Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 517

Show
Ignore:
Timestamp:
01/18/11 06:56:14 (14 years ago)
Author:
braddr
Message:

fix printf's throughout the gc, no functional changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/gc/gcx.d

    r496 r517  
    103103    struct Log 
    104104    { 
    105105        void*  p; 
    106106        size_t size; 
    107107        size_t line; 
    108108        char*  file; 
    109109        void*  parent; 
    110110 
    111111        void print() 
    112112        { 
    113             printf("    p = %x, size = %d, parent = %x ", p, size, parent); 
     113            printf("    p = %p, size = %zd, parent = %p ", p, size, parent); 
    114114            if (file) 
    115115            { 
    116116                printf("%s(%u)", file, line); 
    117117            } 
    118118            printf("\n"); 
    119119        } 
    120120    } 
    121121 
    122122 
    123123    struct LogArray 
     
    483483                default: 
    484484                    assert(false); 
    485485                } 
    486486            } 
    487487            p = gcx.bucket[bin]; 
    488488 
    489489            // Return next item from free list 
    490490            gcx.bucket[bin] = (cast(List*)p).next; 
    491491            if( !(bits & BlkAttr.NO_SCAN) ) 
    492492                memset(p + size, 0, binsize[bin] - size); 
    493             //debug(PRINTF) printf("\tmalloc => %x\n", p); 
     493            //debug(PRINTF) printf("\tmalloc => %p\n", p); 
    494494            debug (MEMSTOMP) memset(p, 0xF0, size); 
    495495        } 
    496496        else 
    497497        { 
    498498            p = gcx.bigAlloc(size, alloc_size); 
    499499            if (!p) 
    500500                onOutOfMemoryError(); 
    501501        } 
    502502        size -= SENTINEL_EXTRA; 
    503503        p = sentinel_add(p); 
     
    537537    } 
    538538 
    539539 
    540540    // 
    541541    // 
    542542    // 
    543543    private void *callocNoSync(size_t size, uint bits = 0, size_t *alloc_size = null) 
    544544    { 
    545545        assert(size != 0); 
    546546 
    547         //debug(PRINTF) printf("calloc: %x len %d\n", p, len); 
     547        //debug(PRINTF) printf("calloc: %p len %d\n", p, len); 
    548548        void *p = mallocNoSync(size, bits, alloc_size); 
    549549        memset(p, 0, size); 
    550550        return p; 
    551551    } 
    552552 
    553553 
    554554    /** 
    555555     * 
    556556     */ 
    557557    void *realloc(void *p, size_t size, uint bits = 0, size_t *alloc_size = null) 
     
    580580                *alloc_size = 0; 
    581581        } 
    582582        else if (!p) 
    583583        { 
    584584            p = mallocNoSync(size, bits, alloc_size); 
    585585        } 
    586586        else 
    587587        {   void *p2; 
    588588            size_t psize; 
    589589 
    590             //debug(PRINTF) printf("GC::realloc(p = %x, size = %u)\n", p, size); 
     590            //debug(PRINTF) printf("GC::realloc(p = %p, size = %zu)\n", p, size); 
    591591            version (SENTINEL) 
    592592            { 
    593593                sentinel_Invariant(p); 
    594594                psize = *sentinel_size(p); 
    595595                if (psize != size) 
    596596                { 
    597597                    if (psize) 
    598598                    { 
    599599                        Pool *pool = gcx.findPool(p); 
    600600 
     
    737737    // 
    738738    // 
    739739    // 
    740740    private size_t extendNoSync(void* p, size_t minsize, size_t maxsize) 
    741741    in 
    742742    { 
    743743        assert( minsize <= maxsize ); 
    744744    } 
    745745    body 
    746746    { 
    747         //debug(PRINTF) printf("GC::extend(p = %x, minsize = %u, maxsize = %u)\n", p, minsize, maxsize); 
     747        //debug(PRINTF) printf("GC::extend(p = %p, minsize = %zu, maxsize = %zu)\n", p, minsize, maxsize); 
    748748        version (SENTINEL) 
    749749        { 
    750750            return 0; 
    751751        } 
    752752        auto psize = gcx.findSize(p);   // find allocated size 
    753753        if (psize < PAGESIZE) 
    754754            return 0;                   // cannot extend buckets 
    755755 
    756756        auto psz = psize / PAGESIZE; 
    757757        auto minsz = (minsize + PAGESIZE - 1) / PAGESIZE; 
     
    10981098    // 
    10991099    // 
    11001100    // 
    11011101    private void setStackBottom(void *p) 
    11021102    { 
    11031103        version (STACKGROWSDOWN) 
    11041104        { 
    11051105            //p = (void *)((uint *)p + 4); 
    11061106            if (p > gcx.stackBottom) 
    11071107            { 
    1108                 //debug(PRINTF) printf("setStackBottom(%x)\n", p); 
     1108                //debug(PRINTF) printf("setStackBottom(%p)\n", p); 
    11091109                gcx.stackBottom = p; 
    11101110            } 
    11111111        } 
    11121112        else 
    11131113        { 
    11141114            //p = (void *)((uint *)p - 4); 
    11151115            if (p < gcx.stackBottom) 
    11161116            { 
    1117                 //debug(PRINTF) printf("setStackBottom(%x)\n", p); 
     1117                //debug(PRINTF) printf("setStackBottom(%p)\n", p); 
    11181118                gcx.stackBottom = cast(char*)p; 
    11191119            } 
    11201120        } 
    11211121    } 
    11221122 
    11231123 
    11241124    /** 
    11251125     * add p to list of roots 
    11261126     */ 
    11271127    void addRoot(void *p) 
     
    11821182    /** 
    11831183     * add range to scan for roots 
    11841184     */ 
    11851185    void addRange(void *p, size_t sz) 
    11861186    { 
    11871187        if (!p || !sz) 
    11881188        { 
    11891189            return; 
    11901190        } 
    11911191 
    1192         //debug(PRINTF) printf("+GC.addRange(pbot = x%x, ptop = x%x)\n", pbot, ptop); 
     1192        //debug(PRINTF) printf("+GC.addRange(p = %p, sz = 0x%zx), p + sz = %p\n", p, sz, p + sz); 
    11931193        if (!thread_needLock()) 
    11941194        { 
    11951195            gcx.addRange(p, p + sz); 
    11961196        } 
    11971197        else synchronized (gcLock) 
    11981198        { 
    11991199            gcx.addRange(p, p + sz); 
    12001200        } 
    12011201        //debug(PRINTF) printf("-GC.addRange()\n"); 
    12021202    } 
     
    12531253        synchronized (gcLock) 
    12541254        { 
    12551255            result = gcx.fullcollectshell(); 
    12561256        } 
    12571257 
    12581258        version (none) 
    12591259        { 
    12601260            GCStats stats; 
    12611261 
    12621262            getStats(stats); 
    1263             debug(PRINTF) printf("poolsize = %x, usedsize = %x, freelistsize = %x\n", 
     1263            debug(PRINTF) printf("poolsize = %zx, usedsize = %zx, freelistsize = %zx\n", 
    12641264                    stats.poolsize, stats.usedsize, stats.freelistsize); 
    12651265        } 
    12661266 
    12671267        gcx.log_collect(); 
    12681268    return result; 
    12691269    } 
    12701270 
    12711271    /** 
    12721272     * Returns true if the pointer is being collected.  Should only be called 
    12731273     * with the base pointer of the block. 
     
    13591359                else if (bin < B_PAGE) 
    13601360                    bsize += PAGESIZE; 
    13611361            } 
    13621362        } 
    13631363 
    13641364        for (n = 0; n < B_PAGE; n++) 
    13651365        { 
    13661366            //debug(PRINTF) printf("bin %d\n", n); 
    13671367            for (List *list = gcx.bucket[n]; list; list = list.next) 
    13681368            { 
    1369                 //debug(PRINTF) printf("\tlist %x\n", list); 
     1369                //debug(PRINTF) printf("\tlist %p\n", list); 
    13701370                flsize += binsize[n]; 
    13711371            } 
    13721372        } 
    13731373 
    13741374        usize = bsize - flsize; 
    13751375 
    13761376        stats.poolsize = psize; 
    13771377        stats.usedsize = bsize - flsize; 
    13781378        stats.freelistsize = flsize; 
    13791379    } 
     
    14311431 
    14321432 
    14331433struct Gcx 
    14341434{ 
    14351435    debug (THREADINVARIANT) 
    14361436    { 
    14371437        pthread_t self; 
    14381438        void thread_Invariant() 
    14391439        { 
    14401440            if (self != pthread_self()) 
    1441                 printf("thread_Invariant(): gcx = %x, self = %x, pthread_self() = %x\n", this, self, pthread_self()); 
     1441                printf("thread_Invariant(): gcx = %p, self = %x, pthread_self() = %x\n", &this, self, pthread_self()); 
    14421442            assert(self == pthread_self()); 
    14431443        } 
    14441444    } 
    14451445    else 
    14461446    { 
    14471447        void thread_Invariant() { } 
    14481448    } 
    14491449     
    14501450    void *cached_size_key; 
    14511451    size_t cached_size_val; 
     
    14781478 
    14791479 
    14801480    void initialize() 
    14811481    {   int dummy; 
    14821482 
    14831483        (cast(byte*)&this)[0 .. Gcx.sizeof] = 0; 
    14841484        stackBottom = cast(char*)&dummy; 
    14851485        log_init(); 
    14861486        debug (THREADINVARIANT) 
    14871487            self = pthread_self(); 
    1488         //printf("gcx = %p, self = %x\n", this, self); 
     1488        //printf("gcx = %p, self = %x\n", &this, self); 
    14891489        inited = 1; 
    14901490    } 
    14911491 
    14921492 
    14931493    void Dtor() 
    14941494    { 
    14951495        inited = 0; 
    14961496 
    14971497        for (size_t i = 0; i < npools; i++) 
    14981498        {   Pool *pool = pooltable[i]; 
     
    15111511    } 
    15121512 
    15131513 
    15141514    void Invariant() { } 
    15151515 
    15161516 
    15171517    invariant() 
    15181518    { 
    15191519        if (inited) 
    15201520        { 
    1521         //printf("Gcx.invariant(): this = %p\n", this); 
     1521            //printf("Gcx.invariant(): this = %p\n", &this); 
    15221522            size_t i; 
    15231523 
    15241524            // Assure we're called on the right thread 
    15251525            debug (THREADINVARIANT) assert(self == pthread_self()); 
    15261526 
    15271527            for (i = 0; i < npools; i++) 
    15281528            {   Pool *pool = pooltable[i]; 
    15291529 
    15301530                pool.Invariant(); 
    15311531                if (i == 0) 
     
    16291629        return result; 
    16301630    } 
    16311631 
    16321632 
    16331633    /** 
    16341634     * 
    16351635     */ 
    16361636    void addRange(void *pbot, void *ptop) 
    16371637    { 
    16381638        //debug(PRINTF) printf("Thread %x ", pthread_self()); 
    1639         debug(PRINTF) printf("%x.Gcx::addRange(%x, %x), nranges = %d\n", this, pbot, ptop, nranges); 
     1639        debug(PRINTF) printf("%p.Gcx::addRange(%p, %p), nranges = %d\n", &this, pbot, ptop, nranges); 
    16401640        if (nranges == rangedim) 
    16411641        { 
    16421642            size_t newdim = rangedim * 2 + 16; 
    16431643            Range *newranges; 
    16441644 
    16451645            newranges = cast(Range*)cstdlib.malloc(newdim * newranges[0].sizeof); 
    16461646            if (!newranges) 
    16471647                onOutOfMemoryError(); 
    16481648            if (ranges) 
    16491649            {   memcpy(newranges, ranges, nranges * newranges[0].sizeof); 
     
    16571657        nranges++; 
    16581658    } 
    16591659 
    16601660 
    16611661    /** 
    16621662     * 
    16631663     */ 
    16641664    void removeRange(void *pbot) 
    16651665    { 
    16661666        //debug(PRINTF) printf("Thread %x ", pthread_self()); 
    1667         debug(PRINTF) printf("%x.Gcx.removeRange(%x), nranges = %d\n", this, pbot, nranges); 
     1667        debug(PRINTF) printf("Gcx.removeRange(%p), nranges = %d\n", pbot, nranges); 
    16681668        for (size_t i = nranges; i--;) 
    16691669        { 
    16701670            if (ranges[i].pbot == pbot) 
    16711671            { 
    16721672                nranges--; 
    16731673                memmove(ranges + i, ranges + i + 1, (nranges - i) * ranges[0].sizeof); 
    16741674                return; 
    16751675            } 
    16761676        } 
    16771677        debug(PRINTF) printf("Wrong thread\n"); 
     
    20582058 
    20592059      L1: 
    20602060        pool.pagetable[pn] = B_PAGE; 
    20612061        if (npages > 1) 
    20622062            memset(&pool.pagetable[pn + 1], B_PAGEPLUS, npages - 1); 
    20632063        p = pool.baseAddr + pn * PAGESIZE; 
    20642064        memset(cast(char *)p + size, 0, npages * PAGESIZE - size); 
    20652065        debug (MEMSTOMP) memset(p, 0xF1, size); 
    20662066        if(alloc_size) 
    20672067            *alloc_size = npages * PAGESIZE; 
    2068         //debug(PRINTF) printf("\tp = %x\n", p); 
     2068        //debug(PRINTF) printf("\tp = %p\n", p); 
    20692069        return p; 
    20702070 
    20712071      Lnomemory: 
    20722072        return null; // let caller handle the error 
    20732073    } 
    20742074 
    20752075 
    20762076    /** 
    20772077     * Allocate a new pool with at least npages in it. 
    20782078     * Sort it into pooltable[]. 
     
    22012201        void **p1 = cast(void **)pbot; 
    22022202        void **p2 = cast(void **)ptop; 
    22032203        size_t pcache = 0; 
    22042204        uint changes = 0; 
    22052205 
    22062206        //printf("marking range: %p -> %p\n", pbot, ptop); 
    22072207        for (; p1 < p2; p1++) 
    22082208        { 
    22092209            auto p = cast(byte *)(*p1); 
    22102210 
    2211             //if (log) debug(PRINTF) printf("\tmark %x\n", p); 
     2211            //if (log) debug(PRINTF) printf("\tmark %p\n", p); 
    22122212            if (p >= minAddr && p < maxAddr) 
    22132213            { 
    22142214                if ((cast(size_t)p & ~(PAGESIZE-1)) == pcache) 
    22152215                    continue; 
    22162216 
    22172217        auto pool = findPool(p); 
    22182218                if (pool) 
    22192219                { 
    22202220                    size_t offset = cast(size_t)(p - pool.baseAddr); 
    22212221                    size_t biti = void; 
    22222222                    size_t pn = offset / PAGESIZE; 
    22232223                    Bins   bin = cast(Bins)pool.pagetable[pn]; 
    22242224 
    2225                     //debug(PRINTF) printf("\t\tfound pool %x, base=%x, pn = %d, bin = %d, biti = x%x\n", pool, pool.baseAddr, pn, bin, biti); 
     2225                    //debug(PRINTF) printf("\t\tfound pool %p, base=%p, pn = %zd, bin = %d, biti = x%x\n", pool, pool.baseAddr, pn, bin, biti); 
    22262226 
    22272227                    // Adjust bit to be at start of allocated memory block 
    22282228                    if (bin < B_PAGE) 
    22292229                    { 
    22302230                        biti = (offset & notbinsize[bin]) >> 4; 
    22312231                        //debug(PRINTF) printf("\t\tbiti = x%x\n", biti); 
    22322232                    } 
    22332233                    else if (bin == B_PAGE) 
    22342234                    { 
    22352235                        biti = (offset & notbinsize[bin]) >> 4; 
     
    22482248                    } 
    22492249                    else 
    22502250                    { 
    22512251                        // Don't mark bits in B_FREE or B_UNCOMMITTED pages 
    22522252                        continue; 
    22532253                    } 
    22542254 
    22552255                    //debug(PRINTF) printf("\t\tmark(x%x) = %d\n", biti, pool.mark.test(biti)); 
    22562256                    if (!pool.mark.testSet(biti)) 
    22572257                    { 
    2258                         //if (log) debug(PRINTF) printf("\t\tmarking %x\n", p); 
     2258                        //if (log) debug(PRINTF) printf("\t\tmarking %p\n", p); 
    22592259                        if (!pool.noscan.test(biti)) 
    22602260                        { 
    22612261                            pool.scan.set(biti); 
    22622262                            changes = 1; 
    22632263                        } 
    22642264                        debug (LOGGING) log_parent(sentinel_add(pool.baseAddr + biti * 16), sentinel_add(pbot)); 
    22652265                    } 
    22662266                } 
    22672267            } 
    22682268        } 
     
    24122412            { 
    24132413                // Scan stacks and registers for each paused thread 
    24142414                thread_scanAll( &mark, stackTop ); 
    24152415            } 
    24162416        } 
    24172417        else 
    24182418        { 
    24192419            if (!noStack) 
    24202420            { 
    24212421                // Scan stack for main thread 
    2422                 debug(PRINTF) printf(" scan stack bot = %x, top = %x\n", stackTop, stackBottom); 
     2422                debug(PRINTF) printf(" scan stack bot = %p, top = %p\n", stackTop, stackBottom); 
    24232423                version (STACKGROWSDOWN) 
    24242424                    mark(stackTop, stackBottom); 
    24252425                else 
    24262426                    mark(stackBottom, stackTop); 
    24272427            } 
    24282428        } 
    24292429 
    24302430        // Scan roots[] 
    24312431        debug(COLLECT_PRINTF) printf("\tscan roots[]\n"); 
    24322432        mark(roots, roots + nroots); 
    24332433 
    24342434        // Scan ranges[] 
    24352435        debug(COLLECT_PRINTF) printf("\tscan ranges[]\n"); 
    24362436        //log++; 
    24372437        for (n = 0; n < nranges; n++) 
    24382438        { 
    2439             debug(COLLECT_PRINTF) printf("\t\t%x .. %x\n", ranges[n].pbot, ranges[n].ptop); 
     2439            debug(COLLECT_PRINTF) printf("\t\t%p .. %p\n", ranges[n].pbot, ranges[n].ptop); 
    24402440            mark(ranges[n].pbot, ranges[n].ptop); 
    24412441        } 
    24422442        //log--; 
    24432443 
    24442444        debug(COLLECT_PRINTF) printf("\tscan heap\n"); 
    24452445        while (anychanges) 
    24462446        { 
    24472447            debug(COLLECT_PRINTF) printf("\t\tpass\n"); 
    24482448            anychanges = 0; 
    24492449            for (n = 0; n < npools; n++) 
     
    25352535                    if (bbase[0] == 0 && bbase[1] == 0 && bbase[2] == 0 && bbase[3] == 0 && 
    25362536                        bbase[4] == 0 && bbase[5] == 0 && bbase[6] == 0 && bbase[7] == 0) 
    25372537                    { 
    25382538                        for (; p < ptop; p += size, biti += bitstride) 
    25392539                        { 
    25402540                            if (pool.finals.nbits && pool.finals.testClear(biti)) 
    25412541                                rt_finalize(cast(List *)sentinel_add(p), false/*noStack > 0*/); 
    25422542                            gcx.clrBits(pool, biti, BlkAttr.ALL_BITS); 
    25432543 
    25442544                            List *list = cast(List *)p; 
    2545                             //debug(PRINTF) printf("\tcollecting %x\n", list); 
     2545                            //debug(PRINTF) printf("\tcollecting %p\n", list); 
    25462546                            log_free(sentinel_add(list)); 
    25472547 
    25482548                            debug (MEMSTOMP) memset(p, 0xF3, size); 
    25492549                        } 
    25502550                        pool.pagetable[pn] = B_FREE; 
    25512551                        freed += PAGESIZE; 
    25522552                        //debug(PRINTF) printf("freeing entire page %d\n", pn); 
    25532553                        continue; 
    25542554                    } 
    25552555    } 
     
    25582558                        if (!pool.mark.test(biti)) 
    25592559                        { 
    25602560                            sentinel_Invariant(sentinel_add(p)); 
    25612561 
    25622562                            pool.freebits.set(biti); 
    25632563                            if (pool.finals.nbits && pool.finals.testClear(biti)) 
    25642564                                rt_finalize(cast(List *)sentinel_add(p), false/*noStack > 0*/); 
    25652565                            clrBits(pool, biti, BlkAttr.ALL_BITS); 
    25662566 
    25672567                            List *list = cast(List *)p; 
    2568                             debug(PRINTF) printf("\tcollecting %x\n", list); 
     2568                            debug(PRINTF) printf("\tcollecting %p\n", list); 
    25692569                            log_free(sentinel_add(list)); 
    25702570 
    25712571                            debug (MEMSTOMP) memset(p, 0xF3, size); 
    25722572 
    25732573                            freed += size; 
    25742574                        } 
    25752575                    } 
    25762576                } 
    25772577                else if (bin == B_PAGE) 
    25782578                {   size_t biti = pn * (PAGESIZE / 16); 
    25792579 
    25802580                    if (!pool.mark.test(biti)) 
    25812581                    {   byte *p = pool.baseAddr + pn * PAGESIZE; 
    25822582 
    25832583                        sentinel_Invariant(sentinel_add(p)); 
    25842584                        if (pool.finals.nbits && pool.finals.testClear(biti)) 
    25852585                            rt_finalize(sentinel_add(p), false/*noStack > 0*/); 
    25862586                        clrBits(pool, biti, BlkAttr.ALL_BITS); 
    25872587 
    2588                         debug(COLLECT_PRINTF) printf("\tcollecting big %x\n", p); 
     2588                        debug(COLLECT_PRINTF) printf("\tcollecting big %p\n", p); 
    25892589                        log_free(sentinel_add(p)); 
    25902590                        pool.pagetable[pn] = B_FREE; 
    25912591                        freedpages++; 
    25922592                        debug (MEMSTOMP) memset(p, 0xF3, PAGESIZE); 
    25932593                        while (pn + 1 < ncommitted && pool.pagetable[pn + 1] == B_PAGEPLUS) 
    25942594                        { 
    25952595                            pn++; 
    25962596                            pool.pagetable[pn] = B_FREE; 
    25972597                            freedpages++; 
    25982598 
     
    27852785        { 
    27862786            //debug(PRINTF) printf("+log_init()\n"); 
    27872787            current.reserve(1000); 
    27882788            prev.reserve(1000); 
    27892789            //debug(PRINTF) printf("-log_init()\n"); 
    27902790        } 
    27912791 
    27922792 
    27932793        void log_malloc(void *p, size_t size) 
    27942794        { 
    2795             //debug(PRINTF) printf("+log_malloc(p = %x, size = %d)\n", p, size); 
     2795            //debug(PRINTF) printf("+log_malloc(p = %p, size = %zd)\n", p, size); 
    27962796            Log log; 
    27972797 
    27982798            log.p = p; 
    27992799            log.size = size; 
    28002800            log.line = GC.line; 
    28012801            log.file = GC.file; 
    28022802            log.parent = null; 
    28032803 
    28042804            GC.line = 0; 
    28052805            GC.file = null; 
    28062806 
    28072807            current.push(log); 
    28082808            //debug(PRINTF) printf("-log_malloc()\n"); 
    28092809        } 
    28102810 
    28112811 
    28122812        void log_free(void *p) 
    28132813        { 
    2814             //debug(PRINTF) printf("+log_free(%x)\n", p); 
     2814            //debug(PRINTF) printf("+log_free(%p)\n", p); 
    28152815            size_t i; 
    28162816 
    28172817            i = current.find(p); 
    28182818            if (i == OPFAIL) 
    28192819            { 
    2820                 debug(PRINTF) printf("free'ing unallocated memory %x\n", p); 
     2820                debug(PRINTF) printf("free'ing unallocated memory %p\n", p); 
    28212821            } 
    28222822            else 
    28232823                current.remove(i); 
    28242824            //debug(PRINTF) printf("-log_free()\n"); 
    28252825        } 
    28262826 
    28272827 
    28282828        void log_collect() 
    28292829        { 
    28302830            //debug(PRINTF) printf("+log_collect()\n"); 
     
    28692869 
    28702870 
    28712871        void log_parent(void *p, void *parent) 
    28722872        { 
    28732873            //debug(PRINTF) printf("+log_parent()\n"); 
    28742874            size_t i; 
    28752875 
    28762876            i = current.find(p); 
    28772877            if (i == OPFAIL) 
    28782878            { 
    2879                 debug(PRINTF) printf("parent'ing unallocated memory %x, parent = %x\n", p, parent); 
     2879                debug(PRINTF) printf("parent'ing unallocated memory %p, parent = %p\n", p, parent); 
    28802880                Pool *pool; 
    28812881                pool = findPool(p); 
    28822882                assert(pool); 
    28832883                size_t offset = cast(size_t)(p - pool.baseAddr); 
    28842884                size_t biti; 
    28852885                size_t pn = offset / PAGESIZE; 
    28862886                Bins bin = cast(Bins)pool.pagetable[pn]; 
    28872887                biti = (offset & notbinsize[bin]); 
    28882888                debug(PRINTF) printf("\tbin = %d, offset = x%x, biti = x%x\n", bin, offset, biti); 
    28892889            } 
     
    29322932        //debug(PRINTF) printf("Pool::Pool(%u)\n", npages); 
    29332933        poolsize = npages * PAGESIZE; 
    29342934        assert(poolsize >= POOLSIZE); 
    29352935        baseAddr = cast(byte *)os_mem_map(poolsize); 
    29362936 
    29372937        // Some of the code depends on page alignment of memory pools 
    29382938        assert((cast(size_t)baseAddr & (PAGESIZE - 1)) == 0); 
    29392939 
    29402940        if (!baseAddr) 
    29412941        { 
    2942             //debug(PRINTF) printf("GC fail: poolsize = x%x, errno = %d\n", poolsize, errno); 
     2942            //debug(PRINTF) printf("GC fail: poolsize = x%zx, errno = %d\n", poolsize, errno); 
    29432943            //debug(PRINTF) printf("message = '%s'\n", sys_errlist[errno]); 
    29442944 
    29452945            npages = 0; 
    29462946            poolsize = 0; 
    29472947        } 
    29482948        //assert(baseAddr); 
    29492949        topAddr = baseAddr + poolsize; 
    29502950 
    29512951        mark.alloc(cast(size_t)poolsize / 16); 
    29522952        scan.alloc(cast(size_t)poolsize / 16);