use of org.jikesrvm.objectmodel.TIB in project JikesRVM by JikesRVM.
the class MemoryManager method newNonMovingWordArray.
/**
* Allocates a non moving word array.
*
* @param size The size of the array
* @return the new non moving word array
*/
@NoInline
@Interruptible
public static WordArray newNonMovingWordArray(int size) {
if (!VM.runningVM) {
return WordArray.create(size);
}
RVMArray arrayType = RVMType.WordArrayType;
int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
int align = ObjectModel.getAlignment(arrayType);
int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
int width = arrayType.getLogElementSize();
TIB arrayTib = arrayType.getTypeInformationBlock();
return (WordArray) allocateArray(size, width, headerSize, arrayTib, Plan.ALLOC_NON_MOVING, align, offset, Plan.DEFAULT_SITE);
}
use of org.jikesrvm.objectmodel.TIB in project JikesRVM by JikesRVM.
the class MemoryManager method newNonMovingDoubleArray.
/**
* Allocates a non moving double array.
*
* @param size The size of the array
* @return the new non moving double array
*/
@NoInline
@Interruptible
public static double[] newNonMovingDoubleArray(int size) {
if (!VM.runningVM) {
return new double[size];
}
RVMArray arrayType = RVMArray.DoubleArray;
int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
int align = ObjectModel.getAlignment(arrayType);
int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
int width = arrayType.getLogElementSize();
TIB arrayTib = arrayType.getTypeInformationBlock();
return (double[]) allocateArray(size, width, headerSize, arrayTib, Plan.ALLOC_NON_MOVING, align, offset, Plan.DEFAULT_SITE);
}
use of org.jikesrvm.objectmodel.TIB in project JikesRVM by JikesRVM.
the class MemoryManager method newNonMovingIntArray.
/**
* Allocates a non moving int array.
*
* @param size The size of the array
* @return the new non moving int array
*/
@NoInline
@Interruptible
public static int[] newNonMovingIntArray(int size) {
if (!VM.runningVM) {
return new int[size];
}
RVMArray arrayType = RVMArray.IntArray;
int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
int align = ObjectModel.getAlignment(arrayType);
int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
int width = arrayType.getLogElementSize();
TIB arrayTib = arrayType.getTypeInformationBlock();
return (int[]) allocateArray(size, width, headerSize, arrayTib, Plan.ALLOC_NON_MOVING, align, offset, Plan.DEFAULT_SITE);
}
use of org.jikesrvm.objectmodel.TIB in project JikesRVM by JikesRVM.
the class MemoryManagerTest method newTIBTestPositive.
@Test
public void newTIBTestPositive() {
TIB test = MemoryManager.newTIB(20, 0);
assertNotNull(test);
}
use of org.jikesrvm.objectmodel.TIB in project JikesRVM by JikesRVM.
the class MemoryManagerTest method allocateArrayTestOverflowToNegative.
@Test(expected = OutOfMemoryError.class)
public void allocateArrayTestOverflowToNegative() {
int size = 1 << 29;
RVMArray arrayType = RVMArray.IntArray;
int headerSize = ObjectModel.computeArrayHeaderSize(arrayType);
int align = ObjectModel.getAlignment(arrayType);
int offset = ObjectModel.getOffsetForAlignment(arrayType, false);
int width = arrayType.getLogElementSize();
TIB arrayTib = arrayType.getTypeInformationBlock();
int[] test = (int[]) MemoryManager.allocateArray(size, width, headerSize, arrayTib, ALLOC_NON_MOVING, align, offset, DEFAULT_SITE);
fail("FAIL! Created array with length " + test.length);
}
Aggregations