pike.git / src / block_alloc.h

version» Context lines:

pike.git/src/block_alloc.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: block_alloc.h,v 1.77 2005/04/09 10:54:25 grubba Exp $ + || $Id: block_alloc.h,v 1.78 2006/01/24 07:32:22 mast Exp $   */      #undef PRE_INIT_BLOCK   #undef DO_PRE_INIT_BLOCK   #undef INIT_BLOCK   #undef EXIT_BLOCK   #undef BLOCK_ALLOC   #undef LOW_PTR_HASH_ALLOC   #undef PTR_HASH_ALLOC_FIXED   #undef PTR_HASH_ALLOC
pike.git/src/block_alloc.h:23:   #undef PTR_HASH_ALLOC_FIXED_FILL_PAGES      /* Note: The block_alloc mutex is held while PRE_INIT_BLOCK runs. */   #define PRE_INIT_BLOCK(X)   #define INIT_BLOCK(X)   #define EXIT_BLOCK(X)   #define COUNT_BLOCK(X)   #define COUNT_OTHER()   #define DMALLOC_DESCRIBE_BLOCK(X)   #define BLOCK_ALLOC_HSIZE_SHIFT 2 - #define MAX_EMPTY_BLOCKS 4 + #define MAX_EMPTY_BLOCKS 4 /* Must be >= 1. */      #ifndef BLOCK_ALLOC_USED   #define BLOCK_ALLOC_USED DO_IF_DMALLOC(real_used) DO_IF_NOT_DMALLOC(used)   #endif      /* Invalidate the block as far as possible if running with dmalloc.    */   #define DO_PRE_INIT_BLOCK(X) do { \    DO_IF_DMALLOC(MEMSET((X), 0x55, sizeof(*(X)))); \    PRE_INIT_BLOCK(X); \
pike.git/src/block_alloc.h:97:    struct DATA x[BSIZE]; \   }; \   struct PIKE_CONCAT(DATA,_context) \   { \    struct PIKE_CONCAT(DATA,_context) *next; \    struct PIKE_CONCAT(DATA, _block) *blocks, *free_blocks; \    INT32 num_empty_blocks; \   }; \    \   static struct PIKE_CONCAT(DATA,_context) *PIKE_CONCAT(DATA,_ctxs)=0; \ +  \ + /* Points to a double linked list of the meta-blocks. */ \ + /* Full meta-blocks are last on this list. */ \   static struct PIKE_CONCAT(DATA,_block) *PIKE_CONCAT(DATA,_blocks)=0; \ -  +  \ + /* Points to the last meta-block in the DATA,_block list that isn't full. */ \   static struct PIKE_CONCAT(DATA,_block) *PIKE_CONCAT(DATA,_free_blocks)= \    (void*)-1; \ -  +  \   static INT32 PIKE_CONCAT3(num_empty_,DATA,_blocks)=0; \   DO_IF_RUN_UNLOCKED(static PIKE_MUTEX_T PIKE_CONCAT(DATA,_mutex);) \   DO_IF_DMALLOC( \    static struct DATA *PIKE_CONCAT(DATA,s_to_free)[4 * (BSIZE)]; \    static size_t PIKE_CONCAT(DATA,s_to_free_ptr) = 0; \   ) \    \   void PIKE_CONCAT3(new_,DATA,_context)(void) \   { \    struct PIKE_CONCAT(DATA, _context) *ctx = \
pike.git/src/block_alloc.h:300:    \    DO_PRE_INIT_BLOCK(d); \    d->BLOCK_ALLOC_NEXT = (void *)blk->PIKE_CONCAT3(free_,DATA,s); \    blk->PIKE_CONCAT3(free_,DATA,s)=d; \    /* Mark block as unavailable. */ \    PIKE_MEM_NA(*d); \    \    if(!--blk->BLOCK_ALLOC_USED && \    ++PIKE_CONCAT3(num_empty_,DATA,_blocks) > MAX_EMPTY_BLOCKS) { \    if(blk == PIKE_CONCAT(DATA,_free_blocks)) { \ +  /* blk->prev isn't NULL because MAX_EMPTY_BLOCKS >= 1 so we */ \ +  /* know there's at least one more empty block. */ \    if((blk->prev->next = blk->next)) \    blk->next->prev = blk->prev; \    PIKE_CONCAT(DATA,_free_blocks) = blk->prev; \    } else { \    PIKE_CONCAT(DATA,_blocks) = blk->next; \    blk->next->prev = NULL; \    } \    \    DO_IF_DMALLOC({ \    size_t i; \