Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs
plarena.h File Reference
#include "prtypes.h"
#include "plarenas.h"

Go to the source code of this file.

Classes

struct  PLArena
struct  PLArenaPool

Defines

#define PL_ARENA_ALIGN(pool, n)   (((PRUword)(n) + (pool)->mask) & ~(pool)->mask)
#define PL_ARENA_ALLOCATE(p, pool, nb)
#define PL_ARENA_GROW(p, pool, size, incr)
#define PL_ARENA_MARK(pool)   ((void *) (pool)->current->avail)
#define PR_UPTRDIFF(p, q)   ((PRUword)(p) - (PRUword)(q))
#define PL_CLEAR_UNUSED(a)
#define PL_CLEAR_ARENA(a)
#define PL_ARENA_RELEASE(pool, mark)
#define PL_COUNT_ARENA(pool, op)
#define PL_ARENA_DESTROY(pool, a, pnext)
#define PL_ArenaCountAllocation(ap, nb)   /* nothing */
#define PL_ArenaCountInplaceGrowth(ap, size, incr)   /* nothing */
#define PL_ArenaCountGrowth(ap, size, incr)   /* nothing */
#define PL_ArenaCountRelease(ap, mark)   /* nothing */
#define PL_ArenaCountRetract(ap, mark)   /* nothing */

Typedefs

typedef
typedefPR_BEGIN_EXTERN_C
struct 
PLArena

Class Documentation

struct PLArena

Definition at line 55 of file plarena.h.

Collaboration diagram for PLArena:
Class Members
PRUword avail
PRUword base
PRUword limit
PLArena * next
struct PLArenaPool

Definition at line 83 of file plarena.h.

Collaboration diagram for PLArenaPool:
Class Members
PRUint32 arenasize
PLArena * current
PLArena first
PRUword mask

Define Documentation

#define PL_ARENA_ALIGN (   pool,
  n 
)    (((PRUword)(n) + (pool)->mask) & ~(pool)->mask)

Definition at line 105 of file plarena.h.

#define PL_ARENA_ALLOCATE (   p,
  pool,
  nb 
)
Value:
PR_BEGIN_MACRO \
        PLArena *_a = (pool)->current; \
        PRUint32 _nb = PL_ARENA_ALIGN(pool, nb); \
        PRUword _p = _a->avail; \
        PRUword _q = _p + _nb; \
        if (_q > _a->limit) \
            _p = (PRUword)PL_ArenaAllocate(pool, _nb); \
        else \
            _a->avail = _q; \
        p = (void *)_p; \
        PL_ArenaCountAllocation(pool, nb); \
    PR_END_MACRO

Definition at line 108 of file plarena.h.

#define PL_ARENA_DESTROY (   pool,
  a,
  pnext 
)
Value:
PR_BEGIN_MACRO \
        PL_COUNT_ARENA(pool,--); \
        if ((pool)->current == (a)) (pool)->current = &(pool)->first; \
        *(pnext) = (a)->next; \
        PL_CLEAR_ARENA(a); \
        free(a); \
        (a) = 0; \
    PR_END_MACRO

Definition at line 173 of file plarena.h.

#define PL_ARENA_GROW (   p,
  pool,
  size,
  incr 
)
Value:
PR_BEGIN_MACRO \
        PLArena *_a = (pool)->current; \
        PRUint32 _incr = PL_ARENA_ALIGN(pool, incr); \
        PRUword _p = _a->avail; \
        PRUword _q = _p + _incr; \
        if (_p == (PRUword)(p) + PL_ARENA_ALIGN(pool, size) && \
            _q <= _a->limit) { \
            _a->avail = _q; \
            PL_ArenaCountInplaceGrowth(pool, size, incr); \
        } else { \
            p = PL_ArenaGrow(pool, p, size, incr); \
        } \
        PL_ArenaCountGrowth(pool, size, incr); \
    PR_END_MACRO

Definition at line 122 of file plarena.h.

#define PL_ARENA_MARK (   pool)    ((void *) (pool)->current->avail)

Definition at line 138 of file plarena.h.

Value:
PR_BEGIN_MACRO \
        char *_m = (char *)(mark); \
        PLArena *_a = (pool)->current; \
        if (PR_UPTRDIFF(_m, _a->base) <= PR_UPTRDIFF(_a->avail, _a->base)) { \
            _a->avail = (PRUword)PL_ARENA_ALIGN(pool, _m); \
            PL_CLEAR_UNUSED(_a); \
            PL_ArenaCountRetract(pool, _m); \
        } else { \
            PL_ArenaRelease(pool, _m); \
        } \
        PL_ArenaCountRelease(pool, _m); \
    PR_END_MACRO

Definition at line 153 of file plarena.h.

#define PL_ArenaCountAllocation (   ap,
  nb 
)    /* nothing */

Definition at line 203 of file plarena.h.

#define PL_ArenaCountGrowth (   ap,
  size,
  incr 
)    /* nothing */

Definition at line 205 of file plarena.h.

#define PL_ArenaCountInplaceGrowth (   ap,
  size,
  incr 
)    /* nothing */

Definition at line 204 of file plarena.h.

#define PL_ArenaCountRelease (   ap,
  mark 
)    /* nothing */

Definition at line 206 of file plarena.h.

#define PL_ArenaCountRetract (   ap,
  mark 
)    /* nothing */

Definition at line 207 of file plarena.h.

Definition at line 150 of file plarena.h.

Definition at line 149 of file plarena.h.

#define PL_COUNT_ARENA (   pool,
  op 
)

Definition at line 170 of file plarena.h.

#define PR_UPTRDIFF (   p,
 
)    ((PRUword)(p) - (PRUword)(q))

Definition at line 139 of file plarena.h.


Typedef Documentation

typedef typedefPR_BEGIN_EXTERN_C struct PLArena

Definition at line 53 of file plarena.h.