[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-hotspot-runtime-dev
Subject:    some questions about interpreter
From:       David.Holmes () Sun ! COM (David Holmes - Sun Microsystems)
Date:       2009-04-21 1:12:38
Message-ID: 49ED1D86.1090902 () sun ! com
[Download RAW message or body]

Hi,

Please don't cross-post so much.

You changed the interpreter to always put 100 on the stack instead of
the real value. How do you expect any Java code to execute correctly
when you do this? It simply can't - hence the exception. When you modify
the interpreter you still have to have it execute the Java language
semantics correctly.

David Holmes

lianshun Liu said the following on 04/21/09 03:58:
> Hi,
>  
> 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.
> BytecodeInterpreter::run()
> {
>    //????
>      switch (opcode)
>      {
>        //????
>        CASE(_bipush):                    
>         //  SET_STACK_INT((jbyte)(pc[1]), 0);   
>            SET_STACK_INT((jint)(100), 0);
>           UPDATE_PC_AND_TOS_AND_CONTINUE(2, 1);
>        //????
>      }
>   //????
> }
> 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
> java.lang.ExceptionInInitializerError
>         at java.lang.System.initializeSystemClass(System.java:1107)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 100
>         at java.util.Properties.<clinit>(Properties.java:1109)
>         at java.lang.System.initializeSystemClass(System.java:1107)
>  
> So my first question is that why the change result in such an error? 
> Can't the source 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?  
>  
> Thanks.
> Lianshun Liu
>  
> 
> ------------------------------------------------------------------------
> 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic