[Javabdd-checkins] JavaBDD/net/sf/javabdd MicroFactory.java,NONE,1.1 JFactory.java,1.11,1.12 BDDFact
Brought to you by:
joewhaley
From: John W. <joe...@us...> - 2005-01-30 14:42:31
|
Update of /cvsroot/javabdd/JavaBDD/net/sf/javabdd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31349/net/sf/javabdd Modified Files: JFactory.java BDDFactory.java Added Files: MicroFactory.java Log Message: Added new microBDD factory: each BDD node is only 4 words. Index: BDDFactory.java =================================================================== RCS file: /cvsroot/javabdd/JavaBDD/net/sf/javabdd/BDDFactory.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** BDDFactory.java 29 Jan 2005 11:37:20 -0000 1.5 --- BDDFactory.java 30 Jan 2005 14:42:23 -0000 1.6 *************** *** 68,71 **** --- 68,73 ---- if (bddpackage.equals("j") || bddpackage.equals("java")) return JFactory.init(nodenum, cachesize); + if (bddpackage.equals("u") || bddpackage.equals("micro")) + return MicroFactory.init(nodenum, cachesize); if (bddpackage.equals("jdd")) return JDDFactory.init(nodenum, cachesize); Index: JFactory.java =================================================================== RCS file: /cvsroot/javabdd/JavaBDD/net/sf/javabdd/JFactory.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** JFactory.java 29 Jan 2005 11:37:20 -0000 1.11 --- JFactory.java 30 Jan 2005 14:42:22 -0000 1.12 *************** *** 47,50 **** --- 47,51 ---- static final boolean USE_FINALIZER = false; + public static boolean FLUSH_CACHE_ON_GC = false; /** *************** *** 2911,2915 **** } ! bdd_operator_reset(); c2 = clock(); --- 2912,2920 ---- } ! if (FLUSH_CACHE_ON_GC) { ! bdd_operator_reset(); ! } else { ! bdd_operator_clean(); ! } c2 = clock(); *************** *** 3367,3370 **** --- 3372,3385 ---- } + void bdd_operator_clean() { + BddCache_clean_ab(applycache); + BddCache_clean_abc(itecache); + BddCache_clean_a(quantcache); + BddCache_clean_ab(appexcache); + BddCache_clean_ab(replacecache); + BddCache_clean_ab(misccache); + BddCache_clean_d(countcache); + } + void bdd_operator_varresize() { if (quantvarset != null) *************** *** 3490,3493 **** --- 3505,3561 ---- } + void BddCache_clean_d(BddCache cache) { + if (cache == null) return; + int n; + for (n = 0; n < cache.tablesize; n++) { + int a = cache.table[n].a; + if (a >= 0 && LOW(a) == -1) { + cache.table[n].a = -1; + } + } + } + + void BddCache_clean_a(BddCache cache) { + if (cache == null) return; + int n; + for (n = 0; n < cache.tablesize; n++) { + int a = cache.table[n].a; + if (a < 0) continue; + if (LOW(a) == -1 || + LOW(((BddCacheDataI)cache.table[n]).res) == -1) { + cache.table[n].a = -1; + } + } + } + + void BddCache_clean_ab(BddCache cache) { + if (cache == null) return; + int n; + for (n = 0; n < cache.tablesize; n++) { + int a = cache.table[n].a; + if (a < 0) continue; + if (LOW(a) == -1 || + (cache.table[n].b != 0 && LOW(cache.table[n].b) == -1) || + LOW(((BddCacheDataI)cache.table[n]).res) == -1) { + cache.table[n].a = -1; + } + } + } + + void BddCache_clean_abc(BddCache cache) { + if (cache == null) return; + int n; + for (n = 0; n < cache.tablesize; n++) { + int a = cache.table[n].a; + if (a < 0) continue; + if (LOW(a) == -1 || + LOW(cache.table[n].b) == -1 || + LOW(cache.table[n].c) == -1 || + LOW(((BddCacheDataI)cache.table[n]).res) == -1) { + cache.table[n].a = -1; + } + } + } + void bdd_setpair(bddPair pair, int oldvar, int newvar) { if (pair == null) *************** *** 3601,3605 **** for (p = pairs; p != null; p = p.next) p.id = pairsid++; ! bdd_operator_reset(); } --- 3669,3674 ---- for (p = pairs; p != null; p = p.next) p.id = pairsid++; ! //bdd_operator_reset(); ! BddCache_reset(replacecache); } --- NEW FILE: MicroFactory.java --- // MicroFactory.java, created Jan 29, 2005 8:24:17 PM by joewhaley // Copyright (C) 2005 John Whaley <jw...@al...> // Licensed under the terms of the GNU LGPL; see COPYING for details. package net.sf.javabdd; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Random; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.PrintStream; import java.math.BigInteger; /** [...6197 lines suppressed...] /** * Use this function to translate BDD's from a JavaFactory into its clone. * This will only work immediately after cloneFactory() is called, and * before any other BDD operations are performed. * * @param that BDD in old factory * @return a BDD in the new factory */ public BDD copyNode(BDD that) { bdd b = (bdd) that; return makeBDD(b._index); } public static final String REVISION = "$Revision: 1.1 $"; public String getVersion() { return "MicroFactory "+REVISION.substring(11, REVISION.length()-2); } } |