Skip to content

Commit b7928b0

Browse files
committed
Add missing TruffleBoundary
1 parent bb29775 commit b7928b0

File tree

1 file changed

+13
-6
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/traceback

1 file changed

+13
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/traceback/TracebackBuiltins.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
4848
import com.oracle.graal.python.runtime.exception.PException;
4949
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
50+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
5051
import com.oracle.truffle.api.TruffleStackTraceElement;
5152
import com.oracle.truffle.api.dsl.Cached;
5253
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
@@ -122,12 +123,7 @@ void doMaterialize(PTraceback tb,
122123
boolean skipFirst = pException.shouldHideLocation();
123124
for (TruffleStackTraceElement element : pException.getTruffleStackTrace()) {
124125
if (pException.shouldCutOffTraceback(element)) {
125-
if (element.getLocation() != null) {
126-
SourceSection sourceSection = element.getLocation().getEncapsulatingSourceSection();
127-
if (sourceSection != null) {
128-
lineno = sourceSection.getStartLine();
129-
}
130-
}
126+
lineno = getLineno(element);
131127
break;
132128
}
133129
if (skipFirst) {
@@ -165,6 +161,17 @@ void doMaterialize(PTraceback tb,
165161
tb.markMaterialized(); // Marks the Truffle stacktrace part as materialized
166162
}
167163

164+
@TruffleBoundary
165+
private static int getLineno(TruffleStackTraceElement element) {
166+
if (element.getLocation() != null) {
167+
SourceSection sourceSection = element.getLocation().getEncapsulatingSourceSection();
168+
if (sourceSection != null) {
169+
return sourceSection.getStartLine();
170+
}
171+
}
172+
return -2;
173+
}
174+
168175
private static PFrame materializeFrame(TruffleStackTraceElement element, MaterializeFrameNode materializeFrameNode) {
169176
// create the PFrame and refresh frame values
170177
return materializeFrameNode.execute(null, element.getLocation(), false, true, element.getFrame());

0 commit comments

Comments
 (0)