@@ -69,7 +69,7 @@ class TestGenCollectorPolicy {
6969 FLAG_SET_ERGO (InitialHeapSize, 100 * M);
7070 FLAG_SET_ERGO (OldSize, 4 * M);
7171 FLAG_SET_ERGO (NewSize, 1 * M);
72- FLAG_SET_ERGO (MaxNewSize, 80 * M);
72+ FLAG_SET_ERGO (MaxNewSize, 40 * M);
7373
7474 ASSERT_NO_FATAL_FAILURE (setter1->execute ());
7575
@@ -212,6 +212,9 @@ class TestGenCollectorPolicy {
212212// depends on so many other configurable variables. These tests only try to
213213// verify that there are some basic rules for NewSize honored by the policies.
214214
215+ // Tests require at least 128M of MaxHeap
216+ // otherwise ergonomic is different and generation sizes might be changed.
217+
215218// If NewSize has been ergonomically set, the collector policy
216219// should use it for min
217220TEST_VM (CollectorPolicy, young_min_ergo) {
@@ -225,6 +228,9 @@ TEST_VM(CollectorPolicy, young_min_ergo) {
225228// should use it for min but calculate the initial young size
226229// using NewRatio.
227230TEST_VM (CollectorPolicy, young_scaled_initial_ergo) {
231+ if (MaxHeapSize < 128 * M) {
232+ return ;
233+ }
228234 TestGenCollectorPolicy::SetNewSizeErgo setter (20 * M);
229235 TestGenCollectorPolicy::CheckScaledYoungInitial checker;
230236
@@ -237,6 +243,9 @@ TEST_VM(CollectorPolicy, young_scaled_initial_ergo) {
237243// the rest of the VM lifetime. This is an irreversible change and
238244// could impact other tests so we use TEST_OTHER_VM
239245TEST_OTHER_VM (CollectorPolicy, young_cmd) {
246+ if (MaxHeapSize < 128 * M) {
247+ return ;
248+ }
240249 // If NewSize is set on the command line, it should be used
241250 // for both min and initial young size if less than min heap.
242251 TestGenCollectorPolicy::SetNewSizeCmd setter (20 * M);
@@ -249,8 +258,8 @@ TEST_OTHER_VM(CollectorPolicy, young_cmd) {
249258
250259 // If NewSize is set on command line, but is larger than the min
251260 // heap size, it should only be used for initial young size.
252- TestGenCollectorPolicy::SetNewSizeCmd setter_large (80 * M);
253- TestGenCollectorPolicy::CheckYoungInitial checker_large (80 * M);
261+ TestGenCollectorPolicy::SetNewSizeCmd setter_large (40 * M);
262+ TestGenCollectorPolicy::CheckYoungInitial checker_large (40 * M);
254263 TestGenCollectorPolicy::TestWrapper::test (&setter_large, &checker_large);
255264}
256265
0 commit comments