abc.weaving.residues
Class Residue

java.lang.Object
  extended by abc.weaving.residues.Residue
Direct Known Subclasses:
AlwaysMatch, AndResidue, AspectOf, AssertResidue, Bind, BindMaskResidue, Box, CflowResidue, CheckType, Copy, HasAspect, IfResidue, IsNull, Load, NeverMatch, NotResidue, OrResidue, SeqResidue, SetResidue, TestResidue

public abstract class Residue
extends java.lang.Object

The base class defining dynamic residues of pointcuts

Author:
Ganesh Sittampalam, Ondrej Lhotak

Nested Class Summary
static class Residue.Bindings
           
 
Constructor Summary
Residue()
           
 
Method Summary
abstract  Stmt codeGen(SootMethod method, LocalGeneratorEx localgen, Chain units, Stmt begin, Stmt fail, boolean sense, WeavingContext wc)
          Generate the code for this dynamic residue.
 void getAdviceFormalBindings(Residue.Bindings bindings, AndResidue andRoot)
          Fills the Bindings object with information of possible advice-formal bindings.
 java.util.List getResidueBoxes()
           
abstract  Residue inline(ConstructorInliningMap cim)
          Make a copy of the residue applying to an inlined version of the code.
abstract  Residue optimize()
          Optimize the residue by rebuilding it, invoking the smart constructors along the way.
 Residue resetForReweaving()
           
 Residue restructureToCreateBindingsMask(Local bindingsMaskLocal, Residue.Bindings bindings)
          Returns residue that replaces the old residue.
protected static Stmt succeed(Chain units, Stmt begin, Stmt fail, boolean sense)
          This is a helper method for codeGen; it is called when an implementation of codeGen considers that the residue has succeeded, but hasn't yet considered the sense parameter.
abstract  java.lang.String toString()
          Must provide a toString method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Residue

public Residue()
Method Detail

inline

public abstract Residue inline(ConstructorInliningMap cim)
Make a copy of the residue applying to an inlined version of the code.


optimize

public abstract Residue optimize()
Optimize the residue by rebuilding it, invoking the smart constructors along the way.


codeGen

public abstract Stmt codeGen(SootMethod method,
                             LocalGeneratorEx localgen,
                             Chain units,
                             Stmt begin,
                             Stmt fail,
                             boolean sense,
                             WeavingContext wc)
Generate the code for this dynamic residue.

Parameters:
method - The method the code is being inserted into
localgen - A local generator for the method
units - The chain the code is being inserted into
begin - Code will be inserted just after this statement
sense - If this is false, inverts the meaning of failure and success for the residue
fail - If the residue "fails", the inserted code will jump to this point; otherwise it will fall through
wc - The weaving context
Returns:
The last statement that was inserted into the chain (or begin if nothing was).

succeed

protected static Stmt succeed(Chain units,
                              Stmt begin,
                              Stmt fail,
                              boolean sense)
This is a helper method for codeGen; it is called when an implementation of codeGen considers that the residue has succeeded, but hasn't yet considered the sense parameter. If sense is true, then the method just returns begin. If sense is false, then it inserts a jump to the fail point after begin.

Parameters:
units - The chain the code is being inserted into
begin - Any extra code will be inserted just after this statement
fail - The place to jump if sense is false
sense - Indicates the sense of the residue

toString

public abstract java.lang.String toString()
Must provide a toString method

Overrides:
toString in class java.lang.Object

resetForReweaving

public Residue resetForReweaving()

getAdviceFormalBindings

public void getAdviceFormalBindings(Residue.Bindings bindings,
                                    AndResidue andRoot)
Fills the Bindings object with information of possible advice-formal bindings. Has to be overwritten by all Residue classes that have children. andRoot is the outermost directly enclosing AndResidue (or null). (see implementation in AndResidue)


restructureToCreateBindingsMask

public Residue restructureToCreateBindingsMask(Local bindingsMaskLocal,
                                               Residue.Bindings bindings)
Returns residue that replaces the old residue. This way, BindMaskResidue is inserted throughout the tree in the appropriate places. Has to be overridden by all Residue classes that have children.


getResidueBoxes

public java.util.List getResidueBoxes()