parrotcode: general Parrot API for GC functions | |
Contents | C |
src/gc/api.c - general Parrot API for GC functions
This file implements dead object destruction. This is documented in PDD 9 with supplementary notes in docs/dev/dod.pod and docs/memory_internals.pod.
It's possible to turn on/off the checking of the system stack and processor registers.
The actual checking is set up in src/cpu_dep.c and is performed in the function trace_memory_block
here.
There's also a verbose mode for garbage collection.
PMC *new_pmc_header
NULL
.
static PMC_EXT *new_pmc_ext
PMC_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_ext
PMC_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_sync
Sync*
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_header
STRING
header 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_header
Buffer
from the buffer header pool.
Calls get_free_buffer
to do all the work.
void *new_bufferlike_header
void Parrot_gc_free_pmc
destroy
VTABLE method if one is available.
If the PMC uses a PMC_EXT structure,
that is freed as well.
void Parrot_gc_free_pmc_ext
PMC_EXT
structure attached to a PMC,
if it exists.
void Parrot_gc_free_sysmem
void Parrot_gc_free_buffer_malloc
void Parrot_gc_free_buffer
static size_t find_common_mask
val1
and val2
.
void trace_mem_block
lo_var_ptr
and hi_var_ptr
.
Attempt to find pointers to PObjs or buffers,
and mark them as "alive" if found.
See src/cpu_dep.c for more information about tracing memory areas.
void Parrot_gc_profile_start
void Parrot_gc_profile_end
what
run when profiling is enabled.
Also record start time of next part.
void Parrot_gc_ms_run_init
void Parrot_do_dod_run
include/parrot/gc_api.h, src/cpu_dep.c, docs/dev/dod.dev and docs/pdds/pdd09_gc.pod.
Initial version by Mike Lambert on 2002.05.27.
|