hotspot/src/share/vm/runtime/safepoint.cpp
changeset 15482 470d0b0c09f1
parent 14583 d70ee55535f4
child 16670 4af09aff4237
equal deleted inserted replaced
15224:0f9e3436040d 15482:470d0b0c09f1
    50 #include "runtime/synchronizer.hpp"
    50 #include "runtime/synchronizer.hpp"
    51 #include "runtime/thread.inline.hpp"
    51 #include "runtime/thread.inline.hpp"
    52 #include "services/memTracker.hpp"
    52 #include "services/memTracker.hpp"
    53 #include "services/runtimeService.hpp"
    53 #include "services/runtimeService.hpp"
    54 #include "utilities/events.hpp"
    54 #include "utilities/events.hpp"
       
    55 #include "utilities/macros.hpp"
    55 #ifdef TARGET_ARCH_x86
    56 #ifdef TARGET_ARCH_x86
    56 # include "nativeInst_x86.hpp"
    57 # include "nativeInst_x86.hpp"
    57 # include "vmreg_x86.inline.hpp"
    58 # include "vmreg_x86.inline.hpp"
    58 #endif
    59 #endif
    59 #ifdef TARGET_ARCH_sparc
    60 #ifdef TARGET_ARCH_sparc
    70 #endif
    71 #endif
    71 #ifdef TARGET_ARCH_ppc
    72 #ifdef TARGET_ARCH_ppc
    72 # include "nativeInst_ppc.hpp"
    73 # include "nativeInst_ppc.hpp"
    73 # include "vmreg_ppc.inline.hpp"
    74 # include "vmreg_ppc.inline.hpp"
    74 #endif
    75 #endif
    75 #ifndef SERIALGC
    76 #if INCLUDE_ALL_GCS
    76 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
    77 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
    77 #include "gc_implementation/shared/concurrentGCThread.hpp"
    78 #include "gc_implementation/shared/concurrentGCThread.hpp"
    78 #endif
    79 #endif // INCLUDE_ALL_GCS
    79 #ifdef COMPILER1
    80 #ifdef COMPILER1
    80 #include "c1/c1_globals.hpp"
    81 #include "c1/c1_globals.hpp"
    81 #endif
    82 #endif
    82 
    83 
    83 // --------------------------------------------------------------------------------------------------
    84 // --------------------------------------------------------------------------------------------------
   101   if (PrintSafepointStatistics || PrintSafepointStatisticsTimeout > 0) {
   102   if (PrintSafepointStatistics || PrintSafepointStatisticsTimeout > 0) {
   102     _safepoint_begin_time = os::javaTimeNanos();
   103     _safepoint_begin_time = os::javaTimeNanos();
   103     _ts_of_current_safepoint = tty->time_stamp().seconds();
   104     _ts_of_current_safepoint = tty->time_stamp().seconds();
   104   }
   105   }
   105 
   106 
   106 #ifndef SERIALGC
   107 #if INCLUDE_ALL_GCS
   107   if (UseConcMarkSweepGC) {
   108   if (UseConcMarkSweepGC) {
   108     // In the future we should investigate whether CMS can use the
   109     // In the future we should investigate whether CMS can use the
   109     // more-general mechanism below.  DLD (01/05).
   110     // more-general mechanism below.  DLD (01/05).
   110     ConcurrentMarkSweepThread::synchronize(false);
   111     ConcurrentMarkSweepThread::synchronize(false);
   111   } else if (UseG1GC) {
   112   } else if (UseG1GC) {
   112     ConcurrentGCThread::safepoint_synchronize();
   113     ConcurrentGCThread::safepoint_synchronize();
   113   }
   114   }
   114 #endif // SERIALGC
   115 #endif // INCLUDE_ALL_GCS
   115 
   116 
   116   // By getting the Threads_lock, we assure that no threads are about to start or
   117   // By getting the Threads_lock, we assure that no threads are about to start or
   117   // exit. It is released again in SafepointSynchronize::end().
   118   // exit. It is released again in SafepointSynchronize::end().
   118   Threads_lock->lock();
   119   Threads_lock->lock();
   119 
   120 
   478     // Release threads lock, so threads can be created/destroyed again. It will also starts all threads
   479     // Release threads lock, so threads can be created/destroyed again. It will also starts all threads
   479     // blocked in signal_thread_blocked
   480     // blocked in signal_thread_blocked
   480     Threads_lock->unlock();
   481     Threads_lock->unlock();
   481 
   482 
   482   }
   483   }
   483 #ifndef SERIALGC
   484 #if INCLUDE_ALL_GCS
   484   // If there are any concurrent GC threads resume them.
   485   // If there are any concurrent GC threads resume them.
   485   if (UseConcMarkSweepGC) {
   486   if (UseConcMarkSweepGC) {
   486     ConcurrentMarkSweepThread::desynchronize(false);
   487     ConcurrentMarkSweepThread::desynchronize(false);
   487   } else if (UseG1GC) {
   488   } else if (UseG1GC) {
   488     ConcurrentGCThread::safepoint_desynchronize();
   489     ConcurrentGCThread::safepoint_desynchronize();
   489   }
   490   }
   490 #endif // SERIALGC
   491 #endif // INCLUDE_ALL_GCS
   491   // record this time so VMThread can keep track how much time has elasped
   492   // record this time so VMThread can keep track how much time has elasped
   492   // since last safepoint.
   493   // since last safepoint.
   493   _end_of_last_safepoint = os::javaTimeMillis();
   494   _end_of_last_safepoint = os::javaTimeMillis();
   494 }
   495 }
   495 
   496