src/share/vm/memory/genMarkSweep.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-g1-mmap Sdiff src/share/vm/memory

src/share/vm/memory/genMarkSweep.cpp

Print this page




  67   assert(ref_processor() == NULL, "no stomping");
  68   assert(rp != NULL, "should be non-NULL");
  69   _ref_processor = rp;
  70   rp->setup_policy(clear_all_softrefs);
  71 
  72   GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);
  73 
  74   gch->trace_heap_before_gc(_gc_tracer);
  75 
  76   // When collecting the permanent generation Method*s may be moving,
  77   // so we either have to flush all bcp data or convert it into bci.
  78   CodeCache::gc_prologue();
  79   Threads::gc_prologue();
  80 
  81   // Increment the invocation count
  82   _total_invocations++;
  83 
  84   // Capture heap size before collection for printing.
  85   size_t gch_prev_used = gch->used();
  86 
  87   // Some of the card table updates below assume that the perm gen is
  88   // also being collected.
  89   assert(level == gch->n_gens() - 1,
  90          "All generations are being collected, ergo perm gen too.");
  91 
  92   // Capture used regions for each generation that will be
  93   // subject to collection, so that card table adjustments can
  94   // be made intelligently (see clear / invalidate further below).
  95   gch->save_used_regions(level);
  96 
  97   allocate_stacks();
  98 
  99   mark_sweep_phase1(level, clear_all_softrefs);
 100 
 101   mark_sweep_phase2();
 102 
 103   // Don't add any more derived pointers during phase3
 104   COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
 105   COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
 106 
 107   mark_sweep_phase3(level);
 108 
 109   mark_sweep_phase4();
 110 


 117   deallocate_stacks();
 118 
 119   // If compaction completely evacuated all generations younger than this
 120   // one, then we can clear the card table.  Otherwise, we must invalidate
 121   // it (consider all cards dirty).  In the future, we might consider doing
 122   // compaction within generations only, and doing card-table sliding.
 123   bool all_empty = true;
 124   for (int i = 0; all_empty && i < level; i++) {
 125     Generation* g = gch->get_gen(i);
 126     all_empty = all_empty && gch->get_gen(i)->used() == 0;
 127   }
 128   GenRemSet* rs = gch->rem_set();
 129   // Clear/invalidate below make use of the "prev_used_regions" saved earlier.
 130   if (all_empty) {
 131     // We've evacuated all generations below us.
 132     Generation* g = gch->get_gen(level);
 133     rs->clear_into_younger(g);
 134   } else {
 135     // Invalidate the cards corresponding to the currently used
 136     // region and clear those corresponding to the evacuated region
 137     // of all generations just collected (i.e. level and younger).
 138     rs->invalidate_or_clear(gch->get_gen(level),
 139                             true /* younger */);
 140   }
 141 
 142   Threads::gc_epilogue();
 143   CodeCache::gc_epilogue();
 144   JvmtiExport::gc_epilogue();
 145 
 146   if (PrintGC && !PrintGCDetails) {
 147     gch->print_heap_change(gch_prev_used);
 148   }
 149 
 150   // refs processing: clean slate
 151   _ref_processor = NULL;
 152 
 153   // Update heap occupancy information which is used as
 154   // input to soft ref clearing policy at the next gc.
 155   Universe::update_heap_info_at_gc();
 156 
 157   // Update time of last gc for all generations we collected
 158   // (which curently is all the generations in the heap).
 159   // We need to use a monotonically non-deccreasing time in ms




  67   assert(ref_processor() == NULL, "no stomping");
  68   assert(rp != NULL, "should be non-NULL");
  69   _ref_processor = rp;
  70   rp->setup_policy(clear_all_softrefs);
  71 
  72   GCTraceTime t1(GCCauseString("Full GC", gch->gc_cause()), PrintGC && !PrintGCDetails, true, NULL);
  73 
  74   gch->trace_heap_before_gc(_gc_tracer);
  75 
  76   // When collecting the permanent generation Method*s may be moving,
  77   // so we either have to flush all bcp data or convert it into bci.
  78   CodeCache::gc_prologue();
  79   Threads::gc_prologue();
  80 
  81   // Increment the invocation count
  82   _total_invocations++;
  83 
  84   // Capture heap size before collection for printing.
  85   size_t gch_prev_used = gch->used();
  86 
  87   guarantee(level == 1, "We always collect both old and young.");



  88 
  89   // Capture used regions for each generation that will be
  90   // subject to collection, so that card table adjustments can
  91   // be made intelligently (see clear / invalidate further below).
  92   gch->save_used_regions(level);
  93 
  94   allocate_stacks();
  95 
  96   mark_sweep_phase1(level, clear_all_softrefs);
  97 
  98   mark_sweep_phase2();
  99 
 100   // Don't add any more derived pointers during phase3
 101   COMPILER2_PRESENT(assert(DerivedPointerTable::is_active(), "Sanity"));
 102   COMPILER2_PRESENT(DerivedPointerTable::set_active(false));
 103 
 104   mark_sweep_phase3(level);
 105 
 106   mark_sweep_phase4();
 107 


 114   deallocate_stacks();
 115 
 116   // If compaction completely evacuated all generations younger than this
 117   // one, then we can clear the card table.  Otherwise, we must invalidate
 118   // it (consider all cards dirty).  In the future, we might consider doing
 119   // compaction within generations only, and doing card-table sliding.
 120   bool all_empty = true;
 121   for (int i = 0; all_empty && i < level; i++) {
 122     Generation* g = gch->get_gen(i);
 123     all_empty = all_empty && gch->get_gen(i)->used() == 0;
 124   }
 125   GenRemSet* rs = gch->rem_set();
 126   // Clear/invalidate below make use of the "prev_used_regions" saved earlier.
 127   if (all_empty) {
 128     // We've evacuated all generations below us.
 129     Generation* g = gch->get_gen(level);
 130     rs->clear_into_younger(g);
 131   } else {
 132     // Invalidate the cards corresponding to the currently used
 133     // region and clear those corresponding to the evacuated region
 134     // of all generations just collected.
 135     rs->invalidate_or_clear(gch->get_gen(1));
 136     rs->invalidate_or_clear(gch->get_gen(0));
 137   }
 138 
 139   Threads::gc_epilogue();
 140   CodeCache::gc_epilogue();
 141   JvmtiExport::gc_epilogue();
 142 
 143   if (PrintGC && !PrintGCDetails) {
 144     gch->print_heap_change(gch_prev_used);
 145   }
 146 
 147   // refs processing: clean slate
 148   _ref_processor = NULL;
 149 
 150   // Update heap occupancy information which is used as
 151   // input to soft ref clearing policy at the next gc.
 152   Universe::update_heap_info_at_gc();
 153 
 154   // Update time of last gc for all generations we collected
 155   // (which curently is all the generations in the heap).
 156   // We need to use a monotonically non-deccreasing time in ms


src/share/vm/memory/genMarkSweep.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File