Search in sources :

Example 46 with Inline

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

the class MonotonePageResource method releasePages.

/**
 * Release all pages associated with this page resource, optionally
 * zeroing on release and optionally memory protecting on release.
 */
@Inline
private void releasePages() {
    if (contiguous) {
        // TODO: We will perform unnecessary zeroing if the nursery size has decreased.
        if (zeroConcurrent) {
            // Wait for current zeroing to finish.
            while (zeroingCursor.LT(zeroingSentinel)) {
            }
        }
        // Reset zeroing region.
        if (cursor.GT(zeroingSentinel)) {
            zeroingSentinel = cursor;
        }
        zeroingCursor = start;
        cursor = start;
        currentChunk = Conversions.chunkAlign(start, true);
    } else {
        /* Not contiguous */
        if (!cursor.isZero()) {
            do {
                Extent bytes = cursor.diff(currentChunk).toWord().toExtent();
                releasePages(currentChunk, bytes);
            } while (moveToNextChunk());
            currentChunk = Address.zero();
            sentinel = Address.zero();
            cursor = Address.zero();
            space.releaseAllChunks();
        }
    }
}
Also used : Extent(org.vmmagic.unboxed.Extent) Inline(org.vmmagic.pragma.Inline)

Example 47 with Inline

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

the class RuntimeEntrypoints method checkstore.

@Entrypoint
@Inline
static void checkstore(Object array, Object arrayElement) throws ArrayStoreException {
    if (arrayElement == null) {
        // null may be assigned to any type
        return;
    }
    RVMType lhsType = Magic.getObjectType(array);
    RVMType elmType = lhsType.asArray().getElementType();
    if (elmType == RVMType.JavaLangObjectType) {
        // array of Object can receive anything
        return;
    }
    RVMType rhsType = Magic.getObjectType(arrayElement);
    if (elmType == rhsType) {
        // exact type match
        return;
    }
    if (isAssignableWith(elmType, rhsType)) {
        return;
    }
    throw new ArrayStoreException();
}
Also used : RVMType(org.jikesrvm.classloader.RVMType) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 48 with Inline

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

the class ThinLock method inlineLock.

@Inline
@NoNullCheck
@Unpreemptible
@Entrypoint
public static void inlineLock(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)) {
        Word changed = old.plus(TL_LOCK_COUNT_UNIT);
        if (!changed.and(TL_LOCK_COUNT_MASK).isZero()) {
            setDedicatedU16(o, lockOffset, changed);
            Magic.combinedLoadBarrier();
            return;
        }
    } else if (id.EQ(TL_STAT_THIN)) {
        // lock is thin and not held by anyone
        if (Magic.attemptWord(o, lockOffset, old, old.or(tid))) {
            if (!VM.MagicAttemptImpliesStoreLoadBarrier)
                Magic.fence();
            return;
        }
    }
    lock(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 49 with Inline

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

the class ThinLock method biasBitsToThinBits.

@Inline
@Uninterruptible
private static Word biasBitsToThinBits(Word bits) {
    int lockOwner = getLockOwner(bits);
    Word changed = bits.and(TL_UNLOCK_MASK).or(TL_STAT_THIN);
    if (lockOwner != 0) {
        int recCount = getRecCount(bits);
        changed = changed.or(Word.fromIntZeroExtend(lockOwner)).or(Word.fromIntZeroExtend(recCount - 1).lsh(TL_LOCK_COUNT_SHIFT));
    }
    return changed;
}
Also used : Word(org.vmmagic.unboxed.Word) Entrypoint(org.vmmagic.pragma.Entrypoint) Uninterruptible(org.vmmagic.pragma.Uninterruptible) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

Example 50 with Inline

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

the class BumpPointer method linearScan.

/**
 * Perform a linear scan through the objects allocated by this bump pointer.
 *
 * @param scanner The scan object to delegate scanning to.
 */
@Inline
public final void linearScan(LinearScan scanner) {
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(allowScanning);
    /* Has this allocator ever allocated anything? */
    if (initialRegion.isZero())
        return;
    /* Loop through active regions or until the last region */
    Address start = initialRegion;
    while (!start.isZero()) {
        // Scan this region
        scanRegion(scanner, start);
        // Move on to next
        start = getNextRegion(start);
    }
}
Also used : Address(org.vmmagic.unboxed.Address) Inline(org.vmmagic.pragma.Inline) NoInline(org.vmmagic.pragma.NoInline)

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