HotSpot Hacking
Tom Rodriguez
tom.rodriguez at oracle.com
Tue Mar 13 09:08:14 PDT 2012
On Mar 13, 2012, at 4: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?
It sounds like you've taken the right steps on the hotspot side so check for pilot error. Have you installed the library properly and are you using the right command line flags to get that library version loaded? Is the entry point getting registered properly when unsafe is initialized? Step through that code and see what's happening.
tom
>
> Thanks in advance,
>
> ---
> Best Regards,
> Ilya Mirsky
>
>
More information about the hotspot-dev
mailing list