Do I need to balance?

James Ladd <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi All,

I'm using ASM and a ClassWriter like this: 

    new ClassWriter(ClassWriter.COMPUTE_MAXS);

I'm wondering do I need to balance the stack or will the JVM / ASM handle this for me?

I have the following code, which leave one extra value on the stack, hence my question:
(I removed signatures to reduce the size of this output)

visitCode()
visitVarInsn(ALOAD, 1)
visitLdcInsn(Transcript)
visitMethodInsn(INVOKESTATIC, 'st/redline/ProtoObject', 'primitiveVariableAt', '<snip>')
visitVarInsn(ALOAD, 1)
visitLdcInsn(Hello World.)
visitMethodInsn(INVOKESTATIC, 'st/redline/ProtoObject', 'primitiveString', '<snip>')
visitLdcInsn(show:)
visitInsn(ACONST_NULL)
visitMethodInsn(INVOKESTATIC, 'st/redline/ProtoObject', 'primitiveSend', '<snip>')
visitInsn(DUP)
visitLdcInsn(cr)
visitInsn(ACONST_NULL)
visitMethodInsn(INVOKESTATIC, 'st/redline/ProtoObject', 'primitiveSend', '<snip>')
visitInsn(POP)
visitInsn(DUP)
visitLdcInsn(cr)
visitInsn(ACONST_NULL)
visitMethodInsn(INVOKESTATIC, 'st/redline/ProtoObject', 'primitiveSend', '<snip>')
visitInsn(ARETURN)
visitMaxs(1, 1)
visitEnd()
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.