33
33
* @requires vm.opt.LargePageSizeInBytes == null
34
34
* @build jdk.test.whitebox.WhiteBox
35
35
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
36
- * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+IgnoreUnrecognizedVMOptions -XX:+ UseLargePages gc.g1.TestLargePageUseForAuxMemory
36
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseLargePages gc.g1.TestLargePageUseForAuxMemory
37
37
*/
38
38
39
+ import java .util .ArrayList ;
40
+ import java .util .List ;
39
41
import java .lang .Math ;
42
+ import java .util .Collections ;
40
43
import jdk .test .lib .process .OutputAnalyzer ;
41
44
import jdk .test .lib .process .ProcessTools ;
42
45
import jdk .test .lib .Asserts ;
43
46
import jdk .test .lib .Platform ;
44
- import jtreg .SkippedException ;
45
47
import jdk .test .whitebox .WhiteBox ;
46
48
49
+ import jtreg .SkippedException ;
50
+
47
51
public class TestLargePageUseForAuxMemory {
48
52
static final long HEAP_REGION_SIZE = 1 * 1024 * 1024 ;
49
53
static long largePageSize ;
@@ -106,19 +110,22 @@ static void checkBitmaps(OutputAnalyzer output, long expectedPageSize) throws Ex
106
110
checkSize (output , expectedPageSize , "Next Bitmap: .*page_size=([^ ]+)" );
107
111
}
108
112
113
+ static List <String > getOpts (long heapsize , boolean largePageEnabled ) {
114
+ return List .of ("-XX:+UseG1GC" ,
115
+ "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE ,
116
+ "-Xmx" + heapsize ,
117
+ "-Xlog:pagesize,gc+init,gc+heap+coops=debug" ,
118
+ "-XX:" + (largePageEnabled ? "+" : "-" ) + "UseLargePages" ,
119
+ "-version" );
120
+ }
121
+
109
122
static void testVM (String what , long heapsize , boolean cardsShouldUseLargePages , boolean bitmapShouldUseLargePages ) throws Exception {
110
123
System .out .println (what + " heapsize " + heapsize + " card table should use large pages " + cardsShouldUseLargePages + " " +
111
124
"bitmaps should use large pages " + bitmapShouldUseLargePages );
112
125
ProcessBuilder pb ;
126
+
113
127
// Test with large page enabled.
114
- pb = ProcessTools .createJavaProcessBuilder ("-XX:+UseG1GC" ,
115
- "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE ,
116
- "-Xmx" + heapsize ,
117
- "-Xlog:pagesize,gc+init,gc+heap+coops=debug" ,
118
- "-XX:+UseLargePages" ,
119
- "-XX:+IgnoreUnrecognizedVMOptions" , // there is no ObjectAlignmentInBytes in 32 bit builds
120
- "-XX:ObjectAlignmentInBytes=8" ,
121
- "-version" );
128
+ pb = ProcessTools .createJavaProcessBuilder (getOpts (heapsize , true ));
122
129
123
130
OutputAnalyzer output = new OutputAnalyzer (pb .start ());
124
131
// Only expect large page size if large pages are enabled.
@@ -132,14 +139,7 @@ static void testVM(String what, long heapsize, boolean cardsShouldUseLargePages,
132
139
output .shouldHaveExitValue (0 );
133
140
134
141
// Test with large page disabled.
135
- pb = ProcessTools .createJavaProcessBuilder ("-XX:+UseG1GC" ,
136
- "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE ,
137
- "-Xmx" + heapsize ,
138
- "-Xlog:pagesize" ,
139
- "-XX:-UseLargePages" ,
140
- "-XX:+IgnoreUnrecognizedVMOptions" , // there is no ObjectAlignmentInBytes in 32 bit builds
141
- "-XX:ObjectAlignmentInBytes=8" ,
142
- "-version" );
142
+ pb = ProcessTools .createJavaProcessBuilder (getOpts (heapsize , false ));
143
143
144
144
output = new OutputAnalyzer (pb .start ());
145
145
checkSmallTables (output , smallPageSize );
0 commit comments