icedtea-1.14 JamVM + OpenJDK 7 -version patch

Robert Lougher rob.lougher at gmail.com
Fri May 27 06:03:44 PDT 2011


Hi,

On 27 May 2011 12:55, Xerxes Rånby <xerxes at zafena.se> wrote:
> fre 2011-05-27 klockan 12:48 +0200 skrev Xerxes Rånby:
>> > What I currently observe are a
>> > unsatisfied link error.
>> >
>> > xranby at xranby-ESPRIMO-P7935:~/test
>> > $ ../icedtea-1.14/openjdk.build/j2sdk-image/bin/java Linpack
>> > java.lang.UnsatisfiedLinkError: registerNatives
>> >     at sun.misc.Perf.registerNatives(Native Method)
>> >     at sun.misc.Perf.<clinit>(Perf.java:536)
>> ...
>> >     at sun.misc.PerfCounter.<clinit>(PerfCounter.java:51)
>> >     at java.net.URLClassLoader.defineClass(URLClassLoader.java:448)
>> >
>> > The URLClassLoader uses sun.misc.Perf to register startup time.
>> >
>> > I start to think this are a bug in OpenJDK 7 that the sun.misc.Perf
>> > constructor expects to be able to use the native registerNatives method
>> > in libhprof.so without explicilty making sure that this library have
>> > already been loaded.
>> >
>> > The libhprof.so are part of the Hotspot JVMTI implementation so it are
>> > no surprise that JamVM currently dont not load it.
>
> The attached patch fix this UnsatisfiedLinkError by simply removing the
> use of sun.misc from the OpenJDK 7 ClassLoader and URLClassLoader. This
> makes it possible to use the OpenJDK 7 classes in combination with other
> JVM's than Hotspot.
>
> I think this are a valid fix since the hooks added using sun.misc.Perf
> to monitor ClassLoader bootup time are not part of the public
> ClassLoader API. These hooks do not exist in OpenJDK 6 and I can not
> find any refernce to validate their existance in OpenJDK 7. I think they
> are leftovers from some old ClassLoader speed regression investigation
> and should be considered as debug code.
>
> If someone like this debug code and have a suggestion how to properly
> re-engineer sun.misc to support other JVM's than Hotspot im all ear.
>

I was in the middle of writing the previous email when I was dragged
off to lunch.  I think this is a valid fix.  However, I would like to
understand the mechanism which is enabling HotSpot to work.  Of
course, once the native functions can be found, there's no guarantee
that they will work, as they may use other unimplemented features.

Rob.

>>
>>
>> For clarification,the native method in libhprof.so void
>> registerNative(void) called by the sun.misc.Perf constructor are not the
>> same "RegisterNatives" as the JNI interface RegisterNatives
>> http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/functions.html#wp17734
>>
>>
>> Xerxes
>
>



More information about the distro-pkg-dev mailing list