< prev index next >

src/share/vm/memory/collectorPolicy.cpp

Print this page
rev 7696 : 8071822: [TEST_BUG] Adapt collectorPolicy internal tests to support 64K pages

@@ -974,25 +974,36 @@
       flag_value = 20 * M;
       set_basic_flag_values();
       FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
       verify_old_min(flag_value);
 
+    // In case of large alignment due to 64K page size, some sizes are
+    // increased. Remember the result from verify_old_min for the
+    // next test.
+    size_t adapted_MaxHeapSize      = MaxHeapSize;
+    size_t adapted_InitialHeapSize  = InitialHeapSize;
+
       set_basic_flag_values();
       FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
+    // Calculate what we expect the flag to be.
+    flag_value = adapted_InitialHeapSize - MaxNewSize;
       verify_old_initial(flag_value);
 
       // If MaxNewSize is large, the maximum OldSize will be less than
       // what's requested on the command line and it should be reset
       // ergonomically.
-      flag_value = 30 * M;
+    // We intentionally set MaxNewSize + OldSize > MaxHeapSize.
       set_basic_flag_values();
+    flag_value = 30 * M;
       FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
-      FLAG_SET_CMDLINE(uintx, MaxNewSize, 170*M);
+    size_t new_size_value = adapted_MaxHeapSize - flag_value + 20*M;
+    FLAG_SET_CMDLINE(uintx, MaxNewSize, new_size_value);
       // Calculate what we expect the flag to be.
-      flag_value = MaxHeapSize - MaxNewSize;
+    flag_value = adapted_MaxHeapSize - MaxNewSize;
       verify_old_initial(flag_value);
 
+    restore_flags();
   }
 
   static void verify_young_min(size_t expected) {
     MarkSweepPolicy msp;
     msp.initialize_all();

@@ -1009,10 +1020,16 @@
 
   static void verify_scaled_young_initial(size_t initial_heap_size) {
     MarkSweepPolicy msp;
     msp.initialize_all();
 
+    if (InitialHeapSize > initial_heap_size) {
+      // InitialHeapSize was adapted by msp.initialize_all, e.g. due to alignment
+      // caused by 64K page size.
+      initial_heap_size = InitialHeapSize;
+    }
+
     size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size);
     assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected));
     assert(FLAG_IS_ERGO(NewSize) && NewSize == expected,
         err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize));
   }
< prev index next >