SVF
cuddCache.c
Go to the documentation of this file.
1 
66 #include "CUDD/util.h"
67 #include "CUDD/cuddInt.h"
68 
69 /*---------------------------------------------------------------------------*/
70 /* Constant declarations */
71 /*---------------------------------------------------------------------------*/
72 
73 #ifdef DD_CACHE_PROFILE
74 #define DD_HYSTO_BINS 8
75 #endif
76 
77 /*---------------------------------------------------------------------------*/
78 /* Stucture declarations */
79 /*---------------------------------------------------------------------------*/
80 
81 
82 /*---------------------------------------------------------------------------*/
83 /* Type declarations */
84 /*---------------------------------------------------------------------------*/
85 
86 
87 /*---------------------------------------------------------------------------*/
88 /* Variable declarations */
89 /*---------------------------------------------------------------------------*/
90 
91 #ifndef lint
92 static char rcsid[] DD_UNUSED = "$Id: cuddCache.c,v 1.36 2012/02/05 01:07:18 fabio Exp $";
93 #endif
94 
95 /*---------------------------------------------------------------------------*/
96 /* Macro declarations */
97 /*---------------------------------------------------------------------------*/
98 
99 
102 /*---------------------------------------------------------------------------*/
103 /* Static function prototypes */
104 /*---------------------------------------------------------------------------*/
105 
106 
110 /*---------------------------------------------------------------------------*/
111 /* Definition of exported functions */
112 /*---------------------------------------------------------------------------*/
113 
114 /*---------------------------------------------------------------------------*/
115 /* Definition of internal functions */
116 /*---------------------------------------------------------------------------*/
117 
118 
131 int
133  DdManager * unique /* unique table */,
134  unsigned int cacheSize /* initial size of the cache */,
135  unsigned int maxCacheSize /* cache size beyond which no resizing occurs */)
136 {
137  int i;
138  unsigned int logSize;
139 #ifndef DD_CACHE_PROFILE
140  DdNodePtr *mem;
141  ptruint offset;
142 #endif
143 
144  /* Round cacheSize to largest power of 2 not greater than the requested
145  ** initial cache size. */
146  logSize = cuddComputeFloorLog2(ddMax(cacheSize,unique->slots/2));
147  cacheSize = 1 << logSize;
148  unique->acache = ALLOC(DdCache,cacheSize+1);
149  if (unique->acache == NULL) {
150  unique->errorCode = CUDD_MEMORY_OUT;
151  return(0);
152  }
153  /* If the size of the cache entry is a power of 2, we want to
154  ** enforce alignment to that power of two. This happens when
155  ** DD_CACHE_PROFILE is not defined. */
156 #ifdef DD_CACHE_PROFILE
157  unique->cache = unique->acache;
158  unique->memused += (cacheSize) * sizeof(DdCache);
159 #else
160  mem = (DdNodePtr *) unique->acache;
161  offset = (ptruint) mem & (sizeof(DdCache) - 1);
162  mem += (sizeof(DdCache) - offset) / sizeof(DdNodePtr);
163  unique->cache = (DdCache *) mem;
164  assert(((ptruint) unique->cache & (sizeof(DdCache) - 1)) == 0);
165  unique->memused += (cacheSize+1) * sizeof(DdCache);
166 #endif
167  unique->cacheSlots = cacheSize;
168  unique->cacheShift = sizeof(int) * 8 - logSize;
169  unique->maxCacheHard = maxCacheSize;
170  /* If cacheSlack is non-negative, we can resize. */
171  unique->cacheSlack = (int) ddMin(maxCacheSize,
173  2 * (int) cacheSize;
174  Cudd_SetMinHit(unique,DD_MIN_HIT);
175  /* Initialize to avoid division by 0 and immediate resizing. */
176  unique->cacheMisses = (double) (int) (cacheSize * unique->minHit + 1);
177  unique->cacheHits = 0;
178  unique->totCachehits = 0;
179  /* The sum of cacheMisses and totCacheMisses is always correct,
180  ** even though cacheMisses is larger than it should for the reasons
181  ** explained above. */
182  unique->totCacheMisses = -unique->cacheMisses;
183  unique->cachecollisions = 0;
184  unique->cacheinserts = 0;
185  unique->cacheLastInserts = 0;
186  unique->cachedeletions = 0;
187 
188  /* Initialize the cache */
189  for (i = 0; (unsigned) i < cacheSize; i++) {
190  unique->cache[i].h = 0; /* unused slots */
191  unique->cache[i].data = NULL; /* invalid entry */
192 #ifdef DD_CACHE_PROFILE
193  unique->cache[i].count = 0;
194 #endif
195  }
196 
197  return(1);
198 
199 } /* end of cuddInitCache */
200 
201 
216 void
218  DdManager * table,
219  ptruint op,
220  DdNode * f,
221  DdNode * g,
222  DdNode * h,
223  DdNode * data)
224 {
225  int posn;
226  register DdCache *entry;
227  ptruint uf, ug, uh;
228 
229  uf = (ptruint) f | (op & 0xe);
230  ug = (ptruint) g | (op >> 4);
231  uh = (ptruint) h;
232 
233  posn = ddCHash2(uh,uf,ug,table->cacheShift);
234  entry = &table->cache[posn];
235 
236  table->cachecollisions += entry->data != NULL;
237  table->cacheinserts++;
238 
239  entry->f = (DdNode *) uf;
240  entry->g = (DdNode *) ug;
241  entry->h = uh;
242  entry->data = data;
243 #ifdef DD_CACHE_PROFILE
244  entry->count++;
245 #endif
246 
247 } /* end of cuddCacheInsert */
248 
249 
262 void
264  DdManager * table,
265  DD_CTFP op,
266  DdNode * f,
267  DdNode * g,
268  DdNode * data)
269 {
270  int posn;
271  register DdCache *entry;
272 
273  posn = ddCHash2(op,f,g,table->cacheShift);
274  entry = &table->cache[posn];
275 
276  if (entry->data != NULL) {
277  table->cachecollisions++;
278  }
279  table->cacheinserts++;
280 
281  entry->f = f;
282  entry->g = g;
283  entry->h = (ptruint) op;
284  entry->data = data;
285 #ifdef DD_CACHE_PROFILE
286  entry->count++;
287 #endif
288 
289 } /* end of cuddCacheInsert2 */
290 
291 
304 void
306  DdManager * table,
307  DD_CTFP1 op,
308  DdNode * f,
309  DdNode * data)
310 {
311  int posn;
312  register DdCache *entry;
313 
314  posn = ddCHash2(op,f,f,table->cacheShift);
315  entry = &table->cache[posn];
316 
317  if (entry->data != NULL) {
318  table->cachecollisions++;
319  }
320  table->cacheinserts++;
321 
322  entry->f = f;
323  entry->g = f;
324  entry->h = (ptruint) op;
325  entry->data = data;
326 #ifdef DD_CACHE_PROFILE
327  entry->count++;
328 #endif
329 
330 } /* end of cuddCacheInsert1 */
331 
332 
346 DdNode *
348  DdManager * table,
349  ptruint op,
350  DdNode * f,
351  DdNode * g,
352  DdNode * h)
353 {
354  int posn;
355  DdCache *en,*cache;
356  DdNode *data;
357  ptruint uf, ug, uh;
358 
359  uf = (ptruint) f | (op & 0xe);
360  ug = (ptruint) g | (op >> 4);
361  uh = (ptruint) h;
362 
363  cache = table->cache;
364 #ifdef DD_DEBUG
365  if (cache == NULL) {
366  return(NULL);
367  }
368 #endif
369 
370  posn = ddCHash2(uh,uf,ug,table->cacheShift);
371  en = &cache[posn];
372  if (en->data != NULL && en->f==(DdNodePtr)uf && en->g==(DdNodePtr)ug &&
373  en->h==uh) {
374  data = Cudd_Regular(en->data);
375  table->cacheHits++;
376  if (data->ref == 0) {
377  cuddReclaim(table,data);
378  }
379  return(en->data);
380  }
381 
382  /* Cache miss: decide whether to resize. */
383  table->cacheMisses++;
384 
385  if (table->cacheSlack >= 0 &&
386  table->cacheHits > table->cacheMisses * table->minHit) {
387  cuddCacheResize(table);
388  }
389 
390  return(NULL);
391 
392 } /* end of cuddCacheLookup */
393 
394 
408 DdNode *
410  DdManager * table,
411  ptruint op,
412  DdNode * f,
413  DdNode * g,
414  DdNode * h)
415 {
416  int posn;
417  DdCache *en,*cache;
418  DdNode *data;
419  ptruint uf, ug, uh;
420 
421  uf = (ptruint) f | (op & 0xe);
422  ug = (ptruint) g | (op >> 4);
423  uh = (ptruint) h;
424 
425  cache = table->cache;
426 #ifdef DD_DEBUG
427  if (cache == NULL) {
428  return(NULL);
429  }
430 #endif
431 
432  posn = ddCHash2(uh,uf,ug,table->cacheShift);
433  en = &cache[posn];
434  if (en->data != NULL && en->f==(DdNodePtr)uf && en->g==(DdNodePtr)ug &&
435  en->h==uh) {
436  data = Cudd_Regular(en->data);
437  table->cacheHits++;
438  if (data->ref == 0) {
439  cuddReclaimZdd(table,data);
440  }
441  return(en->data);
442  }
443 
444  /* Cache miss: decide whether to resize. */
445  table->cacheMisses++;
446 
447  if (table->cacheSlack >= 0 &&
448  table->cacheHits > table->cacheMisses * table->minHit) {
449  cuddCacheResize(table);
450  }
451 
452  return(NULL);
453 
454 } /* end of cuddCacheLookupZdd */
455 
456 
470 DdNode *
472  DdManager * table,
473  DD_CTFP op,
474  DdNode * f,
475  DdNode * g)
476 {
477  int posn;
478  DdCache *en,*cache;
479  DdNode *data;
480 
481  cache = table->cache;
482 #ifdef DD_DEBUG
483  if (cache == NULL) {
484  return(NULL);
485  }
486 #endif
487 
488  posn = ddCHash2(op,f,g,table->cacheShift);
489  en = &cache[posn];
490  if (en->data != NULL && en->f==f && en->g==g && en->h==(ptruint)op) {
491  data = Cudd_Regular(en->data);
492  table->cacheHits++;
493  if (data->ref == 0) {
494  cuddReclaim(table,data);
495  }
496  return(en->data);
497  }
498 
499  /* Cache miss: decide whether to resize. */
500  table->cacheMisses++;
501 
502  if (table->cacheSlack >= 0 &&
503  table->cacheHits > table->cacheMisses * table->minHit) {
504  cuddCacheResize(table);
505  }
506 
507  return(NULL);
508 
509 } /* end of cuddCacheLookup2 */
510 
511 
524 DdNode *
526  DdManager * table,
527  DD_CTFP1 op,
528  DdNode * f)
529 {
530  int posn;
531  DdCache *en,*cache;
532  DdNode *data;
533 
534  cache = table->cache;
535 #ifdef DD_DEBUG
536  if (cache == NULL) {
537  return(NULL);
538  }
539 #endif
540 
541  posn = ddCHash2(op,f,f,table->cacheShift);
542  en = &cache[posn];
543  if (en->data != NULL && en->f==f && en->h==(ptruint)op) {
544  data = Cudd_Regular(en->data);
545  table->cacheHits++;
546  if (data->ref == 0) {
547  cuddReclaim(table,data);
548  }
549  return(en->data);
550  }
551 
552  /* Cache miss: decide whether to resize. */
553  table->cacheMisses++;
554 
555  if (table->cacheSlack >= 0 &&
556  table->cacheHits > table->cacheMisses * table->minHit) {
557  cuddCacheResize(table);
558  }
559 
560  return(NULL);
561 
562 } /* end of cuddCacheLookup1 */
563 
564 
578 DdNode *
580  DdManager * table,
581  DD_CTFP op,
582  DdNode * f,
583  DdNode * g)
584 {
585  int posn;
586  DdCache *en,*cache;
587  DdNode *data;
588 
589  cache = table->cache;
590 #ifdef DD_DEBUG
591  if (cache == NULL) {
592  return(NULL);
593  }
594 #endif
595 
596  posn = ddCHash2(op,f,g,table->cacheShift);
597  en = &cache[posn];
598  if (en->data != NULL && en->f==f && en->g==g && en->h==(ptruint)op) {
599  data = Cudd_Regular(en->data);
600  table->cacheHits++;
601  if (data->ref == 0) {
602  cuddReclaimZdd(table,data);
603  }
604  return(en->data);
605  }
606 
607  /* Cache miss: decide whether to resize. */
608  table->cacheMisses++;
609 
610  if (table->cacheSlack >= 0 &&
611  table->cacheHits > table->cacheMisses * table->minHit) {
612  cuddCacheResize(table);
613  }
614 
615  return(NULL);
616 
617 } /* end of cuddCacheLookup2Zdd */
618 
619 
632 DdNode *
634  DdManager * table,
635  DD_CTFP1 op,
636  DdNode * f)
637 {
638  int posn;
639  DdCache *en,*cache;
640  DdNode *data;
641 
642  cache = table->cache;
643 #ifdef DD_DEBUG
644  if (cache == NULL) {
645  return(NULL);
646  }
647 #endif
648 
649  posn = ddCHash2(op,f,f,table->cacheShift);
650  en = &cache[posn];
651  if (en->data != NULL && en->f==f && en->h==(ptruint)op) {
652  data = Cudd_Regular(en->data);
653  table->cacheHits++;
654  if (data->ref == 0) {
655  cuddReclaimZdd(table,data);
656  }
657  return(en->data);
658  }
659 
660  /* Cache miss: decide whether to resize. */
661  table->cacheMisses++;
662 
663  if (table->cacheSlack >= 0 &&
664  table->cacheHits > table->cacheMisses * table->minHit) {
665  cuddCacheResize(table);
666  }
667 
668  return(NULL);
669 
670 } /* end of cuddCacheLookup1Zdd */
671 
672 
689 DdNode *
691  DdManager * table,
692  ptruint op,
693  DdNode * f,
694  DdNode * g,
695  DdNode * h)
696 {
697  int posn;
698  DdCache *en,*cache;
699  ptruint uf, ug, uh;
700 
701  uf = (ptruint) f | (op & 0xe);
702  ug = (ptruint) g | (op >> 4);
703  uh = (ptruint) h;
704 
705  cache = table->cache;
706 #ifdef DD_DEBUG
707  if (cache == NULL) {
708  return(NULL);
709  }
710 #endif
711  posn = ddCHash2(uh,uf,ug,table->cacheShift);
712  en = &cache[posn];
713 
714  /* We do not reclaim here because the result should not be
715  * referenced, but only tested for being a constant.
716  */
717  if (en->data != NULL &&
718  en->f == (DdNodePtr)uf && en->g == (DdNodePtr)ug && en->h == uh) {
719  table->cacheHits++;
720  return(en->data);
721  }
722 
723  /* Cache miss: decide whether to resize. */
724  table->cacheMisses++;
725 
726  if (table->cacheSlack >= 0 &&
727  table->cacheHits > table->cacheMisses * table->minHit) {
728  cuddCacheResize(table);
729  }
730 
731  return(NULL);
732 
733 } /* end of cuddConstantLookup */
734 
735 
748 int
750  DdManager * table,
751  FILE * fp)
752 {
753  DdCache *cache = table->cache;
754  int slots = table->cacheSlots;
755  int nzeroes = 0;
756  int i, retval;
757  double exUsed;
758 
759 #ifdef DD_CACHE_PROFILE
760  double count, mean, meansq, stddev, expected;
761  long max, min;
762  int imax, imin;
763  double *hystogramQ, *hystogramR; /* histograms by quotient and remainder */
764  int nbins = DD_HYSTO_BINS;
765  int bin;
766  long thiscount;
767  double totalcount, exStddev;
768 
769  meansq = mean = expected = 0.0;
770  max = min = (long) cache[0].count;
771  imax = imin = 0;
772  totalcount = 0.0;
773 
774  hystogramQ = ALLOC(double, nbins);
775  if (hystogramQ == NULL) {
776  table->errorCode = CUDD_MEMORY_OUT;
777  return(0);
778  }
779  hystogramR = ALLOC(double, nbins);
780  if (hystogramR == NULL) {
781  FREE(hystogramQ);
782  table->errorCode = CUDD_MEMORY_OUT;
783  return(0);
784  }
785  for (i = 0; i < nbins; i++) {
786  hystogramQ[i] = 0;
787  hystogramR[i] = 0;
788  }
789 
790  for (i = 0; i < slots; i++) {
791  thiscount = (long) cache[i].count;
792  if (thiscount > max) {
793  max = thiscount;
794  imax = i;
795  }
796  if (thiscount < min) {
797  min = thiscount;
798  imin = i;
799  }
800  if (thiscount == 0) {
801  nzeroes++;
802  }
803  count = (double) thiscount;
804  mean += count;
805  meansq += count * count;
806  totalcount += count;
807  expected += count * (double) i;
808  bin = (i * nbins) / slots;
809  hystogramQ[bin] += (double) thiscount;
810  bin = i % nbins;
811  hystogramR[bin] += (double) thiscount;
812  }
813  mean /= (double) slots;
814  meansq /= (double) slots;
815 
816  /* Compute the standard deviation from both the data and the
817  ** theoretical model for a random distribution. */
818  stddev = sqrt(meansq - mean*mean);
819  exStddev = sqrt((1 - 1/(double) slots) * totalcount / (double) slots);
820 
821  retval = fprintf(fp,"Cache average accesses = %g\n", mean);
822  if (retval == EOF) return(0);
823  retval = fprintf(fp,"Cache access standard deviation = %g ", stddev);
824  if (retval == EOF) return(0);
825  retval = fprintf(fp,"(expected = %g)\n", exStddev);
826  if (retval == EOF) return(0);
827  retval = fprintf(fp,"Cache max accesses = %ld for slot %d\n", max, imax);
828  if (retval == EOF) return(0);
829  retval = fprintf(fp,"Cache min accesses = %ld for slot %d\n", min, imin);
830  if (retval == EOF) return(0);
831  exUsed = 100.0 * (1.0 - exp(-totalcount / (double) slots));
832  retval = fprintf(fp,"Cache used slots = %.2f%% (expected %.2f%%)\n",
833  100.0 - (double) nzeroes * 100.0 / (double) slots,
834  exUsed);
835  if (retval == EOF) return(0);
836 
837  if (totalcount > 0) {
838  expected /= totalcount;
839  retval = fprintf(fp,"Cache access hystogram for %d bins", nbins);
840  if (retval == EOF) return(0);
841  retval = fprintf(fp," (expected bin value = %g)\nBy quotient:",
842  expected);
843  if (retval == EOF) return(0);
844  for (i = nbins - 1; i>=0; i--) {
845  retval = fprintf(fp," %.0f", hystogramQ[i]);
846  if (retval == EOF) return(0);
847  }
848  retval = fprintf(fp,"\nBy residue: ");
849  if (retval == EOF) return(0);
850  for (i = nbins - 1; i>=0; i--) {
851  retval = fprintf(fp," %.0f", hystogramR[i]);
852  if (retval == EOF) return(0);
853  }
854  retval = fprintf(fp,"\n");
855  if (retval == EOF) return(0);
856  }
857 
858  FREE(hystogramQ);
859  FREE(hystogramR);
860 #else
861  for (i = 0; i < slots; i++) {
862  nzeroes += cache[i].h == 0;
863  }
864  exUsed = 100.0 *
865  (1.0 - exp(-(table->cacheinserts - table->cacheLastInserts) /
866  (double) slots));
867  retval = fprintf(fp,"Cache used slots = %.2f%% (expected %.2f%%)\n",
868  100.0 - (double) nzeroes * 100.0 / (double) slots,
869  exUsed);
870  if (retval == EOF) return(0);
871 #endif
872  return(1);
873 
874 } /* end of cuddCacheProfile */
875 
876 
888 void
890  DdManager * table)
891 {
892  DdCache *cache, *oldcache, *oldacache, *entry, *old;
893  int i;
894  int posn, shift;
895  unsigned int slots, oldslots;
896  double offset;
897  int moved = 0;
898  extern DD_OOMFP MMoutOfMemory;
899  DD_OOMFP saveHandler;
900 #ifndef DD_CACHE_PROFILE
901  ptruint misalignment;
902  DdNodePtr *mem;
903 #endif
904 
905  oldcache = table->cache;
906  oldacache = table->acache;
907  oldslots = table->cacheSlots;
908  slots = table->cacheSlots = oldslots << 1;
909 
910 #ifdef DD_VERBOSE
911  (void) fprintf(table->err,"Resizing the cache from %d to %d entries\n",
912  oldslots, slots);
913  (void) fprintf(table->err,
914  "\thits = %g\tmisses = %g\thit ratio = %5.3f\n",
915  table->cacheHits, table->cacheMisses,
916  table->cacheHits / (table->cacheHits + table->cacheMisses));
917 #endif
918 
919  saveHandler = MMoutOfMemory;
920  MMoutOfMemory = Cudd_OutOfMem;
921  table->acache = cache = ALLOC(DdCache,slots+1);
922  MMoutOfMemory = saveHandler;
923  /* If we fail to allocate the new table we just give up. */
924  if (cache == NULL) {
925 #ifdef DD_VERBOSE
926  (void) fprintf(table->err,"Resizing failed. Giving up.\n");
927 #endif
928  table->cacheSlots = oldslots;
929  table->acache = oldacache;
930  /* Do not try to resize again. */
931  table->maxCacheHard = oldslots - 1;
932  table->cacheSlack = - (int) (oldslots + 1);
933  return;
934  }
935  /* If the size of the cache entry is a power of 2, we want to
936  ** enforce alignment to that power of two. This happens when
937  ** DD_CACHE_PROFILE is not defined. */
938 #ifdef DD_CACHE_PROFILE
939  table->cache = cache;
940 #else
941  mem = (DdNodePtr *) cache;
942  misalignment = (ptruint) mem & (sizeof(DdCache) - 1);
943  mem += (sizeof(DdCache) - misalignment) / sizeof(DdNodePtr);
944  table->cache = cache = (DdCache *) mem;
945  assert(((ptruint) table->cache & (sizeof(DdCache) - 1)) == 0);
946 #endif
947  shift = --(table->cacheShift);
948  table->memused += (slots - oldslots) * sizeof(DdCache);
949  table->cacheSlack -= slots; /* need these many slots to double again */
950 
951  /* Clear new cache. */
952  for (i = 0; (unsigned) i < slots; i++) {
953  cache[i].data = NULL;
954  cache[i].h = 0;
955 #ifdef DD_CACHE_PROFILE
956  cache[i].count = 0;
957 #endif
958  }
959 
960  /* Copy from old cache to new one. */
961  for (i = 0; (unsigned) i < oldslots; i++) {
962  old = &oldcache[i];
963  if (old->data != NULL) {
964  posn = ddCHash2(old->h,old->f,old->g,shift);
965  entry = &cache[posn];
966  entry->f = old->f;
967  entry->g = old->g;
968  entry->h = old->h;
969  entry->data = old->data;
970 #ifdef DD_CACHE_PROFILE
971  entry->count = 1;
972 #endif
973  moved++;
974  }
975  }
976 
977  FREE(oldacache);
978 
979  /* Reinitialize measurements so as to avoid division by 0 and
980  ** immediate resizing.
981  */
982  offset = (double) (int) (slots * table->minHit + 1);
983  table->totCacheMisses += table->cacheMisses - offset;
984  table->cacheMisses = offset;
985  table->totCachehits += table->cacheHits;
986  table->cacheHits = 0;
987  table->cacheLastInserts = table->cacheinserts - (double) moved;
988 
989 } /* end of cuddCacheResize */
990 
991 
1003 void
1005  DdManager * table)
1006 {
1007  int i, slots;
1008  DdCache *cache;
1009 
1010  slots = table->cacheSlots;
1011  cache = table->cache;
1012  for (i = 0; i < slots; i++) {
1013  table->cachedeletions += cache[i].data != NULL;
1014  cache[i].data = NULL;
1015  }
1016  table->cacheLastInserts = table->cacheinserts;
1017 
1018  return;
1019 
1020 } /* end of cuddCacheFlush */
1021 
1022 
1035 int
1037  unsigned int value)
1038 {
1039  int floorLog = 0;
1040 #ifdef DD_DEBUG
1041  assert(value > 0);
1042 #endif
1043  while (value > 1) {
1044  floorLog++;
1045  value >>= 1;
1046  }
1047  return(floorLog);
1048 
1049 } /* end of cuddComputeFloorLog2 */
1050 
1051 /*---------------------------------------------------------------------------*/
1052 /* Definition of static functions */
1053 /*---------------------------------------------------------------------------*/
static char rcsid [] DD_UNUSED
Definition: cuddCache.c:92
DdHalfWord ref
Definition: cudd.h:272
DdNode * cuddCacheLookupZdd(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:409
DdNode * cuddCacheLookup2Zdd(DdManager *table, DD_CTFP op, DdNode *f, DdNode *g)
Definition: cuddCache.c:579
void cuddCacheFlush(DdManager *table)
Definition: cuddCache.c:1004
void Cudd_OutOfMem(long size)
Definition: cuddUtil.c:2845
DdNode * f
Definition: cuddInt.h:302
Definition: cudd.h:270
void cuddCacheInsert2(DdManager *table, DD_CTFP op, DdNode *f, DdNode *g, DdNode *data)
Definition: cuddCache.c:263
#define FREE(obj)
Definition: util.h:80
DdNode * data
Definition: cuddInt.h:304
#define assert(ex)
Definition: util.h:141
unsigned int maxCacheHard
Definition: cuddInt.h:343
unsigned int slots
Definition: cuddInt.h:352
ptruint h
Definition: cuddInt.h:303
#define Cudd_Regular(node)
Definition: cudd.h:384
void cuddReclaim(DdManager *table, DdNode *n)
Definition: cuddRef.c:580
void cuddCacheInsert(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h, DdNode *data)
Definition: cuddCache.c:217
FILE * err
Definition: cuddInt.h:424
DdNode * g
Definition: cuddInt.h:302
int cuddInitCache(DdManager *unique, unsigned int cacheSize, unsigned int maxCacheSize)
Definition: cuddCache.c:132
double cachecollisions
Definition: cuddInt.h:437
DdNode * DdNodePtr
Definition: cuddInt.h:253
#define DD_MIN_HIT
Definition: cuddInt.h:137
double cacheinserts
Definition: cuddInt.h:438
void(* DD_OOMFP)(long)
Definition: cudd.h:311
static int * entry
Definition: cuddGroup.c:119
DdNode * cuddCacheLookup2(DdManager *table, DD_CTFP op, DdNode *f, DdNode *g)
Definition: cuddCache.c:471
unsigned int cacheSlots
Definition: cuddInt.h:337
DdNode *(* DD_CTFP)(DdManager *, DdNode *, DdNode *)
Definition: cudd.h:308
DdNode * cuddCacheLookup1(DdManager *table, DD_CTFP1 op, DdNode *f)
Definition: cuddCache.c:525
#define ALLOC(type, num)
Definition: util.h:76
DdCache * cache
Definition: cuddInt.h:336
double totCacheMisses
Definition: cuddInt.h:436
int cuddComputeFloorLog2(unsigned int value)
Definition: cuddCache.c:1036
#define ddMax(x, y)
Definition: cuddInt.h:785
double cacheLastInserts
Definition: cuddInt.h:439
double cacheHits
Definition: cuddInt.h:340
#define ddMin(x, y)
Definition: cuddInt.h:771
#define DD_MAX_CACHE_TO_SLOTS_RATIO
Definition: cuddInt.h:145
void Cudd_SetMinHit(DdManager *dd, unsigned int hr)
Definition: cuddAPI.c:1538
int cacheSlack
Definition: cuddInt.h:342
DdNode * cuddConstantLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:690
void(* MMoutOfMemory)(long)
Definition: safe_mem.c:32
#define ddCHash2(o, f, g, s)
Definition: cuddInt.h:741
void cuddReclaimZdd(DdManager *table, DdNode *n)
Definition: cuddRef.c:634
unsigned long memused
Definition: cuddInt.h:429
unsigned int ptruint
Definition: cuddInt.h:250
int cuddCacheProfile(DdManager *table, FILE *fp)
Definition: cuddCache.c:749
double cacheMisses
Definition: cuddInt.h:339
DdNode *(* DD_CTFP1)(DdManager *, DdNode *)
Definition: cudd.h:309
double minHit
Definition: cuddInt.h:341
int cacheShift
Definition: cuddInt.h:338
double cachedeletions
Definition: cuddInt.h:440
DdCache * acache
Definition: cuddInt.h:335
struct DdCache DdCache
Cudd_ErrorType errorCode
Definition: cuddInt.h:425
DdNode * cuddCacheLookup(DdManager *table, ptruint op, DdNode *f, DdNode *g, DdNode *h)
Definition: cuddCache.c:347
DdNode * cuddCacheLookup1Zdd(DdManager *table, DD_CTFP1 op, DdNode *f)
Definition: cuddCache.c:633
void cuddCacheInsert1(DdManager *table, DD_CTFP1 op, DdNode *f, DdNode *data)
Definition: cuddCache.c:305
void cuddCacheResize(DdManager *table)
Definition: cuddCache.c:889
double totCachehits
Definition: cuddInt.h:435