HotSpot Hacking
Bob Vandette
bob.vandette at oracle.com
Tue Mar 13 07:20:51 PDT 2012
Did you remember to add your method in the correct table that is used to register the natives (unsafe.cpp)?
static JNINativeMethod methods[] { ... }
The Unsafe native entrypoints are registered in unsafe.cpp in the function:
JVM_ENTRY(void, JVM_RegisterUnsafeMethods(JNIEnv *env, jclass unsafecls))
Bob
On Mar 13, 2012, at 7:52 AM, Ilya Mirsky wrote:
> Hi,
>
> I'm trying (unsuccessfully) to add a method to the Unsafe class.
> As a start I'm trying to duplicate an existing method.
> I add the declaration of the new method to Unsafe.java, and update unsafe.cpp as well.
> I register the new method in unsafe.cpp and vmSymbols.hpp, following the example of the original method.
>
> Then I compile the jdk, and want to test the change.
> A test program, which uses the new method, compiles but fails to run due to an UnsatisfiedLinkError.
>
> So my question is, what are the steps of adding a native method to HotSpot?
> Is there is some tutorial or documentation available?
>
> Thanks in advance,
>
> ---
> Best Regards,
> Ilya Mirsky
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-dev/attachments/20120313/cedd024d/attachment.html
More information about the hotspot-dev
mailing list