Crash using sun.misc.Unsafe.static
Rémi Forax
forax at univ-mlv.fr
Tue Jul 17 08:59:03 PDT 2012
On 07/17/2012 01:06 AM, Krystal Mok wrote:
> Hi Remi,
>
> Looks like it's a trap if you're running this on JDK6's HotSpot VM. If
> you're running a debug build of the same VM, you should hit an
> assertion before hitting the ShouldNotReachHere() part.
>
> opto/type.cpp:2477
> assert(o->is_java_object(), "must be java language object");
>
> Even though the source code of JDK6u33 is not open sourced, you could
> try a similar version of HotSpot VM from OpenJDK, namely the
> hsx/hsx20/baseline branch, or jdk6/jdk6/hotspot. Make a fastdebug
> build and you should see the assertion.
>
> And you're right that this has to do with the PermGen removal project.
> The difference comes from [1], which is a part of CR 7017732.
> To be specific, before the 7017732, static fields are stored in the
> instanceKlass of a Java class; an instanceKlass (or its enclosing
> klassOopDesc to be exact) is not an Java object.
> After 7017732, static fields are moved to the tail of java.lang.Class
> instances, which are Java objects.
>
> So to answer your question, you just shouldn't expect the the code to
> work in JDK6/HotSpot.
Hi Krys,
Too bad because I wanted to use a similar code in the jsr292 backport
(a Java agent that enable dynamic language runtime written with
invokedynamic to run on a jdk6 stock VM)
This remember me another question, the java agent use
java.lang.instrument.Instrumentation.retransform to change
code at runtime and it seems that using retransform disable OSR on the
retransformed class.
Is there a reason for that ?
>
> [1]:
> http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/diff/c7f3d0b4570f/src/share/vm/prims/unsafe.cpp
Rémi
More information about the mlvm-dev
mailing list