NAME ^

src/headers.c - Header management functions

DESCRIPTION ^

Handles getting of various headers, and pool creation.

Buffer Header Functions for small-object lookup table ^

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static void *get_free_buffer(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool))

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

Header Pool Creation Functions ^

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Small_Object_Pool *new_pmc_pool(PARROT_INTERP)

Creates an new pool for PMCs and returns it.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Small_Object_Pool *new_bufferlike_pool(PARROT_INTERP, size_t actual_buffer_size)

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

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Small_Object_Pool *new_buffer_pool(PARROT_INTERP)

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

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Small_Object_Pool *new_string_pool(PARROT_INTERP, INTVAL constant)

Creates a new pool for STRINGS and returns it.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Small_Object_Pool *make_bufferlike_pool(PARROT_INTERP, size_t buffer_size)

Make and return a bufferlike header pool.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL Small_Object_Pool *get_bufferlike_pool(PARROT_INTERP, size_t buffer_size)

Return a bufferlike header pool, it must exist.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL PMC *new_pmc_header(PARROT_INTERP, UINTVAL flags)

Get a header.

PARROT_WARN_UNUSED_RESULT PARROT_CANNOT_RETURN_NULL static PMC_EXT *new_pmc_ext(PARROT_INTERP)

Creates a new PMC_EXT and returns it.

void add_pmc_ext(PARROT_INTERP, NOTNULL(PMC *pmc))

Adds a new PMC_EXT to pmc.

void add_pmc_sync(PARROT_INTERP, NOTNULL(PMC *pmc))

Adds a PMC_sync field to pmc.

PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT STRING *new_string_header(PARROT_INTERP, UINTVAL flags)

Returns a new STRING header.

PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT Buffer *new_buffer_header(PARROT_INTERP)

Creates and returns a new Buffer.

PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT void *new_bufferlike_header(PARROT_INTERP, size_t size)

Creates and returns a new buffer-like header.

PARROT_WARN_UNUSED_RESULT size_t get_max_buffer_address(PARROT_INTERP)

Calculates the maximum buffer address and returns it.

PARROT_WARN_UNUSED_RESULT size_t get_min_buffer_address(PARROT_INTERP)

Calculates the minimum buffer address and returns it.

PARROT_WARN_UNUSED_RESULT size_t get_max_pmc_address(PARROT_INTERP)

Calculates the maximum PMC address and returns it.

PARROT_WARN_UNUSED_RESULT size_t get_min_pmc_address(PARROT_INTERP)

Calculates the maximum PMC address and returns it.

PARROT_WARN_UNUSED_RESULT int is_buffer_ptr(PARROT_INTERP, ARGIN(const void *ptr))

Checks that ptr is actually a Buffer.

PARROT_WARN_UNUSED_RESULT int is_pmc_ptr(PARROT_INTERP, ARGIN(const void *ptr))

Checks that ptr is actually a PMC.

void Parrot_initialize_header_pools(PARROT_INTERP)

Initialize the pools for the tracked resources.

PARROT_WARN_UNUSED_RESULT int Parrot_forall_header_pools(PARROT_INTERP, int flag, NULLOK(void *arg), NOTNULL(pool_iter_fn func))

Iterate through all header pools by calling the passed function. Returns zero if the iteration didn't stop or the returned value.

flag is one of

  POOL_PMC
  POOL_BUFFER
  POOL_CONST
  POOL_ALL
Only matching pools will be used.

arg

This argument is passed on to the iteration function.

pool_iter_fn

It is called with Interp*, Small_Object_Pool *, int flag, void *arg) If the function returns a non-zero value iteration will stop.

static void free_pool(NOTNULL(Small_Object_Pool *pool))

RT#48260: Not yet documented!!!

static int sweep_cb_buf(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool), SHIM(int flag), NOTNULL(void *arg))

RT#48260: Not yet documented!!!

static int sweep_cb_pmc(PARROT_INTERP, NOTNULL(Small_Object_Pool *pool), int flag, NOTNULL(void *arg))

RT#48260: Not yet documented!!!

void Parrot_destroy_header_pools(PARROT_INTERP)

Destroys the header pools.

static void fix_pmc_syncs(NOTNULL(Interp *dest_interp), NOTNULL(Small_Object_Pool *pool))

RT#48260: Not yet documented!!!

void Parrot_merge_header_pools(NOTNULL(Interp *dest_interp), NOTNULL(Interp *source_interp))

Merge the header pools of source_interp into those of dest_interp. (Used to deal with shared objects left after interpreter destruction.)

void Parrot_initialize_header_pool_names(PARROT_INTERP)>

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