Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8267271: Fix gc/arguments/TestNewRatioFlag.java expectedNewSize calcu…
…lation

Reviewed-by: tschatzl, kbarrett
  • Loading branch information
kstefanj committed Jun 16, 2021
1 parent 4d545a1 commit 59de99d11988b7f1ab20e323f3dc4d0d49e3b7a3
Showing 1 changed file with 6 additions and 4 deletions.
@@ -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());

1 comment on commit 59de99d

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 59de99d Jun 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.