Commit e10e36d2 authored by trask's avatar trask

Fix java.lang.VerifyError: Operand stack overflow

parent d209ecc3
......@@ -854,7 +854,13 @@ final class MethodWriter extends MethodVisitor {
if (compute == COMPUTE_MAX_STACK_AND_LOCAL_FROM_FRAMES) {
relativeStackSize = nStack;
if (nStack > maxRelativeStackSize) {
for (int i = 0; i < nStack; ++i) {
Object st = stack[i];
if (st == Opcodes.LONG || st == Opcodes.DOUBLE) {
relativeStackSize++;
}
}
if (relativeStackSize > maxRelativeStackSize) {
maxRelativeStackSize = relativeStackSize;
}
}
......
......@@ -1128,4 +1128,19 @@ public class ClassWriterComputeMaxsTest {
assertMaxs(1, 1);
}
@Test
public void testComputeMaxsFromFrameWithLong() {
init(Opcodes.V1_7);
Label l0 = new Label();
methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, "ABC", "get", "()J", false);
GOTO(l0);
LABEL(l0);
methodVisitor.visitFrame(Opcodes.F_NEW, 0, null, 1, new Object[] {Opcodes.LONG});
ACONST_NULL();
RETURN();
assertMaxs(3, 1);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment