abc.weaving.weaver
Class CflowCodeGenUtils.CflowCodeGen

java.lang.Object
  extended by abc.weaving.weaver.CflowCodeGenUtils.CflowCodeGen
Enclosing class:
CflowCodeGenUtils

public abstract static class CflowCodeGenUtils.CflowCodeGen
extends java.lang.Object


Field Summary
protected  abc.weaving.weaver.CflowCodeGenUtils.CodeGenUtils cgu
           
protected  SootFieldRef field
           
 
Constructor Summary
CflowCodeGenUtils.CflowCodeGen()
           
 
Method Summary
abstract  java.lang.String chooseName()
          Get a name to denote fields, methods etc that involve cflow classes.
 Chain genInitCflowField(LocalGeneratorEx localgen, SootFieldRef field)
          Generate code to initialise a field to contain the cflow state (in an aspect)
abstract  Chain genInitLocal(LocalGeneratorEx localgen, Local cFlowLocal, Local cFlowInstance)
          Generate code to initialise a local variable to the cflow thread-local
 Chain genInitLocalLazily(LocalGeneratorEx localgen, Local cFlowLocal, Local cFlowInstance)
          Generate code to initialise a local variable to the cflow thread-local, if non-null
 Chain genInitLocalToNull(LocalGeneratorEx localgen, Local l)
          Generate code to initialise a cflow instance local to a dummy value if necessary
abstract  ChainStmtBox genIsValid(LocalGeneratorEx localgen, Local cFlowLocal, Local result, Stmt succeed, Stmt fail)
          Generate code for an isValid test.
abstract  Chain genPeek(LocalGeneratorEx localgen, Local cFlowLocal, java.util.List targets)
          Generate code for a peek operation.
abstract  ChainStmtBox genPop(LocalGeneratorEx localgen, Local cFlowLocal)
          Generate code for a pop operation.
abstract  ChainStmtBox genPush(LocalGeneratorEx localgen, Local cFlowLocal, java.util.List values)
          Generate code for a push operation.
abstract  SootClass getCflowInstanceClass()
          Get the SootClass for the thread-local cflow class.
 Type getCflowInstanceType()
          Get the Type of the thread-local cflow class.
abstract  Type getCflowType()
          Get the Type of the (global) cflow class
 void setCflowField(SootFieldRef field)
          Set the field containing the reference to this Cflow
abstract  void setFormals(java.util.List types)
          Set the types of the cflow bound vars.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cgu

protected abc.weaving.weaver.CflowCodeGenUtils.CodeGenUtils cgu

field

protected SootFieldRef field
Constructor Detail

CflowCodeGenUtils.CflowCodeGen

public CflowCodeGenUtils.CflowCodeGen()
Method Detail

getCflowType

public abstract Type getCflowType()
Get the Type of the (global) cflow class

Returns:
The type of the cflow class

getCflowInstanceClass

public abstract SootClass getCflowInstanceClass()
Get the SootClass for the thread-local cflow class. Must not be called before the formals have been set.

Returns:
The thread-local cflow class, or null if not applicable

getCflowInstanceType

public Type getCflowInstanceType()
Get the Type of the thread-local cflow class. Must not be called before the formals have been set.

Returns:
The type of the thread-local cflow class

chooseName

public abstract java.lang.String chooseName()
Get a name to denote fields, methods etc that involve cflow classes.

Returns:
The name to use as a base for values of this class.

genInitLocalToNull

public Chain genInitLocalToNull(LocalGeneratorEx localgen,
                                Local l)
Generate code to initialise a cflow instance local to a dummy value if necessary

Parameters:
l - The cflow local variable to initialise
Returns:
The chian of statements initialising the local

setCflowField

public void setCflowField(SootFieldRef field)
Set the field containing the reference to this Cflow

Parameters:
field - The field (in an aspect) containing the cflow

setFormals

public abstract void setFormals(java.util.List types)
Set the types of the cflow bound vars. Must be called before code gen, used to decide on code gen strategy

Parameters:
types - The list of types of the cflow bound variables

genInitLocal

public abstract Chain genInitLocal(LocalGeneratorEx localgen,
                                   Local cFlowLocal,
                                   Local cFlowInstance)
Generate code to initialise a local variable to the cflow thread-local

Parameters:
cFlowLocal - The local variable to contain the thread-local Cflow bookkeeping class
cFlowInstance - The cflow bookkeeping instance to get the thread-local from
Returns:
The chain of statements initialising the cflow local

genInitLocalLazily

public Chain genInitLocalLazily(LocalGeneratorEx localgen,
                                Local cFlowLocal,
                                Local cFlowInstance)
Generate code to initialise a local variable to the cflow thread-local, if non-null

Parameters:
cFlowLocal - The local variable to contain the thread-local Cflow bookkeeping class
cFlowInstance - The cflow bookkeeping instance to get the thread-local from
Returns:
The chain of statements initialising the cflow local

genPush

public abstract ChainStmtBox genPush(LocalGeneratorEx localgen,
                                     Local cFlowLocal,
                                     java.util.List values)
Generate code for a push operation.

Parameters:
cFlowLocal - The local variable containing the thread-local Cflow bookkeeping class
values - the list of values to push onto the cflow stack
Returns:
The chain of statements generated for the push operation, together with a single statement representing it for analyses (cf. conditions for this stmt).

genPop

public abstract ChainStmtBox genPop(LocalGeneratorEx localgen,
                                    Local cFlowLocal)
Generate code for a pop operation.

Parameters:
cFlowLocal - The local variable containing the thread-local Cflow bookkeeping class
Returns:
The chain of statements generated for the pop operation together with a single statement representing it for analyses (cf. conditions for this stmt).

genPeek

public abstract Chain genPeek(LocalGeneratorEx localgen,
                              Local cFlowLocal,
                              java.util.List targets)
Generate code for a peek operation.

Parameters:
cFlowLocal - The local variable containing the thread-local Cflow bookkeeping class
targets - The list of target variables to save the cflow context into
Returns:
The chain of statements generated for the peek operation

genIsValid

public abstract ChainStmtBox genIsValid(LocalGeneratorEx localgen,
                                        Local cFlowLocal,
                                        Local result,
                                        Stmt succeed,
                                        Stmt fail)
Generate code for an isValid test. This sets a boolean variable to the result. In addition, if succeed (resp. fail) is non-null, then control flow jumps to succeed (resp. fail) if the test succeeds (resp. fails). Both succeed and fail should occur *after* the point at which the chain of statements returned by genIsValid is to be inserted.

Parameters:
cFlowLocal - The local variable containing the thread-local Cflow bookkeeping class
result - The local variable to store the result of the test into
succeed - The stmt to jump to if the test succeeds, or null if none required
fail - The stmt to jump to if the test fails, or null if none required
Returns:
The chain of statements generated for the isValid test, together with a single statement representing it for analyses (cf. conditions for this stmt).

genInitCflowField

public Chain genInitCflowField(LocalGeneratorEx localgen,
                               SootFieldRef field)
Generate code to initialise a field to contain the cflow state (in an aspect)

Parameters:
field - The field to contain the cflow state (of type getCflowType())
Returns:
The chain of statements generated to initialise the field