1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-18 17:50:29 +02:00

Merge remote-tracking branch 'local-2.0/stable-2.0'

Conflicts:
	configure.ac
	libguile/finalizers.c
	libguile/finalizers.h
	libguile/gc.c
	libguile/gc.h
	libguile/inline.c
	libguile/inline.h
	libguile/ports.c
	libguile/smob.c
	libguile/smob.h
	module/ice-9/deprecated.scm
	module/ice-9/r4rs.scm
This commit is contained in:
Andy Wingo 2012-03-08 13:22:09 +01:00
commit bc61280992
11 changed files with 89 additions and 224 deletions

View file

@ -41,6 +41,17 @@
static size_t finalization_count;
#ifndef HAVE_GC_SET_FINALIZER_NOTIFIER
static void
GC_set_finalizer_notifier (void (*notifier) (void))
{
GC_finalizer_notifier = notifier;
}
#endif
void
@ -142,10 +153,9 @@ run_finalizers_async_thunk (void)
}
/* The function queue_after_gc_hook is run by the scm_before_gc_c_hook
* at the end of the garbage collection. The only purpose of this
* function is to mark the after_gc_async (which will eventually lead to
* the execution of the after_gc_async_thunk).
/* The function queue_finalizer_async is run by the GC when there are
* objects to finalize. It will enqueue an asynchronous call to
* GC_invoke_finalizers() at the next SCM_TICK in this thread.
*/
static void
queue_finalizer_async (void)
@ -154,7 +164,10 @@ queue_finalizer_async (void)
static scm_i_pthread_mutex_t lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
scm_i_pthread_mutex_lock (&lock);
if (scm_is_false (SCM_CDR (finalizer_async_cell)))
/* If t is NULL, that could be because we're allocating in
threads.c:guilify_self_1. In that case, rely on the
GC_invoke_finalizers call there after the thread spins up. */
if (t && scm_is_false (SCM_CDR (finalizer_async_cell)))
{
SCM_SETCDR (finalizer_async_cell, t->active_asyncs);
t->active_asyncs = finalizer_async_cell;

View file

@ -384,6 +384,8 @@ SCM_DEFINE (scm_gc, "gc", 0, 0, 0,
#define FUNC_NAME s_scm_gc
{
scm_i_gc ("call");
/* If you're calling scm_gc(), you probably want synchronous
finalization. */
GC_invoke_finalizers ();
return SCM_UNSPECIFIED;
}

View file

@ -444,7 +444,8 @@ scm_i_init_guile (void *base)
scm_init_ioext ();
scm_init_keywords (); /* Requires smob_prehistory */
scm_init_list ();
scm_init_macros (); /* Requires smob_prehistory */
scm_init_random (); /* Requires smob_prehistory */
scm_init_macros (); /* Requires smob_prehistory and random */
scm_init_mallocs (); /* Requires smob_prehistory */
scm_init_modules (); /* Requires smob_prehistory */
scm_init_numbers ();
@ -502,7 +503,6 @@ scm_i_init_guile (void *base)
scm_init_eval_in_scheme ();
scm_init_evalext ();
scm_init_debug (); /* Requires macro smobs */
scm_init_random (); /* Requires smob_prehistory */
scm_init_simpos ();
#if HAVE_MODULES
scm_init_dynamic_linking (); /* Requires smob_prehistory */

View file

@ -748,7 +748,7 @@ scm_i_make_symbol (SCM name, scm_t_bits flags,
name = SH_STRING_STRING (name);
start += STRING_START (name);
}
buf = SYMBOL_STRINGBUF (name);
buf = STRING_STRINGBUF (name);
if (start == 0 && length == STRINGBUF_LENGTH (buf))
{

View file

@ -625,6 +625,9 @@ guilify_self_2 (SCM parent)
t->join_queue = make_queue ();
t->block_asyncs = 0;
/* See note in finalizers.c:queue_finalizer_async(). */
GC_invoke_finalizers ();
}

View file

@ -56,21 +56,11 @@ sf_flush (SCM port)
scm_t_port *pt = SCM_PTAB_ENTRY (port);
SCM stream = SCM_PACK (pt->stream);
if (pt->write_pos > pt->write_buf)
{
/* write the byte. */
scm_call_1 (SCM_SIMPLE_VECTOR_REF (stream, 0),
SCM_MAKE_CHAR (*pt->write_buf));
pt->write_pos = pt->write_buf;
/* flush the output. */
{
SCM f = SCM_SIMPLE_VECTOR_REF (stream, 2);
SCM f = SCM_SIMPLE_VECTOR_REF (stream, 2);
if (scm_is_true (f))
scm_call_0 (f);
if (scm_is_true (f))
scm_call_0 (f);
}
}
}
static void