< prev index next >

src/share/vm/jvmci/jvmciCompiler.cpp

Print this page




 152     args.push_int(env->task()->compile_id());
 153     JavaCalls::call_special(&result, receiver->klass(),
 154                             vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
 155   }
 156 
 157   // An uncaught exception was thrown during compilation.  Generally these
 158   // should be handled by the Java code in some useful way but if they leak
 159   // through to here report them instead of dying or silently ignoring them.
 160   if (HAS_PENDING_EXCEPTION) {
 161     Handle exception(THREAD, PENDING_EXCEPTION);
 162     CLEAR_PENDING_EXCEPTION;
 163 
 164     java_lang_Throwable::java_printStackTrace(exception, THREAD);
 165 
 166     env->set_failure("exception throw", false);
 167   } else {
 168     oop result_object = (oop) result.get_jobject();
 169     if (result_object != NULL) {
 170       oop failure_message = CompilationRequestResult::failureMessage(result_object);
 171       if (failure_message != NULL) {
 172         const char* failure_reason = failure_message != NULL ? java_lang_String::as_utf8_string(failure_message) : "unknown reason";
 173         env->set_failure(failure_reason, CompilationRequestResult::retry(result_object));
 174       } else {
 175         if (env->task()->code() == NULL) {
 176           env->set_failure("no nmethod produced", true);
 177         } else {
 178           env->task()->set_num_inlined_bytecodes(CompilationRequestResult::inlinedBytecodes(result_object));
 179           _methodsCompiled++;
 180         }
 181       }


 182     }
 183   }
 184 }
 185 
 186 /**
 187  * Aborts the VM due to an unexpected exception.
 188  */
 189 void JVMCICompiler::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
 190   Thread* THREAD = Thread::current();
 191   CLEAR_PENDING_EXCEPTION;
 192 
 193   java_lang_Throwable::java_printStackTrace(exception, THREAD);
 194 
 195   // Give other aborting threads to also print their stack traces.
 196   // This can be very useful when debugging class initialization
 197   // failures.
 198   assert(THREAD->is_Java_thread(), "compiler threads should be Java threads");
 199   const bool interruptible = true;
 200   os::sleep(THREAD, 200, interruptible);
 201 




 152     args.push_int(env->task()->compile_id());
 153     JavaCalls::call_special(&result, receiver->klass(),
 154                             vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
 155   }
 156 
 157   // An uncaught exception was thrown during compilation.  Generally these
 158   // should be handled by the Java code in some useful way but if they leak
 159   // through to here report them instead of dying or silently ignoring them.
 160   if (HAS_PENDING_EXCEPTION) {
 161     Handle exception(THREAD, PENDING_EXCEPTION);
 162     CLEAR_PENDING_EXCEPTION;
 163 
 164     java_lang_Throwable::java_printStackTrace(exception, THREAD);
 165 
 166     env->set_failure("exception throw", false);
 167   } else {
 168     oop result_object = (oop) result.get_jobject();
 169     if (result_object != NULL) {
 170       oop failure_message = CompilationRequestResult::failureMessage(result_object);
 171       if (failure_message != NULL) {
 172         const char* failure_reason = java_lang_String::as_utf8_string(failure_message);
 173         env->set_failure(failure_reason, CompilationRequestResult::retry(result_object));
 174       } else {
 175         if (env->task()->code() == NULL) {
 176           env->set_failure("no nmethod produced", true);
 177         } else {
 178           env->task()->set_num_inlined_bytecodes(CompilationRequestResult::inlinedBytecodes(result_object));
 179           _methodsCompiled++;
 180         }
 181       }
 182     } else {
 183       assert(false, "JVMCICompiler.compileMethod should always return non-null");
 184     }
 185   }
 186 }
 187 
 188 /**
 189  * Aborts the VM due to an unexpected exception.
 190  */
 191 void JVMCICompiler::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
 192   Thread* THREAD = Thread::current();
 193   CLEAR_PENDING_EXCEPTION;
 194 
 195   java_lang_Throwable::java_printStackTrace(exception, THREAD);
 196 
 197   // Give other aborting threads to also print their stack traces.
 198   // This can be very useful when debugging class initialization
 199   // failures.
 200   assert(THREAD->is_Java_thread(), "compiler threads should be Java threads");
 201   const bool interruptible = true;
 202   os::sleep(THREAD, 200, interruptible);
 203 


< prev index next >