|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.mjc.CMember
org.multijava.mjc.CMethod
org.multijava.mjc.CSourceMethod
org.multijava.mjc.CSourceDispatcherMethod
This class represents a dispatcher method wrapping a set of multimethods of the same generic function as read from a source file.
| Field Summary | |
protected CSourceDispatcherClass |
dispatcherClass
If this a method of an external generic function, then this field represents the dispatcher inner class for this method. |
private boolean |
isInBaseAnchorClass
|
private boolean |
isTopDispatcherInLattice
|
private CSourceMethod[] |
multimethods
|
private static DirectedAcyclicGraph.EdgeCalculator |
OVERRIDES_RELATION
|
private TokenReference |
where
|
| Fields inherited from class org.multijava.mjc.CSourceMethod |
|
| Fields inherited from class org.multijava.mjc.CMethod |
declarationContext, generatefrom, needsPrivacyModifierRemoved, specArgs, synthetic, topConcreteMethod |
| Fields inherited from class org.multijava.mjc.CMember |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
CSourceDispatcherMethod(TokenReference where,
Main compiler,
CSourceClass outer,
CMethod topConcreteMethod,
CSourceMethod[] multimethods,
int gfID)
Constructs a dispatcher method for the given set of multimethods. |
|
| Method Summary | |
CAmbiguousDispatcherClass |
ambiguousDispatcherClass()
Returns the ambiguous-method dispatcher class for this. |
CClass |
anchorClass()
Returns the $anchor class for this generic function. |
protected Object |
clone()
|
protected CSourceDispatcherClass |
dispatcherClass()
Returns the dispatcher class for this. |
CDispatcherSignature |
dispatcherSignature()
Returns the $signature class for this. |
protected CMethodSet |
filteredDispatchers()
Returns the filtered dispatcher methods for the external generic function whose top dispatcher is this. |
int |
functionNumber()
Returns the function field number for this generic function within its $anchor class. |
GenericFunctionInfo |
genGenericFunctionInfo()
Generates the generic function information for this required when generating a class file, or returns null if this method requires no such information. |
ArrayList |
genMethodInfo()
Returns a list of CMethodInfo instances, one for
this dispatcher and one for each multimethod body referenced by
this. |
RMJAnnotation.Method[] |
getMethodAnnotations(String kind,
String baseAnchorClassName,
String dispatcherClassName,
String ambigErrorClassName)
|
boolean |
isTopDispatcherInLattice()
Indicates whether this dispatcher method is the top dispatcher method in the generic function lattice. |
protected void |
plantBodyBytecode(CodeSequence code)
Plants the bytecode for a dispatcher method that dynamically selects the appropriate multimethod body from the set represented by this. |
protected void |
plantFilteredDispatcherBody(CodeSequence code,
CClass receiverSubclass)
Plants the bytecode for a dispatcher method that dynamically selects the appropriate multimethod body from the set represented by this, but filtered so that only multimethods whose receiver type is a proper supertype of receiverSubclass
will be dispatched to. |
void |
plantFunctionRef(CodeSequence code)
Generates bytecode to put a reference to the external function field for the external generic function
on the JVM stack. |
private void |
plantNoMethodThrow(CodeSequence code)
Plant instructions for throwing a NoSuchMethodException onto the given code sequence. |
void |
plantOldFunctionRef(CodeSequence code,
boolean forSuper,
boolean fromOuter)
Generates bytecode to put a reference to the oldFunction field for the external generic function
on the JVM stack. |
protected void |
setOwner(CClass owner)
Sets the owner of this member. |
protected void |
swallowReceiver()
Swallow the receiver, which is passed as the first argument to an external generic function. |
String |
toString()
Returns a string representation of this grouped multimethod. |
| Methods inherited from class org.multijava.mjc.CMember |
access, addModifiers, deprecated, getCClass, getCCompilationUnit, getField, getIdent, getJavaName, getOwnerName, getQualNameWithSeparator, hasDefaultAccess, hasProtectedVisibilityIn, host, ident, isAccessibleFrom, isDeclaredNonNull, isDeprecated, isFinal, isLocalTo, isPrivate, isProtected, isPublic, isStatic, modifiers, owner, qualifiedName, setModifiers |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private final CSourceMethod[] multimethods
private TokenReference where
private boolean isTopDispatcherInLattice
private boolean isInBaseAnchorClass
protected CSourceDispatcherClass dispatcherClass
null.
private static final DirectedAcyclicGraph.EdgeCalculator OVERRIDES_RELATION
| Constructor Detail |
public CSourceDispatcherMethod(TokenReference where,
Main compiler,
CSourceClass outer,
CMethod topConcreteMethod,
CSourceMethod[] multimethods,
int gfID)
requires multimethods != null && multimethods.length > 0;
where - a reference to the source code for annotating bytecodeouter - the class that hosts this dispatcher, either the
declaring class for internal methods or the anchor
class for external methodstopConcreteMethod - the top concrete method of the generic functionmultimethods - the collection of multimethods for which this
this will dispatchgfID - the unique ID of this dispatcher's associated gf,
used to give its $body methods a unique name| Method Detail |
protected void setOwner(CClass owner)
#ownerpublic boolean isTopDispatcherInLattice()
protected void swallowReceiver()
CMethodrequires topConcreteMethod != null && topConcreteMethod.isExternal(); assignable parameters; ensures parameters.length == \old(parameters).length + 1; ensures parameters[0].staticType() == topConcreteMethod.receiverType(); ensures parameters[0].dynamicType() == this.receiverType();
swallowReceiver in class CMethodpublic String toString()
toString in class CSourceMethodprotected CSourceDispatcherClass dispatcherClass()
requires dispatcherClass != null; requires_redundantly topConcreteMethod.isExternal();
public CDispatcherSignature dispatcherSignature()
also requires dispatcherClass != null; requires_redundantly topConcreteMethod.isExternal();
dispatcherSignature in class CSourceMethodpublic CAmbiguousDispatcherClass ambiguousDispatcherClass()
also requires dispatcherClass != null; requires_redundantly topConcreteMethod.isExternal();
ambiguousDispatcherClass in class CSourceMethodpublic CClass anchorClass()
also requires dispatcherClass != null; requires_redundantly topConcreteMethod.isExternal();
anchorClass in class CSourceMethodpublic int functionNumber()
also requires dispatcherClass != null; requires_redundantly topConcreteMethod.isExternal();
functionNumber in class CSourceMethodprotected CMethodSet filteredDispatchers()
also requires topConcreteMethod instanceof CSourceMethod && (\exists int i; i <= 0 && i < multimethods.length; multimethods[i] == topConcreteMethod);
filteredDispatchers in class CSourceMethodpublic ArrayList genMethodInfo()
CMethodInfo instances, one for
this dispatcher and one for each multimethod body referenced by
this.
genMethodInfo in class CSourceMethod
public RMJAnnotation.Method[] getMethodAnnotations(String kind,
String baseAnchorClassName,
String dispatcherClassName,
String ambigErrorClassName)
public GenericFunctionInfo genGenericFunctionInfo()
genGenericFunctionInfo in class CSourceMethodpublic void plantFunctionRef(CodeSequence code)
function field for the external generic function
on the JVM stack.
also requires isTopDispatcherInLattice();
plantFunctionRef in class CSourceMethod
public void plantOldFunctionRef(CodeSequence code,
boolean forSuper,
boolean fromOuter)
oldFunction field for the external generic function
on the JVM stack.
also requires this.isExternal();
plantOldFunctionRef in class CSourceMethodcode - the code sequence to add the bytecode toforSuper - if true, then this is for a super send, which,
under RMJ, should start from the oldSuperFunction
rather than oldFunctionfromOuter - if true, then generates a reference that works from the
outer class context, otherwise generates a reference that
works from within the dispatcher classprotected Object clone()
clone in class Objectprotected void plantBodyBytecode(CodeSequence code)
plantBodyBytecode in class CSourceMethod
protected void plantFilteredDispatcherBody(CodeSequence code,
CClass receiverSubclass)
receiverSubclass
will be dispatched to. receiverSubclass may be null
in which case no filtering is done.
private void plantNoMethodThrow(CodeSequence code)
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||