Search in sources :

Example 51 with Entrypoint

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

the class DynamicLinker method sysCallMethod.

/**
 * Report a magic SysCall has been mistakenly invoked
 */
@Entrypoint
static void sysCallMethod() {
    DynamicLink dl = DL_Helper.resolveDynamicInvocation();
    RVMMethod targMethod = DL_Helper.resolveMethodRef(dl);
    throw new UnsatisfiedLinkError(targMethod.toString() + " which is a SysCall");
}
Also used : RVMMethod(org.jikesrvm.classloader.RVMMethod) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 52 with Entrypoint

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

the class RVMClass method getClassLoaderFromStackFrame.

// --------------------------------------------------------------------//
// Miscellaneous queries.                         //
// ---------------------------------------------------------------------//
/**
 * Support for user-written class loaders:
 * It's required to find the classloader of the class
 * whose method requires another class to be loaded;
 * the initiating loader of the required class is the
 * defining loader of the requiring class.
 *
 * @param skip specifies the number of frames back from the
 *             caller to the method whose class's loader is required
 *
 * @return the class loader
 */
@Entrypoint
public static ClassLoader getClassLoaderFromStackFrame(int skip) {
    // account for stack frame of this function
    skip++;
    StackBrowser browser = new StackBrowser();
    VM.disableGC();
    browser.init();
    while (skip-- > 0) browser.up();
    VM.enableGC();
    return browser.getClassLoader();
}
Also used : StackBrowser(org.jikesrvm.runtime.StackBrowser) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 53 with Entrypoint

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

the class InterfaceInvocation method findITable.

/**
 * Return a reference to the itable for a given class, interface pair
 * We might not have created the iTable yet, in which case we will do that and then return it.
 *
 * @param tib the TIB for the class
 * @param id interface id of the interface sought (NOT dictionary id!!)
 * @return iTable for desired interface
 */
@Entrypoint
public static ITable findITable(TIB tib, int id) throws IncompatibleClassChangeError {
    ITableArray iTables = tib.getITableArray();
    // Search for the right ITable
    RVMType I = RVMClass.getInterface(id);
    if (iTables != null) {
        // check the cache at slot 0
        ITable iTable = iTables.get(0);
        if (iTable.isFor(I)) {
            // cache hit :)
            return iTable;
        }
        // Have to search the 'real' entries for the iTable
        for (int i = 1; i < iTables.length(); i++) {
            iTable = iTables.get(i);
            if (iTable.isFor(I)) {
                // found it; update cache
                iTables.set(0, iTable);
                return iTable;
            }
        }
    }
    // Didn't find the itable, so we don't yet know if
    // the class implements the interface. :(((
    // Therefore, we need to establish that and then
    // look for the iTable again.
    RVMClass C = (RVMClass) tib.getType();
    if (!RuntimeEntrypoints.isAssignableWith(I, C))
        throw new IncompatibleClassChangeError();
    synchronized (C) {
        installITable(C, (RVMClass) I);
    }
    ITable iTable = findITable(tib, id);
    if (VM.VerifyAssertions)
        VM._assert(iTable != null);
    return iTable;
}
Also used : ITableArray(org.jikesrvm.objectmodel.ITableArray) ITable(org.jikesrvm.objectmodel.ITable) Entrypoint(org.vmmagic.pragma.Entrypoint) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 54 with Entrypoint

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

the class InterfaceInvocation method invokeInterface.

/*
   * PART I: runtime routines to implement the invokeinterface bytecode.
   *         these routines are called from the generated code
   *         as part of the interface invocation sequence.
   */
/**
 * Resolve an interface method call.
 * This routine is never called by the IMT-based dispatching code.
 * It is only called for directly indexed ITables when the table
 * index was unknown at compile time (i.e. the target Interface was not loaded).
 *
 * @param target object to which interface method is to be applied
 * @param mid id of the MemberReference for the target interface method.
 * @return machine code corresponding to desired interface method
 */
@Entrypoint
public static CodeArray invokeInterface(Object target, int mid) throws IncompatibleClassChangeError {
    MethodReference mref = MemberReference.getMemberRef(mid).asMethodReference();
    RVMMethod sought = mref.resolveInterfaceMethod();
    RVMClass I = sought.getDeclaringClass();
    RVMClass C = Magic.getObjectType(target).asClass();
    if (VM.BuildForITableInterfaceInvocation) {
        TIB tib = C.getTypeInformationBlock();
        ITable iTable = findITable(tib, I.getInterfaceId());
        return iTable.getCode(getITableIndex(I, mref.getName(), mref.getDescriptor()));
    } else {
        if (!RuntimeEntrypoints.isAssignableWith(I, C))
            throw new IncompatibleClassChangeError();
        RVMMethod found = C.findVirtualMethod(sought.getName(), sought.getDescriptor());
        if (found == null)
            throw new IncompatibleClassChangeError();
        return found.getCurrentEntryCodeArray();
    }
}
Also used : ITable(org.jikesrvm.objectmodel.ITable) TIB(org.jikesrvm.objectmodel.TIB) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 55 with Entrypoint

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

the class Barriers method booleanFieldWrite.

/**
 * Barrier for writes of booleans 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 booleanFieldWrite(Object ref, boolean value, Offset offset, int locationMetadata) {
    if (NEEDS_BOOLEAN_GC_WRITE_BARRIER) {
        ObjectReference src = ObjectReference.fromObject(ref);
        Selected.Mutator.get().booleanWrite(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)

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