Search in sources :

Example 41 with Entrypoint

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

the class OptSaveVolatile method yieldpointFromBackedge.

/**
 * Handle timer interrupt taken on loop backedge.
 * This method is identical to the yieldpointFromBackedge() method used
 * method used by the baseline compiler, except in the OPT compiler world,
 * we also save the volatile registers.
 */
@Entrypoint
public static void yieldpointFromBackedge() {
    Address fp = Magic.getFramePointer();
    RVMThread.yieldpoint(RVMThread.BACKEDGE, fp);
}
Also used : Address(org.vmmagic.unboxed.Address) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 42 with Entrypoint

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

the class OptSaveVolatile method yieldpointFromOsrOpt.

/**
 * OSR invalidation being initiated.
 */
@Entrypoint
public static void yieldpointFromOsrOpt() {
    Address fp = Magic.getFramePointer();
    RVMThread.getCurrentThread().yieldToOSRRequested = true;
    RVMThread.getCurrentThread().takeYieldpoint = 1;
    RVMThread.yieldpoint(RVMThread.OSROPT, fp);
}
Also used : Address(org.vmmagic.unboxed.Address) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 43 with Entrypoint

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

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

the class RVMThread method yieldpointFromPrologue.

/*
   * Support for yieldpoints
   */
/**
 * Yieldpoint taken in prologue.
 */
@BaselineSaveLSRegisters
// Save all non-volatile registers in prologue
@NoOptCompile
@NoInline
// TODO fix this -- related to SaveVolatile
@Entrypoint
@Unpreemptible("Becoming another thread interrupts the current thread, avoid preemption in the process")
public static void yieldpointFromPrologue() {
    Address fp = Magic.getFramePointer();
    yieldpoint(PROLOGUE, fp);
}
Also used : Address(org.vmmagic.unboxed.Address) Unpreemptible(org.vmmagic.pragma.Unpreemptible) Entrypoint(org.vmmagic.pragma.Entrypoint) BaselineSaveLSRegisters(org.vmmagic.pragma.BaselineSaveLSRegisters) NoInline(org.vmmagic.pragma.NoInline) NoOptCompile(org.vmmagic.pragma.NoOptCompile)

Example 45 with Entrypoint

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

the class RuntimeEntrypoints method checkcast.

/**
 * Throw exception unless object is instance of target
 * class/array or implements target interface.
 * @param object object to be tested
 * @param id of type reference corresponding to target class/array/interface
 */
@Entrypoint
static void checkcast(Object object, int id) throws ClassCastException, NoClassDefFoundError {
    if (object == null) {
        // null may be cast to any type
        return;
    }
    TypeReference tRef = TypeReference.getTypeRef(id);
    RVMType lhsType = tRef.peekType();
    if (lhsType == null) {
        lhsType = tRef.resolve();
    }
    RVMType rhsType = ObjectModel.getObjectType(object);
    if (lhsType == rhsType) {
        // exact match
        return;
    }
    // 
    if (!isAssignableWith(lhsType, rhsType)) {
        throw new ClassCastException("Cannot cast a(n) " + rhsType + " to a(n) " + lhsType);
    }
}
Also used : RVMType(org.jikesrvm.classloader.RVMType) TypeReference(org.jikesrvm.classloader.TypeReference) Entrypoint(org.vmmagic.pragma.Entrypoint)

Aggregations

Entrypoint (org.vmmagic.pragma.Entrypoint)69 Inline (org.vmmagic.pragma.Inline)35 ObjectReference (org.vmmagic.unboxed.ObjectReference)33 Offset (org.vmmagic.unboxed.Offset)22 Address (org.vmmagic.unboxed.Address)12 TypeReference (org.jikesrvm.classloader.TypeReference)7 NoInline (org.vmmagic.pragma.NoInline)7 RVMType (org.jikesrvm.classloader.RVMType)6 Unpreemptible (org.vmmagic.pragma.Unpreemptible)6 RVMMethod (org.jikesrvm.classloader.RVMMethod)5 RVMArray (org.jikesrvm.classloader.RVMArray)3 RVMClass (org.jikesrvm.classloader.RVMClass)3 RVMThread (org.jikesrvm.scheduler.RVMThread)3 BaselineSaveLSRegisters (org.vmmagic.pragma.BaselineSaveLSRegisters)3 NoOptCompile (org.vmmagic.pragma.NoOptCompile)3 AbstractRegisters (org.jikesrvm.architecture.AbstractRegisters)2 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)2 ForwardReference (org.jikesrvm.compilers.common.assembler.ForwardReference)2 ITable (org.jikesrvm.objectmodel.ITable)2 TIB (org.jikesrvm.objectmodel.TIB)2