298
299 import jdk.test.lib.Platform;
300 import jdk.test.whitebox.WhiteBox;
301
302 public class GetObjectSizeIntrinsicsTest extends ASimpleInstrumentationTestCase {
303
304 private static final boolean COMPACT_HEADERS = Platform.is64bit() && WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompactObjectHeaders");
305 static final Boolean COMPRESSED_OOPS = WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompressedOops");
306 static final long REF_SIZE = (COMPRESSED_OOPS == null || COMPRESSED_OOPS == true) ? 4 : 8;
307
308 static final Long align = WhiteBox.getWhiteBox().getIntVMFlag("ObjectAlignmentInBytes");
309 static final int OBJ_ALIGN = (align == null ? 8 : align.intValue());
310
311 static final int SMALL_ARRAY_SIZE = 1024;
312
313 // These should overflow 4G size boundary
314 static final int LARGE_INT_ARRAY_SIZE = 1024*1024*1024 + 1024;
315 static final int LARGE_OBJ_ARRAY_SIZE = (4096/(int)REF_SIZE)*1024*1024 + 1024;
316
317 static final boolean CCP = WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompressedClassPointers");
318 static final int ARRAY_HEADER_SIZE = CCP ? 16 : (Platform.is64bit() ? 20 : 16);
319
320 final String mode;
321
322 public GetObjectSizeIntrinsicsTest(String name, String mode) {
323 super(name);
324 this.mode = mode;
325 }
326
327 public static void main(String[] args)throws Throwable {
328 new GetObjectSizeIntrinsicsTest(args[0], (args.length >= 2 ? args[1] : "")).runTest();
329 }
330
331 public static final int ITERS = 200_000;
332
333 public static void assertEquals(long expected, long actual) {
334 if (expected != actual) {
335 throw new IllegalStateException(
336 "Error: expected: " + expected + " (" + Long.toHexString(expected) +
337 "), actual: " + actual + " (" + Long.toHexString(actual) + ")");
338 }
|
298
299 import jdk.test.lib.Platform;
300 import jdk.test.whitebox.WhiteBox;
301
302 public class GetObjectSizeIntrinsicsTest extends ASimpleInstrumentationTestCase {
303
304 private static final boolean COMPACT_HEADERS = Platform.is64bit() && WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompactObjectHeaders");
305 static final Boolean COMPRESSED_OOPS = WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompressedOops");
306 static final long REF_SIZE = (COMPRESSED_OOPS == null || COMPRESSED_OOPS == true) ? 4 : 8;
307
308 static final Long align = WhiteBox.getWhiteBox().getIntVMFlag("ObjectAlignmentInBytes");
309 static final int OBJ_ALIGN = (align == null ? 8 : align.intValue());
310
311 static final int SMALL_ARRAY_SIZE = 1024;
312
313 // These should overflow 4G size boundary
314 static final int LARGE_INT_ARRAY_SIZE = 1024*1024*1024 + 1024;
315 static final int LARGE_OBJ_ARRAY_SIZE = (4096/(int)REF_SIZE)*1024*1024 + 1024;
316
317 static final boolean CCP = WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompressedClassPointers");
318 static final int ARRAY_HEADER_SIZE = COMPACT_HEADERS ? 8 : (CCP ? 16 : (Platform.is64bit() ? 20 : 16));
319
320 final String mode;
321
322 public GetObjectSizeIntrinsicsTest(String name, String mode) {
323 super(name);
324 this.mode = mode;
325 }
326
327 public static void main(String[] args)throws Throwable {
328 new GetObjectSizeIntrinsicsTest(args[0], (args.length >= 2 ? args[1] : "")).runTest();
329 }
330
331 public static final int ITERS = 200_000;
332
333 public static void assertEquals(long expected, long actual) {
334 if (expected != actual) {
335 throw new IllegalStateException(
336 "Error: expected: " + expected + " (" + Long.toHexString(expected) +
337 "), actual: " + actual + " (" + Long.toHexString(actual) + ")");
338 }
|