Skip to content
This repository has been archived by the owner. It is now read-only.

8267271: Fix gc/arguments/TestNewRatioFlag.java expectedNewSize calculation #28

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -122,11 +122,12 @@ public static void main(String args[]) {
public static void verifyDefNewNewRatio(int expectedRatio) {
long initEden = HeapRegionUsageTool.getEdenUsage().getInit();
long initSurv = HeapRegionUsageTool.getSurvivorUsage().getInit();
long initOld = HeapRegionUsageTool.getOldUsage().getInit();
long initHeap = HeapRegionUsageTool.getHeapUsage().getInit();

long newSize = initEden + 2 * initSurv;

long expectedNewSize = HeapRegionUsageTool.alignDown(initOld / expectedRatio,
// See GenArguments::scale_by_NewRatio_aligned for calculation in the JVM.
long expectedNewSize = HeapRegionUsageTool.alignDown(initHeap / (expectedRatio + 1),
wb.getHeapSpaceAlignment());

if (expectedNewSize != newSize) {
@@ -143,11 +144,12 @@ public static void verifyDefNewNewRatio(int expectedRatio) {
public static void verifyPSNewRatio(int expectedRatio) {
long initEden = HeapRegionUsageTool.getEdenUsage().getInit();
long initSurv = HeapRegionUsageTool.getSurvivorUsage().getInit();
long initOld = HeapRegionUsageTool.getOldUsage().getInit();
long initHeap = HeapRegionUsageTool.getHeapUsage().getInit();

long newSize = initEden + 2 * initSurv;

long alignedDownNewSize = HeapRegionUsageTool.alignDown(initOld / expectedRatio,
// See GenArguments::scale_by_NewRatio_aligned for calculation in the JVM.
long alignedDownNewSize = HeapRegionUsageTool.alignDown(initHeap / (expectedRatio + 1),
wb.getHeapSpaceAlignment());
long expectedNewSize = HeapRegionUsageTool.alignUp(alignedDownNewSize,
wb.psVirtualSpaceAlignment());