8165755: [JVMCI] replace use of vm_abort with vm_exit

Reviewed-by: dholmes
This commit is contained in:
Doug Simon 2016-09-14 05:48:18 -07:00
parent 474c035379
commit a83ab529f9
3 changed files with 21 additions and 29 deletions

View File

@ -114,11 +114,11 @@ void JVMCICompiler::bootstrap(TRAPS) {
JVMCIRuntime::bootstrap_finished(CHECK); JVMCIRuntime::bootstrap_finished(CHECK);
} }
#define CHECK_ABORT THREAD); \ #define CHECK_EXIT THREAD); \
if (HAS_PENDING_EXCEPTION) { \ if (HAS_PENDING_EXCEPTION) { \
char buf[256]; \ char buf[256]; \
jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \ jio_snprintf(buf, 256, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
JVMCICompiler::abort_on_pending_exception(PENDING_EXCEPTION, buf); \ JVMCICompiler::exit_on_pending_exception(PENDING_EXCEPTION, buf); \
return; \ return; \
} \ } \
(void)(0 (void)(0
@ -133,10 +133,10 @@ void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JV
return; return;
} }
JVMCIRuntime::initialize_well_known_classes(CHECK_ABORT); JVMCIRuntime::initialize_well_known_classes(CHECK_EXIT);
HandleMark hm; HandleMark hm;
Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT); Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_EXIT);
JavaValue method_result(T_OBJECT); JavaValue method_result(T_OBJECT);
JavaCallArguments args; JavaCallArguments args;
@ -202,23 +202,22 @@ CompLevel JVMCIRuntime::adjust_comp_level(methodHandle method, bool is_osr, Comp
return level; return level;
} }
/** void JVMCICompiler::exit_on_pending_exception(Handle exception, const char* message) {
* Aborts the VM due to an unexpected exception. JavaThread* THREAD = JavaThread::current();
*/
void JVMCICompiler::abort_on_pending_exception(Handle exception, const char* message, bool dump_core) {
Thread* THREAD = Thread::current();
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
java_lang_Throwable::java_printStackTrace(exception, THREAD); static volatile int report_error = 0;
if (!report_error && Atomic::cmpxchg(1, &report_error, 0) == 0) {
// Only report an error once
tty->print_raw_cr(message);
java_lang_Throwable::java_printStackTrace(exception, THREAD);
} else {
// Allow error reporting thread to print the stack trace.
os::sleep(THREAD, 200, false);
}
// Give other aborting threads to also print their stack traces. before_exit(THREAD);
// This can be very useful when debugging class initialization vm_exit(-1);
// failures.
assert(THREAD->is_Java_thread(), "compiler threads should be Java threads");
const bool interruptible = true;
os::sleep(THREAD, 200, interruptible);
vm_abort(dump_core);
} }
// Compilation entry point for methods // Compilation entry point for methods

View File

@ -47,7 +47,10 @@ private:
static elapsedTimer _codeInstallTimer; static elapsedTimer _codeInstallTimer;
static void abort_on_pending_exception(Handle exception, const char* message, bool dump_core = false); /**
* Exits the VM due to an unexpected exception.
*/
static void exit_on_pending_exception(Handle exception, const char* message);
public: public:
JVMCICompiler(); JVMCICompiler();

View File

@ -817,16 +817,6 @@ JVM_ENTRY(void, JVM_RegisterJVMCINatives(JNIEnv *env, jclass c2vmClass))
} }
JVM_END JVM_END
#define CHECK_WARN_ABORT_(message) THREAD); \
if (HAS_PENDING_EXCEPTION) { \
warning(message); \
char buf[512]; \
jio_snprintf(buf, 512, "Uncaught exception at %s:%d", __FILE__, __LINE__); \
JVMCIRuntime::abort_on_pending_exception(PENDING_EXCEPTION, buf); \
return; \
} \
(void)(0
void JVMCIRuntime::shutdown(TRAPS) { void JVMCIRuntime::shutdown(TRAPS) {
if (_HotSpotJVMCIRuntime_instance != NULL) { if (_HotSpotJVMCIRuntime_instance != NULL) {
_shutdown_called = true; _shutdown_called = true;