Skip to content

Commit c32c21d

Browse files
committed
Move a few bytecodes to infrequent section to reduce method size
1 parent bf60412 commit c32c21d

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1872,11 +1872,6 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
18721872
stackTop = bytecodeStoreSubscrSeqIDO(virtualFrame, stackTop, beginBci, localNodes, useCachedNodes);
18731873
break;
18741874
}
1875-
case OpCodesConstants.DELETE_SUBSCR: {
1876-
setCurrentBci(virtualFrame, bciSlot, bci);
1877-
stackTop = bytecodeDeleteSubscr(virtualFrame, stackTop, beginBci, localNodes, useCachedNodes);
1878-
break;
1879-
}
18801875
case OpCodesConstants.RAISE_VARARGS: {
18811876
int count = Byte.toUnsignedInt(localBC[bci + 1]);
18821877
throw bytecodeRaiseVarargs(virtualFrame, stackTop, beginBci, count, localNodes);
@@ -1900,12 +1895,6 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
19001895
stackTop = bytecodeStoreName(virtualFrame, stackTop, beginBci, oparg, localNames, localNodes, useCachedNodes);
19011896
break;
19021897
}
1903-
case OpCodesConstants.DELETE_NAME: {
1904-
setCurrentBci(virtualFrame, bciSlot, bci);
1905-
oparg |= Byte.toUnsignedInt(localBC[++bci]);
1906-
bytecodeDeleteName(virtualFrame, globals, locals, beginBci, oparg, localNames, localNodes, useCachedNodes);
1907-
break;
1908-
}
19091898
case OpCodesConstants.STORE_ATTR: {
19101899
setCurrentBci(virtualFrame, bciSlot, bci);
19111900
oparg |= Byte.toUnsignedInt(localBC[++bci]);
@@ -1924,12 +1913,6 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
19241913
stackTop = bytecodeStoreGlobal(virtualFrame, globals, stackTop, beginBci, oparg, localNodes, localNames, useCachedNodes);
19251914
break;
19261915
}
1927-
case OpCodesConstants.DELETE_GLOBAL: {
1928-
setCurrentBci(virtualFrame, bciSlot, bci);
1929-
oparg |= Byte.toUnsignedInt(localBC[++bci]);
1930-
bytecodeDeleteGlobal(virtualFrame, globals, beginBci, oparg, localNodes, localNames, useCachedNodes);
1931-
break;
1932-
}
19331916
case OpCodesConstants.LOAD_NAME: {
19341917
setCurrentBci(virtualFrame, bciSlot, bci);
19351918
oparg |= Byte.toUnsignedInt(localBC[++bci]);
@@ -2337,6 +2320,8 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
23372320
case OpCodesConstants.LOAD_FROM_DICT_OR_GLOBALS:
23382321
case OpCodesConstants.MAKE_TYPE_PARAM:
23392322
case OpCodesConstants.IMPORT_STAR:
2323+
case OpCodesConstants.DELETE_GLOBAL:
2324+
case OpCodesConstants.DELETE_NAME:
23402325
stackTop = infrequentBytecodes(virtualFrame, localFrame, bc, bci, stackTop, beginBci, oparg, localBC, globals, locals, localNames, localNodes, bciSlot, localCelloffset,
23412326
useCachedNodes);
23422327
bci++;
@@ -2345,6 +2330,7 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
23452330
case OpCodesConstants.LOAD_LOCALS:
23462331
case OpCodesConstants.MAKE_TYPE_ALIAS:
23472332
case OpCodesConstants.MAKE_GENERIC:
2333+
case OpCodesConstants.DELETE_SUBSCR:
23482334
stackTop = infrequentBytecodes(virtualFrame, localFrame, bc, bci, stackTop, beginBci, oparg, localBC, globals, locals, localNames, localNodes, bciSlot, localCelloffset,
23492335
useCachedNodes);
23502336
break;
@@ -2439,6 +2425,7 @@ private Object bytecodeLoop(VirtualFrame virtualFrame, Frame localFrame, Bytecod
24392425
}
24402426
}
24412427

2428+
@BytecodeInterpreterSwitch
24422429
private int infrequentBytecodes(VirtualFrame virtualFrame, Frame localFrame, byte bc, int bci, int stackTop, int beginBci, int oparg, byte[] localBC, Object globals, Object locals,
24432430
TruffleString[] localNames, Node[] localNodes, int bciSlot, int localCelloffset, boolean useCachedNodes) {
24442431
switch (bc) {
@@ -2488,6 +2475,23 @@ private int infrequentBytecodes(VirtualFrame virtualFrame, Frame localFrame, byt
24882475
stackTop = bytecodeImportStar(virtualFrame, stackTop, beginBci, oparg, localNames, localNodes, useCachedNodes);
24892476
break;
24902477
}
2478+
case OpCodesConstants.DELETE_GLOBAL: {
2479+
setCurrentBci(virtualFrame, bciSlot, bci);
2480+
oparg |= Byte.toUnsignedInt(localBC[++bci]);
2481+
bytecodeDeleteGlobal(virtualFrame, globals, beginBci, oparg, localNodes, localNames, useCachedNodes);
2482+
break;
2483+
}
2484+
case OpCodesConstants.DELETE_NAME: {
2485+
setCurrentBci(virtualFrame, bciSlot, bci);
2486+
oparg |= Byte.toUnsignedInt(localBC[++bci]);
2487+
bytecodeDeleteName(virtualFrame, globals, locals, beginBci, oparg, localNames, localNodes, useCachedNodes);
2488+
break;
2489+
}
2490+
case OpCodesConstants.DELETE_SUBSCR: {
2491+
setCurrentBci(virtualFrame, bciSlot, bci);
2492+
stackTop = bytecodeDeleteSubscr(virtualFrame, stackTop, beginBci, localNodes, useCachedNodes);
2493+
break;
2494+
}
24912495
default:
24922496
throw raiseUnknownBytecodeError(bc);
24932497

0 commit comments

Comments
 (0)