boolean isTask;
FlatMethod fm;
if( d instanceof MethodDescriptor ) {
- isTask = false;
+ //isTask = false;
fm = state.getMethodFlat( (MethodDescriptor) d );
} else {
assert d instanceof TaskDescriptor;
- isTask = true;
+ //isTask = true;
fm = state.getMethodFlat( (TaskDescriptor) d );
}
- OwnershipGraph og = analyzeFlatMethod( isTask, fm );
+ OwnershipGraph og = analyzeFlatMethod( d, fm );
OwnershipGraph ogPrev = mapDescriptorToCompleteOwnershipGraph.get( d );
if( !og.equals( ogPrev ) ) {
}
+ // keep passing the Descriptor of the method along for debugging
+ // and dot file writing
private OwnershipGraph
- analyzeFlatMethod( boolean isTask,
+ analyzeFlatMethod( Descriptor mDesc,
FlatMethod flatm ) throws java.io.IOException {
// initialize flat nodes to visit as the flat method
// apply the analysis of the flat node to the
// ownership graph made from the merge of the
// parent graphs
- analyzeFlatNode( isTask, fn, og );
+ analyzeFlatNode( mDesc, fn, og );
// if the results of the new graph are different from
// the current graph at this node, replace the graph
private void
- analyzeFlatNode( boolean isTask,
+ analyzeFlatNode( Descriptor methodDesc,
FlatNode fn,
OwnershipGraph og ) throws java.io.IOException {
// adding parameters labels to new heap regions
for( int i = 0; i < fm.numParameters(); ++i ) {
TempDescriptor tdParam = fm.getParameter( i );
- og.parameterAllocation( isTask, tdParam );
+ og.parameterAllocation( methodDesc instanceof TaskDescriptor,
+ tdParam );
+ og.writeGraph( methodDesc, fn );
}
break;
- /*
case FKind.FlatOpNode:
FlatOpNode fon = (FlatOpNode) fn;
if( fon.getOp().getOp() == Operation.ASSIGN ) {
src = fon.getLeft();
dst = fon.getDest();
og.assignTempToTemp( src, dst );
- //nodeDescription = "Op";
- //writeGraph = true;
- og.writeGraph( fn );
+ og.writeGraph( methodDesc, fn );
}
break;
fld = ffn.getField();
if( !fld.getType().isPrimitive() ) {
og.assignTempToField( src, dst, fld );
- //nodeDescription = "Field";
- //writeGraph = true;
- og.writeGraph( fn );
+ og.writeGraph( methodDesc, fn );
}
break;
dst = fsfn.getDst();
fld = fsfn.getField();
og.assignFieldToTemp( src, dst, fld );
- //nodeDescription = "SetField";
- //writeGraph = true;
- og.writeGraph( fn );
+ og.writeGraph( methodDesc, fn );
break;
+ /*
case FKind.FlatNew:
FlatNew fnn = (FlatNew) fn;
dst = fnn.getDst();
//MethodDescriptor md = fc.getMethod();
//descriptorsToVisit.add( md );
//System.out.println( " Descs to visit: " + descriptorsToVisit );
+ og.writeGraph( methodDesc, fn );
break;
case FKind.FlatReturnNode:
//nodeDescription = "Return";
//writeGraph = true;
//og.writeCondensedAnalysis( makeCondensedAnalysisName( methodname, flatnodetolabel.get(fn) ) );
- //og.writeGraph( fn );
+ og.writeGraph( methodDesc, fn );
break;
}
-
- /*
- if( writeGraph ) {
- og.writeGraph( makeNodeName( methodname,
- flatnodetolabel.get( fn ),
- nodeDescription ) );
- }
- */
}
static public Integer generateUniqueHeapRegionNodeID() {
public class OwnershipGraph {
- /*
+
protected static final int VISIT_HRN_WRITE_FULL = 0;
- protected static final int VISIT_HRN_WRITE_CONDENSED = 1;
- */
+ //protected static final int VISIT_HRN_WRITE_CONDENSED = 1;
+
private int allocationDepth;
}
- /*
////////////////////////////////////////////////////
//
// New Reference Methods
// end new reference methods
////////////////////////////////////////////////////
- */
protected HeapRegionNode
createNewHeapRegionNode( Integer id,
}
*/
- public void writeGraph( String graphName ) throws java.io.IOException {
+ public void writeGraph( Descriptor methodDesc,
+ FlatNode fn ) throws java.io.IOException {
+ String graphName =
+ methodDesc.getSymbol() +
+ methodDesc.getNum() +
+ fn.toString();
+
+ // remove all non-word characters from the graph name so
+ // the filename and identifier in dot don't cause errors
+ graphName = graphName.replaceAll( "[\\W]", "" );
+
+
BufferedWriter bw = new BufferedWriter( new FileWriter( graphName+".dot" ) );
bw.write( "digraph "+graphName+" {\n" );
bw.write( " }\n" );
}
+ */
+
// then visit every heap region node
HashSet<HeapRegionNode> visited = new HashSet<HeapRegionNode>();
- s = heapRoots.entrySet();
- i = s.iterator();
+ Set s = heapRoots.entrySet();
+ Iterator i = s.iterator();
while( i.hasNext() ) {
Map.Entry me = (Map.Entry) i.next();
HeapRegionNode hrn = (HeapRegionNode) me.getValue();
"\"];\n" );
}
}
- */
bw.write( "}\n" );
bw.close();
bw.write( "}\n" );
bw.close();
}
+ */
protected void traverseHeapRegionNodes( int mode,
HeapRegionNode hrn,
"\"];\n" );
break;
+ /*
case VISIT_HRN_WRITE_CONDENSED:
Iterator i = hrn.iteratorToAnalysisRegionAliases();
hrn.addAnalysisRegionAlias( td );
break;
+ */
}
-
- OwnershipNode onRef = null;
- Iterator refItr = hrn.iteratorToReferencers();
+ OwnershipNode onRef = null;
+ Iterator refItr = hrn.iteratorToReferencers();
while( refItr.hasNext() ) {
onRef = (OwnershipNode) refItr.next();
traverseHeapRegionNodes( mode, hrnChild, bw, td, visited );
}
}
- */
-
}
SOURCE_FILES=test01.java
BUILDSCRIPT=~/research/Robust/src/buildscript
-#BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
-BSFLAGS= -recover -ownership -enable-assertions
+BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
+#BSFLAGS= -recover -ownership -enable-assertions
all: $(PROGRAM).bin
view: PNGs
- eog *flatIRGraph*.png &
- eog *FN*.png &
- eog *Ownership*.png &
+ #eog *flatIRGraph*.png &
+ #eog *FN*.png &
+ #eog *Ownership*.png &
+ eog *.png &
PNGs: DOTs
- rm -f *Startup*.dot
- rm -f *FN*Method*.dot
- rm -f *FN*Op*.dot
- rm -f *FN*Field*.dot
- rm -f *FN*SetField*.dot
+ #rm -f *Startup*.dot
+ rm -f *FlatMethod*.dot
+ rm -f *FlatOpNode*.dot
+ rm -f *FlatFieldNode*.dot
+ rm -f *FlatSetFieldNode*.dot
d2p *.dot
DOTs: $(PROGRAM).bin
flag w;
int a, b;
Parameter f, g;
- 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 class Penguin {
+ int x, y;
+
+ public Penguin() { x = 0; y = 0; }
+
+ public void bar() { x = 1; }
+}
+
task Startup( StartupObject s{ initialstate } ) {
Parameter p = new Parameter(){!w};
p.foo();
+ Penguin g = new Penguin();
+ g.bar();
+
taskexit( s{ !initialstate } );
}
taskexit( p1{w}, p2{w} );
}
-
+*/
task bunchOfPaths
( Parameter p1{!w}, Parameter p2{!w} ) {
taskexit( p1{w}, p2{w} );
}
-
+/*
task literalTest( Parameter p1{!w} ) {
Parameter x = null;
int y = 5;
taskexit( p1{w} );
}
-*/
-/*
task newNoAlias
( Parameter p1{!w}, Parameter p2{!w} ) {
taskexit( p1{w}, p2{w} );
}
-*/
+*/
\ No newline at end of file