56 #include "runtime/fprofiler.hpp"
57 #include "runtime/init.hpp"
58 #include "runtime/interfaceSupport.hpp"
59 #include "runtime/java.hpp"
60 #include "runtime/memprofiler.hpp"
61 #include "runtime/sharedRuntime.hpp"
62 #include "runtime/statSampler.hpp"
63 #include "runtime/sweeper.hpp"
64 #include "runtime/task.hpp"
65 #include "runtime/thread.inline.hpp"
66 #include "runtime/timer.hpp"
67 #include "runtime/vm_operations.hpp"
68 #include "services/memTracker.hpp"
69 #include "trace/traceMacros.hpp"
70 #include "trace/tracing.hpp"
71 #include "utilities/dtrace.hpp"
72 #include "utilities/globalDefinitions.hpp"
73 #include "utilities/histogram.hpp"
74 #include "utilities/macros.hpp"
75 #include "utilities/vmError.hpp"
76 #if INCLUDE_ALL_GCS
77 #include "gc/cms/concurrentMarkSweepThread.hpp"
78 #include "gc/parallel/psScavenge.hpp"
79 #endif // INCLUDE_ALL_GCS
80 #ifdef COMPILER1
81 #include "c1/c1_Compiler.hpp"
82 #include "c1/c1_Runtime1.hpp"
83 #endif
84 #ifdef COMPILER2
85 #include "code/compiledIC.hpp"
86 #include "compiler/methodLiveness.hpp"
87 #include "opto/compile.hpp"
88 #include "opto/indexSet.hpp"
89 #include "opto/runtime.hpp"
90 #endif
91
92 GrowableArray<Method*>* collected_profiled_methods;
93
94 int compare_methods(Method** a, Method** b) {
95 // %%% there can be 32-bit overflow here
96 return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
97 - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
98 }
99
456
457 TRACE_VM_EXIT();
458
459 // Stop the WatcherThread. We do this before disenrolling various
460 // PeriodicTasks to reduce the likelihood of races.
461 if (PeriodicTask::num_tasks() > 0) {
462 WatcherThread::stop();
463 }
464
465 // Print statistics gathered (profiling ...)
466 if (Arguments::has_profile()) {
467 FlatProfiler::disengage();
468 FlatProfiler::print(10);
469 }
470
471 // shut down the StatSampler task
472 StatSampler::disengage();
473 StatSampler::destroy();
474
475 // Stop concurrent GC threads
476 Universe::heap()->stop();
477
478 // Print GC/heap related information.
479 Log(gc, heap, exit) log;
480 if (log.is_info()) {
481 ResourceMark rm;
482 Universe::print_on(log.info_stream());
483 if (log.is_trace()) {
484 ClassLoaderDataGraph::dump_on(log.trace_stream());
485 }
486 }
487 AdaptiveSizePolicyOutput::print();
488
489 if (PrintBytecodeHistogram) {
490 BytecodeHistogram::print();
491 }
492
493 if (JvmtiExport::should_post_thread_life()) {
494 JvmtiExport::post_thread_end(thread);
495 }
496
497 // Always call even when there are not JVMTI environments yet, since environments
498 // may be attached late and JVMTI must track phases of VM execution
499 JvmtiExport::post_vm_death();
500 Threads::shutdown_vm_agents();
501
502 // Terminate the signal thread
503 // Note: we don't wait until it actually dies.
504 os::terminate_signal_thread();
505
506 print_statistics();
507 Universe::heap()->print_tracing_info();
508
509 { MutexLocker ml(BeforeExit_lock);
510 _before_exit_status = BEFORE_EXIT_DONE;
511 BeforeExit_lock->notify_all();
512 }
513
514 if (VerifyStringTableAtExit) {
515 int fail_cnt = 0;
516 {
517 MutexLocker ml(StringTable_lock);
518 fail_cnt = StringTable::verify_and_compare_entries();
519 }
520
521 if (fail_cnt != 0) {
522 tty->print_cr("ERROR: fail_cnt=%d", fail_cnt);
523 guarantee(fail_cnt == 0, "unexpected StringTable verification failures");
524 }
525 }
526
527 #undef BEFORE_EXIT_NOT_RUN
|
56 #include "runtime/fprofiler.hpp"
57 #include "runtime/init.hpp"
58 #include "runtime/interfaceSupport.hpp"
59 #include "runtime/java.hpp"
60 #include "runtime/memprofiler.hpp"
61 #include "runtime/sharedRuntime.hpp"
62 #include "runtime/statSampler.hpp"
63 #include "runtime/sweeper.hpp"
64 #include "runtime/task.hpp"
65 #include "runtime/thread.inline.hpp"
66 #include "runtime/timer.hpp"
67 #include "runtime/vm_operations.hpp"
68 #include "services/memTracker.hpp"
69 #include "trace/traceMacros.hpp"
70 #include "trace/tracing.hpp"
71 #include "utilities/dtrace.hpp"
72 #include "utilities/globalDefinitions.hpp"
73 #include "utilities/histogram.hpp"
74 #include "utilities/macros.hpp"
75 #include "utilities/vmError.hpp"
76 #ifdef COMPILER1
77 #include "c1/c1_Compiler.hpp"
78 #include "c1/c1_Runtime1.hpp"
79 #endif
80 #ifdef COMPILER2
81 #include "code/compiledIC.hpp"
82 #include "compiler/methodLiveness.hpp"
83 #include "opto/compile.hpp"
84 #include "opto/indexSet.hpp"
85 #include "opto/runtime.hpp"
86 #endif
87
88 GrowableArray<Method*>* collected_profiled_methods;
89
90 int compare_methods(Method** a, Method** b) {
91 // %%% there can be 32-bit overflow here
92 return ((*b)->invocation_count() + (*b)->compiled_invocation_count())
93 - ((*a)->invocation_count() + (*a)->compiled_invocation_count());
94 }
95
452
453 TRACE_VM_EXIT();
454
455 // Stop the WatcherThread. We do this before disenrolling various
456 // PeriodicTasks to reduce the likelihood of races.
457 if (PeriodicTask::num_tasks() > 0) {
458 WatcherThread::stop();
459 }
460
461 // Print statistics gathered (profiling ...)
462 if (Arguments::has_profile()) {
463 FlatProfiler::disengage();
464 FlatProfiler::print(10);
465 }
466
467 // shut down the StatSampler task
468 StatSampler::disengage();
469 StatSampler::destroy();
470
471 // Stop concurrent GC threads
472 GC::gc()->heap()->stop();
473
474 // Print GC/heap related information.
475 Log(gc, heap, exit) log;
476 if (log.is_info()) {
477 ResourceMark rm;
478 Universe::print_on(log.info_stream());
479 if (log.is_trace()) {
480 ClassLoaderDataGraph::dump_on(log.trace_stream());
481 }
482 }
483 AdaptiveSizePolicyOutput::print();
484
485 if (PrintBytecodeHistogram) {
486 BytecodeHistogram::print();
487 }
488
489 if (JvmtiExport::should_post_thread_life()) {
490 JvmtiExport::post_thread_end(thread);
491 }
492
493 // Always call even when there are not JVMTI environments yet, since environments
494 // may be attached late and JVMTI must track phases of VM execution
495 JvmtiExport::post_vm_death();
496 Threads::shutdown_vm_agents();
497
498 // Terminate the signal thread
499 // Note: we don't wait until it actually dies.
500 os::terminate_signal_thread();
501
502 print_statistics();
503 GC::gc()->heap()->print_tracing_info();
504
505 { MutexLocker ml(BeforeExit_lock);
506 _before_exit_status = BEFORE_EXIT_DONE;
507 BeforeExit_lock->notify_all();
508 }
509
510 if (VerifyStringTableAtExit) {
511 int fail_cnt = 0;
512 {
513 MutexLocker ml(StringTable_lock);
514 fail_cnt = StringTable::verify_and_compare_entries();
515 }
516
517 if (fail_cnt != 0) {
518 tty->print_cr("ERROR: fail_cnt=%d", fail_cnt);
519 guarantee(fail_cnt == 0, "unexpected StringTable verification failures");
520 }
521 }
522
523 #undef BEFORE_EXIT_NOT_RUN
|