package Analysis.Disjoint;
-import java.io.*;
import java.util.*;
import IR.*;
Set<EdgeKey> edgeKeysForLoad ) {
DefiniteReachState state = makeIn( fn );
state.load( x, y, f, edgeKeysForLoad );
+ state.writeState( "YO" );
fn2state.put( fn, state );
}
public void writeState( FlatNode fn, String outputName ) {
- DefiniteReachState state = makeIn( fn );
- try {
- BufferedWriter bw = new BufferedWriter( new FileWriter( outputName+".txt" ) );
- bw.write( state.toString() );
- bw.close();
- } catch( IOException e ) {
- System.out.println( "ERROR writing definite reachability state:\n "+e );
- }
+ makeIn( fn ).writeState( outputName );
}
// before the given program point by merging the out
// states of the predecessor statements
private DefiniteReachState makeIn( FlatNode fn ) {
- DefiniteReachState stateIn = new DefiniteReachState();
- for( int i = 0; i < fn.numPrev(); ++i ) {
+ if( fn.numPrev() <= 1 ) {
+ return new DefiniteReachState();
+ }
+
+ DefiniteReachState stateIn =
+ new DefiniteReachState( get( fn.getPrev( 0 ) ) );
+
+ for( int i = 1; i < fn.numPrev(); ++i ) {
stateIn.merge( get( fn.getPrev( i ) ) );
}
return stateIn;
package Analysis.Disjoint;
+import java.io.*;
import java.util.*;
import IR.*;
+ public DefiniteReachState( DefiniteReachState toCopy ) {
+ this.R = toCopy.R.clone( RBuilder );
+ }
public DefiniteReachState() {
R = RBuilder.build();
//Rs = new HashMap<TempDescriptor, DefReachKnown>();
+
//Fu = FuBuilder.build();
}
}
+ public void writeState( String outputName ) {
+ try {
+ BufferedWriter bw = new BufferedWriter( new FileWriter( "defReach-"+outputName+".txt" ) );
+ bw.write( this.toString() );
+ bw.close();
+ } catch( IOException e ) {
+ System.out.println( "ERROR writing definite reachability state:\n "+e );
+ }
+ }
+
+
public String toString() {
StringBuilder s = new StringBuilder();
this.f = f;
}
+ public String toString() {
+ return "<"+srcId+", "+f+", "+dstId+">";
+ }
+
public Integer getSrcId() {
return srcId;
}
static public void main( String args[] ) {
-
+ gendefreach yn1;
+
Foo x = getFlagged();
Foo y = getUnflagged();
x.f = y;
// x is flagged and y is reachable from
// at most one object from that site
+ gendefreach y0;
genreach y0;
Foo t = getFlagged();
// x is flagged and y is reachable from
// at most one object from that site, even
// though x is summarized now
+ gendefreach y1;
genreach y1;
x.g = y;
// from x, but we don't and x is summarized
// so we conservatively increase the arity
// of objects y is reachable from.
- genreach y2;
gendefreach y2;
+ genreach y2;
+
System.out.println( x+","+y );
}
}\r
\r
\r
+ public MultiViewMap<T> clone( MultiViewMapBuilder<T> builder ) {\r
+ MultiViewMap<T> out = builder.build();\r
+ for( Map.Entry<MultiKey, T> entry : this.get().entrySet() ) {\r
+ out.put( entry.getKey(), entry.getValue() );\r
+ }\r
+ return out;\r
+ }\r
+\r
+\r
public boolean equals( Object o ) {\r
if( this == o ) {\r
return true;\r