HotSpot Hacking

Tom Rodriguez tom.rodriguez at oracle.com
Wed Mar 14 10:50:06 PDT 2012


On Mar 13, 2012, at 11:06 AM, Ilya Mirsky wrote:

> Hi Tom,
> 
> Yep, it seems to be a library problem.
> Although I did install the custom-built jdk as the default java on my Linux system,
> it seems that it doesn't use the correct library.
> Tried to point eclipse to use jdk from it's build directory, without success either.
> 
> How do I install the library, and what should be the command line flags ?

For a JDK the libjvm.so should end up in jre/lib/<arch>/{client,server} depending on which config you built, and make sure you use appropriate -client or -server flag as well.  Use -version and -Xinternalversion to make sure you've got the right bits.

tom

> 
> Thanks a lot, I appreciate your assistance.
> 
> ---
> Best Regards,
> Ilya Mirsky
>     
> 
> 
> 
> On Tue, Mar 13, 2012 at 6:08 PM, Tom Rodriguez <tom.rodriguez at oracle.com> wrote:
> 
> 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