From f7e1fcaa61eb541abb2f4c97143def6a7cbae143 Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 12 Aug 2009 17:58:16 +0000 Subject: [PATCH] tracked down more bugs in not-avail and variable analyses --- Robust/src/Analysis/MLP/MLPAnalysis.java | 32 +++++++++++++++------ Robust/src/Analysis/MLP/VarSrcTokTable.java | 23 +++++++++++++++ Robust/src/Tests/mlp/tinyTest/makefile | 2 +- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 6766027e..ed72c5ac 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -143,7 +143,7 @@ public class MLPAnalysis { pruneVariableResultsWithLiveness( fm ); } if( state.MLPDEBUG ) { - //System.out.println( "\nVariable Results-Out\n----------------\n"+fmMain.printMethod( variableResults ) ); + System.out.println( "\nVariable Results-Out\n----------------\n"+fmMain.printMethod( variableResults ) ); } @@ -494,8 +494,12 @@ public class MLPAnalysis { case FKind.FlatSESEEnterNode: { FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; assert fsen.equals( currentSESE ); + vstTable.age( currentSESE ); vstTable.assertConsistency(); + + vstTable.ownInSet( currentSESE ); + vstTable.assertConsistency(); } break; case FKind.FlatSESEExitNode: { @@ -738,8 +742,8 @@ public class MLPAnalysis { TempDescriptor rTemp = readTemps[i]; notAvailSet.remove( rTemp ); - // if this variable has exactly one source, mark everything - // else from that source as available as well + // if this variable has exactly one source, potentially + // get other things from this source as well VarSrcTokTable vstTable = variableResults.get( fn ); Integer srcType = @@ -754,9 +758,25 @@ public class MLPAnalysis { Iterator availItr = vstTable.get( vst.getSESE(), vst.getAge() ).iterator(); + + // look through things that are also available from same source while( availItr.hasNext() ) { VariableSourceToken vstAlsoAvail = availItr.next(); - notAvailSet.removeAll( vstAlsoAvail.getRefVars() ); + + Iterator refVarItr = vstAlsoAvail.getRefVars().iterator(); + while( refVarItr.hasNext() ) { + TempDescriptor refVarAlso = refVarItr.next(); + + // if a variable is available from the same source, AND it ALSO + // only comes from one statically known source, mark it available + Integer srcTypeAlso = + vstTable.getRefVarSrcType( refVarAlso, + currentSESE, + currentSESE.getParent() ); + if( srcTypeAlso.equals( VarSrcTokTable.SrcType_STATIC ) ) { + notAvailSet.remove( refVarAlso ); + } + } } } } @@ -903,9 +923,6 @@ public class MLPAnalysis { currentSESE, currentSESE.getParent() ); - - System.out.println( "considering stall on "+readtmp+" for "+currentSESE ); - if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) { // 1) It is not clear statically where this variable will // come from statically, so dynamically we must keep track @@ -913,7 +930,6 @@ public class MLPAnalysis { // 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 diff --git a/Robust/src/Analysis/MLP/VarSrcTokTable.java b/Robust/src/Analysis/MLP/VarSrcTokTable.java index 226eb6a6..0b07adbe 100644 --- a/Robust/src/Analysis/MLP/VarSrcTokTable.java +++ b/Robust/src/Analysis/MLP/VarSrcTokTable.java @@ -330,6 +330,29 @@ public class VarSrcTokTable { assertConsistency(); } + + // at an SESE enter node, all ref vars in the SESE's in-set will + // be copied into the SESE's local scope, change source to itself + public void ownInSet( FlatSESEEnterNode curr ) { + Iterator inVarItr = curr.getInVarSet().iterator(); + while( inVarItr.hasNext() ) { + TempDescriptor inVar = inVarItr.next(); + + remove( inVar ); + assertConsistency(); + + Set refVars = new HashSet(); + refVars.add( inVar ); + add( new VariableSourceToken( refVars, + curr, + new Integer( 0 ), + inVar + ) + ); + assertConsistency(); + } + } + // for the given SESE, change child tokens into this parent public void remapChildTokens( FlatSESEEnterNode curr ) { diff --git a/Robust/src/Tests/mlp/tinyTest/makefile b/Robust/src/Tests/mlp/tinyTest/makefile index 0b22c179..67e822cc 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 -- 2.34.1