projects
/
IRC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
08387f9
)
successfully keep def reach info just for the store transform
author
jjenista
<jjenista>
Thu, 10 Nov 2011 00:16:50 +0000
(
00:16
+0000)
committer
jjenista
<jjenista>
Thu, 10 Nov 2011 00:16:50 +0000
(
00:16
+0000)
Robust/src/Analysis/Disjoint/DefiniteReachAnalysis.java
patch
|
blob
|
history
Robust/src/Analysis/Disjoint/DefiniteReachState.java
patch
|
blob
|
history
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
patch
|
blob
|
history
diff --git
a/Robust/src/Analysis/Disjoint/DefiniteReachAnalysis.java
b/Robust/src/Analysis/Disjoint/DefiniteReachAnalysis.java
index 8c1cf8b5e5af24a0e590f155360c4b37cb1a547e..f8a252ee37caa9bf9bbadd53540cf3265898b6c1 100644
(file)
--- a/
Robust/src/Analysis/Disjoint/DefiniteReachAnalysis.java
+++ b/
Robust/src/Analysis/Disjoint/DefiniteReachAnalysis.java
@@
-13,26
+13,43
@@
public class DefiniteReachAnalysis {
// every program point
private Map<FlatNode, DefiniteReachState> fn2state;
// every program point
private Map<FlatNode, DefiniteReachState> fn2state;
- private static PointerMethod pm;
+ // even though the above map has a set of nodes that
+ // have been analyzed, we need a per-intra pass set
+ // of nodes that have been analyzed, too, to filter
+ // out nodes that do not have a partial result yet
+ private Set<FlatNode> fnHasPartial;
- public static void setPointerMethod( PointerMethod pm ) {
- DefiniteReachAnalysis.pm = pm;
- }
+
+ private static PointerMethod pm;
- public DefiniteReachAnalysis() {
+ public DefiniteReachAnalysis(
PointerMethod pm
) {
// a class-wide initialization
DefiniteReachState.initBuilders();
// a class-wide initialization
DefiniteReachState.initBuilders();
+
+ DefiniteReachAnalysis.pm = pm;
- fn2state = new HashMap<FlatNode, DefiniteReachState>();
+ fn2state = new HashMap<FlatNode, DefiniteReachState>();
+ fnHasPartial = new HashSet<FlatNode>();
+ }
+
+
+ private void addPartialResult( FlatNode fn, DefiniteReachState state ) {
+ fn2state.put( fn, state );
+ fnHasPartial.add( fn );
}
public void methodEntry( FlatNode fn,
Set<TempDescriptor> parameters ) {
}
public void methodEntry( FlatNode fn,
Set<TempDescriptor> parameters ) {
+ // this should be called exactly once at the beginning
+ // of any intraprocedural pass, so clear partial result
+ // set
+ fnHasPartial.clear();
+
DefiniteReachState state = makeIn( fn );
state.methodEntry( parameters );
DefiniteReachState state = makeIn( fn );
state.methodEntry( parameters );
- fn2state.put( fn, state );
+ addPartialResult( fn, state );
}
public void copy( FlatNode fn,
}
public void copy( FlatNode fn,
@@
-40,7
+57,7
@@
public class DefiniteReachAnalysis {
TempDescriptor y ) {
DefiniteReachState state = makeIn( fn );
state.copy( x, y );
TempDescriptor y ) {
DefiniteReachState state = makeIn( fn );
state.copy( x, y );
-
fn2state.pu
t( fn, state );
+
addPartialResul
t( fn, state );
}
public void load( FlatNode fn,
}
public void load( FlatNode fn,
@@
-51,7
+68,7
@@
public class DefiniteReachAnalysis {
DefiniteReachState state = makeIn( fn );
state.load( x, y, f, edgeKeysForLoad );
DefiniteReachState state = makeIn( fn );
state.load( x, y, f, edgeKeysForLoad );
-
fn2state.pu
t( fn, state );
+
addPartialResul
t( fn, state );
}
public void store( FlatNode fn,
}
public void store( FlatNode fn,
@@
-63,14
+80,14
@@
public class DefiniteReachAnalysis {
DefiniteReachState state = makeIn( fn );
state.store( x, f, y, edgeKeysRemoved, edgeKeysAdded );
DefiniteReachState state = makeIn( fn );
state.store( x, f, y, edgeKeysRemoved, edgeKeysAdded );
-
fn2state.pu
t( fn, state );
+
addPartialResul
t( fn, state );
}
public void newObject( FlatNode fn,
TempDescriptor x ) {
DefiniteReachState state = makeIn( fn );
state.newObject( x );
}
public void newObject( FlatNode fn,
TempDescriptor x ) {
DefiniteReachState state = makeIn( fn );
state.newObject( x );
-
fn2state.pu
t( fn, state );
+
addPartialResul
t( fn, state );
}
public void methodCall( FlatNode fn,
}
public void methodCall( FlatNode fn,
@@
-79,11
+96,11
@@
public class DefiniteReachAnalysis {
if( retVal != null ) {
state.methodCall( retVal );
}
if( retVal != null ) {
state.methodCall( retVal );
}
-
fn2state.pu
t( fn, state );
+
addPartialResul
t( fn, state );
}
public void otherStatement( FlatNode fn ) {
}
public void otherStatement( FlatNode fn ) {
-
fn2state.pu
t( fn, makeIn( fn ) );
+
addPartialResul
t( fn, makeIn( fn ) );
}
}
@@
-103,10
+120,12
@@
public class DefiniteReachAnalysis {
return state;
}
return state;
}
+
// get the current state for the program point just
// before the given program point by merging the out
// states of the predecessor statements
public DefiniteReachState makeIn( FlatNode fn ) {
// get the current state for the program point just
// before the given program point by merging the out
// states of the predecessor statements
public DefiniteReachState makeIn( FlatNode fn ) {
+
if( pm.numPrev( fn ) == 0 ) {
return new DefiniteReachState();
}
if( pm.numPrev( fn ) == 0 ) {
return new DefiniteReachState();
}
@@
-114,8
+133,7
@@
public class DefiniteReachAnalysis {
DefiniteReachState stateIn = null;
for( int i = 0; i < pm.numPrev( fn ); ++i ) {
DefiniteReachState stateIn = null;
for( int i = 0; i < pm.numPrev( fn ); ++i ) {
-
- if( fn2state.containsKey( pm.getPrev( fn, i ) ) ) {
+ if( fnHasPartial.contains( pm.getPrev( fn, i ) ) ) {
if( stateIn == null ) {
// duplicate the first partial result we find
stateIn = new DefiniteReachState( get( pm.getPrev( fn, i ) ) );
if( stateIn == null ) {
// duplicate the first partial result we find
stateIn = new DefiniteReachState( get( pm.getPrev( fn, i ) ) );
diff --git
a/Robust/src/Analysis/Disjoint/DefiniteReachState.java
b/Robust/src/Analysis/Disjoint/DefiniteReachState.java
index 70711b19e7bb0251562896df46836d35e13eb6bb..e78ab4808b5b5e567afc65e7ce198cd6b2e9c63e 100644
(file)
--- a/
Robust/src/Analysis/Disjoint/DefiniteReachState.java
+++ b/
Robust/src/Analysis/Disjoint/DefiniteReachState.java
@@
-188,14
+188,14
@@
public class DefiniteReachState {
public void methodEntryR( Set<TempDescriptor> parameters ) {
public void methodEntryR( Set<TempDescriptor> parameters ) {
- R.clear();
+
//
R.clear();
}
public void copyR( TempDescriptor x,
TempDescriptor y ) {
// consider that x and y can be the same, so do the
// parts of the update in the right order:
}
public void copyR( TempDescriptor x,
TempDescriptor y ) {
// consider that x and y can be the same, so do the
// parts of the update in the right order:
-
+ /*
// first get all info for update
MultiKey keyY = MultiKey.factory( y );
Map<MultiKey, Object> mapY0 = R.get( viewR0, keyY );
// first get all info for update
MultiKey keyY = MultiKey.factory( y );
Map<MultiKey, Object> mapY0 = R.get( viewR0, keyY );
@@
-219,12
+219,14
@@
public class DefiniteReachState {
fullKeyY.get( 2 ) );
R.put( fullKeyX, MultiViewMap.dummyValue );
}
fullKeyY.get( 2 ) );
R.put( fullKeyX, MultiViewMap.dummyValue );
}
+ */
}
public void loadR( TempDescriptor x,
TempDescriptor y,
FieldDescriptor f,
Set<EdgeKey> edgeKeysForLoad ) {
}
public void loadR( TempDescriptor x,
TempDescriptor y,
FieldDescriptor f,
Set<EdgeKey> edgeKeysForLoad ) {
+ /*
// consider that x and y can be the same, so do the
// parts of the update in the right order:
// consider that x and y can be the same, so do the
// parts of the update in the right order:
@@
-253,6
+255,7
@@
public class DefiniteReachState {
MultiViewMap.dummyValue );
}
}
MultiViewMap.dummyValue );
}
}
+ */
}
public void storeR( TempDescriptor x,
}
public void storeR( TempDescriptor x,
@@
-271,21
+274,29
@@
public class DefiniteReachState {
}
public void newObjectR( TempDescriptor x ) {
}
public void newObjectR( TempDescriptor x ) {
+ /*
MultiKey keyX = MultiKey.factory( x );
R.remove( viewR0, keyX );
R.remove( viewR1, keyX );
MultiKey keyX = MultiKey.factory( x );
R.remove( viewR0, keyX );
R.remove( viewR1, keyX );
+ */
}
public void methodCallR( TempDescriptor retVal ) {
}
public void methodCallR( TempDescriptor retVal ) {
+ /*
MultiKey keyRetVal = MultiKey.factory( retVal );
R.remove( viewR0, keyRetVal );
R.remove( viewR1, keyRetVal );
MultiKey keyRetVal = MultiKey.factory( retVal );
R.remove( viewR0, keyRetVal );
R.remove( viewR1, keyRetVal );
+ */
}
public void mergeR( DefiniteReachState that ) {
for( MultiKey key : this.R.get().keySet() ) {
if( that.R.get( viewRfull, key ).isEmpty() ) {
this.R.remove( viewRfull, key );
}
public void mergeR( DefiniteReachState that ) {
for( MultiKey key : this.R.get().keySet() ) {
if( that.R.get( viewRfull, key ).isEmpty() ) {
this.R.remove( viewRfull, key );
+ } else {
+ // if the key is in this and that, we should join the
+ // values using the R.joinOp which is currently has no
+ // public interface
}
}
}
}
}
}
diff --git
a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java
b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java
index a27d1df90a6bbadbf1d5b4271344251856ac0834..4b9b4f0dc79e2e1160701da4ca25a89e69c8fda2 100644
(file)
--- a/
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
+++ b/
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
@@
-851,8
+851,7
@@
public class DisjointAnalysis implements HeapAnalysis {
if( state.DO_DEFINITE_REACH_ANALYSIS ) {
doDefiniteReachAnalysis = true;
if( state.DO_DEFINITE_REACH_ANALYSIS ) {
doDefiniteReachAnalysis = true;
- DefiniteReachAnalysis.setPointerMethod( pm );
- definiteReachAnalysis = new DefiniteReachAnalysis();
+ definiteReachAnalysis = new DefiniteReachAnalysis( pm );
}
}