Author: chromatic
Date: Fri Jan 2 17:47:44 2009
New Revision: 34843
Modified:
branches/pdd09gc_part2/include/parrot/gc_api.h
branches/pdd09gc_part2/src/gc/api.c
branches/pdd09gc_part2/src/gc/incremental_ms.c
Log:
[GC] Created an enum for Parrot_gc_trace_root() to select which of the root set
and the system areas to trace for live PObjs.
Modified: branches/pdd09gc_part2/include/parrot/gc_api.h
==============================================================================
--- branches/pdd09gc_part2/include/parrot/gc_api.h (original)
+++ branches/pdd09gc_part2/include/parrot/gc_api.h Fri Jan 2 17:47:44 2009
@@ -13,6 +13,12 @@
#include "parrot/parrot.h"
+typedef enum {
+ GC_TRACE_FULL,
+ GC_TRACE_ROOT_ONLY,
+ GC_TRACE_SYSTEM_ONLY
+} Parrot_gc_trace_type;
+
/* Macros for recursively blocking and unblocking DOD */
#define Parrot_block_GC_mark(interp) \
{ \
@@ -118,7 +124,7 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-int Parrot_gc_trace_root(PARROT_INTERP, int trace_stack)
+int Parrot_gc_trace_root(PARROT_INTERP, Parrot_gc_trace_type)
__attribute__nonnull__(1);
void Parrot_free_pmc_ext(PARROT_INTERP, ARGMOD(PMC *p))
Modified: branches/pdd09gc_part2/src/gc/api.c
==============================================================================
--- branches/pdd09gc_part2/src/gc/api.c (original)
+++ branches/pdd09gc_part2/src/gc/api.c Fri Jan 2 17:47:44 2009
@@ -56,7 +56,7 @@
FUNC_MODIFIES(*pool)
FUNC_MODIFIES(*arg);
-static int trace_active_PMCs(PARROT_INTERP, int trace_stack)
+static int trace_active_PMCs(PARROT_INTERP, Parrot_gc_trace_type trace)
__attribute__nonnull__(1);
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
@@ -242,16 +242,28 @@
C<trace_stack> can have these values:
- 0 ... trace normal roots, no system areas
- 1 ... trace whole root set
- 2 ... trace system areas only
+=over 4
+
+=item * GC_TRACE_FULL
+
+trace whole root set, including system areas
+
+=item * GC_TRACE_ROOT_ONLY
+
+trace normal roots, no system areas
+
+=item * GC_TRACE_SYSTEM_ONLY
+
+trace system areas only
+
+=back
=cut
*/
int
-Parrot_gc_trace_root(PARROT_INTERP, int trace_stack)
+Parrot_gc_trace_root(PARROT_INTERP, Parrot_gc_trace_type trace)
{
Arenas * const arena_base = interp->arena_base;
Parrot_Context *ctx;
@@ -260,7 +272,7 @@
/* note: adding locals here did cause increased DOD runs */
mark_context_start();
- if (trace_stack == 2) {
+ if (trace == GC_TRACE_SYSTEM_ONLY) {
trace_system_areas(interp);
return 0;
}
@@ -339,7 +351,7 @@
return 0;
/* Find important stuff on the system stack */
- if (trace_stack)
+ if (trace == GC_TRACE_FULL)
trace_system_areas(interp);
if (interp->profile)
@@ -362,9 +374,9 @@
*/
static int
-trace_active_PMCs(PARROT_INTERP, int trace_stack)
+trace_active_PMCs(PARROT_INTERP, Parrot_gc_trace_type trace)
{
- if (!Parrot_gc_trace_root(interp, trace_stack))
+ if (!Parrot_gc_trace_root(interp, trace))
return 0;
/* Okay, we've marked the whole root set, and should have a good-sized
@@ -1156,7 +1168,9 @@
Parrot_go_collect(interp);
/* Now go trace the PMCs */
- if (trace_active_PMCs(interp, (int)(flags & GC_trace_stack_FLAG))) {
+ if (trace_active_PMCs(interp, (flags & GC_trace_stack_FLAG)
+ ? GC_TRACE_FULL
+ : GC_TRACE_ROOT_ONLY)) {
int ignored;
arena_base->dod_trace_ptr = NULL;
Modified: branches/pdd09gc_part2/src/gc/incremental_ms.c
==============================================================================
--- branches/pdd09gc_part2/src/gc/incremental_ms.c (original)
+++ branches/pdd09gc_part2/src/gc/incremental_ms.c Fri Jan 2 17:47:44 2009
@@ -665,7 +665,7 @@
* trace root set w/o system areas
* TODO also skip volatile roots
*/
- Parrot_gc_trace_root(interp, 0);
+ Parrot_gc_trace_root(interp, GC_TRACE_ROOT_ONLY);
g_ims = (Gc_ims_private *)arena_base->gc_private;
g_ims->state = GC_IMS_MARKING;
@@ -770,7 +770,8 @@
*/
/* TODO mark volatile roots */
- Parrot_gc_trace_root(interp, g_ims->lazy ? 0 : (int)GC_trace_stack_FLAG);
+ Parrot_gc_trace_root(interp, g_ims->lazy ? GC_TRACE_ROOT_ONLY
+ : GC_TRACE_FULL);
/* mark (again) rest of children */
Parrot_gc_trace_children(interp, (size_t) -1);