is this correct code?
Jochen Theodorou <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
Hi all, I am currently trying to find an bytecode problem in a strange situation. The code is fine if verified and normally run, but fails if debugged in IntelliJ with: java.lang.VerifyError: (class: org/codehaus/groovy/ast/builder/AstBuilderTransformation, method: <clinit> signature: ()V) Attempt to split long or double on the stack No clinit looks like this: > static <clinit>()V > LDC 0 > INVOKESTATIC org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.box (J)Ljava/lang/Object; > CHECKCAST java/lang/Long > ASTORE 0 > ALOAD 0 > INVOKESTATIC org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.longUnbox (Ljava/lang/Object;)J > PUTSTATIC org/codehaus/groovy/ast/builder/AstBuilderTransformation.__timeStamp__239_neverHappen1291891067850 : J > ALOAD 0 > POP > LDC 1291891067849 > INVOKESTATIC org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.box (J)Ljava/lang/Object; > CHECKCAST java/lang/Long > ASTORE 1 > ALOAD 1 > INVOKESTATIC org/codehaus/groovy/runtime/typehandling/DefaultTypeTransformation.longUnbox (Ljava/lang/Object;)J > PUTSTATIC org/codehaus/groovy/ast/builder/AstBuilderTransformation.__timeStamp : J > ALOAD 1 > POP > RETURN > RETURN > NOP > MAXSTACK = 2 > MAXLOCALS = 2 And I see two potential problems. First there is the LDC 1291891067849, which should produce an int or long? I quite never understood how a constant can be long and int at the same time here. Anyway, next is a method call that takes an long and we may or may not have one. Now I know that there is actually no way to represent a real long constant over 1l, so this is probably right and what the java compiler would have done as well. But before that there is also a LDC 0 followed by a box call that takes a long. This is the only place I can imagine could cause a problem. And I recently had the case that I did "LDC 0; LSTORE 5" and the verifier complained... sometimes. I could fix it there by instead having "LCONST_0; LSTORE 5". Now I am wondering about some things: (1) why is it valid to use LDC one time and at another not? (2) if it is not valid, why is it sometimes a VerifyError and sometimes not? (3) shouldn't asm do a strict check here (I am using asm 3.2) and point this out as error? bye blackdrag -- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead http://blackdragsview.blogspot.com/ For Groovy programming sources visit http://groovy.codehaus.org
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