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