44 // shared functionality such as exception forwarding (C++ to 45 // Java exceptions), locking/unlocking mechanisms, statistical 46 // information, etc. 47 48 class SharedRuntime: AllStatic { 49 friend class VMStructs; 50 51 private: 52 static methodHandle resolve_sub_helper(JavaThread *thread, 53 bool is_virtual, 54 bool is_optimized, TRAPS); 55 56 // Shared stub locations 57 58 static RuntimeStub* _wrong_method_blob; 59 static RuntimeStub* _wrong_method_abstract_blob; 60 static RuntimeStub* _ic_miss_blob; 61 static RuntimeStub* _resolve_opt_virtual_call_blob; 62 static RuntimeStub* _resolve_virtual_call_blob; 63 static RuntimeStub* _resolve_static_call_blob; 64 65 static DeoptimizationBlob* _deopt_blob; 66 67 static SafepointBlob* _polling_page_vectors_safepoint_handler_blob; 68 static SafepointBlob* _polling_page_safepoint_handler_blob; 69 static SafepointBlob* _polling_page_return_handler_blob; 70 71 #ifdef COMPILER2 72 static UncommonTrapBlob* _uncommon_trap_blob; 73 #endif // COMPILER2 74 75 #ifndef PRODUCT 76 // Counters 77 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable) 78 #endif // !PRODUCT 79 80 private: 81 enum { POLL_AT_RETURN, POLL_AT_LOOP, POLL_AT_VECTOR_LOOP }; 82 static SafepointBlob* generate_handler_blob(address call_ptr, int poll_type); 83 static RuntimeStub* generate_resolve_blob(address destination, const char* name); 84 85 public: 86 static void generate_stubs(void); 87 88 // max bytes for each dtrace string parameter 89 enum { max_dtrace_string_size = 256 }; 90 91 // The following arithmetic routines are used on platforms that do 92 // not have machine instructions to implement their functionality. 93 // Do not remove these. 94 95 // long arithmetics 96 static jlong lmul(jlong y, jlong x); 97 static jlong ldiv(jlong y, jlong x); 98 static jlong lrem(jlong y, jlong x); 99 100 // float and double remainder 101 static jfloat frem(jfloat x, jfloat y); 102 static jdouble drem(jdouble x, jdouble y); 103 218 return _wrong_method_abstract_blob->entry_point(); 219 } 220 221 #ifdef COMPILER2 222 static void generate_uncommon_trap_blob(void); 223 static UncommonTrapBlob* uncommon_trap_blob() { return _uncommon_trap_blob; } 224 #endif // COMPILER2 225 226 static address get_resolve_opt_virtual_call_stub(){ 227 assert(_resolve_opt_virtual_call_blob != NULL, "oops"); 228 return _resolve_opt_virtual_call_blob->entry_point(); 229 } 230 static address get_resolve_virtual_call_stub() { 231 assert(_resolve_virtual_call_blob != NULL, "oops"); 232 return _resolve_virtual_call_blob->entry_point(); 233 } 234 static address get_resolve_static_call_stub() { 235 assert(_resolve_static_call_blob != NULL, "oops"); 236 return _resolve_static_call_blob->entry_point(); 237 } 238 239 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; } 240 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; } 241 static SafepointBlob* polling_page_vectors_safepoint_handler_blob() { return _polling_page_vectors_safepoint_handler_blob; } 242 243 // Counters 244 #ifndef PRODUCT 245 static address nof_megamorphic_calls_addr() { return (address)&_nof_megamorphic_calls; } 246 #endif // PRODUCT 247 248 // Helper routine for full-speed JVMTI exception throwing support 249 static void throw_and_post_jvmti_exception(JavaThread *thread, Handle h_exception); 250 static void throw_and_post_jvmti_exception(JavaThread *thread, Symbol* name, const char *message = NULL); 251 252 // RedefineClasses() tracing support for obsolete method entry 253 static int rc_trace_method_entry(JavaThread* thread, Method* m); 254 255 // To be used as the entry point for unresolved native methods. 256 static address native_method_throw_unsatisfied_link_error_entry(); 257 static address native_method_throw_unsupported_operation_exception_entry(); | 44 // shared functionality such as exception forwarding (C++ to 45 // Java exceptions), locking/unlocking mechanisms, statistical 46 // information, etc. 47 48 class SharedRuntime: AllStatic { 49 friend class VMStructs; 50 51 private: 52 static methodHandle resolve_sub_helper(JavaThread *thread, 53 bool is_virtual, 54 bool is_optimized, TRAPS); 55 56 // Shared stub locations 57 58 static RuntimeStub* _wrong_method_blob; 59 static RuntimeStub* _wrong_method_abstract_blob; 60 static RuntimeStub* _ic_miss_blob; 61 static RuntimeStub* _resolve_opt_virtual_call_blob; 62 static RuntimeStub* _resolve_virtual_call_blob; 63 static RuntimeStub* _resolve_static_call_blob; 64 static address _memento_stack_trace_return_handler; 65 static address _memento_stack_trace_exception_handler; 66 67 static DeoptimizationBlob* _deopt_blob; 68 69 static SafepointBlob* _polling_page_vectors_safepoint_handler_blob; 70 static SafepointBlob* _polling_page_safepoint_handler_blob; 71 static SafepointBlob* _polling_page_return_handler_blob; 72 73 #ifdef COMPILER2 74 static UncommonTrapBlob* _uncommon_trap_blob; 75 #endif // COMPILER2 76 77 #ifndef PRODUCT 78 // Counters 79 static int _nof_megamorphic_calls; // total # of megamorphic calls (through vtable) 80 #endif // !PRODUCT 81 82 private: 83 enum { POLL_AT_RETURN, POLL_AT_LOOP, POLL_AT_VECTOR_LOOP }; 84 static SafepointBlob* generate_handler_blob(address call_ptr, int poll_type); 85 static RuntimeStub* generate_resolve_blob(address destination, const char* name); 86 static void generate_memento_stack_trace_blob(); 87 88 public: 89 static void generate_stubs(void); 90 91 // max bytes for each dtrace string parameter 92 enum { max_dtrace_string_size = 256 }; 93 94 // The following arithmetic routines are used on platforms that do 95 // not have machine instructions to implement their functionality. 96 // Do not remove these. 97 98 // long arithmetics 99 static jlong lmul(jlong y, jlong x); 100 static jlong ldiv(jlong y, jlong x); 101 static jlong lrem(jlong y, jlong x); 102 103 // float and double remainder 104 static jfloat frem(jfloat x, jfloat y); 105 static jdouble drem(jdouble x, jdouble y); 106 221 return _wrong_method_abstract_blob->entry_point(); 222 } 223 224 #ifdef COMPILER2 225 static void generate_uncommon_trap_blob(void); 226 static UncommonTrapBlob* uncommon_trap_blob() { return _uncommon_trap_blob; } 227 #endif // COMPILER2 228 229 static address get_resolve_opt_virtual_call_stub(){ 230 assert(_resolve_opt_virtual_call_blob != NULL, "oops"); 231 return _resolve_opt_virtual_call_blob->entry_point(); 232 } 233 static address get_resolve_virtual_call_stub() { 234 assert(_resolve_virtual_call_blob != NULL, "oops"); 235 return _resolve_virtual_call_blob->entry_point(); 236 } 237 static address get_resolve_static_call_stub() { 238 assert(_resolve_static_call_blob != NULL, "oops"); 239 return _resolve_static_call_blob->entry_point(); 240 } 241 242 static address get_memento_stack_trace_return_handler() { return _memento_stack_trace_return_handler; } 243 static address get_memento_stack_trace_exception_handler() { return _memento_stack_trace_exception_handler; } 244 static bool is_memento_stack_trace_return_handler(address addr) { return addr == _memento_stack_trace_return_handler; } 245 static bool is_memento_stack_trace_exception_handler(address addr) { return addr == _memento_stack_trace_exception_handler; } 246 247 static SafepointBlob* polling_page_return_handler_blob() { return _polling_page_return_handler_blob; } 248 static SafepointBlob* polling_page_safepoint_handler_blob() { return _polling_page_safepoint_handler_blob; } 249 static SafepointBlob* polling_page_vectors_safepoint_handler_blob() { return _polling_page_vectors_safepoint_handler_blob; } 250 251 // Counters 252 #ifndef PRODUCT 253 static address nof_megamorphic_calls_addr() { return (address)&_nof_megamorphic_calls; } 254 #endif // PRODUCT 255 256 // Helper routine for full-speed JVMTI exception throwing support 257 static void throw_and_post_jvmti_exception(JavaThread *thread, Handle h_exception); 258 static void throw_and_post_jvmti_exception(JavaThread *thread, Symbol* name, const char *message = NULL); 259 260 // RedefineClasses() tracing support for obsolete method entry 261 static int rc_trace_method_entry(JavaThread* thread, Method* m); 262 263 // To be used as the entry point for unresolved native methods. 264 static address native_method_throw_unsatisfied_link_error_entry(); 265 static address native_method_throw_unsupported_operation_exception_entry(); |