@@ -40,7 +40,7 @@ public class JFactory extends BDDFactoryIntImpl {
4040 * Flush the operation cache on every garbage collection. If this is false, we only clean the collected entries on
4141 * every GC, rather than emptying the whole cache. For most problems, you should keep this set to true.
4242 */
43- public static boolean FLUSH_CACHE_ON_GC = true ;
43+ public static boolean FLUSH_CACHE_ON_GC = false ;
4444
4545 static final boolean VERIFY_ASSERTIONS = false ;
4646
@@ -6995,7 +6995,7 @@ void bdd_operator_reset() {
69956995
69966996 void bdd_operator_clean () {
69976997 BddCache_clean_ab (applycache );
6998- BddCache_clean_abc (itecache );
6998+ BddCache_clean_itecache (itecache );
69996999 BddCache_clean_a (quantcache );
70007000 BddCache_clean_ab (appexcache );
70017001 BddCache_clean_ab (replacecache );
@@ -7177,20 +7177,58 @@ void BddCache_clean_ab(BddCache cache) {
71777177 }
71787178 }
71797179
7180- void BddCache_clean_abc (BddCache cache ) {
7180+ void BddCache_clean_itecache (BddCache cache ) {
71817181 if (cache == null ) {
71827182 return ;
71837183 }
7184- int n ;
7185- for (n = 0 ; n < cache .tablesize ; n ++) {
7186- int a = cache .table [n ].a ;
7187- if (a < 0 ) {
7184+
7185+ for (int i = 0 ; i < cache .tablesize ; i ++) {
7186+ BddCacheDataI entry = (BddCacheDataI )cache .table [i ];
7187+
7188+ if (entry == null ) {
7189+ throw new RuntimeException ("Expected a non-null cache entry." );
7190+ }
7191+
7192+ if (entry .a < 0 ) {
71887193 continue ;
71897194 }
7190- if (LOW (a ) == -1 || LOW (cache .table [n ].b ) == INVALID_BDD || LOW (cache .table [n ].c ) == INVALID_BDD
7191- || LOW (((BddCacheDataI )cache .table [n ]).res ) == INVALID_BDD )
7192- {
7193- cache .table [n ].a = -1 ;
7195+
7196+ boolean isInvalid = false ;
7197+
7198+ switch (entry .e ) {
7199+ case bddop_ite :
7200+ case bddop_relnext :
7201+ case bddop_relprev :
7202+ isInvalid = LOW (entry .a ) == INVALID_BDD || LOW (entry .b ) == INVALID_BDD
7203+ || LOW (entry .c ) == INVALID_BDD || LOW (entry .res ) == INVALID_BDD ;
7204+ break ;
7205+
7206+ case bddop_relnextUnion :
7207+ case bddop_relnextIntersection :
7208+ case bddop_relprevUnion :
7209+ case bddop_relprevIntersection :
7210+ isInvalid = LOW (entry .a ) == INVALID_BDD || LOW (entry .b ) == INVALID_BDD
7211+ || LOW (entry .c ) == INVALID_BDD || LOW (entry .d ) == INVALID_BDD
7212+ || LOW (entry .res ) == INVALID_BDD ;
7213+ break ;
7214+
7215+ case bddop_saturationForward :
7216+ case bddop_saturationBackward :
7217+ isInvalid = LOW (entry .a ) == INVALID_BDD || LOW (entry .res ) == INVALID_BDD ;
7218+ break ;
7219+
7220+ case bddop_boundedSaturationForward :
7221+ case bddop_boundedSaturationBackward :
7222+ isInvalid = LOW (entry .a ) == INVALID_BDD || LOW (entry .b ) == INVALID_BDD
7223+ || LOW (entry .res ) == INVALID_BDD ;
7224+ break ;
7225+
7226+ default :
7227+ throw new RuntimeException ("Unknown cache entry." );
7228+ }
7229+
7230+ if (isInvalid ) {
7231+ entry .a = -1 ;
71947232 }
71957233 }
71967234 }
0 commit comments