Skip to content

Commit 2c1f22c

Browse files
committed
Refactor: Introduce DebugRangeInfo interface
1 parent 9aa918b commit 2c1f22c

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/ClassEntry.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugFrameSizeChange;
4141
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugInstanceTypeInfo;
4242
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugMethodInfo;
43+
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugRangeInfo;
4344
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo;
4445
import com.oracle.objectfile.debuginfo.DebugInfoProvider.DebugTypeInfo.DebugTypeKind;
4546

@@ -99,7 +100,8 @@ public ClassEntry(String className, FileEntry fileEntry, int size) {
99100
this.fileEntry = fileEntry;
100101
// methods is a sorted list and we want to be able to add more elements to it while keeping
101102
// it sorted,
102-
// so a LinkedList seems more appropriate than an ArrayList. (see getMethodEntry)
103+
// so a LinkedList seems more appropriate than an ArrayList.
104+
// (see ensureMethodEntryForDebugRangeInfo)
103105
this.methods = new LinkedList<>();
104106
this.primaryEntries = new ArrayList<>();
105107
this.primaryIndex = new HashMap<>();
@@ -345,11 +347,11 @@ public ClassEntry getSuperClass() {
345347
return superClass;
346348
}
347349

348-
public MethodEntry getMethodEntry(DebugMethodInfo debugMethodInfo, DebugInfoBase debugInfoBase, DebugContext debugContext) {
350+
public MethodEntry ensureMethodEntryForDebugRangeInfo(DebugRangeInfo debugRangeInfo, DebugInfoBase debugInfoBase, DebugContext debugContext) {
349351
assert listIsSorted(methods);
350-
String methodName = debugInfoBase.uniqueDebugString(debugMethodInfo.name());
351-
String paramSignature = debugMethodInfo.paramSignature();
352-
String returnTypeName = debugMethodInfo.valueType();
352+
String methodName = debugInfoBase.uniqueDebugString(debugRangeInfo.name());
353+
String paramSignature = debugRangeInfo.paramSignature();
354+
String returnTypeName = debugRangeInfo.valueType();
353355
ListIterator<MethodEntry> methodIterator = methods.listIterator();
354356
while (methodIterator.hasNext()) {
355357
MethodEntry methodEntry = methodIterator.next();
@@ -362,7 +364,7 @@ public MethodEntry getMethodEntry(DebugMethodInfo debugMethodInfo, DebugInfoBase
362364
break;
363365
}
364366
}
365-
MethodEntry newMethodEntry = processMethod(debugMethodInfo, debugInfoBase, debugContext, true);
367+
MethodEntry newMethodEntry = processMethod(debugRangeInfo, debugInfoBase, debugContext, true);
366368
methodIterator.add(newMethodEntry);
367369
return newMethodEntry;
368370
}

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debugentry/DebugInfoBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
245245

246246
/* Search for a method defining this primary range. */
247247
ClassEntry classEntry = ensureClassEntry(className);
248-
MethodEntry methodEntry = classEntry.getMethodEntry(debugCodeInfo, this, debugContext);
248+
MethodEntry methodEntry = classEntry.ensureMethodEntryForDebugRangeInfo(debugCodeInfo, this, debugContext);
249249
Range primaryRange = new Range(stringTable, methodEntry, lo, hi, primaryLine);
250250
debugContext.log(DebugContext.INFO_LEVEL, "PrimaryRange %s.%s %s %s:%d [0x%x, 0x%x]", className, methodName, filePath, fileName, primaryLine, lo, hi);
251251
classEntry.indexPrimary(primaryRange, debugCodeInfo.getFrameSizeChanges(), debugCodeInfo.getFrameSize());
@@ -262,7 +262,7 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
262262
* symbol for them and don't see a break in the address range.
263263
*/
264264
ClassEntry subClassEntry = ensureClassEntry(classNameAtLine);
265-
MethodEntry subMethodEntry = subClassEntry.getMethodEntry(debugLineInfo, this, debugContext);
265+
MethodEntry subMethodEntry = subClassEntry.ensureMethodEntryForDebugRangeInfo(debugLineInfo, this, debugContext);
266266
Range subRange = new Range(stringTable, subMethodEntry, loAtLine, hiAtLine, line, primaryRange);
267267
classEntry.indexSubRange(subRange);
268268
try (DebugContext.Scope s = debugContext.scope("Subranges")) {

substratevm/src/com.oracle.objectfile/src/com/oracle/objectfile/debuginfo/DebugInfoProvider.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,17 @@ interface DebugMethodInfo extends DebugMemberInfo {
227227
boolean isDeoptTarget();
228228
}
229229

230+
/**
231+
* Access details of a compiled method producing the code in a specific
232+
* {@link com.oracle.objectfile.debugentry.Range}.
233+
*/
234+
interface DebugRangeInfo extends DebugMethodInfo {
235+
}
236+
230237
/**
231238
* Access details of a specific compiled method.
232239
*/
233-
interface DebugCodeInfo extends DebugMethodInfo {
240+
interface DebugCodeInfo extends DebugRangeInfo {
234241
void debugContext(Consumer<DebugContext> action);
235242

236243
/**
@@ -291,7 +298,7 @@ interface DebugDataInfo {
291298
* Access details of code generated for a specific outer or inlined method at a given line
292299
* number.
293300
*/
294-
interface DebugLineInfo extends DebugMethodInfo {
301+
interface DebugLineInfo extends DebugRangeInfo {
295302
/**
296303
* @return the lowest address containing code generated for an outer or inlined code segment
297304
* reported at this line represented as an offset into the code segment.

0 commit comments

Comments
 (0)