Skip to content

Commit

Permalink
Allocate the arena_bounds array when the pool is allocated. Don't che…
Browse files Browse the repository at this point in the history
…ck for NULL every time we get a new arena
  • Loading branch information
Whiteknight committed Sep 4, 2011
1 parent 3f42979 commit 1e1a6e6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/gc/fixed_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ Parrot_gc_pool_new(SHIM_INTERP, size_t object_size)
newpool->newfree = NULL;
newpool->newlast = NULL;
newpool->num_arenas = 0;
newpool->arena_bounds = NULL;
newpool->arena_bounds = mem_sys_allocate(NEXT_ARENA_BOUNDS_SIZE(0));

return newpool;
}
Expand Down Expand Up @@ -574,11 +574,9 @@ allocate_new_pool_arena(PARROT_INTERP, ARGMOD(Pool_Allocator *pool))
if ((char *)pool->hi_arena_ptr < (char *)new_arena + total_size)
pool->hi_arena_ptr = (char *)new_arena + total_size;

pool->num_arenas++;
if (pool->arena_bounds == NULL)
pool->arena_bounds = mem_sys_allocate(NEXT_ARENA_BOUNDS_SIZE(0));
else if (pool->num_arenas % ARENA_BOUNDS_PADDING == 0)
if (pool->num_arenas % ARENA_BOUNDS_PADDING == 0)
pool->arena_bounds = mem_sys_realloc(pool->arena_bounds, NEXT_ARENA_BOUNDS_SIZE(pool->num_arenas));
pool->num_arenas++;
{
size_t ptr_idx = (pool->num_arenas - 1) * 2;
pool->arena_bounds[ptr_idx] = (size_t) (new_arena + 1);
Expand Down

0 comments on commit 1e1a6e6

Please sign in to comment.