20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP 26 #define SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP 27 28 #include "interpreter/bytecode.hpp" 29 #include "interpreter/linkResolver.hpp" 30 #include "memory/universe.hpp" 31 #include "oops/method.hpp" 32 #include "runtime/frame.inline.hpp" 33 #include "runtime/signature.hpp" 34 #include "runtime/thread.hpp" 35 #include "utilities/macros.hpp" 36 37 // The InterpreterRuntime is called by the interpreter for everything 38 // that cannot/should not be dealt with in assembly and needs C support. 39 40 class InterpreterRuntime: AllStatic { 41 friend class BytecodeClosure; // for method and bcp 42 friend class PrintingClosure; // for method and bcp 43 44 private: 45 // Helper class to access current interpreter state 46 class LastFrameAccessor : public StackObj { 47 frame _last_frame; 48 public: 49 LastFrameAccessor(JavaThread* thread) { 50 assert(thread == Thread::current(), "sanity"); 51 _last_frame = thread->last_frame(); 52 } 53 bool is_interpreted_frame() const { return _last_frame.is_interpreted_frame(); } 54 Method* method() const { return _last_frame.interpreter_frame_method(); } 55 address bcp() const { return _last_frame.interpreter_frame_bcp(); } 56 int bci() const { return _last_frame.interpreter_frame_bci(); } 57 address mdp() const { return _last_frame.interpreter_frame_mdp(); } 58 59 void set_bcp(address bcp) { _last_frame.interpreter_frame_set_bcp(bcp); } 152 static void resolve_invokehandle (JavaThread* thread); 153 static void resolve_invokedynamic(JavaThread* thread); 154 155 public: 156 // Synchronization 157 static void monitorenter(JavaThread* thread, BasicObjectLock* elem); 158 static void monitorexit (JavaThread* thread, BasicObjectLock* elem); 159 160 static void throw_illegal_monitor_state_exception(JavaThread* thread); 161 static void new_illegal_monitor_state_exception(JavaThread* thread); 162 163 // Breakpoints 164 static void _breakpoint(JavaThread* thread, Method* method, address bcp); 165 static Bytecodes::Code get_original_bytecode_at(JavaThread* thread, Method* method, address bcp); 166 static void set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code); 167 static bool is_breakpoint(JavaThread *thread) { return Bytecodes::code_or_bp_at(LastFrameAccessor(thread).bcp()) == Bytecodes::_breakpoint; } 168 169 // Safepoints 170 static void at_safepoint(JavaThread* thread); 171 172 // Debugger support 173 static void post_field_access(JavaThread *thread, oopDesc* obj, 174 ConstantPoolCacheEntry *cp_entry); 175 static void post_field_modification(JavaThread *thread, oopDesc* obj, 176 ConstantPoolCacheEntry *cp_entry, jvalue *value); 177 static void post_method_entry(JavaThread *thread); 178 static void post_method_exit (JavaThread *thread); 179 static int interpreter_contains(address pc); 180 181 // Native signature handlers 182 static void prepare_native_call(JavaThread* thread, Method* method); 183 static address slow_signature_handler(JavaThread* thread, 184 Method* method, 185 intptr_t* from, intptr_t* to); 186 187 #if defined(IA32) || defined(AMD64) || defined(ARM) 188 // Popframe support (only needed on x86, AMD64 and ARM) 189 static void popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address); 190 #endif 191 | 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP 26 #define SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP 27 28 #include "interpreter/bytecode.hpp" 29 #include "interpreter/linkResolver.hpp" 30 #include "memory/universe.hpp" 31 #include "oops/method.hpp" 32 #include "runtime/frame.inline.hpp" 33 #include "runtime/signature.hpp" 34 #include "runtime/thread.hpp" 35 #include "utilities/macros.hpp" 36 37 // The InterpreterRuntime is called by the interpreter for everything 38 // that cannot/should not be dealt with in assembly and needs C support. 39 40 struct FrameInfo { 41 address pc; 42 address fp; 43 address sp; 44 }; 45 46 class InterpreterRuntime: AllStatic { 47 friend class BytecodeClosure; // for method and bcp 48 friend class PrintingClosure; // for method and bcp 49 50 private: 51 // Helper class to access current interpreter state 52 class LastFrameAccessor : public StackObj { 53 frame _last_frame; 54 public: 55 LastFrameAccessor(JavaThread* thread) { 56 assert(thread == Thread::current(), "sanity"); 57 _last_frame = thread->last_frame(); 58 } 59 bool is_interpreted_frame() const { return _last_frame.is_interpreted_frame(); } 60 Method* method() const { return _last_frame.interpreter_frame_method(); } 61 address bcp() const { return _last_frame.interpreter_frame_bcp(); } 62 int bci() const { return _last_frame.interpreter_frame_bci(); } 63 address mdp() const { return _last_frame.interpreter_frame_mdp(); } 64 65 void set_bcp(address bcp) { _last_frame.interpreter_frame_set_bcp(bcp); } 158 static void resolve_invokehandle (JavaThread* thread); 159 static void resolve_invokedynamic(JavaThread* thread); 160 161 public: 162 // Synchronization 163 static void monitorenter(JavaThread* thread, BasicObjectLock* elem); 164 static void monitorexit (JavaThread* thread, BasicObjectLock* elem); 165 166 static void throw_illegal_monitor_state_exception(JavaThread* thread); 167 static void new_illegal_monitor_state_exception(JavaThread* thread); 168 169 // Breakpoints 170 static void _breakpoint(JavaThread* thread, Method* method, address bcp); 171 static Bytecodes::Code get_original_bytecode_at(JavaThread* thread, Method* method, address bcp); 172 static void set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code); 173 static bool is_breakpoint(JavaThread *thread) { return Bytecodes::code_or_bp_at(LastFrameAccessor(thread).bcp()) == Bytecodes::_breakpoint; } 174 175 // Safepoints 176 static void at_safepoint(JavaThread* thread); 177 178 // Continuation 179 static void freeze(JavaThread* thread, FrameInfo* fi, oop context); 180 static void pop_and_thaw0(JavaThread* thread, FrameInfo* fi, int num_frames, bool pop); 181 static void pop_and_thaw(JavaThread* thread, FrameInfo* fi, int num_frames); 182 static void thaw(JavaThread* thread, FrameInfo* fi, int num_frames); 183 184 // Debugger support 185 static void post_field_access(JavaThread *thread, oopDesc* obj, 186 ConstantPoolCacheEntry *cp_entry); 187 static void post_field_modification(JavaThread *thread, oopDesc* obj, 188 ConstantPoolCacheEntry *cp_entry, jvalue *value); 189 static void post_method_entry(JavaThread *thread); 190 static void post_method_exit (JavaThread *thread); 191 static int interpreter_contains(address pc); 192 193 // Native signature handlers 194 static void prepare_native_call(JavaThread* thread, Method* method); 195 static address slow_signature_handler(JavaThread* thread, 196 Method* method, 197 intptr_t* from, intptr_t* to); 198 199 #if defined(IA32) || defined(AMD64) || defined(ARM) 200 // Popframe support (only needed on x86, AMD64 and ARM) 201 static void popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address); 202 #endif 203 |