| parrotcode: Header management functions | |
| Contents | C |

src/headers.c - Header management functions

Handles getting of various headers, and pool creation.

static void *get_free_bufferpool and returns it.
If the object is larger then a starndard PObj structure,
all additional memory is cleared.
Small_Object_Pool *new_pmc_poolSmall_Object_Pool *new_bufferlike_poolmake_bufferlike_pool(),
and should probably not be called directly.Small_Object_Pool *new_buffer_poolSmall_Object_Pool structure for managing buffer objects.Small_Object_Pool *new_string_poolSTRINGS and returns it.
This calls make_bufferlike_pool internally,
which in turn calls new_bufferlike_pool.Small_Object_Pool *make_bufferlike_poolSmall_Object_Pool *get_bufferlike_poolPMC *new_pmc_headerNULL.static PMC_EXT *new_pmc_extPMC_EXT structure from the PMC_EXT pool.
A pointer to the new PMC_EXT is returned.
Does not check to ensure the PMC_EXT is non-null before it is returned (yet).void add_pmc_extPMC_EXT structure,
and attaches it to the given PMC.
Sets the necessary flags associated with the PMC_EXT structure.
Ensures that the PMC_EXT structure is marked as "alive" by the GC.void add_pmc_syncSync* structure to the given PMC.
Initializes the PMC's owner field and the synchronization mutext.
Does not check to ensure the Sync* is non-null.STRING *new_string_headerSTRING structure from the string pool or the constant string pool.
Sets default flags on the string object: PObj_is_string_FLAG,
PObj_is_COWable_FLAG,
and PObj_live_FLAG (for GC).
Initializes the data field of the string buffer to NULL.Buffer *new_buffer_headerBuffer from the buffer header pool.
Does not check that the pointer is non-null.
Calls get_free_buffer to do all the work.void *new_bufferlike_headersize_t get_max_buffer_addressend_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_addressstart_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_addresspmc_pool.size_t get_min_pmc_addresspmc_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_ptrptr is located within one of the sized header pools.
Returns 1 if it is,
and 0 if not.int is_pmc_ptrptr is actually a PMC pointer.
Returns 1 if it is,
returns 0 otherwise.void Parrot_initialize_header_poolsstring_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_ALL
(Interp*, Small_Object_Pool *, int flag, void *arg) If the function returns a non-zero value iteration will stop.static void free_poolstatic int sweep_cb_bufParrot_dod_sweep to perform the sweep, and free_pool to free the pool and all it's arenas.static int sweep_cb_pmcParrot_dod_sweep to perform the sweep, and free_pool to free the pool and all it's arenas. Always returns 0.void Parrot_destroy_header_poolsParrot_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_syncsvoid Parrot_merge_header_poolssource_interp into those of dest_interp. (Used to deal with shared objects left after interpreter destruction.)void Parrot_initialize_header_pool_namesname parameter of the various header pools to a Parrot string structure for the name of the pool.
include/parrot/headers.h.

Initial version by Mike Lambert on 2002.05.27.
|
|
|