104 static void bootstrap_finished(TRAPS); 105 106 static bool shutdown_called() { 107 return _shutdown_called; 108 } 109 110 /** 111 * Lets JVMCI modify the compilation level currently selected for a method by 112 * the VM compilation policy. 113 * 114 * @param method the method being scheduled for compilation 115 * @param is_osr specifies if the compilation is an OSR compilation 116 * @param level the compilation level currently selected by the VM compilation policy 117 * @param thread the current thread 118 * @return the compilation level to use for the compilation 119 */ 120 static CompLevel adjust_comp_level(const methodHandle& method, bool is_osr, CompLevel level, JavaThread* thread); 121 122 static BasicType kindToBasicType(Handle kind, TRAPS); 123 124 // The following routines are all called from compiled JVMCI code 125 126 static void new_instance(JavaThread* thread, Klass* klass); 127 static void new_array(JavaThread* thread, Klass* klass, jint length); 128 static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims); 129 static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length); 130 static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror); 131 static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted); 132 static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3); 133 static jint identity_hash_code(JavaThread* thread, oopDesc* obj); 134 static address exception_handler_for_pc(JavaThread* thread); 135 static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock); 136 static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock); 137 static jboolean object_notify(JavaThread* thread, oopDesc* obj); 138 static jboolean object_notifyAll(JavaThread* thread, oopDesc* obj); 139 static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value); 140 static oopDesc* load_and_clear_exception(JavaThread* thread); 141 static void log_printf(JavaThread* thread, const char* format, jlong v1, jlong v2, jlong v3); 142 static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline); 143 // Print the passed in object, optionally followed by a newline. If 144 // as_string is true and the object is a java.lang.String then it 145 // printed as a string, otherwise the type of the object is printed 146 // followed by its address. 147 static void log_object(JavaThread* thread, oopDesc* object, bool as_string, bool newline); 148 #if INCLUDE_G1GC 149 static void write_barrier_pre(JavaThread* thread, oopDesc* obj); 150 static void write_barrier_post(JavaThread* thread, void* card); | 104 static void bootstrap_finished(TRAPS); 105 106 static bool shutdown_called() { 107 return _shutdown_called; 108 } 109 110 /** 111 * Lets JVMCI modify the compilation level currently selected for a method by 112 * the VM compilation policy. 113 * 114 * @param method the method being scheduled for compilation 115 * @param is_osr specifies if the compilation is an OSR compilation 116 * @param level the compilation level currently selected by the VM compilation policy 117 * @param thread the current thread 118 * @return the compilation level to use for the compilation 119 */ 120 static CompLevel adjust_comp_level(const methodHandle& method, bool is_osr, CompLevel level, JavaThread* thread); 121 122 static BasicType kindToBasicType(Handle kind, TRAPS); 123 124 static void new_instance_common(JavaThread* thread, Klass* klass, bool null_on_fail); 125 static void new_array_common(JavaThread* thread, Klass* klass, jint length, bool null_on_fail); 126 static void new_multi_array_common(JavaThread* thread, Klass* klass, int rank, jint* dims, bool null_on_fail); 127 static void dynamic_new_array_common(JavaThread* thread, oopDesc* element_mirror, jint length, bool null_on_fail); 128 static void dynamic_new_instance_common(JavaThread* thread, oopDesc* type_mirror, bool null_on_fail); 129 130 // The following routines are called from compiled JVMCI code 131 132 // When allocation fails, these stubs: 133 // 1. Exercise -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError handling and also 134 // post a JVMTI_EVENT_RESOURCE_EXHAUSTED event if the failure is an OutOfMemroyError 135 // 2. Return NULL with a pending exception. 136 // Compiled code must ensure these stubs are not called twice for the same allocation 137 // site due to the non-repeatable side effects in the case of OOME. 138 static void new_instance(JavaThread* thread, Klass* klass) { new_instance_common(thread, klass, false); } 139 static void new_array(JavaThread* thread, Klass* klass, jint length) { new_array_common(thread, klass, length, false); } 140 static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims) { new_multi_array_common(thread, klass, rank, dims, false); } 141 static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length) { dynamic_new_array_common(thread, element_mirror, length, false); } 142 static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror) { dynamic_new_instance_common(thread, type_mirror, false); } 143 144 // When allocation fails, these stubs return NULL and have no pending exception. Compiled code 145 // can use these stubs if a failed allocation will be retried (e.g., by deoptimizing and 146 // re-executing in the interpreter). 147 static void new_instance_or_null(JavaThread* thread, Klass* klass) { new_instance_common(thread, klass, true); } 148 static void new_array_or_null(JavaThread* thread, Klass* klass, jint length) { new_array_common(thread, klass, length, true); } 149 static void new_multi_array_or_null(JavaThread* thread, Klass* klass, int rank, jint* dims) { new_multi_array_common(thread, klass, rank, dims, true); } 150 static void dynamic_new_array_or_null(JavaThread* thread, oopDesc* element_mirror, jint length) { dynamic_new_array_common(thread, element_mirror, length, true); } 151 static void dynamic_new_instance_or_null(JavaThread* thread, oopDesc* type_mirror) { dynamic_new_instance_common(thread, type_mirror, true); } 152 153 static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted); 154 static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3); 155 static jint identity_hash_code(JavaThread* thread, oopDesc* obj); 156 static address exception_handler_for_pc(JavaThread* thread); 157 static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock); 158 static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock); 159 static jboolean object_notify(JavaThread* thread, oopDesc* obj); 160 static jboolean object_notifyAll(JavaThread* thread, oopDesc* obj); 161 static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value); 162 static oopDesc* load_and_clear_exception(JavaThread* thread); 163 static void log_printf(JavaThread* thread, const char* format, jlong v1, jlong v2, jlong v3); 164 static void log_primitive(JavaThread* thread, jchar typeChar, jlong value, jboolean newline); 165 // Print the passed in object, optionally followed by a newline. If 166 // as_string is true and the object is a java.lang.String then it 167 // printed as a string, otherwise the type of the object is printed 168 // followed by its address. 169 static void log_object(JavaThread* thread, oopDesc* object, bool as_string, bool newline); 170 #if INCLUDE_G1GC 171 static void write_barrier_pre(JavaThread* thread, oopDesc* obj); 172 static void write_barrier_post(JavaThread* thread, void* card); |