@@ -78,7 +78,7 @@ class TestGenCollectorPolicy {
7878 FLAG_SET_ERGO (size_t , InitialHeapSize, 100 * M);
7979 FLAG_SET_ERGO (size_t , OldSize, 4 * M);
8080 FLAG_SET_ERGO (size_t , NewSize, 1 * M);
81- FLAG_SET_ERGO (size_t , MaxNewSize, 80 * M);
81+ FLAG_SET_ERGO (size_t , MaxNewSize, 40 * M);
8282 Arguments::set_min_heap_size (40 * M);
8383
8484 ASSERT_NO_FATAL_FAILURE (setter1->execute ());
@@ -227,10 +227,16 @@ TEST_VM(CollectorPolicy, young_min_ergo) {
227227 TestGenCollectorPolicy::TestWrapper::test (&setter, &checker);
228228}
229229
230+ // Tests require at least 128M of MaxHeap
231+ // otherwise ergonomic is different and generation sizes might be changed.
232+
230233// If NewSize has been ergonomically set, the collector policy
231234// should use it for min but calculate the initial young size
232235// using NewRatio.
233236TEST_VM (CollectorPolicy, young_scaled_initial_ergo) {
237+ if (MaxHeapSize < 128 * M) {
238+ return ;
239+ }
234240 TestGenCollectorPolicy::SetNewSizeErgo setter (20 * M);
235241 TestGenCollectorPolicy::CheckScaledYoungInitial checker;
236242
@@ -243,6 +249,9 @@ TEST_VM(CollectorPolicy, young_scaled_initial_ergo) {
243249// the rest of the VM lifetime. This is an irreversible change and
244250// could impact other tests so we use TEST_OTHER_VM
245251TEST_OTHER_VM (CollectorPolicy, young_cmd) {
252+ if (MaxHeapSize < 128 * M) {
253+ return ;
254+ }
246255 // If NewSize is set on the command line, it should be used
247256 // for both min and initial young size if less than min heap.
248257 TestGenCollectorPolicy::SetNewSizeCmd setter (20 * M);
@@ -255,8 +264,8 @@ TEST_OTHER_VM(CollectorPolicy, young_cmd) {
255264
256265 // If NewSize is set on command line, but is larger than the min
257266 // heap size, it should only be used for initial young size.
258- TestGenCollectorPolicy::SetNewSizeCmd setter_large (80 * M);
259- TestGenCollectorPolicy::CheckYoungInitial checker_large (80 * M);
267+ TestGenCollectorPolicy::SetNewSizeCmd setter_large (40 * M);
268+ TestGenCollectorPolicy::CheckYoungInitial checker_large (40 * M);
260269 TestGenCollectorPolicy::TestWrapper::test (&setter_large, &checker_large);
261270}
262271
0 commit comments