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