From: jjenista Date: Mon, 10 Aug 2009 18:45:09 +0000 (+0000) Subject: Working towards dynamic source variables in MLP, not quite ready X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b5d0b7d00582b7a0eec3babbf56f6a1658ee06e8;p=IRC.git Working towards dynamic source variables in MLP, not quite ready --- diff --git a/Robust/src/Analysis/MLP/CodePlan.java b/Robust/src/Analysis/MLP/CodePlan.java index 9450be18..d71626e8 100644 --- a/Robust/src/Analysis/MLP/CodePlan.java +++ b/Robust/src/Analysis/MLP/CodePlan.java @@ -9,28 +9,16 @@ import java.io.*; // a code plan contains information based on analysis results // for injecting code before and/or after a flat node public class CodePlan { - - private Set writeToDynamicSrc; private Hashtable< VariableSourceToken, Set > stall2copySet; + private Set dynamicStallSet; public CodePlan() { - writeToDynamicSrc = null; - stall2copySet = new Hashtable< VariableSourceToken, Set >(); + dynamicStallSet = new HashSet(); } - - public void setWriteToDynamicSrc( - Set writeToDynamicSrc - ) { - this.writeToDynamicSrc = writeToDynamicSrc; - } - - public Set getWriteToDynamicSrc() { - return writeToDynamicSrc; - } public void addStall2CopySet( VariableSourceToken stallToken, Set copySet ) { @@ -52,6 +40,15 @@ public class CodePlan { } + public void addDynamicStall( TempDescriptor var ) { + dynamicStallSet.add( var ); + } + + public Set getDynamicStallSet() { + return dynamicStallSet; + } + + public boolean equals( Object o ) { if( o == null ) { return false; @@ -63,46 +60,30 @@ public class CodePlan { CodePlan cp = (CodePlan) o; - boolean dynamicSetEq; - if( writeToDynamicSrc == null ) { - dynamicSetEq = (cp.writeToDynamicSrc == null); - } else { - dynamicSetEq = (writeToDynamicSrc.equals( cp.writeToDynamicSrc )); - } - boolean copySetsEq = (stall2copySet.equals( cp.stall2copySet )); + + boolean dynStallSetEq = (dynamicStallSet.equals( cp.dynamicStallSet )); - return dynamicSetEq && copySetsEq; + return copySetsEq && dynStallSetEq; } public int hashCode() { - int dynamicSetHC = 1; - if( writeToDynamicSrc != null ) { - dynamicSetHC = writeToDynamicSrc.hashCode(); - } int copySetsHC = stall2copySet.hashCode(); - return dynamicSetHC ^ 3*copySetsHC; + int dynStallSetHC = dynamicStallSet.hashCode(); + + int hash = 7; + hash = 31*hash + copySetsHC; + hash = 31*hash + dynStallSetHC; + return hash; } public String toString() { String s = " PLAN: "; - if( writeToDynamicSrc != null ) { - s += "[WRITE DYN"; - - Iterator vstItr = writeToDynamicSrc.iterator(); - while( vstItr.hasNext() ) { - VariableSourceToken vst = vstItr.next(); - s += ", "+vst; - } - - s += "]"; - } - if( !stall2copySet.entrySet().isEmpty() ) { - s += "[STALLS:"; + s += "[STATIC STALLS:"; } Iterator cpsItr = stall2copySet.entrySet().iterator(); while( cpsItr.hasNext() ) { @@ -116,6 +97,10 @@ public class CodePlan { s += "]"; } + if( !dynamicStallSet.isEmpty() ) { + s += "[DYN STALLS:"+dynamicStallSet+"]"; + } + return s; } } diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 7bd56721..78d207dc 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -27,6 +27,8 @@ public class MLPAnalysis { private Hashtable< FlatNode, Set > notAvailableResults; private Hashtable< FlatNode, CodePlan > codePlans; + private Hashtable wdvNodesToSpliceIn; + public static int maxSESEage = -1; @@ -73,6 +75,9 @@ public class MLPAnalysis { notAvailableResults = new Hashtable< FlatNode, Set >(); codePlans = new Hashtable< FlatNode, CodePlan >(); + wdvNodesToSpliceIn = new Hashtable(); + + FlatMethod fmMain = state.getMethodFlat( tu.getMain() ); rootSESE = (FlatSESEEnterNode) fmMain.getNext(0); @@ -80,6 +85,9 @@ public class MLPAnalysis { rootSESE.setmdEnclosing( fmMain.getMethod() ); rootSESE.setcdEnclosing( fmMain.getMethod().getClassDesc() ); + if( state.MLPDEBUG ) { + System.out.println( "" ); + } // 1st pass // run analysis on each method that is actually called @@ -93,6 +101,9 @@ public class MLPAnalysis { // and organize them into roots and children buildForestForward( fm ); } + if( state.MLPDEBUG ) { + //System.out.println( "\nSESE Hierarchy\n--------------\n" ); printSESEHierarchy(); + } // 2nd pass, results are saved in FlatSESEEnterNode, so @@ -110,11 +121,18 @@ public class MLPAnalysis { // variable analysis for refinement and stalls variableAnalysisForward( fm ); } + if( state.MLPDEBUG ) { + System.out.println( "\nVariable Results\n----------------\n"+fmMain.printMethod( variableResults ) ); + } // 4th pass, compute liveness contribution from // virtual reads discovered in variable pass livenessAnalysisBackward( rootSESE, true, null, fmMain.getFlatExit() ); + if( state.MLPDEBUG ) { + //System.out.println( "\nSESE Liveness\n-------------\n" ); printSESELiveness(); + //System.out.println( "\nLiveness Root View\n------------------\n"+fmMain.printMethod( livenessRootView ) ); + } // 5th pass @@ -127,6 +145,9 @@ public class MLPAnalysis { // point, in a forward fixed-point pass notAvailableForward( fm ); } + if( state.MLPDEBUG ) { + System.out.println( "\nNot Available Results\n---------------------\n"+fmMain.printMethod( notAvailableResults ) ); + } // 5th pass @@ -138,16 +159,18 @@ public class MLPAnalysis { // compute a plan for code injections computeStallsForward( fm ); } + if( state.MLPDEBUG ) { + System.out.println( "\nCode Plans\n----------\n"+fmMain.printMethod( codePlans ) ); + } - if( state.MLPDEBUG ) { - System.out.println( "" ); - //System.out.println( "\nSESE Hierarchy\n--------------\n" ); printSESEHierarchy(); - //System.out.println( "\nSESE Liveness\n-------------\n" ); printSESELiveness(); - //System.out.println( "\nLiveness Root View\n------------------\n"+fmMain.printMethod( livenessRootView ) ); - //System.out.println( "\nVariable Results\n----------------\n"+fmMain.printMethod( variableResults ) ); - //System.out.println( "\nNot Available Results\n---------------------\n"+fmMain.printMethod( notAvailableResults ) ); - //System.out.println( "\nCode Plans\n----------\n"+fmMain.printMethod( codePlans ) ); + // splice new IR nodes into graph after all + // analysis passes are complete + Iterator spliceItr = wdvNodesToSpliceIn.entrySet().iterator(); + while( spliceItr.hasNext() ) { + Map.Entry me = (Map.Entry) spliceItr.next(); + FlatWriteDynamicVarNode fwdvn = (FlatWriteDynamicVarNode) me.getValue(); + fwdvn.spliceIntoIR(); } @@ -777,7 +800,10 @@ public class MLPAnalysis { Iterator inVarItr = fsen.getInVarSet().iterator(); while( inVarItr.hasNext() ) { TempDescriptor inVar = inVarItr.next(); - Integer srcType = vstTable.getRefVarSrcType( inVar, fsen.getParent() ); + Integer srcType = + vstTable.getRefVarSrcType( inVar, + fsen, + fsen.getParent() ); if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) { fsen.addDynamicInVar( inVar ); @@ -820,10 +846,6 @@ public class MLPAnalysis { // fall through to this default case default: { - // decide if we must stall for variables dereferenced at this node - Set potentialStallSet = - vstTable.getChildrenVSTs( currentSESE ); - // a node with no live set has nothing to stall for Set liveSet = livenessRootView.get( fn ); if( liveSet == null ) { @@ -841,21 +863,24 @@ public class MLPAnalysis { } // check the source type of this variable - Integer srcType = vstTable.getRefVarSrcType( readtmp, - currentSESE.getParent() ); + Integer srcType + = vstTable.getRefVarSrcType( readtmp, + currentSESE, + currentSESE.getParent() ); + + + System.out.println( "considering stall on "+readtmp+" for "+currentSESE ); if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) { - // identify that this is a stall, and allocate an integer - // pointer in the generated code that keeps a pointer to - // the source SESE and the address of where to get this thing - // --then the stall is just wait for that, and copy the - // one thing because we're not sure if we can copy other stuff - - // NEEDS WORK! - - - } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) { + // 1) It is not clear statically where this variable will + // come from statically, so dynamically we must keep track + // along various control paths, and therefore when we stall, + // just stall for the exact thing we need and move on + plan.addDynamicStall( readtmp ); + currentSESE.addDynamicStallVar( readtmp ); + System.out.println( "ADDING "+readtmp+" TO "+currentSESE+" DYNSTALLSET" ); + } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) { // 2) Single token/age pair: Stall for token/age pair, and copy // all live variables with same token/age pair at the same // time. This is the same stuff that the notavaialable analysis @@ -915,23 +940,39 @@ public class MLPAnalysis { currentSESE.mustTrackAtLeastAge( vst.getAge() ); } - // if any variable at this node has a static source (exactly one sese) - // but goes to a dynamic source at a next node, write its dynamic addr - Set static2dynamicSet = new HashSet(); + + codePlans.put( fn, plan ); + + + // if any variables at this node have a static source (exactly one vst) + // but go to a dynamic source at a next node, create a new IR graph + // node on that edge to track the sources dynamically for( int i = 0; i < fn.numNext(); i++ ) { FlatNode nn = fn.getNext( i ); VarSrcTokTable nextVstTable = variableResults.get( nn ); + // the table can be null if it is one of the few IR nodes // completely outside of the root SESE scope if( nextVstTable != null ) { - static2dynamicSet.addAll( vstTable.getStatic2DynamicSet( nextVstTable ) ); - } - } - if( !static2dynamicSet.isEmpty() ) { - plan.setWriteToDynamicSrc( static2dynamicSet ); + Hashtable static2dynamicSet = + vstTable.getStatic2DynamicSet( nextVstTable ); + + if( !static2dynamicSet.isEmpty() ) { + + // either add these results to partial fixed-point result + // or make a new one if we haven't made any here yet + FlatEdge fe = new FlatEdge( fn, nn ); + FlatWriteDynamicVarNode fwdvn = wdvNodesToSpliceIn.get( fe ); + + if( fwdvn == null ) { + fwdvn = new FlatWriteDynamicVarNode( fn, nn, static2dynamicSet ); + wdvNodesToSpliceIn.put( fe, fwdvn ); + } else { + fwdvn.addMoreVar2Src( static2dynamicSet ); + } + } + } } - - codePlans.put( fn, plan ); } } diff --git a/Robust/src/Analysis/MLP/VarSrcTokTable.java b/Robust/src/Analysis/MLP/VarSrcTokTable.java index 29b234fe..a9078cc8 100644 --- a/Robust/src/Analysis/MLP/VarSrcTokTable.java +++ b/Robust/src/Analysis/MLP/VarSrcTokTable.java @@ -461,23 +461,29 @@ public class VarSrcTokTable { // given a table from a subsequent program point, decide // which variables are going from a static source to a // dynamic source and return them - public Set getStatic2DynamicSet( VarSrcTokTable next ) { + public Hashtable getStatic2DynamicSet( VarSrcTokTable next ) { - Set out = new HashSet(); + Hashtable out = + new Hashtable(); Iterator itr = var2vst.entrySet().iterator(); while( itr.hasNext() ) { Map.Entry me = (Map.Entry) itr.next(); TempDescriptor var = (TempDescriptor) me.getKey(); HashSet s1 = (HashSet) me.getValue(); - + + // this is a variable with a static source if it + // currently has one vst if( s1.size() == 1 ) { - // this is a variable with a static source Set s2 = next.get( var ); - + + // and if in the next table, it is dynamic, then + // this is a transition point, so if( s2.size() > 1 ) { - // and in the next table, it is dynamic - out.addAll( s1 ); + + // remember the variable and the only source + // it had before crossing the transition + out.put( var, s1.iterator().next() ); } } } @@ -495,25 +501,35 @@ public class VarSrcTokTable { // 3. Dynamic -- we don't know where the value will come // from, so we'll track it dynamically public Integer getRefVarSrcType( TempDescriptor refVar, + FlatSESEEnterNode current, FlatSESEEnterNode parent ) { assert refVar != null; - if( parent == null ) { + // if you have no parent (root) and the variable in + // question is in your in-set, it's a command line + // argument and it is definitely available + if( parent == null && + current.getInVarSet().contains( refVar ) ) { return SrcType_READY; } Set srcs = get( refVar ); assert !srcs.isEmpty(); + // if the variable may have more than one source, or that + // source is at the summary age, it must be tracked dynamically if( srcs.size() > 1 || srcs.iterator().next().getAge() == MLPAnalysis.maxSESEage ) { return SrcType_DYNAMIC; } + // if it has one source that comes from the parent, it's ready if( srcs.iterator().next().getSESE() == parent ) { return SrcType_READY; } + // otherwise it comes from one source not the parent (sibling) + // and we know exactly which static SESE/age it will come from return SrcType_STATIC; } diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 6c4bc13d..fa56edcf 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -1865,13 +1865,29 @@ public class BuildCode { } - // declare variables for naming SESE's + // declare variables for naming static SESE's Iterator pItr = fsen.getNeededStaticNames().iterator(); while( pItr.hasNext() ) { SESEandAgePair p = pItr.next(); output.println(" void* "+p+";"); } + // declare variables for tracking dynamic sources + Set dynSrcVars = new HashSet(); + dynSrcVars.addAll( fsen.getDynamicStallVarSet() ); + Iterator childItr = fsen.getChildren().iterator(); + while( childItr.hasNext() ) { + FlatSESEEnterNode child = childItr.next(); + dynSrcVars.addAll( child.getDynamicInVarSet() ); + } + Iterator dynItr = dynSrcVars.iterator(); + while( dynItr.hasNext() ) { + TempDescriptor dynVar = dynItr.next(); + output.println(" void* "+dynVar+"_srcSESE;"); + output.println(" INTPTR "+dynVar+"_srcAddr;"); + } + + // declare local temps for in-set primitives, and if it is // a ready-source variable, get the value from the record Iterator itrInSet = fsen.getInVarSet().iterator(); @@ -1904,16 +1920,13 @@ public class BuildCode { to = "(void*) "; size = "sizeof "; } else { - //to = "(void*) &("+temp.getSafeSymbol()+")"; to = temp.getSafeSymbol(); size = "sizeof( "+temp.getSafeSymbol()+" )"; } SESEandAgePair srcPair = new SESEandAgePair( vst.getSESE(), vst.getAge() ); - //String from = "(void*) &("+paramsprefix+"->"+srcPair+"->"+vst.getAddrVar()+")"; String from = paramsprefix+"->"+srcPair+"->"+vst.getAddrVar(); - //output.println(" memcpy( "+to+", "+from+", "+size+" );"); output.println(" "+to+" = "+from+";"); } @@ -2263,12 +2276,19 @@ public class BuildCode { output.println(" "+td.getSafeSymbol()+" = child->"+ vst.getAddrVar().getSafeSymbol()+";"); - //output.println("printf(\"copied %d into "+td.getSafeSymbol()+" from "+vst.getAddrVar().getSafeSymbol()+ - //"\\n\", "+td.getSafeSymbol()+" );"); } output.println(" }"); } + + + // for each variable with a dynamic source, stall just + // for that variable + Iterator dynItr = cp.getDynamicStallSet().iterator(); + while( dynItr.hasNext() ) { + TempDescriptor dynVar = dynItr.next(); + + } } } @@ -2292,6 +2312,10 @@ public class BuildCode { case FKind.FlatSESEExitNode: generateFlatSESEExitNode(fm, lb, (FlatSESEExitNode)fn, output); break; + + case FKind.FlatWriteDynamicVarNode: + generateFlatWriteDynamicVarNode(fm, lb, (FlatWriteDynamicVarNode)fn, output); + break; case FKind.FlatGlobalConvNode: generateFlatGlobalConvNode(fm, lb, (FlatGlobalConvNode) fn, output); @@ -2387,17 +2411,6 @@ public class BuildCode { CodePlan cp = mlpa.getCodePlan( fn ); if( cp != null ) { - - /* - Set writeDynamic = cp.getWriteToDynamicSrc(); - if( writeDynamic != null ) { - Iterator vstItr = writeDynamic.iterator(); - while( vstItr.hasNext() ) { - VariableSourceToken vst = vstItr.next(); - - } - } - */ } } } @@ -2876,6 +2889,43 @@ public class BuildCode { output.println(" psem_give( &("+paramsprefix+"->common.stallSem) );"); } } + + public void generateFlatWriteDynamicVarNode( FlatMethod fm, + LocalityBinding lb, + FlatWriteDynamicVarNode fwdvn, + PrintWriter output + ) { + if( !state.MLP ) { + // should node should not be in an IR graph if the + // MLP flag is not set + throw new Error("Unexpected presence of FlatWriteDynamicVarNode"); + } + + Hashtable writeDynamic = + fwdvn.getVar2src(); + + assert writeDynamic != null; + + Iterator wdItr = writeDynamic.entrySet().iterator(); + while( wdItr.hasNext() ) { + Map.Entry me = (Map.Entry) wdItr.next(); + TempDescriptor var = (TempDescriptor) me.getKey(); + VariableSourceToken vst = (VariableSourceToken) me.getValue(); + + SESEandAgePair instance = new SESEandAgePair( vst.getSESE(), vst.getAge() ); + + output.println(" {"); + output.println(" "+var+"_srcSESE = "+instance+";"); + + output.println(" "+vst.getSESE().getSESErecordName()+"* rec = ("+ + vst.getSESE().getSESErecordName()+") "+ + instance+";"); + + output.println(" "+var+"_srcAddr = (INTPTR) &(rec->"+vst.getAddrVar()+");"); + output.println(" }"); + } + } + private void generateFlatCheckNode(FlatMethod fm, LocalityBinding lb, FlatCheckNode fcn, PrintWriter output) { if (state.CONSCHECK) { diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java index 6a250cc8..f6d7797b 100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ b/Robust/src/IR/Flat/BuildFlat.java @@ -1178,6 +1178,7 @@ public class BuildFlat { FlatSESEEnterNode fsen=sn.getStart().getFlatEnter(); fsexn.setFlatEnter(fsen); sn.getStart().getFlatEnter().setFlatExit( fsexn ); + return new NodePair(fsexn, fsexn); } diff --git a/Robust/src/IR/Flat/FKind.java b/Robust/src/IR/Flat/FKind.java index 58f81158..2ba61b50 100644 --- a/Robust/src/IR/Flat/FKind.java +++ b/Robust/src/IR/Flat/FKind.java @@ -25,6 +25,7 @@ public class FKind { public static final int FlatOffsetNode=22; public static final int FlatSESEEnterNode=23; public static final int FlatSESEExitNode=24; - public static final int FlatInstanceOfNode=25; - public static final int FlatExit=26; + public static final int FlatWriteDynamicVarNode=25; + public static final int FlatInstanceOfNode=26; + public static final int FlatExit=27; } diff --git a/Robust/src/IR/Flat/FlatEdge.java b/Robust/src/IR/Flat/FlatEdge.java new file mode 100644 index 00000000..548ab7e2 --- /dev/null +++ b/Robust/src/IR/Flat/FlatEdge.java @@ -0,0 +1,42 @@ +package IR.Flat; + +public class FlatEdge { + + protected FlatNode tail; + protected FlatNode head; + + public FlatEdge( FlatNode t, FlatNode h ) { + assert t != null; + assert h != null; + tail = t; + head = h; + } + + public boolean equals( Object o ) { + if( o == null ) { + return false; + } + + if( !(o instanceof FlatEdge) ) { + return false; + } + + FlatEdge fe = (FlatEdge) o; + + return tail.equals( fe.tail ) && head.equals( fe.head ); + } + + public int hashCode() { + int tailHC = tail.hashCode(); + int headHC = head.hashCode(); + + int hash = 7; + hash = 31*hash + tailHC; + hash = 31*hash + headHC; + return hash; + } + + public String toString() { + return "FlatEdge("+tail+"->"+head+")"; + } +} diff --git a/Robust/src/IR/Flat/FlatNode.java b/Robust/src/IR/Flat/FlatNode.java index ba2c3a8d..c2a3cf9d 100644 --- a/Robust/src/IR/Flat/FlatNode.java +++ b/Robust/src/IR/Flat/FlatNode.java @@ -33,9 +33,14 @@ public class FlatNode { next.add(n); n.addPrev(this); } + + public void removeNext(FlatNode n) { + next.remove(n); + } public void removePrev(FlatNode n) { prev.remove(n); } + /** This function modifies the graph */ public void setNext(int i, FlatNode n) { FlatNode old=getNext(i); diff --git a/Robust/src/IR/Flat/FlatSESEEnterNode.java b/Robust/src/IR/Flat/FlatSESEEnterNode.java index cd0d17a1..209a5961 100644 --- a/Robust/src/IR/Flat/FlatSESEEnterNode.java +++ b/Robust/src/IR/Flat/FlatSESEEnterNode.java @@ -21,16 +21,19 @@ public class FlatSESEEnterNode extends FlatNode { protected Integer oldestAgeToTrack; protected Set children; - protected Set inVars; - protected Set outVars; - protected Set needStaticNameInCode; + protected Set inVars; + protected Set outVars; - protected Set staticInVarSrcs; + protected Set needStaticNameInCode; - protected Set readyInVars; - protected Set staticInVars; - protected Set dynamicInVars; + protected Set staticInVarSrcs; + + protected Set readyInVars; + protected Set staticInVars; + protected Set dynamicInVars; + + protected Set dynamicStallVars; protected Hashtable staticInVar2src; @@ -60,6 +63,7 @@ public class FlatSESEEnterNode extends FlatNode { readyInVars = new HashSet(); staticInVars = new HashSet(); dynamicInVars = new HashSet(); + dynamicStallVars = new HashSet(); staticInVar2src = new Hashtable(); } @@ -233,6 +237,14 @@ public class FlatSESEEnterNode extends FlatNode { return dynamicInVars; } + public void addDynamicStallVar( TempDescriptor td ) { + dynamicStallVars.add( td ); + } + + public Set getDynamicStallVarSet() { + return dynamicStallVars; + } + public void mustTrackAtLeastAge( Integer age ) { if( age > oldestAgeToTrack ) { oldestAgeToTrack = new Integer( age ); diff --git a/Robust/src/IR/Flat/FlatWriteDynamicVarNode.java b/Robust/src/IR/Flat/FlatWriteDynamicVarNode.java new file mode 100644 index 00000000..ac9cad81 --- /dev/null +++ b/Robust/src/IR/Flat/FlatWriteDynamicVarNode.java @@ -0,0 +1,57 @@ +package IR.Flat; +import Analysis.MLP.VariableSourceToken; +import java.util.Hashtable; + + +// This node is inserted by the MLP analysis +// in between a (tail -> head) IR graph edge. +// It is for tracking SESE variables with +// dynamic sources +public class FlatWriteDynamicVarNode extends FlatNode { + + + protected FlatNode tailNode; + protected FlatNode headNode; + + protected Hashtable var2src; + + + public FlatWriteDynamicVarNode( FlatNode t, + FlatNode h, + Hashtable v2s + ) { + tailNode = t; + headNode = h; + var2src = v2s; + } + + public void spliceIntoIR() { + tailNode.removeNext( headNode ); + headNode.removePrev( tailNode ); + + tailNode.addNext( this ); + this.addNext( headNode ); + } + + public void addMoreVar2Src( Hashtable more ) { + var2src.putAll( more ); + } + + public Hashtable getVar2src() { + return var2src; + } + + public String toString() { + return "writeDynVars "+var2src.keySet(); + } + + public int kind() { + return FKind.FlatWriteDynamicVarNode; + } + + public FlatNode clone(TempMap t) { + return new FlatWriteDynamicVarNode( tailNode, headNode, var2src ); + } + public void rewriteUse(TempMap t) { + } +} diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 56800060..6df19dfc 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -320,13 +320,6 @@ public class Main { } } - if (state.FLATIRGRAPH) { - FlatIRGraph firg = new FlatIRGraph(state, - state.FLATIRGRAPHTASKS, - state.FLATIRGRAPHUSERMETHODS, - state.FLATIRGRAPHLIBMETHODS); - } - if (state.OWNERSHIP && !state.MLP) { CallGraph callGraph = new CallGraph(state); OwnershipAnalysis oa = new OwnershipAnalysis(state, @@ -353,6 +346,13 @@ public class Main { oa); } + if (state.FLATIRGRAPH) { + FlatIRGraph firg = new FlatIRGraph(state, + state.FLATIRGRAPHTASKS, + state.FLATIRGRAPHUSERMETHODS, + state.FLATIRGRAPHLIBMETHODS); + } + if (state.TAGSTATE) { CallGraph callgraph=new CallGraph(state); TagAnalysis taganalysis=new TagAnalysis(state, callgraph); diff --git a/Robust/src/Tests/mlp/tinyTest/makefile b/Robust/src/Tests/mlp/tinyTest/makefile index 67e822cc..0b22c179 100644 --- a/Robust/src/Tests/mlp/tinyTest/makefile +++ b/Robust/src/Tests/mlp/tinyTest/makefile @@ -4,7 +4,7 @@ SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript -USEMLP= -mlp 1 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken +#USEMLP= -mlp 1 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken BSFLAGS= -nooptimize -debug -garbagestats -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt all: $(PROGRAM).bin diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index 9ddb52e4..b316a5f0 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -3,44 +3,30 @@ public class Foo { } +// TODO +// -dynamic variables +// -objects + + public class Test { public static void main( String args[] ) { int x = Integer.parseInt( args[0] ); int y = Integer.parseInt( args[1] ); - System.out.println( "root: x="+x+", y="+y ); - //Foo f; - - sese fi { - //if( true ) { - - System.out.println( "fi: x="+x+", y="+y ); - - x = y + 2; - y = 3; - - //f = new Foo(); - //} - } - - - // just for testing root's ability to - // realize a single exit after all returns - // DOESN'T WORK! - /* - if( false ) { - return; + if( x > 3 ) { + sese fi { + y = y + 10; + } } - */ - + // see that values from sese fi are // forwarded to this sibling - sese fo { - System.out.println( "fo: x="+x+", y="+y ); - } + //sese fo { + System.out.println( "fo: x="+x+", y="+y ); + //} /* float xyz = 2.0f; @@ -48,13 +34,11 @@ public class Test { */ - //Integer i; - //afunc( i ); - } - - /* - public static void afunc( Integer i ) { - i = null; + // just for testing root's ability to + // realize a single exit after all returns + // DOESN'T WORK! + //if( false ) { + // return; + //} } - */ }