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 // 64-bit: 8mw-4ccp-4len
318 // 32-bit: 4mw-4ccp-4len-4gap
319 static final int ARRAY_HEADER_SIZE = 16;
320
321 final String mode;
322
323 public GetObjectSizeIntrinsicsTest(String name, String mode) {
324 super(name);
325 this.mode = mode;
326 }
327
328 public static void main(String[] args)throws Throwable {
329 new GetObjectSizeIntrinsicsTest(args[0], (args.length >= 2 ? args[1] : "")).runTest();
330 }
331
332 public static final int ITERS = 200_000;
333
334 public static void assertEquals(long expected, long actual) {
335 if (expected != actual) {
336 throw new IllegalStateException(
337 "Error: expected: " + expected + " (" + Long.toHexString(expected) +
338 "), actual: " + actual + " (" + Long.toHexString(actual) + ")");
339 }
|
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 // 64-bit: 8mw-4ccp-4len
318 // 32-bit: 4mw-4ccp-4len-4gap
319 static final int ARRAY_HEADER_SIZE = 16;
320 static final int ARRAY_HEADER_SIZE = COMPACT_HEADERS ? 8 : 16;
321
322 final String mode;
323
324 public GetObjectSizeIntrinsicsTest(String name, String mode) {
325 super(name);
326 this.mode = mode;
327 }
328
329 public static void main(String[] args)throws Throwable {
330 new GetObjectSizeIntrinsicsTest(args[0], (args.length >= 2 ? args[1] : "")).runTest();
331 }
332
333 public static final int ITERS = 200_000;
334
335 public static void assertEquals(long expected, long actual) {
336 if (expected != actual) {
337 throw new IllegalStateException(
338 "Error: expected: " + expected + " (" + Long.toHexString(expected) +
339 "), actual: " + actual + " (" + Long.toHexString(actual) + ")");
340 }
|