@@ -616,6 +616,7 @@ public final class PBytecodeRootNode extends PRootNode implements BytecodeOSRNod
616
616
private static final byte TRACE_PROFILE_NEW_FRAME = 1 << 1 ;
617
617
private static final byte TRACE_PROFILE_EXISTING_FRAME = 1 << 2 ;
618
618
private static final byte TRACE_PROFILE_SYNC_LOCALS_BACK = 1 << 3 ;
619
+ private static final byte TRACE_PROFILE_DID_JUMP = 1 << 4 ;
619
620
@ CompilationFinal (dimensions = 1 ) byte [] traceProfileData ;
620
621
621
622
@ CompilationFinal private Object osrMetadata ;
@@ -1346,10 +1347,9 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
1346
1347
if (isTracingEnabled (tracingOrProfilingEnabled )) {
1347
1348
final int stackDiff = traceLine (virtualFrame , mutableData , localBC , bci );
1348
1349
if (stackDiff <= 0 ) {
1349
- // The loop must be partially unrollable assuming a certain sequence of bytecode
1350
- // instructions. A jump can happen non-deterministically and thus break this
1351
- // assumption. This can happen repeatedly, so we don't invalidate
1352
- CompilerDirectives .transferToInterpreter ();
1350
+ // See traceLine, if we get here, we should be in the interpreter already, but
1351
+ // SVM can't prove it, so transfer again
1352
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
1353
1353
bci = mutableData .getJumpBci ();
1354
1354
stackTop += stackDiff ;
1355
1355
continue ;
@@ -3050,6 +3050,11 @@ private int traceLine(VirtualFrame virtualFrame, MutableLoopData mutableData, by
3050
3050
invokeTraceFunction (virtualFrame , null , mutableData .getThreadState (this ), mutableData , PythonContext .TraceEvent .LINE ,
3051
3051
mutableData .getPastLine (), true , bci );
3052
3052
if (pyFrame .didJump ()) {
3053
+ enterTraceProfile (bci , TRACE_PROFILE_DID_JUMP );
3054
+ // The loop must be partially unrollable assuming a certain sequence of bytecode
3055
+ // instructions. A jump can happen non-deterministically and thus break this
3056
+ // assumption. This can happen repeatedly, so we don't invalidate
3057
+ CompilerDirectives .transferToInterpreter ();
3053
3058
int newBci = lineToBci (pyFrame .getJumpDestLine ());
3054
3059
mutableData .setPastBci (bci );
3055
3060
if (newBci == BytecodeCodeUnit .LINE_TO_BCI_LINE_AFTER_CODEBLOCK ) {
0 commit comments