From: yeom Date: Mon, 12 Dec 2011 19:51:01 +0000 (+0000) Subject: fix another bug: callee propagated wrong write effects associated with its local... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f876c75f71f46ec9b749a9007859aa924bd1eb5d;p=IRC.git fix another bug: callee propagated wrong write effects associated with its local vars to the caller's may-write set. --- diff --git a/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java b/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java index 1e31d7d6..2e1598d2 100644 --- a/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java +++ b/Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java @@ -933,35 +933,33 @@ public class DefinitelyWrittenCheck { Hashtable> mapArgIdx2CallerArgLocationPath = new Hashtable>(); - // arg idx is starting from 'this' arg if (fc.getThis() != null) { - // loc path for 'this' - NTuple thisLocationPath = deriveLocationTuple(mdCaller, fc.getThis()); - if (thisLocationPath != null) { - mapArgIdx2CallerArgLocationPath.put(Integer.valueOf(0), thisLocationPath); - // heap path for 'this' + if (mapHeapPath.containsKey(fc.getThis())) { + + // setup heap path for 'this' NTuple thisHeapPath = new NTuple(); - if (mapHeapPath.containsKey(fc.getThis())) { - thisHeapPath.addAll(mapHeapPath.get(fc.getThis())); - } else { - // method is called without creating new flat node representing - // 'this' - thisHeapPath.add(fc.getThis()); - } + thisHeapPath.addAll(mapHeapPath.get(fc.getThis())); mapArgIdx2CallerArgHeapPath.put(Integer.valueOf(0), thisHeapPath); + + // setup location path for 'this' + NTuple thisLocationPath = deriveLocationTuple(mdCaller, fc.getThis()); + mapArgIdx2CallerArgLocationPath.put(Integer.valueOf(0), thisLocationPath); + } } for (int i = 0; i < fc.numArgs(); i++) { TempDescriptor arg = fc.getArg(i); // create mapping arg to loc path - NTuple argLocationPath = deriveLocationTuple(mdCaller, arg); - if (argLocationPath != null) { - mapArgIdx2CallerArgLocationPath.put(Integer.valueOf(i + 1), argLocationPath); - // create mapping arg to heap path - NTuple argHeapPath = computePath(arg); + + if (mapHeapPath.containsKey(arg)) { + // setup heap path + NTuple argHeapPath = mapHeapPath.get(arg); mapArgIdx2CallerArgHeapPath.put(Integer.valueOf(i + 1), argHeapPath); + // setup loc path + NTuple argLocationPath = deriveLocationTuple(mdCaller, arg); + mapArgIdx2CallerArgLocationPath.put(Integer.valueOf(i + 1), argLocationPath); } } @@ -1755,13 +1753,10 @@ public class DefinitelyWrittenCheck { // arg idx is starting from 'this' arg if (fc.getThis() != null) { NTuple thisHeapPath = mapHeapPath.get(fc.getThis()); - if (thisHeapPath == null) { - // method is called without creating new flat node representing 'this' - thisHeapPath = new NTuple(); - thisHeapPath.add(fc.getThis()); + if (thisHeapPath != null) { + // if 'this' does not have heap path, it is local reference + mapArgIdx2CallerArgHeapPath.put(Integer.valueOf(0), thisHeapPath); } - - mapArgIdx2CallerArgHeapPath.put(Integer.valueOf(0), thisHeapPath); } for (int i = 0; i < fc.numArgs(); i++) {