mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Simplify smob and port marking; set the mark bit in the generic
marking code, and make marker routines only responsible for turning up outgoing pointers. * gc.c (scm_gc_mark): Set the mark bit on ports and smobs here, before calling the marking function. Don't call the marking function if it's zero. * markers.c (scm_mark0): Just return #f. This function isn't necessary at all now, but it's harmless to call it. We'll leave it in so other folks' code doesn't croak at link time. (scm_markcdr): Don't call SCM_SETGC8MARK. * async.c (mark_async): Don't call SCM_SETGC8MARK. * dynl.c (mark_dynl_obj): Same. * root.c (mark_root): Same. * srcprop.c (marksrcprops): Same. * unif.c (markra): Same. * variable.c (scm_markvar): Same. * ports.c (scm_markstream): Same. (void_port_ptob): Specify zero for our marking function. * debug.c (debugobjsmob): Same. * dynwind.c (guardsmob): Same. * filesys.c (dir_smob): Same. * fluids.c (fluid_smob): Same. * fports.c (scm_fptob, scm_pipob): Same. * mallocs.c (mallocsmob): Same. * regex-posix.c (regex_t_smob): Same. * smob.c (freecell, flob, bigob): Same. * threads.c (thread_smob, mutex_smob, condvar_smob): Same. * throw.c (jbsmob, lazy_catch_funs): Same.
This commit is contained in:
parent
6f4d962200
commit
dc53f02690
19 changed files with 45 additions and 43 deletions
|
@ -285,9 +285,6 @@ mark_async (obj)
|
|||
SCM obj;
|
||||
{
|
||||
struct scm_async * it;
|
||||
if (SCM_GC8MARKP (obj))
|
||||
return SCM_BOOL_F;
|
||||
SCM_SETGC8MARK (obj);
|
||||
it = SCM_ASYNC (obj);
|
||||
return it->thunk;
|
||||
}
|
||||
|
|
|
@ -562,7 +562,7 @@ prindebugobj (obj, port, pstate)
|
|||
}
|
||||
|
||||
static scm_smobfuns debugobjsmob =
|
||||
{scm_mark0, scm_free0, prindebugobj, 0};
|
||||
{0, scm_free0, prindebugobj, 0};
|
||||
|
||||
SCM_PROC (s_debug_object_p, "debug-object?", 1, 0, 0, scm_debug_object_p);
|
||||
|
||||
|
|
|
@ -302,7 +302,6 @@ mark_dynl_obj (ptr)
|
|||
SCM ptr;
|
||||
{
|
||||
struct dynl_obj *d = (struct dynl_obj *)SCM_CDR (ptr);
|
||||
SCM_SETGC8MARK (ptr);
|
||||
return d->filename;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ printguards (SCM exp, SCM port, scm_print_state *pstate)
|
|||
}
|
||||
|
||||
static scm_smobfuns guardsmob = {
|
||||
scm_mark0,
|
||||
0,
|
||||
freeguards,
|
||||
printguards,
|
||||
0
|
||||
|
|
|
@ -832,7 +832,7 @@ scm_dir_free (p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static scm_smobfuns dir_smob = {scm_mark0, scm_dir_free, scm_dir_print, 0};
|
||||
static scm_smobfuns dir_smob = {0, scm_dir_free, scm_dir_print, 0};
|
||||
|
||||
|
||||
/* {Navigating Directories}
|
||||
|
|
|
@ -107,7 +107,7 @@ print_fluid (exp, port, pstate)
|
|||
}
|
||||
|
||||
static scm_smobfuns fluid_smob = {
|
||||
scm_mark0,
|
||||
0,
|
||||
scm_free0,
|
||||
print_fluid
|
||||
};
|
||||
|
|
|
@ -458,7 +458,7 @@ local_pclose (fp)
|
|||
|
||||
scm_ptobfuns scm_fptob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
(int (*) SCM_P ((SCM))) local_fclose,
|
||||
prinfport,
|
||||
0,
|
||||
|
@ -474,7 +474,7 @@ scm_ptobfuns scm_fptob =
|
|||
/* {Pipe ports} */
|
||||
scm_ptobfuns scm_pipob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
(int (*) SCM_P ((SCM))) local_pclose,
|
||||
print_pipe_port,
|
||||
0,
|
||||
|
|
|
@ -819,32 +819,42 @@ gc_mark_nimp:
|
|||
goto def;
|
||||
if (SCM_GC8MARKP (ptr))
|
||||
break;
|
||||
SCM_SETGC8MARK (ptr);
|
||||
if (SCM_PTAB_ENTRY(ptr))
|
||||
scm_gc_mark (SCM_PTAB_ENTRY(ptr)->file_name);
|
||||
if (scm_ptobs[i].mark)
|
||||
{
|
||||
ptr = (scm_ptobs[i].mark) (ptr);
|
||||
goto gc_mark_loop;
|
||||
}
|
||||
else
|
||||
return;
|
||||
break;
|
||||
case scm_tc7_smob:
|
||||
if (SCM_GC8MARKP (ptr))
|
||||
break;
|
||||
switch SCM_TYP16 (ptr)
|
||||
SCM_SETGC8MARK (ptr);
|
||||
switch SCM_GCTYP16 (ptr)
|
||||
{ /* should be faster than going through scm_smobs */
|
||||
case scm_tc_free_cell:
|
||||
/* printf("found free_cell %X ", ptr); fflush(stdout); */
|
||||
SCM_SETGC8MARK (ptr);
|
||||
SCM_SETCDR (ptr, SCM_EOL);
|
||||
break;
|
||||
case scm_tcs_bignums:
|
||||
case scm_tc16_flo:
|
||||
SCM_SETGC8MARK (ptr);
|
||||
break;
|
||||
default:
|
||||
i = SCM_SMOBNUM (ptr);
|
||||
if (!(i < scm_numsmob))
|
||||
goto def;
|
||||
if (scm_smobs[i].mark)
|
||||
{
|
||||
ptr = (scm_smobs[i].mark) (ptr);
|
||||
goto gc_mark_loop;
|
||||
}
|
||||
else
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
def:scm_wta (ptr, "unknown type in ", "gc_mark");
|
||||
|
|
|
@ -66,7 +66,7 @@ prinmalloc (exp, port, pstate)
|
|||
|
||||
|
||||
int scm_tc16_malloc;
|
||||
static scm_smobfuns mallocsmob = {scm_mark0, fmalloc, prinmalloc, 0};
|
||||
static scm_smobfuns mallocsmob = {0, fmalloc, prinmalloc, 0};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -50,11 +50,20 @@
|
|||
*/
|
||||
|
||||
|
||||
/* This function is vestigial. It used to be the mark function's
|
||||
responsibility to set the mark bit on the smob or port, but now the
|
||||
generic marking routine in gc.c takes care of that, and a zero
|
||||
pointer for a mark function means "don't bother". So you never
|
||||
need scm_mark0.
|
||||
|
||||
However, we leave it here because it's harmless to call it, and
|
||||
people out there have smob code that uses it, and there's no reason
|
||||
to make their links fail. */
|
||||
|
||||
SCM
|
||||
scm_mark0 (ptr)
|
||||
SCM ptr;
|
||||
{
|
||||
SCM_SETGC8MARK (ptr);
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
|
@ -64,9 +73,6 @@ SCM
|
|||
scm_markcdr (ptr)
|
||||
SCM ptr;
|
||||
{
|
||||
if (SCM_GC8MARKP (ptr))
|
||||
return SCM_BOOL_F;
|
||||
SCM_SETGC8MARK (ptr);
|
||||
return SCM_CDR (ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,10 +81,7 @@ scm_markstream (ptr)
|
|||
SCM ptr;
|
||||
{
|
||||
int openp;
|
||||
if (SCM_GC8MARKP (ptr))
|
||||
return SCM_BOOL_F;
|
||||
openp = SCM_CAR (ptr) & SCM_OPN;
|
||||
SCM_SETGC8MARK (ptr);
|
||||
if (openp)
|
||||
return SCM_STREAM (ptr);
|
||||
else
|
||||
|
@ -895,7 +892,7 @@ noop0 (SCM stream)
|
|||
|
||||
static struct scm_ptobfuns void_port_ptob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
noop0,
|
||||
print_void_port,
|
||||
0, /* equal? */
|
||||
|
|
|
@ -112,7 +112,7 @@ scm_print_regex_t (obj, port, pstate)
|
|||
|
||||
|
||||
static scm_smobfuns regex_t_smob =
|
||||
{ scm_mark0, scm_free_regex_t, scm_print_regex_t, 0 };
|
||||
{ 0, scm_free_regex_t, scm_print_regex_t, 0 };
|
||||
|
||||
|
||||
SCM_SYMBOL (scm_regexp_error_key, "regular-expression-syntax");
|
||||
|
|
|
@ -77,7 +77,7 @@ mark_root (root)
|
|||
SCM root;
|
||||
{
|
||||
scm_root_state *s = SCM_ROOT_STATE (root);
|
||||
SCM_SETGC8MARK (root);
|
||||
|
||||
scm_gc_mark (s->rootcont);
|
||||
scm_gc_mark (s->dynwinds);
|
||||
scm_gc_mark (s->continuation_stack);
|
||||
|
|
|
@ -89,7 +89,7 @@ scm_newsmob (smob)
|
|||
|
||||
static scm_smobfuns freecell =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
scm_free0,
|
||||
0,
|
||||
0
|
||||
|
@ -97,7 +97,7 @@ static scm_smobfuns freecell =
|
|||
|
||||
static scm_smobfuns flob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
/*flofree*/ 0,
|
||||
scm_floprint,
|
||||
scm_floequal
|
||||
|
@ -105,7 +105,7 @@ static scm_smobfuns flob =
|
|||
|
||||
static scm_smobfuns bigob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
/*bigfree*/ 0,
|
||||
scm_bigprint,
|
||||
scm_bigequal
|
||||
|
|
|
@ -86,7 +86,6 @@ static SCM
|
|||
marksrcprops (obj)
|
||||
SCM obj;
|
||||
{
|
||||
SCM_SETGC8MARK (obj);
|
||||
scm_gc_mark (SRCPROPFNAME (obj));
|
||||
scm_gc_mark (SRCPROPCOPY (obj));
|
||||
return SRCPROPPLIST (obj);
|
||||
|
|
|
@ -95,7 +95,7 @@ print_thread (exp, port, pstate)
|
|||
|
||||
static scm_smobfuns thread_smob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
scm_threads_free_thread,
|
||||
print_thread,
|
||||
0
|
||||
|
@ -115,7 +115,7 @@ print_mutex (exp, port, pstate)
|
|||
|
||||
static scm_smobfuns mutex_smob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
scm_threads_free_mutex,
|
||||
print_mutex,
|
||||
0
|
||||
|
@ -135,7 +135,7 @@ print_condvar (exp, port, pstate)
|
|||
|
||||
static scm_smobfuns condvar_smob =
|
||||
{
|
||||
scm_mark0,
|
||||
0,
|
||||
scm_threads_free_condvar,
|
||||
print_condvar,
|
||||
0
|
||||
|
|
|
@ -103,7 +103,7 @@ printjb (exp, port, pstate)
|
|||
}
|
||||
|
||||
static scm_smobfuns jbsmob = {
|
||||
scm_mark0,
|
||||
0,
|
||||
#ifdef DEBUG_EXTENSIONS
|
||||
freejb,
|
||||
#else
|
||||
|
@ -280,7 +280,7 @@ print_lazy_catch (SCM closure, SCM port, scm_print_state *pstate)
|
|||
}
|
||||
|
||||
static scm_smobfuns lazy_catch_funs = {
|
||||
scm_mark0, scm_free0, print_lazy_catch, 0
|
||||
0, scm_free0, print_lazy_catch, 0
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -2532,9 +2532,6 @@ static SCM
|
|||
markra (ptr)
|
||||
SCM ptr;
|
||||
{
|
||||
if SCM_GC8MARKP
|
||||
(ptr) return SCM_BOOL_F;
|
||||
SCM_SETGC8MARK (ptr);
|
||||
return SCM_ARRAY_V (ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -92,9 +92,6 @@ static SCM
|
|||
scm_markvar (ptr)
|
||||
SCM ptr;
|
||||
{
|
||||
if (SCM_GC8MARKP (ptr))
|
||||
return SCM_BOOL_F;
|
||||
SCM_SETGC8MARK (ptr);
|
||||
return SCM_CDR (ptr);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue