@@ -124,11 +124,12 @@ public static void main(String args[]) {
124
124
public static void verifyDefNewNewRatio (int expectedRatio ) {
125
125
long initEden = HeapRegionUsageTool .getEdenUsage ().getInit ();
126
126
long initSurv = HeapRegionUsageTool .getSurvivorUsage ().getInit ();
127
- long initOld = HeapRegionUsageTool .getOldUsage ().getInit ();
127
+ long initHeap = HeapRegionUsageTool .getHeapUsage ().getInit ();
128
128
129
129
long newSize = initEden + 2 * initSurv ;
130
130
131
- long expectedNewSize = HeapRegionUsageTool .alignDown (initOld / expectedRatio ,
131
+ // See GenArguments::scale_by_NewRatio_aligned for calculation in the JVM.
132
+ long expectedNewSize = HeapRegionUsageTool .alignDown (initHeap / (expectedRatio + 1 ),
132
133
wb .getHeapSpaceAlignment ());
133
134
134
135
if (expectedNewSize != newSize ) {
@@ -145,11 +146,12 @@ public static void verifyDefNewNewRatio(int expectedRatio) {
145
146
public static void verifyPSNewRatio (int expectedRatio ) {
146
147
long initEden = HeapRegionUsageTool .getEdenUsage ().getInit ();
147
148
long initSurv = HeapRegionUsageTool .getSurvivorUsage ().getInit ();
148
- long initOld = HeapRegionUsageTool .getOldUsage ().getInit ();
149
+ long initHeap = HeapRegionUsageTool .getHeapUsage ().getInit ();
149
150
150
151
long newSize = initEden + 2 * initSurv ;
151
152
152
- long alignedDownNewSize = HeapRegionUsageTool .alignDown (initOld / expectedRatio ,
153
+ // See GenArguments::scale_by_NewRatio_aligned for calculation in the JVM.
154
+ long alignedDownNewSize = HeapRegionUsageTool .alignDown (initHeap / (expectedRatio + 1 ),
153
155
wb .getHeapSpaceAlignment ());
154
156
long expectedNewSize = HeapRegionUsageTool .alignUp (alignedDownNewSize ,
155
157
wb .psVirtualSpaceAlignment ());
0 commit comments