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 ;
@@ -105,19 +109,22 @@ static void checkBitmap(OutputAnalyzer output, long expectedPageSize) throws Exc
105
109
checkSize (output , expectedPageSize , "Mark Bitmap: .*page_size=([^ ]+)" );
106
110
}
107
111
112
+ static List <String > getOpts (long heapsize , boolean largePageEnabled ) {
113
+ return List .of ("-XX:+UseG1GC" ,
114
+ "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE ,
115
+ "-Xmx" + heapsize ,
116
+ "-Xlog:pagesize,gc+init,gc+heap+coops=debug" ,
117
+ "-XX:" + (largePageEnabled ? "+" : "-" ) + "UseLargePages" ,
118
+ "-version" );
119
+ }
120
+
108
121
static void testVM (String what , long heapsize , boolean cardsShouldUseLargePages , boolean bitmapShouldUseLargePages ) throws Exception {
109
122
System .out .println (what + " heapsize " + heapsize + " card table should use large pages " + cardsShouldUseLargePages + " " +
110
123
"bitmaps should use large pages " + bitmapShouldUseLargePages );
111
124
ProcessBuilder pb ;
125
+
112
126
// Test with large page enabled.
113
- pb = ProcessTools .createJavaProcessBuilder ("-XX:+UseG1GC" ,
114
- "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE ,
115
- "-Xmx" + heapsize ,
116
- "-Xlog:pagesize,gc+init,gc+heap+coops=debug" ,
117
- "-XX:+UseLargePages" ,
118
- "-XX:+IgnoreUnrecognizedVMOptions" , // there is no ObjectAlignmentInBytes in 32 bit builds
119
- "-XX:ObjectAlignmentInBytes=8" ,
120
- "-version" );
127
+ pb = ProcessTools .createJavaProcessBuilder (getOpts (heapsize , true ));
121
128
122
129
OutputAnalyzer output = new OutputAnalyzer (pb .start ());
123
130
// Only expect large page size if large pages are enabled.
@@ -131,14 +138,7 @@ static void testVM(String what, long heapsize, boolean cardsShouldUseLargePages,
131
138
output .shouldHaveExitValue (0 );
132
139
133
140
// Test with large page disabled.
134
- pb = ProcessTools .createJavaProcessBuilder ("-XX:+UseG1GC" ,
135
- "-XX:G1HeapRegionSize=" + HEAP_REGION_SIZE ,
136
- "-Xmx" + heapsize ,
137
- "-Xlog:pagesize" ,
138
- "-XX:-UseLargePages" ,
139
- "-XX:+IgnoreUnrecognizedVMOptions" , // there is no ObjectAlignmentInBytes in 32 bit builds
140
- "-XX:ObjectAlignmentInBytes=8" ,
141
- "-version" );
141
+ pb = ProcessTools .createJavaProcessBuilder (getOpts (heapsize , false ));
142
142
143
143
output = new OutputAnalyzer (pb .start ());
144
144
checkSmallTables (output , smallPageSize );
0 commit comments