abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cuddRef.c File Reference
#include "misc/util/util_hack.h"
#include "cuddInt.h"

Go to the source code of this file.

Functions

void Cudd_Ref (DdNode *n)
 
void Cudd_RecursiveDeref (DdManager *table, DdNode *n)
 
void Cudd_IterDerefBdd (DdManager *table, DdNode *n)
 
void Cudd_DelayedDerefBdd (DdManager *table, DdNode *n)
 
void Cudd_RecursiveDerefZdd (DdManager *table, DdNode *n)
 
void Cudd_Deref (DdNode *node)
 
int Cudd_CheckZeroRef (DdManager *manager)
 
void cuddReclaim (DdManager *table, DdNode *n)
 
void cuddReclaimZdd (DdManager *table, DdNode *n)
 
void cuddShrinkDeathRow (DdManager *table)
 
void cuddClearDeathRow (DdManager *table)
 
int cuddIsInDeathRow (DdManager *dd, DdNode *f)
 
int cuddTimesInDeathRow (DdManager *dd, DdNode *f)
 

Variables

static
ABC_NAMESPACE_IMPL_START char
rcsid[] 
DD_UNUSED = "$Id: cuddRef.c,v 1.28 2004/08/13 18:04:50 fabio Exp $"
 

Function Documentation

int Cudd_CheckZeroRef ( DdManager manager)

Function********************************************************************

Synopsis [Checks the unique table for nodes with non-zero reference counts.]

Description [Checks the unique table for nodes with non-zero reference counts. It is normally called before Cudd_Quit to make sure that there are no memory leaks due to missing Cudd_RecursiveDeref's. Takes into account that reference counts may saturate and that the basic constants and the projection functions are referenced by the manager. Returns the number of nodes with non-zero reference count. (Except for the cases mentioned above.)]

SideEffects [None]

SeeAlso []

Definition at line 466 of file cuddRef.c.

468 {
469  int size;
470  int i, j;
471  int remain; /* the expected number of remaining references to one */
472  DdNodePtr *nodelist;
473  DdNode *node;
474  DdNode *sentinel = &(manager->sentinel);
475  DdSubtable *subtable;
476  int count = 0;
477  int index;
478 
479 #ifndef DD_NO_DEATH_ROW
480  cuddClearDeathRow(manager);
481 #endif
482 
483  /* First look at the BDD/ADD subtables. */
484  remain = 1; /* reference from the manager */
485  size = manager->size;
486  remain += 2 * size; /* reference from the BDD projection functions */
487 
488  for (i = 0; i < size; i++) {
489  subtable = &(manager->subtables[i]);
490  nodelist = subtable->nodelist;
491  for (j = 0; (unsigned) j < subtable->slots; j++) {
492  node = nodelist[j];
493  while (node != sentinel) {
494  if (node->ref != 0 && node->ref != DD_MAXREF) {
495  index = (int) node->index;
496  if (node != manager->vars[index]) {
497  count++;
498  } else {
499  if (node->ref != 1) {
500  count++;
501  }
502  }
503  }
504  node = node->next;
505  }
506  }
507  }
508 
509  /* Then look at the ZDD subtables. */
510  size = manager->sizeZ;
511  if (size) /* references from ZDD universe */
512  remain += 2;
513 
514  for (i = 0; i < size; i++) {
515  subtable = &(manager->subtableZ[i]);
516  nodelist = subtable->nodelist;
517  for (j = 0; (unsigned) j < subtable->slots; j++) {
518  node = nodelist[j];
519  while (node != NULL) {
520  if (node->ref != 0 && node->ref != DD_MAXREF) {
521  index = (int) node->index;
522  if (node == manager->univ[manager->permZ[index]]) {
523  if (node->ref > 2) {
524  count++;
525  }
526  } else {
527  count++;
528  }
529  }
530  node = node->next;
531  }
532  }
533  }
534 
535  /* Now examine the constant table. Plusinfinity, minusinfinity, and
536  ** zero are referenced by the manager. One is referenced by the
537  ** manager, by the ZDD universe, and by all projection functions.
538  ** All other nodes should have no references.
539  */
540  nodelist = manager->constants.nodelist;
541  for (j = 0; (unsigned) j < manager->constants.slots; j++) {
542  node = nodelist[j];
543  while (node != NULL) {
544  if (node->ref != 0 && node->ref != DD_MAXREF) {
545  if (node == manager->one) {
546  if ((int) node->ref != remain) {
547  count++;
548  }
549  } else if (node == manager->zero ||
550  node == manager->plusinfinity ||
551  node == manager->minusinfinity) {
552  if (node->ref != 1) {
553  count++;
554  }
555  } else {
556  count++;
557  }
558  }
559  node = node->next;
560  }
561  }
562  return(count);
563 
564 } /* end of Cudd_CheckZeroRef */
DdHalfWord ref
Definition: cudd.h:280
#define DD_MAXREF
Definition: cuddInt.h:100
Definition: cudd.h:278
int size
Definition: cuddInt.h:361
DdNode * zero
Definition: cuddInt.h:346
DdSubtable * subtables
Definition: cuddInt.h:365
int * permZ
Definition: cuddInt.h:387
DdNode sentinel
Definition: cuddInt.h:344
DdNode * next
Definition: cudd.h:281
if(last==0)
Definition: sparse_int.h:34
DdNode ** nodelist
Definition: cuddInt.h:327
static int size
Definition: cuddSign.c:86
int sizeZ
Definition: cuddInt.h:362
DdHalfWord index
Definition: cudd.h:279
DdNode ** vars
Definition: cuddInt.h:390
DdNode * one
Definition: cuddInt.h:345
DdNode * plusinfinity
Definition: cuddInt.h:347
DdSubtable constants
Definition: cuddInt.h:367
DdNode * minusinfinity
Definition: cuddInt.h:348
void cuddClearDeathRow(DdManager *table)
Definition: cuddRef.c:726
DdSubtable * subtableZ
Definition: cuddInt.h:366
DdNode ** univ
Definition: cuddInt.h:392
void Cudd_DelayedDerefBdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of BDD node n.]

Description [Enqueues node n for later dereferencing. If the queue is full decreases the reference count of the oldest node N to make room for n. If N dies, recursively decreases the reference counts of its children. It is used to dispose of a BDD that is currently not needed, but may be useful again in the near future. The dereferencing proper is done as in Cudd_IterDerefBdd.]

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_IterDerefBdd]

Definition at line 274 of file cuddRef.c.

277 {
278  DdNode *N;
279  int ord;
280  DdNodePtr *stack;
281  int SP;
282 
283  unsigned int live = table->keys - table->dead;
284  if (live > table->peakLiveNodes) {
285  table->peakLiveNodes = live;
286  }
287 
288  n = Cudd_Regular(n);
289 #ifdef DD_DEBUG
290  assert(n->ref != 0);
291 #endif
292 
293 #ifdef DD_NO_DEATH_ROW
294  N = n;
295 #else
296  if (cuddIsConstant(n) || n->ref > 1) {
297 #ifdef DD_DEBUG
298  assert(n->ref != 1 && (!cuddIsConstant(n) || n == DD_ONE(table)));
299 #endif
300  cuddSatDec(n->ref);
301  return;
302  }
303 
304  N = table->deathRow[table->nextDead];
305 
306  if (N != NULL) {
307 #endif
308 #ifdef DD_DEBUG
310 #endif
311  stack = table->stack;
312  SP = 1;
313  do {
314 #ifdef DD_DEBUG
315  assert(N->ref != 0);
316 #endif
317  if (N->ref == 1) {
318  N->ref = 0;
319  table->dead++;
320 #ifdef DD_STATS
321  table->nodesDropped++;
322 #endif
323  ord = table->perm[N->index];
324  stack[SP++] = Cudd_Regular(cuddE(N));
325  table->subtables[ord].dead++;
326  N = cuddT(N);
327  } else {
328  cuddSatDec(N->ref);
329  N = stack[--SP];
330  }
331  } while (SP != 0);
332 #ifndef DD_NO_DEATH_ROW
333  }
334  table->deathRow[table->nextDead] = n;
335 
336  /* Udate insertion point. */
337  table->nextDead++;
338  table->nextDead &= table->deadMask;
339 #if 0
340  if (table->nextDead == table->deathRowDepth) {
341  if (table->deathRowDepth < table->looseUpTo / 2) {
342  extern void (*MMoutOfMemory)(long);
343  void (*saveHandler)(long) = MMoutOfMemory;
344  DdNodePtr *newRow;
346  newRow = ABC_REALLOC(DdNodePtr,table->deathRow,2*table->deathRowDepth);
347  MMoutOfMemory = saveHandler;
348  if (newRow == NULL) {
349  table->nextDead = 0;
350  } else {
351  int i;
352  table->memused += table->deathRowDepth;
353  i = table->deathRowDepth;
354  table->deathRowDepth <<= 1;
355  for (; i < table->deathRowDepth; i++) {
356  newRow[i] = NULL;
357  }
358  table->deadMask = table->deathRowDepth - 1;
359  table->deathRow = newRow;
360  }
361  } else {
362  table->nextDead = 0;
363  }
364  }
365 #endif
366 #endif
367 
368 } /* end of Cudd_DelayedDerefBdd */
DdHalfWord ref
Definition: cudd.h:280
void Cudd_OutOfMem(long size)
Definition: cuddUtil.c:2837
unsigned int peakLiveNodes
Definition: cuddInt.h:465
Definition: cudd.h:278
unsigned deadMask
Definition: cuddInt.h:404
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
#define Cudd_Regular(node)
Definition: cudd.h:397
DdSubtable * subtables
Definition: cuddInt.h:365
DdNode ** deathRow
Definition: cuddInt.h:401
DdNode ** stack
Definition: cuddInt.h:380
unsigned int dead
Definition: cuddInt.h:371
#define Cudd_IsComplement(node)
Definition: cudd.h:425
unsigned int keys
Definition: cuddInt.h:369
unsigned int dead
Definition: cuddInt.h:332
#define cuddIsConstant(node)
Definition: cuddInt.h:620
#define cuddT(node)
Definition: cuddInt.h:636
int nextDead
Definition: cuddInt.h:403
unsigned long memused
Definition: cuddInt.h:449
int deathRowDepth
Definition: cuddInt.h:402
DdHalfWord index
Definition: cudd.h:279
unsigned int looseUpTo
Definition: cuddInt.h:377
#define cuddE(node)
Definition: cuddInt.h:652
#define cuddSatDec(x)
Definition: cuddInt.h:896
#define assert(ex)
Definition: util_old.h:213
#define DD_ONE(dd)
Definition: cuddInt.h:911
int * perm
Definition: cuddInt.h:386
#define MMoutOfMemory
Definition: util_hack.h:38
void Cudd_Deref ( DdNode node)

Function********************************************************************

Synopsis [Decreases the reference count of node.]

Description [Decreases the reference count of node. It is primarily used in recursive procedures to decrease the ref count of a result node before returning it. This accomplishes the goal of removing the protection applied by a previous Cudd_Ref.]

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_RecursiveDerefZdd Cudd_Ref]

Definition at line 438 of file cuddRef.c.

440 {
441  node = Cudd_Regular(node);
442  cuddSatDec(node->ref);
443 
444 } /* end of Cudd_Deref */
DdHalfWord ref
Definition: cudd.h:280
#define Cudd_Regular(node)
Definition: cudd.h:397
#define cuddSatDec(x)
Definition: cuddInt.h:896
void Cudd_IterDerefBdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of BDD node n.]

Description [Decreases the reference count of node n. If n dies, recursively decreases the reference counts of its children. It is used to dispose of a BDD that is no longer needed. It is more efficient than Cudd_RecursiveDeref, but it cannot be used on ADDs. The greater efficiency comes from being able to assume that no constant node will ever die as a result of a call to this procedure.]

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_DelayedDerefBdd]

Definition at line 217 of file cuddRef.c.

220 {
221  DdNode *N;
222  int ord;
223  DdNodePtr *stack = table->stack;
224  int SP = 1;
225 
226  unsigned int live = table->keys - table->dead;
227  if (live > table->peakLiveNodes) {
228  table->peakLiveNodes = live;
229  }
230 
231  N = Cudd_Regular(n);
232 
233  do {
234 #ifdef DD_DEBUG
235  assert(N->ref != 0);
236 #endif
237 
238  if (N->ref == 1) {
239  N->ref = 0;
240  table->dead++;
241 #ifdef DD_STATS
242  table->nodesDropped++;
243 #endif
244  ord = table->perm[N->index];
245  stack[SP++] = Cudd_Regular(cuddE(N));
246  table->subtables[ord].dead++;
247  N = cuddT(N);
248  } else {
249  cuddSatDec(N->ref);
250  N = stack[--SP];
251  }
252  } while (SP != 0);
253 
254 } /* end of Cudd_IterDerefBdd */
DdHalfWord ref
Definition: cudd.h:280
unsigned int peakLiveNodes
Definition: cuddInt.h:465
Definition: cudd.h:278
#define Cudd_Regular(node)
Definition: cudd.h:397
DdSubtable * subtables
Definition: cuddInt.h:365
DdNode ** stack
Definition: cuddInt.h:380
unsigned int dead
Definition: cuddInt.h:371
unsigned int keys
Definition: cuddInt.h:369
unsigned int dead
Definition: cuddInt.h:332
#define cuddT(node)
Definition: cuddInt.h:636
DdHalfWord index
Definition: cudd.h:279
#define cuddE(node)
Definition: cuddInt.h:652
#define cuddSatDec(x)
Definition: cuddInt.h:896
#define assert(ex)
Definition: util_old.h:213
int * perm
Definition: cuddInt.h:386
void Cudd_RecursiveDeref ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of node n.]

Description [Decreases the reference count of node n. If n dies, recursively decreases the reference counts of its children. It is used to dispose of a DD that is no longer needed.]

SideEffects [None]

SeeAlso [Cudd_Deref Cudd_Ref Cudd_RecursiveDerefZdd]

Definition at line 154 of file cuddRef.c.

157 {
158  DdNode *N;
159  int ord;
160  DdNodePtr *stack = table->stack;
161  int SP = 1;
162 
163  unsigned int live = table->keys - table->dead;
164  if (live > table->peakLiveNodes) {
165  table->peakLiveNodes = live;
166  }
167 
168  N = Cudd_Regular(n);
169 
170  do {
171 #ifdef DD_DEBUG
172  assert(N->ref != 0);
173 #endif
174 
175  if (N->ref == 1) {
176  N->ref = 0;
177  table->dead++;
178 #ifdef DD_STATS
179  table->nodesDropped++;
180 #endif
181  if (cuddIsConstant(N)) {
182  table->constants.dead++;
183  N = stack[--SP];
184  } else {
185  ord = table->perm[N->index];
186  stack[SP++] = Cudd_Regular(cuddE(N));
187  table->subtables[ord].dead++;
188  N = cuddT(N);
189  }
190  } else {
191  cuddSatDec(N->ref);
192  N = stack[--SP];
193  }
194  } while (SP != 0);
195 
196 } /* end of Cudd_RecursiveDeref */
DdHalfWord ref
Definition: cudd.h:280
unsigned int peakLiveNodes
Definition: cuddInt.h:465
Definition: cudd.h:278
#define Cudd_Regular(node)
Definition: cudd.h:397
DdSubtable * subtables
Definition: cuddInt.h:365
DdNode ** stack
Definition: cuddInt.h:380
unsigned int dead
Definition: cuddInt.h:371
unsigned int keys
Definition: cuddInt.h:369
unsigned int dead
Definition: cuddInt.h:332
#define cuddIsConstant(node)
Definition: cuddInt.h:620
#define cuddT(node)
Definition: cuddInt.h:636
DdHalfWord index
Definition: cudd.h:279
#define cuddE(node)
Definition: cuddInt.h:652
#define cuddSatDec(x)
Definition: cuddInt.h:896
#define assert(ex)
Definition: util_old.h:213
DdSubtable constants
Definition: cuddInt.h:367
int * perm
Definition: cuddInt.h:386
void Cudd_RecursiveDerefZdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Decreases the reference count of ZDD node n.]

Description [Decreases the reference count of ZDD node n. If n dies, recursively decreases the reference counts of its children. It is used to dispose of a ZDD that is no longer needed.]

SideEffects [None]

SeeAlso [Cudd_Deref Cudd_Ref Cudd_RecursiveDeref]

Definition at line 385 of file cuddRef.c.

388 {
389  DdNode *N;
390  int ord;
391  DdNodePtr *stack = table->stack;
392  int SP = 1;
393 
394  N = n;
395 
396  do {
397 #ifdef DD_DEBUG
398  assert(N->ref != 0);
399 #endif
400 
401  cuddSatDec(N->ref);
402 
403  if (N->ref == 0) {
404  table->deadZ++;
405 #ifdef DD_STATS
406  table->nodesDropped++;
407 #endif
408 #ifdef DD_DEBUG
409  assert(!cuddIsConstant(N));
410 #endif
411  ord = table->permZ[N->index];
412  stack[SP++] = cuddE(N);
413  table->subtableZ[ord].dead++;
414  N = cuddT(N);
415  } else {
416  N = stack[--SP];
417  }
418  } while (SP != 0);
419 
420 } /* end of Cudd_RecursiveDerefZdd */
DdHalfWord ref
Definition: cudd.h:280
Definition: cudd.h:278
unsigned int deadZ
Definition: cuddInt.h:372
int * permZ
Definition: cuddInt.h:387
DdNode ** stack
Definition: cuddInt.h:380
unsigned int dead
Definition: cuddInt.h:332
#define cuddIsConstant(node)
Definition: cuddInt.h:620
#define cuddT(node)
Definition: cuddInt.h:636
DdHalfWord index
Definition: cudd.h:279
#define cuddE(node)
Definition: cuddInt.h:652
#define cuddSatDec(x)
Definition: cuddInt.h:896
#define assert(ex)
Definition: util_old.h:213
DdSubtable * subtableZ
Definition: cuddInt.h:366
void Cudd_Ref ( DdNode n)

AutomaticStart AutomaticEnd Function********************************************************************

Synopsis [Increases the reference count of a node, if it is not saturated.]

Description []

SideEffects [None]

SeeAlso [Cudd_RecursiveDeref Cudd_Deref]

Definition at line 129 of file cuddRef.c.

131 {
132 
133  n = Cudd_Regular(n);
134 
135  cuddSatInc(n->ref);
136 
137 } /* end of Cudd_Ref */
DdHalfWord ref
Definition: cudd.h:280
#define Cudd_Regular(node)
Definition: cudd.h:397
#define cuddSatInc(x)
Definition: cuddInt.h:878
void cuddClearDeathRow ( DdManager table)

Function********************************************************************

Synopsis [Clears the death row.]

Description []

SideEffects [None]

SeeAlso [Cudd_DelayedDerefBdd Cudd_IterDerefBdd Cudd_CheckZeroRef cuddGarbageCollect]

Definition at line 726 of file cuddRef.c.

728 {
729 #ifndef DD_NO_DEATH_ROW
730  int i;
731 
732  for (i = 0; i < table->deathRowDepth; i++) {
733  if (table->deathRow[i] == NULL) break;
734  Cudd_IterDerefBdd(table,table->deathRow[i]);
735  table->deathRow[i] = NULL;
736  }
737 #ifdef DD_DEBUG
738  for (; i < table->deathRowDepth; i++) {
739  assert(table->deathRow[i] == NULL);
740  }
741 #endif
742  table->nextDead = 0;
743 #endif
744 
745 } /* end of cuddClearDeathRow */
DdNode ** deathRow
Definition: cuddInt.h:401
void Cudd_IterDerefBdd(DdManager *table, DdNode *n)
Definition: cuddRef.c:217
int nextDead
Definition: cuddInt.h:403
int deathRowDepth
Definition: cuddInt.h:402
#define assert(ex)
Definition: util_old.h:213
int cuddIsInDeathRow ( DdManager dd,
DdNode f 
)

Function********************************************************************

Synopsis [Checks whether a node is in the death row.]

Description [Checks whether a node is in the death row. Returns the position of the first occurrence if the node is present; -1 otherwise.]

SideEffects [None]

SeeAlso [Cudd_DelayedDerefBdd cuddClearDeathRow]

Definition at line 762 of file cuddRef.c.

765 {
766 #ifndef DD_NO_DEATH_ROW
767  int i;
768 
769  for (i = 0; i < dd->deathRowDepth; i++) {
770  if (f == dd->deathRow[i]) {
771  return(i);
772  }
773  }
774 #endif
775 
776  return(-1);
777 
778 } /* end of cuddIsInDeathRow */
DdNode ** deathRow
Definition: cuddInt.h:401
int deathRowDepth
Definition: cuddInt.h:402
void cuddReclaim ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Brings children of a dead node back.]

Description []

SideEffects [None]

SeeAlso [cuddReclaimZdd]

Definition at line 584 of file cuddRef.c.

587 {
588  DdNode *N;
589  int ord;
590  DdNodePtr *stack = table->stack;
591  int SP = 1;
592  double initialDead = table->dead;
593 
594  N = Cudd_Regular(n);
595 
596 #ifdef DD_DEBUG
597  assert(N->ref == 0);
598 #endif
599 
600  do {
601  if (N->ref == 0) {
602  N->ref = 1;
603  table->dead--;
604  if (cuddIsConstant(N)) {
605  table->constants.dead--;
606  N = stack[--SP];
607  } else {
608  ord = table->perm[N->index];
609  stack[SP++] = Cudd_Regular(cuddE(N));
610  table->subtables[ord].dead--;
611  N = cuddT(N);
612  }
613  } else {
614  cuddSatInc(N->ref);
615  N = stack[--SP];
616  }
617  } while (SP != 0);
618 
619  N = Cudd_Regular(n);
620  cuddSatDec(N->ref);
621  table->reclaimed += initialDead - table->dead;
622 
623 } /* end of cuddReclaim */
DdHalfWord ref
Definition: cudd.h:280
Definition: cudd.h:278
#define Cudd_Regular(node)
Definition: cudd.h:397
DdSubtable * subtables
Definition: cuddInt.h:365
DdNode ** stack
Definition: cuddInt.h:380
unsigned int dead
Definition: cuddInt.h:371
unsigned int dead
Definition: cuddInt.h:332
#define cuddIsConstant(node)
Definition: cuddInt.h:620
#define cuddT(node)
Definition: cuddInt.h:636
DdHalfWord index
Definition: cudd.h:279
#define cuddE(node)
Definition: cuddInt.h:652
#define cuddSatDec(x)
Definition: cuddInt.h:896
#define assert(ex)
Definition: util_old.h:213
DdSubtable constants
Definition: cuddInt.h:367
int * perm
Definition: cuddInt.h:386
#define cuddSatInc(x)
Definition: cuddInt.h:878
double reclaimed
Definition: cuddInt.h:384
void cuddReclaimZdd ( DdManager table,
DdNode n 
)

Function********************************************************************

Synopsis [Brings children of a dead ZDD node back.]

Description []

SideEffects [None]

SeeAlso [cuddReclaim]

Definition at line 638 of file cuddRef.c.

641 {
642  DdNode *N;
643  int ord;
644  DdNodePtr *stack = table->stack;
645  int SP = 1;
646 
647  N = n;
648 
649 #ifdef DD_DEBUG
650  assert(N->ref == 0);
651 #endif
652 
653  do {
654  cuddSatInc(N->ref);
655 
656  if (N->ref == 1) {
657  table->deadZ--;
658  table->reclaimed++;
659 #ifdef DD_DEBUG
660  assert(!cuddIsConstant(N));
661 #endif
662  ord = table->permZ[N->index];
663  stack[SP++] = cuddE(N);
664  table->subtableZ[ord].dead--;
665  N = cuddT(N);
666  } else {
667  N = stack[--SP];
668  }
669  } while (SP != 0);
670 
671  cuddSatDec(n->ref);
672 
673 } /* end of cuddReclaimZdd */
DdHalfWord ref
Definition: cudd.h:280
Definition: cudd.h:278
unsigned int deadZ
Definition: cuddInt.h:372
int * permZ
Definition: cuddInt.h:387
DdNode ** stack
Definition: cuddInt.h:380
unsigned int dead
Definition: cuddInt.h:332
#define cuddIsConstant(node)
Definition: cuddInt.h:620
#define cuddT(node)
Definition: cuddInt.h:636
DdHalfWord index
Definition: cudd.h:279
#define cuddE(node)
Definition: cuddInt.h:652
#define cuddSatDec(x)
Definition: cuddInt.h:896
#define assert(ex)
Definition: util_old.h:213
#define cuddSatInc(x)
Definition: cuddInt.h:878
double reclaimed
Definition: cuddInt.h:384
DdSubtable * subtableZ
Definition: cuddInt.h:366
void cuddShrinkDeathRow ( DdManager table)

Function********************************************************************

Synopsis [Shrinks the death row.]

Description [Shrinks the death row by a factor of four.]

SideEffects [None]

SeeAlso [cuddClearDeathRow]

Definition at line 688 of file cuddRef.c.

690 {
691 #ifndef DD_NO_DEATH_ROW
692  int i;
693 
694  if (table->deathRowDepth > 3) {
695  for (i = table->deathRowDepth/4; i < table->deathRowDepth; i++) {
696  if (table->deathRow[i] == NULL) break;
697  Cudd_IterDerefBdd(table,table->deathRow[i]);
698  table->deathRow[i] = NULL;
699  }
700  table->deathRowDepth /= 4;
701  table->deadMask = table->deathRowDepth - 1;
702  if ((unsigned) table->nextDead > table->deadMask) {
703  table->nextDead = 0;
704  }
705  table->deathRow = ABC_REALLOC(DdNodePtr, table->deathRow,
706  table->deathRowDepth);
707  }
708 #endif
709 
710 } /* end of cuddShrinkDeathRow */
Definition: cudd.h:278
unsigned deadMask
Definition: cuddInt.h:404
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
DdNode ** deathRow
Definition: cuddInt.h:401
void Cudd_IterDerefBdd(DdManager *table, DdNode *n)
Definition: cuddRef.c:217
int nextDead
Definition: cuddInt.h:403
int deathRowDepth
Definition: cuddInt.h:402
int cuddTimesInDeathRow ( DdManager dd,
DdNode f 
)

Function********************************************************************

Synopsis [Counts how many times a node is in the death row.]

Description []

SideEffects [None]

SeeAlso [Cudd_DelayedDerefBdd cuddClearDeathRow cuddIsInDeathRow]

Definition at line 793 of file cuddRef.c.

796 {
797  int count = 0;
798 #ifndef DD_NO_DEATH_ROW
799  int i;
800 
801  for (i = 0; i < dd->deathRowDepth; i++) {
802  count += f == dd->deathRow[i];
803  }
804 #endif
805 
806  return(count);
807 
808 } /* end of cuddTimesInDeathRow */
DdNode ** deathRow
Definition: cuddInt.h:401
int deathRowDepth
Definition: cuddInt.h:402

Variable Documentation

ABC_NAMESPACE_IMPL_START char rcsid [] DD_UNUSED = "$Id: cuddRef.c,v 1.28 2004/08/13 18:04:50 fabio Exp $"
static

CFile***********************************************************************

FileName [cuddRef.c]

PackageName [cudd]

Synopsis [Functions that manipulate the reference counts.]

Description [External procedures included in this module:

Internal procedures included in this module:

]

SeeAlso []

Author [Fabio Somenzi]

Copyright [Copyright (c) 1995-2004, 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.]

Definition at line 95 of file cuddRef.c.