[uim-commit] r2199 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Mon Nov 21 01:34:42 PST 2005
Author: yamaken
Date: 2005-11-21 01:34:37 -0800 (Mon, 21 Nov 2005)
New Revision: 2199
Modified:
branches/r5rs/sigscheme/sigschemeinternal.h
branches/r5rs/sigscheme/storage-continuation.c
branches/r5rs/sigscheme/storage-gc.c
Log:
* This commit fixes a GC bug on continuation object
* sigscheme/sigschemeinternal.h
- (Scm_MarkObj, Scm_MarkContinuation): New function decl
* sigscheme/storage-continuation.c
- (Scm_MarkContinuation): New function
* sigscheme/storage-gc.c
- (mark_obj): Rename to Scm_MarkObj()
- (Scm_MarkObj):
* Renamed from mark_obj() and made global
* Replace recursive mark_obj() invocations too
* Add Scm_MarkContinuation() invocation for continuation object
- (gc_mark_protected_var, gc_mark_locations_n, gc_mark_symbol_hash):
Follow the renaming
Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-21 09:09:25 UTC (rev 2198)
+++ branches/r5rs/sigscheme/sigschemeinternal.h 2005-11-21 09:34:37 UTC (rev 2199)
@@ -337,10 +337,12 @@
void SigScm_InitGC(void);
void SigScm_FinalizeGC(void);
ScmObj SigScm_NewObjFromHeap(void);
+void Scm_MarkObj(ScmObj obj);
/* storage-continuation.c */
void SigScm_InitContinuation(void);
void SigScm_FinalizeContinuation(void);
+void Scm_MarkContinuation(ScmObj cont);
void Scm_DestructContinuation(ScmObj cont);
ScmObj Scm_CallWithCurrentContinuation(ScmObj proc, ScmEvalState *eval_state);
void Scm_CallContinuation(ScmObj cont, ScmObj ret);
Modified: branches/r5rs/sigscheme/storage-continuation.c
===================================================================
--- branches/r5rs/sigscheme/storage-continuation.c 2005-11-21 09:09:25 UTC (rev 2198)
+++ branches/r5rs/sigscheme/storage-continuation.c 2005-11-21 09:34:37 UTC (rev 2199)
@@ -250,6 +250,11 @@
return dest_cont;
}
+void Scm_MarkContinuation(ScmObj cont)
+{
+ Scm_MarkObj(CONTINUATION_DYNEXT(cont));
+}
+
void Scm_DestructContinuation(ScmObj cont)
{
/* no object to free(3) in this implementation */
Modified: branches/r5rs/sigscheme/storage-gc.c
===================================================================
--- branches/r5rs/sigscheme/storage-gc.c 2005-11-21 09:09:25 UTC (rev 2198)
+++ branches/r5rs/sigscheme/storage-gc.c 2005-11-21 09:34:37 UTC (rev 2199)
@@ -155,7 +155,6 @@
static void gc_mark_and_sweep(void);
/* GC Mark Related Functions */
-static void mark_obj(ScmObj obj);
static int is_pointer_to_heap(ScmObj obj);
static void gc_mark_protected_var();
@@ -391,7 +390,7 @@
}
}
-static void mark_obj(ScmObj obj)
+void Scm_MarkObj(ScmObj obj)
{
int i = 0;
@@ -410,24 +409,24 @@
/* mark recursively */
switch (SCM_TYPE(obj)) {
case ScmCons:
- mark_obj(CAR(obj));
+ Scm_MarkObj(CAR(obj));
obj = CDR(obj);
goto mark_loop;
break;
case ScmSymbol:
- mark_obj(SCM_SYMBOL_VCELL(obj));
+ Scm_MarkObj(SCM_SYMBOL_VCELL(obj));
break;
case ScmClosure:
- mark_obj(SCM_CLOSURE_EXP(obj));
+ Scm_MarkObj(SCM_CLOSURE_EXP(obj));
obj = SCM_CLOSURE_ENV(obj);
goto mark_loop;
break;
case ScmValuePacket:
#if SCM_USE_VALUECONS
- mark_obj(SCM_VALUECONS_CAR(obj));
+ Scm_MarkObj(SCM_VALUECONS_CAR(obj));
obj = SCM_VALUECONS_CDR(obj);
#else
obj = SCM_VALUEPACKET_VALUES(obj);
@@ -436,10 +435,21 @@
case ScmVector:
for (i = 0; i < SCM_VECTOR_LEN(obj); i++) {
- mark_obj(SCM_VECTOR_VEC(obj)[i]);
+ Scm_MarkObj(SCM_VECTOR_VEC(obj)[i]);
}
break;
+ case ScmContinuation:
+ /*
+ * Since continuation object is not so many, marking the object by
+ * function call will not cost high. This function interface makes
+ * continuation module substitution easy without preparing
+ * module-specific header file which contains the module-specific
+ * mark macro.
+ */
+ Scm_MarkContinuation(obj);
+ break;
+
default:
break;
}
@@ -478,7 +488,7 @@
{
gc_protected_var *item = NULL;
for (item = protected_var_list; item; item = item->next_var) {
- mark_obj(*item->var);
+ Scm_MarkObj(*item->var);
}
}
@@ -492,7 +502,7 @@
obj = start[i];
if (is_pointer_to_heap(obj)) {
- mark_obj(obj);
+ Scm_MarkObj(obj);
}
}
@@ -522,7 +532,7 @@
{
int i = 0;
for (i = 0; i < NAMEHASH_SIZE; i++) {
- mark_obj(scm_symbol_hash[i]);
+ Scm_MarkObj(scm_symbol_hash[i]);
}
}
More information about the uim-commit
mailing list