Skip to content

Commit 6614978

Browse files
committed
Pass BytecodeNode to ExecutionContext#exit so PFrame gets the correct location
1 parent 880e2cf commit 6614978

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,15 +329,17 @@ public static Object doExit(VirtualFrame frame, Object returnValue,
329329
public static final class ExitCalleeContextExceptional {
330330
@Specialization
331331
public static void doPException(VirtualFrame frame, PException pe,
332-
@Bind("$root") PBytecodeDSLRootNode root) {
332+
@Bind("$root") PBytecodeDSLRootNode root,
333+
@Bind("this") Node location) {
333334
pe.notifyAddedTracebackFrame(!root.isPythonInternal());
334-
root.calleeContext.exit(frame, root);
335+
root.calleeContext.exit(frame, root, location);
335336
}
336337

337338
@Specialization
338339
public static void doOther(VirtualFrame frame, AbstractTruffleException ate,
339-
@Bind("$root") PBytecodeDSLRootNode root) {
340-
root.calleeContext.exit(frame, root);
340+
@Bind("$root") PBytecodeDSLRootNode root,
341+
@Bind("this") Node location) {
342+
root.calleeContext.exit(frame, root, location);
341343
}
342344
}
343345

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/ExecutionContext.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ public void enter(VirtualFrame frame) {
253253
}
254254

255255
public void exit(VirtualFrame frame, PRootNode node) {
256+
exit(frame, node, node);
257+
}
258+
259+
public void exit(VirtualFrame frame, PRootNode node, Node location) {
256260
/*
257261
* equivalent to PyPy's ExecutionContext.leave. Note that <tt>got_exception</tt> in
258262
* their code is handled automatically by the Truffle lazy exceptions, so here we only
@@ -261,12 +265,12 @@ public void exit(VirtualFrame frame, PRootNode node) {
261265
PFrame.Reference info = PArguments.getCurrentFrameInfo(frame);
262266
CompilerAsserts.partialEvaluationConstant(node);
263267
if (node.getFrameEscapedProfile().profile(info.isEscaped())) {
264-
exitEscaped(frame, node, info);
268+
exitEscaped(frame, node, location, info);
265269
}
266270
}
267271

268272
@InliningCutoff
269-
private void exitEscaped(VirtualFrame frame, PRootNode node, Reference info) {
273+
private void exitEscaped(VirtualFrame frame, PRootNode node, Node location, Reference info) {
270274
if (!everEscaped) {
271275
CompilerDirectives.transferToInterpreterAndInvalidate();
272276
everEscaped = true;
@@ -294,7 +298,7 @@ private void exitEscaped(VirtualFrame frame, PRootNode node, Reference info) {
294298
}
295299

296300
// force the frame so that it can be accessed later
297-
ensureMaterializeNode().execute(frame, node, false, true);
301+
ensureMaterializeNode().execute(frame, location, false, true);
298302
// if this frame escaped we must ensure that also f_back does
299303
callerInfo.markAsEscaped();
300304
info.setBackref(callerInfo);

0 commit comments

Comments
 (0)