Search in sources :

Example 81 with Inline

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

the class ThinLock method getLockIndex.

/**
 * Return the lock index for a given lock word.  Assert valid index
 * ranges, that the fat lock bit is set, and that the lock entry
 * exists.
 *
 * @param lockWord The lock word whose lock index is being established
 * @return the lock index corresponding to the lock workd.
 */
@Inline
@Uninterruptible
public static int getLockIndex(Word lockWord) {
    int index = lockWord.and(TL_LOCK_ID_MASK).rshl(TL_LOCK_ID_SHIFT).toInt();
    if (VM.VerifyAssertions) {
        if (!(index > 0 && index < Lock.numLocks())) {
            VM.sysWriteln("Lock index out of range! Word: ", lockWord);
            VM.sysWrite(" index: ", index);
            VM.sysWrite(" locks: ", Lock.numLocks());
            VM.sysWriteln();
        }
        // index is in range
        VM._assert(index > 0 && index < Lock.numLocks());
        // fat lock bit is set
        VM._assert(lockWord.and(TL_STAT_MASK).EQ(TL_STAT_FAT));
    }
    return index;
}
Also used : Entrypoint(org.vmmagic.pragma.Entrypoint) Uninterruptible(org.vmmagic.pragma.Uninterruptible) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 82 with Inline

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

the class ThinLock method inlineUnlock.

@Inline
@NoNullCheck
@Unpreemptible
@Entrypoint
public static void inlineUnlock(Object o, Offset lockOffset) {
    // FIXME: bad for PPC?
    Word old = Magic.prepareWord(o, lockOffset);
    Word id = old.and(TL_THREAD_ID_MASK.or(TL_STAT_MASK));
    Word tid = Word.fromIntSignExtend(RVMThread.getCurrentThread().getLockingId());
    if (id.EQ(tid)) {
        if (!old.and(TL_LOCK_COUNT_MASK).isZero()) {
            setDedicatedU16(o, lockOffset, old.minus(TL_LOCK_COUNT_UNIT));
            Magic.fence();
            return;
        }
    } else if (old.xor(tid).rshl(TL_LOCK_COUNT_SHIFT).EQ(TL_STAT_THIN.rshl(TL_LOCK_COUNT_SHIFT))) {
        Magic.combinedLoadBarrier();
        if (Magic.attemptWord(o, lockOffset, old, old.and(TL_UNLOCK_MASK).or(TL_STAT_THIN))) {
            if (!VM.MagicAttemptImpliesStoreLoadBarrier)
                Magic.fence();
            return;
        }
    }
    unlock(o, lockOffset);
}
Also used : Word(org.vmmagic.unboxed.Word) Unpreemptible(org.vmmagic.pragma.Unpreemptible) Entrypoint(org.vmmagic.pragma.Entrypoint) NoNullCheck(org.vmmagic.pragma.NoNullCheck) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 83 with Inline

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

the class ObjectModel method copyScalar.

@Inline
private ObjectReference copyScalar(ObjectReference from, TIB tib, RVMClass type, int allocator) {
    int bytes = org.jikesrvm.objectmodel.ObjectModel.bytesRequiredWhenCopied(from.toObject(), type);
    int align = org.jikesrvm.objectmodel.ObjectModel.getAlignment(type, from.toObject());
    int offset = org.jikesrvm.objectmodel.ObjectModel.getOffsetForAlignment(type, from);
    CollectorContext context = VM.activePlan.collector();
    allocator = context.copyCheckAllocator(from, bytes, align, allocator);
    Address region = MemoryManager.allocateSpace(context, bytes, align, offset, allocator, from);
    Object toObj = org.jikesrvm.objectmodel.ObjectModel.moveObject(region, from.toObject(), bytes, type);
    ObjectReference to = ObjectReference.fromObject(toObj);
    context.postCopy(to, ObjectReference.fromObject(tib), bytes, allocator);
    return to;
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) CollectorContext(org.mmtk.plan.CollectorContext) Inline(org.vmmagic.pragma.Inline)

Example 84 with Inline

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

the class ObjectModel method isAcyclic.

@Override
@Inline
public boolean isAcyclic(ObjectReference typeRef) {
    TIB tib = Magic.addressAsTIB(typeRef.toAddress());
    RVMType type = tib.getType();
    return type.isAcyclicReference();
}
Also used : RVMType(org.jikesrvm.classloader.RVMType) TIB(org.jikesrvm.objectmodel.TIB) Inline(org.vmmagic.pragma.Inline)

Example 85 with Inline

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

the class ObjectModel method copyArray.

@Inline
private ObjectReference copyArray(ObjectReference from, TIB tib, RVMArray type, int allocator) {
    int elements = Magic.getArrayLength(from.toObject());
    int bytes = org.jikesrvm.objectmodel.ObjectModel.bytesRequiredWhenCopied(from.toObject(), type, elements);
    int align = org.jikesrvm.objectmodel.ObjectModel.getAlignment(type, from.toObject());
    int offset = org.jikesrvm.objectmodel.ObjectModel.getOffsetForAlignment(type, from);
    CollectorContext context = VM.activePlan.collector();
    allocator = context.copyCheckAllocator(from, bytes, align, allocator);
    Address region = MemoryManager.allocateSpace(context, bytes, align, offset, allocator, from);
    Object toObj = org.jikesrvm.objectmodel.ObjectModel.moveObject(region, from.toObject(), bytes, type);
    ObjectReference to = ObjectReference.fromObject(toObj);
    context.postCopy(to, ObjectReference.fromObject(tib), bytes, allocator);
    if (type == RVMType.CodeArrayType) {
        // sync all moved code arrays to get icache and dcache in sync
        // immediately.
        int dataSize = bytes - org.jikesrvm.objectmodel.ObjectModel.computeHeaderSize(Magic.getObjectType(toObj));
        org.jikesrvm.runtime.Memory.sync(to.toAddress(), dataSize);
    }
    return to;
}
Also used : Address(org.vmmagic.unboxed.Address) ObjectReference(org.vmmagic.unboxed.ObjectReference) CollectorContext(org.mmtk.plan.CollectorContext) Inline(org.vmmagic.pragma.Inline)

Aggregations

Inline (org.vmmagic.pragma.Inline)110 NoInline (org.vmmagic.pragma.NoInline)42 Entrypoint (org.vmmagic.pragma.Entrypoint)40 Offset (org.vmmagic.unboxed.Offset)38 ObjectReference (org.vmmagic.unboxed.ObjectReference)35 Address (org.vmmagic.unboxed.Address)15 Word (org.vmmagic.unboxed.Word)15 TypeReference (org.jikesrvm.classloader.TypeReference)12 Uninterruptible (org.vmmagic.pragma.Uninterruptible)6 RVMType (org.jikesrvm.classloader.RVMType)5 RVMClass (org.jikesrvm.classloader.RVMClass)4 Unpreemptible (org.vmmagic.pragma.Unpreemptible)4 RVMClassLoader (org.jikesrvm.classloader.RVMClassLoader)3 TIB (org.jikesrvm.objectmodel.TIB)3 Extent (org.vmmagic.unboxed.Extent)3 MethodReference (org.jikesrvm.classloader.MethodReference)2 ForwardReference (org.jikesrvm.compilers.common.assembler.ForwardReference)2 RVMThread (org.jikesrvm.scheduler.RVMThread)2 CollectorContext (org.mmtk.plan.CollectorContext)2 NoNullCheck (org.vmmagic.pragma.NoNullCheck)2