80 #ifdef TARGET_ARCH_ppc
81 # include "vm_version_ppc.hpp"
82 #endif
83 #if INCLUDE_ALL_GCS
84 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
85 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
86 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
87 #endif // INCLUDE_ALL_GCS
88 #ifdef COMPILER1
89 #include "c1/c1_Compiler.hpp"
90 #include "c1/c1_Runtime1.hpp"
91 #endif
92 #ifdef COMPILER2
93 #include "code/compiledIC.hpp"
94 #include "compiler/methodLiveness.hpp"
95 #include "opto/compile.hpp"
96 #include "opto/indexSet.hpp"
97 #include "opto/runtime.hpp"
98 #endif
99
100 #ifndef USDT2
101 HS_DTRACE_PROBE_DECL(hotspot, vm__shutdown);
102 #endif /* !USDT2 */
103
104 #ifndef PRODUCT
105
106 // Statistics printing (method invocation histogram)
107
108 GrowableArray<Method*>* collected_invoked_methods;
109
110 void collect_invoked_methods(Method* m) {
111 if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
112 collected_invoked_methods->push(m);
113 }
114 }
115
116
117 GrowableArray<Method*>* collected_profiled_methods;
118
119 void collect_profiled_methods(Method* m) {
120 Thread* thread = Thread::current();
121 // This HandleMark prevents a huge amount of handles from being added
122 // to the metadata_handles() array on the thread.
586 vm_direct_exit(code);
587 }
588
589 if (VMThread::vm_thread() != NULL) {
590 // Fire off a VM_Exit operation to bring VM to a safepoint and exit
591 VM_Exit op(code);
592 if (thread->is_Java_thread())
593 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
594 VMThread::execute(&op);
595 // should never reach here; but in case something wrong with VM Thread.
596 vm_direct_exit(code);
597 } else {
598 // VM thread is gone, just exit
599 vm_direct_exit(code);
600 }
601 ShouldNotReachHere();
602 }
603
604 void notify_vm_shutdown() {
605 // For now, just a dtrace probe.
606 #ifndef USDT2
607 HS_DTRACE_PROBE(hotspot, vm__shutdown);
608 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
609 #else /* USDT2 */
610 HOTSPOT_VM_SHUTDOWN();
611 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
612 #endif /* USDT2 */
613 }
614
615 void vm_direct_exit(int code) {
616 notify_vm_shutdown();
617 os::wait_for_keypress_at_exit();
618 ::exit(code);
619 }
620
621 void vm_perform_shutdown_actions() {
622 // Warning: do not call 'exit_globals()' here. All threads are still running.
623 // Calling 'exit_globals()' will disable thread-local-storage and cause all
624 // kinds of assertions to trigger in debug mode.
625 if (is_init_completed()) {
626 Thread* thread = ThreadLocalStorage::is_initialized() ?
627 ThreadLocalStorage::get_thread_slow() : NULL;
628 if (thread != NULL && thread->is_Java_thread()) {
629 // We are leaving the VM, set state to native (in case any OS exit
630 // handlers call back to the VM)
631 JavaThread* jt = (JavaThread*)thread;
632 // Must always be walkable or have no last_Java_frame when in
|
80 #ifdef TARGET_ARCH_ppc
81 # include "vm_version_ppc.hpp"
82 #endif
83 #if INCLUDE_ALL_GCS
84 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
85 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
86 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
87 #endif // INCLUDE_ALL_GCS
88 #ifdef COMPILER1
89 #include "c1/c1_Compiler.hpp"
90 #include "c1/c1_Runtime1.hpp"
91 #endif
92 #ifdef COMPILER2
93 #include "code/compiledIC.hpp"
94 #include "compiler/methodLiveness.hpp"
95 #include "opto/compile.hpp"
96 #include "opto/indexSet.hpp"
97 #include "opto/runtime.hpp"
98 #endif
99
100
101 #ifndef PRODUCT
102
103 // Statistics printing (method invocation histogram)
104
105 GrowableArray<Method*>* collected_invoked_methods;
106
107 void collect_invoked_methods(Method* m) {
108 if (m->invocation_count() + m->compiled_invocation_count() >= 1 ) {
109 collected_invoked_methods->push(m);
110 }
111 }
112
113
114 GrowableArray<Method*>* collected_profiled_methods;
115
116 void collect_profiled_methods(Method* m) {
117 Thread* thread = Thread::current();
118 // This HandleMark prevents a huge amount of handles from being added
119 // to the metadata_handles() array on the thread.
583 vm_direct_exit(code);
584 }
585
586 if (VMThread::vm_thread() != NULL) {
587 // Fire off a VM_Exit operation to bring VM to a safepoint and exit
588 VM_Exit op(code);
589 if (thread->is_Java_thread())
590 ((JavaThread*)thread)->set_thread_state(_thread_in_vm);
591 VMThread::execute(&op);
592 // should never reach here; but in case something wrong with VM Thread.
593 vm_direct_exit(code);
594 } else {
595 // VM thread is gone, just exit
596 vm_direct_exit(code);
597 }
598 ShouldNotReachHere();
599 }
600
601 void notify_vm_shutdown() {
602 // For now, just a dtrace probe.
603 HOTSPOT_VM_SHUTDOWN();
604 HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
605 }
606
607 void vm_direct_exit(int code) {
608 notify_vm_shutdown();
609 os::wait_for_keypress_at_exit();
610 ::exit(code);
611 }
612
613 void vm_perform_shutdown_actions() {
614 // Warning: do not call 'exit_globals()' here. All threads are still running.
615 // Calling 'exit_globals()' will disable thread-local-storage and cause all
616 // kinds of assertions to trigger in debug mode.
617 if (is_init_completed()) {
618 Thread* thread = ThreadLocalStorage::is_initialized() ?
619 ThreadLocalStorage::get_thread_slow() : NULL;
620 if (thread != NULL && thread->is_Java_thread()) {
621 // We are leaving the VM, set state to native (in case any OS exit
622 // handlers call back to the VM)
623 JavaThread* jt = (JavaThread*)thread;
624 // Must always be walkable or have no last_Java_frame when in
|