hotspot/src/share/vm/jvmci/jvmciCompiler.cpp
changeset 35143 33daaea9d5c2
parent 34185 ee71c590a456
child 35557 029dcb9bfa8b
equal deleted inserted replaced
35142:11e71310edae 35143:33daaea9d5c2
   110     tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methodsCompiled);
   110     tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methodsCompiled);
   111   }
   111   }
   112   _bootstrapping = false;
   112   _bootstrapping = false;
   113 }
   113 }
   114 
   114 
       
   115 #define CHECK_ABORT THREAD); \
       
   116 if (HAS_PENDING_EXCEPTION) { \
       
   117   char buf[256]; \
       
   118   jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
       
   119   JVMCICompiler::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
       
   120   return; \
       
   121 } \
       
   122 (void)(0
       
   123 
   115 void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JVMCIEnv* env) {
   124 void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JVMCIEnv* env) {
   116   JVMCI_EXCEPTION_CONTEXT
   125   JVMCI_EXCEPTION_CONTEXT
   117 
   126 
   118   bool is_osr = entry_bci != InvocationEntryBci;
   127   bool is_osr = entry_bci != InvocationEntryBci;
   119   if (_bootstrapping && is_osr) {
   128   if (_bootstrapping && is_osr) {
   148 
   157 
   149   // An uncaught exception was thrown during compilation.  Generally these
   158   // An uncaught exception was thrown during compilation.  Generally these
   150   // should be handled by the Java code in some useful way but if they leak
   159   // should be handled by the Java code in some useful way but if they leak
   151   // through to here report them instead of dying or silently ignoring them.
   160   // through to here report them instead of dying or silently ignoring them.
   152   if (HAS_PENDING_EXCEPTION) {
   161   if (HAS_PENDING_EXCEPTION) {
   153     Handle throwable = PENDING_EXCEPTION;
   162     Handle exception(THREAD, PENDING_EXCEPTION);
   154     CLEAR_PENDING_EXCEPTION;
   163     CLEAR_PENDING_EXCEPTION;
   155 
   164 
   156     JVMCIRuntime::call_printStackTrace(throwable, THREAD);
   165     {
   157     if (HAS_PENDING_EXCEPTION) {
   166       ttyLocker ttyl;
   158       CLEAR_PENDING_EXCEPTION;
   167       java_lang_Throwable::print_stack_trace(exception, tty);
   159     }
   168     }
   160 
   169 
   161     // Something went wrong so disable compilation at this level
   170     // Something went wrong so disable compilation at this level
   162     method->set_not_compilable(CompLevel_full_optimization);
   171     method->set_not_compilable(CompLevel_full_optimization);
   163   } else {
   172   } else {
   164     _methodsCompiled++;
   173     _methodsCompiled++;
   165   }
   174   }
   166 }
   175 }
   167 
   176 
       
   177 /**
       
   178  * Aborts the VM due to an unexpected exception.
       
   179  */
       
   180 void JVMCICompiler::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
       
   181   Thread* THREAD = Thread::current();
       
   182   CLEAR_PENDING_EXCEPTION;
       
   183 
       
   184   {
       
   185     ttyLocker ttyl;
       
   186     tty->print_raw_cr(message);
       
   187     java_lang_Throwable::print_stack_trace(exception, tty);
       
   188   }
       
   189 
       
   190   // Give other aborting threads to also print their stack traces.
       
   191   // This can be very useful when debugging class initialization
       
   192   // failures.
       
   193   assert(THREAD->is_Java_thread(), "compiler threads should be Java threads");
       
   194   const bool interruptible = true;
       
   195   os::sleep(THREAD, 200, interruptible);
       
   196 
       
   197   vm_abort(dump_core);
       
   198 }
   168 
   199 
   169 // Compilation entry point for methods
   200 // Compilation entry point for methods
   170 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) {
   201 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) {
   171   ShouldNotReachHere();
   202   ShouldNotReachHere();
   172 }
   203 }