From: jjenista Date: Fri, 21 Mar 2008 18:52:54 +0000 (+0000) Subject: Collect merge of FlatReturn ownership graphs for use in function call X-Git-Tag: preEdgeChange~222 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=27d39d83d9a4eca89b75b4b8eb48de4b52ffe79b;p=IRC.git Collect merge of FlatReturn ownership graphs for use in function call application. --- diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index a00b44d2..685ac580 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -77,6 +77,8 @@ public class OwnershipAnalysis { analyzeMethods(); } + // called from the constructor to help initialize the set + // of methods that needs to be analyzed by ownership analysis private void scheduleAllCallees( HashSet calleesScheduled, Descriptor d ) { if( calleesScheduled.contains( d ) ) { @@ -133,6 +135,8 @@ public class OwnershipAnalysis { if( !og.equals( ogPrev ) ) { mapDescriptorToCompleteOwnershipGraph.put( d, og ); + og.writeGraph( d ); + // only methods have dependents, tasks cannot // be invoked by any user program calls if( d instanceof MethodDescriptor ) { @@ -187,7 +191,10 @@ public class OwnershipAnalysis { // apply the analysis of the flat node to the // ownership graph made from the merge of the // parent graphs - analyzeFlatNode( mDesc, fn, og ); + analyzeFlatNode( mDesc, + fn, + returnNodesToCombineForCompleteOwnershipGraph, + og ); // if the results of the new graph are different from // the current graph at this node, replace the graph @@ -220,9 +227,10 @@ public class OwnershipAnalysis { private void - analyzeFlatNode( Descriptor methodDesc, - FlatNode fn, - OwnershipGraph og ) throws java.io.IOException { + analyzeFlatNode( Descriptor methodDesc, + FlatNode fn, + HashSet setRetNodes, + OwnershipGraph og ) throws java.io.IOException { TempDescriptor src; TempDescriptor dst; @@ -243,7 +251,7 @@ public class OwnershipAnalysis { TempDescriptor tdParam = fm.getParameter( i ); og.assignTempToParameterAllocation( methodDesc instanceof TaskDescriptor, tdParam ); - og.writeGraph( methodDesc, fn ); + //og.writeGraph( methodDesc, fn ); } break; @@ -253,7 +261,7 @@ public class OwnershipAnalysis { src = fon.getLeft(); dst = fon.getDest(); og.assignTempToTemp( src, dst ); - og.writeGraph( methodDesc, fn ); + //og.writeGraph( methodDesc, fn ); } break; @@ -264,7 +272,7 @@ public class OwnershipAnalysis { fld = ffn.getField(); if( !fld.getType().isPrimitive() ) { og.assignTempToField( src, dst, fld ); - og.writeGraph( methodDesc, fn ); + //og.writeGraph( methodDesc, fn ); } break; @@ -274,7 +282,7 @@ public class OwnershipAnalysis { dst = fsfn.getDst(); fld = fsfn.getField(); og.assignFieldToTemp( src, dst, fld ); - og.writeGraph( methodDesc, fn ); + //og.writeGraph( methodDesc, fn ); break; case FKind.FlatNew: @@ -293,11 +301,13 @@ public class OwnershipAnalysis { //MethodDescriptor md = fc.getMethod(); //descriptorsToVisit.add( md ); //System.out.println( " Descs to visit: " + descriptorsToVisit ); - og.writeGraph( methodDesc, fn ); + //og.writeGraph( methodDesc, fn ); break; case FKind.FlatReturnNode: - og.writeGraph( methodDesc, fn ); + FlatReturnNode frn = (FlatReturnNode) fn; + setRetNodes.add( frn ); + //og.writeGraph( methodDesc, fn ); break; } } diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index dd841365..ba53898e 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -875,15 +875,37 @@ public class OwnershipGraph { } + /* + // use this method to determine if two temp descriptors can possibly + // access the same heap regions, which means there is a possible alias + public boolean havePossibleAlias( TempDescriptor td1, + TempDescriptor td2 ) { + + + return false; + } + */ + + // for writing ownership graphs to dot files public void writeGraph( Descriptor methodDesc, FlatNode fn ) throws java.io.IOException { - - String graphName = - methodDesc.getSymbol() + - methodDesc.getNum() + - fn.toString(); + writeGraph( + methodDesc.getSymbol() + + methodDesc.getNum() + + fn.toString() + ); + } + + public void writeGraph( Descriptor methodDesc ) throws java.io.IOException { + writeGraph( + methodDesc.getSymbol() + + methodDesc.getNum() + + "COMPLETE" + ); + } + private void writeGraph( String graphName ) throws java.io.IOException { // remove all non-word characters from the graph name so // the filename and identifier in dot don't cause errors graphName = graphName.replaceAll( "[\\W]", "" ); diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java index dbe9ed9d..541f8dba 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java @@ -30,6 +30,8 @@ public class Baw { flag g; int y; public Baw() {} + + public void doTheBaw( Voo v ) { v = new Voo(); } } @@ -47,6 +49,8 @@ task Startup( StartupObject s{ initialstate } ) { // merely points to the newest region task NewObject( Voo v{ f } ) { Voo w = new Voo(); + Baw b = new Baw(); + b.doTheBaw( w ); taskexit( v{ !f } ); }