return clone.iterator();
}
+ public int getNumReferencers() {
+ return referencers.size();
+ }
+
+
public void addReferencer( ReferenceEdge edge ) {
assert edge != null;
false,
edgeY.getBetaNew().pruneBy( hrnX.getAlpha() )
);
+ if( f != null ) {
+ // we can do a strong update here if one of two cases holds
+ if( (hrnX.getNumReferencers() == 1) ||
+ ( lnX.getNumReferencees() == 1 && hrnX.isSingleObject() )
+ ) {
+ clearReferenceEdgesFrom( hrnX, f, false );
+ }
+
+ addReferenceEdge( hrnX, hrnY, edgeNew );
- addReferenceEdge( hrnX, hrnY, edgeNew );
+ } else {
+ // if the field is null, or "any" field, then
+ // look to see if an any field already exists
+ // and merge with it, otherwise just add the edge
+ ReferenceEdge edgeExisting = hrnX.getReferenceTo( hrnY, f );
+
+ if( edgeExisting != null ) {
+ edgeExisting.setBetaNew(
+ edgeExisting.getBetaNew().union( edgeNew.getBeta() )
+ );
+ // a new edge here cannot be reflexive, so existing will
+ // always be also not reflexive anymore
+ edgeExisting.setIsInitialParamReflexive( false );
+
+ } else {
+ addReferenceEdge( hrnX, hrnY, edgeNew );
+ }
+ }
}
}
}
- // some notes:
- // the heap regions that are specially allocated as multiple-object
- // regions for method parameters need to be remembered in order to
- // resolve a function call. So actually, we need a mapping from
- // caller argument descriptors to the callee parameter heap regions
- // to apply reference edges in the callee to the caller graph.
- //
- // also, Constructors and virtual dispatch methods have a "this"
- // argument that make the mapping of arguments to parameters a little
- // tricky. What happens to that this region?
-
-
- public void resolveMethodCall( FlatCall fc,
- boolean isStatic,
- FlatMethod fm,
- OwnershipGraph ogCallee ) {
+ public void resolveMethodCall( FlatCall fc,
+ boolean isStatic,
+ FlatMethod fm,
+ OwnershipGraph ogCallee ) {
/*
// verify the existence of allocation sites and their
}
}
}
- }
- */
+ }
+ */
}
/*
return clone.iterator();
}
+ public int getNumReferencees() {
+ return referencees.size();
+ }
public void addReferencee( ReferenceEdge edge ) {
assert edge != null;
PROGRAM=test01
-SOURCE_FILES=test01.java
+SOURCE_FILES=$(PROGRAM).java
BUILDSCRIPT=~/research/Robust/src/buildscript
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 *COMPLETE*.png &
- #eog *debug*.png &
-
-printable:
- rm -f *Startup*.dot
- rm -f *FlatMethod*.dot
- rm -f *FlatOpNode*.dot
- rm -f *FlatFieldNode*.dot
- rm -f *FlatSetFieldNode*.dot
- rm -f *FlatCall*.dot
- rm -f *Parameter*.dot
- rm -f *Penguin*.dot
- rm -f *Voo*.dot
- rm -f *Baw*.dot
- rm -f *COMPLETE.dot
- dot2eps *.dot
+ eog *.png
PNGs: DOTs
- #rm -f *Startup*.dot
- #rm -f *COMPLETE*.dot
- rm -f *FlatIR*.dot
- rm -f *FlatMethod*.dot
- rm -f *FlatOpNode*.dot
- rm -f *FlatFieldNode*.dot
- rm -f *FlatSetFieldNode*.dot
- rm -f *FlatCall*.dot
- rm -f *Parameter*.dot
- rm -f *Penguin*.dot
- rm -f *Voo*.dot
- rm -f *Baw*.dot
- d2p *.dot
+ d2p *COMPLETE*.dot
DOTs: $(PROGRAM).bin
-/*
public class Parameter {
flag w;
int a, b;
public void doTheBaw( Voo v ) { v = new Voo(); }
}
-*/
public class Foo {
flag f;
public Foo() {}
public Foo x;
+ public Foo y;
- /*
public void ruinSomeFoos( Foo a, Foo b ) {
a.x = b.x;
}
- */
- static public void test( Foo p0, Foo p1 ) {
+ static public void aStaticMethod( Foo p0, Foo p1 ) {
Foo f0 = new Foo();
Foo f1 = new Foo();
Foo f2 = new Foo();
// look for the parameter s as a label referencing
// a heap region that is multi-object, flagged, not summary
task Startup( StartupObject s{ initialstate } ) {
-
-
- while( false ) {
- Foo a = new Foo();
- a.x = new Foo();
- a.x.x = new Foo();
-
- //Foo z = a.x;
- //z.x = new Foo();
- }
-
-
-
- Foo d = new Foo();
- Foo e = new Foo();
- Foo f = new Foo();
- Foo g = new Foo();
-
- d.x = e;
- e.x = f;
- f.x = g;
-
-
- Foo h = new Foo();
- Foo i = new Foo();
- Foo j = new Foo();
- Foo k = new Foo();
-
- j.x = k;
- i.x = j;
- h.x = i;
-
-
-
-
- // to look like Foo a above
- //d.x.x = f;
-
-
- Foo b;
- while( false ) {
- Foo c = new Foo();
- c.x = b;
- b = c;
- }
-
-
taskexit( s{ !initialstate } );
}
-task basics( Foo p0{ f }, Foo p1{ f } ) {
-
- //Foo a = new Foo();
- //Foo b = new Foo();
-
- Foo q = p0;
- p0.x = p1;
-
- Foo a = new Foo();
- a.x = new Foo();
- a.x.x = new Foo();
-
- //p0.x = a;
- //a.x = b;
-
- taskexit( p0{ !f }, p1{ !f } );
-}
-
-
-task methodTest( Foo p0{ f } ) {
-
- Foo up0 = new Foo();
- Foo up1 = new Foo();
- Foo up2 = new Foo();
-
- Foo a0;
- Foo a1;
-
- if( false ) {
- a0 = new Foo();
- up0.x = a0;
- a0.x = new Foo();
- //Foo temp = new Foo();
- }
-
- if( false ) {
- a0 = new Foo();
- a0.x = new Foo();
- a1 = a0;
- up1.x = a0;
- }
-
- if( false ) {
- a1 = new Foo();
- up2.x = a1;
- }
-
- // Foo.test( a0, a1 );
-
- taskexit( p0{ !f } );
-}
-
-
-
-
-/*
-task NewObject( Foo a{ f }, Foo b{ f } ) {
-
- Foo c = new Foo();
-
- a.x = c;
-
- taskexit( a{ !f }, b{ !f } );
-}
-*/
-
-/*
task NewObjectA( Foo a{ f }, Foo b{ f } ) {
Foo c = new Foo();
taskexit( a{ !f }, b{ !f } );
}
-*/
-/*
-task NewObject2( Foo a{ f }, Foo b{ f } ) {
+task NewObjectC( Foo a{ f }, Foo b{ f } ) {
Foo c;
taskexit( a{ !f }, b{ !f } );
}
-*/
-/*
+
+
// this task allocates a new object, so there should
// be a heap region for the parameter, and several
// heap regions for the allocation site, but the label
// merely points to the newest region
-task NewObject( Voo v{ f } ) {
+task NewObjectInMethod( Voo v{ f } ) {
Voo w = new Voo();
Baw b = new Baw();
b.doTheBaw( w );
}
-// this task
-task Branch( Voo v{ f } ) {
- Voo w = new Voo();
- Baw j = new Baw();
- Baw k = new Baw();
+task ClobberInitParamReflex( Voo v{ f }, Voo w{ f } ) {
+ v.b = v.bb;
+
+ taskexit( v{ !f }, w{ !f } );
+}
+
- if( v.x == 0 ) {
- w.b = j;
- } else {
- w.b = k;
+task SummaryNodeTokens( Foo p0{ f } ) {
+
+ while( false ) {
+ Foo a = new Foo();
+ a.x = new Foo();
+ a.x.x = new Foo();
+ }
+
+ Foo b;
+ while( false ) {
+ Foo c = new Foo();
+ c.x = b;
+ b = c;
}
- taskexit( v{ !f } );
+ taskexit( p0{ !f } );
}
-task NoAliasNewInLoop( Voo v{ f } ) {
+task strongUpdates( Foo p0{ f } ) {
- for( int i = 0; i < 10; ++i ) {
- Voo w = new Voo();
- w.b = new Baw();
- w.b.f = new Foo();
+ Foo b = new Foo();
+
+ Foo a = new Foo();
+ if( false ) {
+ a.x = new Foo();
+ a.y = new Foo();
+ } else if( false ) {
+ a.x = new Foo();
+ a.y = new Foo();
}
- taskexit( v{ !f } );
+ // this should effect a strong update
+ a.x = b;
+
+
+ if( false ) {
+ p0.x = new Foo();
+ p0.y = new Foo();
+ } else if( false ) {
+ p0.x = new Foo();
+ p0.y = new Foo();
+ }
+
+ // p0 points to a multiple-object heap region
+ // so this should not make a strong update
+ p0.x = b;
+
+ taskexit( p0{ !f } );
}
-task NoAliasNewInLoopAnotherWay( Voo v{ f } ) {
+task methodTest( Foo p0{ f } ) {
+
+ Foo up0 = new Foo();
+ Foo up1 = new Foo();
+ Foo up2 = new Foo();
- for( int i = 0; i < 10; ++i ) {
- Voo w = new Voo();
- Baw b = new Baw();
- Foo f = new Foo();
+ Foo a0;
+ Foo a1;
- w.b = b;
- b.f = f;
+ if( false ) {
+ a0 = new Foo();
+ up0.x = a0;
+ a0.x = new Foo();
+ //Foo temp = new Foo();
}
- taskexit( v{ !f } );
-}
+ if( false ) {
+ a0 = new Foo();
+ a0.x = new Foo();
+ a1 = a0;
+ up1.x = a0;
+ }
+ if( false ) {
+ a1 = new Foo();
+ up2.x = a1;
+ }
-task ClobberInitParamReflex( Voo v{ f }, Voo w{ f } ) {
- v.b = v.bb;
+ // Foo.test( a0, a1 );
- taskexit( v{ !f }, w{ !f } );
+ taskexit( p0{ !f } );
}
-*/
\ No newline at end of file
-PROGRAM=test02
+PROGRAM=test01
-SOURCE_FILES=test02.java
+SOURCE_FILES=$(PROGRAM).java
BUILDSCRIPT=~/research/Robust/src/buildscript
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 *.png &
+ eog *.png
PNGs: DOTs
- #rm -f *Startup*.dot
- rm -f *FlatMethod*.dot
- rm -f *FlatOpNode*.dot
- rm -f *FlatFieldNode*.dot
- rm -f *FlatSetFieldNode*.dot
- rm -f *FlatCall*.dot
- rm -f *Parameter*.dot
- rm -f *Penguin*.dot
- d2p *.dot
+ d2p *COMPLETE*.dot
DOTs: $(PROGRAM).bin
rm -f *~
rm -f *.dot
rm -f *.png
+ rm -f *.ps
+ rm -f *.eps
+ rm -f identifiedAliases.txt
taskexit( p1{w}, p2{w} );
}
+
+task NoAliasNewInLoop( Voo v{ f } ) {
+
+ for( int i = 0; i < 10; ++i ) {
+ Voo w = new Voo();
+ w.b = new Baw();
+ w.b.f = new Foo();
+ }
+
+ taskexit( v{ !f } );
+}
+
+
+task NoAliasNewInLoopAnotherWay( Voo v{ f } ) {
+
+ for( int i = 0; i < 10; ++i ) {
+ Voo w = new Voo();
+ Baw b = new Baw();
+ Foo f = new Foo();
+
+ w.b = b;
+ b.f = f;
+ }
+
+ taskexit( v{ !f } );
+}
-PROGRAM=test03
+PROGRAM=test01
-SOURCE_FILES=test03.java
+SOURCE_FILES=$(PROGRAM).java
BUILDSCRIPT=~/research/Robust/src/buildscript
-BSFLAGS= -recover -flatirtasks -ownership #-enable-assertions
-#BSFLAGS= -recover -ownership -enable-assertions
+BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
all: $(PROGRAM).bin
view: PNGs
- eog *flatIRGraph*.png &
- #eog *FN*.png &
- #eog *Ownership*.png &
- eog *.png &
-
-printable:
- rm -f *Startup*.dot
- rm -f *FlatMethod*.dot
- rm -f *FlatOpNode*.dot
- rm -f *FlatFieldNode*.dot
- rm -f *FlatSetFieldNode*.dot
- rm -f *FlatCall*.dot
- rm -f *Parameter*.dot
- rm -f *Penguin*.dot
- rm -f *Voo*.dot
- rm -f *Baw*.dot
- rm -f *COMPLETE.dot
- dot2eps *.dot
+ eog *.png
PNGs: DOTs
- #rm -f *Startup*.dot
- rm -f *FlatMethod*.dot
- rm -f *FlatOpNode*.dot
- rm -f *FlatFieldNode*.dot
- rm -f *FlatSetFieldNode*.dot
- rm -f *FlatCall*.dot
- rm -f *Parameter*.dot
- rm -f *Penguin*.dot
- rm -f *Voo*.dot
- rm -f *Baw*.dot
- d2p *.dot
+ d2p *COMPLETE*.dot
DOTs: $(PROGRAM).bin