Skip to content

Commit cbee071

Browse files
committed
Move all constants defined by the DWARF spec into an inheritable, reusable interface
1 parent 9c893ed commit cbee071

13 files changed

+970
-905
lines changed

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfARangesSectionImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@
4242
*/
4343
public class DwarfARangesSectionImpl extends DwarfSectionImpl {
4444
/* Headers have a fixed size but must align up to 2 * address size. */
45-
private static final int DW_AR_HEADER_SIZE = 12;
46-
private static final int DW_AR_HEADER_PAD_SIZE = 4;
45+
private static final int AR_HEADER_SIZE = 12;
46+
private static final int AR_HEADER_PAD_SIZE = 4;
4747

4848
public DwarfARangesSectionImpl(DwarfDebugInfo dwarfSections) {
4949
super(dwarfSections);
5050
}
5151

5252
@Override
5353
public String getSectionName() {
54-
return DwarfDebugInfo.DW_ARANGES_SECTION_NAME;
54+
return DW_ARANGES_SECTION_NAME;
5555
}
5656

5757
@Override
@@ -104,9 +104,9 @@ public void createContent() {
104104
private static int entrySize(int methodCount) {
105105
int size = 0;
106106
// allow for header data
107-
size += DW_AR_HEADER_SIZE;
107+
size += AR_HEADER_SIZE;
108108
// align to 2 * address size.
109-
size += DW_AR_HEADER_PAD_SIZE;
109+
size += AR_HEADER_PAD_SIZE;
110110
// count 16 bytes for each deopt compiled method
111111
size += methodCount * (2 * 8);
112112
// allow for two trailing zeroes to terminate
@@ -161,17 +161,17 @@ private int writeHeader(int cuIndex, byte[] buffer, int p) {
161161
// write dummy length for now
162162
pos = writeInt(0, buffer, pos);
163163
/* DWARF version is always 2. */
164-
pos = writeShort(DwarfDebugInfo.DW_VERSION_2, buffer, pos);
164+
pos = writeShort(DW_VERSION_2, buffer, pos);
165165
pos = writeInfoSectionOffset(cuIndex, buffer, pos);
166166
/* Address size is always 8. */
167167
pos = writeByte((byte) 8, buffer, pos);
168168
/* Segment size is always 0. */
169169
pos = writeByte((byte) 0, buffer, pos);
170-
assert (pos - p) == DW_AR_HEADER_SIZE;
170+
assert (pos - p) == AR_HEADER_SIZE;
171171
/*
172172
* Align to 2 * address size.
173173
*/
174-
for (int i = 0; i < DW_AR_HEADER_PAD_SIZE; i++) {
174+
for (int i = 0; i < AR_HEADER_PAD_SIZE; i++) {
175175
pos = writeByte((byte) 0, buffer, pos);
176176
}
177177
return pos;
@@ -189,7 +189,7 @@ int writeARange(DebugContext context, CompiledMethodEntry compiledMethod, byte[]
189189
/*
190190
* The debug_aranges section depends on debug_frame section.
191191
*/
192-
private static final String TARGET_SECTION_NAME = DwarfDebugInfo.DW_FRAME_SECTION_NAME;
192+
private static final String TARGET_SECTION_NAME = DW_FRAME_SECTION_NAME;
193193

194194
@Override
195195
public String targetSectionName() {

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/elf/dwarf/DwarfAbbrevSectionImpl.java

Lines changed: 399 additions & 399 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)