Next: Bibliography
Up: Implementation Details
Previous: Implementation Details
Here are more details on each Quad statement. First the header and
footer nodes:
- HEADER(f)
- Start node in the control flow graph with end node f.
Performs no operation. Zero predecessors, one successor.
- METHODHEADER(f, p)
- Start node in the control flow graph for
a method with parameters p and end node f. A subclass of HEADER.
The method arguments are loaded into
before execution starts.
Zero predecessors, one successor.
- FOOTER( )
- Final node in control-flow graph. Performs no operation.
All RETURN and THROW statements must have the graph's
FOOTER as their only successor. FOOTER nodes may
have any positive number of predecessors. They have no successors.
The following Quads modify the control-flow:
- PHI(t, l)
- Control flow merges at PHI nodes.
A phi node represents a list of -functions of the form
where j is the arity of the -function; that is,
the number of predecessors to the node. Any non-negative number of
predecessors, one successor.
- CJMP(t)
- Conditional jump based on the boolean t. If t is
false (0), control flows to the first successor (next[0]).
If t is true (1), control flows to the second successor
(next[1]). One predecessor, two successors.
- SWITCH(t, k)
- Indexed jump. Depending on the value of index
variable t and a key list k, control is transferred to
targetn where t = kn. If t does not match any key in k,
control is transferred to the default
targetn+1 where kn is
the last key in the key list. One predecessor, multiple successors.
- RETURN(t)
- Return an optional value t from this method.
One predecessor, one successor. The single successor should be a
FOOTER node.
- THROW(t)
- Throws an exception t as the result of this method.
One predecessor, one successor. The single successor should be a
FOOTER node.
The remaining Quads have no effect on control flow, and have
exactly one predecessor and one successor. No exceptions are thrown.
- AGET(t1, t2, t3)
- Fetches the element at index t3from array t2 and stores the value in t1.
- ALENGTH(t1, t2)
- Puts the length of array t2 into
variable t1.
- ANEW(t1, c, l)
- Creates a new uninitialized array with
type c and dimensions
,
storing a reference in
t1. The number of dimensions
supplied in list l may be smaller than the number of dimensions of
array class type c, in which case only the n dimensions specified
in l will be created.
- ASET(t1, t2, t3)
- Sets the element at index t2 of
array t1 to the value in t3.
- CALL(m, t, p, r, e)
- Calls method m of optional class
reference t with parameter list
,
putting the return value in rif no exception is thrown, or setting e to the thrown exception.
Either r or e will be null on completion of the
CALL. Exception e is not automatically thrown from the
method containing the CALL: e must be explicitly tested and
its exception rethrown if that behavior is desired. t is not needed
for static methods.
- COMPONENTOF(t1, t2, t3)
- Puts the boolean value
true (1) in t1 if object t3 is an instance of the component
type of array t2, or false (0) otherwise.
- CONST(t, c, y)
- Assigns numeric or string constant c of
type y to variable t.
- GET(t1, f, t2)
- Puts the value of field f of optional
object t2 in variable t1. t2 is not necessary for static fields.
- INSTANCEOF(t1, t2, c)
- Puts the boolean value
true (1) in t1 if object t2 is an instance of class
c, or false (0) otherwise.
- MOVE(t1, t2)
- Copies the value in t2 into t1.
- NEW(t, c)
- Create a new uninitialized instance of class c,
storing a reference in t. A class constructor must be invoked using
CALL in order to initialize the instance.
- NOP( )
- Performs no operation.
- OPER(o, t, l)
- Performs operation o on the variables in
list l, storing the result in t. The operation is represented as
a string; figure 3 lists all valid operation strings.
The operations performed by the strings are identical to the
operations performed by the Java bytecode operation of the same name,
except that no exceptions are ever thrown. See [LY96] for
details.
- SET(f, t1, t2)
- Sets field f of optional object t1 to the
value of t2. t1 is not necessary for static fields.
The harpoon.IR.QuadSSA.Code
class provides a means to access the QuadSSA form of a given method;
see the definition of superclass harpoon.ClassFile.HCode and
the example code in harpoon.Main.Main for details.
Figure 3:
Classes comprising the QuadSSA intermediate representation.
Only the constructors are shown; the object field variables correspond
exactly to the names of the constructor arguments.
|
Next: Bibliography
Up: Implementation Details
Previous: Implementation Details
C. Scott Ananian
1998-10-12