|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.IR.Quads.Quad
harpoon.IR.Quads.SIGMA
harpoon.IR.Quads.CALL
public class CALL
CALL
objects represent method invocations.
The retval
field will be null
for void
methods. For non-static methods, the
method receiver (object reference on which to invoke the method)
is the first parameter in the params
array.
CALL
behaves like a conditional branch: if
no exception is thrown by the called method, the Temp
specified by retval
will be assigned the return
value, if any, and execution will follow the first outgoing
edge, nextEdge(0)
. If an exception is thrown
then the Temp
specified by retex
will
be assigned the non-null reference to the thrown exception
and execution will follow the second outgoing edge,
nextEdge(1)
. Calls with explicit exception
handling always have exactly two outgoing edges.
In quad-with-try form, the CALL
has only one
outgoing edge, and exceptions are handled by an implicit
control transfer to an appropriate HANDLER
quad.
The retex
field should be null
in
this case (and only in this case).
Note that exactly one of { retval
, retex
}
will be defined after the execution of CALL
; thus it is
perfectly
valid for retval
and retex
to be identical.
Of course, for type-safety the return type cannot be primitive if this
is so.
The Temp
not defined by the CALL
(if the retex
and retval
Temp
s
are different) is undefined --- that is, it may have
any value at all after the CALL
. Both
IR.LowQuad.PCALL
and IR.Tree.CALL
also
behave this way.
Field Summary | |
---|---|
protected boolean |
isTailCall
Special flag for tail calls. |
protected boolean |
isVirtual
Special flag for non-virtual methods. |
protected HMethod |
method
The method to invoke. |
protected Temp[] |
params
Parameters to pass to the method. |
protected Temp |
retex
Destination for any exception thrown by the method. |
protected Temp |
retval
Destination for the method's return value; null for void methods. |
Fields inherited from class harpoon.IR.Quads.SIGMA |
---|
dst, src |
Fields inherited from class harpoon.IR.Quads.Quad |
---|
arrayFactory |
Constructor Summary | |
---|---|
CALL(QuadFactory qf,
HCodeElement source,
HMethod method,
Temp[] params,
Temp retval,
Temp retex,
boolean isVirtual,
boolean isTailCall,
Temp[] src)
Creates a CALL with an empty dst array
of the proper size. |
|
CALL(QuadFactory qf,
HCodeElement source,
HMethod method,
Temp[] params,
Temp retval,
Temp retex,
boolean isVirtual,
boolean isTailCall,
Temp[][] dst,
Temp[] src)
Creates a CALL quad representing a method invocation
with explicit exception handling. |
Method Summary | ||
---|---|---|
|
accept(QuadValueVisitor<T> v)
|
|
void |
accept(QuadVisitor v)
Accept a visitor. |
|
Temp[] |
def()
Returns all the Temps defined by this Quad. |
|
boolean |
isInterfaceMethod()
Determines whether this CALL is to an interface method. |
|
boolean |
isStatic()
Determines whether this CALL is to a static method. |
|
boolean |
isTailCall()
Returns true if this method should return the
same value the callee returns or throw whatever
exception the callee throws (in which case we can get
rid of our stack and let the callee return directly to
our caller. |
|
boolean |
isVirtual()
Returns true if the method is dispatched virtually,
or false otherwise. |
|
int |
kind()
Return an integer enumeration of the kind of this Quad . |
|
HMethod |
method()
Returns the method invoked by this CALL . |
|
Temp[] |
params()
Returns the parameters of this method invocation. |
|
Temp |
params(int i)
Returns a specified parameter in the params array. |
|
int |
paramsLength()
Returns the number of parameters in the params array. |
|
HClass |
paramType(int i)
Returns the type of the specified parameter. |
|
Quad |
rename(QuadFactory qqf,
TempMap defMap,
TempMap useMap)
Create a new Quad identical to the receiver, but
with all Temp s renamed according to a mapping. |
|
Temp |
retex()
Returns the Temp which will get any exception thrown
by the called method, or null if exceptions are
not caught. |
|
Temp |
retval()
Returns the Temp which will hold the return value of
the method, or the value null if the method returns
no value. |
|
String |
toString()
Returns human-readable representation. |
|
Temp[] |
use()
Returns all the Temps used by this Quad. |
Methods inherited from class harpoon.IR.Quads.SIGMA |
---|
arity, assign, dst, dst, dst, numSigmas, removeSigma, src, src |
Methods inherited from class harpoon.IR.Quads.Quad |
---|
addEdge, addEdges, addHandlers, clone, clone, clone, compareTo, defC, edgeC, edges, getFactory, getID, getLineNumber, getSourceFile, handlers, hashCode, isPred, isSucc, map, map, map, next, next, nextEdge, nextEdge, nextLength, pred, predC, prev, prev, prevEdge, prevEdge, prevLength, remove, removeHandlers, rename, replace, succ, succC, toLongString, transferHandlers, useC |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final HMethod method
protected Temp[] params
protected Temp retval
null
for void
methods.
protected Temp retex
null
exceptions are thrown, not caught.
protected final boolean isVirtual
protected final boolean isTailCall
Constructor Detail |
---|
public CALL(QuadFactory qf, HCodeElement source, HMethod method, Temp[] params, Temp retval, Temp retex, boolean isVirtual, boolean isTailCall, Temp[][] dst, Temp[] src)
CALL
quad representing a method invocation
with explicit exception handling.
method
- the method to invoke.params
- an array of Temp
s containing the parameters
to pass to the method. The object on which to invoke the
method is the first element in the parameter list of a
non-static method; static methods do not need to specify a
receiver. For static methods, params
should match exactly the number and types of parameters in
the method descriptor. For non-static methods, the receiver
object (which is not included in the descriptor) is element
zero of the params
array.retval
- the destination Temp
for the method's return
value, or null
if the method returns no
value (return type is void
.retex
- the destination Temp
for any exception thrown
by the called method. If null
then this
CALL
has arity one and handles exceptions
implicitly; else it has arity two and exception handling
is explicit.isVirtual
- true
if invocation semantics are that of a
virtual method; false
for constructors,
private methods, and static initializers, which have
non-virtual invocation semantics.
Value doesn't matter for static methods; the
isVirtual()
method will always return
false
in this case.isTailCall
- true
if this method should return the same
value the callee returns or throw whatever exception the
callee throws (in which case we can get rid of our stack
and let the callee return directly to our caller.
Usually false
.dst
- the elements of the pairs on the left-hand side of
the sigma function assignment block associated with
this CALL
.src
- the arguments to the sigma functions associated with
this CALL
.public CALL(QuadFactory qf, HCodeElement source, HMethod method, Temp[] params, Temp retval, Temp retex, boolean isVirtual, boolean isTailCall, Temp[] src)
CALL
with an empty dst
array
of the proper size. Other arguments as above.
Method Detail |
---|
public HMethod method()
CALL
.
public Temp[] params()
public Temp params(int i)
params
array.
public int paramsLength()
params
array.
public HClass paramType(int i)
public Temp retval()
Temp
which will hold the return value of
the method, or the value null
if the method returns
no value.
public Temp retex()
Temp
which will get any exception thrown
by the called method, or null
if exceptions are
not caught.
public boolean isVirtual()
true
if the method is dispatched virtually,
or false
otherwise. Static methods return
false
, constructors and static initializers return
false
, and all other method types return
true
.
public boolean isTailCall()
true
if this method should return the
same value the callee returns or throw whatever
exception the callee throws (in which case we can get
rid of our stack and let the callee return directly to
our caller. Usually false
.
public Temp[] use()
use
in interface UseDefable
use
in class SIGMA
params
array.public Temp[] def()
def
in interface UseDefable
def
in class SIGMA
{ retval, retex }
.public int kind()
Quad
Quad
. The enumerated values are defined in
QuadKind
.
kind
in class Quad
public Quad rename(QuadFactory qqf, TempMap defMap, TempMap useMap)
Quad
Quad
identical to the receiver, but
with all Temp
s renamed according to a mapping.
The new Quad
will have no edges.
The new Quad
will come from the specified
QuadFactory
.
rename
in class Quad
public void accept(QuadVisitor v)
Quad
accept
in class SIGMA
public <T> T accept(QuadValueVisitor<T> v)
accept
in class SIGMA
public String toString()
toString
in class SIGMA
public boolean isInterfaceMethod()
CALL
is to an interface method.
public boolean isStatic()
CALL
is to a static method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |