提交 1d84ed47 编写于 作者: Z zgu

6730115: Fastdebug VM crashes with "ExceptionMark destructor expects no pending exceptions" error

Summary: Fixed incompatible uses of EXCEPTION_MARK and CHECK macros in AttachListener::init(), handle exception locally.
Reviewed-by: minqi, coleenp
上级 5a3a0dec
...@@ -466,15 +466,39 @@ static void attach_listener_thread_entry(JavaThread* thread, TRAPS) { ...@@ -466,15 +466,39 @@ static void attach_listener_thread_entry(JavaThread* thread, TRAPS) {
} }
} }
bool AttachListener::has_init_error(TRAPS) {
if (HAS_PENDING_EXCEPTION) {
tty->print_cr("Exception in VM (AttachListener::init) : ");
java_lang_Throwable::print(PENDING_EXCEPTION, tty);
tty->cr();
CLEAR_PENDING_EXCEPTION;
return true;
} else {
return false;
}
}
// Starts the Attach Listener thread // Starts the Attach Listener thread
void AttachListener::init() { void AttachListener::init() {
EXCEPTION_MARK; EXCEPTION_MARK;
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK); Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, THREAD);
if (has_init_error(THREAD)) {
return;
}
instanceKlassHandle klass (THREAD, k); instanceKlassHandle klass (THREAD, k);
instanceHandle thread_oop = klass->allocate_instance_handle(CHECK); instanceHandle thread_oop = klass->allocate_instance_handle(THREAD);
if (has_init_error(THREAD)) {
return;
}
const char thread_name[] = "Attach Listener"; const char thread_name[] = "Attach Listener";
Handle string = java_lang_String::create_from_str(thread_name, CHECK); Handle string = java_lang_String::create_from_str(thread_name, THREAD);
if (has_init_error(THREAD)) {
return;
}
// Initialize thread_oop to put it into the system threadGroup // Initialize thread_oop to put it into the system threadGroup
Handle thread_group (THREAD, Universe::system_thread_group()); Handle thread_group (THREAD, Universe::system_thread_group());
...@@ -487,13 +511,7 @@ void AttachListener::init() { ...@@ -487,13 +511,7 @@ void AttachListener::init() {
string, string,
THREAD); THREAD);
if (HAS_PENDING_EXCEPTION) { if (has_init_error(THREAD)) {
tty->print_cr("Exception in VM (AttachListener::init) : ");
java_lang_Throwable::print(PENDING_EXCEPTION, tty);
tty->cr();
CLEAR_PENDING_EXCEPTION;
return; return;
} }
...@@ -505,14 +523,7 @@ void AttachListener::init() { ...@@ -505,14 +523,7 @@ void AttachListener::init() {
vmSymbols::thread_void_signature(), vmSymbols::thread_void_signature(),
thread_oop, // ARG 1 thread_oop, // ARG 1
THREAD); THREAD);
if (has_init_error(THREAD)) {
if (HAS_PENDING_EXCEPTION) {
tty->print_cr("Exception in VM (AttachListener::init) : ");
java_lang_Throwable::print(PENDING_EXCEPTION, tty);
tty->cr();
CLEAR_PENDING_EXCEPTION;
return; return;
} }
......
...@@ -94,6 +94,9 @@ class AttachListener: AllStatic { ...@@ -94,6 +94,9 @@ class AttachListener: AllStatic {
// dequeue the next operation // dequeue the next operation
static AttachOperation* dequeue(); static AttachOperation* dequeue();
#endif // !INCLUDE_SERVICES #endif // !INCLUDE_SERVICES
private:
static bool has_init_error(TRAPS);
}; };
#if INCLUDE_SERVICES #if INCLUDE_SERVICES
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册