NAME ^

src/gc/resources.c - Handling Small Object Pools

DESCRIPTION ^

Handles the accessing of small object pools (header pools).

Functions ^

PARROT_WARN_UNUSED_RESULT INTVAL contained_in_pool(NOTNULL(const Small_Object_Pool *pool), NOTNULL(const void *ptr))

Returns whether pool contains *ptr.

int Parrot_is_const_pmc(PARROT_INTERP, NOTNULL(PMC *pmc))

Returns whether *pmc is a constant PMC.

static void more_traceable_objects(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool))

We're out of traceable objects. Try a DOD, then get some more if needed.

static void gc_ms_add_free_object(SHIM_INTERP, NOTNULL(Small_Object_Pool *pool), NOTNULL(PObj *to_add))

Add an unused object back to the free pool for later reuse.

PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT static PObj *gc_ms_get_free_object(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool))

Get a new object from the free pool and return it.

void Parrot_add_to_free_list(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool), NOTNULL(Small_Object_Arena *arena))

Adds the objects in the newly allocated arena to the free list.

void Parrot_append_arena_in_pool(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool), NOTNULL(Small_Object_Arena *new_arena), size_t size)

insert the new arena into the pool's structure, update stats

static void gc_ms_alloc_objects(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool))

We have no more headers on the free header pool. Go allocate more and put them on.

PARROT_MALLOC PARROT_CANNOT_RETURN_NULL Small_Object_Pool *new_small_object_pool(size_t object_size, size_t objects_per_alloc)

Creates a new Small_Object_Pool and returns a pointer to it.

void gc_pmc_ext_pool_init(NOTNULL(Small_Object_Pool *pool))

TODO: Not yet documented!!!

static void gc_ms_pool_init(SHIM_INTERP, NOTNULL(Small_Object_Pool *pool))

TODO: Not yet documented!!!

void Parrot_gc_ms_init(PARROT_INTERP)

Initialize the state structures of the gc system. Called immediately before creation of memory pools. This function must set the function pointers for add_free_object_fn, get_free_object_fn, alloc_object_fn, and more_object_fn.

void Parrot_small_object_pool_merge(PARROT_INTERP, NOTNULL(Small_Object_Pool *dest), NOTNULL(Small_Object_Pool *source))

Merge source into dest.

SEE ALSO ^

include/parrot/smallobject.h, docs/memory_internals.pod.


parrot