Macros | Functions
omBin.h File Reference

Go to the source code of this file.

Macros

#define omGetAlignedSpecBin(size)   _omGetSpecBin(size, 1, 0)
 
#define omGetSpecBin(size)   _omGetSpecBin(size, 0, 0)
 
#define omUnGetSpecBin(bin_ptr)   _omUnGetSpecBin(bin_ptr, 0)
 
#define omDeleteSpecBin(bin_ptr)   _omUnGetSpecBin(bin_ptr, 1)
 
#define omIsStickyBin(bin)   (bin->sticky >= SIZEOF_VOIDP)
 
#define omIsStaticNormalBin(bin)
 
#define omIsNormalBin(bin)   omIsStaticNormalBin(bin) || omFindInGList(om_SpecBin, next, bin, bin) || omIsStickyBin(bin)
 
#define omIsSpecBin(bin)   (!omIsStaticNormalBin(bin) && !omIsStickyBin(bin))
 
#define omIsKnownTopBin(bin, normal_bin)   1
 
#define omIsStaticTrackBin(bin)   0
 
#define omIsTrackBin(bin)   0
 
#define omIsStaticBin(bin)   omIsStaticNormalBin(bin) || omIsStaticTrackBin(bin)
 

Functions

omBin _omGetSpecBin (size_t size, int align, int track)
 
void _omUnGetSpecBin (omBin *bin, int force)
 
long omGetUsedBinBytes ()
 
omBin omGetStickyBinOfBin (omBin bin)
 
void omMergeStickyBinIntoBin (omBin sticky_bin, omBin into_bin)
 
unsigned long omGetNewStickyBinTag (omBin bin)
 
void omSetStickyBinTag (omBin bin, unsigned long sticky)
 
void omUnSetStickyBinTag (omBin bin, unsigned long sticky)
 
void omDeleteStickyBinTag (omBin bin, unsigned long sticky)
 
unsigned long omGetNewStickyAllBinTag ()
 
void omSetStickyAllBinTag (unsigned long sticky)
 
void omUnSetStickyAllBinTag (unsigned long sticky)
 
void omDeleteStickyAllBinTag (unsigned long sticky)
 
void omPrintBinStats (FILE *fd)
 
int omIsKnownTopBin (omBin bin, int normal_bin)
 

Macro Definition Documentation

#define omDeleteSpecBin (   bin_ptr)    _omUnGetSpecBin(bin_ptr, 1)

Definition at line 15 of file omBin.h.

#define omGetAlignedSpecBin (   size)    _omGetSpecBin(size, 1, 0)

Definition at line 10 of file omBin.h.

#define omGetSpecBin (   size)    _omGetSpecBin(size, 0, 0)

Definition at line 11 of file omBin.h.

#define omIsKnownTopBin (   bin,
  normal_bin 
)    1

Definition at line 55 of file omBin.h.

#define omIsNormalBin (   bin)    omIsStaticNormalBin(bin) || omFindInGList(om_SpecBin, next, bin, bin) || omIsStickyBin(bin)

Definition at line 46 of file omBin.h.

#define omIsSpecBin (   bin)    (!omIsStaticNormalBin(bin) && !omIsStickyBin(bin))

Definition at line 47 of file omBin.h.

#define omIsStaticBin (   bin)    omIsStaticNormalBin(bin) || omIsStaticTrackBin(bin)

Definition at line 59 of file omBin.h.

#define omIsStaticNormalBin (   bin)
Value:
((unsigned long) bin >= ((unsigned long) &om_StaticBin[0]) && \
(unsigned long) bin <= ((unsigned long) &om_StaticBin[OM_MAX_BIN_INDEX]))
omBin_t om_StaticBin[]

Definition at line 43 of file omBin.h.

#define omIsStaticTrackBin (   bin)    0

Definition at line 56 of file omBin.h.

#define omIsStickyBin (   bin)    (bin->sticky >= SIZEOF_VOIDP)

Definition at line 33 of file omBin.h.

#define omIsTrackBin (   bin)    0

Definition at line 57 of file omBin.h.

#define omUnGetSpecBin (   bin_ptr)    _omUnGetSpecBin(bin_ptr, 0)

Definition at line 14 of file omBin.h.

Function Documentation

omBin _omGetSpecBin ( size_t  size,
int  align,
int  track 
)

Definition at line 24 of file omBin.c.

26 {
27  omBin om_new_specBin;
28  long max_blocks;
29  long sizeW;
30 
31 
32  size = OM_ALIGN_SIZE(size);
33 #ifdef OM_ALIGNMENT_NEEDS_WORK
34  if (align || size >= OM_SIZEOF_UNIQUE_MAX_BLOCK_THRESHOLD)
35  {
36  align = 1;
37  size = OM_STRICT_ALIGN_SIZE(size);
38  }
39 #else
40  align = 0;
41 #endif
42 
44  {
45  /* need page header */
46  max_blocks = - (long)
47  ((size+(SIZEOF_SYSTEM_PAGE-SIZEOF_OM_BIN_PAGE))+SIZEOF_SYSTEM_PAGE-1)
48  / SIZEOF_SYSTEM_PAGE;
49  sizeW = ((-max_blocks*SIZEOF_SYSTEM_PAGE) -
50  (SIZEOF_SYSTEM_PAGE - SIZEOF_OM_BIN_PAGE)) / SIZEOF_LONG;
51  om_new_specBin = om_LargeBin;
52  }
53  else
54  {
55  /* SIZEOF_OM_BIN_PAGE == max_blocks*size + r1; r1 < size */
56  /* r1 = max_blocks*(size_padding) + r2; r2 < max_blocks */
57  max_blocks = SIZEOF_OM_BIN_PAGE / size;
58  sizeW = (SIZEOF_OM_BIN_PAGE % size) / max_blocks;
59 #ifdef OM_ALIGNMENT_NEEDS_WORK
60  if (align)
61  sizeW = ((size + sizeW) & ~ (SIZEOF_STRICT_ALIGNMENT - 1));
62  else
63 #endif
64  sizeW = ((size + sizeW) & ~ (SIZEOF_OM_ALIGNMENT - 1));
65 
66  omAssume(sizeW >= size);
67  omAssume(max_blocks*sizeW <= SIZEOF_OM_BIN_PAGE);
68  omAssume((max_blocks+1)*sizeW > SIZEOF_OM_BIN_PAGE ||
69  max_blocks*(sizeW + SIZEOF_STRICT_ALIGNMENT) > SIZEOF_OM_BIN_PAGE);
70 
71  sizeW = sizeW >> LOG_SIZEOF_LONG;
72  if (size > OM_MAX_BLOCK_SIZE)
73  {
74  om_new_specBin = om_LargeBin;
75  }
76 #ifdef OM_ALIGNMENT_NEEDS_WORK
77  else if (align)
78  {
79  om_new_specBin = omSmallSize2AlignedBin( size );
80  }
81 #endif
82 #ifdef OM_HAVE_TRACK
83  else if (track)
84  {
85  om_new_specBin = omSmallSize2TrackBin( size );
86  }
87 #endif
88  else
89  {
90  om_new_specBin = omSmallSize2Bin( size );
91  }
92  }
93 
94  if (om_new_specBin == om_LargeBin ||
95  om_new_specBin->max_blocks < max_blocks)
96  {
97  omSpecBin s_bin;
98 #ifdef OM_HAVE_TRACK
99  if (track)
100  s_bin = omFindInSortedGList(om_SpecTrackBin, next, max_blocks, max_blocks);
101  else
102 #endif
103  s_bin = omFindInSortedGList(om_SpecBin, next, max_blocks, max_blocks);
104 
105  if (s_bin != NULL)
106  {
107  (s_bin->ref)++;
108  omAssume(s_bin->bin != NULL &&
109  s_bin->bin->max_blocks == s_bin->max_blocks &&
110  s_bin->bin->sizeW == sizeW);
111  return s_bin->bin;
112  }
113  s_bin = (omSpecBin) omAlloc(sizeof(omSpecBin_t));
114  s_bin->ref = 1;
115  s_bin->next = NULL;
116  s_bin->max_blocks = max_blocks;
117  s_bin->bin = (omBin) omAlloc(sizeof(omBin_t));
118  s_bin->bin->current_page = om_ZeroPage;
119  s_bin->bin->last_page = NULL;
120  s_bin->bin->next = NULL;
121  s_bin->bin->sizeW = sizeW;
122  s_bin->bin->max_blocks = max_blocks;
123  s_bin->bin->sticky = 0;
124 #ifdef OM_HAVE_TRACK
125  if (track)
126  {
127  om_SpecTrackBin = omInsertInSortedGList(om_SpecTrackBin, next, max_blocks, s_bin);
128  }
129  else
130 #endif
131  om_SpecBin = omInsertInSortedGList(om_SpecBin, next, max_blocks, s_bin);
132  return s_bin->bin;
133  }
134  else
135  {
136  return om_new_specBin;
137  }
138 }
omBin_t * omBin
Definition: omStructs.h:12
#define omSmallSize2AlignedBin
Definition: omtTestAlloc.c:29
#define omFindInSortedGList(ptr, next, what, value)
Definition: omList.h:108
#define omAlloc(size)
Definition: omAllocDecl.h:210
omBinPage_t om_ZeroPage[]
Definition: om_Alloc.c:17
#define omInsertInSortedGList(ptr, next, what, addr)
Definition: omList.h:106
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
#define omAssume(x)
Definition: omError.h:85
#define om_LargeBin
Definition: omBin.c:23
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
#define OM_MAX_BLOCK_SIZE
Definition: omTables.c:31
#define NULL
Definition: omList.c:10
#define omSmallSize2Bin(size)
#define SIZEOF_OM_BIN_PAGE
ListNode * next
Definition: janet.h:31
void _omUnGetSpecBin ( omBin bin,
int  force 
)

Definition at line 140 of file omBin.c.

141 {
142  omBin bin = *bin_p;
143  if (! omIsStaticBin(bin))
144  {
145 #ifdef OM_HAVE_TRACK
146  int track_bin = 0;
147 #endif
148  omSpecBin s_bin;
149 
150 #ifdef OM_HAVE_TRACK
151  s_bin = omFindInGList(om_SpecTrackBin, next, bin, bin);
152  if (s_bin != NULL)
153  track_bin = 1;
154  else
155 #endif
156  s_bin = omFindInSortedGList(om_SpecBin, next, max_blocks, bin->max_blocks);
157 
158  omAssume(s_bin != NULL && bin == s_bin->bin);
159  if (s_bin != NULL)
160  {
161  (s_bin->ref)--;
162  if (s_bin->ref == 0 || force)
163  {
164 #ifdef OM_HAVE_TRACK
165  if (! track_bin)
166 #endif
167  omFreeKeptAddrFromBin(s_bin->bin);
168  if(s_bin->bin->last_page == NULL || force)
169  {
170 #ifdef OM_HAVE_TRACK
171  if (track_bin)
172  om_SpecTrackBin = omRemoveFromSortedGList(om_SpecTrackBin, next, max_blocks, s_bin);
173  else
174 #endif
175  om_SpecBin = omRemoveFromSortedGList(om_SpecBin, next, max_blocks, s_bin);
176  omFreeSize(s_bin->bin, sizeof(omBin_t));
177  omFreeSize(s_bin, sizeof(omSpecBin_t));
178  }
179  }
180  }
181  }
182  *bin_p = NULL;
183 }
#define omRemoveFromSortedGList(ptr, next, what, addr)
Definition: omList.h:110
omBin_t * omBin
Definition: omStructs.h:12
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void omFreeKeptAddrFromBin(omBin bin)
Definition: omDebug.c:542
#define omFindInSortedGList(ptr, next, what, value)
Definition: omList.h:108
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
#define omAssume(x)
Definition: omError.h:85
#define NULL
Definition: omList.c:10
#define omIsStaticBin(bin)
Definition: omBin.h:59
#define omFindInGList(ptr, next, what, value)
Definition: omList.h:104
ListNode * next
Definition: janet.h:31
void omDeleteStickyAllBinTag ( unsigned long  sticky)

Definition at line 568 of file omBin.c.

569 {
570  omSpecBin s_bin = om_SpecBin;
571  int i;
572  for (i=0; i<=OM_MAX_BIN_INDEX; i++)
573  {
574  omDeleteStickyBinTag(&(om_StaticBin[i]), sticky);
575  }
576  while (s_bin != NULL)
577  {
578  omDeleteStickyBinTag(s_bin->bin, sticky);
579  s_bin = s_bin->next;
580  }
581 }
omBin_t om_StaticBin[]
void omDeleteStickyBinTag(omBin bin, unsigned long sticky)
Definition: omBin.c:337
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
void omDeleteStickyBinTag ( omBin  bin,
unsigned long  sticky 
)

Definition at line 337 of file omBin.c.

338 {
339  omBin no_sticky_bin = NULL;
340  omBin sticky_bin = NULL;
341 
342  if (sticky == 0)
343  {
344  omAssume(0);
345  return;
346  }
347 
348  sticky_bin = omGetStickyBin(bin, sticky);
349  if (sticky_bin != NULL)
350  {
351  no_sticky_bin = omGetStickyBin(bin, 0);
352  omAssume(no_sticky_bin != NULL && sticky_bin != no_sticky_bin);
353 
354  omMergeStickyPages(no_sticky_bin, sticky_bin);
355 
356  if (bin == sticky_bin)
357  {
358  sticky_bin = no_sticky_bin;
359  omSetStickyBinTag(bin, 0);
360  }
361  bin->next = omRemoveFromGList(bin->next, next, sticky_bin);
362  omFreeSize(sticky_bin, sizeof(omBin_t));
363  }
364 }
#define omRemoveFromGList(ptr, next, addr)
Definition: omList.h:102
omBin_t * omBin
Definition: omStructs.h:12
#define omGetStickyBin(bin, sticky_tag)
Definition: omBin.c:191
static void omMergeStickyPages(omBin to_bin, omBin from_bin)
Definition: omBin.c:265
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void omSetStickyBinTag(omBin bin, unsigned long sticky_tag)
Definition: omBin.c:235
#define omAssume(x)
Definition: omError.h:85
#define NULL
Definition: omList.c:10
ListNode * next
Definition: janet.h:31
unsigned long omGetNewStickyAllBinTag ( )

Definition at line 484 of file omBin.c.

485 {
486  unsigned long sticky = 0, new_sticky;
487  int i;
488  omSpecBin s_bin;
489  // first, find new sticky tag
490  for (i=0; i<=OM_MAX_BIN_INDEX; i++)
491  {
492  new_sticky = omGetMaxStickyBinTag(&(om_StaticBin[i]));
493  if (new_sticky > sticky) sticky = new_sticky;
494  }
495  s_bin = om_SpecBin;
496  while (s_bin != NULL)
497  {
498  new_sticky = omGetMaxStickyBinTag(s_bin->bin);
499  if (new_sticky > sticky) sticky = new_sticky;
500  s_bin = s_bin->next;
501  }
502  if (sticky < BIT_SIZEOF_LONG - 2)
503  {
504  sticky++;
505  for (i=0; i<=OM_MAX_BIN_INDEX; i++)
506  {
507  omCreateStickyBin(&(om_StaticBin[i]), sticky);
508  }
509  s_bin = om_SpecBin;
510  while (s_bin != NULL)
511  {
512  omCreateStickyBin(s_bin->bin, sticky);
513  s_bin = s_bin->next;
514  }
515  return sticky;
516  }
517  else
518  {
519  omBin bin;
520  omAssume(sticky == BIT_SIZEOF_LONG - 1);
521  for (i=0; i<=OM_MAX_BIN_INDEX; i++)
522  {
523  bin = &om_StaticBin[i];
524  if (omGetStickyBin(bin, BIT_SIZEOF_LONG -1) == NULL)
526  }
527  s_bin = om_SpecBin;
528  while (s_bin != NULL)
529  {
530  if (omGetStickyBin(s_bin->bin, BIT_SIZEOF_LONG -1) == NULL)
531  omCreateStickyBin(s_bin->bin, BIT_SIZEOF_LONG -1);
532  s_bin = s_bin->next;
533  }
534  return BIT_SIZEOF_LONG - 1;
535  }
536 }
omBin_t * omBin
Definition: omStructs.h:12
#define omGetStickyBin(bin, sticky_tag)
Definition: omBin.c:191
omBin_t om_StaticBin[]
static omBin omCreateStickyBin(omBin bin, unsigned long sticky)
Definition: omBin.c:194
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
#define omAssume(x)
Definition: omError.h:85
unsigned long omGetMaxStickyBinTag(omBin bin)
Definition: omBin.c:207
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:124
unsigned long omGetNewStickyBinTag ( omBin  bin)

Definition at line 219 of file omBin.c.

220 {
221  unsigned long sticky = omGetMaxStickyBinTag(bin);
222  if (sticky < BIT_SIZEOF_LONG - 2)
223  {
224  sticky++;
225  omCreateStickyBin(bin, sticky);
226  return sticky;
227  }
228  else
229  {
230  omAssume(sticky == BIT_SIZEOF_LONG - 1);
231  }
232  return sticky;
233 }
static omBin omCreateStickyBin(omBin bin, unsigned long sticky)
Definition: omBin.c:194
#define omAssume(x)
Definition: omError.h:85
unsigned long omGetMaxStickyBinTag(omBin bin)
Definition: omBin.c:207
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:124
omBin omGetStickyBinOfBin ( omBin  bin)

Definition at line 373 of file omBin.c.

374 {
375  omBin new_bin = omAlloc(sizeof(omBin_t));
376  omAssume(omIsKnownTopBin(bin, 1) && ! omIsStickyBin(bin));
377  new_bin->sticky = SIZEOF_VOIDP;
378  new_bin->max_blocks = bin->max_blocks;
379  new_bin->sizeW = bin->sizeW;
380  new_bin->next = om_StickyBins;
381  om_StickyBins = new_bin;
382  new_bin->last_page = NULL;
383  new_bin->current_page = om_ZeroPage;
384 #if 0
385  if (omIsSpecBin(bin))
386  {
387  omSpecBin s_bin = omFindInSortedGList(om_SpecBin, next, max_blocks, bin->max_blocks);
388  omAssume(s_bin != NULL);
389  if (s_bin != NULL)
390  s_bin->ref++;
391  }
392 #endif
393  return new_bin;
394 }
omBin_t * omBin
Definition: omStructs.h:12
#define omFindInSortedGList(ptr, next, what, value)
Definition: omList.h:108
#define omAlloc(size)
Definition: omAllocDecl.h:210
omBinPage_t om_ZeroPage[]
Definition: om_Alloc.c:17
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
#define omIsStickyBin(bin)
Definition: omBin.h:33
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
int omIsKnownTopBin(omBin bin, int normal_bin)
Definition: omBin.c:440
#define omIsSpecBin(bin)
Definition: omBin.h:47
#define omAssume(x)
Definition: omError.h:85
omBin om_StickyBins
Definition: omBin.c:372
#define NULL
Definition: omList.c:10
ListNode * next
Definition: janet.h:31
long omGetUsedBinBytes ( )

Definition at line 760 of file omBin.c.

761 {
762  int i = OM_MAX_BIN_INDEX;
763  omSpecBin s_bin = om_SpecBin;
764  long used = 0;
765  omBin sticky;
766 
767  for (; i>=0; i--)
768  {
769  used += omGetUsedBytesOfBin(&om_StaticBin[i]);
770  }
771  while (s_bin != NULL)
772  {
773  used += omGetUsedBytesOfBin(s_bin->bin);
774  s_bin = s_bin->next;
775  }
776 #ifdef OM_HAVE_TRACK
777  for (i=OM_MAX_BIN_INDEX; i>=0; i--)
778  {
779  used += omGetUsedBytesOfBin(&om_StaticTrackBin[i]);
780  }
781  s_bin = om_SpecTrackBin;
782  while (s_bin != NULL)
783  {
784  used += omGetUsedBytesOfBin(s_bin->bin);
785  s_bin = s_bin->next;
786  }
787 #endif
788 
789  sticky = om_StickyBins;
790  while (sticky != NULL)
791  {
792  used += omGetUsedBytesOfBin(sticky);
793  sticky = sticky->next;
794  }
795  return used;
796 }
omBin_t * omBin
Definition: omStructs.h:12
omBin_t om_StaticBin[]
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
int i
Definition: cfEzgcd.cc:123
omBin om_StickyBins
Definition: omBin.c:372
#define NULL
Definition: omList.c:10
static long omGetUsedBytesOfBin(omBin bin)
Definition: omBin.c:753
int omIsKnownTopBin ( omBin  bin,
int  normal_bin 
)

Definition at line 440 of file omBin.c.

441 {
442  omBin to_check;
443  omSpecBin s_bin;
444  int i;
445 
446  omAssume(normal_bin == 1 || normal_bin == 0);
447 
448 #ifdef OM_HAVE_TRACK
449  if (! normal_bin)
450  {
451  to_check = om_StaticTrackBin;
452  s_bin = om_SpecTrackBin;
453  }
454  else
455 #endif
456  {
457  omAssume(normal_bin);
458  to_check = om_StaticBin;
459  s_bin = om_SpecBin;
460  }
461 
462  for (i=0; i<= OM_MAX_BIN_INDEX; i++)
463  {
464  if (bin == &(to_check[i]))
465  return 1;
466  }
467 
468  while (s_bin != NULL)
469  {
470  if (bin == s_bin->bin) return 1;
471  s_bin = s_bin->next;
472  }
473  to_check = om_StickyBins;
474 
475  while (to_check != NULL)
476  {
477  if (bin == to_check) return 1;
478  to_check = to_check->next;
479  }
480  return 0;
481 }
omBin_t * omBin
Definition: omStructs.h:12
omBin_t om_StaticBin[]
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
#define omAssume(x)
Definition: omError.h:85
int i
Definition: cfEzgcd.cc:123
omBin om_StickyBins
Definition: omBin.c:372
#define NULL
Definition: omList.c:10
void omMergeStickyBinIntoBin ( omBin  sticky_bin,
omBin  into_bin 
)

Definition at line 396 of file omBin.c.

397 {
398  if (! omIsOnGList(om_StickyBins, next, sticky_bin) ||
399  !sticky_bin->sticky ||
400  sticky_bin->max_blocks != into_bin->max_blocks ||
401  sticky_bin == into_bin ||
402  !omIsKnownTopBin(into_bin, 1) ||
403  omIsStickyBin(into_bin))
404  {
405 #ifndef OM_NDEBUG
407  (! omIsOnGList(om_StickyBins, next, sticky_bin) ? "unknown sticky_bin" :
408  (!sticky_bin->sticky ? "sticky_bin is not sticky" :
409  (sticky_bin->max_blocks != into_bin->max_blocks ? "sticky_bin and into_bin have different block sizes" :
410  (sticky_bin == into_bin ? "sticky_bin == into_bin" :
411  (!omIsKnownTopBin(into_bin, 1) ? "unknown into_bin" :
412  (omIsStickyBin(into_bin) ? "into_bin is sticky" :
413  "unknown sticky_bin error")))))));
414 #endif
415  return;
416  }
417  omFreeKeptAddrFromBin(sticky_bin);
419  omMergeStickyPages(into_bin, sticky_bin);
420 
421 #if 0
422  if (! omIsStaticBin(into_bin))
423  {
424  omBin _ibin = into_bin;
425  omUnGetSpecBin(&_ibin);
426  }
427 #endif
428  omFreeSize(sticky_bin, sizeof(omBin_t));
429 #if defined(OM_INTERNAL_DEBUG) && !defined(OM_NDEBUG)
430  omTestBin(into_bin, 2);
431 #endif
432 }
#define omRemoveFromGList(ptr, next, addr)
Definition: omList.h:102
omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL, const char *fmt,...)
Definition: omError.c:78
omBin_t * omBin
Definition: omStructs.h:12
static void omMergeStickyPages(omBin to_bin, omBin from_bin)
Definition: omBin.c:265
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void omFreeKeptAddrFromBin(omBin bin)
Definition: omDebug.c:542
#define omUnGetSpecBin(bin_ptr)
Definition: omBin.h:14
omError_t omTestBin(omBin bin, int check_level)
Definition: omDebug.c:90
#define omIsStickyBin(bin)
Definition: omBin.h:33
int omIsKnownTopBin(omBin bin, int normal_bin)
Definition: omBin.c:440
omBin om_StickyBins
Definition: omBin.c:372
#define omIsStaticBin(bin)
Definition: omBin.h:59
#define omIsOnGList(ptr, next, addr)
Definition: omList.h:100
ListNode * next
Definition: janet.h:31
void omPrintBinStats ( FILE *  fd)

Definition at line 692 of file omBin.c.

693 {
694  int i = OM_MAX_BIN_INDEX, pages=0, used_blocks=0, free_blocks=0;
695  int pages_p, used_blocks_p, free_blocks_p;
696  omSpecBin s_bin = om_SpecBin;
697  omBin sticky;
698 
699  fprintf(fd, " SizeW\tBlocks\tUPages\tFBlocks\tUBlocks\tSticky\n");
700  fflush(fd);
701  while (s_bin != NULL || i >= 0)
702  {
703  if (s_bin == NULL || (i >= 0 && (unsigned long) om_StaticBin[i].max_blocks < (unsigned long) s_bin->bin->max_blocks))
704  {
705  omPrintBinStat(fd, &om_StaticBin[i], 0, &pages_p, &used_blocks_p, &free_blocks_p);
706  pages += pages_p;
707  used_blocks += used_blocks_p;
708  free_blocks += free_blocks_p;
709 #ifdef OM_HAVE_TRACK
710  if (om_StaticTrackBin[i].current_page != om_ZeroPage)
711  {
712  omPrintBinStat(fd, &om_StaticTrackBin[i], 1, &pages_p, &used_blocks_p, &free_blocks_p);
713  pages += pages_p;
714  used_blocks += used_blocks_p;
715  free_blocks += free_blocks_p;
716  }
717 #endif
718  i--;
719  }
720  else
721  {
722  omPrintBinStat(fd, s_bin->bin,0, &pages_p, &used_blocks_p, &free_blocks_p);
723  pages += pages_p;
724  used_blocks += used_blocks_p;
725  free_blocks += free_blocks_p;
726  s_bin = s_bin->next;
727  }
728  }
729 #ifdef OM_HAVE_TRACK
730  s_bin = om_SpecTrackBin;
731  while (s_bin != NULL)
732  {
733  omPrintBinStat(fd, s_bin->bin, 0, &pages_p, &used_blocks_p, &free_blocks_p);
734  s_bin = s_bin->next;
735  pages += pages_p;
736  used_blocks += used_blocks_p;
737  free_blocks += free_blocks_p;
738  }
739 #endif
740  sticky = om_StickyBins;
741  while (sticky != NULL)
742  {
743  omPrintBinStat(fd, sticky, 0, &pages_p, &used_blocks_p, &free_blocks_p);
744  sticky = sticky->next;
745  pages += pages_p;
746  used_blocks += used_blocks_p;
747  free_blocks += free_blocks_p;
748  }
749  fprintf(fd, "----------------------------------------\n");
750  fprintf(fd, " \t \t%d\t%d\t%d\n", pages, free_blocks, used_blocks);
751 }
int status int fd
Definition: si_signals.h:59
omBin_t * omBin
Definition: omStructs.h:12
omBin_t om_StaticBin[]
omBinPage_t om_ZeroPage[]
Definition: om_Alloc.c:17
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
static void omPrintBinStat(FILE *fd, omBin bin, int track, int *pages, int *used_blocks, int *free_blocks)
Definition: omBin.c:661
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
int i
Definition: cfEzgcd.cc:123
omBin om_StickyBins
Definition: omBin.c:372
#define NULL
Definition: omList.c:10
void omSetStickyAllBinTag ( unsigned long  sticky)

Definition at line 538 of file omBin.c.

539 {
540  omSpecBin s_bin = om_SpecBin;
541  int i;
542  for (i=0; i<=OM_MAX_BIN_INDEX; i++)
543  {
544  omSetStickyBinTag(&(om_StaticBin[i]), sticky);
545  }
546  while (s_bin != NULL)
547  {
548  omSetStickyBinTag(s_bin->bin, sticky);
549  s_bin = s_bin->next;
550  }
551 }
omBin_t om_StaticBin[]
void omSetStickyBinTag(omBin bin, unsigned long sticky_tag)
Definition: omBin.c:235
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
void omSetStickyBinTag ( omBin  bin,
unsigned long  sticky 
)

Definition at line 235 of file omBin.c.

236 {
237  omBin s_bin;
238  s_bin = omGetStickyBin(bin, sticky_tag);
239 
240  if (s_bin != bin)
241  {
242  omBinPage tc, tl;
243  unsigned long ts;
244 
245  if (s_bin == NULL) s_bin = omCreateStickyBin(bin, sticky_tag);
246  ts = bin->sticky;
247  tl = bin->last_page;
248  tc = bin->current_page;
249  bin->sticky = s_bin->sticky;
250  bin->current_page = s_bin->current_page;
251  bin->last_page = s_bin->last_page;
252  s_bin->sticky = ts;
253  s_bin->last_page = tl;
254  s_bin->current_page = tc;
255  }
256 }
omBin_t * omBin
Definition: omStructs.h:12
#define omGetStickyBin(bin, sticky_tag)
Definition: omBin.c:191
static omBin omCreateStickyBin(omBin bin, unsigned long sticky)
Definition: omBin.c:194
omBinPage_t * omBinPage
Definition: omStructs.h:16
#define NULL
Definition: omList.c:10
void omUnSetStickyAllBinTag ( unsigned long  sticky)

Definition at line 553 of file omBin.c.

554 {
555  omSpecBin s_bin = om_SpecBin;
556  int i;
557  for (i=0; i<=OM_MAX_BIN_INDEX; i++)
558  {
559  omUnSetStickyBinTag(&(om_StaticBin[i]), sticky);
560  }
561  while (s_bin != NULL)
562  {
563  omUnSetStickyBinTag(s_bin->bin, sticky);
564  s_bin = s_bin->next;
565  }
566 }
omBin_t om_StaticBin[]
omSpecBin_t * omSpecBin
Definition: omStructs.h:30
omSpecBin om_SpecBin
Definition: om_Alloc.c:18
int i
Definition: cfEzgcd.cc:123
void omUnSetStickyBinTag(omBin bin, unsigned long sticky)
Definition: omBin.c:258
#define NULL
Definition: omList.c:10
void omUnSetStickyBinTag ( omBin  bin,
unsigned long  sticky 
)

Definition at line 258 of file omBin.c.

259 {
260  omAssume(omGetStickyBin(bin, 0) != NULL);
261  if (bin->sticky == sticky)
262  omSetStickyBinTag(bin, 0);
263 }
#define omGetStickyBin(bin, sticky_tag)
Definition: omBin.c:191
void omSetStickyBinTag(omBin bin, unsigned long sticky_tag)
Definition: omBin.c:235
#define omAssume(x)
Definition: omError.h:85
#define NULL
Definition: omList.c:10