From: yeom Date: Sat, 20 Aug 2011 08:49:24 +0000 (+0000) Subject: changes. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=bafdf8895425a699f5550a970a2c8144e06ae1e2 changes. --- diff --git a/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java b/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java index 21d7b33c..c6d2b358 100644 --- a/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java +++ b/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java @@ -783,14 +783,10 @@ public class DefinitelyWrittenCheck { assert ssjavaLoopEntrance != null; - System.out.println("ssjavaLoopEntrance=" + ssjavaLoopEntrance); - // assume that ssjava loop is top-level loop in method, not nested loop Set nestedLoop = loopFinder.nestedLoops(); for (Iterator loopIter = nestedLoop.iterator(); loopIter.hasNext();) { LoopFinder lf = (LoopFinder) loopIter.next(); - System.out.println("lf=" + lf.loopEntrances()); - System.out.println("elements=" + lf.loopIncElements()); if (lf.loopEntrances().iterator().next().equals(ssjavaLoopEntrance)) { ssjavaLoop = lf; } @@ -913,9 +909,9 @@ public class DefinitelyWrittenCheck { TypeDescriptor td = rhs.getType().dereference(); fld = getArrayField(td); } - - if(fld.isFinal() && fld.isStatic()){ - // if field is final and static, no need to check + + if (fld.isFinal() /* && fld.isStatic() */) { + // if field is final and static, no need to check break; } @@ -961,7 +957,6 @@ public class DefinitelyWrittenCheck { case FKind.FlatCall: { FlatCall fc = (FlatCall) fn; bindHeapPathCallerArgWithCaleeParam(fc); - // add in which hp is an element of // READ_bound set // of callee: callee has 'read' requirement! @@ -1157,7 +1152,8 @@ public class DefinitelyWrittenCheck { (LinkedList) sortedDescriptors.clone(); // no need to analyze method having ssjava loop - methodContainingSSJavaLoop = descriptorListToAnalyze.removeFirst(); + // methodContainingSSJavaLoop = descriptorListToAnalyze.removeFirst(); + methodContainingSSJavaLoop = ssjava.getMethodContainingSSJavaLoop(); // current descriptors to visit in fixed-point interprocedural analysis, // prioritized by @@ -1302,9 +1298,9 @@ public class DefinitelyWrittenCheck { TypeDescriptor td = rhs.getType().dereference(); fld = getArrayField(td); } - - if(fld.isFinal() && fld.isStatic()){ - // if field is final and static, no need to check + + if (fld.isFinal() /* && fld.isStatic() */) { + // if field is final and static, no need to check break; } @@ -1372,24 +1368,26 @@ public class DefinitelyWrittenCheck { FlatCall fc = (FlatCall) fn; - bindHeapPathCallerArgWithCaleeParam(fc); + if (fc.getThis() != null) { + bindHeapPathCallerArgWithCaleeParam(fc); - // add heap path, which is an element of READ_bound set and is not - // an - // element of WT set, to the caller's READ set - for (Iterator iterator = calleeUnionBoundReadSet.iterator(); iterator.hasNext();) { - NTuple read = (NTuple) iterator.next(); - if (!writtenSet.contains(read)) { - readSet.add(read); + // add heap path, which is an element of READ_bound set and is not + // an + // element of WT set, to the caller's READ set + for (Iterator iterator = calleeUnionBoundReadSet.iterator(); iterator.hasNext();) { + NTuple read = (NTuple) iterator.next(); + if (!writtenSet.contains(read)) { + readSet.add(read); + } } - } - writtenSet.removeAll(calleeUnionBoundReadSet); + writtenSet.removeAll(calleeUnionBoundReadSet); - // add heap path, which is an element of OVERWRITE_bound set, to the - // caller's WT set - for (Iterator iterator = calleeIntersectBoundOverWriteSet.iterator(); iterator.hasNext();) { - NTuple write = (NTuple) iterator.next(); - writtenSet.add(write); + // add heap path, which is an element of OVERWRITE_bound set, to the + // caller's WT set + for (Iterator iterator = calleeIntersectBoundOverWriteSet.iterator(); iterator.hasNext();) { + NTuple write = (NTuple) iterator.next(); + writtenSet.add(write); + } } } diff --git a/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java b/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java index 5dbcc8ad..778c0553 100644 --- a/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java +++ b/Robust/src/Analysis/SSJava/MethodAnnotationCheck.java @@ -282,6 +282,7 @@ public class MethodAnnotationCheck { if (isSSJavaLoop) { throw new Error("Only outermost loop can be the self-stabilizing loop."); } else { + ssjava.setMethodContainingSSJavaLoop(md); annotatedMDSet.add(md); isSSJavaLoop = true; } diff --git a/Robust/src/Analysis/SSJava/SSJavaAnalysis.java b/Robust/src/Analysis/SSJava/SSJavaAnalysis.java index 70944c9c..fb137633 100644 --- a/Robust/src/Analysis/SSJava/SSJavaAnalysis.java +++ b/Robust/src/Analysis/SSJava/SSJavaAnalysis.java @@ -77,6 +77,9 @@ public class SSJavaAnalysis { // the set of method descriptors annotated as "TRUST" Set trustWorthyMDSet; + // points to method containing SSJAVA Loop + private MethodDescriptor methodContainingSSJavaLoop; + CallGraph callgraph; LinearTypeCheck checker; @@ -104,10 +107,10 @@ public class SSJavaAnalysis { // if (state.SSJAVADEBUG) { // debugPrint(); // } - // parseLocationAnnotation(); + parseLocationAnnotation(); // doFlowDownCheck(); - // doDefinitelyWrittenCheck(); - debugDoLoopCheck(); + doDefinitelyWrittenCheck(); + // debugDoLoopCheck(); } private void debugDoLoopCheck() { @@ -494,4 +497,11 @@ public class SSJavaAnalysis { return bf; } + public MethodDescriptor getMethodContainingSSJavaLoop() { + return methodContainingSSJavaLoop; + } + + public void setMethodContainingSSJavaLoop(MethodDescriptor methodContainingSSJavaLoop) { + this.methodContainingSSJavaLoop = methodContainingSSJavaLoop; + } } diff --git a/Robust/src/Tests/ssJava/mp3decoder/Header.java b/Robust/src/Tests/ssJava/mp3decoder/Header.java index 8dc5237f..b98fea93 100644 --- a/Robust/src/Tests/ssJava/mp3decoder/Header.java +++ b/Robust/src/Tests/ssJava/mp3decoder/Header.java @@ -119,7 +119,7 @@ public final class Header { Header() { } - + @LATTICE("OUT= 0; i--) { + TERMINATE: for (@LOC("C") int i = 31; i >= 0; i--) { samples[i] = s[i] * eq[i]; } }