< prev index next > test/jdk/java/lang/instrument/GetObjectSizeIntrinsicsTest.java
Print this page
private static long roundUp(long v, long a) {
return (v + a - 1) / a * a;
}
private void testSize_newObject() {
! long expected = roundUp(Platform.is64bit() ? 16 : 8, OBJ_ALIGN);
for (int c = 0; c < ITERS; c++) {
assertEquals(expected, fInst.getObjectSize(new Object()));
}
}
private void testSize_localObject() {
! long expected = roundUp(Platform.is64bit() ? 16 : 8, OBJ_ALIGN);
Object o = new Object();
for (int c = 0; c < ITERS; c++) {
assertEquals(expected, fInst.getObjectSize(o));
}
}
static Object staticO = new Object();
private void testSize_fieldObject() {
! long expected = roundUp(Platform.is64bit() ? 16 : 8, OBJ_ALIGN);
for (int c = 0; c < ITERS; c++) {
assertEquals(expected, fInst.getObjectSize(staticO));
}
}
private static long roundUp(long v, long a) {
return (v + a - 1) / a * a;
}
private void testSize_newObject() {
! long expected = roundUp(8, OBJ_ALIGN);
for (int c = 0; c < ITERS; c++) {
assertEquals(expected, fInst.getObjectSize(new Object()));
}
}
private void testSize_localObject() {
! long expected = roundUp(8, OBJ_ALIGN);
Object o = new Object();
for (int c = 0; c < ITERS; c++) {
assertEquals(expected, fInst.getObjectSize(o));
}
}
static Object staticO = new Object();
private void testSize_fieldObject() {
! long expected = roundUp(8, OBJ_ALIGN);
for (int c = 0; c < ITERS; c++) {
assertEquals(expected, fInst.getObjectSize(staticO));
}
}
< prev index next >