59 #endif |
59 #endif |
60 |
60 |
61 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL; |
61 jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL; |
62 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; |
62 bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false; |
63 bool JVMCIRuntime::_well_known_classes_initialized = false; |
63 bool JVMCIRuntime::_well_known_classes_initialized = false; |
64 int JVMCIRuntime::_trivial_prefixes_count = 0; |
|
65 char** JVMCIRuntime::_trivial_prefixes = NULL; |
|
66 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none; |
64 JVMCIRuntime::CompLevelAdjustment JVMCIRuntime::_comp_level_adjustment = JVMCIRuntime::none; |
67 bool JVMCIRuntime::_shutdown_called = false; |
65 bool JVMCIRuntime::_shutdown_called = false; |
68 |
66 |
69 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) { |
67 BasicType JVMCIRuntime::kindToBasicType(Handle kind, TRAPS) { |
70 if (kind.is_null()) { |
68 if (kind.is_null()) { |
534 return exception; |
532 return exception; |
535 JRT_END |
533 JRT_END |
536 |
534 |
537 PRAGMA_DIAG_PUSH |
535 PRAGMA_DIAG_PUSH |
538 PRAGMA_FORMAT_NONLITERAL_IGNORED |
536 PRAGMA_FORMAT_NONLITERAL_IGNORED |
539 JRT_LEAF(void, JVMCIRuntime::log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3)) |
537 JRT_LEAF(void, JVMCIRuntime::log_printf(JavaThread* thread, const char* format, jlong v1, jlong v2, jlong v3)) |
540 ResourceMark rm; |
538 ResourceMark rm; |
541 assert(format != NULL && java_lang_String::is_instance(format), "must be"); |
539 tty->print(format, v1, v2, v3); |
542 char *buf = java_lang_String::as_utf8_string(format); |
|
543 tty->print((const char*)buf, v1, v2, v3); |
|
544 JRT_END |
540 JRT_END |
545 PRAGMA_DIAG_POP |
541 PRAGMA_DIAG_POP |
546 |
542 |
547 static void decipher(jlong v, bool ignoreZero) { |
543 static void decipher(jlong v, bool ignoreZero) { |
548 if (v != 0 || !ignoreZero) { |
544 if (v != 0 || !ignoreZero) { |
683 "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); |
679 "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); |
684 |
680 |
685 Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime", |
681 Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime", |
686 "runtime", |
682 "runtime", |
687 "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK); |
683 "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK); |
688 objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result); |
|
689 if (trivial_prefixes != NULL) { |
|
690 char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler); |
|
691 for (int i = 0; i < trivial_prefixes->length(); i++) { |
|
692 oop str = trivial_prefixes->obj_at(i); |
|
693 if (str == NULL) { |
|
694 THROW(vmSymbols::java_lang_NullPointerException()); |
|
695 } else { |
|
696 prefixes[i] = strdup(java_lang_String::as_utf8_string(str)); |
|
697 } |
|
698 } |
|
699 _trivial_prefixes = prefixes; |
|
700 _trivial_prefixes_count = trivial_prefixes->length(); |
|
701 } |
|
702 int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result); |
684 int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result); |
703 assert(adjustment >= JVMCIRuntime::none && |
685 assert(adjustment >= JVMCIRuntime::none && |
704 adjustment <= JVMCIRuntime::by_full_signature, |
686 adjustment <= JVMCIRuntime::by_full_signature, |
705 "compilation level adjustment out of bounds"); |
687 "compilation level adjustment out of bounds"); |
706 _comp_level_adjustment = (CompLevelAdjustment) adjustment; |
688 _comp_level_adjustment = (CompLevelAdjustment) adjustment; |
916 JavaValue result(T_VOID); |
898 JavaValue result(T_VOID); |
917 JavaCallArguments args; |
899 JavaCallArguments args; |
918 args.push_oop(receiver); |
900 args.push_oop(receiver); |
919 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::bootstrapFinished_method_name(), vmSymbols::void_method_signature(), &args, CHECK); |
901 JavaCalls::call_special(&result, receiver->klass(), vmSymbols::bootstrapFinished_method_name(), vmSymbols::void_method_signature(), &args, CHECK); |
920 } |
902 } |
921 |
|
922 bool JVMCIRuntime::treat_as_trivial(Method* method) { |
|
923 if (_HotSpotJVMCIRuntime_initialized) { |
|
924 for (int i = 0; i < _trivial_prefixes_count; i++) { |
|
925 if (method->method_holder()->name()->starts_with(_trivial_prefixes[i])) { |
|
926 return true; |
|
927 } |
|
928 } |
|
929 } |
|
930 return false; |
|
931 } |
|