return out;
}
+
+ // BOO, HISS! SESE (rblock) operand does NOT extend
+ // Canonical, so we can't cache this op by its
+ // canonical arguments--THINK ABOUT A BETTER WAY!
+ public static TaintSet removeTaintsBy( TaintSet ts,
+ FlatSESEEnterNode sese ) {
+ assert ts != null;
+ assert ts.isCanonical();
+ assert sese != null;
+
+ // NEVER a cached result... (cry)
+ TaintSet out = new TaintSet();
+
+ Iterator<Taint> tItr = ts.iterator();
+ while( tItr.hasNext() ) {
+ Taint t = tItr.next();
+
+ if( !t.getSESE().equals( sese ) ) {
+ out.taints.add( t );
+ }
+ }
+
+ out = (TaintSet) makeCanonical( out );
+ //op2result.put( op, out ); CRY CRY
+ return out;
+ }
}
public RBlockRelationAnalysis rblockRel;
public TypeUtil typeUtil;
public int allocationDepth;
+
+ protected boolean doEffectsAnalysis = false;
+
// data structure for public interface
private Hashtable< Descriptor, HashSet<AllocSite> >
private Hashtable<FlatCall, Descriptor> fc2enclosing;
- //protected RBlockRelationAnalysis rra;
-
// allocate various structures that are not local
// to a single class method--should be done once
this.liveness = liveness;
this.arrayReferencees = arrayReferencees;
this.rblockRel = rra;
+
+ if( rblockRel != null ) {
+ doEffectsAnalysis = true;
+ }
+
this.allocationDepth = state.DISJOINTALLOCDEPTH;
this.releaseMode = state.DISJOINTRELEASEMODE;
this.determinismDesired = state.DISJOINTDETERMINISM;
}
}
- //if(rra.isEndOfRegion(fn)){
- // rg.clearAccessibleVarSet();
- // also need to clear stall mapping
- //}
if( takeDebugSnapshots &&
d.getSymbol().equals( descSymbolDebug )
// nullified in the graph to reduce edges
//rg.nullifyDeadVars( liveness.getLiveInTemps( fmContaining, fn ) );
+ /*
+ if( doEffectsAnalysis &&
+ rra.isEndOfRegion(fn)){
+ rg.clearAccessibleVarSet();
+ also need to clear stall mapping
+ }
+ */
TempDescriptor lhs;
TempDescriptor rhs;
lhs = fon.getDest();
rhs = fon.getLeft();
rg.assignTempXEqualToTempY( lhs, rhs );
+
+ /*
+ if( doEffectsAnalysis ) {
+ // current sese is top of stack at this program point
+ FlatSESEEnterNode sese =
+ rblockRel.getRBlockStacks( fmContaining, fn ).peek();
+
+ // if we are assigning to an out-set var, the taint
+ // on the out-set var edges should be TRUE (and propagate
+ // back to callers
+
+ rg.taintTemp( sese,
+ null,
+ lhs,
+ ReachGraph.predsTrue
+ );
+ }
+ */
}
break;
}
break;
- /*
case FKind.FlatSESEEnterNode:
- FlatSESEEnterNode sese = (FlatSESEEnterNode) fn;
- rg.taintLiveTemps( sese,
- liveness.getLiveInTemps( fmContaining, fn )
- );
+ if( doEffectsAnalysis ) {
+ FlatSESEEnterNode sese = (FlatSESEEnterNode) fn;
+ rg.taintInSetVars( sese );
+ }
break;
case FKind.FlatSESEExitNode:
- FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
- rg.removeInContextTaints( fsexn.getFlatEnter() );
+ if( doEffectsAnalysis ) {
+ FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
+ rg.removeInContextTaints( fsexn.getFlatEnter() );
+ }
break;
- */
+
case FKind.FlatCall: {
Descriptor mdCaller;
protected static final ReachSet rsetWithEmptyState = Canonical.makePredsTrue(ReachSet.factory( rstateEmpty ));
// predicate constants
- protected static final ExistPred predTrue = ExistPred.factory(); // if no args, true
- protected static final ExistPredSet predsEmpty = ExistPredSet.factory();
- protected static final ExistPredSet predsTrue = ExistPredSet.factory( predTrue );
+ public static final ExistPred predTrue = ExistPred.factory(); // if no args, true
+ public static final ExistPredSet predsEmpty = ExistPredSet.factory();
+ public static final ExistPredSet predsTrue = ExistPredSet.factory( predTrue );
// from DisjointAnalysis for convenience
}
- // either the sese or the callsite should be null!
- public void taintTemp( FlatSESEEnterNode sese,
- FlatNode stallSite,
- TempDescriptor td
+ public void taintInSetVars( FlatSESEEnterNode sese ) {
+ Iterator<TempDescriptor> isvItr = sese.getInVarSet().iterator()
+;
+ while( isvItr.hasNext() ) {
+ TempDescriptor isv = isvItr.next();
+ VariableNode vn = td2vn.get( isv );
+
+ Iterator<RefEdge> reItr = vn.iteratorToReferencees();
+ while( reItr.hasNext() ) {
+ RefEdge re = reItr.next();
+
+ // these in-set taints should have empty
+ // predicates so they never propagate
+ // out to callers
+ Taint t = Taint.factory( sese,
+ null,
+ isv,
+ re.getDst().getAllocSite(),
+ ExistPredSet.factory()
+ );
+
+ re.setTaints( Canonical.add( re.getTaints(),
+ t
+ )
+ );
+ }
+ }
+ }
+
+ // this is useful for more general tainting
+ public void taintTemp( Taint taint,
+ TempDescriptor td,
+ ExistPredSet preds
) {
VariableNode vn = td2vn.get( td );
Iterator<RefEdge> reItr = vn.iteratorToReferencees();
while( reItr.hasNext() ) {
RefEdge re = reItr.next();
-
- // these new taints should have empty
- // predicates so they never propagate
- // out to callers
- Taint t = Taint.factory( sese,
- stallSite,
- td,
- re.getDst().getAllocSite(),
- ExistPredSet.factory()
- );
-
+
re.setTaints( Canonical.add( re.getTaints(),
- t
+ taint
)
);
}
}
public void removeInContextTaints( FlatSESEEnterNode sese ) {
-
+ Iterator meItr = id2hrn.entrySet().iterator();
+ while( meItr.hasNext() ) {
+ Map.Entry me = (Map.Entry) meItr.next();
+ Integer id = (Integer) me.getKey();
+ HeapRegionNode hrn = (HeapRegionNode) me.getValue();
+
+ Iterator<RefEdge> reItr = hrn.iteratorToReferencers();
+ while( reItr.hasNext() ) {
+ RefEdge re = reItr.next();
+
+ re.setTaints( Canonical.removeTaintsBy( re.getTaints(),
+ sese
+ )
+ );
+ }
+ }
}
// conflictGraphLockMap = new Hashtable<ConflictGraph, HashSet<SESELock>>();
// 1st pass, find basic rblock relations
- RBlockRelationAnalysis rblockRel =
- new RBlockRelationAnalysis(state, typeUtil, callGraph);
+ rblockRel = new RBlockRelationAnalysis(state, typeUtil, callGraph);
// 2nd pass, liveness, in-set out-set (no virtual reads yet!)
Iterator<FlatSESEEnterNode> rootItr =
}
// MORE PASSES?
-
+
+
}
BUILDSCRIPT=~/research/Robust/src/buildscript
-
-BSFLAGS= -mainclass Test -justanalyze -ooojava -disjoint -disjoint-k 2 -disjoint-write-dots final -enable-assertions
+BSFLAGS= -mainclass Test -justanalyze -ooojava -disjoint -disjoint-k 1 -enable-assertions
+DEBUGFLAGS= -disjoint-write-dots final -disjoint-debug-snap-method main 0 10 true
all: $(PROGRAM).bin
static public void main( String[] args ) {
Foo a = new Foo();
- doSomething( a );
- }
+ Foo b = new Foo();
- static void doSomething( Foo a ) {
+ if( false ) {
+ a = new Foo();
+ }
- a.f = new Foo();
-
- rblock r1 {
- Foo b = a.f;
- b.f = new Foo();
+ rblock p1 {
+ a.f = new Foo();
+ a.g = new Foo();
+
+ Foo x = a.f;
}
- rblock r2 {
- Foo c = a.f.f;
- c.f = new Foo();
+ rblock p2 {
+ a.f = new Foo();
+ b.f = new Foo();
+
+ rblock c1 {
+ Foo d = a;
+ d.g = new Foo();
+ Foo e = d.g;
+ }
+
+ Foo y = a.f;
}
+
+ //doSomething( a );
+ }
+
+ static void doSomething( Foo a ) {
+
//Foo f = doStuff( a, c );
}
static Foo doStuff( Foo m, Foo n ) {
- m.f = new Foo();
- n.f = new Foo();
-
- m.g = n.f;
-
return new Foo();
}
}