From: jjenista Date: Mon, 28 Jun 2010 22:21:43 +0000 (+0000) Subject: restate inaccessible vars for stall site so facts get joined properly X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=81932de2d62a7e354ce7d86a0619c33637ae9ae8;p=IRC.git restate inaccessible vars for stall site so facts get joined properly --- diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 6c7c2fde..cf02283a 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1017,11 +1017,13 @@ public class DisjointAnalysis { // nullified in the graph to reduce edges //rg.nullifyDeadVars( liveness.getLiveInTemps( fmContaining, fn ) ); - TempDescriptor lhs; - TempDescriptor rhs; - FieldDescriptor fld; - TypeDescriptor tdElement; - FieldDescriptor fdElement; + TempDescriptor lhs; + TempDescriptor rhs; + FieldDescriptor fld; + TypeDescriptor tdElement; + FieldDescriptor fdElement; + FlatSESEEnterNode sese; + FlatSESEExitNode fsexn; // use node type to decide what transfer function // to apply to the reachability graph @@ -1067,8 +1069,8 @@ public class DisjointAnalysis { if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) { if(rblockStatus.isInCriticalRegion(fmContaining, fn)){ // x gets status of y - if(rg.isAccessible(rhs)){ - rg.addAccessibleVar(lhs); + if(!rg.isAccessible(rhs)){ + rg.makeInaccessible(lhs); } } } @@ -1085,7 +1087,18 @@ public class DisjointAnalysis { TypeDescriptor td = fcn.getType(); assert td != null; + + // before transfer, do effects analysis support + if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) { + if(rblockStatus.isInCriticalRegion(fmContaining, fn)){ + // x gets status of y + if(!rg.isAccessible(rhs)){ + rg.makeInaccessible(lhs); + } + } + } + // transfer func rg.assignTempXEqualToCastedTempY( lhs, rhs, td ); break; @@ -1108,8 +1121,8 @@ public class DisjointAnalysis { } // after this, x and y are accessbile. - rg.addAccessibleVar(lhs); - rg.addAccessibleVar(rhs); + rg.makeAccessible(lhs); + rg.makeAccessible(rhs); } } @@ -1150,8 +1163,8 @@ public class DisjointAnalysis { } // accessible status update - rg.addAccessibleVar(lhs); - rg.addAccessibleVar(rhs); + rg.makeAccessible(lhs); + rg.makeAccessible(rhs); } } @@ -1190,8 +1203,8 @@ public class DisjointAnalysis { rg.taintStallSite(fn, rhs); } - rg.addAccessibleVar(lhs); - rg.addAccessibleVar(rhs); + rg.makeAccessible(lhs); + rg.makeAccessible(rhs); } } @@ -1234,8 +1247,8 @@ public class DisjointAnalysis { } // accessible status update - rg.addAccessibleVar(lhs); - rg.addAccessibleVar(rhs); + rg.makeAccessible(lhs); + rg.makeAccessible(rhs); } } @@ -1264,7 +1277,7 @@ public class DisjointAnalysis { if (doEffectsAnalysis && fmContaining != fmAnalysisEntry) { if (rblockStatus.isInCriticalRegion(fmContaining, fn)) { // after creating new object, lhs is accessible - rg.addAccessibleVar(lhs); + rg.makeAccessible(lhs); } } @@ -1274,30 +1287,33 @@ public class DisjointAnalysis { break; case FKind.FlatSESEEnterNode: + sese = (FlatSESEEnterNode) fn; + if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) { // always remove ALL stall site taints at enter rg.removeAllStallSiteTaints(); - // inject taints for in-set vars - FlatSESEEnterNode sese = (FlatSESEEnterNode) fn; + // inject taints for in-set vars rg.taintInSetVars( sese ); } break; case FKind.FlatSESEExitNode: - if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) { + fsexn = (FlatSESEExitNode) fn; + sese = fsexn.getFlatEnter(); - // sese exit clears all mappings of accessible vars and stall sites - // need to wipe out stall site taints - rg.clearAccessibleVarSet(); + if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) { + // @ sese exit make all live variables + // inaccessible to later parent statements + rg.makeInaccessible( liveness.getLiveInTemps( fmContaining, fn ) ); + // always remove ALL stall site taints at exit rg.removeAllStallSiteTaints(); - // remove in-set vars for the exiting rblock - FlatSESEExitNode fsexn = (FlatSESEExitNode) fn; - rg.removeInContextTaints( fsexn.getFlatEnter() ); + // remove in-set var taints for the exiting rblock + rg.removeInContextTaints( sese ); } break; diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index f458b38c..c32826f3 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -37,17 +37,17 @@ public class ReachGraph { // convenient set of alloc sites for all heap regions // present in the graph without having to search - public HashSet allocSites; + public Set allocSites; - // set of accessible variables for current program statement - // if not contains, it is an inaccessible variable - public HashSet accessibleVars; + // set of inaccessible variables for current program statement + // with respect to stall-site analysis + public Set inaccessibleVars; public ReachGraph() { - id2hrn = new Hashtable(); - td2vn = new Hashtable(); - allocSites = new HashSet(); - accessibleVars = new HashSet(); + id2hrn = new Hashtable(); + td2vn = new Hashtable(); + allocSites = new HashSet(); + inaccessibleVars = new HashSet(); } @@ -732,11 +732,7 @@ public class ReachGraph { TaintSet.factory() // taints ); - addRefEdge( lnX, hrnNewest, edgeNew ); - - // after x=new , x is accessible - // if (isInRegion()) { - //accessibleVars.add(x); + addRefEdge( lnX, hrnNewest, edgeNew ); } @@ -3687,10 +3683,10 @@ public class ReachGraph { return; } - mergeNodes ( rg ); - mergeRefEdges ( rg ); - mergeAllocSites( rg ); - mergeAccessibleSet( rg ); + mergeNodes ( rg ); + mergeRefEdges ( rg ); + mergeAllocSites ( rg ); + mergeInaccessibleVars( rg ); } protected void mergeNodes( ReachGraph rg ) { @@ -3898,21 +3894,8 @@ public class ReachGraph { allocSites.addAll( rg.allocSites ); } - protected void mergeAccessibleSet( ReachGraph rg ){ - // inaccesible status is prior to accessible status - - Set varsToMerge=rg.getAccessibleVar(); - Set varsRemoved=new HashSet(); - - for (Iterator iterator = accessibleVars.iterator(); iterator.hasNext();) { - TempDescriptor accessibleVar = (TempDescriptor) iterator.next(); - if(!varsToMerge.contains(accessibleVar)){ - varsRemoved.add(accessibleVar); - } - } - - accessibleVars.removeAll(varsRemoved); - + protected void mergeInaccessibleVars( ReachGraph rg ){ + inaccessibleVars.addAll(rg.inaccessibleVars); } @@ -3960,7 +3943,7 @@ public class ReachGraph { return false; } - if( !accessibleVars.equals( rg.accessibleVars) ){ + if( !inaccessibleVars.equals(rg.inaccessibleVars) ){ return false; } @@ -4975,20 +4958,23 @@ public class ReachGraph { return common; } - public void addAccessibleVar(TempDescriptor td){ - accessibleVars.add(td); + public void makeInaccessible( Set vars ) { + inaccessibleVars.addAll( vars ); } - - public Set getAccessibleVar(){ - return accessibleVars; + + public void makeInaccessible( TempDescriptor td ) { + inaccessibleVars.add( td ); + } + + public void makeAccessible( TempDescriptor td ) { + inaccessibleVars.remove( td ); } public boolean isAccessible(TempDescriptor td) { - return accessibleVars.contains(td); + return !inaccessibleVars.contains(td); } - public void clearAccessibleVarSet(){ - accessibleVars.clear(); - } - + public Set getInaccessibleVars() { + return inaccessibleVars; + } } diff --git a/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java b/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java index 35693823..d11c5b2b 100644 --- a/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java +++ b/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java @@ -140,7 +140,7 @@ public class RBlockStatusAnalysis { Hashtable status = statusMap.get(fn); if(status.get(seseContaining).booleanValue()==true){ - System.out.println(fn+" is in the critical region in according to "+seseContaining); + //System.out.println(fn+" is in the critical region in according to "+seseContaining); } return status.get(seseContaining).booleanValue(); diff --git a/Robust/src/Tests/disjoint/taintTest1/makefile b/Robust/src/Tests/disjoint/taintTest1/makefile index e3736144..5b0554bc 100644 --- a/Robust/src/Tests/disjoint/taintTest1/makefile +++ b/Robust/src/Tests/disjoint/taintTest1/makefile @@ -5,7 +5,7 @@ SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript BSFLAGS= -mainclass Test -justanalyze -ooojava -disjoint -disjoint-k 1 -enable-assertions -DEBUGFLAGS= -disjoint-write-dots final -disjoint-write-initial-contexts -disjoint-write-ihms -disjoint-debug-snap-method main 0 10 true +DEBUGFLAGS= -disjoint-write-dots final -disjoint-write-initial-contexts -disjoint-write-ihms #-disjoint-debug-snap-method main 0 10 true all: $(PROGRAM).bin