NAME ^

src/headers.c - Header management functions

DESCRIPTION ^

Handles getting of various headers, and pool creation.

Buffer Header Functions for small-object lookup table ^

static void *get_free_buffer(Interp *interpreter, struct Small_Object_Pool *pool)

Gets a free Buffer from pool and returns it. Memory is cleared.

Header Pool Creation Functions ^

struct Small_Object_Pool *new_pmc_pool(Interp *interpreter)

Creates an new pool for PMCs and returns it.

struct Small_Object_Pool *new_bufferlike_pool(Interp *interpreter, size_t actual_buffer_size)

Creates a new pool for buffer-like structures. Usually you would need make_bufferlike_pool().

struct Small_Object_Pool *new_buffer_pool(Interp *interpreter)

Non-constant strings and plain Buffers are in the sized header pools.

struct Small_Object_Pool *new_string_pool(Interp *interpreter, INTVAL constant)

Creates a new pool for STRINGS and returns it.

struct Small_Object_Pool *make_bufferlike_pool(Interp *interpreter, size_t buffer_size)

Make and return a bufferlike header pool.

struct Small_Object_Pool *get_bufferlike_pool(Interp *interpreter, size_t buffer_size)

Return a bufferlike header pool, it must exist.

PMC *new_pmc_header(Interp *interpreter)

Get a header.

PMC_EXT *new_pmc_ext(Interp *interpreter)

Creates a new PMC_EXT and returns it.

void add_pmc_ext(Interp *interpreter, PMC *pmc)

Adds a new PMC_EXT to pmc.

STRING *new_string_header(Interp *interpreter, UINTVAL flags)

Returns a new STRING header.

Buffer *new_buffer_header(Interp *interpreter)

Creates and returns a new Buffer.

void buffer_mark_COW(Buffer *b)

Marks b as COW.

Buffer *buffer_unmake_COW(Interp *interpreter, Buffer *src)

If src is COW then a new Buffer is created by copying from src and returned. Otherwise src is returned.

Buffer *buffer_copy_if_diff(Interp *interpreter, Buffer *src, Buffer *dst)

Returns a copy of src if it differs from dst.

void *new_bufferlike_header(Interp *interpreter, size_t size)

Creates and returns a new buffer-like header.

size_t get_max_buffer_address(Interp *interpreter)

Calculates the maximum buffer address and returns it.

size_t get_min_buffer_address(Interp *interpreter)

Calculates the minimum buffer address and returns it.

size_t get_max_pmc_address(Interp *interpreter)

Calculates the maximum PMC address and returns it.

size_t get_min_pmc_address(Interp *interpreter)

Calculates the maximum PMC address and returns it.

int is_buffer_ptr(Interp *interpreter, void *ptr)

Checks that ptr is actually a Buffer.

int is_pmc_ptr(Interp *interpreter, void *ptr)

Checks that ptr is actually a PMC.

void Parrot_initialize_header_pools(Interp *interpreter)

Initialize the pools for the tracked resources.

void Parrot_destroy_header_pools(Interp *interpreter)

Destroys the header pools.

void Parrot_initialize_header_pool_names(Interp *interpreter)

If we want these names, they must be added in DOD.

SEE ALSO ^

include/parrot/headers.h.

HISTORY ^

Initial version by Mike Lambert on 2002.05.27.


parrot