use of org.jikesrvm.classloader.RVMArray 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);
}
use of org.jikesrvm.classloader.RVMArray in project JikesRVM by JikesRVM.
the class MemoryManagerTest method allocateArrayTestNegative.
@Test(expected = OutOfMemoryError.class)
public void allocateArrayTestNegative() {
int size = -5;
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