#include "BALBase.h"
Namespaces | |
| namespace | OWBAL |
Classes | |
| struct | OWBAL::Arena |
| struct | OWBAL::ArenaPool |
Defines | |
| #define | ARENA_ALIGN_MASK 3 |
| #define | ARENA_ALIGN(pool, n) (((uword)(n) + ARENA_ALIGN_MASK) & ~ARENA_ALIGN_MASK) |
| #define | INIT_ARENA_POOL(pool, name, size) InitArenaPool(pool, name, size, ARENA_ALIGN_MASK + 1) |
| #define | ARENA_ALLOCATE(p, pool, nb) |
| #define | ARENA_GROW(p, pool, size, incr) |
| #define | ARENA_MARK(pool) ((void *) (pool)->current->avail) |
| #define | UPTRDIFF(p, q) ((uword)(p) - (uword)(q)) |
| #define | CLEAR_UNUSED(a) |
| #define | CLEAR_ARENA(a) |
| #define | ARENA_RELEASE(pool, mark) |
| #define | ARENA_DESTROY(pool, a, pnext) |
Typedefs | |
| typedef unsigned long | OWBAL::uword |
Functions | |
| void | OWBAL::InitArenaPool (ArenaPool *pool, const char *name, unsigned int size, unsigned int align) |
| Init arena pool. | |
| void | OWBAL::FinishArenaPool (ArenaPool *pool) |
| Finish arena pool. | |
| void | OWBAL::FreeArenaPool (ArenaPool *pool) |
| Free arena pool. | |
| void * | OWBAL::ArenaAllocate (ArenaPool *pool, unsigned int nb) |
| Arena allocate. | |
| #define ARENA_ALIGN_MASK 3 |
| #define ARENA_ALIGN | ( | pool, | |||
| n | ) | (((uword)(n) + ARENA_ALIGN_MASK) & ~ARENA_ALIGN_MASK) |
| #define INIT_ARENA_POOL | ( | pool, | |||
| name, | |||||
| size | ) | InitArenaPool(pool, name, size, ARENA_ALIGN_MASK + 1) |
| #define ARENA_ALLOCATE | ( | p, | |||
| pool, | |||||
| nb | ) |
Value:
Arena *_a = (pool)->current; \
unsigned int _nb = ARENA_ALIGN(pool, nb); \
uword _p = _a->avail; \
uword _q = _p + _nb; \
if (_q > _a->limit) \
_p = (uword)ArenaAllocate(pool, _nb); \
else \
_a->avail = _q; \
p = (void *)_p;
| #define ARENA_GROW | ( | p, | |||
| pool, | |||||
| size, | |||||
| incr | ) |
Value:
Arena *_a = (pool)->current; \
unsigned int _incr = ARENA_ALIGN(pool, incr); \
uword _p = _a->avail; \
uword _q = _p + _incr; \
if (_p == (uword)(p) + ARENA_ALIGN(pool, size) && \
| #define ARENA_MARK | ( | pool | ) | ((void *) (pool)->current->avail) |
| #define UPTRDIFF | ( | p, | |||
| q | ) | ((uword)(p) - (uword)(q)) |
| #define CLEAR_UNUSED | ( | a | ) |
| #define CLEAR_ARENA | ( | a | ) |
| #define ARENA_RELEASE | ( | pool, | |||
| mark | ) |
Value:
char *_m = (char *)(mark); \ Arena *_a = (pool)->current; \
| #define ARENA_DESTROY | ( | pool, | |||
| a, | |||||
| pnext | ) |
Value:
if ((pool)->current == (a)) (pool)->current = &(pool)->first; \ *(pnext) = (a)->next; \ CLEAR_ARENA(a); \ fastFree(a); \ (a) = 0;