From: jjenista Date: Thu, 11 Mar 2010 23:38:53 +0000 (+0000) Subject: debugging something else, but commiting this bug fix--mapping out-of-context nodes... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3f6bc5173cf6c0fd4156494b5fdea3d5e7430808;p=IRC.git debugging something else, but commiting this bug fix--mapping out-of-context nodes to a unique heap region id requires that the callee method be part of the identifier string otherwise an ooc region can appear in more than one context of a call chain, which is bad --- diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 283e0cd2..3afd0f8f 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1264,7 +1264,7 @@ public class ReachGraph { // this reach graph public ReachGraph makeCalleeView( FlatCall fc, - FlatMethod fm, + FlatMethod fmCallee, Set callerNodeIDsCopiedToCallee, boolean writeDebugDOTs ) { @@ -1286,16 +1286,16 @@ public class ReachGraph { // mechanically-reachable-from-arguments graph // as opposed to using reachability information // to prune the graph further - for( int i = 0; i < fm.numParameters(); ++i ) { + for( int i = 0; i < fmCallee.numParameters(); ++i ) { // for each parameter index, get the symbol in the // caller view and callee view // argument defined here is the symbol in the caller - TempDescriptor tdArg = fc.getArgMatchingParamIndex( fm, i ); + TempDescriptor tdArg = fc.getArgMatchingParamIndex( fmCallee, i ); // parameter defined here is the symbol in the callee - TempDescriptor tdParam = fm.getParameter( i ); + TempDescriptor tdParam = fmCallee.getParameter( i ); // use these two VariableNode objects to translate // between caller and callee--its easy to compare @@ -1528,6 +1528,7 @@ public class ReachGraph { // for consistency, map one out-of-context "identifier" // to one heap region node id, otherwise no convergence String oocid = "oocid"+ + fmCallee+ hrnCalleeAndInContext.getIDString()+ oocNodeType+ edgeMightCross.getType()+ @@ -1608,7 +1609,7 @@ public class ReachGraph { public void resolveMethodCall( FlatCall fc, - FlatMethod fm, + FlatMethod fmCallee, ReachGraph rgCallee, Set callerNodeIDsCopiedToCallee, boolean writeDebugDOTs @@ -1687,10 +1688,10 @@ public class ReachGraph { } // test param -> HRN edges, also - for( int i = 0; i < fm.numParameters(); ++i ) { + for( int i = 0; i < fmCallee.numParameters(); ++i ) { // parameter defined here is the symbol in the callee - TempDescriptor tdParam = fm.getParameter( i ); + TempDescriptor tdParam = fmCallee.getParameter( i ); VariableNode vnCallee = rgCallee.getVariableNodeFromTemp( tdParam ); Iterator reItr = vnCallee.iteratorToReferencees(); @@ -1837,7 +1838,7 @@ public class ReachGraph { // come into the caller if its from a param var VariableNode vnCallee = (VariableNode) rsnCallee; TempDescriptor tdParam = vnCallee.getTempDescriptor(); - TempDescriptor tdArg = fc.getArgMatchingParam( fm, + TempDescriptor tdArg = fc.getArgMatchingParam( fmCallee, tdParam ); if( tdArg == null ) { // this means the variable isn't a parameter, its local @@ -1861,11 +1862,22 @@ public class ReachGraph { // for out-of-context sources we have to find all // caller sources that might match assert hrnDstCaller != null; + + if( writeDebugDOTs ) { + System.out.println( " looking for matches for OOC: "+reCallee ); + } Iterator reItr = hrnDstCaller.iteratorToReferencers(); while( reItr.hasNext() ) { // the edge and field (either possibly null) must match RefEdge reCaller = reItr.next(); + + + if( writeDebugDOTs ) { + System.out.println( " considering: "+reCaller ); + } + + if( !reCaller.typeEquals ( reCallee.getType() ) || !reCaller.fieldEquals( reCallee.getField() ) ) { @@ -1887,6 +1899,12 @@ public class ReachGraph { } } + + if( writeDebugDOTs ) { + System.out.println( " took it" ); + } + + // it matches, add to sources of edges to make rsnCallers.add( rsnCaller ); } @@ -1991,12 +2009,12 @@ public class ReachGraph { hrnDstCallee.isSingleObject(), // single object? hrnDstCallee.isNewSummary(), // summary? hrnDstCallee.isFlagged(), // flagged? - false, // out-of-context? + false, // out-of-context? hrnDstCallee.getType(), // type hrnDstCallee.getAllocSite(), // allocation site hrnDstCallee.getInherent(), // inherent reach - null, // current reach - predsTrue, // predicates + null, // current reach + predsTrue, // predicates hrnDstCallee.getDescription() // description ); } else { diff --git a/Robust/src/Analysis/Disjoint/VariableNode.java b/Robust/src/Analysis/Disjoint/VariableNode.java index 7e58ea79..a2db14ca 100644 --- a/Robust/src/Analysis/Disjoint/VariableNode.java +++ b/Robust/src/Analysis/Disjoint/VariableNode.java @@ -7,7 +7,7 @@ import java.util.*; public class VariableNode extends RefSrcNode { protected TempDescriptor td; - public VariableNode(TempDescriptor td) { + public VariableNode( TempDescriptor td ) { this.td = td; } @@ -15,18 +15,18 @@ public class VariableNode extends RefSrcNode { return td; } - public boolean equals(Object o) { + public boolean equals( Object o ) { if( o == null ) { return false; } - if( !( o instanceof VariableNode) ) { + if( !(o instanceof VariableNode) ) { return false; } - VariableNode ln = (VariableNode) o; + VariableNode vn = (VariableNode) o; - return td == ln.getTempDescriptor(); + return td == vn.getTempDescriptor(); } public int hashCode() { @@ -38,6 +38,6 @@ public class VariableNode extends RefSrcNode { } public String toString() { - return "LN_"+getTempDescriptorString(); + return "VN_"+getTempDescriptorString(); } } diff --git a/Robust/src/Tests/disjoint/predicateTest2/makefile b/Robust/src/Tests/disjoint/predicateTest2/makefile index 628bc7d5..e80e242c 100644 --- a/Robust/src/Tests/disjoint/predicateTest2/makefile +++ b/Robust/src/Tests/disjoint/predicateTest2/makefile @@ -8,8 +8,8 @@ BUILDSCRIPT=~/research/Robust/src/buildscript #DEBUGFLAGS= -disjoint-debug-callsite Foo main 1 #DEBUGFLAGS= -disjoint-debug-callsite main analysisEntryMethod 1 -#DEBUGFLAGS= -disjoint-debug-callsite addSomething main 1 -DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1 +DEBUGFLAGS= -disjoint-debug-callsite addSomething main 1 +#DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1 #DEBUGFLAGS= -disjoint-debug-callsite Bar addBar 1 #DEBUGFLAGS= diff --git a/Robust/src/Tests/disjoint/predicateTest2/test.java b/Robust/src/Tests/disjoint/predicateTest2/test.java index ee4e9211..1ee29c72 100644 --- a/Robust/src/Tests/disjoint/predicateTest2/test.java +++ b/Robust/src/Tests/disjoint/predicateTest2/test.java @@ -13,29 +13,30 @@ public class Test { static public void main( String[] args ) { Foo f1 = new Foo(); - Foo extraVar = f1; + //Foo extraVar = f1; addSomething( f1 ); - Foo f2 = new Foo(); - addSomething( f2 ); + //Foo f2 = new Foo(); + //addSomething( f2 ); + /* Foo f3 = getAFoo(); Foo f4 = getAFoo(); f3.f = f4; + */ } public static void addSomething( Foo f ) { + f.b = new Bar(); //addBar( f ); } - public static void addBar( Foo g ) { - /* + public static void addBar( Foo g ) { if( true ) { g.b = new Bar(); } else { g.b = new Bar(); - } - */ + } } public static Foo getAFoo() {