11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "gc_implementation/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp"
26 #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp"
27 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
28 #include "gc_implementation/shenandoah/shenandoahHeapRegion.hpp"
29 #include "gc_implementation/shenandoah/shenandoahLogging.hpp"
30
31 ShenandoahPassiveHeuristics::ShenandoahPassiveHeuristics() : ShenandoahHeuristics() {
32 // Do not allow concurrent cycles.
33 FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false);
34
35 // Passive runs with max speed, reacts on allocation failure.
36 FLAG_SET_DEFAULT(ShenandoahPacing, false);
37
38 // Disable known barriers by default.
39 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier);
40 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahWriteBarrier);
41 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahReadBarrier);
42 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier);
43 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahAcmpBarrier);
44 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier);
45 }
46
47 void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(ShenandoahCollectionSet* cset,
48 RegionData* data, size_t size,
49 size_t free) {
50 for (size_t idx = 0; idx < size; idx++) {
51 ShenandoahHeapRegion* r = data[idx]._region;
52 if (r->garbage() > 0) {
53 cset->add_region(r);
54 }
55 }
56 }
57
58 bool ShenandoahPassiveHeuristics::should_start_normal_gc() const {
59 // Never do concurrent GCs.
60 return false;
61 }
62
63 bool ShenandoahPassiveHeuristics::should_process_references() {
64 if (ShenandoahRefProcFrequency == 0) return false;
65 // Always process references.
66 return true;
67 }
68
69 bool ShenandoahPassiveHeuristics::should_unload_classes() {
70 if (ShenandoahUnloadClassesFrequency == 0) return false;
71 // Always unload classes.
72 return true;
73 }
74
75 bool ShenandoahPassiveHeuristics::should_degenerate_cycle() {
76 // Always fail to Full GC
77 return false;
78 }
79
80 const char* ShenandoahPassiveHeuristics::name() {
81 return "passive";
82 }
83
84 bool ShenandoahPassiveHeuristics::is_diagnostic() {
85 return true;
86 }
87
88 bool ShenandoahPassiveHeuristics::is_experimental() {
89 return false;
90 }
|
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
21 *
22 */
23
24 #include "precompiled.hpp"
25 #include "gc_implementation/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp"
26 #include "gc_implementation/shenandoah/shenandoahCollectionSet.hpp"
27 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
28 #include "gc_implementation/shenandoah/shenandoahHeapRegion.hpp"
29 #include "gc_implementation/shenandoah/shenandoahLogging.hpp"
30
31 ShenandoahPassiveHeuristics::ShenandoahPassiveHeuristics() : ShenandoahAdaptiveHeuristics() {
32 // Do not allow concurrent cycles.
33 FLAG_SET_DEFAULT(ExplicitGCInvokesConcurrent, false);
34
35 // Passive runs with max speed, reacts on allocation failure.
36 FLAG_SET_DEFAULT(ShenandoahPacing, false);
37
38 // No need for evacuation reserve with Full GC, only for Degenerated GC.
39 if (!ShenandoahDegeneratedGC) {
40 SHENANDOAH_ERGO_OVERRIDE_DEFAULT(ShenandoahEvacReserve, 0);
41 }
42
43 // Disable known barriers by default.
44 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahSATBBarrier);
45 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahWriteBarrier);
46 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahReadBarrier);
47 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCASBarrier);
48 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahAcmpBarrier);
49 SHENANDOAH_ERGO_DISABLE_FLAG(ShenandoahCloneBarrier);
50 }
51
52 bool ShenandoahPassiveHeuristics::should_start_normal_gc() const {
53 // Never do concurrent GCs.
54 return false;
55 }
56
57 bool ShenandoahPassiveHeuristics::should_process_references() {
58 if (ShenandoahRefProcFrequency == 0) return false;
59 // Always process references.
60 return true;
61 }
62
63 bool ShenandoahPassiveHeuristics::should_unload_classes() {
64 if (ShenandoahUnloadClassesFrequency == 0) return false;
65 // Always unload classes.
66 return true;
67 }
68
69 bool ShenandoahPassiveHeuristics::should_degenerate_cycle() {
70 // Always fail to Degenerated GC, if enabled
71 return ShenandoahDegeneratedGC;
72 }
73
74 const char* ShenandoahPassiveHeuristics::name() {
75 return "passive";
76 }
77
78 bool ShenandoahPassiveHeuristics::is_diagnostic() {
79 return true;
80 }
81
82 bool ShenandoahPassiveHeuristics::is_experimental() {
83 return false;
84 }
|