parrotcode: Header management functions | |
Contents | C |
src/gc/pools.c - Header management functions
Handles pool creation for PMC headers.
void *get_free_buffer
pool
and returns it.
If the object is larger then a standard PObj
structure,
all additional memory is cleared.Small_Object_Pool *new_pmc_pool
Small_Object_Pool *new_bufferlike_pool
get_bufferlike_pool()
,
and should probably not be called directly.
Small_Object_Pool *new_buffer_pool
Small_Object_Pool
structure for managing buffer objects.Non-constant strings and plain Buffers are stored in the sized header pools.
Small_Object_Pool *new_string_pool
STRING
s and returns it.
This calls get_bufferlike_pool
internally,
which in turn calls new_bufferlike_pool
.
Small_Object_Pool *get_bufferlike_pool
size_t get_max_buffer_address
end_arena_memory
field is the highest.
Notice that arenas in each pool are not necessarily located directly next to each other in memory,
and the last arena in the pool's list may not be located at the highest memory address.
size_t get_min_buffer_address
start_arena_memory
field.
Notice that the memory region between get_min_buffer_address
and get_max_buffer_address
may be fragmented,
and parts of it may not be available for Parrot to use directly (such as bookkeeping data for the OS memory manager).
size_t get_max_pmc_address
pmc_pool
.
size_t get_min_pmc_address
pmc_pool
.
Notice that the memory region between get_min_pmc_address
and get_max_pmc_address
may be fragmented,
and not all of it may be used directly by Parrot for storing PMCs.
int is_buffer_ptr
ptr
is located within one of the sized header pools.
Returns 1
if it is,
and 0
if not.
int is_pmc_ptr
ptr
is actually a PMC pointer.
Returns 1
if it is,
0
otherwise.
void Parrot_initialize_header_pools
string_header_pool
and buffer_header_pool
are actually both in the sized pools,
although no other sized pools are created here.
int Parrot_forall_header_pools
POOL_PMC POOL_BUFFER POOL_CONST POOL_ALLOnly matching pools will be used. Notice that it is not possible to iterate over certain sets of pools using the provided flags in the single pass. For instance, both the PMC pool and the constant PMC pool cannot be iterated over in a single pass.
(Parrot_Interp, Small_Object_Pool *, int flag, void *arg)
. If the function returns a non-zero value, iteration will stop.static void free_pool
static int sweep_cb_buf
Parrot_gc_sweep
to perform the sweep, and free_pool
to free the pool and all its arenas.
static int sweep_cb_pmc
Parrot_gc_sweep
to perform the sweep, and free_pool
to free the pool and all its arenas. Always returns 0
.
void Parrot_destroy_header_pools
Parrot_forall_header_pools
to loop over all the pools, passing sweep_cb_pmc
and sweep_cb_buf
callback routines. Frees the array of sized header pointers in the Arenas
structure too.
static void fix_pmc_syncs
void Parrot_merge_header_pools
source_interp
into those of dest_interp
. (Used to deal with shared objects left after interpreter destruction.)include/parrot/gc_pools.h.
Initial version by Mike Lambert on 2002.05.27.
|