joeq.Compiler.Analysis.FlowInsensitive
Class MethodSummary.BuildMethodSummary

java.lang.Object
  extended by joeq.Compiler.Quad.QuadVisitor.EmptyVisitor
      extended by joeq.Compiler.Analysis.FlowInsensitive.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/interfaces inherited from interface joeq.Compiler.Quad.QuadVisitor
QuadVisitor.AllQuadVisitor, QuadVisitor.EmptyVisitor
 
Field Summary
protected  BasicBlock bb
          The current basic block.
protected  HashMap callToRVN
          Map from a method call to its ReturnValueNode.
protected  HashMap callToTEN
          Map from a method call to its ThrownExceptionNode.
protected  LinkedHashMap castMap
          Map from a (Node,Quad) pair to the node it's cast to.
protected  LinkedHashSet castPredecessors
          Set of nodes that lead to a cast.
protected  boolean change
          Change bit for worklist iteration.
static boolean INSIDE_EDGES
           
protected  jq_Method method
          The method that we are building a summary for.
protected  Set methodCalls
          The set of method calls made.
protected  MethodSummary.GlobalNode my_global
          The global node.
protected  HashMap nodeCache
          Factory for nodes.
protected  MethodSummary.ParamNode[] param_nodes
          The parameter nodes.
protected  Set passedAsParameter
          The set of nodes that were ever passed as a parameter, or returned/thrown from a call site.
static boolean PATCH_UP_FAKE
           
protected  Set returned
          The set of returned and thrown nodes.
protected  RegisterFactory rf
          The register factory.
protected  MethodSummary.State s
          The current state.
protected  MethodSummary.State[] start_states
          The start states of the iteration.
protected  Map sync_ops
          Map from sync ops to their nodes.
protected  Set thrown
          The set of returned and thrown nodes.
 
Constructor Summary
MethodSummary.BuildMethodSummary(ControlFlowGraph cfg)
          Build a summary for the given method.
 
Method Summary
 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(ProgramLocation obj, RegisterFactory.Register dest_r, MethodSummary.Node base_n, jq_Field f)
          Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, base and field.
protected  void heapLoad(ProgramLocation obj, RegisterFactory.Register dest_r, RegisterFactory.Register base_r, 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(ProgramLocation obj, RegisterFactory.Register dest_r, Set base_s, jq_Field f)
          Abstractly perform a heap load operation corresponding to quad 'obj' with the given destination register, bases and field.
protected  void heapLoad(Set result, MethodSummary.Node base, 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, jq_Field f)
          Abstractly perform a heap store operation of the given source node on the given base node and field.
protected  void heapStore(MethodSummary.Node base, Object src, jq_Field f)
           
protected  void heapStore(MethodSummary.Node base, Set src, jq_Field f)
          Abstractly perform a heap store operation of the given source nodes on the given base node and field.
protected  void heapStore(Object base, Object src, jq_Field f)
          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 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)
           
protected  void monitorOp(Quad q, RegisterFactory.Register r)
           
protected  void monitorOp(Quad q, Set s)
           
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, Object n)
          Set the given register in the current state to point to the given node or set of nodes.
 void updateLocation(BasicBlock bb, Quad q)
          Calculate the register set up to a given point.
 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 visitMonitor(Quad obj)
          Visit a register move 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 visitPhi(Quad obj)
          A phi 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 joeq.Compiler.Quad.QuadVisitor.EmptyVisitor
visitALength, visitAllocation, visitArray, visitBoundsCheck, visitBranch, visitCheck, visitCondBranch, visitGoto, visitInstanceField, visitIntIfCmp, visitLoad, visitLookupSwitch, visitMemLoad, visitMemStore, 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 jq_Method method
The method that we are building a summary for.


rf

protected final RegisterFactory rf
The register factory.


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 Set returned
The set of returned and thrown nodes.


thrown

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


methodCalls

protected final Set methodCalls
The set of method calls made.


callToRVN

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


callToTEN

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


castMap

protected final LinkedHashMap castMap
Map from a (Node,Quad) pair to the node it's cast to.


castPredecessors

protected final LinkedHashSet castPredecessors
Set of nodes that lead to a cast.


passedAsParameter

protected final 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.


sync_ops

protected final Map sync_ops
Map from sync ops to their nodes.


nodeCache

protected final HashMap nodeCache
Factory for nodes.


INSIDE_EDGES

public static final boolean INSIDE_EDGES
See Also:
Constant Field Values

PATCH_UP_FAKE

public static boolean PATCH_UP_FAKE
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,
                           Object n)
Set the given register in the current state to point to the given node or set of nodes.


getRegister

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


updateLocation

public void updateLocation(BasicBlock bb,
                           Quad q)
Calculate the register set up to a given point.


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(Set result,
                        MethodSummary.Node base,
                        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(ProgramLocation obj,
                        RegisterFactory.Register dest_r,
                        Set base_s,
                        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(ProgramLocation obj,
                        RegisterFactory.Register dest_r,
                        MethodSummary.Node base_n,
                        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(ProgramLocation obj,
                        RegisterFactory.Register dest_r,
                        RegisterFactory.Register base_r,
                        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,
                         jq_Field f)
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,
                         Set src,
                         jq_Field f)
Abstractly perform a heap store operation of the given source nodes on the given base node and field.


heapStore

protected void heapStore(MethodSummary.Node base,
                         Object src,
                         jq_Field f)

heapStore

protected void heapStore(Object base,
                         Object src,
                         jq_Field f)
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.


monitorOp

protected void monitorOp(Quad q,
                         RegisterFactory.Register r)

monitorOp

protected void monitorOp(Quad q,
                         Set s)

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
See Also:
QuadVisitor.visitJsr(joeq.Compiler.Quad.Quad)

visitMonitor

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

Specified by:
visitMonitor in interface QuadVisitor
Overrides:
visitMonitor 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

visitPhi

public void visitPhi(Quad obj)
Description copied from class: QuadVisitor.EmptyVisitor
A phi instruction. (For SSA.)

Specified by:
visitPhi in interface QuadVisitor
Overrides:
visitPhi 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

visitReturn

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

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

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


Copyright © 2001-2008 John Whaley. All Rights Reserved.