Search in sources :

Example 1 with Entrypoint

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

the class VM method boot.

/**
 * Begin VM execution.<p>
 *
 * Uninterruptible because we are not setup to execute a yieldpoint
 * or stackoverflow check in the prologue this early in booting.<p>
 *
 * The following machine registers are set by "C" bootstrap program
 * before calling this method:
 * <ol>
 *   <li>JTOC_POINTER - required for accessing globals
 *   <li>FRAME_POINTER - required for accessing locals
 *   <li>THREAD_ID_REGISTER - required for method prolog (stack overflow check)
 * </ol>
 */
@UnpreemptibleNoWarn("No point threading until threading is booted")
@Entrypoint
public static void boot() {
    writingBootImage = false;
    runningVM = true;
    verboseBoot = BootRecord.the_boot_record.verboseBoot;
    verboseSignalHandling = BootRecord.the_boot_record.verboseSignalHandling != 0;
    sysWriteLockOffset = Entrypoints.sysWriteLockField.getOffset();
    if (verboseBoot >= 1)
        VM.sysWriteln("Booting");
    // register.
    if (verboseBoot >= 1)
        VM.sysWriteln("Setting up current RVMThread");
    if (VM.BuildForIA32) {
        org.jikesrvm.ia32.ThreadLocalState.boot();
    } else {
        if (VM.VerifyAssertions)
            VM._assert(VM.BuildForPowerPC);
        org.jikesrvm.ppc.ThreadLocalState.boot();
    }
    // 
    if (verboseBoot >= 1)
        VM.sysWriteln("Doing thread initialization");
    RVMThread currentThread = RVMThread.getCurrentThread();
    currentThread.stackLimit = Magic.objectAsAddress(currentThread.getStack()).plus(StackFrameLayout.getStackSizeGuard());
    finishBooting();
}
Also used : RVMThread(org.jikesrvm.scheduler.RVMThread) Entrypoint(org.vmmagic.pragma.Entrypoint) UnpreemptibleNoWarn(org.vmmagic.pragma.UnpreemptibleNoWarn)

Example 2 with Entrypoint

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

the class InterfaceInvocation method unresolvedInvokeinterfaceImplementsTest.

/**
 * <code>mid</code> is the dictionary id of an interface method we are trying to invoke
 * <code>RHStib</code> is the TIB of an object on which we are attempting to invoke it.
 *
 * We were unable to resolve the member reference at compile time.
 * Therefore we must resolve it now and then call invokeinterfaceImplementsTest
 * with the right LHSclass.
 *
 * @param mid     Dictionary id of the {@link MemberReference} for the target interface method.
 * @param rhsObject  The object on which we are attempting to invoke the interface method
 */
@Entrypoint
public static void unresolvedInvokeinterfaceImplementsTest(int mid, Object rhsObject) throws IncompatibleClassChangeError {
    RVMMethod sought = MemberReference.getMemberRef(mid).asMethodReference().resolveInterfaceMethod();
    RVMClass LHSclass = sought.getDeclaringClass();
    if (!LHSclass.isResolved()) {
        LHSclass.resolve();
    }
    /* If the object is not null, ensure that it implements the interface.
     * If it is null, then we return to our caller and let them raise the
     * null pointer exception when they attempt to get the object's TIB so
     * they can actually make the interface call.
     */
    if (rhsObject != null) {
        TIB RHStib = ObjectModel.getTIB(rhsObject);
        if (LHSclass.isInterface() && DynamicTypeCheck.instanceOfInterface(LHSclass, RHStib))
            return;
        // Raise an IncompatibleClassChangeError.
        throw new IncompatibleClassChangeError();
    }
}
Also used : TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 3 with Entrypoint

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

the class Barriers method byteFieldWrite.

/**
 * Barrier for writes of bytes into fields of instances (i.e. putfield).
 *
 * @param ref the object which is the subject of the putfield
 * @param value the new value for the field
 * @param offset the offset of the field to be modified
 * @param locationMetadata an int that encodes the source location being modified
 */
@Inline
@Entrypoint
public static void byteFieldWrite(Object ref, byte value, Offset offset, int locationMetadata) {
    if (NEEDS_BYTE_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().byteWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 4 with Entrypoint

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

the class Barriers method floatArrayRead.

/**
 * Barrier for loads of floats from fields of arrays (i.e. faload).
 *
 * @param ref the array containing the reference.
 * @param index the index into the array were the reference resides.
 * @return the value read from the array
 */
@Inline
@Entrypoint
public static float floatArrayRead(float[] ref, int index) {
    if (NEEDS_FLOAT_GC_READ_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT);
        return Selected.Mutator.get().floatRead(array, array.toAddress().plus(offset), offset.toWord(), Word.zero(), ARRAY_ELEMENT);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
    return 0;
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

Example 5 with Entrypoint

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

the class Barriers method floatArrayWrite.

/**
 * Barrier for writes of floats into arrays (i.e. fastore).
 *
 * @param ref the array which is the subject of the astore
 * @param index the index into the array where the new reference
 * resides.  The index is the "natural" index into the array, for
 * example a[index].
 * @param value the value to be stored.
 */
@Inline
@Entrypoint
public static void floatArrayWrite(float[] ref, int index, float value) {
    if (NEEDS_FLOAT_GC_WRITE_BARRIER) {
        ObjectReference array = ObjectReference.fromObject(ref);
        Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT);
        Selected.Mutator.get().floatWrite(array, array.toAddress().plus(offset), value, offset.toWord(), Word.zero(), ARRAY_ELEMENT);
    } else if (VM.VerifyAssertions)
        VM._assert(VM.NOT_REACHED);
}
Also used : ObjectReference(org.vmmagic.unboxed.ObjectReference) Offset(org.vmmagic.unboxed.Offset) Entrypoint(org.vmmagic.pragma.Entrypoint) Inline(org.vmmagic.pragma.Inline)

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