From: pcm <pcm...@us...> - 2005-05-10 06:47:19
|
Update of /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/jvm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15058/src/gov/nasa/jpf/jvm Modified Files: ThreadInfo.java Log Message: moved the idle loop detection out of the core and into gov.nasa.jpf.tools.IdleFilter listener, which is also a bit more sophisticated. It checks not just for back jump threshold, but abandons the test if it detects ArrayStoreInstructions or InvokeInstructions, assuming both are doing stuff that shouldn't be ignored. The thing can be made vastly more sophisticated, but it nicely shows what can be done with listeners. It passes the int[] a = new int[500]; // init loop -> pass for (int i=0; i<a.length; i++) a[i] = i; for (long l=0; l<1000000; l++); // bad idle loop -> filter test. To ease creation of listeners like this, I've also added a ListenerAdapter, which dummy implements both VMListener and SearchListener, so that tools only have to override their relevant notificatiion methods Index: ThreadInfo.java =================================================================== RCS file: /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/jvm/ThreadInfo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ThreadInfo.java 7 May 2005 00:40:01 -0000 1.8 +++ ThreadInfo.java 10 May 2005 06:46:55 -0000 1.9 @@ -152,9 +152,6 @@ */ LinkedList lockedObjects = new LinkedList(); - /** number of consecutive POR breaks this thread had since the last backtrack - */ - int forcedPorBreaks; // the following parameters are configurable. Would be nice if we could keep // them on a per-instance basis, but there are a few locations @@ -180,12 +177,7 @@ * we don't treat access of the corresponding field as a boundary step */ static boolean porSyncDetection; - - /** after how many back jumps (potential loop closing GOTOs) do we get suspicious - * that we are in an endless loop that would never return from executePorStep - */ - static int porMaxBackJumps; - + static boolean init (Config config) { threadDataPool = new HashPool(); stackFramePool = new HashPool(); @@ -195,7 +187,6 @@ porInEffect = config.getBoolean("vm.por"); porFieldBoundaries = config.getBoolean("vm.por.field_boundaries"); porSyncDetection = config.getBoolean("vm.por.sync_detection"); - porMaxBackJumps = config.getInt("vm.por.max_backjumps", 50); return true; } @@ -1222,8 +1213,6 @@ hasChanged = new BitSet(); lowestChanged = -1; - forcedPorBreaks = 0; - this.data = data; } @@ -2088,8 +2077,6 @@ */ protected boolean executePorStep () throws JPFException { - int backJumps =0; - while (true) { Instruction pc = executeInstruction(); @@ -2137,16 +2124,7 @@ if ( yield || pc.isSchedulingRelevant(list.ks.ss, list.ks, this)) { yield = false; break; - } - - if (pc.isBackJump()) { - if (backJumps++ > porMaxBackJumps) { - if (forcedPorBreaks++ > 1) { - vm.setIgnoreState(true); - } - break; // we break before the jump backwards - } - } + } } return true; |