From 001c48225c8b3a820d1408bf22bfa1ca0ece5279 Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 24 Sep 2008 22:49:38 +0000 Subject: [PATCH] Bug fix where two isolated heap regions with empty reachability sets have a reference edge created between them. Actually, the reachability sets arent' empty, they contain the empty token tuple set, but the edge that gets created has the empty reachability set. Changed the field set method to detect this and fill it in. This is not a good fix, find the reason why it happens in the first place. --- .../OwnershipAnalysis/OwnershipGraph.java | 14 ++++++- .../OwnershipAnalysisTest/test01/test01.java | 42 +++++++++++++------ 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index a3a65298..50b4a515 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -433,6 +433,7 @@ public class OwnershipGraph { // then propagate back just up the edges from hrn ChangeTupleSet Cx = R.unionUpArityToChangeSet(O); + HashSet todoEdges = new HashSet(); Hashtable edgePlannedChanges = @@ -450,8 +451,19 @@ public class OwnershipGraph { edgesWithNewBeta); + if( edgeY.getBetaNew().equals( new ReachabilitySet() ) ) { + edgeY.setBetaNew( new ReachabilitySet( new TokenTupleSet().makeCanonical() ).makeCanonical() ); + } - //System.out.println( edgeY.getBetaNew() + "\nbeing pruned by\n" + hrnX.getAlpha() ); + /* + System.out.println( "---------------------------\n" + + edgeY.getBetaNew() + + "\nbeing pruned by\n" + + hrnX.getAlpha() + + "\nis\n" + + edgeY.getBetaNew().pruneBy(hrnX.getAlpha()) + ); + */ // create the actual reference edge hrnX.f -> hrnY ReferenceEdge edgeNew = new ReferenceEdge(hrnX, diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java index ee94e76a..77510319 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java @@ -3,17 +3,32 @@ public class Parameter { flag w; int a; int b; - Parameter f; - Parameter g; - Penguin p; - Foo h; + //Parameter f; + //Parameter g; + //Penguin p; + //Foo h; - public Parameter() { a = 0; b = 0; f = null; g = null; } + public Parameter() {} // a = 0; b = 0; f = null; g = null; } - public void bar() { foo(); } - public void foo() { bar(); } + //public void bar() { foo(); } + //public void foo() { bar(); } + + static public void proof( Fooz p0, Fooz p1 ) { + Fooz c = new Fooz(); + Fooz d = new Fooz(); + + c.x = d; + p0.x = c; + p1.x = d; + } +} + +public class Fooz { + public Fooz() {} + public Fooz x; } +/* public class Penguin { int x; int y; @@ -95,7 +110,6 @@ public class Foo { p0.x = g1; } - /* static public void m2_( Foo p0 ) { Foo g0 = new Foo(); @@ -166,9 +180,8 @@ public class Foo { p0.y = p1; p1.y = p0; } - */ } - +*/ // this empty task should still create a non-empty @@ -177,18 +190,20 @@ public class Foo { // a heap region that is multi-object, flagged, not summary task Startup( StartupObject s{ initialstate } ) { - Parameter p0 = new Parameter(); + //Parameter p0 = new Parameter(); //int a, b, c; + Parameter.proof( null, null ); + /* int a = 1; int b = 2; int c = 3; b = c; a = b; - + */ taskexit( s{ !initialstate } ); } @@ -458,6 +473,7 @@ task getNewFromMethod( Foo p0{ f } ) { } */ +/* task methodTest01_( Foo p0{ f }, Foo p1{ f } ) { Foo a0before = new Foo(); @@ -479,7 +495,7 @@ task methodTest01_( Foo p0{ f }, Foo p1{ f } ) { taskexit( p0{ !f }, p1{ !f } ); } - +*/ /* task methodTest02_( Foo p0{ f }, Foo p1{ f } ) { -- 2.34.1