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