|
58 | 58 | import com.oracle.truffle.api.CompilerDirectives; |
59 | 59 | import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; |
60 | 60 | import com.oracle.truffle.api.CompilerDirectives.ValueType; |
| 61 | +import com.oracle.truffle.api.HostCompilerDirectives; |
61 | 62 | import com.oracle.truffle.api.HostCompilerDirectives.InliningCutoff; |
62 | 63 | import com.oracle.truffle.api.RootCallTarget; |
63 | 64 | import com.oracle.truffle.api.bytecode.ContinuationRootNode; |
@@ -461,7 +462,7 @@ private static IndirectCallState enter(VirtualFrame frame, PythonThreadState pyt |
461 | 462 | pythonThreadState.setCaughtException(null); |
462 | 463 | } |
463 | 464 |
|
464 | | - if (curExc == null && info == null) { |
| 465 | + if (HostCompilerDirectives.inInterpreterFastPath() && curExc == null && info == null) { |
465 | 466 | return null; |
466 | 467 | } else { |
467 | 468 | return new IndirectCallState(info, curExc); |
@@ -506,7 +507,9 @@ public static void exit(VirtualFrame frame, PythonThreadState pythonThreadState, |
506 | 507 | if (state.info != null) { |
507 | 508 | pythonThreadState.popTopFrameInfo(); |
508 | 509 | } |
509 | | - pythonThreadState.setCaughtException(state.curExc); |
| 510 | + if (state.curExc != null) { |
| 511 | + pythonThreadState.setCaughtException(state.curExc); |
| 512 | + } |
510 | 513 | } |
511 | 514 | } |
512 | 515 |
|
@@ -566,8 +569,7 @@ public static void exit(PythonThreadState threadState, Object state) { |
566 | 569 | * CalleeContext in its RootNode. If this topframeref was marked as escaped, it'll be |
567 | 570 | * materialized at the latest needed time |
568 | 571 | */ |
569 | | - if (state instanceof IndirectCallState) { |
570 | | - IndirectCallState indirectCallState = (IndirectCallState) state; |
| 572 | + if (state instanceof IndirectCallState indirectCallState) { |
571 | 573 | threadState.setTopFrameInfo(indirectCallState.info); |
572 | 574 | threadState.setCaughtException(indirectCallState.curExc); |
573 | 575 | } else { |
|
0 commit comments