public class InterfaceInvocation extends Object
We support two mechanisms:
IMT-based (Alpern, Cocchi, Fink, Grove, and Lieber OOPSLA'01). ITable-based (searched at dispatch time with 1 entry move-to-front cache)
Modifier and Type | Class and Description |
---|---|
private static class |
InterfaceInvocation.IMTDict |
Constructor and Description |
---|
InterfaceInvocation() |
Modifier and Type | Method and Description |
---|---|
private static InterfaceInvocation.IMTDict |
buildIMTDict(RVMClass klass,
RVMClass[] interfaces)
Build up a description of the IMT contents for the given class.
|
private static ITable |
buildITable(RVMClass C,
RVMClass I) |
static ITable |
findITable(TIB tib,
int id)
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.
|
static int |
getITableIndex(RVMClass klass,
Atom mname,
Atom mdesc) |
static void |
initializeDispatchStructures(RVMClass klass)
Main entrypoint called from RVMClass.instantiate to
initialize the interface dispatching data structures for
the given class.
|
private static void |
installITable(RVMClass C,
RVMClass I) |
static CodeArray |
invokeInterface(Object target,
int mid)
Resolve an interface method call.
|
private static void |
populateIMT(RVMClass klass,
InterfaceInvocation.IMTDict d) |
static void |
unresolvedInvokeinterfaceImplementsTest(int mid,
Object rhsObject)
mid is the dictionary id of an interface method we are trying to invoke
RHStib is the TIB of an object on which we are attempting to invoke it. |
static void |
updateTIBEntry(RVMClass klass,
RVMMethod m)
If there is an an IMT or ITable entry that contains
compiled code for the argument method, then update it to
contain the current compiled code for the method.
|
public InterfaceInvocation()
public static CodeArray invokeInterface(Object target, int mid) throws IncompatibleClassChangeError
target
- object to which interface method is to be appliedmid
- id of the MemberReference for the target interface method.IncompatibleClassChangeError
public static ITable findITable(TIB tib, int id) throws IncompatibleClassChangeError
tib
- the TIB for the classid
- interface id of the interface sought (NOT dictionary id!!)IncompatibleClassChangeError
public static void unresolvedInvokeinterfaceImplementsTest(int mid, Object rhsObject) throws IncompatibleClassChangeError
mid
is the dictionary id of an interface method we are trying to invoke
RHStib
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.mid
- Dictionary id of the MemberReference
for the target interface method.rhsObject
- The object on which we are attempting to invoke the interface methodIncompatibleClassChangeError
public static void initializeDispatchStructures(RVMClass klass)
klass
- the RVMClass to initialize the dispatch structures for.private static InterfaceInvocation.IMTDict buildIMTDict(RVMClass klass, RVMClass[] interfaces)
klass
- the RVMClass whose IMT we are going to build.interfaces
- the interfaces that the class implementsprivate static void populateIMT(RVMClass klass, InterfaceInvocation.IMTDict d)
private static void installITable(RVMClass C, RVMClass I)
private static ITable buildITable(RVMClass C, RVMClass I)
public static int getITableIndex(RVMClass klass, Atom mname, Atom mdesc)
klass
- the interface classmname
- method namemdesc
- method descriptorpublic static void updateTIBEntry(RVMClass klass, RVMMethod m)
klass
- the RVMClass who's IMT/ITable is being resetm
- the method that needs to be updated.