src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

changeset 1794
23b1b27ac76c
parent 1748
664ae0c5e0e5
child 1795
bda703475ded
     1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Apr 05 12:19:22 2010 -0400
     1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Apr 06 10:59:45 2010 -0400
     1.3 @@ -902,6 +902,10 @@
     1.4  
     1.5  void G1CollectedHeap::do_collection(bool full, bool clear_all_soft_refs,
     1.6                                      size_t word_size) {
     1.7 +  if (GC_locker::check_active_before_gc()) {
     1.8 +    return; // GC is disabled (e.g. JNI GetXXXCritical operation)
     1.9 +  }
    1.10 +
    1.11    ResourceMark rm;
    1.12  
    1.13    if (PrintHeapAtGC) {
    1.14 @@ -916,10 +920,6 @@
    1.15    assert(SafepointSynchronize::is_at_safepoint(), "should be at safepoint");
    1.16    assert(Thread::current() == VMThread::vm_thread(), "should be in vm thread");
    1.17  
    1.18 -  if (GC_locker::is_active()) {
    1.19 -    return; // GC is disabled (e.g. JNI GetXXXCritical operation)
    1.20 -  }
    1.21 -
    1.22    {
    1.23      IsGCActiveMark x;
    1.24  
    1.25 @@ -2658,6 +2658,10 @@
    1.26  
    1.27  void
    1.28  G1CollectedHeap::do_collection_pause_at_safepoint() {
    1.29 +  if (GC_locker::check_active_before_gc()) {
    1.30 +    return; // GC is disabled (e.g. JNI GetXXXCritical operation)
    1.31 +  }
    1.32 +
    1.33    if (PrintHeapAtGC) {
    1.34      Universe::print_heap_before_gc();
    1.35    }
    1.36 @@ -2665,6 +2669,11 @@
    1.37    {
    1.38      ResourceMark rm;
    1.39  
    1.40 +    // This call will decide whether this pause is an initial-mark
    1.41 +    // pause. If it is, during_initial_mark_pause() will return true
    1.42 +    // for the duration of this pause.
    1.43 +    g1_policy()->decide_on_conc_mark_initiation();
    1.44 +
    1.45      char verbose_str[128];
    1.46      sprintf(verbose_str, "GC pause ");
    1.47      if (g1_policy()->in_young_gc_mode()) {
    1.48 @@ -2673,7 +2682,7 @@
    1.49        else
    1.50          strcat(verbose_str, "(partial)");
    1.51      }
    1.52 -    if (g1_policy()->should_initiate_conc_mark())
    1.53 +    if (g1_policy()->during_initial_mark_pause())
    1.54        strcat(verbose_str, " (initial-mark)");
    1.55  
    1.56      // if PrintGCDetails is on, we'll print long statistics information
    1.57 @@ -2697,10 +2706,6 @@
    1.58               "young list should be well formed");
    1.59      }
    1.60  
    1.61 -    if (GC_locker::is_active()) {
    1.62 -      return; // GC is disabled (e.g. JNI GetXXXCritical operation)
    1.63 -    }
    1.64 -
    1.65      bool abandoned = false;
    1.66      { // Call to jvmpi::post_class_unload_events must occur outside of active GC
    1.67        IsGCActiveMark x;
    1.68 @@ -2756,7 +2761,7 @@
    1.69        _young_list->print();
    1.70  #endif // SCAN_ONLY_VERBOSE
    1.71  
    1.72 -      if (g1_policy()->should_initiate_conc_mark()) {
    1.73 +      if (g1_policy()->during_initial_mark_pause()) {
    1.74          concurrent_mark()->checkpointRootsInitialPre();
    1.75        }
    1.76        save_marks();
    1.77 @@ -2858,7 +2863,7 @@
    1.78        }
    1.79  
    1.80        if (g1_policy()->in_young_gc_mode() &&
    1.81 -          g1_policy()->should_initiate_conc_mark()) {
    1.82 +          g1_policy()->during_initial_mark_pause()) {
    1.83          concurrent_mark()->checkpointRootsInitialPost();
    1.84          set_marking_started();
    1.85          // CAUTION: after the doConcurrentMark() call below,
    1.86 @@ -3977,7 +3982,7 @@
    1.87      OopsInHeapRegionClosure        *scan_perm_cl;
    1.88      OopsInHeapRegionClosure        *scan_so_cl;
    1.89  
    1.90 -    if (_g1h->g1_policy()->should_initiate_conc_mark()) {
    1.91 +    if (_g1h->g1_policy()->during_initial_mark_pause()) {
    1.92        scan_root_cl = &scan_mark_root_cl;
    1.93        scan_perm_cl = &scan_mark_perm_cl;
    1.94        scan_so_cl   = &scan_mark_heap_rs_cl;
    1.95 @@ -4140,7 +4145,7 @@
    1.96    FilterAndMarkInHeapRegionAndIntoCSClosure scan_and_mark(this, &boc, concurrent_mark());
    1.97  
    1.98    OopsInHeapRegionClosure *foc;
    1.99 -  if (g1_policy()->should_initiate_conc_mark())
   1.100 +  if (g1_policy()->during_initial_mark_pause())
   1.101      foc = &scan_and_mark;
   1.102    else
   1.103      foc = &scan_only;

mercurial