< prev index next >

src/share/vm/runtime/java.cpp

Print this page




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "compiler/compileBroker.hpp"
  31 #include "compiler/compilerOracle.hpp"
  32 #include "gc/shared/genCollectedHeap.hpp"
  33 #include "interpreter/bytecodeHistogram.hpp"




  34 #include "memory/oopFactory.hpp"
  35 #include "memory/universe.hpp"
  36 #include "oops/constantPool.hpp"
  37 #include "oops/generateOopMap.hpp"
  38 #include "oops/instanceKlass.hpp"
  39 #include "oops/instanceOop.hpp"
  40 #include "oops/method.hpp"
  41 #include "oops/objArrayOop.hpp"
  42 #include "oops/oop.inline.hpp"
  43 #include "oops/symbol.hpp"
  44 #include "prims/jvmtiExport.hpp"
  45 #include "runtime/arguments.hpp"
  46 #include "runtime/biasedLocking.hpp"
  47 #include "runtime/compilationPolicy.hpp"
  48 #include "runtime/fprofiler.hpp"
  49 #include "runtime/init.hpp"
  50 #include "runtime/interfaceSupport.hpp"
  51 #include "runtime/java.hpp"
  52 #include "runtime/memprofiler.hpp"
  53 #include "runtime/sharedRuntime.hpp"


 219     extern Histogram *JVMHistogram;
 220     JVMHistogram->print();
 221   }
 222 
 223 #endif
 224 
 225   if (MemProfiling) {
 226     MemProfiler::disengage();
 227   }
 228 
 229   if (CITime) {
 230     CompileBroker::print_times();
 231   }
 232 
 233 #ifdef COMPILER1
 234   if ((PrintC1Statistics || LogVMOutput || LogCompilation) && UseCompiler) {
 235     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintC1Statistics);
 236     Runtime1::print_statistics();
 237     Deoptimization::print_statistics();
 238     SharedRuntime::print_statistics();
 239     nmethod::print_statistics();
 240   }
 241 #endif /* COMPILER1 */
 242 
 243 #ifdef COMPILER2
 244   if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) {
 245     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintOptoStatistics);
 246     Compile::print_statistics();
 247 #ifndef COMPILER1
 248     Deoptimization::print_statistics();
 249     nmethod::print_statistics();
 250     SharedRuntime::print_statistics();
 251 #endif //COMPILER1
 252     os::print_statistics();
 253   }
 254 
 255   if (PrintLockStatistics || PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) {
 256     OptoRuntime::print_named_counters();
 257   }
 258 
 259   if (TimeLivenessAnalysis) {
 260     MethodLiveness::print_times();
 261   }
 262 #ifdef ASSERT
 263   if (CollectIndexSetStatistics) {
 264     IndexSet::print_statistics();
 265   }
 266 #endif // ASSERT
 267 #endif // COMPILER2














 268   if (CountCompiledCalls) {
 269     print_method_invocation_histogram();
 270   }
 271 
 272   print_method_profiling_data();
 273 
 274   if (TimeCompilationPolicy) {
 275     CompilationPolicy::policy()->print_time();
 276   }
 277   if (TimeOopMap) {
 278     GenerateOopMap::print_time();
 279   }
 280   if (ProfilerCheckIntervals) {
 281     PeriodicTask::print_intervals();
 282   }
 283   if (PrintSymbolTableSizeHistogram) {
 284     SymbolTable::print_histogram();
 285   }
 286   if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
 287     BytecodeCounter::print();


 392   // JVMTI post_thread_end_event and post_vm_death_event will run native code.
 393   // A CAS or OSMutex would work just fine but then we need to manipulate
 394   // thread state for Safepoint. Here we use Monitor wait() and notify_all()
 395   // for synchronization.
 396   { MutexLocker ml(BeforeExit_lock);
 397     switch (_before_exit_status) {
 398     case BEFORE_EXIT_NOT_RUN:
 399       _before_exit_status = BEFORE_EXIT_RUNNING;
 400       break;
 401     case BEFORE_EXIT_RUNNING:
 402       while (_before_exit_status == BEFORE_EXIT_RUNNING) {
 403         BeforeExit_lock->wait();
 404       }
 405       assert(_before_exit_status == BEFORE_EXIT_DONE, "invalid state");
 406       return;
 407     case BEFORE_EXIT_DONE:
 408       return;
 409     }
 410   }
 411 




 412   // Hang forever on exit if we're reporting an error.
 413   if (ShowMessageBoxOnError && is_error_reported()) {
 414     os::infinite_sleep();
 415   }
 416 
 417   // Stop the WatcherThread. We do this before disenrolling various
 418   // PeriodicTasks to reduce the likelihood of races.
 419   if (PeriodicTask::num_tasks() > 0) {
 420     WatcherThread::stop();
 421   }
 422 
 423   // Print statistics gathered (profiling ...)
 424   if (Arguments::has_profile()) {
 425     FlatProfiler::disengage();
 426     FlatProfiler::print(10);
 427   }
 428 
 429   // shut down the StatSampler task
 430   StatSampler::disengage();
 431   StatSampler::destroy();




  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/classLoader.hpp"
  27 #include "classfile/stringTable.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "compiler/compileBroker.hpp"
  31 #include "compiler/compilerOracle.hpp"
  32 #include "gc/shared/genCollectedHeap.hpp"
  33 #include "interpreter/bytecodeHistogram.hpp"
  34 #if INCLUDE_JVMCI
  35 #include "jvmci/jvmciCompiler.hpp"
  36 #include "jvmci/jvmciRuntime.hpp"
  37 #endif
  38 #include "memory/oopFactory.hpp"
  39 #include "memory/universe.hpp"
  40 #include "oops/constantPool.hpp"
  41 #include "oops/generateOopMap.hpp"
  42 #include "oops/instanceKlass.hpp"
  43 #include "oops/instanceOop.hpp"
  44 #include "oops/method.hpp"
  45 #include "oops/objArrayOop.hpp"
  46 #include "oops/oop.inline.hpp"
  47 #include "oops/symbol.hpp"
  48 #include "prims/jvmtiExport.hpp"
  49 #include "runtime/arguments.hpp"
  50 #include "runtime/biasedLocking.hpp"
  51 #include "runtime/compilationPolicy.hpp"
  52 #include "runtime/fprofiler.hpp"
  53 #include "runtime/init.hpp"
  54 #include "runtime/interfaceSupport.hpp"
  55 #include "runtime/java.hpp"
  56 #include "runtime/memprofiler.hpp"
  57 #include "runtime/sharedRuntime.hpp"


 223     extern Histogram *JVMHistogram;
 224     JVMHistogram->print();
 225   }
 226 
 227 #endif
 228 
 229   if (MemProfiling) {
 230     MemProfiler::disengage();
 231   }
 232 
 233   if (CITime) {
 234     CompileBroker::print_times();
 235   }
 236 
 237 #ifdef COMPILER1
 238   if ((PrintC1Statistics || LogVMOutput || LogCompilation) && UseCompiler) {
 239     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintC1Statistics);
 240     Runtime1::print_statistics();
 241     Deoptimization::print_statistics();
 242     SharedRuntime::print_statistics();

 243   }
 244 #endif /* COMPILER1 */
 245 
 246 #ifdef COMPILER2
 247   if ((PrintOptoStatistics || LogVMOutput || LogCompilation) && UseCompiler) {
 248     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && PrintOptoStatistics);
 249     Compile::print_statistics();
 250 #ifndef COMPILER1
 251     Deoptimization::print_statistics();

 252     SharedRuntime::print_statistics();
 253 #endif //COMPILER1
 254     os::print_statistics();
 255   }
 256 
 257   if (PrintLockStatistics || PrintPreciseBiasedLockingStatistics || PrintPreciseRTMLockingStatistics) {
 258     OptoRuntime::print_named_counters();
 259   }
 260 
 261   if (TimeLivenessAnalysis) {
 262     MethodLiveness::print_times();
 263   }
 264 #ifdef ASSERT
 265   if (CollectIndexSetStatistics) {
 266     IndexSet::print_statistics();
 267   }
 268 #endif // ASSERT
 269 #else
 270 #ifdef INCLUDE_JVMCI
 271 #ifndef COMPILER1
 272   if ((TraceDeoptimization || LogVMOutput || LogCompilation) && UseCompiler) {
 273     FlagSetting fs(DisplayVMOutput, DisplayVMOutput && TraceDeoptimization);
 274     Deoptimization::print_statistics();
 275     SharedRuntime::print_statistics();
 276   }
 277 #endif
 278 #endif
 279 #endif
 280 
 281   if (PrintNMethodStatistics) {
 282     nmethod::print_statistics();
 283   }
 284   if (CountCompiledCalls) {
 285     print_method_invocation_histogram();
 286   }
 287 
 288   print_method_profiling_data();
 289 
 290   if (TimeCompilationPolicy) {
 291     CompilationPolicy::policy()->print_time();
 292   }
 293   if (TimeOopMap) {
 294     GenerateOopMap::print_time();
 295   }
 296   if (ProfilerCheckIntervals) {
 297     PeriodicTask::print_intervals();
 298   }
 299   if (PrintSymbolTableSizeHistogram) {
 300     SymbolTable::print_histogram();
 301   }
 302   if (CountBytecodes || TraceBytecodes || StopInterpreterAt) {
 303     BytecodeCounter::print();


 408   // JVMTI post_thread_end_event and post_vm_death_event will run native code.
 409   // A CAS or OSMutex would work just fine but then we need to manipulate
 410   // thread state for Safepoint. Here we use Monitor wait() and notify_all()
 411   // for synchronization.
 412   { MutexLocker ml(BeforeExit_lock);
 413     switch (_before_exit_status) {
 414     case BEFORE_EXIT_NOT_RUN:
 415       _before_exit_status = BEFORE_EXIT_RUNNING;
 416       break;
 417     case BEFORE_EXIT_RUNNING:
 418       while (_before_exit_status == BEFORE_EXIT_RUNNING) {
 419         BeforeExit_lock->wait();
 420       }
 421       assert(_before_exit_status == BEFORE_EXIT_DONE, "invalid state");
 422       return;
 423     case BEFORE_EXIT_DONE:
 424       return;
 425     }
 426   }
 427 
 428 #if INCLUDE_JVMCI
 429   JVMCIRuntime::shutdown();
 430 #endif
 431 
 432   // Hang forever on exit if we're reporting an error.
 433   if (ShowMessageBoxOnError && is_error_reported()) {
 434     os::infinite_sleep();
 435   }
 436 
 437   // Stop the WatcherThread. We do this before disenrolling various
 438   // PeriodicTasks to reduce the likelihood of races.
 439   if (PeriodicTask::num_tasks() > 0) {
 440     WatcherThread::stop();
 441   }
 442 
 443   // Print statistics gathered (profiling ...)
 444   if (Arguments::has_profile()) {
 445     FlatProfiler::disengage();
 446     FlatProfiler::print(10);
 447   }
 448 
 449   // shut down the StatSampler task
 450   StatSampler::disengage();
 451   StatSampler::destroy();


< prev index next >