From: jjenista Date: Fri, 18 Mar 2011 21:14:45 +0000 (+0000) Subject: changing to new traversers/examiners X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=43ca900966904e343f98e05e7e0ab2fea063699d;p=IRC.git changing to new traversers/examiners --- diff --git a/Robust/src/Analysis/Disjoint/BuildStateMachines.java b/Robust/src/Analysis/Disjoint/BuildStateMachines.java index d7e404f2..bed70eec 100644 --- a/Robust/src/Analysis/Disjoint/BuildStateMachines.java +++ b/Robust/src/Analysis/Disjoint/BuildStateMachines.java @@ -5,6 +5,8 @@ import java.io.*; import IR.*; import IR.Flat.*; +import Analysis.OoOJava.*; + ////////////////////////////////////////////// // @@ -31,6 +33,7 @@ public class BuildStateMachines { Hashtable< FlatNode, Hashtable >(); } + protected StateMachineForEffects getStateMachine( FlatNode fn, TempDescriptor var ) { @@ -50,7 +53,6 @@ public class BuildStateMachines { } - public void addToStateMachine( Taint t, Effect e, FlatNode currentProgramPoint ) { diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 75d0646f..06818aff 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -623,7 +623,7 @@ public class DisjointAnalysis implements HeapAnalysis { Set sitesToFlag, RBlockRelationAnalysis rra ) { - init( s, tu, cg, l, ar, sitesToFlag, rra, false ); + init( s, tu, cg, l, ar, sitesToFlag, rra, null, false ); } public DisjointAnalysis( State s, @@ -635,7 +635,20 @@ public class DisjointAnalysis implements HeapAnalysis { RBlockRelationAnalysis rra, boolean suppressOutput ) { - init( s, tu, cg, l, ar, sitesToFlag, rra, suppressOutput ); + init( s, tu, cg, l, ar, sitesToFlag, rra, null, suppressOutput ); + } + + public DisjointAnalysis( State s, + TypeUtil tu, + CallGraph cg, + Liveness l, + ArrayReferencees ar, + Set sitesToFlag, + RBlockRelationAnalysis rra, + BuildStateMachines bsm, + boolean suppressOutput + ) { + init( s, tu, cg, l, ar, sitesToFlag, rra, bsm, suppressOutput ); } protected void init( State state, @@ -645,29 +658,27 @@ public class DisjointAnalysis implements HeapAnalysis { ArrayReferencees arrayReferencees, Set sitesToFlag, RBlockRelationAnalysis rra, + BuildStateMachines bsm, boolean suppressOutput ) { analysisComplete = false; - this.state = state; - this.typeUtil = typeUtil; - this.callGraph = callGraph; - this.liveness = liveness; - this.arrayReferencees = arrayReferencees; - this.sitesToFlag = sitesToFlag; - this.rblockRel = rra; - this.suppressOutput = suppressOutput; + this.state = state; + this.typeUtil = typeUtil; + this.callGraph = callGraph; + this.liveness = liveness; + this.arrayReferencees = arrayReferencees; + this.sitesToFlag = sitesToFlag; + this.rblockRel = rra; + this.suppressOutput = suppressOutput; + this.buildStateMachines = bsm; if( rblockRel != null ) { doEffectsAnalysis = true; effectsAnalysis = new EffectsAnalysis(); } - if( state.RCR ) { - buildStateMachines = new BuildStateMachines(); - } - this.allocationDepth = state.DISJOINTALLOCDEPTH; this.releaseMode = state.DISJOINTRELEASEMODE; this.determinismDesired = state.DISJOINTDETERMINISM; diff --git a/Robust/src/Analysis/OoOJava/ConflictGraph.java b/Robust/src/Analysis/OoOJava/ConflictGraph.java index 50ddd6c3..9492990e 100644 --- a/Robust/src/Analysis/OoOJava/ConflictGraph.java +++ b/Robust/src/Analysis/OoOJava/ConflictGraph.java @@ -206,8 +206,8 @@ public class ConflictGraph { if ((!currentNode.getID().equals(entryNodeID)) && !(analyzedIDSet.contains(currentNode.getID() + entryNodeID) || analyzedIDSet - .contains(entryNodeID + currentNode.getID()))) { - + .contains(entryNodeID + currentNode.getID()))) { + conflictType = calculateConflictType(currentNode, entryNode, useReachInfo); if (conflictType > ConflictGraph.NON_WRITE_CONFLICT) { addConflictEdge(conflictType, currentNode, entryNode); @@ -224,11 +224,12 @@ public class ConflictGraph { } private int calculateConflictType(ConflictNode node, boolean useReachInfo) { - + int conflictType = ConflictGraph.NON_WRITE_CONFLICT; - Hashtable> alloc2readEffects = node.getReadEffectSet(); - Hashtable> alloc2writeEffects = node.getWriteEffectSet(); - Hashtable> alloc2SUEffects = node.getStrongUpdateEffectSet(); + + Hashtable> alloc2readEffects = node.getReadEffectSet(); + Hashtable> alloc2writeEffects = node.getWriteEffectSet(); + Hashtable> alloc2SUEffects = node.getStrongUpdateEffectSet(); conflictType = updateConflictType(conflictType, determineConflictType(node, alloc2writeEffects, node, diff --git a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java index c73f7fa6..8f1e9b79 100644 --- a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java +++ b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java @@ -1,46 +1,15 @@ package Analysis.OoOJava; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; -import java.util.Set; -import java.util.Stack; -import java.util.Map.Entry; - -import Analysis.Pointer.Pointer; -import Analysis.ArrayReferencees; -import Analysis.Liveness; -import Analysis.CallGraph.CallGraph; -import Analysis.Disjoint.HeapAnalysis; -import Analysis.Disjoint.DisjointAnalysis; -import Analysis.Disjoint.Effect; -import Analysis.Disjoint.EffectsAnalysis; -import Analysis.Disjoint.Taint; -import IR.Descriptor; -import IR.MethodDescriptor; -import IR.Operation; -import IR.State; -import IR.TypeUtil; -import IR.Flat.FKind; -import IR.Flat.FlatCall; -import IR.Flat.FlatEdge; -import IR.Flat.FlatElementNode; -import IR.Flat.FlatFieldNode; -import IR.Flat.FlatMethod; -import IR.Flat.FlatNew; -import IR.Flat.FlatNode; -import IR.Flat.FlatOpNode; -import IR.Flat.FlatSESEEnterNode; -import IR.Flat.FlatSESEExitNode; -import IR.Flat.FlatSetElementNode; -import IR.Flat.FlatSetFieldNode; -import IR.Flat.FlatWriteDynamicVarNode; -import IR.Flat.TempDescriptor; +import java.io.*; +import java.util.*; + +import Analysis.*; +import Analysis.CallGraph.*; +import Analysis.Disjoint.*; +import Analysis.Pointer.*; +import IR.*; +import IR.Flat.*; + public class OoOJavaAnalysis { @@ -51,6 +20,7 @@ public class OoOJavaAnalysis { private RBlockRelationAnalysis rblockRel; private HeapAnalysis disjointAnalysisTaints; private DisjointAnalysis disjointAnalysisReach; + private BuildStateMachines buildStateMachines; private Set descriptorsToAnalyze; @@ -143,6 +113,11 @@ public class OoOJavaAnalysis { fn2contextTaskNames = new Hashtable(); fn2fm = new Hashtable(); + // state machines support heap examiners with + // state transitions to improve precision + if( state.RCR ) { + buildStateMachines = new BuildStateMachines(); + } // add all methods transitively reachable from the // source's main to set for analysis @@ -205,7 +180,7 @@ public class OoOJavaAnalysis { } else disjointAnalysisTaints = new DisjointAnalysis(state, typeUtil, callGraph, liveness, arrayReferencees, null, - rblockRel, + rblockRel, buildStateMachines, true ); // suppress output--this is an intermediate pass // 6th pass, not available analysis FOR VARIABLES! @@ -237,11 +212,21 @@ public class OoOJavaAnalysis { disjointAnalysisReach = new DisjointAnalysis(state, typeUtil, callGraph, liveness, arrayReferencees, sitesToFlag, - null // don't do effects analysis again! + null, // don't do effects analysis again! + null, // no BuildStateMachines needed + false // don't suppress progress output ); // 10th pass, calculate conflicts with reachability info calculateConflicts(null, true); + + } else { + // in RCR/DFJ we want to do some extra processing on the + // state machines before they get handed off to code gen, + // and we're doing the same effect-conflict traversal needed + // to identify heap examiners that are weakly connected, so + // accomplish both at the same time + pruneMachinesAndFindWeaklyConnectedExaminers(); } // 11th pass, compiling memory Qs! The name "lock" is a legacy @@ -1283,12 +1268,51 @@ public class OoOJavaAnalysis { } + + // the traversal for pruning state machines and finding + // machines that are weakly connected BOTH consider conflicting + // effects between heap roots, so it is smart to compute all of + // this together + public void pruneMachinesAndFindWeaklyConnectedExaminers() { + + EffectsAnalysis effectsAnalysis = disjointAnalysisTaints.getEffectsAnalysis(); + + // visit every conflict graph once, so iterate through the + // the non-leaf tasks to find them all + Set allSESEs = rblockRel.getAllSESEs(); + for( Iterator allItr = allSESEs.iterator(); allItr.hasNext(); ) { + + FlatSESEEnterNode parent = (FlatSESEEnterNode) allItr.next(); + if( parent.getIsLeafSESE() ) { + continue; + } + + ConflictGraph conflictGraph = sese2conflictGraph.get( parent ); + assert conflictGraph != null; + + // from the conflict graph we want to extract all conflicting effects + // and use them to identify (1) weakly connected heap examiners and + // (2) states/examiner nodes with a conflicting effect that will later + // support the examiner pruning process + Set conflictEdges = conflictGraph.getEdgeSet(); + for( Iterator edgeItr = conflictEdges.iterator(); edgeItr.hasNext(); ) { + ConflictEdge conflictEdge = (ConflictEdge) edgeItr.next(); + + + } + + } + + } + + + private void synthesizeLocks() { // for every conflict graph, generate a set of memory queues // (called SESELock in this code!) to cover the graph - Set> graphEntrySet = sese2conflictGraph.entrySet(); + Set> graphEntrySet = sese2conflictGraph.entrySet(); for (Iterator iterator = graphEntrySet.iterator(); iterator.hasNext();) { - Entry graphEntry = (Entry) iterator.next(); + Map.Entry graphEntry = (Map.Entry) iterator.next(); FlatNode sese = graphEntry.getKey(); ConflictGraph conflictGraph = graphEntry.getValue(); calculateCovering(conflictGraph); diff --git a/Robust/src/IR/Flat/RuntimeConflictResolver.java b/Robust/src/IR/Flat/RuntimeConflictResolver.java index 994e9b31..ba6d5dfb 100644 --- a/Robust/src/IR/Flat/RuntimeConflictResolver.java +++ b/Robust/src/IR/Flat/RuntimeConflictResolver.java @@ -370,33 +370,32 @@ public class RuntimeConflictResolver { } //This is Pass 1 of internal graph creation. - private void createPrunedGraph( - Hashtable created, - VariableNode varNode, - Taint t) { - // For every inset HRN, create a graph node, and run a DFT (buildPrunedGraphFromRG) - Iterator possibleEdges = varNode.iteratorToReferencees(); - while (possibleEdges.hasNext()) { - RefEdge edge = possibleEdges.next(); - assert edge != null; + private void createPrunedGraph(Hashtable created, + VariableNode varNode, + Taint t) { + // For every inset HRN, create a graph node, and run a DFT (buildPrunedGraphFromRG) + Iterator possibleEdges = varNode.iteratorToReferencees(); + while (possibleEdges.hasNext()) { + RefEdge edge = possibleEdges.next(); + assert edge != null; - ConcreteRuntimeObjNode singleRoot = new ConcreteRuntimeObjNode(edge.getDst(), true); - int rootKey = singleRoot.allocSite.getUniqueAllocSiteID(); + ConcreteRuntimeObjNode singleRoot = new ConcreteRuntimeObjNode(edge.getDst(), true); + int rootKey = singleRoot.allocSite.getUniqueAllocSiteID(); - if (!created.containsKey(rootKey)) { - created.put(rootKey, singleRoot); - buildPrunedGraphFromRG(singleRoot, edge.getDst().iteratorToReferencees(), created, t); - } - } - } + if (!created.containsKey(rootKey)) { + created.put(rootKey, singleRoot); + buildPrunedGraphFromRG(singleRoot, edge.getDst().iteratorToReferencees(), created, t); + } + } + } //Performs Depth First Traversal on the ReachGraph to build an //internal representation of it. It prunes ptrs not reachable //by read Effects and stores in each node the effects by it. private void buildPrunedGraphFromRG( ConcreteRuntimeObjNode curr, - Iterator edges, - Hashtable created, - Taint taint) { + Iterator edges, + Hashtable created, + Taint taint) { EffectsGroup currEffects = effectsLookupTable.getEffects(curr.allocSite, taint); if (currEffects == null || currEffects.isEmpty())