src/share/vm/interpreter/bytecodeInterpreter.hpp

Print this page
rev 4899 : 8019519: PPC64 (part 105): C interpreter: implement support for jvmti early return.


  49 #endif
  50 
  51 #ifdef CC_INTERP
  52 
  53 // JavaStack Implementation
  54 #define MORE_STACK(count)  \
  55     (topOfStack -= ((count) * Interpreter::stackElementWords))
  56 
  57 // CVM definitions find hotspot equivalents...
  58 
  59 union VMJavaVal64 {
  60     jlong   l;
  61     jdouble d;
  62     uint32_t      v[2];
  63 };
  64 
  65 
  66 typedef class BytecodeInterpreter* interpreterState;
  67 
  68 struct call_message {
  69     class Method* _callee;    /* method to call during call_method request */
  70     address   _callee_entry_point;   /* address to jump to for call_method request */
  71     int       _bcp_advance;          /* size of the invoke bytecode operation */
  72 };
  73 
  74 struct osr_message {
  75     address _osr_buf;                 /* the osr buffer */
  76     address _osr_entry;               /* the entry to the osr method */
  77 };
  78 
  79 struct osr_result {
  80   nmethod* nm;                       /* osr nmethod */
  81   address return_addr;               /* osr blob return address */
  82 };
  83 
  84 // Result returned to frame manager
  85 union frame_manager_message {
  86     call_message _to_call;            /* describes callee */
  87     Bytecodes::Code _return_kind;     /* i_return, a_return, ... */
  88     osr_message _osr;                 /* describes the osr */
  89     osr_result _osr_result;           /* result of OSR request */
  90 };
  91 
  92 class BytecodeInterpreter : StackObj {
  93 friend class SharedRuntime;
  94 friend class AbstractInterpreterGenerator;
  95 friend class CppInterpreterGenerator;
  96 friend class InterpreterGenerator;
  97 friend class InterpreterMacroAssembler;
  98 friend class frame;
  99 friend class VMStructs;
 100 
 101 public:
 102     enum messages {
 103          no_request = 0,            // unused
 104          initialize,                // Perform one time interpreter initializations (assumes all switches set)
 105          // status message to C++ interpreter
 106          method_entry,              // initial method entry to interpreter
 107          method_resume,             // frame manager response to return_from_method request (assuming a frame to resume)
 108          deopt_resume,              // returning from a native call into a deopted frame
 109          deopt_resume2,             // deopt resume as a result of a PopFrame
 110          got_monitors,              // frame manager response to more_monitors request
 111          rethrow_exception,         // unwinding and throwing exception
 112          // requests to frame manager from C++ interpreter
 113          call_method,               // request for new frame from interpreter, manager responds with method_entry
 114          return_from_method,        // request from interpreter to unwind, manager responds with method_continue
 115          more_monitors,             // need a new monitor
 116          throwing_exception,        // unwind stack and rethrow
 117          popping_frame,             // unwind call and retry call
 118          do_osr                     // request this invocation be OSR's

 119     };
 120 
 121 private:
 122     JavaThread*           _thread;        // the vm's java thread pointer
 123     address               _bcp;           // instruction pointer
 124     intptr_t*             _locals;        // local variable pointer
 125     ConstantPoolCache*    _constants;     // constant pool cache
 126     Method*               _method;        // method being executed
 127     DataLayout*           _mdx;           // compiler profiling data for current bytecode
 128     intptr_t*             _stack;         // expression stack
 129     messages              _msg;           // frame manager <-> interpreter message
 130     frame_manager_message _result;        // result to frame manager
 131     interpreterState      _prev_link;     // previous interpreter state
 132     oop                   _oop_temp;      // mirror for interpreted native, null otherwise
 133     intptr_t*             _stack_base;    // base of expression stack
 134     intptr_t*             _stack_limit;   // limit of expression stack
 135     BasicObjectLock*      _monitor_base;  // base of monitors on the native stack
 136 
 137 
 138 public:


 199 inline void set_bcp(address new_bcp) { _bcp = new_bcp; }
 200 
 201 inline intptr_t* locals() { return _locals; }
 202 
 203 inline ConstantPoolCache* constants() { return _constants; }
 204 inline Method* method() { return _method; }
 205 inline DataLayout* mdx() { return _mdx; }
 206 inline void set_mdx(DataLayout *new_mdx) { _mdx = new_mdx; }
 207 
 208 inline messages msg() { return _msg; }
 209 inline void set_msg(messages new_msg) { _msg = new_msg; }
 210 
 211 inline Method* callee() { return _result._to_call._callee; }
 212 inline void set_callee(Method* new_callee) { _result._to_call._callee = new_callee; }
 213 inline void set_callee_entry_point(address entry) { _result._to_call._callee_entry_point = entry; }
 214 inline void set_osr_buf(address buf) { _result._osr._osr_buf = buf; }
 215 inline void set_osr_entry(address entry) { _result._osr._osr_entry = entry; }
 216 inline int bcp_advance() { return _result._to_call._bcp_advance; }
 217 inline void set_bcp_advance(int count) { _result._to_call._bcp_advance = count; }
 218 
 219 inline void set_return_kind(Bytecodes::Code kind) { _result._return_kind = kind; }
 220 
 221 inline interpreterState prev() { return _prev_link; }
 222 
 223 inline intptr_t* stack() { return _stack; }
 224 inline void set_stack(intptr_t* new_stack) { _stack = new_stack; }
 225 
 226 
 227 inline intptr_t* stack_base() { return _stack_base; }
 228 inline intptr_t* stack_limit() { return _stack_limit; }
 229 
 230 inline BasicObjectLock* monitor_base() { return _monitor_base; }
 231 
 232 /*
 233  * 64-bit Arithmetic:
 234  *
 235  * The functions below follow the semantics of the
 236  * ladd, land, ldiv, lmul, lor, lxor, and lrem bytecodes,
 237  * respectively.
 238  */
 239 
 240 static jlong VMlongAdd(jlong op1, jlong op2);




  49 #endif
  50 
  51 #ifdef CC_INTERP
  52 
  53 // JavaStack Implementation
  54 #define MORE_STACK(count)  \
  55     (topOfStack -= ((count) * Interpreter::stackElementWords))
  56 
  57 // CVM definitions find hotspot equivalents...
  58 
  59 union VMJavaVal64 {
  60     jlong   l;
  61     jdouble d;
  62     uint32_t      v[2];
  63 };
  64 
  65 
  66 typedef class BytecodeInterpreter* interpreterState;
  67 
  68 struct call_message {
  69   class Method* _callee;           // method to call during call_method request
  70   address _callee_entry_point;     // address to jump to for call_method request
  71   int _bcp_advance;                // size of the invoke bytecode operation
  72 };
  73 
  74 struct osr_message {
  75   address _osr_buf;                 // the osr buffer
  76   address _osr_entry;               // the entry to the osr method
  77 };
  78 
  79 struct osr_result {
  80   nmethod* nm;                      // osr nmethod
  81   address return_addr;              // osr blob return address
  82 };
  83 
  84 // Result returned to frame manager
  85 union frame_manager_message {
  86   call_message _to_call;            // describes callee
  87   osr_message _osr;                 // describes the osr
  88   osr_result _osr_result;           // result of OSR request

  89 };
  90 
  91 class BytecodeInterpreter : StackObj {
  92 friend class SharedRuntime;
  93 friend class AbstractInterpreterGenerator;
  94 friend class CppInterpreterGenerator;
  95 friend class InterpreterGenerator;
  96 friend class InterpreterMacroAssembler;
  97 friend class frame;
  98 friend class VMStructs;
  99 
 100 public:
 101     enum messages {
 102          no_request = 0,            // unused
 103          initialize,                // Perform one time interpreter initializations (assumes all switches set)
 104          // status message to C++ interpreter
 105          method_entry,              // initial method entry to interpreter
 106          method_resume,             // frame manager response to return_from_method request (assuming a frame to resume)
 107          deopt_resume,              // returning from a native call into a deopted frame
 108          deopt_resume2,             // deopt resume as a result of a PopFrame
 109          got_monitors,              // frame manager response to more_monitors request
 110          rethrow_exception,         // unwinding and throwing exception
 111          // requests to frame manager from C++ interpreter
 112          call_method,               // request for new frame from interpreter, manager responds with method_entry
 113          return_from_method,        // request from interpreter to unwind, manager responds with method_continue
 114          more_monitors,             // need a new monitor
 115          throwing_exception,        // unwind stack and rethrow
 116          popping_frame,             // unwind call and retry call
 117          do_osr,                    // request this invocation be OSR's
 118          early_return               // early return as commanded by jvmti
 119     };
 120 
 121 private:
 122     JavaThread*           _thread;        // the vm's java thread pointer
 123     address               _bcp;           // instruction pointer
 124     intptr_t*             _locals;        // local variable pointer
 125     ConstantPoolCache*    _constants;     // constant pool cache
 126     Method*               _method;        // method being executed
 127     DataLayout*           _mdx;           // compiler profiling data for current bytecode
 128     intptr_t*             _stack;         // expression stack
 129     messages              _msg;           // frame manager <-> interpreter message
 130     frame_manager_message _result;        // result to frame manager
 131     interpreterState      _prev_link;     // previous interpreter state
 132     oop                   _oop_temp;      // mirror for interpreted native, null otherwise
 133     intptr_t*             _stack_base;    // base of expression stack
 134     intptr_t*             _stack_limit;   // limit of expression stack
 135     BasicObjectLock*      _monitor_base;  // base of monitors on the native stack
 136 
 137 
 138 public:


 199 inline void set_bcp(address new_bcp) { _bcp = new_bcp; }
 200 
 201 inline intptr_t* locals() { return _locals; }
 202 
 203 inline ConstantPoolCache* constants() { return _constants; }
 204 inline Method* method() { return _method; }
 205 inline DataLayout* mdx() { return _mdx; }
 206 inline void set_mdx(DataLayout *new_mdx) { _mdx = new_mdx; }
 207 
 208 inline messages msg() { return _msg; }
 209 inline void set_msg(messages new_msg) { _msg = new_msg; }
 210 
 211 inline Method* callee() { return _result._to_call._callee; }
 212 inline void set_callee(Method* new_callee) { _result._to_call._callee = new_callee; }
 213 inline void set_callee_entry_point(address entry) { _result._to_call._callee_entry_point = entry; }
 214 inline void set_osr_buf(address buf) { _result._osr._osr_buf = buf; }
 215 inline void set_osr_entry(address entry) { _result._osr._osr_entry = entry; }
 216 inline int bcp_advance() { return _result._to_call._bcp_advance; }
 217 inline void set_bcp_advance(int count) { _result._to_call._bcp_advance = count; }
 218 


 219 inline interpreterState prev() { return _prev_link; }
 220 
 221 inline intptr_t* stack() { return _stack; }
 222 inline void set_stack(intptr_t* new_stack) { _stack = new_stack; }
 223 
 224 
 225 inline intptr_t* stack_base() { return _stack_base; }
 226 inline intptr_t* stack_limit() { return _stack_limit; }
 227 
 228 inline BasicObjectLock* monitor_base() { return _monitor_base; }
 229 
 230 /*
 231  * 64-bit Arithmetic:
 232  *
 233  * The functions below follow the semantics of the
 234  * ladd, land, ldiv, lmul, lor, lxor, and lrem bytecodes,
 235  * respectively.
 236  */
 237 
 238 static jlong VMlongAdd(jlong op1, jlong op2);