From 3804c0ecb28de5138b1bd5dbe80ba4bdec8ac11e Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 12 Feb 2011 17:03:58 +0900 Subject: [PATCH] s/gc_mark/markedp to avoid confusion with the mark command --- gc.c | 14 +++++++------- include/chibi/sexp.h | 4 ++-- sexp.c | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gc.c b/gc.c index abaefcba..b6d552c6 100644 --- a/gc.c +++ b/gc.c @@ -107,9 +107,9 @@ void sexp_mark (sexp ctx, sexp x) { sexp t, *p; struct sexp_gc_var_t *saves; loop: - if (!x || !sexp_pointerp(x) || !sexp_valid_object_p(ctx, x) || sexp_gc_mark(x)) + if (!x || !sexp_pointerp(x) || !sexp_valid_object_p(ctx, x) || sexp_markedp(x)) return; - sexp_gc_mark(x) = 1; + sexp_markedp(x) = 1; if (sexp_contextp(x)) for (saves=sexp_context_saves(x); saves; saves=saves->next) if (saves->var) sexp_mark(ctx, *(saves->var)); @@ -150,7 +150,7 @@ void sexp_conservative_mark (sexp ctx) { p = (sexp) (((char*)p) + r->size); continue; } - if (!sexp_gc_mark(p) && stack_references_pointer_p(ctx, p)) { + if (!sexp_markedp(p) && stack_references_pointer_p(ctx, p)) { #if SEXP_USE_DEBUG_GC > 3 if (p && sexp_pointerp(p)) { fprintf(stderr, SEXP_BANNER("MISS: %p: %s"), p,sexp_pointer_source(p)); @@ -189,14 +189,14 @@ void sexp_reset_weak_references(sexp ctx) { p = (sexp) (((char*)p) + r->size); continue; } - if (sexp_gc_mark(p)) { + if (sexp_markedp(p)) { t = sexp_object_type(ctx, p); if (sexp_type_weak_base(t) > 0) { all_reset_p = 1; v = (sexp*) ((char*)p + sexp_type_weak_base(t)); len = sexp_type_num_weak_slots_of_object(t, p); for (i=0; i %p"), ctx, p, sexp_pointer_tag(p), r); #endif - if (! sexp_gc_mark(p)) { + if (! sexp_markedp(p)) { /* free p */ finalizer = sexp_type_finalize(sexp_object_type(ctx, p)); if (finalizer) finalizer(ctx sexp_api_pass(NULL, 1), p); @@ -279,7 +279,7 @@ sexp sexp_sweep (sexp ctx, size_t *sum_freed_ptr) { if (freed > max_freed) max_freed = freed; } else { - sexp_gc_mark(p) = 0; + sexp_markedp(p) = 0; p = (sexp) (((char*)p)+size); } } diff --git a/include/chibi/sexp.h b/include/chibi/sexp.h index 13a89d6f..cf3b4adc 100644 --- a/include/chibi/sexp.h +++ b/include/chibi/sexp.h @@ -230,7 +230,7 @@ struct sexp_core_form_struct { struct sexp_struct { sexp_tag_t tag; - char gc_mark; + char markedp; unsigned int immutablep:1; unsigned int freep:1; unsigned int brokenp:1; @@ -489,7 +489,7 @@ void *sexp_realloc(sexp ctx, sexp x, size_t size); #define sexp_booleanp(x) (((x) == SEXP_TRUE) || ((x) == SEXP_FALSE)) #define sexp_pointer_tag(x) ((x)->tag) -#define sexp_gc_mark(x) ((x)->gc_mark) +#define sexp_markedp(x) ((x)->markedp) #define sexp_flags(x) ((x)->flags) #define sexp_immutablep(x) ((x)->immutablep) #define sexp_freep(x) ((x)->freep) diff --git a/sexp.c b/sexp.c index 9d643677..9d68bf40 100644 --- a/sexp.c +++ b/sexp.c @@ -355,10 +355,10 @@ void sexp_destroy_context (sexp ctx) { size_t sum_freed; if (sexp_context_heap(ctx)) { heap = sexp_context_heap(ctx); - sexp_gc_mark(ctx) = 1; + sexp_markedp(ctx) = 1; #if ! SEXP_USE_GLOBAL_TYPES - sexp_gc_mark(sexp_context_globals(ctx)) = 1; - sexp_gc_mark(sexp_global(ctx, SEXP_G_TYPES)) = 1; + sexp_markedp(sexp_context_globals(ctx)) = 1; + sexp_markedp(sexp_global(ctx, SEXP_G_TYPES)) = 1; #endif sexp_sweep(ctx, &sum_freed); /* sweep w/o mark to run finalizers */ sexp_context_heap(ctx) = NULL;