Search in sources :

Example 36 with Interruptible

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

the class JavaHeader method initializeScalarHeader.

/**
 * Perform any required initialization of the JAVA portion of the header.
 * @param bootImage The bootimage being written
 * @param ptr  The object ref to the storage to be initialized
 * @param tib  The TIB of the instance being created
 * @param size The number of bytes allocated by the GC system for this object.
 * @param needsIdentityHash needs an identity hash value
 * @param identityHashValue the value for the identity hash
 * @return the address used for a reference to this object
 */
@Interruptible
public static Address initializeScalarHeader(BootImageInterface bootImage, Address ptr, TIB tib, int size, boolean needsIdentityHash, int identityHashValue) {
    Address ref = ptr.plus(OBJECT_REF_OFFSET);
    if (needsIdentityHash) {
        bootImage.setFullWord(ref.plus(STATUS_OFFSET), HASH_STATE_HASHED_AND_MOVED.toInt());
        if (DYNAMIC_HASH_OFFSET) {
            // Read the size of this object.
            RVMType t = tib.getType();
            bootImage.setFullWord(ptr.plus(t.asClass().getInstanceSize()), identityHashValue);
        } else {
            ref = ref.plus(HASHCODE_BYTES);
            bootImage.setFullWord(ref.plus(HASHCODE_OFFSET), (identityHashValue << 1) | ALIGNMENT_MASK);
        }
    } else {
        // As boot image objects can't move there is no benefit in lazily setting them to hashed
        bootImage.setFullWord(ref.plus(STATUS_OFFSET), HASH_STATE_HASHED.toInt());
    }
    return ref;
}
Also used : Address(org.vmmagic.unboxed.Address) RVMType(org.jikesrvm.classloader.RVMType) Interruptible(org.vmmagic.pragma.Interruptible)

Example 37 with Interruptible

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

the class JavaHeader method initializeArrayHeader.

/**
 * Perform any required initialization of the JAVA portion of the header.
 *
 * @param bootImage the bootimage being written
 * @param ptr  the object ref to the storage to be initialized
 * @param tib the TIB of the instance being created
 * @param size the number of bytes allocated by the GC system for this object.
 * @param numElements the number of elements in the array
 * @param needsIdentityHash needs an identity hash value
 * @param identityHashValue the value for the identity hash
 * @return the address used for a reference to this object
 */
@Interruptible
public static Address initializeArrayHeader(BootImageInterface bootImage, Address ptr, TIB tib, int size, int numElements, boolean needsIdentityHash, int identityHashValue) {
    Address ref = ptr.plus(OBJECT_REF_OFFSET);
    // (TIB set by BootImageWriter; array length set by ObjectModel)
    if (needsIdentityHash) {
        bootImage.setFullWord(ref.plus(STATUS_OFFSET), HASH_STATE_HASHED_AND_MOVED.toInt());
        if (DYNAMIC_HASH_OFFSET) {
            // Read the size of this object.
            RVMType t = tib.getType();
            bootImage.setFullWord(ptr.plus(t.asArray().getInstanceSize(numElements)), identityHashValue);
        } else {
            ref = ref.plus(HASHCODE_BYTES);
            bootImage.setFullWord(ref.plus(HASHCODE_OFFSET), (identityHashValue << 1) | ALIGNMENT_MASK);
        }
    } else {
        // As boot image objects can't move there is no benefit in lazily setting them to hashed
        bootImage.setFullWord(ref.plus(STATUS_OFFSET), HASH_STATE_HASHED.toInt());
    }
    return ref;
}
Also used : Address(org.vmmagic.unboxed.Address) RVMType(org.jikesrvm.classloader.RVMType) Interruptible(org.vmmagic.pragma.Interruptible)

Example 38 with Interruptible

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

the class JavaHeader method installHashCode.

@NoInline
@Interruptible
protected static int installHashCode(Object o) {
    Word hashCode;
    do {
        hashCodeGenerator = hashCodeGenerator.plus(Word.one().lsh(HASH_CODE_SHIFT));
        hashCode = hashCodeGenerator.and(HASH_CODE_MASK);
    } while (hashCode.isZero());
    while (true) {
        Word statusWord = Magic.prepareWord(o, STATUS_OFFSET);
        if (!(statusWord.and(HASH_CODE_MASK).isZero())) {
            // some other thread installed a hashcode
            return statusWord.and(HASH_CODE_MASK).rshl(HASH_CODE_SHIFT).toInt();
        }
        if (Magic.attemptWord(o, STATUS_OFFSET, statusWord, statusWord.or(hashCode))) {
            // we installed the hash code
            return hashCode.rshl(HASH_CODE_SHIFT).toInt();
        }
    }
}
Also used : Word(org.vmmagic.unboxed.Word) Interruptible(org.vmmagic.pragma.Interruptible) NoInline(org.vmmagic.pragma.NoInline)

Example 39 with Interruptible

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

the class ObjectModel method allocateCode.

/**
 * Allocate and initialize space in the bootimage (at bootimage writing time)
 * to be an uninitialized instance of the (array) type specified by array.
 * NOTE: TIB is set by BootimageWriter2
 *
 * @param bootImage the bootimage to put the object in
 * @param array RVMArray object of array being allocated.
 * @param numElements number of elements
 * @return Address of object in bootimage
 */
@Interruptible
public static Address allocateCode(BootImageInterface bootImage, RVMArray array, int numElements) {
    TIB tib = array.getTypeInformationBlock();
    int size = array.getInstanceSize(numElements);
    int align = getAlignment(array);
    int offset = getOffsetForAlignment(array, false);
    Address ptr = bootImage.allocateCodeStorage(size, align, offset);
    Address ref = JavaHeader.initializeArrayHeader(bootImage, ptr, tib, size, numElements, false, 0);
    bootImage.setFullWord(ref.plus(getArrayLengthOffset()), numElements);
    MemoryManager.initializeHeader(bootImage, ref, tib, size, false);
    MiscHeader.initializeHeader(bootImage, ref, tib, size, false);
    return ref;
}
Also used : Address(org.vmmagic.unboxed.Address) Entrypoint(org.vmmagic.pragma.Entrypoint) Interruptible(org.vmmagic.pragma.Interruptible)

Example 40 with Interruptible

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

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