Skip to content

Commit 58a6c99

Browse files
committed
Augment Range with info for nested inlining
1 parent 8566dfe commit 58a6c99

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
151151
String methodNameAtLine = debugLineInfo.methodName();
152152
String paramNamesAtLine = debugLineInfo.paramNames();
153153
String returnTypeNameAtLine = debugLineInfo.returnTypeName();
154+
boolean isInlined = debugLineInfo.getCaller() != null;
154155
int loAtLine = lo + debugLineInfo.addressLo();
155156
int hiAtLine = lo + debugLineInfo.addressHi();
156157
int line = debugLineInfo.line();
@@ -159,7 +160,9 @@ public void installDebugInfo(DebugInfoProvider debugInfoProvider) {
159160
* Record all subranges even if they have no line or file so we at least get a
160161
* symbol for them.
161162
*/
162-
Range subRange = new Range(fileNameAtLine, filePathAtLine, cachePathAtLine, classNameAtLine, methodNameAtLine, paramNamesAtLine, returnTypeNameAtLine, stringTable, loAtLine, hiAtLine, line, primaryRange);
163+
Range subRange = new Range(fileNameAtLine, filePathAtLine, cachePathAtLine, classNameAtLine,
164+
methodNameAtLine, paramNamesAtLine, returnTypeNameAtLine, stringTable, loAtLine, hiAtLine,
165+
line, isInlined, primaryRange, false, null);
163166
addSubRange(primaryRange, subRange);
164167
try (DebugContext.Scope s = debugContext.scope("Subranges")) {
165168
debugContext.log(DebugContext.VERBOSE_LEVEL, "SubRange %s.%s %s %s:%d 0x%x, 0x%x]", classNameAtLine, methodNameAtLine, filePathAtLine, fileNameAtLine, line, loAtLine, hiAtLine);

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737

3838
public class Range {
3939
private final String cachePath;
40+
private final Range caller;
4041
private String fileName;
4142
private Path filePath;
4243
private String className;
@@ -48,6 +49,8 @@ public class Range {
4849
private int hi;
4950
private int line;
5051
private boolean isDeoptTarget;
52+
private final boolean isInlined;
53+
private final boolean withChildren;
5154
/*
5255
* This is null for a primary range.
5356
*/
@@ -58,22 +61,22 @@ public class Range {
5861
*/
5962
public Range(String fileName, Path filePath, Path cachePath, String className, String methodName, String paramNames, String returnTypeName, StringTable stringTable, int lo, int hi, int line,
6063
boolean isDeoptTarget) {
61-
this(fileName, filePath, cachePath, className, methodName, paramNames, returnTypeName, stringTable, lo, hi, line, isDeoptTarget, null);
64+
this(fileName, filePath, cachePath, className, methodName, paramNames, returnTypeName, stringTable, lo, hi, line, isDeoptTarget, false, null, false, null);
6265
}
6366

6467
/*
6568
* Create a secondary range.
6669
*/
6770
public Range(String fileName, Path filePath, Path cachePath, String className, String methodName, String paramNames, String returnTypeName, StringTable stringTable, int lo, int hi, int line,
68-
Range primary) {
69-
this(fileName, filePath, cachePath, className, methodName, paramNames, returnTypeName, stringTable, lo, hi, line, false, primary);
71+
boolean isInline, Range primary, boolean withChildren, Range caller) {
72+
this(fileName, filePath, cachePath, className, methodName, paramNames, returnTypeName, stringTable, lo, hi, line, false, isInline, primary, withChildren, caller);
7073
}
7174

7275
/*
7376
* Create a primary or secondary range.
7477
*/
7578
private Range(String fileName, Path filePath, Path cachePath, String className, String methodName, String paramNames, String returnTypeName, StringTable stringTable, int lo, int hi, int line,
76-
boolean isDeoptTarget, Range primary) {
79+
boolean isDeoptTarget, boolean isInline, Range primary, boolean withChildren, Range caller) {
7780
/*
7881
* Currently file name and full method name need to go into the debug_str section other
7982
* strings just need to be deduplicated to save space.
@@ -90,7 +93,10 @@ private Range(String fileName, Path filePath, Path cachePath, String className,
9093
this.hi = hi;
9194
this.line = line;
9295
this.isDeoptTarget = isDeoptTarget;
96+
this.isInlined = isInline;
9397
this.primary = primary;
98+
this.withChildren = withChildren;
99+
this.caller = caller;
94100
}
95101

96102
public boolean contains(Range other) {
@@ -180,4 +186,16 @@ private String constructClassAndMethodNameWithParams() {
180186
public String getCachePath() {
181187
return cachePath;
182188
}
189+
190+
public boolean isInlined() {
191+
return isInlined;
192+
}
193+
194+
public boolean withChildren() {
195+
return withChildren;
196+
}
197+
198+
public Range getCaller() {
199+
return caller;
200+
}
183201
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,10 @@ private int writeLineNumberTable(DebugContext context, ClassEntry classEntry, by
509509
* Now write a row for each subrange lo and hi.
510510
*/
511511
for (Range subrange : primaryEntry.getSubranges()) {
512+
if (subrange.withChildren()) {
513+
/* skip caller subranges */
514+
continue;
515+
}
512516
assert subrange.getLo() >= primaryRange.getLo();
513517
assert subrange.getHi() <= primaryRange.getHi();
514518
FileEntry subFileEntry = primaryEntry.getSubrangeFileEntry(subrange);

0 commit comments

Comments
 (0)