143
143
* <li><code>abbrev_code == CLASS_LAYOUT_3, tag == DW_TAG_class_type, parent = CLASS_UNIT_1/2</code>
144
144
* - Skeleton Java instance type structure definition for compilation units
145
145
*
146
- * <li><code>abbrev_code == TYPE_POINTER , tag == DW_TAG_pointer_type, parent = TYPE_UNIT</code> - Is
147
- * either of
146
+ * <li><code>abbrev_code == TYPE_POINTER_SIG , tag == DW_TAG_pointer_type, parent = TYPE_UNIT</code>
147
+ * - Points to a type using its type signature and is either of
148
148
* <ul>
149
149
* <li>Java instance ref type</li>
150
150
* <li>Java interface ref type</li>
151
151
* <li>Java array ref type</li>
152
- * <li>Java indirect ref type</li> - used to type indirect oops that encode the address of an
152
+ * </ul>
153
+ *
154
+ * <li><code>abbrev_code == TYPE_POINTER, tag == DW_TAG_pointer_type, parent = TYPE_UNIT</code> -
155
+ * Points to a type using a 4 byte offset and is used for
156
+ * <ul>
157
+ * <li>Java compressed ref type</li> - used to type compressed oops that encode the address of an
153
158
* object, whether by adding tag bits or representing the address as an offset from some base
154
159
* address. these are used to type object references stored in static and instance fields. They are
155
160
* not needed when typing local vars and parameters held in registers or on the stack as they appear
174
179
* <li><code>abbrev_code == INTERFACE_LAYOUT, tag == DW_TAG_union_type, parent = TYPE_UNIT</code> -
175
180
* Java array type structure definition
176
181
*
177
- * <li><code>abbrev_code == INDIRECT_LAYOUT , tag == DW_TAG_class_type, parent = TYPE_UNIT</code> -
182
+ * <li><code>abbrev_code == COMPRESSED_LAYOUT , tag == DW_TAG_class_type, parent = TYPE_UNIT</code> -
178
183
* wrapper layout attaches address rewriting logic to the layout types that it wraps using a
179
184
* <code>data_location</code> attribute
180
185
*
386
391
* which a debugger can use to decode the oop pointer to a raw address. n.b. this only applies in
387
392
* the case where normal oop references are raw addresses (no compressed oops, no isolates). If a
388
393
* heapbase register is being used then decoding logic is encoded for both normal classes and for
389
- * <code>java.lang.Class</code> using an indirect layout (see below).
394
+ * <code>java.lang.Class</code> using a compressed layout (see below).
390
395
*
391
396
* <ul>
392
397
*
403
408
*
404
409
* <li><code>DW_AT_decl_file : ... DW_FORM_data1/2</code> only for CLASS_LAYOUT_1/2
405
410
*
406
- * <li><code>DW_AT_data_location : ... DW_FORM_expr_loc</code> n.b. only for CLASS_LAYOUT_2
411
+ * <li><code>DW_AT_data_location : ... DW_FORM_expr_loc</code> only for CLASS_LAYOUT_2 - contains
412
+ * the decoding logic for the layout of <code>java.lang.Class</code> if no compressed layout is
413
+ * available
407
414
*
408
415
* </ul>
409
416
*
537
544
*
538
545
* </ul>
539
546
*
540
- * Indirect Instance Class Structure: The level 1 class layout DIE may be followed by a level 1
541
- * <code>INDIRECT_LAYOUT </code> DIE. The indirect layout is only needed when a heapbase register is
542
- * in use (isolates or compressed oops are enabled). This means that oop fields will hold encoded
543
- * oops. The indirect layout defines an empty wrapper class which declares the previous layout as
547
+ * Compressed Instance Class Structure: The level 1 class layout DIE may be followed by a level 1
548
+ * <code>COMPRESSED_LAYOUT </code> DIE. The compressed layout is only needed when a heapbase register
549
+ * is in use (isolates or compressed oops are enabled). This means that oop fields will hold encoded
550
+ * oops. The compressed layout defines an empty wrapper class which declares the previous layout as
544
551
* its super class. This wrapper type also supplies a <code>data_location</code> attribute, ensuring
545
- * that indirect pointers to the class (see next item) are translated to raw addresses. The name of
546
- * the indirect type is constructed by prefixing the class name with
547
- * <code>DwarfDebugInfo.INDIRECT_PREFIX </code>. This DIE has only one child DIE with type
548
- * SUPER_REFERENCE (see above). This effectively embeds the standard layout type in the indirect
549
- * layout as a type compatible referent for the Java oop. The size of the indirect layout is the
552
+ * that compressed pointers to the class (see next item) are translated to raw addresses. The name
553
+ * of the compressed type is constructed by prefixing the class name with
554
+ * <code>DwarfDebugInfo.COMPRESSED_PREFIX </code>. This DIE has only one child DIE with type
555
+ * SUPER_REFERENCE (see above). This effectively embeds the standard layout type in the compressed
556
+ * layout as a type compatible referent for the Java oop. The size of the compressed layout is the
550
557
* same as the size of the class layout.
551
558
*
552
559
* <ul>
553
560
*
554
- * <li><code>abbrev_code == INDIRECT_LAYOUT , tag == DW_TAG_class_type, has_children</code>
561
+ * <li><code>abbrev_code == COMPRESSED_LAYOUT , tag == DW_TAG_class_type, has_children</code>
555
562
*
556
563
* <li><code>DW_AT_name : ........ DW_FORM_strp</code>
557
564
*
562
569
* </ul>
563
570
*
564
571
* Instance Class Reference Types: The level 1 <code>CLASS_LAYOUT</code> and
565
- * <code>INDIRECT_LAYOUT </code> DIEs are followed by level 1 DIEs defining pointers to the
572
+ * <code>COMPRESSED_LAYOUT </code> DIEs are followed by level 1 DIEs defining pointers to the
566
573
* respective class layouts. A <code>TYPE_POINTER</code> DIE defines a pointer type for the
567
574
* <code>CLASS_LAYOUT</code> type and is used to type pointers which directly address an instance.
568
575
* It is used to type local and parameter var references whether located in a register or on the
569
576
* stack. It may be followed by another <code>TYPE_POINTER</code> DIE which defines a pointer type
570
- * for the class's <code>INDIRECT_LAYOUT </code> type. This is used to type references to instances
577
+ * for the class's <code>COMPRESSED_LAYOUT </code> type. This is used to type references to instances
571
578
* of the class located in a static or instance field. These latter references require address
572
579
* translation by masking off tag bits and/or rebasing from an offset to a raw address. The logic
573
580
* for this translation is encoded in the <code>data_location</code> attribute of the corresponding
574
- * <code>INDIRECT_LAYOUT </code> DIE.
581
+ * <code>COMPRESSED_LAYOUT </code> DIE.
575
582
*
576
583
* <ul>
577
584
*
767
774
*
768
775
* </ul>
769
776
*
770
- * The immediately following DIE is an INDIRECT_LAYOUT (see above) that wraps the array layout as
777
+ * The immediately following DIE is an COMPRESSED_LAYOUT (see above) that wraps the array layout as
771
778
* its super type (just as with class layouts). The wrapper type supplies a data_location attribute,
772
- * allowing indirect pointers to the array to be translated to raw addresses. The name of the
773
- * indirect array type is constructed by prefixing the array name with
774
- * <code>DwarfDebugInfo.INDIRECT_PREFIX </code>. This DIE has only one child DIE with type
779
+ * allowing compressed pointers to the array to be translated to raw addresses. The name of the
780
+ * compressed array type is constructed by prefixing the array name with
781
+ * <code>DwarfDebugInfo.COMPRESSED_PREFIX </code>. This DIE has only one child DIE with type
775
782
* <code>SUPER_REFERENCE</code> (see above). The latter references the array layout DIE, effectively
776
- * embedding the standard array layout type in the indirect layout. The size of the indirect layout
777
- * is the same as the size of the array layout.
783
+ * embedding the standard array layout type in the compressed layout. The size of the compressed
784
+ * layout is the same as the size of the array layout.
778
785
* <p>
779
786
*
780
787
* The third and fourth DIEs define array reference types as a pointers to the underlying structure
781
788
* layout types. As with classes, there is a TYPE_POINTER type for raw address references used to
782
- * type local and param vars and a (indirect ) TYPE_POINTER type (see above) for array references
789
+ * type local and param vars and a (compressed ) TYPE_POINTER type (see above) for array references
783
790
* stored in static and instance fields.
784
791
*
785
792
* n.b. the name used in the ARRAY_LAYOUT DIE is the Java array name. This is deliberately
821
828
*
822
829
* </ul>
823
830
*
824
- * A second level 1 DIE provides an indirect layout that wraps the interface layout as its super
831
+ * A second level 1 DIE provides a compressed layout that wraps the interface layout as its super
825
832
* type (just as with class layouts). The wrapper type supplies a <code>data_location</code>
826
- * attribute, allowing indirect pointers to the interface to be translated to raw addresses. The
827
- * name of the indirect interface type is constructed by prefixing the interface name with
828
- * <code>DwarfDebugInfo.INDIRECT_PREFIX </code>. This DIE has only one child DIE with type
833
+ * attribute, allowing compressed pointers to the interface to be translated to raw addresses. The
834
+ * name of the compressed interface type is constructed by prefixing the interface name with
835
+ * <code>DwarfDebugInfo.COMPRESSED_PREFIX </code>. This DIE has only one child DIE with type
829
836
* <code>sup[er_reference</code> (see above). The latter references the interface layout DIE,
830
- * effectively embedding the standard interface layout type in the indirect layout. The size of the
831
- * indirect layout is the same as the size of the interface layout.
837
+ * effectively embedding the standard interface layout type in the compressed layout. The size of
838
+ * the compressed layout is the same as the size of the interface layout.
832
839
*
833
840
* The third and fourth DIEs define interface reference types as a pointers to the underlying
834
841
* structure layout types. As with classes, there is an TYPE_POINTER type for raw address references
835
- * used to type local and param vars and an (indirect ) TYPE_POINTER type (see above) for interface
842
+ * used to type local and param vars and a (compressed ) TYPE_POINTER type (see above) for interface
836
843
* references stored in static and instance fields.
837
844
*
838
845
* A second level 1 defines a pointer to this layout type.
@@ -918,7 +925,7 @@ public int writeAbbrevs(DebugContext context, byte[] buffer, int p) {
918
925
pos = writeNamespaceAbbrev (context , buffer , pos );
919
926
920
927
pos = writeClassLayoutAbbrevs (context , buffer , pos );
921
- pos = writeClassReferenceAbbrev (context , buffer , pos );
928
+ pos = writeClassReferenceAbbrevs (context , buffer , pos );
922
929
pos = writeMethodDeclarationAbbrevs (context , buffer , pos );
923
930
pos = writeFieldDeclarationAbbrevs (context , buffer , pos );
924
931
@@ -943,16 +950,16 @@ public int writeAbbrevs(DebugContext context, byte[] buffer, int p) {
943
950
pos = writeInlinedSubroutineAbbrev (buffer , pos , true );
944
951
945
952
/*
946
- * if we address rebasing is required then then we need to use indirect layout types
947
- * supplied with a suitable data_location attribute and indirect pointer types to ensure
948
- * that gdb converts offsets embedded in static or instance fields to raw pointers.
949
- * Transformed addresses are typed using pointers to the underlying layout.
953
+ * if we address rebasing is required then we need to use compressed layout types supplied
954
+ * with a suitable data_location attribute and compressed pointer types to ensure that gdb
955
+ * converts offsets embedded in static or instance fields to raw pointers. Transformed
956
+ * addresses are typed using pointers to the underlying layout.
950
957
*
951
- * if address rebasing is not required then we a data_location attribute on the layout type
958
+ * if address rebasing is not required then a data_location attribute on the layout type
952
959
* will ensure that address tag bits are removed.
953
960
*/
954
961
if (dwarfSections .useHeapBase ()) {
955
- pos = writeIndirectLayoutAbbrev (context , buffer , pos );
962
+ pos = writeCompressedLayoutAbbrev (context , buffer , pos );
956
963
}
957
964
958
965
pos = writeParameterDeclarationAbbrevs (context , buffer , pos );
@@ -1152,17 +1159,25 @@ private int writeClassLayoutAbbrev(@SuppressWarnings("unused") DebugContext cont
1152
1159
return pos ;
1153
1160
}
1154
1161
1155
- private int writeClassReferenceAbbrev (@ SuppressWarnings ("unused" ) DebugContext context , byte [] buffer , int p ) {
1162
+ private int writeClassReferenceAbbrevs (@ SuppressWarnings ("unused" ) DebugContext context , byte [] buffer , int p ) {
1163
+ int pos = p ;
1164
+ pos = writeClassReferenceAbbrev (context , AbbrevCode .TYPE_POINTER_SIG , buffer , pos );
1165
+ pos = writeClassReferenceAbbrev (context , AbbrevCode .TYPE_POINTER , buffer , pos );
1166
+ return pos ;
1167
+ }
1168
+
1169
+ private int writeClassReferenceAbbrev (@ SuppressWarnings ("unused" ) DebugContext context , AbbrevCode abbrevCode , byte [] buffer , int p ) {
1156
1170
int pos = p ;
1157
1171
1158
1172
/* A pointer to the class struct type. */
1159
- pos = writeAbbrevCode (AbbrevCode . TYPE_POINTER , buffer , pos );
1173
+ pos = writeAbbrevCode (abbrevCode , buffer , pos );
1160
1174
pos = writeTag (DwarfTag .DW_TAG_pointer_type , buffer , pos );
1161
1175
pos = writeHasChildren (DwarfHasChildren .DW_CHILDREN_no , buffer , pos );
1162
1176
pos = writeAttrType (DwarfAttribute .DW_AT_byte_size , buffer , pos );
1163
1177
pos = writeAttrForm (DwarfForm .DW_FORM_data1 , buffer , pos );
1164
1178
pos = writeAttrType (DwarfAttribute .DW_AT_type , buffer , pos );
1165
- pos = writeAttrForm (DwarfForm .DW_FORM_ref_sig8 , buffer , pos );
1179
+ pos = writeAttrForm (abbrevCode == AbbrevCode .TYPE_POINTER_SIG ? DwarfForm .DW_FORM_ref_sig8 : DwarfForm .DW_FORM_ref4 , buffer , pos );
1180
+
1166
1181
/*
1167
1182
* Now terminate.
1168
1183
*/
@@ -1563,18 +1578,18 @@ private int writeSuperReferenceAbbrev(@SuppressWarnings("unused") DebugContext c
1563
1578
return pos ;
1564
1579
}
1565
1580
1566
- private int writeIndirectLayoutAbbrev (@ SuppressWarnings ("unused" ) DebugContext context , byte [] buffer , int p ) {
1581
+ private int writeCompressedLayoutAbbrev (@ SuppressWarnings ("unused" ) DebugContext context , byte [] buffer , int p ) {
1567
1582
int pos = p ;
1568
1583
1569
1584
/*
1570
- * oops are not necessarily raw addresses. they may contains pointer bits or be offsets from
1571
- * a base register. An indirect layout wraps a standard layout adding a data_location that
1572
- * translates indirect an oop to a raw address . It is used as the base for an indirect
1585
+ * oops are not necessarily raw addresses. They may contain pointer bits or be offsets from
1586
+ * a base register. A compressed layout wraps a standard layout adding a data_location that
1587
+ * translates compressed oops to a raw addresses . It is used as the base for a compressed
1573
1588
* pointer type that is used to type values that need translation to a raw address i.e.
1574
1589
* values stored in static and instance fields.
1575
1590
*/
1576
- /* the type for an indirect layout that includes address translation info */
1577
- pos = writeAbbrevCode (AbbrevCode .INDIRECT_LAYOUT , buffer , pos );
1591
+ /* The type for a compressed layout that includes address translation info */
1592
+ pos = writeAbbrevCode (AbbrevCode .COMPRESSED_LAYOUT , buffer , pos );
1578
1593
pos = writeTag (DwarfTag .DW_TAG_class_type , buffer , pos );
1579
1594
pos = writeHasChildren (DwarfHasChildren .DW_CHILDREN_yes , buffer , pos );
1580
1595
pos = writeAttrType (DwarfAttribute .DW_AT_name , buffer , pos );
0 commit comments