some questions about interpreter

lianshun Liu lsliu0507 at
Mon Apr 20 12:10:06 PDT 2009


I have some questions about interpreter.
I build latested hotspot(b55) with the C++-Interpreter successfully on Win32, and java.exe can work correctly. But if I change the source code of the interpreter, locates at hotspot\src\share\vm\interpreter\bytecodeInterpreter.cpp, something will be wrong.
     switch (opcode)
        //  SET_STACK_INT((jbyte)(pc[1]), 0);   
           SET_STACK_INT((jint)(100), 0);
SET_STACK_INT((jbyte)(pc[1]), 0) is a macro that puts pc[1] (operand of bipush) onto the stack, it doesn't do anything else. So I thought I could change SET_STACK_INT((jbyte)(pc[1]), 0) into SET_STACK_INT((jint)(100), 0), which will always put 100 onto the stack if the opcode is bipush. But to my surprise, after this change, though hotspot can be build successfully, java.exe can't be launch, following error occured:

E:\openjdk\build\windows-i586\bin>java -version
Error occurred during initialization of VM
        at java.lang.System.initializeSystemClass(
Caused by: java.lang.ArrayIndexOutOfBoundsException: 100
        at java.util.Properties.<clinit>(
        at java.lang.System.initializeSystemClass(

So my first question is that why the change result in such an error? Can't the source code of interpreter be changed?
My second question is also a little odd. This time I do not change the macro, I only embed some code that print some message after CASE(_bipush), still hotspot can build successfully. But when I start java -version on command line, an error arise, as the attachment shows. What surprises me is that though java.exe is failed, BytecodeInterpreter::run() is still executed, and printed message for more than 500 times, means code snippet CASE(_bipush)... will execute for 500+ times. Why?  

Lianshun Liu
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: javaError.jpg
Type: image/jpeg
Size: 24434 bytes
Desc: not available
Url : 

More information about the hotspot-dev mailing list