1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Removed the mark/free functions of continuations and threads.

* libguile/continuations.c (continuation_mark): Removed.
  (continuation_free): Removed.
  (scm_init_continuations): Don't use them.

* libguile/coop-pthreads.c (scm_threads_mark_stacks): Removed (was
  unused).

* libguile/threads.c (scm_threads_mark_stacks): Likewise.

* libguile/threads.h (scm_threads_mark_stacks): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-21
This commit is contained in:
Ludovic Courtes 2006-05-18 08:08:47 +00:00 committed by Ludovic Courtès
parent 296278188e
commit 6bad09ba9f
4 changed files with 2 additions and 138 deletions

View file

@ -43,41 +43,6 @@
scm_t_bits scm_tc16_continuation;
static SCM
continuation_mark (SCM obj)
{
scm_t_contregs *continuation = SCM_CONTREGS (obj);
scm_gc_mark (continuation->root);
scm_gc_mark (continuation->throw_value);
scm_mark_locations (continuation->stack, continuation->num_stack_items);
#ifdef __ia64__
if (continuation->backing_store)
scm_mark_locations (continuation->backing_store,
continuation->backing_store_size /
sizeof (SCM_STACKITEM));
#endif /* __ia64__ */
return continuation->dynenv;
}
static size_t
continuation_free (SCM obj)
{
scm_t_contregs *continuation = SCM_CONTREGS (obj);
/* stack array size is 1 if num_stack_items is 0. */
size_t extra_items = (continuation->num_stack_items > 0)
? (continuation->num_stack_items - 1)
: 0;
size_t bytes_free = sizeof (scm_t_contregs)
+ extra_items * sizeof (SCM_STACKITEM);
#ifdef __ia64__
scm_gc_free (continuation->backing_store, continuation->backing_store_size,
"continuation backing store");
#endif /* __ia64__ */
scm_gc_free (continuation, bytes_free, "continuation");
return 0;
}
static int
continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED)
@ -430,8 +395,6 @@ void
scm_init_continuations ()
{
scm_tc16_continuation = scm_make_smob_type ("continuation", 0);
scm_set_smob_mark (scm_tc16_continuation, continuation_mark);
scm_set_smob_free (scm_tc16_continuation, continuation_free);
scm_set_smob_print (scm_tc16_continuation, continuation_print);
scm_set_smob_apply (scm_tc16_continuation, continuation_apply, 0, 0, 1);
#include "libguile/continuations.x"

View file

@ -854,83 +854,7 @@ scm_threads_init (SCM_STACKITEM *base)
# define SCM_MARK_BACKING_STORE()
#endif
void
scm_threads_mark_stacks (void)
{
volatile SCM c;
for (c = all_threads; !scm_is_null (c); c = SCM_CDR (c))
{
scm_copt_thread *t = SCM_THREAD_DATA (SCM_CAR (c));
if (t->base == NULL)
{
/* Not fully initialized yet. */
continue;
}
if (t->top == NULL)
{
/* Active thread */
/* stack_len is long rather than sizet in order to guarantee
that &stack_len is long aligned */
#if SCM_STACK_GROWS_UP
long stack_len = ((SCM_STACKITEM *) (&t) -
(SCM_STACKITEM *) thread->base);
/* Protect from the C stack. This must be the first marking
* done because it provides information about what objects
* are "in-use" by the C code. "in-use" objects are those
* for which the information about length and base address must
* remain usable. This requirement is stricter than a liveness
* requirement -- in particular, it constrains the implementation
* of scm_resizuve.
*/
SCM_FLUSH_REGISTER_WINDOWS;
/* This assumes that all registers are saved into the jmp_buf */
setjmp (scm_save_regs_gc_mark);
scm_mark_locations ((SCM_STACKITEM *) scm_save_regs_gc_mark,
((size_t) sizeof scm_save_regs_gc_mark
/ sizeof (SCM_STACKITEM)));
scm_mark_locations (((size_t) t->base,
(sizet) stack_len));
#else
long stack_len = ((SCM_STACKITEM *) t->base -
(SCM_STACKITEM *) (&t));
/* Protect from the C stack. This must be the first marking
* done because it provides information about what objects
* are "in-use" by the C code. "in-use" objects are those
* for which the information about length and base address must
* remain usable. This requirement is stricter than a liveness
* requirement -- in particular, it constrains the implementation
* of scm_resizuve.
*/
SCM_FLUSH_REGISTER_WINDOWS;
/* This assumes that all registers are saved into the jmp_buf */
setjmp (scm_save_regs_gc_mark);
scm_mark_locations ((SCM_STACKITEM *) scm_save_regs_gc_mark,
((size_t) sizeof scm_save_regs_gc_mark
/ sizeof (SCM_STACKITEM)));
scm_mark_locations ((SCM_STACKITEM *) &t,
stack_len);
#endif
}
else
{
/* Suspended thread */
#if SCM_STACK_GROWS_UP
long stack_len = t->top - t->base;
scm_mark_locations (t->base, stack_len);
#else
long stack_len = t->base - t->top;
scm_mark_locations (t->top, stack_len);
#endif
scm_mark_locations ((SCM_STACKITEM *) t->regs,
((size_t) sizeof(t->regs)
/ sizeof (SCM_STACKITEM)));
}
}
}
/*** Select */

View file

@ -1305,30 +1305,7 @@ SCM_DEFINE (scm_broadcast_condition_variable, "broadcast-condition-variable", 1,
# define SCM_MARK_BACKING_STORE()
#endif
void
scm_threads_mark_stacks (void)
{
scm_i_thread *t;
for (t = all_threads; t; t = t->next_thread)
{
/* Check that thread has indeed been suspended.
*/
assert (t->top);
scm_gc_mark (t->handle);
#if SCM_STACK_GROWS_UP
scm_mark_locations (t->base, t->top - t->base);
#else
scm_mark_locations (t->top, t->base - t->top);
#endif
scm_mark_locations ((SCM_STACKITEM *) t->regs,
((size_t) sizeof(t->regs)
/ sizeof (SCM_STACKITEM)));
}
SCM_MARK_BACKING_STORE ();
}
/*** Select */

View file

@ -139,7 +139,7 @@ void scm_i_thread_sleep_for_gc (void);
void scm_threads_prehistory (SCM_STACKITEM *);
void scm_threads_init_first_thread (void);
SCM_API void scm_threads_mark_stacks (void);
SCM_API void scm_init_threads (void);
SCM_API void scm_init_thread_procs (void);
SCM_API void scm_init_threads_default_dynamic_state (void);