Skip to content

Commit 9699fb7

Browse files
committed
Ensure IndirectCallState can be escape analyzed
1 parent 329c973 commit 9699fb7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
import com.oracle.truffle.api.CompilerDirectives;
5959
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
6060
import com.oracle.truffle.api.CompilerDirectives.ValueType;
61+
import com.oracle.truffle.api.HostCompilerDirectives;
6162
import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff;
6263
import com.oracle.truffle.api.RootCallTarget;
6364
import com.oracle.truffle.api.bytecode.ContinuationRootNode;
@@ -461,7 +462,7 @@ private static IndirectCallState enter(VirtualFrame frame, PythonThreadState pyt
461462
pythonThreadState.setCaughtException(null);
462463
}
463464

464-
if (curExc == null && info == null) {
465+
if (HostCompilerDirectives.inInterpreterFastPath() && curExc == null && info == null) {
465466
return null;
466467
} else {
467468
return new IndirectCallState(info, curExc);
@@ -506,7 +507,9 @@ public static void exit(VirtualFrame frame, PythonThreadState pythonThreadState,
506507
if (state.info != null) {
507508
pythonThreadState.popTopFrameInfo();
508509
}
509-
pythonThreadState.setCaughtException(state.curExc);
510+
if (state.curExc != null) {
511+
pythonThreadState.setCaughtException(state.curExc);
512+
}
510513
}
511514
}
512515

@@ -566,8 +569,7 @@ public static void exit(PythonThreadState threadState, Object state) {
566569
* CalleeContext in its RootNode. If this topframeref was marked as escaped, it'll be
567570
* materialized at the latest needed time
568571
*/
569-
if (state instanceof IndirectCallState) {
570-
IndirectCallState indirectCallState = (IndirectCallState) state;
572+
if (state instanceof IndirectCallState indirectCallState) {
571573
threadState.setTopFrameInfo(indirectCallState.info);
572574
threadState.setCaughtException(indirectCallState.curExc);
573575
} else {

0 commit comments

Comments
 (0)