2018 void G1CollectedHeap::stop() {
2019 // Stop all concurrent threads. We do this to make sure these threads
2020 // do not continue to execute and access resources (e.g. gclog_or_tty)
2021 // that are destroyed during shutdown.
2022 _cg1r->stop();
2023 _cmThread->stop();
2024 if (G1StringDedup::is_enabled()) {
2025 G1StringDedup::stop();
2026 }
2027 }
2028
2029 void G1CollectedHeap::clear_humongous_is_live_table() {
2030 guarantee(G1EagerReclaimHumongousObjects, "Should only be called if true");
2031 _humongous_is_live.clear();
2032 }
2033
2034 size_t G1CollectedHeap::conservative_max_heap_alignment() {
2035 return HeapRegion::max_region_size();
2036 }
2037
2038 void G1CollectedHeap::ref_processing_init() {
2039 // Reference processing in G1 currently works as follows:
2040 //
2041 // * There are two reference processor instances. One is
2042 // used to record and process discovered references
2043 // during concurrent marking; the other is used to
2044 // record and process references during STW pauses
2045 // (both full and incremental).
2046 // * Both ref processors need to 'span' the entire heap as
2047 // the regions in the collection set may be dotted around.
2048 //
2049 // * For the concurrent marking ref processor:
2050 // * Reference discovery is enabled at initial marking.
2051 // * Reference discovery is disabled and the discovered
2052 // references processed etc during remarking.
2053 // * Reference discovery is MT (see below).
2054 // * Reference discovery requires a barrier (see below).
2055 // * Reference processing may or may not be MT
2056 // (depending on the value of ParallelRefProcEnabled
2057 // and ParallelGCThreads).
2058 // * A full GC disables reference discovery by the CM
2059 // ref processor and abandons any entries on it's
2060 // discovered lists.
2061 //
2062 // * For the STW processor:
2063 // * Non MT discovery is enabled at the start of a full GC.
2064 // * Processing and enqueueing during a full GC is non-MT.
2065 // * During a full GC, references are processed after marking.
2066 //
2067 // * Discovery (may or may not be MT) is enabled at the start
2068 // of an incremental evacuation pause.
2069 // * References are processed near the end of a STW evacuation pause.
2070 // * For both types of GC:
2071 // * Discovery is atomic - i.e. not concurrent.
2072 // * Reference discovery will not need a barrier.
2073
2074 SharedHeap::ref_processing_init();
2075 MemRegion mr = reserved_region();
2076
2077 // Concurrent Mark ref processor
2078 _ref_processor_cm =
2079 new ReferenceProcessor(mr, // span
2080 ParallelRefProcEnabled && (ParallelGCThreads > 1),
2081 // mt processing
2082 (int) ParallelGCThreads,
2083 // degree of mt processing
2084 (ParallelGCThreads > 1) || (ConcGCThreads > 1),
2085 // mt discovery
2086 (int) MAX2(ParallelGCThreads, ConcGCThreads),
2087 // degree of mt discovery
2088 false,
2089 // Reference discovery is not atomic
2090 &_is_alive_closure_cm);
2091 // is alive closure
2092 // (for efficiency/performance)
2093
2094 // STW ref processor
|
2018 void G1CollectedHeap::stop() {
2019 // Stop all concurrent threads. We do this to make sure these threads
2020 // do not continue to execute and access resources (e.g. gclog_or_tty)
2021 // that are destroyed during shutdown.
2022 _cg1r->stop();
2023 _cmThread->stop();
2024 if (G1StringDedup::is_enabled()) {
2025 G1StringDedup::stop();
2026 }
2027 }
2028
2029 void G1CollectedHeap::clear_humongous_is_live_table() {
2030 guarantee(G1EagerReclaimHumongousObjects, "Should only be called if true");
2031 _humongous_is_live.clear();
2032 }
2033
2034 size_t G1CollectedHeap::conservative_max_heap_alignment() {
2035 return HeapRegion::max_region_size();
2036 }
2037
2038 void G1CollectedHeap::post_initialize() {
2039 CollectedHeap::post_initialize();
2040 ref_processing_init();
2041 }
2042
2043 void G1CollectedHeap::ref_processing_init() {
2044 // Reference processing in G1 currently works as follows:
2045 //
2046 // * There are two reference processor instances. One is
2047 // used to record and process discovered references
2048 // during concurrent marking; the other is used to
2049 // record and process references during STW pauses
2050 // (both full and incremental).
2051 // * Both ref processors need to 'span' the entire heap as
2052 // the regions in the collection set may be dotted around.
2053 //
2054 // * For the concurrent marking ref processor:
2055 // * Reference discovery is enabled at initial marking.
2056 // * Reference discovery is disabled and the discovered
2057 // references processed etc during remarking.
2058 // * Reference discovery is MT (see below).
2059 // * Reference discovery requires a barrier (see below).
2060 // * Reference processing may or may not be MT
2061 // (depending on the value of ParallelRefProcEnabled
2062 // and ParallelGCThreads).
2063 // * A full GC disables reference discovery by the CM
2064 // ref processor and abandons any entries on it's
2065 // discovered lists.
2066 //
2067 // * For the STW processor:
2068 // * Non MT discovery is enabled at the start of a full GC.
2069 // * Processing and enqueueing during a full GC is non-MT.
2070 // * During a full GC, references are processed after marking.
2071 //
2072 // * Discovery (may or may not be MT) is enabled at the start
2073 // of an incremental evacuation pause.
2074 // * References are processed near the end of a STW evacuation pause.
2075 // * For both types of GC:
2076 // * Discovery is atomic - i.e. not concurrent.
2077 // * Reference discovery will not need a barrier.
2078
2079 MemRegion mr = reserved_region();
2080
2081 // Concurrent Mark ref processor
2082 _ref_processor_cm =
2083 new ReferenceProcessor(mr, // span
2084 ParallelRefProcEnabled && (ParallelGCThreads > 1),
2085 // mt processing
2086 (int) ParallelGCThreads,
2087 // degree of mt processing
2088 (ParallelGCThreads > 1) || (ConcGCThreads > 1),
2089 // mt discovery
2090 (int) MAX2(ParallelGCThreads, ConcGCThreads),
2091 // degree of mt discovery
2092 false,
2093 // Reference discovery is not atomic
2094 &_is_alive_closure_cm);
2095 // is alive closure
2096 // (for efficiency/performance)
2097
2098 // STW ref processor
|