AnalyzerException with ASM 3.3

Jonathan Byrne <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi ASM community, I'm using

Analyzer a = new Analyzer(new SimpleVerifier(.....));
a..analyze(....);

in the 3.3 release of ASM to verify the correctness of bytecode which I
have *not* modified. On running the above code on Java2D - the Java
2D demo which comes with the Sun/Oracle JDK - I get the following
error, when validating the following method:

class:
java2d.demos.Arcs_Curves.Curves.class

method:
render (IILjava/awt/Graphics2D;)V

Error:
org.objectweb.asm.tree.analysis.AnalyzerException: Error in render at
instruction 326: Method owner: expected Ljava/awt/Shape;, but found
Ljava/lang/Object;
	at org.objectweb.asm.tree.analysis.Analyzer.analyze(Analyzer.java:291)

From the bytecode I can see why the error occurs and ASM resolves the
value for the stack frame at 327 by grabbing the return value from the
invokeinterface opcode.

323   --     LINENUMBER 120 L43
324   --     ALOAD 11
325  Ljava/lang/Object; --     ACONST_NULL
326  Ljava/lang/Object;Lnull; --     INVOKEINTERFACE
java/awt/Shape.getPathIterator
(Ljava/awt/geom/AffineTransform;)Ljava/awt/geom/PathIterator;
327  Ljava/awt/geom/PathIterator; --     ASTORE 12

However, this isn't the problem I ran into, but thought I'd mention this in
case it impacts on the error which occurs in the same method but a few
opcodes further down. The problem is: ASM stops computing stack frames
between 398 and 404 and I was wondering why? (Obviously I get a
null pointer exception when I try to query the stack frame at 404).

391   --    L16
392   --    FRAME FULL [java2d/demos/Arcs_Curves/Curves I I
java/awt/Graphics2D I java/awt/font/FontRenderContext
java/awt/font/TextLayout F F I I] []
393   --     ILOAD 10
394  I --     ICONST_3
395  II --     IF_ICMPLT L17
396   --    L52
397 --     LINENUMBER 134 L52
398 --     ILOAD 2
399 --     ICONST_2
400 --     IDIV
401 --     BIPUSH 15
402 --     IADD
403 --     I2F
404 --     FSTORE 8
405 --    L53
406 --     LINENUMBER 83 L53
407 --     IINC 9 1
408   --    L13
409   --    FRAME FULL [java2d/demos/Arcs_Curves/Curves I I
java/awt/Graphics2D I java/awt/font/FontRenderContext
java/awt/font/TextLayout F F I] []
410   --     ILOAD 9
411  I --     ICONST_2
412  II --     IF_ICMPLT L14
413   --    L54
414 --     LINENUMBER 136 L54
415 --     RETURN

I've attached the class file which causes the issue. And if you run

java -cp asm-3.3.jar org.objectweb.asm.util.CheckClassAdapter Curves.class

you can see where the stack frames are no longer computed:

00312 Curves I I Graphics2D I FontRenderContext TextLayout F F I I . .
. .  : I  :     ICONST_3
00313 Curves I I Graphics2D I FontRenderContext TextLayout F F I I . .
. .  : I I  :     IF_ICMPLT L3
00314 Curves I I Graphics2D I FontRenderContext TextLayout F F I I . .
. .  :  :     ILOAD 2
00315 ?                          :     ICONST_2
00316 ?                          :     IDIV
00317 ?                          :     BIPUSH 15
00318 ?                          :     IADD
00319 ?                          :     I2F
00320 ?                          :     FSTORE 8
00321 ?                          :     IINC 9 1
00322 Curves I I Graphics2D I FontRenderContext TextLayout F F I . . .
. .  :  :    L0
00323 Curves I I Graphics2D I FontRenderContext TextLayout F F I . . .
. .  :  :    FRAME CHOP 1
00324 Curves I I Graphics2D I FontRenderContext TextLayout F F I . . .
. .  :  :     ILOAD 9
00325 Curves I I Graphics2D I FontRenderContext TextLayout F F I . . .
. .  : I  :     ICONST_2
00326 Curves I I Graphics2D I FontRenderContext TextLayout F F I . . .
. .  : I I  :     IF_ICMPLT L1
00327 Curves I I Graphics2D I FontRenderContext TextLayout F F I . . .
. .  :  :     RETURN

BTW, I haven't checked to see if this error occurs in other releases of ASM.

Any help would be greatly appreciated !

Regards for now...
Curves.class (application/octet-stream, 3.6 KB) - not displayed
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.