< prev index next >

src/hotspot/share/jvmci/jvmciRuntime.cpp

Print this page




 900     CLEAR_PENDING_EXCEPTION;
 901     if (exception->is_a(SystemDictionary::ThreadDeath_klass())) {
 902       // Don't print anything if we are being killed.
 903     } else {
 904       java_lang_Throwable::print_stack_trace(exception, tty);
 905 
 906       // Clear and ignore any exceptions raised during printing
 907       CLEAR_PENDING_EXCEPTION;
 908     }
 909     if (!clear) {
 910       THREAD->set_pending_exception(exception(), exception_file, exception_line);
 911     }
 912   }
 913 }
 914 
 915 
 916 void JVMCIRuntime::exit_on_pending_exception(JVMCIEnv* JVMCIENV, const char* message) {
 917   JavaThread* THREAD = JavaThread::current();
 918 
 919   static volatile int report_error = 0;
 920   if (!report_error && Atomic::cmpxchg(1, &report_error, 0) == 0) {
 921     // Only report an error once
 922     tty->print_raw_cr(message);
 923     if (JVMCIENV != NULL) {
 924       JVMCIENV->describe_pending_exception(true);
 925     } else {
 926       describe_pending_hotspot_exception(THREAD, true);
 927     }
 928   } else {
 929     // Allow error reporting thread to print the stack trace.
 930     THREAD->sleep(200);
 931   }
 932 
 933   before_exit(THREAD);
 934   vm_exit(-1);
 935 }
 936 
 937 // ------------------------------------------------------------------
 938 // Note: the logic of this method should mirror the logic of
 939 // constantPoolOopDesc::verify_constant_pool_resolve.
 940 bool JVMCIRuntime::check_klass_accessibility(Klass* accessing_klass, Klass* resolved_klass) {


1278 JVMCI::CodeInstallResult JVMCIRuntime::validate_compile_task_dependencies(Dependencies* dependencies, JVMCICompileState* compile_state, char** failure_detail) {
1279   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
1280   if (compile_state != NULL && compile_state->jvmti_state_changed()) {
1281     *failure_detail = (char*) "Jvmti state change during compilation invalidated dependencies";
1282     return JVMCI::dependencies_failed;
1283   }
1284 
1285   CompileTask* task = compile_state == NULL ? NULL : compile_state->task();
1286   Dependencies::DepType result = dependencies->validate_dependencies(task, failure_detail);
1287   if (result == Dependencies::end_marker) {
1288     return JVMCI::ok;
1289   }
1290 
1291   return JVMCI::dependencies_failed;
1292 }
1293 
1294 // Reports a pending exception and exits the VM.
1295 static void fatal_exception_in_compile(JVMCIEnv* JVMCIENV, JavaThread* thread, const char* msg) {
1296   // Only report a fatal JVMCI compilation exception once
1297   static volatile int report_init_failure = 0;
1298   if (!report_init_failure && Atomic::cmpxchg(1, &report_init_failure, 0) == 0) {
1299       tty->print_cr("%s:", msg);
1300       JVMCIENV->describe_pending_exception(true);
1301   }
1302   JVMCIENV->clear_pending_exception();
1303   before_exit(thread);
1304   vm_exit(-1);
1305 }
1306 
1307 void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, const methodHandle& method, int entry_bci) {
1308   JVMCI_EXCEPTION_CONTEXT
1309 
1310   JVMCICompileState* compile_state = JVMCIENV->compile_state();
1311 
1312   bool is_osr = entry_bci != InvocationEntryBci;
1313   if (compiler->is_bootstrapping() && is_osr) {
1314     // no OSR compilations during bootstrap - the compiler is just too slow at this point,
1315     // and we know that there are no endless loops
1316     compile_state->set_failure(true, "No OSR during boostrap");
1317     return;
1318   }




 900     CLEAR_PENDING_EXCEPTION;
 901     if (exception->is_a(SystemDictionary::ThreadDeath_klass())) {
 902       // Don't print anything if we are being killed.
 903     } else {
 904       java_lang_Throwable::print_stack_trace(exception, tty);
 905 
 906       // Clear and ignore any exceptions raised during printing
 907       CLEAR_PENDING_EXCEPTION;
 908     }
 909     if (!clear) {
 910       THREAD->set_pending_exception(exception(), exception_file, exception_line);
 911     }
 912   }
 913 }
 914 
 915 
 916 void JVMCIRuntime::exit_on_pending_exception(JVMCIEnv* JVMCIENV, const char* message) {
 917   JavaThread* THREAD = JavaThread::current();
 918 
 919   static volatile int report_error = 0;
 920   if (!report_error && Atomic::cmpxchg(&report_error, 0, 1) == 0) {
 921     // Only report an error once
 922     tty->print_raw_cr(message);
 923     if (JVMCIENV != NULL) {
 924       JVMCIENV->describe_pending_exception(true);
 925     } else {
 926       describe_pending_hotspot_exception(THREAD, true);
 927     }
 928   } else {
 929     // Allow error reporting thread to print the stack trace.
 930     THREAD->sleep(200);
 931   }
 932 
 933   before_exit(THREAD);
 934   vm_exit(-1);
 935 }
 936 
 937 // ------------------------------------------------------------------
 938 // Note: the logic of this method should mirror the logic of
 939 // constantPoolOopDesc::verify_constant_pool_resolve.
 940 bool JVMCIRuntime::check_klass_accessibility(Klass* accessing_klass, Klass* resolved_klass) {


1278 JVMCI::CodeInstallResult JVMCIRuntime::validate_compile_task_dependencies(Dependencies* dependencies, JVMCICompileState* compile_state, char** failure_detail) {
1279   // If JVMTI capabilities were enabled during compile, the compilation is invalidated.
1280   if (compile_state != NULL && compile_state->jvmti_state_changed()) {
1281     *failure_detail = (char*) "Jvmti state change during compilation invalidated dependencies";
1282     return JVMCI::dependencies_failed;
1283   }
1284 
1285   CompileTask* task = compile_state == NULL ? NULL : compile_state->task();
1286   Dependencies::DepType result = dependencies->validate_dependencies(task, failure_detail);
1287   if (result == Dependencies::end_marker) {
1288     return JVMCI::ok;
1289   }
1290 
1291   return JVMCI::dependencies_failed;
1292 }
1293 
1294 // Reports a pending exception and exits the VM.
1295 static void fatal_exception_in_compile(JVMCIEnv* JVMCIENV, JavaThread* thread, const char* msg) {
1296   // Only report a fatal JVMCI compilation exception once
1297   static volatile int report_init_failure = 0;
1298   if (!report_init_failure && Atomic::cmpxchg(&report_init_failure, 0, 1) == 0) {
1299       tty->print_cr("%s:", msg);
1300       JVMCIENV->describe_pending_exception(true);
1301   }
1302   JVMCIENV->clear_pending_exception();
1303   before_exit(thread);
1304   vm_exit(-1);
1305 }
1306 
1307 void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, const methodHandle& method, int entry_bci) {
1308   JVMCI_EXCEPTION_CONTEXT
1309 
1310   JVMCICompileState* compile_state = JVMCIENV->compile_state();
1311 
1312   bool is_osr = entry_bci != InvocationEntryBci;
1313   if (compiler->is_bootstrapping() && is_osr) {
1314     // no OSR compilations during bootstrap - the compiler is just too slow at this point,
1315     // and we know that there are no endless loops
1316     compile_state->set_failure(true, "No OSR during boostrap");
1317     return;
1318   }


< prev index next >