Search in sources :

Example 41 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class MemoryManager method pickAllocator.

/**
 * Returns the appropriate allocation scheme/area for the given type
 * and given method requesting the allocation.
 *
 * @param type the type of the object to be allocated
 * @param method the method requesting the allocation
 * @return the identifier of the appropriate allocator
 */
@Interruptible
public static int pickAllocator(RVMType type, RVMMethod method) {
    if (traceAllocator) {
        VM.sysWrite("allocator for ");
        VM.sysWrite(type.getDescriptor());
        VM.sysWrite(": ");
    }
    if (method != null) {
        // We should strive to be allocation-free here.
        RVMClass cls = method.getDeclaringClass();
        byte[] clsBA = cls.getDescriptor().toByteArray();
        if (Selected.Constraints.get().withGCspy()) {
            if (isPrefix("Lorg/mmtk/vm/gcspy/", clsBA) || isPrefix("[Lorg/mmtk/vm/gcspy/", clsBA)) {
                if (traceAllocator) {
                    VM.sysWriteln("GCSPY");
                }
                return Plan.ALLOC_GCSPY;
            }
        }
        if (isPrefix("Lorg/jikesrvm/mm/mmtk/ReferenceProcessor", clsBA)) {
            if (traceAllocator) {
                VM.sysWriteln("DEFAULT");
            }
            return Plan.ALLOC_DEFAULT;
        }
        if (isPrefix("Lorg/mmtk/", clsBA) || isPrefix("Lorg/jikesrvm/mm/", clsBA)) {
            if (traceAllocator) {
                VM.sysWriteln("NONMOVING");
            }
            return Plan.ALLOC_NON_MOVING;
        }
        if (method.isNonMovingAllocation()) {
            return Plan.ALLOC_NON_MOVING;
        }
    }
    if (traceAllocator) {
        VM.sysWriteln(type.getMMAllocator());
    }
    return type.getMMAllocator();
}
Also used : RVMClass(org.jikesrvm.classloader.RVMClass) Interruptible(org.vmmagic.pragma.Interruptible)

Example 42 with Interruptible

use of org.vmmagic.pragma.Interruptible in project JikesRVM by JikesRVM.

the class MemoryManager method pickAllocatorForType.

/**
 * Determine the default allocator to be used for a given type.
 *
 * @param type The type in question
 * @return The allocator to use for allocating instances of type
 * <code>type</code>.
 */
@Interruptible
private static int pickAllocatorForType(RVMType type) {
    int allocator = Plan.ALLOC_DEFAULT;
    if (type.isArrayType()) {
        RVMType elementType = type.asArray().getElementType();
        if (elementType.isPrimitiveType() || elementType.isUnboxedType()) {
            allocator = Plan.ALLOC_NON_REFERENCE;
        }
    }
    if (type.isNonMoving()) {
        allocator = Plan.ALLOC_NON_MOVING;
    }
    byte[] typeBA = type.getDescriptor().toByteArray();
    if (Selected.Constraints.get().withGCspy()) {
        if (isPrefix("Lorg/mmtk/vm/gcspy/", typeBA) || isPrefix("[Lorg/mmtk/vm/gcspy/", typeBA)) {
            allocator = Plan.ALLOC_GCSPY;
        }
    }
    if (isPrefix("Lorg/jikesrvm/tuningfork", typeBA) || isPrefix("[Lorg/jikesrvm/tuningfork", typeBA) || isPrefix("Lcom/ibm/tuningfork/", typeBA) || isPrefix("[Lcom/ibm/tuningfork/", typeBA) || isPrefix("Lorg/mmtk/", typeBA) || isPrefix("[Lorg/mmtk/", typeBA) || isPrefix("Lorg/jikesrvm/mm/", typeBA) || isPrefix("[Lorg/jikesrvm/mm/", typeBA) || isPrefix("Lorg/jikesrvm/jni/JNIEnvironment;", typeBA)) {
        allocator = Plan.ALLOC_NON_MOVING;
    }
    return allocator;
}
Also used : RVMType(org.jikesrvm.classloader.RVMType) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 43 with Interruptible

use of org.vmmagic.pragma.Interruptible 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 44 with Interruptible

use of org.vmmagic.pragma.Interruptible 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)

Aggregations

Interruptible (org.vmmagic.pragma.Interruptible)44 Entrypoint (org.vmmagic.pragma.Entrypoint)22 Address (org.vmmagic.unboxed.Address)11 NoInline (org.vmmagic.pragma.NoInline)9 TIB (org.jikesrvm.objectmodel.TIB)8 RVMArray (org.jikesrvm.classloader.RVMArray)7 RVMType (org.jikesrvm.classloader.RVMType)6 RVMMethod (org.jikesrvm.classloader.RVMMethod)3 Offset (org.vmmagic.unboxed.Offset)3 NormalMethod (org.jikesrvm.classloader.NormalMethod)2 RVMClass (org.jikesrvm.classloader.RVMClass)2 CodeArray (org.jikesrvm.compilers.common.CodeArray)2 CallSiteTreeNode (org.jikesrvm.compilers.opt.inlining.CallSiteTreeNode)2 CollectorThread (org.jikesrvm.mm.mminterface.CollectorThread)2 Extent (org.vmmagic.unboxed.Extent)2 EventAttribute (com.ibm.tuningfork.tracegen.types.EventAttribute)1 Atom (org.jikesrvm.classloader.Atom)1 TypeReference (org.jikesrvm.classloader.TypeReference)1 BaselineCompiledMethod (org.jikesrvm.compilers.baseline.BaselineCompiledMethod)1 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)1