From: yeom Date: Fri, 1 Jul 2011 18:48:51 +0000 (+0000) Subject: bug fixes and refactoring to have more smooth integration of loopOptimize and loopTer... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=78bbc8a139de273348fa628a28604d1e99f538df;p=IRC.git bug fixes and refactoring to have more smooth integration of loopOptimize and loopTerminate --- diff --git a/Robust/src/Analysis/Loops/LoopOptimize.java b/Robust/src/Analysis/Loops/LoopOptimize.java index 5b111ca3..8a096572 100644 --- a/Robust/src/Analysis/Loops/LoopOptimize.java +++ b/Robust/src/Analysis/Loops/LoopOptimize.java @@ -20,6 +20,7 @@ public class LoopOptimize { private GlobalFieldType gft; private TypeUtil typeutil; private Map fm2loopinv; + private LoopTerminate lt; private Hashtable ntoomap; private Hashtable clonemap; @@ -30,12 +31,14 @@ public class LoopOptimize { this.typeutil = typeutil; fm2loopinv = new HashMap(); } - - public void optimize(FlatMethod fm) { + + public void analyze(FlatMethod fm){ loopinv = new LoopInvariant(typeutil, gft); loopinv.analyze(fm); fm2loopinv.put(fm, loopinv); - + } + + public void optimize(FlatMethod fm) { ntoomap=new Hashtable(); map=new Hashtable(); clonemap=new Hashtable(); diff --git a/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java b/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java index ec404bd9..d99f44f4 100644 --- a/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java +++ b/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java @@ -77,8 +77,10 @@ public class DefinitelyWrittenCheck { } public void definitelyWrittenCheck() { - methodReadOverWriteAnalysis(); - writtenAnalyis(); + if (!ssjava.getAnnotationRequireSet().isEmpty()) { + methodReadOverWriteAnalysis(); + writtenAnalyis(); + } } private void writtenAnalyis() { diff --git a/Robust/src/Analysis/SSJava/SSJavaAnalysis.java b/Robust/src/Analysis/SSJava/SSJavaAnalysis.java index f5357f35..ac27f7c3 100644 --- a/Robust/src/Analysis/SSJava/SSJavaAnalysis.java +++ b/Robust/src/Analysis/SSJava/SSJavaAnalysis.java @@ -277,6 +277,11 @@ public class SSJavaAnalysis { return annotationRequireSet; } + public void doLoopTerminationCheck(LoopOptimize lo, FlatMethod fm) { + LoopTerminate lt = new LoopTerminate(); + lt.terminateAnalysis(fm, lo.getLoopInvariant(fm)); + } + public void doLoopTerminationCheck(LoopOptimize lo) { LoopTerminate lt = new LoopTerminate(); for (Iterator iterator = annotationRequireSet.iterator(); iterator.hasNext();) { diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index c2bc4eb0..d48ad48b 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -508,8 +508,15 @@ public class Main { continue; cp.optimize(fm); dc.optimize(fm); - if (!state.NOLOOP) + if (!state.NOLOOP){ + lo.analyze(fm); + if(state.SSJAVA){ + ssjava.doLoopTerminationCheck(lo,fm); + } lo.optimize(fm); + } + + cp.optimize(fm); dc.optimize(fm); lcse.doAnalysis(fm); @@ -522,9 +529,6 @@ public class Main { } State.logEvent("Done Optimizing"); - if(state.SSJAVA) { - ssjava.doLoopTerminationCheck(lo); - } } if (state.FLATIRGRAPH) {