From b4546cf7f9a5788cfd5af0f08c5f6ce89c26670f Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 29 Apr 2009 21:51:12 +0000 Subject: [PATCH] stable capture, bug fixes--a problem: using an SESEs liveIn set liberally, some cases call for using an SESEs liveOut instead, I think, which is at least part of why no stalls are reported --- Robust/src/Analysis/MLP/MLPAnalysis.java | 33 ++++++++++----------- Robust/src/Analysis/MLP/VarSrcTokTable.java | 25 +++++++++++++--- Robust/src/Tests/mlp/tinyTest/test.java | 7 +++-- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index cd6759df..ec22eb0b 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -87,22 +87,23 @@ public class MLPAnalysis { } - // 4th pass + // 4th pass, compute liveness contribution from + // virtual reads discovered in variable pass + livenessResults = new Hashtable< FlatNode, Set >(); + livenessAnalysisBackward( rootSESE ); + + + // 5th pass methItr = ownAnalysis.descriptorsToAnalyze.iterator(); while( methItr.hasNext() ) { Descriptor d = methItr.next(); FlatMethod fm = state.getMethodFlat( d ); + // compute a plan for code injections computeStallsForward( fm ); } - // 5th pass, compute liveness contribution from - // virtual reads discovered in stall pass - livenessResults = new Hashtable< FlatNode, Set >(); - livenessAnalysisBackward( rootSESE ); - - double timeEndAnalysis = (double) System.nanoTime(); double dt = (timeEndAnalysis - timeStartAnalysis)/(Math.pow( 10.0, 9.0 ) ); String treport = String.format( "The mlp analysis took %.3f sec.", dt ); @@ -371,14 +372,13 @@ public class MLPAnalysis { assert currentSESE.getChildren().contains( fsen ); vstTable.remapChildTokens( fsen ); - Set liveIn = livenessResults.get( fn ); + Set liveIn = currentSESE.getInVarSet(); Set virLiveIn = vstTable.removeParentAndSiblingTokens( fsen, liveIn ); - Set virLiveInNew = livenessVirtualReads.get( fn ); - if( virLiveInNew == null ) { - virLiveInNew = new HashSet(); + Set virLiveInOld = livenessVirtualReads.get( fn ); + if( virLiveInOld != null ) { + virLiveIn.addAll( virLiveInOld ); } - virLiveInNew.addAll( virLiveIn ); - livenessVirtualReads.put( fn, virLiveInNew ); + livenessVirtualReads.put( fn, virLiveIn ); } break; case FKind.FlatOpNode: { @@ -504,10 +504,8 @@ public class MLPAnalysis { } break; default: { - Set stallSet = vstTable.getStallSet( currentSESE ); - - - Set liveIn = livenessResults.get( fn ); + Set stallSet = vstTable.getStallSet( currentSESE ); + Set liveIn = currentSESE.getInVarSet(); if( liveIn != null ) { stallSet.retainAll( liveIn ); @@ -515,7 +513,6 @@ public class MLPAnalysis { // there is nothing live, clear all stallSet.clear(); } - if( !stallSet.isEmpty() ) { s = "STALL for:"; diff --git a/Robust/src/Analysis/MLP/VarSrcTokTable.java b/Robust/src/Analysis/MLP/VarSrcTokTable.java index b71d2805..b01a16f6 100644 --- a/Robust/src/Analysis/MLP/VarSrcTokTable.java +++ b/Robust/src/Analysis/MLP/VarSrcTokTable.java @@ -395,7 +395,7 @@ public class VarSrcTokTable { // of A as a source for that variable: s is virtual reads protected void remove_A_if_B( FlatSESEEnterNode a, FlatSESEEnterNode b, - Set liveIn, + Set liveInCurrentSESE, Set virtualLiveIn ) { Set forRemoval = new HashSet(); @@ -410,12 +410,18 @@ public class VarSrcTokTable { forRemoval.add( vst ); // mark this variable as a virtual read as well - if( liveIn.contains( varLive ) ) { - virtualLiveIn.add( varLive ); - } + //if( liveInCurrentSESE.contains( varLive ) ) { ??????????? + virtualLiveIn.add( varLive ); + //} } } + /* + System.out.println( "remove "+a.getPrettyIdentifier()+" if "+b.getPrettyIdentifier() ); + System.out.println( "THIS "+toStringPretty() ); + System.out.println( "for removal="+forRemoval ); + */ + vstItr = forRemoval.iterator(); while( vstItr.hasNext() ) { VariableSourceToken vst = vstItr.next(); @@ -508,6 +514,17 @@ public class VarSrcTokTable { public String toStringPretty() { String tokHighlighter = "o"; + String str = "VarSrcTokTable\n"; + Iterator vstItr = trueSet.iterator(); + while( vstItr.hasNext() ) { + str += " "+tokHighlighter+" "+vstItr.next()+"\n"; + } + return str; + } + + public String toStringPrettyVerbose() { + String tokHighlighter = "o"; + String str = "VarSrcTokTable\n"; Set s; diff --git a/Robust/src/Tests/mlp/tinyTest/test.java b/Robust/src/Tests/mlp/tinyTest/test.java index e29ea038..cef2abe4 100644 --- a/Robust/src/Tests/mlp/tinyTest/test.java +++ b/Robust/src/Tests/mlp/tinyTest/test.java @@ -20,11 +20,12 @@ public class Test { */ int x = 1; + int y = 1; sese fi { - //if( true ) { - x = 2; - //} + if( true ) { + x = y + 2; + } } x = x + 1; -- 2.34.1