libsrc/credel.cxx File Reference

enfilade creation and deletion routines More...

#include <memory.h>
#include <malloc.h>
#include <unistd.h>
#include "udanax.h"

Include dependency graph for credel.cxx:

Include dependency graph

Go to the source code of this file.

Defines

#define NEWALLOC
#define MAXALLOCQUEUEARRAY   500

Functions

bool isreapable (int *fuckinap, typecorecrum *localreaper)
 ???

void reap (typecorecrum *localreaper)
 ???

void initqueues ()
 ???

char * allocfromqueue (int n)
 ???

void freetoqueue (char *ptr)
 ???

typecorecrumcreatecruminternal (int crumheight, int enftype, typecorecrum *allocated)
void initcrum (int crumheight, int enftype, typecorecrum *ptr)
 ???

void xgrabmorecore ()
 ???

void grimlyreap ()
 ???

int * ealloc (unsigned nbytes)
 ???

void efree (char *ptr)
 ???

int * eallocwithtag (unsigned nbytes, tagtype tag)
 ???

void initgrimreaper ()
 ???

int testforrejuvinate (typecorecrum *ptr)
 ???

void funcrejuvinate (typecorecrum *ptr)
 ???

void reserve (typecorecrum *ptr)
 ???

void testforreservedness (char *msg)
 ???

void subtreefree (typecorecrum *ptr)
 ???

void freecrum (typecorecrum *ptr)
 ???

void loaffree (typecuc *father)
 ???

void orglfree (typecuc *ptr)
 ???

typecuccreateenf (int enftype)
 ???

typecorecrumcreatecrum (int crumheight, int enftype)
 ???


Variables

typecorecrumgrimreaper
int ingrimreaper = false
int reaplevel = 0
int timesaroundreaper = 0
int crumnumber = 0
int reapnumber = 0
int nreapings = 0
int reservnumber = 0
queue allocqueuearray [MAXALLOCQUEUEARRAY]


Detailed Description

enfilade creation and deletion routines

(to be defined)

Definition in file credel.cxx.


Define Documentation

#define MAXALLOCQUEUEARRAY   500
 

Definition at line 99 of file credel.cxx.

Referenced by initqueues().

#define NEWALLOC
 

Definition at line 87 of file credel.cxx.


Function Documentation

char* allocfromqueue int  n  )  [static]
 

???

(to be defined)

Definition at line 153 of file credel.cxx.

References allocqueuearray, HEADER, and qremove().

Referenced by ealloc().

00155 {
00156     return (char *) qremove(&allocqueuearray[((n + sizeof(HEADER) - 1) / sizeof(HEADER))]);
00157 }

typecorecrum* createcrum int  crumheight,
int  enftype
 

???

(to be defined)

Definition at line 865 of file credel.cxx.

References createcruminternal(), grimreaper, typecorecrumhedr::nextcrum, NULL, typecorecrumhedr::prevcrum, and typecorecrum.

Referenced by createenf(), initkluge(), inorglinternal(), insertcbcnd(), insertseq(), levelpush(), makecutsbackuptohere(), peelcrumoffnd(), peeloffcorrectson(), peelsoncorrectly(), splitcrumseq(), and varunpackloaf().

00868 {
00869     typecorecrum *ptr = createcruminternal(crumheight, enftype, (typecorecrum *) NULL);
00870 
00871     if (grimreaper) {
00872         ptr->nextcrum                  = grimreaper;
00873         ptr->prevcrum                  = grimreaper->prevcrum;
00874         grimreaper->prevcrum->nextcrum = ptr;
00875         grimreaper->prevcrum           = ptr;
00876     } else
00877         grimreaper = ptr->nextcrum = ptr->prevcrum = ptr;
00878 
00879     return ptr;
00880 }

typecorecrum* createcruminternal int  crumheight,
int  enftype,
typecorecrum allocated
[static]
 

Definition at line 182 of file credel.cxx.

References typecorecrumhedr::age, assert, CBCTAG, typecorecrumhedr::cdsp, typecorecrumhedr::cenftype, clear, crumnumber, CUCTAG, typecorecrumhedr::cwid, DISKPTRNULL, eallocwithtag(), GRAN, GRANCLEARLYILLEGALINFO, typecorecrumhedr::height, L, typecorecrumhedr::leftbroorfather, NEW, NULL, POOM, typecorecrumhedr::rightbro, SPAN, tagtype, and typecorecrum.

Referenced by createcrum(), and initcrum().

00186 {
00187     unsigned crumsize = 0;
00188 
00189     if (crumheight == 0) {
00190         switch (enftype) {
00191         case GRAN:
00192             crumsize = sizeof(typecbc);
00193             break;
00194         case SPAN:
00195         case POOM:
00196             crumsize = sizeof( /* typecbc */ type2dcbc);
00197             break;
00198         default:
00199             L(" enftype = %d\n", enftype);
00200             assert(0); // createcrum illegal enftype
00201         }
00202     } else
00203         crumsize = sizeof(typecuc);
00204 
00205     typecorecrum *ptr;
00206     if (!allocated)
00207         ptr = (typecorecrum *) eallocwithtag(crumsize, (tagtype) (crumheight > 0 ? CUCTAG : CBCTAG));
00208     else
00209         ptr = allocated;
00210 
00211     ptr->height          = crumheight;
00212     ptr->isapex          = false;
00213     ptr->cenftype        = enftype;
00214     ptr->modified        = true /*false*/;
00215     ptr->isleftmost      = false;
00216     ptr->age             = NEW;
00217     ptr->leftbroorfather = NULL;
00218     ptr->rightbro        = NULL;
00219 
00220     clear(&ptr->cdsp, sizeof(ptr->cdsp));
00221     clear(&ptr->cwid, sizeof(ptr->cwid));
00222 
00223     if (crumheight > 0) {
00224         ((typecuc *) ptr)->numberofsons              = 0;
00225         ((typecuc *) ptr)->leftson                   = NULL;
00226         ((typecuc *) ptr)->sonorigin.diskblocknumber = DISKPTRNULL;
00227 
00228     } else {
00229         if (enftype == GRAN) {
00230             clear(&((typecbc *) ptr)->cinfo, sizeof(((typecbc *) ptr)->cinfo));
00231             ((typecbc *) ptr)->cinfo.infotype = GRANCLEARLYILLEGALINFO;
00232         } else
00233             clear(&((type2dcbc *) ptr)->c2dinfo, sizeof(((type2dcbc *) ptr)->c2dinfo));
00234     }
00235     ++crumnumber;
00236 
00237     return ptr;
00238 }

typecuc* createenf int  enftype  ) 
 

???

(to be defined)

Definition at line 833 of file credel.cxx.

References adopt(), typecuc::cenftype, createcrum(), GRAN, GRANNULL, ivemodified(), SON, and typecorecrum.

Referenced by createorglgr(), and initsession().

00835 {
00836     typecuc *fullcrumptr = (typecuc *) createcrum(1, enftype);
00837 
00838     fullcrumptr->cenftype   = enftype;
00839     fullcrumptr->isapex     = true;
00840     fullcrumptr->isleftmost = true;
00841 
00842     typecorecrum *ptr = createcrum(0, enftype);
00843 
00844     adopt(ptr, SON, (typecorecrum *) fullcrumptr);
00845     if (enftype == GRAN)
00846         ((typecbc *) ptr)->cinfo.infotype = GRANNULL;   /* KLUGE will this work?? */
00847 
00848     ivemodified(ptr);
00849 
00850 /* if(enftype == GRAN){ levelpush(fullcrumptr); adopt (createcrum(0,enftype), RIGHTBRO, fullcrumptr->leftson);
00851  * adopt(createcrum(0,enftype),SON,fullcrumptr->leftson->rightbro); ptr = fullcrumptr->leftson->leftson;
00852  * tumblerincrement(&(ptr->cwid.dsas[WIDTH]),2,1,&(ptr->cwid.dsas[WIDTH])); setwispupwards(ptr,1); } */
00853 
00854     return fullcrumptr;
00855 }

int* ealloc unsigned  nbytes  )  [static]
 

???

(to be defined)

Definition at line 345 of file credel.cxx.

References allocfromqueue(), falloc(), grimlyreap(), grimreaper, NULL, tagtype, and xgrabmorecore().

Referenced by eallocwithtag().

00347 {                                      /* with tag */
00348     /* L("ealloc called with %d\n", nbytes); */
00349 
00350     for (;;) {
00351         char *ret;
00352 
00353         if ((ret = allocfromqueue(nbytes + sizeof(tagtype))) != 0) {
00354             ret += sizeof(tagtype);
00355             return (int *) ret;
00356         }
00357         ret = (char *)falloc(nbytes + sizeof(tagtype));
00358 
00359         if (ret) {
00360             // memset(ret + sizeof(tagtype), 0xF9, nbytes);
00361             *(tagtype *) ret = false;
00362             return (int *) (ret + sizeof(tagtype));
00363         }
00364         if (grimreaper == NULL) {
00365             xgrabmorecore();
00366             /*
00367              * assert(0); // Why am I out of room?
00368              */
00369         }
00370         grimlyreap();
00371     }
00372 }

int * eallocwithtag unsigned  nbytes,
tagtype  tag
 

???

(to be defined)

Definition at line 409 of file credel.cxx.

References CBCTAG, CUCTAG, ealloc(), NULL, and tagtype.

Referenced by addtoopen(), Session::alloc(), createcontext(), createcrumcontext(), and createcruminternal().

00412 {
00413     char *ret = NULL;
00414 
00415     if (tag == CBCTAG || tag == CUCTAG) {
00416         ret = (char *) ealloc(nbytes);
00417 
00418     } else {
00419         ret = (char *) malloc(nbytes + sizeof(tagtype));
00420         ret += sizeof(tagtype);
00421     }
00422 
00423 /* etag((char*)ret,tag); */
00424 
00425     *(ret - sizeof(tagtype)) = tag;
00426     return (int *) ret;
00427 }

void efree char *  ptr  ) 
 

???

(to be defined)

Definition at line 382 of file credel.cxx.

References CBCTAG, CUCTAG, ffree(), freetoqueue(), and tagtype.

Referenced by closeberts(), contextfree(), crumcontextfree(), Session::free(), freecrum(), Session::freeexplicit(), and removefromopen().

00384 {                                      /* with tag */
00385 /* ffree(ptr); */
00386     if (*(ptr - sizeof(tagtype)) == CBCTAG || *(ptr - sizeof(tagtype)) == CUCTAG) {
00387 #ifdef NEWALLOC
00388         freetoqueue(ptr - sizeof(tagtype));
00389 #else
00390         ffree(ptr - sizeof(tagtype));
00391 #endif
00392     } else {
00393         free(ptr - sizeof(tagtype));
00394     }
00395 }

void freecrum typecorecrum ptr  ) 
 

???

(to be defined)

Definition at line 759 of file credel.cxx.

References typecorecrumhedr::age, assert, crumnumber, efree(), grimreaper, typecorecrumhedr::nextcrum, NULL, typecorecrumhedr::prevcrum, RESERVED, and typecorecrum.

Referenced by eatbrossubtreend(), eatbrossubtreeseq(), initkluge(), subtreefree(), takenephewnd(), and takeovernephewsnd().

00761 {
00762     if (ptr->age == RESERVED)
00763         assert(0); // freecrum called with RESERVED crum
00764 
00765     if (grimreaper == ptr)
00766         grimreaper = grimreaper->nextcrum;
00767 
00768     if (grimreaper == ptr)
00769         grimreaper = NULL;
00770 
00771     ptr->nextcrum->prevcrum = ptr->prevcrum;
00772     ptr->prevcrum->nextcrum = ptr->nextcrum;
00773 
00774 /* zzz should it decrement usecount here sometimes? */
00775 
00776     --crumnumber;
00777     efree((char *)ptr);
00778 }

void freetoqueue char *  ptr  )  [static]
 

???

(to be defined)

Definition at line 167 of file credel.cxx.

References allocqueuearray, HEADER, and qpush().

Referenced by efree().

00169 {
00170     // Located in memory before the tag is the sizeof the block in align uints
00171     // including the header
00172 
00173     // dumptable();
00174 
00175     int n = ((HEADER *) (ptr - sizeof(HEADER)))->s.size - 1;
00176     qpush(&allocqueuearray[n], (queue *) ptr);
00177 
00178     // dumptable();
00179 }

void funcrejuvinate typecorecrum ptr  ) 
 

???

(to be defined)

Definition at line 641 of file credel.cxx.

References typecorecrumhedr::age, assert, dump(), NEW, RESERVED, reservnumber, and typecorecrum.

00643 {                                      /* inner if is testing very useful * test */
00644     if (ptr->age == RESERVED) {
00645         if (!reservnumber) {
00646 #ifndef DISTRIBUTION
00647             dump(ptr);
00648             assert(0); // There shouldn't be any more reserved
00649 #else
00650             assert(0); // memory mess
00651 #endif
00652         }
00653         --reservnumber;
00654     }
00655     ptr->age = NEW;
00656 }

void grimlyreap  )  [static]
 

???

(to be defined)

*

Definition at line 284 of file credel.cxx.

References typecorecrumhedr::age, assert, grimreaper, ingrimreaper, isreapable(), L, typecorecrumhedr::nextcrum, reap(), reaplevel, reapnumber, RESERVED, timesaroundreaper, typecorecrum, and xgrabmorecore().

Referenced by ealloc().

00285 {
00286     typecorecrum *ptr;
00287     int eh;
00288 
00289     ingrimreaper = true;
00290     if (reaplevel++)
00291 #ifndef DISTRIBUTION
00292         if (reaplevel == 1)
00293             L("Recursive grimreaper call.\n");
00294 #endif
00295 
00296     if (!grimreaper)
00297         assert(0); // nothing to reap!
00298 
00299     reapnumber = 0;
00300     timesaroundreaper = 0;
00301     for (ptr = grimreaper; grimreaper; grimreaper = (typecorecrum *) grimreaper->nextcrum) {
00302         if (grimreaper == ptr) {
00303             ++timesaroundreaper;
00304         }
00305         if (timesaroundreaper > 10) {
00306             L("urk in grimlyreap\n");
00307 /* lookatalloc(); */
00308             xgrabmorecore();
00309             break;
00311 // * #ifndef DISTRIBUTION assert(0); /* I'm getting bored in grimlyreap */); #else
00312 // * assert(0); /* memory fouled */); #endif */
00313         }
00314 
00315         if (grimreaper->age == RESERVED)
00316             continue;
00317 
00318         if (isreapable(&eh, grimreaper)) {
00319             reap(grimreaper);
00320             reapnumber = 0;
00321             timesaroundreaper = 0;
00322             --reaplevel;
00323             break;
00324         } else {
00325             if (eh) {
00326 /* dump(grimreaper); */
00327             }
00328         }
00329 
00330         ++reapnumber;
00331         grimreaper->age++;
00332     }
00333 
00334     ingrimreaper = false;
00335 }

void initcrum int  crumheight,
int  enftype,
typecorecrum ptr
 

???

(to be defined)

Definition at line 248 of file credel.cxx.

References createcruminternal(), and typecorecrum.

Referenced by deletefullcrumandgarbageddescendents().

00252 {
00253     createcruminternal(crumheight, enftype, ptr);
00254 }

void initgrimreaper  ) 
 

???

(to be defined)

Definition at line 608 of file credel.cxx.

References grimreaper, and NULL.

Referenced by initsession().

00609 {
00610     grimreaper = NULL;
00611 }

void initqueues  ) 
 

???

(to be defined)

Definition at line 113 of file credel.cxx.

References allocqueuearray, allocsize, falloc(), HEADER, MAXALLOCQUEUEARRAY, qinit(), qpush(), and tagtype.

Referenced by initsession().

00114 {
00115     for (int i = 0; i < MAXALLOCQUEUEARRAY; i++)
00116         qinit(&allocqueuearray[i]);
00117 
00118 #ifdef NEWALLOC
00119     int num = allocsize / 3;
00120 #else
00121     int num = 0;
00122 #endif
00123 
00124     for (int j = 0; j < num; j += sizeof(typecuc) + sizeof(typecbc) + sizeof(type2dcbc) + 3 * sizeof(tagtype)) {
00125         qpush(&allocqueuearray[(sizeof(typecuc) + sizeof(tagtype) + sizeof(HEADER) - 1) / sizeof(HEADER)],
00126               (queue *) falloc(sizeof(typecuc) + sizeof(tagtype)));
00127         qpush(&allocqueuearray[(sizeof(typecbc) + sizeof(tagtype) + sizeof(HEADER) - 1) / sizeof(HEADER)],
00128               (queue *) falloc(sizeof(typecbc) + sizeof(tagtype)));
00129         qpush(&allocqueuearray[(sizeof(type2dcbc) + sizeof(tagtype) + sizeof(HEADER) - 1) / sizeof(HEADER)],
00130               (queue *) falloc(sizeof(type2dcbc) + sizeof(tagtype)));
00131     }
00132 }

bool isreapable int *  fuckinap,
typecorecrum localreaper
[static]
 

???

(to be defined)

Definition at line 437 of file credel.cxx.

References typecorecrumhedr::age, assert, typecorecrumhedr::cenftype, dump(), GRAN, GRANORGL, typecorecrumhedr::height, L, OLD, POOM, RESERVED, typecorecrumhedr::rightbro, typecorecrum, weakfindfather, and weakfindleftmostbro().

Referenced by grimlyreap().

00440 {
00441     register typecorecrum *p;
00442     typecuc *father;
00443 
00444     *fuckinap = 0;
00445     if (!localreaper)
00446         assert(0); // localreaper NULL
00447 
00448     if (localreaper->age < OLD || localreaper->age == RESERVED) {
00449         *fuckinap = 1;
00450         return false;
00451     }
00452 
00453     if (localreaper->isapex) {
00454         if (localreaper->cenftype != POOM)
00455             return false;
00456 
00457         if (localreaper->modified) {
00458             if (!((typecuc *) localreaper)->leftson) {
00459 #ifndef DISTRIBUTION
00460                 dump(localreaper);
00461                 L("in isreapable modified and no son in apex");
00462 #endif
00463                 return false;
00464             }
00465 
00466             for (p = ((typecuc *) localreaper)->leftson; p; p = p->rightbro) {
00467                 if (p->modified)
00468                     return false;
00469 
00470                 if (p->age < OLD || p->age == RESERVED)
00471                     return false;
00472 
00473                 if (p->height > 0 && ((typecuc *) p)->leftson)
00474                     return false;
00475 
00476                 if (p->height == 0 && p->cenftype == GRAN && ((typecbc *) p)->cinfo.infotype == GRANORGL && ((typecbc *) p)->cinfo.granstuff.orglstuff.orglincore)
00477                     return false;
00478             }
00479             return true;
00480 
00481         } else {
00482             for (p = ((typecuc *) localreaper)->leftson; p; p = p->rightbro) {
00483                 if (p->modified)
00484                     return false;
00485 
00486                 if (p->age < OLD || p->age == RESERVED)
00487                     return false;
00488 
00489                 if (p->height > 0 && ((typecuc *) p)->leftson)
00490                     return false;
00491 
00492                 if (p->height == 0 && p->cenftype == GRAN && ((typecbc *) p)->cinfo.infotype == GRANORGL && ((typecbc *) p)->cinfo.granstuff.orglstuff.orglincore)
00493                     return false;
00494             }
00495             return true;
00496         }
00497     }
00498 
00499 /* if height == 0 and not cinfo.orglincore return true */
00500     if (!localreaper)
00501         assert(0); // in isreapable localreaper is NULL
00502 
00503     father = weakfindfather((typecorecrum *) localreaper);
00504     if (!father) {
00505         L("in isreapable no father !! \n");
00506         return false;
00507     }
00508 
00509     if (localreaper->height == 0) {
00510         if (localreaper->cenftype == GRAN) {
00511             if (((typecbc *) localreaper)->cinfo.infotype == GRANORGL) {
00512                 if (((typecbc *) localreaper)->cinfo.granstuff.orglstuff.orglincore)
00513                     return false;
00514             }
00515         }
00516 
00517         for (p = weakfindleftmostbro(localreaper); p; p = p->rightbro) {
00518             if (p->age < OLD || p->age == RESERVED)
00519                 return false;
00520 
00521             if (p->height == 0 && p->cenftype == GRAN && ((typecbc *) p)->cinfo.infotype == GRANORGL && ((typecbc *) p)->cinfo.granstuff.orglstuff.orglincore)
00522                 return false;
00523         }
00524         return true;
00525 
00526     } else {                           /* != 0 */
00527         if (father->modified) {
00528             for (p = weakfindleftmostbro(localreaper); p; p = p->rightbro) {
00529                 if (p->modified)
00530                     return false;
00531 
00532                 if (p->age < OLD || p->age == RESERVED)
00533                     return false;
00534 
00535                 if (p->height > 0 && ((typecuc *) p)->leftson)
00536                     return false;
00537             }
00538             return true;
00539 
00540         } else {                       /* if (!father->modified) */
00541             for (p = weakfindleftmostbro(localreaper); p; p = p->rightbro) {
00542                 if (p->modified)
00543                     return false;
00544 
00545                 if (p->age < OLD || p->age == RESERVED)
00546                     return false;
00547 
00548                 if (p->height > 0 && ((typecuc *) p)->leftson)
00549                     return false;
00550             }
00551             return true;
00552         }
00553     }
00554 }

void loaffree typecuc father  ) 
 

???

(to be defined)

Definition at line 788 of file credel.cxx.

References assert, disownnomodify(), typecuc::height, typecuc::leftson, typecorecrumhedr::rightbro, subtreefree(), and typecorecrum.

Referenced by subtreewriterecurs().

00790 {
00791     if (father->height <= 0 /* || !father->leftson */ )
00792         assert(0); // bad call
00793 
00794     typecorecrum *ptr, *next;
00795     for (ptr = father->leftson; ptr; ptr = next) {
00796         next = ptr->rightbro;
00797         disownnomodify(ptr);
00798         subtreefree(ptr);
00799     }
00800 
00801     father->modified = false;
00802 }

void orglfree typecuc ptr  ) 
 

???

(to be defined)

Definition at line 812 of file credel.cxx.

References assert, DISKPTRNULL, typecuc::leftbroorfather, NULL, subtreefree(), and typecorecrum.

Referenced by orglwritepart2(), and subtreefree().

00814 {
00815     assert(ptr);         // ERROR: orglfree called with no orglptr
00816     assert(ptr->isapex); // ERROR: Orglfree called with non-fullcrum
00817     assert(((typecbc *) ptr->leftbroorfather)->cinfo.granstuff.orglstuff.diskorglptr.diskblocknumber != DISKPTRNULL); // ERROR: orglfree called with unwritten-out orgl
00818 
00819     ((typecbc *) ptr->leftbroorfather)->cinfo.granstuff.orglstuff.orglincore = false;
00820     ((typecbc *) ptr->leftbroorfather)->cinfo.granstuff.orglstuff.orglptr    = NULL;
00821 
00822     subtreefree((typecorecrum *) ptr);
00823 }

void reap typecorecrum localreaper  )  [static]
 

???

(to be defined)

Definition at line 564 of file credel.cxx.

References assert, grimreaper, typecorecrumhedr::leftbroorfather, typecuc::leftson, typecorecrumhedr::nextcrum, nreapings, orglwrite(), subtreewrite(), typecorecrum, and weakfindfather.

Referenced by grimlyreap().

00566 {
00567     typecuc *temp;
00568 
00569     if (!localreaper)
00570         assert(0); // localreaper NULL0
00571 
00572     ++nreapings;
00573     if (localreaper->isapex) {
00574         temp = (typecuc *) localreaper->leftbroorfather;
00575         grimreaper = grimreaper->nextcrum;
00576         if (!temp)
00577             return;
00578 
00579         orglwrite((typecbc *) temp);
00580         if (!localreaper)
00581             assert(0); // localreaper NULL2
00582 
00583         return;
00584     }
00585 
00586     temp = weakfindfather((typecorecrum *) localreaper);
00587     if (!temp)
00588         assert(0); // localreaper doesn't have a father
00589 
00590     if (!temp->leftson) {
00591         grimreaper = grimreaper->nextcrum;
00592         return;
00593     }
00594 
00595     subtreewrite(temp);
00596 }

void reserve typecorecrum ptr  ) 
 

???

(to be defined)

Definition at line 667 of file credel.cxx.

References typecorecrumhedr::age, assert, foohex(), RESERVED, reservnumber, and typecorecrum.

Referenced by createcrumcontext(), createorglgr(), eatbrossubtreend(), findleftson(), insertcbcnd(), insertseq(), makecontextfromcbc(), orglwritepart2(), peelcrumoffnd(), and splitcrumseq().

00669 {
00670 #ifndef DISTRIBUTION
00671     foohex("reserve\n", (int) ptr);
00672 #endif
00673     if (ptr->age != RESERVED) {
00674         ++reservnumber;
00675     } else {
00676 #ifndef DISTRIBUTION
00677         assert(0); // reserve already reserved
00678 #else
00679         assert(0); // arg!
00680 #endif
00681     }
00682     ptr->age = RESERVED;
00683 }

void subtreefree typecorecrum ptr  ) 
 

???

(to be defined)

Definition at line 728 of file credel.cxx.

References assert, typecorecrumhedr::cenftype, disown(), freecrum(), GRAN, GRANORGL, typecorecrumhedr::height, orglfree(), typecorecrumhedr::rightbro, and typecorecrum.

Referenced by deletend(), loaffree(), and orglfree().

00730 {
00731     if (!ptr)
00732         assert(0); // boom in subtreefree called with ptr == NULL
00733 
00734     if (ptr->height > 0) {
00735         typecorecrum *p, *right;
00736 
00737         for (p = ((typecuc *) ptr)->leftson; p; p = right) {
00738             right = p->rightbro;
00739             disown(p);
00740             subtreefree(p);
00741         }
00742 
00743     } else if (ptr->cenftype == GRAN
00744            && ((typecbc *) ptr)->cinfo.infotype == GRANORGL
00745            && ((typecbc *) ptr)->cinfo.granstuff.orglstuff.orglincore)
00746         orglfree(((typecbc *) ptr)->cinfo.granstuff.orglstuff.orglptr);
00747 
00748     freecrum(ptr);
00749 }

int testforrejuvinate typecorecrum ptr  ) 
 

???

(to be defined)

Definition at line 621 of file credel.cxx.

References typecorecrumhedr::age, assert, RESERVED, reservnumber, and typecorecrum.

00623 {
00624     if (ptr->age == RESERVED) {
00625         if (!reservnumber)
00626             assert(0); // There shouldn't be any more reserved
00627 
00628         --reservnumber;
00629     }
00630     return 0;
00631 }

void testforreservedness char *  msg  ) 
 

???

(to be defined)

Definition at line 693 of file credel.cxx.

References typecorecrumhedr::age, assert, debug, dump(), grimreaper, L, typecorecrumhedr::nextcrum, RESERVED, reservnumber, and typecorecrum.

Referenced by main().

00695 {                                      /* test to see if any reserved flags linger * in the memory.  if they do is a
00696                                         * gross * error in crum stuff */
00697     int numreserved = 0;
00698     bool first;
00699 
00700     typecorecrum *ptr;
00701     for (ptr = grimreaper, first = true; ptr && (first ? true : ptr != grimreaper); ptr = ptr->nextcrum, first = false)
00702         if (ptr->age == RESERVED) {
00703             ++numreserved;
00704             if (true || debug)
00705                 dump(ptr);
00706         }
00707 
00708     if (numreserved) {
00709         L("numreserved = %s:  There are %d reserved crums. (reservnumber = %d)\n", msg, numreserved, reservnumber);
00710         assert(0); // This isn't supposed to be the case
00711     }
00712 
00713     if (reservnumber) {
00714         L("reservnumber = %d\n", reservnumber);
00715         assert(0); // reservnumber is incorrect
00716     }
00717 }

void xgrabmorecore  )  [static]
 

???

(to be defined)

Definition at line 264 of file credel.cxx.

References assert, ffree(), HEADER, incrementalallocsize, and L.

Referenced by ealloc(), and grimlyreap().

00265 {
00266     char *tmp = (char *) sbrk(incrementalallocsize);
00267     if (!tmp)
00268         assert(0); // no more memory in xgrabmorecore
00269 
00270     ((HEADER *) tmp)->s.size = (incrementalallocsize + sizeof(HEADER) - 1) / sizeof(HEADER);
00271     ffree(tmp + sizeof(HEADER));
00272 
00273     L("xgrabmorecore got another %d\n", incrementalallocsize);
00274 }


Variable Documentation

struct queue allocqueuearray[MAXALLOCQUEUEARRAY]
 

Definition at line 100 of file credel.cxx.

Referenced by allocfromqueue(), freetoqueue(), and initqueues().

int crumnumber = 0
 

Definition at line 94 of file credel.cxx.

Referenced by createcruminternal(), and freecrum().

typecorecrum* grimreaper
 

Definition at line 90 of file credel.cxx.

Referenced by checkenftypes(), checkthebleedingcrum(), createcrum(), ealloc(), freecrum(), grimlyreap(), initgrimreaper(), reap(), and testforreservedness().

int ingrimreaper = false
 

Definition at line 91 of file credel.cxx.

Referenced by falloc(), and grimlyreap().

int nreapings = 0
 

Definition at line 96 of file credel.cxx.

Referenced by reap().

int reaplevel = 0
 

Definition at line 92 of file credel.cxx.

Referenced by grimlyreap().

int reapnumber = 0
 

Definition at line 95 of file credel.cxx.

Referenced by grimlyreap().

int reservnumber = 0
 

Definition at line 97 of file credel.cxx.

Referenced by assertsubtreeisok(), funcrejuvinate(), reserve(), testforrejuvinate(), and testforreservedness().

int timesaroundreaper = 0
 

Definition at line 93 of file credel.cxx.

Referenced by grimlyreap().


Generated on Sun Aug 21 04:18:27 2005 for Udanax-Green by doxygen1.3.4