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();
}
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;
}
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);
}
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);
}
Aggregations