From 85035340f16967b99fe7c7569f4b99616d528949 Mon Sep 17 00:00:00 2001 From: jjenista Date: Tue, 22 Jun 2010 23:21:03 +0000 Subject: [PATCH] taints at reach graph level implemented --- .../Analysis/Disjoint/DisjointAnalysis.java | 13 +++-- Robust/src/Analysis/Disjoint/ReachGraph.java | 54 +++++++++---------- Robust/src/Analysis/Disjoint/Taint.java | 10 +++- Robust/src/IR/Flat/FlatSESEEnterNode.java | 2 +- .../src/Tests/disjoint/taintTest1/test.java | 26 ++++----- 5 files changed, 56 insertions(+), 49 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 567d9e3c..2e15b921 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -469,8 +469,9 @@ public class DisjointAnalysis { static protected Hashtable fn2rg = new Hashtable(); - private Hashtable fc2enclosing; - + private Hashtable fc2enclosing; + + //protected RBlockRelationAnalysis rra; // allocate various structures that are not local @@ -505,7 +506,7 @@ public class DisjointAnalysis { mapBackEdgeToMonotone = new Hashtable(); - + mapHrnIdToAllocSite = new Hashtable(); @@ -553,6 +554,7 @@ public class DisjointAnalysis { CallGraph cg, Liveness l, ArrayReferencees ar + //RBlockRelationAnalysis rra ) throws java.io.IOException { init( s, tu, cg, l, ar ); } @@ -562,6 +564,7 @@ public class DisjointAnalysis { CallGraph callGraph, Liveness liveness, ArrayReferencees arrayReferencees + //RBlockRelationAnalysis rra ) throws java.io.IOException { analysisComplete = false; @@ -1112,6 +1115,7 @@ public class DisjointAnalysis { } break; + /* case FKind.FlatSESEEnterNode: FlatSESEEnterNode sese = (FlatSESEEnterNode) fn; rg.taintLiveTemps( sese, @@ -1123,7 +1127,8 @@ public class DisjointAnalysis { FlatSESEExitNode fsexn = (FlatSESEExitNode) fn; rg.removeInContextTaints( fsexn.getFlatEnter() ); break; - + */ + case FKind.FlatCall: { Descriptor mdCaller; if( fmContaining.getMethod() != null ){ diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 127ca159..acd13a75 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1243,38 +1243,32 @@ public class ReachGraph { } - public void taintLiveTemps( FlatSESEEnterNode sese, - Set liveTemps - ) { - - System.out.println( "At "+sese+" with: "+liveTemps ); - - Iterator tdItr = liveTemps.iterator(); - while( tdItr.hasNext() ) { - TempDescriptor td = tdItr.next(); - VariableNode vn = td2vn.get( td ); - - Iterator reItr = vn.iteratorToReferencees(); - while( reItr.hasNext() ) { - RefEdge re = reItr.next(); - - // these new sese (rblock) taints should - // have empty predicates so they never propagate - // out to callers - Taint t = Taint.factory( sese, - td, - re.getDst().getAllocSite(), - ExistPredSet.factory() - ); - - re.setTaints( Canonical.add( re.getTaints(), - t - ) - ); - } + public void taintTemp( FlatSESEEnterNode sese, + TempDescriptor td + ) { + + VariableNode vn = td2vn.get( td ); + + Iterator reItr = vn.iteratorToReferencees(); + while( reItr.hasNext() ) { + RefEdge re = reItr.next(); + + // these new sese (rblock) taints should + // have empty predicates so they never propagate + // out to callers + Taint t = Taint.factory( sese, + td, + re.getDst().getAllocSite(), + ExistPredSet.factory() + ); + + re.setTaints( Canonical.add( re.getTaints(), + t + ) + ); } } - + public void removeInContextTaints( FlatSESEEnterNode sese ) { } diff --git a/Robust/src/Analysis/Disjoint/Taint.java b/Robust/src/Analysis/Disjoint/Taint.java index 440a33fa..24f0d9a4 100644 --- a/Robust/src/Analysis/Disjoint/Taint.java +++ b/Robust/src/Analysis/Disjoint/Taint.java @@ -129,8 +129,16 @@ public class Taint extends Canonical { } public String toString() { + + String s; + if( sese.getIsCallerSESEplaceholder() ) { + s = "placeh"; + } else { + s = sese.getPrettyIdentifier(); + } + return - "("+sese.getPrettyIdentifier()+ + "("+s+ "-"+insetVar+ ", "+allocSite.toStringBrief()+ "):"+preds; diff --git a/Robust/src/IR/Flat/FlatSESEEnterNode.java b/Robust/src/IR/Flat/FlatSESEEnterNode.java index e2e88057..98569fdd 100644 --- a/Robust/src/IR/Flat/FlatSESEEnterNode.java +++ b/Robust/src/IR/Flat/FlatSESEEnterNode.java @@ -112,7 +112,7 @@ public class FlatSESEEnterNode extends FlatNode { return id; } - public String getPrettyIdentifier() { + public String getPrettyIdentifier() { if( treeNode.getID() != null ) { return treeNode.getID(); } diff --git a/Robust/src/Tests/disjoint/taintTest1/test.java b/Robust/src/Tests/disjoint/taintTest1/test.java index a8b37ef2..ace7ac5e 100644 --- a/Robust/src/Tests/disjoint/taintTest1/test.java +++ b/Robust/src/Tests/disjoint/taintTest1/test.java @@ -9,25 +9,25 @@ public class Test { static public void main( String[] args ) { Foo a = new Foo(); + doSomething( a ); + } - rblock DU { - Foo b = new Foo(); - Foo z = a.f; - } + static void doSomething( Foo a ) { - Foo c = new Foo(); - Foo d = new Foo(); + a.f = new Foo(); - //doSomething( a, b, c ); - } - - static void doSomething( Foo a, Foo b, Foo c ) { + rblock r1 { + Foo b = a.f; + b.f = new Foo(); + } - rblock YO { - Foo e = doStuff( a, b ); + rblock r2 { + Foo c = a.f.f; + c.f = new Foo(); } - Foo f = doStuff( a, c ); + + //Foo f = doStuff( a, c ); } static Foo doStuff( Foo m, Foo n ) { -- 2.34.1