Re: Questions on jvm interpreter

Remi Forax forax at
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.


Sent from my Phone

----- Reply message -----
From: "Saravanaraj Velusamy" <svelusa at>
To: <distro-pkg-dev at>, <hotspot-compiler-dev at>
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)  

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.

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...

More information about the hotspot-compiler-dev mailing list