@@ -834,9 +834,6 @@ class DwarfLineTable {
834834};
835835
836836// / ClusteredRows represents a collection of debug line table row references.
837- // / Since a Binary function can belong to multiple compilation units (CUs),
838- // / a single MCInst can have multiple debug line table rows associated with it
839- // / from different CUs. This class manages such clustered row references.
840837// /
841838// / MEMORY LAYOUT AND DESIGN:
842839// / This class uses a flexible array member pattern to store all
@@ -846,26 +843,15 @@ class DwarfLineTable {
846843// / +------------------+
847844// / | ClusteredRows | <- Object header (Size + first element)
848845// / | - Size |
849- // / | - Raws (element) | <- First DebugLineTableRowRef element
846+ // / | - Rows (element) | <- First DebugLineTableRowRef element
850847// / +------------------+
851848// / | element[1] | <- Additional DebugLineTableRowRef elements
852849// / | element[2] | stored immediately after the object
853850// / | ... |
854851// / | element[Size-1] |
855852// / +------------------+
856853// /
857- // / PERFORMANCE BENEFITS:
858- // / - Single memory allocation: All elements are stored in one contiguous block,
859- // / eliminating the need for separate heap allocations for the array.
860- // / - No extra dereferencing: Elements are accessed directly via pointer
861- // / arithmetic (beginPtr() + offset) rather than through an additional
862- // / pointer indirection.
863- // / - Cache locality: All elements are guaranteed to be adjacent in memory,
864- // / improving cache performance during iteration.
865- // / - Memory efficiency: No overhead from separate pointer storage or
866- // / fragmented allocations.
867- // /
868- // / The 'Raws' member serves as both the first element storage and the base
854+ // / The 'Rows' member serves as both the first element storage and the base
869855// / address for pointer arithmetic to access subsequent elements.
870856class ClusteredRows {
871857public:
@@ -891,33 +877,33 @@ class ClusteredRows {
891877
892878private:
893879 uint64_t Size;
894- DebugLineTableRowRef Raws ;
880+ DebugLineTableRowRef Rows ;
895881
896882 ClusteredRows (uint64_t Size) : Size(Size) {}
897883 static uint64_t getTotalSize (uint64_t Size) {
898884 assert (Size > 0 && " Size must be greater than 0" );
899885 return sizeof (ClusteredRows) + (Size - 1 ) * sizeof (DebugLineTableRowRef);
900886 }
901887 const DebugLineTableRowRef *beginPtrConst () const {
902- return reinterpret_cast <const DebugLineTableRowRef *>(&Raws );
888+ return reinterpret_cast <const DebugLineTableRowRef *>(&Rows );
903889 }
904890 DebugLineTableRowRef *beginPtr () {
905- return reinterpret_cast <DebugLineTableRowRef *>(&Raws );
891+ return reinterpret_cast <DebugLineTableRowRef *>(&Rows );
906892 }
907893
908- friend class ClasteredRowsContainer ;
894+ friend class ClusteredRowsContainer ;
909895};
910896
911- // / ClasteredRowsContainer manages the lifecycle of ClusteredRows objects.
912- class ClasteredRowsContainer {
897+ // / ClusteredRowsContainer manages the lifecycle of ClusteredRows objects.
898+ class ClusteredRowsContainer {
913899public:
914900 ClusteredRows *createClusteredRows (uint64_t Size) {
915901 auto *CR = new (std::malloc (ClusteredRows::getTotalSize (Size)))
916902 ClusteredRows (Size);
917903 Clusters.push_back (CR);
918904 return CR;
919905 }
920- ~ClasteredRowsContainer () {
906+ ~ClusteredRowsContainer () {
921907 for (auto *CR : Clusters)
922908 std::free (CR);
923909 }
0 commit comments