Skip to content

Commit 75d24fd

Browse files
committed
Fix inaccuracy in stack size calculation
1 parent 9430277 commit 75d24fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/code-generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ const codeGenerators: { [type: string]: (node: Node, cg: CodeGenerator) => Compi
238238
const size1 = compile(createIntLiteralNode(i), cg).stackSize
239239
const size2 = compile(val as Expression, cg).stackSize
240240
cg.code.push(arrayElemType in arrayStoreOp ? arrayStoreOp[arrayElemType] : OPCODE.AASTORE)
241-
maxStack = Math.max(maxStack, 1 + size1 + size2)
241+
maxStack = Math.max(maxStack, 2 + size1 + size2)
242242
})
243243
cg.code.push(OPCODE.ASTORE, curIdx)
244244
} else {

0 commit comments

Comments
 (0)