vcf/JavaScriptKit/js-impl/jsarena.h File Reference
Classes | |
| struct | JSArena |
| struct | JSArenaPool |
Defines | |
| #define | JS_ARENA_ALIGN(pool, n) (((jsuword)(n) + (pool)->mask) & ~(pool)->mask) |
| #define | JS_ARENA_ALLOCATE(p, pool, nb) JS_ARENA_ALLOCATE_CAST(p, void *, pool, nb) |
| #define | JS_ARENA_ALLOCATE_TYPE(p, type, pool) JS_ARENA_ALLOCATE_COMMON(p, type *, pool, sizeof(type), 0) |
| #define | JS_ARENA_ALLOCATE_CAST(p, type, pool, nb) JS_ARENA_ALLOCATE_COMMON(p, type, pool, nb, _nb > _a->limit) |
| #define | JS_ARENA_ALLOCATE_COMMON(p, type, pool, nb, guard) |
| #define | JS_ARENA_GROW(p, pool, size, incr) JS_ARENA_GROW_CAST(p, void *, pool, size, incr) |
| #define | JS_ARENA_GROW_CAST(p, type, pool, size, incr) |
| #define | JS_ARENA_MARK(pool) ((void *) (pool)->current->avail) |
| #define | JS_UPTRDIFF(p, q) ((jsuword)(p) - (jsuword)(q)) |
| #define | JS_CLEAR_UNUSED(a) |
| #define | JS_CLEAR_ARENA(a) |
| #define | JS_ARENA_RELEASE(pool, mark) |
| #define | JS_COUNT_ARENA(pool, op) |
| #define | JS_ARENA_DESTROY(pool, a, pnext) |
| #define | JS_ArenaCountAllocation(ap, nb) |
| #define | JS_ArenaCountInplaceGrowth(ap, size, incr) |
| #define | JS_ArenaCountGrowth(ap, size, incr) |
| #define | JS_ArenaCountRelease(ap, mark) |
| #define | JS_ArenaCountRetract(ap, mark) |
Typedefs | |
| typedef typedefJS_BEGIN_EXTERN_C struct JSArena | JSArena |
| typedef JSArenaPool | JSArenaPool |
Functions | |
| JS_PUBLIC_API (void) JS_InitArenaPool(JSArenaPool *pool | |
| JS_PUBLIC_API (void *) JS_ArenaAllocate(JSArenaPool *pool | |
Variables | |
| const char * | name |
| const char size_t | size |
| const char size_t size_t | align |
| size_t | nb |
| void * | p |
| void size_t | size |
| void size_t size_t | incr |
| void * | p |
| void size_t | size |
| void size_t size_t | incr |
| char * | mark |
| void * | p |
| void size_t | size |
Define Documentation
|
|
|
|
|
|
|
|
|
|
|
Value: JS_BEGIN_MACRO \ JSArena *_a = (pool)->current; \ size_t _nb = JS_ARENA_ALIGN(pool, nb); \ jsuword _p = _a->avail; \ if ((guard) || _p > _a->limit - _nb) \ _p = (jsuword)JS_ArenaAllocate(pool, _nb); \ else \ _a->avail = _p + _nb; \ p = (type) _p; \ JS_ArenaCountAllocation(pool, nb); \ JS_END_MACRO |
|
|
|
|
|
Value: JS_BEGIN_MACRO \ JS_COUNT_ARENA(pool,--); \ if ((pool)->current == (a)) (pool)->current = &(pool)->first; \ *(pnext) = (a)->next; \ JS_CLEAR_ARENA(a); \ free(a); \ (a) = NULL; \ JS_END_MACRO |
|
|
|
|
|
Value: JS_BEGIN_MACRO \ JSArena *_a = (pool)->current; \ if (_a->avail == (jsuword)(p) + JS_ARENA_ALIGN(pool, size)) { \ size_t _nb = (size) + (incr); \ _nb = JS_ARENA_ALIGN(pool, _nb); \ if (_a->limit >= _nb && (jsuword)(p) <= _a->limit - _nb) { \ _a->avail = (jsuword)(p) + _nb; \ JS_ArenaCountInplaceGrowth(pool, size, incr); \ } else if ((jsuword)(p) == _a->base) { \ p = (type) JS_ArenaRealloc(pool, p, size, incr); \ } else { \ p = (type) JS_ArenaGrow(pool, p, size, incr); \ } \ } else { \ p = (type) JS_ArenaGrow(pool, p, size, incr); \ } \ JS_ArenaCountGrowth(pool, size, incr); \ JS_END_MACRO |
|
|
|
|
|
Value: JS_BEGIN_MACRO \ char *_m = (char *)(mark); \ JSArena *_a = (pool)->current; \ if (_a != &(pool)->first && \ JS_UPTRDIFF(_m, _a->base) <= JS_UPTRDIFF(_a->avail, _a->base)) { \ _a->avail = (jsuword)JS_ARENA_ALIGN(pool, _m); \ JS_ASSERT(_a->avail <= _a->limit); \ JS_CLEAR_UNUSED(_a); \ JS_ArenaCountRetract(pool, _m); \ } else { \ JS_ArenaRelease(pool, _m); \ } \ JS_ArenaCountRelease(pool, _m); \ JS_END_MACRO |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Typedef Documentation
|
|
|
|
|
|
Function Documentation
|
|
|
|
|
|
Variable Documentation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
