Search in sources :

Example 31 with TIB

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);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) WordArray(org.vmmagic.unboxed.WordArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 32 with TIB

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);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 33 with TIB

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);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 34 with TIB

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);
}
Also used : TIB(org.jikesrvm.objectmodel.TIB) Test(org.junit.Test)

Example 35 with TIB

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);
}
Also used : RVMArray(org.jikesrvm.classloader.RVMArray) TIB(org.jikesrvm.objectmodel.TIB) Test(org.junit.Test)

Aggregations

TIB (org.jikesrvm.objectmodel.TIB)36 Entrypoint (org.vmmagic.pragma.Entrypoint)16 RVMArray (org.jikesrvm.classloader.RVMArray)14 RVMType (org.jikesrvm.classloader.RVMType)13 NoInline (org.vmmagic.pragma.NoInline)9 Interruptible (org.vmmagic.pragma.Interruptible)8 Address (org.vmmagic.unboxed.Address)7 Test (org.junit.Test)5 CodeArray (org.jikesrvm.compilers.common.CodeArray)4 ITable (org.jikesrvm.objectmodel.ITable)4 RVMClass (org.jikesrvm.classloader.RVMClass)3 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 Offset (org.vmmagic.unboxed.Offset)3 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)2 IMT (org.jikesrvm.objectmodel.IMT)2 ITableArray (org.jikesrvm.objectmodel.ITableArray)2 Inline (org.vmmagic.pragma.Inline)2 BufferedOutputStream (java.io.BufferedOutputStream)1 FileOutputStream (java.io.FileOutputStream)1 PrintStream (java.io.PrintStream)1