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");
}
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();
}
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;
}
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();
}
}
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);
}
Aggregations