Jikes 1.15 vs. Verifier

Dalibor Topic robilad at yahoo.com
Sat Mar 23 19:54:14 PST 2002


We have had a lot of fun with jikes 1.15 generated Klasses.jar last week. I 
tried to figure out what was going on, and if kaffe's verifier was to blame.

Here is the typical error message:
java.lang.VerifyError: at pc 5 sp 7 not in range [4, 6]
        at java.io.PushbackReader.<init>(PushbackReader.java:32)
        at java.io.StreamTokenizer.<init>(StreamTokenizer.java:50)
        at wc.<init>(wc.java:72)
        at wc.main(wc.java:104)

I patched class-analyse.c to show me method & class where the stack
violation was found.

I compiled Klasses.jar with jikes 1.14 & jikes 1.15, disassembled the
output and diffed it.

the diff of the disassembly of java.io.PushbackReader showed that
jikes 1.15 has decreased the required stack size of the constructor 
java.io.PushbackReader.PushbackBuffer(java.io.PushbackReader,java.io.PushbackReader$1,int).

here is the excerpt from the diff:
--- pbr.j114    Sat Mar 23 21:29:50 2002
+++ pbr.j115    Sat Mar 23 21:24:28 2002
[snip]
         private 
java.io.PushbackReader.PushbackBuffer(java.io.PushbackReader,int);
        /* Stack=2, Locals=3, Args_size=3 */
         
java.io.PushbackReader.PushbackBuffer(java.io.PushbackReader,java.io.PushbackReader$1,int);
-       /* Stack=3, Locals=4, Args_size=4 */
+       /* Stack=2, Locals=4, Args_size=4 */
     }
[snip]

there was one difference in the generated code for that
constructor. I went through the disassembly and annotated it with
stack size:

Method java.io.PushbackReader. 
PushbackBuffer(java.io.PushbackReader,java.io.PushbackReader$1,int)
   0 aload_0
     # sz += 1; sz == 1
   ## jikes 1.14  includes an additional aload_1 here. ##
   1 iload_3
     # sz += 1; sz == 2
   2 invokespecial #88 <Method 
java.io.PushbackReader.PushbackBuffer(java.io.PushbackReader,int)>
     #sz -= 3; sz = -1; oops!
   5 return

Thus I think there is a bug in jikes 1.15. This has been pointed out
already on the mailing list, I just thought I'd try to investigate a
little further and see if I can turn up any evidence that the bug is
in the verifier.

I've attached the patch for class-analyse.c that improves the error
message generated when the verification fails. I hope this will make
finding that kind of issues with compilers easier.

dalibor topic

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



More information about the kaffe mailing list