Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/java.cpp @ 2096:0eb90baf1b69
6583275: Hotspot crash in vm_perform_shutdown_actions due to uninitialized TLS during out of memory handling
Summary: Call get_thread_slow() in vm_perform_shutdown actions and add null check.
Reviewed-by: kvn, dholmes, jcoomes
author | coleenp |
---|---|
date | Wed, 05 Jan 2011 21:23:15 -0500 |
parents | f95d63e2154a |
children | 8f8dfba37802 |
comparison
equal
deleted
inserted
replaced
2095:36c186bcc085 | 2096:0eb90baf1b69 |
---|---|
513 #undef BEFORE_EXIT_RUNNING | 513 #undef BEFORE_EXIT_RUNNING |
514 #undef BEFORE_EXIT_DONE | 514 #undef BEFORE_EXIT_DONE |
515 } | 515 } |
516 | 516 |
517 void vm_exit(int code) { | 517 void vm_exit(int code) { |
518 Thread* thread = ThreadLocalStorage::thread_index() == -1 ? NULL | 518 Thread* thread = ThreadLocalStorage::is_initialized() ? |
519 : ThreadLocalStorage::get_thread_slow(); | 519 ThreadLocalStorage::get_thread_slow() : NULL; |
520 if (thread == NULL) { | 520 if (thread == NULL) { |
521 // we have serious problems -- just exit | 521 // we have serious problems -- just exit |
522 vm_direct_exit(code); | 522 vm_direct_exit(code); |
523 } | 523 } |
524 | 524 |
551 void vm_perform_shutdown_actions() { | 551 void vm_perform_shutdown_actions() { |
552 // Warning: do not call 'exit_globals()' here. All threads are still running. | 552 // Warning: do not call 'exit_globals()' here. All threads are still running. |
553 // Calling 'exit_globals()' will disable thread-local-storage and cause all | 553 // Calling 'exit_globals()' will disable thread-local-storage and cause all |
554 // kinds of assertions to trigger in debug mode. | 554 // kinds of assertions to trigger in debug mode. |
555 if (is_init_completed()) { | 555 if (is_init_completed()) { |
556 Thread* thread = Thread::current(); | 556 Thread* thread = ThreadLocalStorage::is_initialized() ? |
557 if (thread->is_Java_thread()) { | 557 ThreadLocalStorage::get_thread_slow() : NULL; |
558 if (thread != NULL && thread->is_Java_thread()) { | |
558 // We are leaving the VM, set state to native (in case any OS exit | 559 // We are leaving the VM, set state to native (in case any OS exit |
559 // handlers call back to the VM) | 560 // handlers call back to the VM) |
560 JavaThread* jt = (JavaThread*)thread; | 561 JavaThread* jt = (JavaThread*)thread; |
561 // Must always be walkable or have no last_Java_frame when in | 562 // Must always be walkable or have no last_Java_frame when in |
562 // thread_in_native | 563 // thread_in_native |