Skip to content

Commit 5b2e4e2

Browse files
committed
Fix stacksize reporting
1 parent fa8a1b2 commit 5b2e4e2

File tree

2 files changed

+7
-3
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python

2 files changed

+7
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/code/PCode.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,10 @@ private static TruffleString extractName(RootNode rootNode) {
269269

270270
@TruffleBoundary
271271
private static int extractStackSize(RootNode rootNode) {
272+
if (rootNode instanceof PBytecodeRootNode) {
273+
CodeUnit code = ((PBytecodeRootNode) rootNode).getCodeUnit();
274+
return code.stacksize + code.varnames.length + code.cellvars.length + code.freevars.length;
275+
}
272276
return rootNode.getFrameDescriptor().getNumberOfSlots();
273277
}
274278

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/CodeUnit.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
*/
4141
package com.oracle.graal.python.compiler;
4242

43+
import static com.oracle.graal.python.util.PythonUtils.TS_ENCODING;
44+
4345
import java.util.ArrayList;
4446
import java.util.Arrays;
4547
import java.util.HashMap;
@@ -53,8 +55,6 @@
5355
import com.oracle.graal.python.util.PythonUtils;
5456
import com.oracle.truffle.api.strings.TruffleString;
5557

56-
import static com.oracle.graal.python.util.PythonUtils.TS_ENCODING;
57-
5858
/**
5959
* A context-independent representation of code for bytecode interpreter. Contains the actual
6060
* bytecode and all the related data, like constants or exception handler ranges. It doesn't contain
@@ -111,7 +111,7 @@ public CodeUnit(TruffleString name, TruffleString qualname,
111111
this.argCount = argCount;
112112
this.kwOnlyArgCount = kwOnlyArgCount;
113113
this.positionalOnlyArgCount = positionalOnlyArgCount;
114-
this.stacksize = stacksize + varnames.length + cellvars.length + freevars.length;
114+
this.stacksize = stacksize;
115115
this.code = code;
116116
this.srcOffsetTable = linetable;
117117
this.flags = flags;

0 commit comments

Comments
 (0)