envgen.codegen
Class SEStubGenerator

java.lang.Object
  |
  +--envgen.codegen.AbstractStubGenerator
        |
        +--envgen.codegen.JavaStubGenerator
              |
              +--envgen.codegen.SEStubGenerator
All Implemented Interfaces:
ICodeGenerator

public class SEStubGenerator
extends JavaStubGenerator

Generates stubs for environment methods based on side-effects analysis.


Field Summary
(package private)  boolean atomicStepsMode
           
(package private)  int debug
          Set to print debugging messages.
(package private)  boolean mustSE
          Keeps track of environment components, including only those that get called inside the unit.
(package private)  boolean returnSensitivity
           
 
Fields inherited from class envgen.codegen.AbstractStubGenerator
assumptions, envInterface, envTable, unitTable
 
Constructor Summary
SEStubGenerator(java.util.HashMap unitTable, java.util.HashMap envTable, EnvInterface envInterface)
          StubGenerator constructor that sets fields flowing from the EnvGenerator.
 
Method Summary
 void buildAllocationStmts(MultiSet newLocations, soot.util.Chain units)
           
 void buildReturnSideEffectsStmts(MultiSet returnSideEffectsSummary, MultiSet returnLocations, soot.util.Chain units, soot.SootClass markedClass, soot.SootMethod markedMethod)
           
 soot.SootClass genEnvEqualsClass()
          Adds a class with a special definition of "equals" method.
 void genMissingFields(SymLocValue symVal, soot.SootClass markedClass)
          If sym is of the form this.f and markedClass doesn't declare f, such field is included.
 void genStubBody(soot.SootClass markedClass, soot.SootMethod markedMethod)
          Builds a stub based on analysis results.
 java.util.List genUnitMethods()
           
 JavaStmt getAssignmentStmt(java.lang.String lhs, java.lang.String rhs, boolean may)
          Builds and assignment statement and make it a body of if(choose()){} for the may analysis.
 JavaStmt getMultipleReturns(soot.SootClass markedClass, MultiSet returnLocations, soot.Type returnType)
          Creates a nondeterministic choice of returnLocations.
 JavaStmt getMultipleValues(MultiSet values, soot.Type symType, java.lang.String var, soot.SootClass markedClass, int rId)
          Creates a nondeterministic choice of returnLocations.
 JavaStmt getReturnStmts(soot.SootClass markedClass, soot.SootMethod markedMethod, MultiSet returnLocations)
          Inserts return statements into units.
 JavaStmt getSideEffectsStmts(DataFlowSet sideEffectsSummary, soot.SootClass markedClass, boolean may)
          Takes sideEffectsSummary table and builds assignment statements that describe it.
 void getSpec(java.util.List markedMethods)
          Maps results of the side-effects analysis into a convenient form.
 
Methods inherited from class envgen.codegen.JavaStubGenerator
genTopFields
 
Methods inherited from class envgen.codegen.AbstractStubGenerator
genCode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mustSE

boolean mustSE
Keeps track of environment components, including only those that get called inside the unit.


returnSensitivity

boolean returnSensitivity

atomicStepsMode

boolean atomicStepsMode

debug

int debug
Set to print debugging messages.

Constructor Detail

SEStubGenerator

public SEStubGenerator(java.util.HashMap unitTable,
                       java.util.HashMap envTable,
                       EnvInterface envInterface)
StubGenerator constructor that sets fields flowing from the EnvGenerator.

Method Detail

genStubBody

public void genStubBody(soot.SootClass markedClass,
                        soot.SootMethod markedMethod)
Builds a stub based on analysis results.

Specified by:
genStubBody in class AbstractStubGenerator

buildAllocationStmts

public void buildAllocationStmts(MultiSet newLocations,
                                 soot.util.Chain units)

buildReturnSideEffectsStmts

public void buildReturnSideEffectsStmts(MultiSet returnSideEffectsSummary,
                                        MultiSet returnLocations,
                                        soot.util.Chain units,
                                        soot.SootClass markedClass,
                                        soot.SootMethod markedMethod)

getSideEffectsStmts

public JavaStmt getSideEffectsStmts(DataFlowSet sideEffectsSummary,
                                    soot.SootClass markedClass,
                                    boolean may)
Takes sideEffectsSummary table and builds assignment statements that describe it.


getAssignmentStmt

public JavaStmt getAssignmentStmt(java.lang.String lhs,
                                  java.lang.String rhs,
                                  boolean may)
Builds and assignment statement and make it a body of if(choose()){} for the may analysis.


genMissingFields

public void genMissingFields(SymLocValue symVal,
                             soot.SootClass markedClass)
If sym is of the form this.f and markedClass doesn't declare f, such field is included.

Overrides:
genMissingFields in class JavaStubGenerator

getMultipleValues

public JavaStmt getMultipleValues(MultiSet values,
                                  soot.Type symType,
                                  java.lang.String var,
                                  soot.SootClass markedClass,
                                  int rId)
Creates a nondeterministic choice of returnLocations.


getReturnStmts

public JavaStmt getReturnStmts(soot.SootClass markedClass,
                               soot.SootMethod markedMethod,
                               MultiSet returnLocations)
Inserts return statements into units. There may be several return statements that are presented as a nondeterministic choice. This method is called only if returnType is not instanceof VoidType.


getMultipleReturns

public JavaStmt getMultipleReturns(soot.SootClass markedClass,
                                   MultiSet returnLocations,
                                   soot.Type returnType)
Creates a nondeterministic choice of returnLocations.


genEnvEqualsClass

public soot.SootClass genEnvEqualsClass()
Adds a class with a special definition of "equals" method.

Overrides:
genEnvEqualsClass in class JavaStubGenerator

genUnitMethods

public java.util.List genUnitMethods()
Returns:
List of concrete (analyzable) unit methods

getSpec

public void getSpec(java.util.List markedMethods)
Maps results of the side-effects analysis into a convenient form.