From: jjenista Date: Mon, 9 Jan 2012 19:10:15 +0000 (+0000) Subject: defreach experiment X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c97c030ac8b91bb9771553a316b2d327b0b19cb9;p=IRC.git defreach experiment --- diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index b8dac1f9..335a3534 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -15,6 +15,7 @@ import java.io.*; public class DisjointAnalysis implements HeapAnalysis { + /////////////////////////////////////////// // // Public interface to discover possible @@ -889,6 +890,10 @@ public class DisjointAnalysis implements HeapAnalysis { } else { treport = String.format("Disjoint reachability analysis took %.3f sec.", dt); } + if( state.DISJOINT_COUNT_VISITS ) { + treport += "\nFixed point algorithm visited "+totalMethodVisits+ + " methods and "+totalNodeVisits+" nodes."; + } String justtime = String.format("%.2f", dt); System.out.println(treport); @@ -1115,6 +1120,10 @@ public class DisjointAnalysis implements HeapAnalysis { protected ReachGraph analyzeMethod(Descriptor d) throws java.io.IOException { + if( state.DISJOINT_COUNT_VISITS ) { + ++totalMethodVisits; + } + // get the flat code for this descriptor FlatMethod fm; if( d == mdAnalysisEntry ) { @@ -1290,6 +1299,11 @@ public class DisjointAnalysis implements HeapAnalysis { ) throws java.io.IOException { + if( state.DISJOINT_COUNT_VISITS ) { + ++totalNodeVisits; + } + + // any variables that are no longer live should be // nullified in the graph to reduce edges //rg.nullifyDeadVars( liveness.getLiveInTemps( fmContaining, fn ) ); @@ -3251,4 +3265,9 @@ public class DisjointAnalysis implements HeapAnalysis { return rgAtExit.canPointTo( x, arrayElementFieldName, x.getType().dereference() ); } + + + // to evaluate convergence behavior + private static long totalMethodVisits = 0; + private static long totalNodeVisits = 0; } diff --git a/Robust/src/IR/State.java b/Robust/src/IR/State.java index 7f754482..f9b7be76 100644 --- a/Robust/src/IR/State.java +++ b/Robust/src/IR/State.java @@ -132,6 +132,8 @@ public class State { public boolean DO_DEFINITE_REACH_ANALYSIS=false; + public boolean DISJOINT_COUNT_VISITS=false; + public boolean OOOJAVA=false; public boolean OOODEBUG=false; diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 8ac20190..1277bafa 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -295,6 +295,10 @@ public class Main { state.DO_DEFINITE_REACH_ANALYSIS = true; + } else if( option.equals("-count-visits") ) { + state.DISJOINT_COUNT_VISITS = true; + + } else if (option.equals("-optional")) state.OPTIONAL=true; else if (option.equals("-optimize")) diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 4ea2b894..b797433a 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -51,6 +51,7 @@ echo -disjoint-dvisit-pqueue use prio. q strat to visit descriptors echo -disjoint-desire-determinism set above interproc for determinism echo -disjoint-debug-scheduling debug when methods are scheduled for analysis echo -do-definite-reach-analysis enable improved precision for disjoint reachability analysis +echo -count-visits for counting visits in the fixed point algorithm to evaluate convergence behavior echo echo -pointsto-check-v-runtime check allocation site of pointer targets at runtime to help verify heap analysis results echo