46 #include "utilities/defaultStream.hpp" 47 48 #if defined(_MSC_VER) 49 #define strtoll _strtoi64 50 #endif 51 52 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL; 53 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; 54 bool JVMCIRuntime::_well_known_classes_initialized = false; 55 int JVMCIRuntime::_trivial_prefixes_count = 0; 56 char** JVMCIRuntime::_trivial_prefixes = NULL; 57 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none; 58 bool JVMCIRuntime::_shutdown_called = false; 59 60 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) { 61 if (kind.is_null()) { 62 THROW_(vmSymbols::java_lang_NullPointerException(), T_ILLEGAL); 63 } 64 jchar ch = JavaKind::typeChar(kind); 65 switch(ch) { 66 case 'z': return T_BOOLEAN; 67 case 'b': return T_BYTE; 68 case 's': return T_SHORT; 69 case 'c': return T_CHAR; 70 case 'i': return T_INT; 71 case 'f': return T_FLOAT; 72 case 'j': return T_LONG; 73 case 'd': return T_DOUBLE; 74 case 'a': return T_OBJECT; 75 case '-': return T_ILLEGAL; 76 default: 77 JVMCI_ERROR_(T_ILLEGAL, "unexpected Kind: %c", ch); 78 } 79 } 80 81 // Simple helper to see if the caller of a runtime stub which 82 // entered the VM has been deoptimized 83 84 static bool caller_is_deopted() { 85 JavaThread* thread = JavaThread::current(); 86 RegisterMap reg_map(thread, false); 87 frame runtime_frame = thread->last_frame(); 88 frame caller_frame = runtime_frame.sender(®_map); 89 assert(caller_frame.is_compiled_frame(), "must be compiled"); 90 return caller_frame.is_deoptimized_frame(); 91 } 92 93 // Stress deoptimization 94 static void deopt_caller() { 557 fatal("<anonymous error>"); 558 } 559 } else if (buf != NULL) { 560 tty->print(buf, v1, v2, v3); 561 } else { 562 assert(v2 == 0, "v2 != 0"); 563 assert(v3 == 0, "v3 != 0"); 564 decipher(v1, false); 565 } 566 JRT_END 567 PRAGMA_DIAG_POP 568 569 JRT_LEAF(void, JVMCIRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) 570 union { 571 jlong l; 572 jdouble d; 573 jfloat f; 574 } uu; 575 uu.l = value; 576 switch (typeChar) { 577 case 'z': tty->print(value == 0 ? "false" : "true"); break; 578 case 'b': tty->print("%d", (jbyte) value); break; 579 case 'c': tty->print("%c", (jchar) value); break; 580 case 's': tty->print("%d", (jshort) value); break; 581 case 'i': tty->print("%d", (jint) value); break; 582 case 'f': tty->print("%f", uu.f); break; 583 case 'j': tty->print(JLONG_FORMAT, value); break; 584 case 'd': tty->print("%lf", uu.d); break; 585 default: assert(false, "unknown typeChar"); break; 586 } 587 if (newline) { 588 tty->cr(); 589 } 590 JRT_END 591 592 JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj)) 593 return (jint) obj->identity_hash(); 594 JRT_END 595 596 JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted)) 597 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate. 598 // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF. 599 Handle receiverHandle(thread, receiver); 600 MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock); 601 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); 602 if (receiverThread == NULL) { 603 // The other thread may exit during this process, which is ok so return false. 604 return JNI_FALSE; | 46 #include "utilities/defaultStream.hpp" 47 48 #if defined(_MSC_VER) 49 #define strtoll _strtoi64 50 #endif 51 52 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL; 53 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; 54 bool JVMCIRuntime::_well_known_classes_initialized = false; 55 int JVMCIRuntime::_trivial_prefixes_count = 0; 56 char** JVMCIRuntime::_trivial_prefixes = NULL; 57 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none; 58 bool JVMCIRuntime::_shutdown_called = false; 59 60 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) { 61 if (kind.is_null()) { 62 THROW_(vmSymbols::java_lang_NullPointerException(), T_ILLEGAL); 63 } 64 jchar ch = JavaKind::typeChar(kind); 65 switch(ch) { 66 case 'Z': return T_BOOLEAN; 67 case 'B': return T_BYTE; 68 case 'S': return T_SHORT; 69 case 'C': return T_CHAR; 70 case 'I': return T_INT; 71 case 'F': return T_FLOAT; 72 case 'J': return T_LONG; 73 case 'D': return T_DOUBLE; 74 case 'A': return T_OBJECT; 75 case '-': return T_ILLEGAL; 76 default: 77 JVMCI_ERROR_(T_ILLEGAL, "unexpected Kind: %c", ch); 78 } 79 } 80 81 // Simple helper to see if the caller of a runtime stub which 82 // entered the VM has been deoptimized 83 84 static bool caller_is_deopted() { 85 JavaThread* thread = JavaThread::current(); 86 RegisterMap reg_map(thread, false); 87 frame runtime_frame = thread->last_frame(); 88 frame caller_frame = runtime_frame.sender(®_map); 89 assert(caller_frame.is_compiled_frame(), "must be compiled"); 90 return caller_frame.is_deoptimized_frame(); 91 } 92 93 // Stress deoptimization 94 static void deopt_caller() { 557 fatal("<anonymous error>"); 558 } 559 } else if (buf != NULL) { 560 tty->print(buf, v1, v2, v3); 561 } else { 562 assert(v2 == 0, "v2 != 0"); 563 assert(v3 == 0, "v3 != 0"); 564 decipher(v1, false); 565 } 566 JRT_END 567 PRAGMA_DIAG_POP 568 569 JRT_LEAF(void, JVMCIRuntime::log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline)) 570 union { 571 jlong l; 572 jdouble d; 573 jfloat f; 574 } uu; 575 uu.l = value; 576 switch (typeChar) { 577 case 'Z': tty->print(value == 0 ? "false" : "true"); break; 578 case 'B': tty->print("%d", (jbyte) value); break; 579 case 'C': tty->print("%c", (jchar) value); break; 580 case 'S': tty->print("%d", (jshort) value); break; 581 case 'I': tty->print("%d", (jint) value); break; 582 case 'F': tty->print("%f", uu.f); break; 583 case 'J': tty->print(JLONG_FORMAT, value); break; 584 case 'D': tty->print("%lf", uu.d); break; 585 default: assert(false, "unknown typeChar"); break; 586 } 587 if (newline) { 588 tty->cr(); 589 } 590 JRT_END 591 592 JRT_ENTRY(jint, JVMCIRuntime::identity_hash_code(JavaThread* thread, oopDesc* obj)) 593 return (jint) obj->identity_hash(); 594 JRT_END 595 596 JRT_ENTRY(jboolean, JVMCIRuntime::thread_is_interrupted(JavaThread* thread, oopDesc* receiver, jboolean clear_interrupted)) 597 // Ensure that the C++ Thread and OSThread structures aren't freed before we operate. 598 // This locking requires thread_in_vm which is why this method cannot be JRT_LEAF. 599 Handle receiverHandle(thread, receiver); 600 MutexLockerEx ml(thread->threadObj() == (void*)receiver ? NULL : Threads_lock); 601 JavaThread* receiverThread = java_lang_Thread::thread(receiverHandle()); 602 if (receiverThread == NULL) { 603 // The other thread may exit during this process, which is ok so return false. 604 return JNI_FALSE; |