Skip to content

Commit f53b0ce

Browse files
committed
[GR-67184] Ensure bci is constant for infrequentBytecodes
PullRequest: graalpython/3884
2 parents 740cb40 + 5f4b4b5 commit f53b0ce

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode/PBytecodeRootNode.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2305,12 +2305,21 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
23052305
bci++;
23062306
continue;
23072307
}
2308-
default: {
2309-
long r = infrequentBytecodes(virtualFrame, localFrame, bc, bci, stackTop, beginBci, oparg, localBC, globals, locals, localNames, localNodes, bciSlot, localCelloffset,
2308+
case OpCodesConstants.LOAD_FROM_DICT_OR_DEREF:
2309+
case OpCodesConstants.LOAD_FROM_DICT_OR_GLOBALS:
2310+
case OpCodesConstants.MAKE_TYPE_PARAM:
2311+
stackTop = infrequentBytecodes(virtualFrame, localFrame, bc, bci, stackTop, beginBci, oparg, localBC, globals, locals, localNames, localNodes, bciSlot, localCelloffset,
23102312
useCachedNodes);
2311-
stackTop = (int) (r >> 32);
2312-
bci = (int) r;
2313-
}
2313+
bci++;
2314+
break;
2315+
case OpCodesConstants.LOAD_LOCALS:
2316+
case OpCodesConstants.MAKE_TYPE_ALIAS:
2317+
case OpCodesConstants.MAKE_GENERIC:
2318+
stackTop = infrequentBytecodes(virtualFrame, localFrame, bc, bci, stackTop, beginBci, oparg, localBC, globals, locals, localNames, localNodes, bciSlot, localCelloffset,
2319+
useCachedNodes);
2320+
break;
2321+
default:
2322+
throw raiseUnknownBytecodeError(bc);
23142323
}
23152324
// prepare next loop
23162325
oparg = 0;
@@ -2400,7 +2409,7 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
24002409
}
24012410
}
24022411

2403-
private long infrequentBytecodes(VirtualFrame virtualFrame, Frame localFrame, byte bc, int bci, int stackTop, int beginBci, int oparg, byte[] localBC, Object globals, Object locals,
2412+
private int infrequentBytecodes(VirtualFrame virtualFrame, Frame localFrame, byte bc, int bci, int stackTop, int beginBci, int oparg, byte[] localBC, Object globals, Object locals,
24042413
TruffleString[] localNames, Node[] localNodes, int bciSlot, int localCelloffset, boolean useCachedNodes) {
24052414
switch (bc) {
24062415
case OpCodesConstants.LOAD_LOCALS: {
@@ -2443,7 +2452,7 @@ private long infrequentBytecodes(VirtualFrame virtualFrame, Frame localFrame, by
24432452
throw raiseUnknownBytecodeError(bc);
24442453

24452454
}
2446-
return (long) stackTop << 32 | bci;
2455+
return stackTop;
24472456
}
24482457

24492458
@BytecodeInterpreterSwitch

0 commit comments

Comments
 (0)