How to notify the VM about certain event from Java code?
guanxiaohua at gmail.com
Wed Apr 28 11:18:34 PDT 2010
Thanks a lot!
Tony (Xiaohua Guan)
On Wed, Apr 28, 2010 at 1:05 PM, Tom Rodriguez <tom.rodriguez at oracle.com> wrote:
> I don't think there's an existing call that you can just suborn for this purpose, but it's easy enough to just declare some method in some class as your notify function and then treat it specially inside the JVM and use that as your hook either by intrinsifying it or binding it as a native method.
> In general creating new bytecodes is rarely the right solution to any problem because most operations can be represented as method calls and adding bytecodes requires changing all sorts of code to understand and generate them which is a huge pain. There are obviously cases where a new bytecode is the only way to go but that's less often than you think.
> On Apr 28, 2010, at 9:11 AM, Tony Guan wrote:
>> Hi all,
>> I need to notify VM to take some action at certain point of the java
>> execution, how can I do that without creating special bytecode?
>> for example:
>> ...system.out.println("this is part of java code");
>> ......system.out.println("this is part of java code");
>> I need some functionCall_XXX() which will enable me to communicate
>> with the JVM, so that I can do something at this point. Does such
>> function exist?
More information about the hotspot-runtime-dev