[Soot-list] Re: [abc-dev] issue with method stack size (fwd)

Etienne Gagnon egagnon at sablevm.org
Wed Nov 9 18:42:05 EST 2005


Hi Michael,

I agree that max_stack should be 1.  An exception handler does
effectively put a reference on the stack.  I am surprised that Sun's
verifier didn't catch this.  This code should cause a VerificationError
(as long as the verifier is turned on, of course).

The rule of thumb is that all code that is executed by the virtual
machine should be "verifiable".  As an "optimization", the virtual
machine might consider some code as "trusted", where the virtual machine
trusts the user/system/digital-signature/whatever that the code has been
"pre-verified".  I think Jikes RVM doesn't have a verifier, and thus
implicitly trusts all code (as does SableVM and other free VMs).  It is
quite normal that Jikes RVM exhibits unexpected behavior on unverifiable
byttecode.

You should definitely run this code in Sun's VM while turning on the
"-verify" (or something like that) command-line option, just to make
sure you haven't actually found a quite grave bug in the verifier.

Of course, abc should be fixed too... ;-)

Have fun!

Etienne


Prof. Laurie HENDREN wrote:
> Any opinions on this?
> ---------- Forwarded message ----------
> From: Michael Haupt <haupt at informatik.tu-darmstadt.de>
> Subject: [abc-dev] issue with method stack size
> 
> Dear all,
> 
> when using abc with the Jikes RVM 2.3.1, I've come across the following
> problem.
> 
> The abc compiler generated an aspect's class initialiser <clinit> with
> the following bytecode:
> 
> -----
> 0:   invokestatic    #25; //Method abc$preClinit:()V
> 3:   invokestatic    #28; //Method abc$postClinit:()V
> 6:   goto    12
> 9:   putstatic       #30; //Field ...
> 12:  return
>    Exception table:
>     from   to  target type
>       3     6     9   Class java/lang/Throwable
> -----
> 
> (The field being set at index 9 contains a Throwable; I've omitted that
> for better layout.)
> 
> This static initialiser requires a stack size (operand words) of 1
> because the potential exception must be put on the stack. However, abc
> generates the method with a stack size of 0.
> 
> The Sun JVM accepts this code without problems. The Jikes RVM (2.3.1)
> crashes during building GC maps prior to compilation. I think Jikes is
> right, because the stack size value should reflect the actually needed
> stack size.
> 
> With respect to the generation of "specification-compliant" bytecode, I
> believe that's a bug, regardless of whether the Sun JVM can live with
> it. I'd rather say the Sun JVM does not stick to the standards properly.

-- 
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20051109/883cdc47/signature.bin


More information about the Soot-list mailing list