// insert a call to debugSnapshot() somewhere in the analysis
// to get successive captures of the analysis state
boolean takeDebugSnapshots = false;
- String mcDescSymbolDebug = "StandardEngine";
+ String mcDescSymbolDebug = "addFirst";
boolean stopAfterCapture = true;
// increments every visit to debugSnapshot, don't fiddle with it
int iterStartCapture = 0;
// the number of snapshots to take
- int numIterToCapture = 100;
+ int numIterToCapture = 40;
void debugSnapshot(OwnershipGraph og, FlatNode fn) {
if( debugCounter > iterStartCapture + numIterToCapture ) {
graphName = graphName+fn;
}
try {
+ // arguments to writeGraph are:
+ // boolean writeLabels,
+ // boolean labelSelect,
+ // boolean pruneGarbage,
+ // boolean writeReferencers
+ // boolean writeParamMappings
+
+ //og.writeGraph(graphName, true, true, true, false, false);
og.writeGraph(graphName, true, true, true, false, false);
} catch( Exception e ) {
System.out.println("Error writing debug capture.");
ReferenceEdge edge = i.next();
if( removeAll ||
- (type != null && edge.getType() .equals( type )) ||
- (field != null && edge.getField().equals( field ))
+ (edge.typeEquals( type ) && edge.fieldEquals( field ))
+ //(type != null && edge.getType() .equals( type )) ||
+ //(field != null && edge.getField().equals( field ))
){
HeapRegionNode referencee = edge.getDst();
ReferenceEdge edge = i.next();
if( removeAll ||
- (type != null && edge.getType() .equals( type )) ||
- (field != null && edge.getField().equals( field ))
+ (edge.typeEquals( type ) && edge.fieldEquals( field ))
+ //(type != null && edge.getType() .equals( type )) ||
+ //(field != null && edge.getField().equals( field ))
){
OwnershipNode referencer = edge.getSrc();
HashSet<HeapRegionNode> nodesWithNewAlpha = new HashSet<HeapRegionNode>();
HashSet<ReferenceEdge> edgesWithNewBeta = new HashSet<ReferenceEdge>();
+
+
+ //boolean printDebug = f.getType()
+
+
// first look for possible strong updates and remove those edges
boolean strongUpdate = false;
HeapRegionNode n = (HeapRegionNode) me.getKey();
ChangeTupleSet C = (ChangeTupleSet) me.getValue();
- n.setAlphaNew( n.getAlpha().applyChangeSet( C, false ) );
+ n.setAlphaNew( n.getAlpha().applyChangeSet( C, true ) );
nodesWithNewAlpha.add( n );
}
String debugCaller = "foo";
String debugCallee = "bar";
+ //String debugCaller = "StandardEngine";
+ //String debugCaller = "register_by_type";
+ //String debugCaller = "register_by_type_front";
+ //String debugCaller = "addFirst";
+ //String debugCallee = "LinkedListElement";
if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
fm.getMethod().getSymbol().equals( debugCallee ) ) {
try {
- writeGraph( "debug1Before", true, true, true, false, false );
+ writeGraph( "debug1BeforeCall", true, true, true, false, false );
ogCallee.writeGraph( "debug0Callee", true, true, true, false, false );
} catch( IOException e ) {}
}
+ if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
+ fm.getMethod().getSymbol().equals( debugCallee ) ) {
+ try {
+ writeGraph( "debug7JustBeforeMergeToKCapacity", true, true, true, false, false );
+ } catch( IOException e ) {}
+ }
+
+
+
// merge the shadow nodes of allocation sites back down to normal capacity
Iterator<AllocationSite> allocItr = ogCallee.allocationSites.iterator();
while( allocItr.hasNext() ) {
if( mc.getDescriptor().getSymbol().equals( debugCaller ) &&
fm.getMethod().getSymbol().equals( debugCallee ) ) {
try {
- writeGraph( "debug2JustBeforeSweep", true, true, true, false, false );
+ writeGraph( "debug8JustBeforeSweep", true, true, true, false, false );
} catch( IOException e ) {}
}
writeGraph( "debug9endResolveCall", true, true, true, false, false );
} catch( IOException e ) {}
System.out.println( " "+mc+" done calling "+fm );
- System.exit( -1 );
+ ++x;
+ if( x > 2 ) {
+ System.exit( -1 );
+ }
}
}
+ static int x = 0;
+
protected boolean hasMatchingField(HeapRegionNode src, ReferenceEdge edge) {
-public class Foo {
- public Foo() {}
+public class Engine {
+ LinkedList[] actions;
- public Bar b;
-}
+ public Engine() {
+ actions = new LinkedList[10];
+ for( int i = 0; i < 10; ++i ) {
+ actions[i] = disjoint blah new LinkedList();
+ }
+ }
-public class Bar {
- public Bar() {}
+ public add( Action a, int list, Action c ) {
+ actions[list].addFirst( a );
+ }
}
-public class Test {
+public class StandardEngine extends Engine {
+ public StandardEngine( Gen gen ) {
+ Engine();
- static public void main( String[] args ) {
- Foo x = disjoint foo new Foo();
- Bar y = disjoint bar new Bar();
+ Action c = new Action( gen );
- x.b = y;
+ Action a = new AntherAction( gen );
+ add( a, 0, c );
+ //add( a, 1, c );
+
+
+ Action b = new AntherAction( gen );
+ add( b, 0, c );
- virginia( x, y );
}
+}
- static public void virginia( Foo x, Bar y ) {
- //x.b = y;
- //x.b = new Bar();
- x.b = null;
+public class Action {
+ Gen gen;
+ public Action( Gen g ) {
+ gen = g;
+ }
+}
+
+public class AntherAction extends Action {
+ public AntherAction( Gen g ) {
+ Action( g );
+ }
+}
+
+public class Gen {
+ public Gen() {}
+}
+
+public class Test {
+
+ static public void main( String[] args ) {
+ Gen gen = new Gen();
+ StandardEngine se = new StandardEngine( gen );
}
}