Questions on jvm interpreter

Saravanaraj Velusamy svelusa at
Thu Mar 29 01:20:51 PDT 2012

Hi All,

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

For example if a Java code has conditions like this

if( var == value1)

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

More information about the hotspot-compiler-dev mailing list