Skip to content

Commit 81ff9ce

Browse files
committed
Remove limit on cellvar initialization explosion
1 parent 68d7101 commit 81ff9ce

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

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

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5463,22 +5463,8 @@ private int bytecodeImportStar(VirtualFrame virtualFrame, int initialStackTop, i
54635463
return stackTop;
54645464
}
54655465

5466-
private void initCellVars(Frame localFrame) {
5467-
if (cellvars.length <= 32) {
5468-
initCellVarsExploded(localFrame);
5469-
} else {
5470-
initCellVarsLoop(localFrame);
5471-
}
5472-
}
5473-
54745466
@ExplodeLoop
5475-
private void initCellVarsExploded(Frame localFrame) {
5476-
for (int i = 0; i < cellvars.length; i++) {
5477-
initCell(localFrame, i);
5478-
}
5479-
}
5480-
5481-
private void initCellVarsLoop(Frame localFrame) {
5467+
private void initCellVars(Frame localFrame) {
54825468
for (int i = 0; i < cellvars.length; i++) {
54835469
initCell(localFrame, i);
54845470
}
@@ -5498,31 +5484,16 @@ private void initCell(Frame localFrame, int i) {
54985484
}
54995485
}
55005486

5487+
@ExplodeLoop
55015488
private void initFreeVars(Frame localFrame, Object[] originalArgs) {
55025489
if (freevars.length > 0) {
5503-
if (freevars.length <= 32) {
5504-
initFreeVarsExploded(localFrame, originalArgs);
5505-
} else {
5506-
initFreeVarsLoop(localFrame, originalArgs);
5490+
PCell[] closure = PArguments.getClosure(originalArgs);
5491+
for (int i = 0; i < freevars.length; i++) {
5492+
localFrame.setObject(freeoffset + i, closure[i]);
55075493
}
55085494
}
55095495
}
55105496

5511-
@ExplodeLoop
5512-
private void initFreeVarsExploded(Frame localFrame, Object[] originalArgs) {
5513-
PCell[] closure = PArguments.getClosure(originalArgs);
5514-
for (int i = 0; i < freevars.length; i++) {
5515-
localFrame.setObject(freeoffset + i, closure[i]);
5516-
}
5517-
}
5518-
5519-
private void initFreeVarsLoop(Frame localFrame, Object[] originalArgs) {
5520-
PCell[] closure = PArguments.getClosure(originalArgs);
5521-
for (int i = 0; i < freevars.length; i++) {
5522-
localFrame.setObject(freeoffset + i, closure[i]);
5523-
}
5524-
}
5525-
55265497
@ExplodeLoop
55275498
@SuppressWarnings("unchecked")
55285499
private static <T> void moveFromStack(VirtualFrame virtualFrame, int start, int stop, T[] target) {

0 commit comments

Comments
 (0)