355 testSize_localSmallIntArray();
356 testSize_fieldSmallIntArray();
357
358 testSize_newSmallObjArray();
359 testSize_localSmallObjArray();
360 testSize_fieldSmallObjArray();
361
362 if (mode.equals("large")) {
363 testSize_localLargeIntArray();
364 testSize_localLargeObjArray();
365 }
366
367 testNulls();
368 }
369
370 private static long roundUp(long v, long a) {
371 return (v + a - 1) / a * a;
372 }
373
374 private void testSize_newObject() {
375 long expected = roundUp(Platform.is64bit() ? 16 : 8, OBJ_ALIGN);
376 for (int c = 0; c < ITERS; c++) {
377 assertEquals(expected, fInst.getObjectSize(new Object()));
378 }
379 }
380
381 private void testSize_localObject() {
382 long expected = roundUp(Platform.is64bit() ? 16 : 8, OBJ_ALIGN);
383 Object o = new Object();
384 for (int c = 0; c < ITERS; c++) {
385 assertEquals(expected, fInst.getObjectSize(o));
386 }
387 }
388
389 static Object staticO = new Object();
390
391 private void testSize_fieldObject() {
392 long expected = roundUp(Platform.is64bit() ? 16 : 8, OBJ_ALIGN);
393 for (int c = 0; c < ITERS; c++) {
394 assertEquals(expected, fInst.getObjectSize(staticO));
395 }
396 }
397
398 private void testSize_newSmallIntArray() {
399 long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
400 for (int c = 0; c < ITERS; c++) {
401 assertEquals(expected, fInst.getObjectSize(new int[SMALL_ARRAY_SIZE]));
402 }
403 }
404
405 private void testSize_localSmallIntArray() {
406 int[] arr = new int[SMALL_ARRAY_SIZE];
407 long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
408 for (int c = 0; c < ITERS; c++) {
409 assertEquals(expected, fInst.getObjectSize(arr));
410 }
411 }
412
|
355 testSize_localSmallIntArray();
356 testSize_fieldSmallIntArray();
357
358 testSize_newSmallObjArray();
359 testSize_localSmallObjArray();
360 testSize_fieldSmallObjArray();
361
362 if (mode.equals("large")) {
363 testSize_localLargeIntArray();
364 testSize_localLargeObjArray();
365 }
366
367 testNulls();
368 }
369
370 private static long roundUp(long v, long a) {
371 return (v + a - 1) / a * a;
372 }
373
374 private void testSize_newObject() {
375 long expected = roundUp(8, OBJ_ALIGN);
376 for (int c = 0; c < ITERS; c++) {
377 assertEquals(expected, fInst.getObjectSize(new Object()));
378 }
379 }
380
381 private void testSize_localObject() {
382 long expected = roundUp(8, OBJ_ALIGN);
383 Object o = new Object();
384 for (int c = 0; c < ITERS; c++) {
385 assertEquals(expected, fInst.getObjectSize(o));
386 }
387 }
388
389 static Object staticO = new Object();
390
391 private void testSize_fieldObject() {
392 long expected = roundUp(8, OBJ_ALIGN);
393 for (int c = 0; c < ITERS; c++) {
394 assertEquals(expected, fInst.getObjectSize(staticO));
395 }
396 }
397
398 private void testSize_newSmallIntArray() {
399 long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
400 for (int c = 0; c < ITERS; c++) {
401 assertEquals(expected, fInst.getObjectSize(new int[SMALL_ARRAY_SIZE]));
402 }
403 }
404
405 private void testSize_localSmallIntArray() {
406 int[] arr = new int[SMALL_ARRAY_SIZE];
407 long expected = roundUp(4L*SMALL_ARRAY_SIZE + 16, OBJ_ALIGN);
408 for (int c = 0; c < ITERS; c++) {
409 assertEquals(expected, fInst.getObjectSize(arr));
410 }
411 }
412
|