Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.Quad
Class MethodSummary.BuildMethodSummary  view MethodSummary.BuildMethodSummary download MethodSummary.BuildMethodSummary.java

java.lang.Object
  extended byCompil3r.Quad.QuadVisitor.EmptyVisitor
      extended byCompil3r.Quad.MethodSummary.BuildMethodSummary
All Implemented Interfaces:
QuadVisitor
Enclosing class:
MethodSummary

public static final class MethodSummary.BuildMethodSummary
extends QuadVisitor.EmptyVisitor

Visitor class to build an intramethod summary.


Nested Class Summary
 
Nested classes inherited from class Compil3r.Quad.QuadVisitor
QuadVisitor.AllQuadVisitor, QuadVisitor.EmptyVisitor
 
Field Summary
protected  BasicBlock bb
          The current basic block.
protected  java.util.HashMap callToRVN
          Map from a method call to its ReturnValueNode.
protected  java.util.HashMap callToTEN
          Map from a method call to its ThrownExceptionNode.
protected  boolean change
          Change bit for worklist iteration.
static boolean INSIDE_EDGES
           
(package private)  java.util.HashMap jsr_states
           
protected  Clazz.jq_Method method
          The method that we are building a summary for.
protected  java.util.Set methodCalls
          The set of method calls made.
protected  MethodSummary.GlobalNode my_global
          The global node.
protected  int nLocals
          The number of locals and number of registers.
protected  int nRegisters
          The number of locals and number of registers.
protected  MethodSummary.ParamNode[] param_nodes
          The parameter nodes.
protected  java.util.Set passedAsParameter
          The set of nodes that were ever passed as a parameter, or returned/thrown from a call site.
protected  java.util.HashMap quadsToNodes
          Factory for nodes.
protected  java.util.Set returned
          The set of returned and thrown nodes.
protected  MethodSummary.State s
          The current state.
protected  MethodSummary.State[] start_states
          The start states of the iteration.
protected  java.util.Set thrown
          The set of returned and thrown nodes.
 
Constructor Summary
MethodSummary.BuildMethodSummary(ControlFlowGraph cfg)
          Build a summary for the given method.
 
Method Summary
(package private) static void addToSet(java.util.Set s, java.lang.Object o)
           
protected  java.lang.Object getRegister(RegisterFactory.Register r)
          Get the node or set of nodes in the given register in the current state.
 MethodSummary getSummary()
          Returns the summary.
protected  void heapLoad(Quad obj, RegisterFactory.Register dest_r, MethodSummary.Node base_n, Clazz.jq_Field f)
          Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, base and field.
protected  void heapLoad(Quad obj, RegisterFactory.Register dest_r, RegisterFactory.Register base_r, Clazz.jq_Field f)
          Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, base register and field.
protected  void heapLoad(Quad obj, RegisterFactory.Register dest_r, java.util.Set base_s, Clazz.jq_Field f)
          Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, bases and field.
protected  void heapLoad(java.util.Set result, MethodSummary.Node base, Clazz.jq_Field f, MethodSummary.FieldNode fn)
          Abstractly perform a heap load operation on the given base and field with the given field node, putting the result in the given set.
protected  void heapStore(MethodSummary.Node base, MethodSummary.Node src, Clazz.jq_Field f, Quad q)
          Abstractly perform a heap store operation of the given source node on the given base node and field.
protected  void heapStore(MethodSummary.Node base, RegisterFactory.Register src_r, Clazz.jq_Field f, Quad q)
          Abstractly perform a heap store operation of the nodes in the given register on the given base node and field.
protected  void heapStore(MethodSummary.Node base, java.util.Set src, Clazz.jq_Field f, Quad q)
          Abstractly perform a heap store operation of the given source nodes on the given base node and field.
protected  void heapStore(RegisterFactory.Register base_r, MethodSummary.Node src_n, Clazz.jq_Field f, Quad q)
          Abstractly perform a heap store operation of the given source node on the nodes in the given register in the current state and the given field.
protected  void heapStore(RegisterFactory.Register base_r, RegisterFactory.Register src_r, Clazz.jq_Field f, Quad q)
          Abstractly perform a heap store operation of the nodes in the given register on the nodes in the given register in the current state and the given field.
protected  void mergeWith(BasicBlock succ)
          Merge the current state into the start state for the given basic block.
protected  void mergeWith(ExceptionHandler eh)
          Merge the current state into the start state for the given basic block.
protected  void mergeWithJSR(BasicBlock succ, MethodSummary.State s2, boolean[] changedLocals)
           
(package private)  void passParameter(RegisterFactory.Register r, ProgramLocation m, int p)
          Record that the nodes in the given register were passed to the given method call as the given parameter.
(package private) static void setAsEscapes(java.lang.Object o)
           
protected  void setLocal(int i, MethodSummary.Node n)
          Set the given local in the current state to point to the given node.
protected  void setRegister(RegisterFactory.Register r, MethodSummary.Node n)
          Set the given register in the current state to point to the given node.
protected  void setRegister(RegisterFactory.Register r, java.lang.Object n)
          Set the given register in the current state to point to the given node or set of nodes.
 void visitALoad(Quad obj)
          Visit an array load instruction.
 void visitAStore(Quad obj)
          Visit an array store instruction.
 void visitBinary(Quad obj)
          A binary operation instruction.
 void visitCheckCast(Quad obj)
          Visit a type cast check instruction.
 void visitExceptionThrower(Quad obj)
          A potentially excepting instruction..
 void visitGetfield(Quad obj)
          Visit a get instance field instruction.
 void visitGetstatic(Quad obj)
          Visit a get static field instruction.
 void visitInstanceOf(Quad obj)
          Visit a type instance of instruction.
 void visitInvoke(Quad obj)
          Visit an invoke instruction.
 void visitJsr(Quad obj)
          A jump local subroutine instruction.
 void visitMove(Quad obj)
          Visit a register move instruction.
 void visitNew(Quad obj)
          Visit an object allocation instruction.
 void visitNewArray(Quad obj)
          Visit an array allocation instruction.
 void visitPutfield(Quad obj)
          Visit a put instance field instruction.
 void visitPutstatic(Quad obj)
          Visit a put static field instruction.
 void visitReturn(Quad obj)
          Visit a return/throw instruction.
 void visitSpecial(Quad obj)
          A special instruction.
 void visitUnary(Quad obj)
          A unary operation instruction.
 
Methods inherited from class Compil3r.Quad.QuadVisitor.EmptyVisitor
visitALength, visitAllocation, visitArray, visitBoundsCheck, visitBranch, visitCheck, visitCondBranch, visitGoto, visitInstanceField, visitIntIfCmp, visitLoad, visitLookupSwitch, visitMemLoad, visitMemStore, visitMonitor, visitNullCheck, visitQuad, visitRet, visitStaticField, visitStore, visitStoreCheck, visitTableSwitch, visitTypeCheck, visitZeroCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

method

protected final Clazz.jq_Method method
The method that we are building a summary for.


nLocals

protected final int nLocals
The number of locals and number of registers.


nRegisters

protected final int nRegisters
The number of locals and number of registers.


param_nodes

protected final MethodSummary.ParamNode[] param_nodes
The parameter nodes.


my_global

protected final MethodSummary.GlobalNode my_global
The global node.


start_states

protected final MethodSummary.State[] start_states
The start states of the iteration.


returned

protected final java.util.Set returned
The set of returned and thrown nodes.


thrown

protected final java.util.Set thrown
The set of returned and thrown nodes.


methodCalls

protected final java.util.Set methodCalls
The set of method calls made.


callToRVN

protected final java.util.HashMap callToRVN
Map from a method call to its ReturnValueNode.


callToTEN

protected final java.util.HashMap callToTEN
Map from a method call to its ThrownExceptionNode.


passedAsParameter

protected final java.util.Set passedAsParameter
The set of nodes that were ever passed as a parameter, or returned/thrown from a call site.


bb

protected BasicBlock bb
The current basic block.


s

protected MethodSummary.State s
The current state.


change

protected boolean change
Change bit for worklist iteration.


quadsToNodes

protected final java.util.HashMap quadsToNodes
Factory for nodes.


INSIDE_EDGES

public static final boolean INSIDE_EDGES
See Also:
Constant Field Values

jsr_states

java.util.HashMap jsr_states
Constructor Detail

MethodSummary.BuildMethodSummary

public MethodSummary.BuildMethodSummary(ControlFlowGraph cfg)
Build a summary for the given method.

Method Detail

getSummary

public MethodSummary getSummary()
Returns the summary. Call this after iteration has completed.


setLocal

protected void setLocal(int i,
                        MethodSummary.Node n)
Set the given local in the current state to point to the given node.


setRegister

protected void setRegister(RegisterFactory.Register r,
                           MethodSummary.Node n)
Set the given register in the current state to point to the given node.


setRegister

protected void setRegister(RegisterFactory.Register r,
                           java.lang.Object n)
Set the given register in the current state to point to the given node or set of nodes.


getRegister

protected java.lang.Object getRegister(RegisterFactory.Register r)
Get the node or set of nodes in the given register in the current state.


mergeWith

protected void mergeWith(BasicBlock succ)
Merge the current state into the start state for the given basic block. If that start state is uninitialized, it is initialized with a copy of the current state. This updates the change flag if anything is changed.


mergeWithJSR

protected void mergeWithJSR(BasicBlock succ,
                            MethodSummary.State s2,
                            boolean[] changedLocals)

mergeWith

protected void mergeWith(ExceptionHandler eh)
Merge the current state into the start state for the given basic block. If that start state is uninitialized, it is initialized with a copy of the current state. This updates the change flag if anything is changed.


heapLoad

protected void heapLoad(java.util.Set result,
                        MethodSummary.Node base,
                        Clazz.jq_Field f,
                        MethodSummary.FieldNode fn)
Abstractly perform a heap load operation on the given base and field with the given field node, putting the result in the given set.


heapLoad

protected void heapLoad(Quad obj,
                        RegisterFactory.Register dest_r,
                        java.util.Set base_s,
                        Clazz.jq_Field f)
Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, bases and field. The destination register in the current state is changed to the result.


heapLoad

protected void heapLoad(Quad obj,
                        RegisterFactory.Register dest_r,
                        MethodSummary.Node base_n,
                        Clazz.jq_Field f)
Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, base and field. The destination register in the current state is changed to the result.


heapLoad

protected void heapLoad(Quad obj,
                        RegisterFactory.Register dest_r,
                        RegisterFactory.Register base_r,
                        Clazz.jq_Field f)
Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, base register and field. The destination register in the current state is changed to the result.


heapStore

protected void heapStore(MethodSummary.Node base,
                         MethodSummary.Node src,
                         Clazz.jq_Field f,
                         Quad q)
Abstractly perform a heap store operation of the given source node on the given base node and field.


heapStore

protected void heapStore(MethodSummary.Node base,
                         java.util.Set src,
                         Clazz.jq_Field f,
                         Quad q)
Abstractly perform a heap store operation of the given source nodes on the given base node and field.


heapStore

protected void heapStore(RegisterFactory.Register base_r,
                         MethodSummary.Node src_n,
                         Clazz.jq_Field f,
                         Quad q)
Abstractly perform a heap store operation of the given source node on the nodes in the given register in the current state and the given field.


heapStore

protected void heapStore(MethodSummary.Node base,
                         RegisterFactory.Register src_r,
                         Clazz.jq_Field f,
                         Quad q)
Abstractly perform a heap store operation of the nodes in the given register on the given base node and field.


heapStore

protected void heapStore(RegisterFactory.Register base_r,
                         RegisterFactory.Register src_r,
                         Clazz.jq_Field f,
                         Quad q)
Abstractly perform a heap store operation of the nodes in the given register on the nodes in the given register in the current state and the given field.


passParameter

void passParameter(RegisterFactory.Register r,
                   ProgramLocation m,
                   int p)
Record that the nodes in the given register were passed to the given method call as the given parameter.


visitALoad

public void visitALoad(Quad obj)
Visit an array load instruction.

Specified by:
visitALoad in interface QuadVisitor
Overrides:
visitALoad in class QuadVisitor.EmptyVisitor

visitAStore

public void visitAStore(Quad obj)
Visit an array store instruction.

Specified by:
visitAStore in interface QuadVisitor
Overrides:
visitAStore in class QuadVisitor.EmptyVisitor

visitBinary

public void visitBinary(Quad obj)
Description copied from class: QuadVisitor.EmptyVisitor
A binary operation instruction.

Specified by:
visitBinary in interface QuadVisitor
Overrides:
visitBinary in class QuadVisitor.EmptyVisitor

visitCheckCast

public void visitCheckCast(Quad obj)
Visit a type cast check instruction.

Specified by:
visitCheckCast in interface QuadVisitor
Overrides:
visitCheckCast in class QuadVisitor.EmptyVisitor

visitGetfield

public void visitGetfield(Quad obj)
Visit a get instance field instruction.

Specified by:
visitGetfield in interface QuadVisitor
Overrides:
visitGetfield in class QuadVisitor.EmptyVisitor

visitGetstatic

public void visitGetstatic(Quad obj)
Visit a get static field instruction.

Specified by:
visitGetstatic in interface QuadVisitor
Overrides:
visitGetstatic in class QuadVisitor.EmptyVisitor

visitInstanceOf

public void visitInstanceOf(Quad obj)
Visit a type instance of instruction.

Specified by:
visitInstanceOf in interface QuadVisitor
Overrides:
visitInstanceOf in class QuadVisitor.EmptyVisitor

visitInvoke

public void visitInvoke(Quad obj)
Visit an invoke instruction.

Specified by:
visitInvoke in interface QuadVisitor
Overrides:
visitInvoke in class QuadVisitor.EmptyVisitor

visitJsr

public void visitJsr(Quad obj)
Description copied from class: QuadVisitor.EmptyVisitor
A jump local subroutine instruction.

Specified by:
visitJsr in interface QuadVisitor
Overrides:
visitJsr in class QuadVisitor.EmptyVisitor

visitMove

public void visitMove(Quad obj)
Visit a register move instruction.

Specified by:
visitMove in interface QuadVisitor
Overrides:
visitMove in class QuadVisitor.EmptyVisitor

visitNew

public void visitNew(Quad obj)
Visit an object allocation instruction.

Specified by:
visitNew in interface QuadVisitor
Overrides:
visitNew in class QuadVisitor.EmptyVisitor

visitNewArray

public void visitNewArray(Quad obj)
Visit an array allocation instruction.

Specified by:
visitNewArray in interface QuadVisitor
Overrides:
visitNewArray in class QuadVisitor.EmptyVisitor

visitPutfield

public void visitPutfield(Quad obj)
Visit a put instance field instruction.

Specified by:
visitPutfield in interface QuadVisitor
Overrides:
visitPutfield in class QuadVisitor.EmptyVisitor

visitPutstatic

public void visitPutstatic(Quad obj)
Visit a put static field instruction.

Specified by:
visitPutstatic in interface QuadVisitor
Overrides:
visitPutstatic in class QuadVisitor.EmptyVisitor

addToSet

static void addToSet(java.util.Set s,
                     java.lang.Object o)

visitReturn

public void visitReturn(Quad obj)
Visit a return/throw instruction.

Specified by:
visitReturn in interface QuadVisitor
Overrides:
visitReturn in class QuadVisitor.EmptyVisitor

setAsEscapes

static void setAsEscapes(java.lang.Object o)

visitSpecial

public void visitSpecial(Quad obj)
Description copied from class: QuadVisitor.EmptyVisitor
A special instruction.

Specified by:
visitSpecial in interface QuadVisitor
Overrides:
visitSpecial in class QuadVisitor.EmptyVisitor

visitUnary

public void visitUnary(Quad obj)
Description copied from class: QuadVisitor.EmptyVisitor
A unary operation instruction.

Specified by:
visitUnary in interface QuadVisitor
Overrides:
visitUnary in class QuadVisitor.EmptyVisitor

visitExceptionThrower

public void visitExceptionThrower(Quad obj)
Description copied from class: QuadVisitor.EmptyVisitor
A potentially excepting instruction..

Specified by:
visitExceptionThrower in interface QuadVisitor
Overrides:
visitExceptionThrower in class QuadVisitor.EmptyVisitor