NAME ^

src/gc/dod.c - Dead object destruction of the various headers

DESCRIPTION ^

This file implements dead object destruction. This is documented in PDD 9 with supplementary notes in docs/dev/dod.pod.

It's possible to turn on/off the checking of the system stack and processor registers. The actual checking is implemented in src/cpu_dep.c.

There's also a verbose mode for garbage collection.

FUNCTIONS ^

static void mark_special

Mark a special PMC. If it has a PMC_EXT structure, append or prepend the next_for_GC pointer; otherwise, do the custom mark directly.

This should really be inline, so if inline isn't available, it would be better if it were a macro.

void pobject_lives

RT#48260: Not yet documented!!!

Marks the object to live.

int Parrot_dod_trace_root

Trace the root set. Returns 0 if it's a lazy DOD run and all objects that need timely destruction were found.

trace_stack can have these values:

 0 ... trace normal roots, no system areas
 1 ... trace whole root set
 2 ... trace system areas only
static int trace_active_PMCs

Do a full trace run and mark all the PMCs as active if they are. Returns whether the run completed, that is, whether it's safe to proceed with GC.

int Parrot_dod_trace_children

Returns whether the tracing process completed.

void Parrot_dod_trace_pmc_data

RT#48260: Not yet documented!!!

void clear_cow

Clear the COW ref count.

void used_cow

Find other users of COW's bufstart.

void Parrot_dod_sweep

Put any buffers/PMCs that are now unused onto the pool's free list. If GC_IS_MALLOC, bufstart gets freed too, if possible. Avoid buffers that are immune from collection (i.e. constant).

void Parrot_dod_free_pmc

RT#48260: Not yet documented!!!

void Parrot_free_pmc_ext

Frees the PMC_EXT structure attached to a PMC, if it exists.

void Parrot_dod_free_sysmem

RT#48260: Not yet documented!!!

void Parrot_dod_free_buffer_malloc

RT#48260: Not yet documented!!!

void Parrot_dod_free_buffer

RT#48260: Not yet documented!!!

static size_t find_common_mask

Find a mask covering the longest common bit-prefix of val1 and val2.

void trace_mem_block

Traces the memory block between lo_var_ptr and hi_var_ptr.

static void clear_live_bits

Run through all PMC arenas and clear live bits.

void Parrot_dod_clear_live_bits

RT#48260: Not yet documented!!!

void Parrot_dod_profile_start

Records the start time of a DOD run when profiling is enabled.

void Parrot_dod_profile_end

Records the end time of the DOD part what run when profiling is enabled. Also record start time of next part.

void Parrot_dod_ms_run_init

Prepare for a mark & sweep DOD run.

static int sweep_cb

RT#48260: Not yet documented!!!

void Parrot_dod_ms_run

Run the stop-the-world mark & sweep collector.

void Parrot_do_dod_run

Call the configured garbage collector to reclaim unused headers.

SEE ALSO ^

include/parrot/dod.h, src/cpu_dep.c, docs/dev/dod.dev and docs/pdds/pdd09_gc.pod.

HISTORY ^

Initial version by Mike Lambert on 2002.05.27.


parrot