cudd
3.0.0
The University of Colorado Decision Diagram Package
|
Functions for local caches. More...
Macros | |
#define | DD_MAX_HASHTABLE_DENSITY 2 /* tells when to resize a table */ |
#define | ddLCHash1(f, shift) (((unsigned)(ptruint)(f) * DD_P1) >> (shift)) |
Computes hash function for keys of one operand. More... | |
#define | ddLCHash2(f, g, shift) |
Computes hash function for keys of two operands. More... | |
#define | ddLCHash3(f, g, h, shift) ddCHash2(f,g,h,shift) |
Computes hash function for keys of three operands. More... | |
Functions | |
DdLocalCache * | cuddLocalCacheInit (DdManager *manager, unsigned int keySize, unsigned int cacheSize, unsigned int maxCacheSize) |
Initializes a local computed table. More... | |
void | cuddLocalCacheQuit (DdLocalCache *cache) |
Shuts down a local computed table. More... | |
void | cuddLocalCacheInsert (DdLocalCache *cache, DdNodePtr *key, DdNode *value) |
Inserts a result in a local cache. More... | |
DdNode * | cuddLocalCacheLookup (DdLocalCache *cache, DdNodePtr *key) |
Looks up in a local cache. More... | |
void | cuddLocalCacheClearDead (DdManager *manager) |
Clears the dead entries of the local caches of a manager. More... | |
void | cuddLocalCacheClearAll (DdManager *manager) |
Clears the local caches of a manager. More... | |
DdHashTable * | cuddHashTableInit (DdManager *manager, unsigned int keySize, unsigned int initSize) |
Initializes a hash table. More... | |
void | cuddHashTableQuit (DdHashTable *hash) |
Shuts down a hash table. More... | |
void | cuddHashTableGenericQuit (DdHashTable *hash) |
Shuts down a hash table. More... | |
int | cuddHashTableInsert (DdHashTable *hash, DdNodePtr *key, DdNode *value, ptrint count) |
Inserts an item in a hash table. More... | |
DdNode * | cuddHashTableLookup (DdHashTable *hash, DdNodePtr *key) |
Looks up a key in a hash table. More... | |
int | cuddHashTableInsert1 (DdHashTable *hash, DdNode *f, DdNode *value, ptrint count) |
Inserts an item in a hash table. More... | |
DdNode * | cuddHashTableLookup1 (DdHashTable *hash, DdNode *f) |
Looks up a key consisting of one pointer in a hash table. More... | |
int | cuddHashTableGenericInsert (DdHashTable *hash, DdNode *f, void *value) |
Inserts a generic item in a hash table. More... | |
void * | cuddHashTableGenericLookup (DdHashTable *hash, DdNode *f) |
Looks up a key consisting of one pointer in a hash table. More... | |
int | cuddHashTableInsert2 (DdHashTable *hash, DdNode *f, DdNode *g, DdNode *value, ptrint count) |
Inserts an item in a hash table. More... | |
DdNode * | cuddHashTableLookup2 (DdHashTable *hash, DdNode *f, DdNode *g) |
Looks up a key consisting of two pointers in a hash table. More... | |
int | cuddHashTableInsert3 (DdHashTable *hash, DdNode *f, DdNode *g, DdNode *h, DdNode *value, ptrint count) |
Inserts an item in a hash table. More... | |
DdNode * | cuddHashTableLookup3 (DdHashTable *hash, DdNode *f, DdNode *g, DdNode *h) |
Looks up a key consisting of three pointers in a hash table. More... | |
static void | cuddLocalCacheResize (DdLocalCache *cache) |
Resizes a local cache. More... | |
static unsigned int | ddLCHash (DdNodePtr *key, unsigned int keysize, int shift) |
Computes the hash value for a local cache. More... | |
static void | cuddLocalCacheAddToList (DdLocalCache *cache) |
Inserts a local cache in the manager list. More... | |
static void | cuddLocalCacheRemoveFromList (DdLocalCache *cache) |
Removes a local cache from the manager list. More... | |
static int | cuddHashTableResize (DdHashTable *hash) |
Resizes a hash table. More... | |
static DdHashItem * | cuddHashTableAlloc (DdHashTable *hash) |
Fast storage allocation for items in a hash table. More... | |
Functions for local caches.
Copyright (c) 1995-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ddLCHash1 | ( | f, | |
shift | |||
) | (((unsigned)(ptruint)(f) * DD_P1) >> (shift)) |
#define ddLCHash2 | ( | f, | |
g, | |||
shift | |||
) |
#define ddLCHash3 | ( | f, | |
g, | |||
h, | |||
shift | |||
) | ddCHash2(f,g,h,shift) |
|
static |
Fast storage allocation for items in a hash table.
The first sizeof(void *) bytes of a chunk contain a pointer to the next block; the rest contains DD_MEM_CHUNK spaces for hash items.
int cuddHashTableGenericInsert | ( | DdHashTable * | hash, |
DdNode * | f, | ||
void * | value | ||
) |
Inserts a generic item in a hash table.
Inserts an item in a hash table when the key is one pointer and the value is not a DdNode pointer. The main difference w.r.t. cuddHashTableInsert1 is that the reference count of the value is not incremented.
void* cuddHashTableGenericLookup | ( | DdHashTable * | hash, |
DdNode * | f | ||
) |
Looks up a key consisting of one pointer in a hash table.
Looks up a key consisting of one pointer in a hash table when the value is not a DdNode pointer.
void cuddHashTableGenericQuit | ( | DdHashTable * | hash | ) |
Shuts down a hash table.
Shuts down a hash table, when the values are not DdNode pointers.
DdHashTable* cuddHashTableInit | ( | DdManager * | manager, |
unsigned int | keySize, | ||
unsigned int | initSize | ||
) |
Initializes a hash table.
The table associates tuples of DdNode pointers to one DdNode pointer. This type of table is used for functions that cannot (or prefer not to) use the main computed table. The package also provides functions that allow the caller to store arbitrary pointers in the table.
manager | DD manager |
keySize | number of pointers in the key |
initSize | initial size of the table |
int cuddHashTableInsert | ( | DdHashTable * | hash, |
DdNodePtr * | key, | ||
DdNode * | value, | ||
ptrint | count | ||
) |
Inserts an item in a hash table.
Inserts an item in a hash table when the key has more than three pointers.
int cuddHashTableInsert1 | ( | DdHashTable * | hash, |
DdNode * | f, | ||
DdNode * | value, | ||
ptrint | count | ||
) |
Inserts an item in a hash table.
Inserts an item in a hash table when the key is one pointer.
int cuddHashTableInsert2 | ( | DdHashTable * | hash, |
DdNode * | f, | ||
DdNode * | g, | ||
DdNode * | value, | ||
ptrint | count | ||
) |
Inserts an item in a hash table.
Inserts an item in a hash table when the key is composed of two pointers.
int cuddHashTableInsert3 | ( | DdHashTable * | hash, |
DdNode * | f, | ||
DdNode * | g, | ||
DdNode * | h, | ||
DdNode * | value, | ||
ptrint | count | ||
) |
Inserts an item in a hash table.
Inserts an item in a hash table when the key is composed of three pointers.
DdNode* cuddHashTableLookup | ( | DdHashTable * | hash, |
DdNodePtr * | key | ||
) |
Looks up a key in a hash table.
Looks up a key consisting of more than three pointers in a hash table. If the entry is present, its reference counter is decremented if not saturated. If the counter reaches 0, the value of the entry is dereferenced, and the entry is returned to the free list.
DdNode* cuddHashTableLookup1 | ( | DdHashTable * | hash, |
DdNode * | f | ||
) |
Looks up a key consisting of one pointer in a hash table.
If the entry is present, its reference count is decremented if not saturated. If the counter reaches 0, the value of the entry is dereferenced, and the entry is returned to the free list.
DdNode* cuddHashTableLookup2 | ( | DdHashTable * | hash, |
DdNode * | f, | ||
DdNode * | g | ||
) |
Looks up a key consisting of two pointers in a hash table.
If the entry is present, its reference counter is decremented if not saturated. If the counter reaches 0, the value of the entry is dereferenced, and the entry is returned to the free list.
DdNode* cuddHashTableLookup3 | ( | DdHashTable * | hash, |
DdNode * | f, | ||
DdNode * | g, | ||
DdNode * | h | ||
) |
Looks up a key consisting of three pointers in a hash table.
If the entry is present, its reference counter is decremented if not saturated. If the counter reaches 0, the value of the entry is dereferenced, and the entry is returned to the free list.
void cuddHashTableQuit | ( | DdHashTable * | hash | ) |
|
static |
Resizes a hash table.
|
static |
Inserts a local cache in the manager list.
void cuddLocalCacheClearAll | ( | DdManager * | manager | ) |
Clears the local caches of a manager.
Used before reordering.
void cuddLocalCacheClearDead | ( | DdManager * | manager | ) |
Clears the dead entries of the local caches of a manager.
Used during garbage collection.
DdLocalCache* cuddLocalCacheInit | ( | DdManager * | manager, |
unsigned int | keySize, | ||
unsigned int | cacheSize, | ||
unsigned int | maxCacheSize | ||
) |
Initializes a local computed table.
manager | manager |
keySize | size of the key (number of operands) |
cacheSize | Initial size of the cache |
maxCacheSize | Size of the cache beyond which no resizing occurs |
void cuddLocalCacheInsert | ( | DdLocalCache * | cache, |
DdNodePtr * | key, | ||
DdNode * | value | ||
) |
Inserts a result in a local cache.
DdNode* cuddLocalCacheLookup | ( | DdLocalCache * | cache, |
DdNodePtr * | key | ||
) |
Looks up in a local cache.
void cuddLocalCacheQuit | ( | DdLocalCache * | cache | ) |
Shuts down a local computed table.
cache | cache to be shut down |
|
static |
Removes a local cache from the manager list.
|
static |
Resizes a local cache.
|
static |
Computes the hash value for a local cache.