Way to statically initialize a class before or during MethodHandle creation, Unsafe crashes JVM

Jochen Theodorou blackdrag at gmx.org
Fri Nov 16 08:15:32 PST 2012


Am 16.11.2012 16:05, schrieb Remi Forax:
> Jochen,
> can you extract a simple test class that reproduce the bug ?
>
> Also, methods of sun.misc.Unsafe are not protected again send null as
> arguments,
> so you have to do the check before calling unsafe.XXX.

I am sure it is not null... as for a testcase... the groovy program is 
simple, but that does not contain the unsafe call. The unsafe call is in 
the bootstrapping code, so you would have to use the Groovy runtime. I 
will try if it is always for the same class, but since that class is 
absolutely nothing special I highly doubt it. Also the call to 
ensureClassInitialization is done thousands of times without problem
...

as for another way to ensure cinit has been executed... do you have any 
idea how to get this done without Unsafe?

bye Jochen


More information about the mlvm-dev mailing list