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

Print this page
rev 6446 : 8040807: G1: Enable G1CollectedHeap::stop()
Reviewed-by: TBD


2156   // require BOT updates or not and, if it doesn't, then a non-young
2157   // region will complain that it cannot support allocations without
2158   // BOT updates. So we'll tag the dummy region as young to avoid that.
2159   dummy_region->set_young();
2160   // Make sure it's full.
2161   dummy_region->set_top(dummy_region->end());
2162   G1AllocRegion::setup(this, dummy_region);
2163 
2164   init_mutator_alloc_region();
2165 
2166   // Do create of the monitoring and management support so that
2167   // values in the heap have been properly initialized.
2168   _g1mm = new G1MonitoringSupport(this);
2169 
2170   G1StringDedup::initialize();
2171 
2172   return JNI_OK;
2173 }
2174 
2175 void G1CollectedHeap::stop() {
2176 #if 0
2177   // Stopping concurrent worker threads is currently disabled until
2178   // some bugs in concurrent mark has been resolve. Without fixing
2179   // those bugs first we risk haning during VM exit when trying to
2180   // stop these threads.
2181 
2182   // Abort any ongoing concurrent root region scanning and stop all
2183   // concurrent threads. We do this to make sure these threads do
2184   // not continue to execute and access resources (e.g. gclog_or_tty)
2185   // that are destroyed during shutdown.
2186   _cm->root_regions()->abort();
2187   _cm->root_regions()->wait_until_scan_finished();
2188   stop_conc_gc_threads();
2189 #endif
2190 }
2191 
2192 size_t G1CollectedHeap::conservative_max_heap_alignment() {
2193   return HeapRegion::max_region_size();
2194 }
2195 
2196 void G1CollectedHeap::ref_processing_init() {
2197   // Reference processing in G1 currently works as follows:
2198   //
2199   // * There are two reference processor instances. One is
2200   //   used to record and process discovered references
2201   //   during concurrent marking; the other is used to
2202   //   record and process references during STW pauses
2203   //   (both full and incremental).
2204   // * Both ref processors need to 'span' the entire heap as
2205   //   the regions in the collection set may be dotted around.
2206   //
2207   // * For the concurrent marking ref processor:
2208   //   * Reference discovery is enabled at initial marking.
2209   //   * Reference discovery is disabled and the discovered




2156   // require BOT updates or not and, if it doesn't, then a non-young
2157   // region will complain that it cannot support allocations without
2158   // BOT updates. So we'll tag the dummy region as young to avoid that.
2159   dummy_region->set_young();
2160   // Make sure it's full.
2161   dummy_region->set_top(dummy_region->end());
2162   G1AllocRegion::setup(this, dummy_region);
2163 
2164   init_mutator_alloc_region();
2165 
2166   // Do create of the monitoring and management support so that
2167   // values in the heap have been properly initialized.
2168   _g1mm = new G1MonitoringSupport(this);
2169 
2170   G1StringDedup::initialize();
2171 
2172   return JNI_OK;
2173 }
2174 
2175 void G1CollectedHeap::stop() {
2176   // Abort any ongoing concurrent mark and stop all concurrent threads.
2177   // We do this to make sure these threads do not continue to execute
2178   // and access resources (e.g. gclog_or_tty) that are destroyed during
2179   // shutdown.
2180   _cm->set_has_aborted();





2181   _cm->root_regions()->abort();
2182   _cm->root_regions()->wait_until_scan_finished();
2183   stop_conc_gc_threads();

2184 }
2185 
2186 size_t G1CollectedHeap::conservative_max_heap_alignment() {
2187   return HeapRegion::max_region_size();
2188 }
2189 
2190 void G1CollectedHeap::ref_processing_init() {
2191   // Reference processing in G1 currently works as follows:
2192   //
2193   // * There are two reference processor instances. One is
2194   //   used to record and process discovered references
2195   //   during concurrent marking; the other is used to
2196   //   record and process references during STW pauses
2197   //   (both full and incremental).
2198   // * Both ref processors need to 'span' the entire heap as
2199   //   the regions in the collection set may be dotted around.
2200   //
2201   // * For the concurrent marking ref processor:
2202   //   * Reference discovery is enabled at initial marking.
2203   //   * Reference discovery is disabled and the discovered