Re: Questions on jvm interpreter

Remi Forax forax at univ-mlv.fr
Thu Mar 29 09:48:08 PDT 2012


Take a look to java.lang.instrument that allow you to alter the bytecode using by example ASM at runtime.

Cheers,
Rémi

Sent from my Phone

----- Reply message -----
From: "Saravanaraj Velusamy" <svelusa at ncsu.edu>
To: <distro-pkg-dev at openjdk.java.net>, <hotspot-compiler-dev at openjdk.java.net>
Subject: Questions on jvm interpreter
Date: Thu, Mar 29, 2012 10:20
Hi All,

We are trying to alter the branch conditions taken by a java program at run time. 

For example if a Java code has conditions like this


if( var == value1)  
    PATH1;
else
    PATH2;

Lets 
say we want to it take PATH2 (even though var might be equal to value1). We might not 
change all branch statements in the class file and we can assume there 
is another source (say a text file) which contains what conditions needs
to be changed.


We have two ideas to do the same. 
1) To change the bytecode at that point during execution (like changing if_icmpeq to if_icmpne)
2) Find the place which contains the result of the first comparison and complement the result of the comparison.



The example has a simple conditional statement. We would also want to consider loops, switch cases later.

We
would like to know what is the best way to go about and pointers in the
code related to this. We are currently looking into 
bytecodeInterpreter.cpp of Zero instead of hotspot to avoid generated 
assembly for interpreter. 
Is there any way to find out the class file 
belonging to the current opcode ? Since we are not interested in the 
standard Java class files like String, Integer etc and focus on the ones
from the User written classes and methods.


We have looked into BCEL, ASM, JVMTI and found out that we cannot change the behavior at run time. 

Thanks in advance.
- Saravanaraj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20120329/4541fbd5/attachment.html 


More information about the hotspot-compiler-dev mailing list