From 820920e6a3e740fe9c3f4987d0071dfbbe0255ce Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Fri, 21 Apr 2000 23:15:27 +0000 Subject: [PATCH] *** empty log message *** --- NEWS | 68 ++++++++++++++++++++++++++++++++++++++++++++++ RELEASE | 2 +- libguile/ChangeLog | 52 ++++++++++++++++++++++++++++++++++- 3 files changed, 120 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2c0334179..8b7c351a4 100644 --- a/NEWS +++ b/NEWS @@ -147,6 +147,24 @@ an exception with a key of 'unbound-variable instead of 'misc-error. ** The initial default output port is now unbuffered if it's using a tty device. Previously in this situation it was line-buffered. +** gc-thunk is deprecated + +gc-thunk will be removed in next release of Guile. It has been +replaced by after-gc-hook. + +** New hook: after-gc-hook + +after-gc-hook takes over the role of gc-thunk. This hook is run at +the first SCM_TICK after a GC. (Thus, the code is run at the same +point during evaluation as signal handlers.) + +Note that this hook should be used only for diagnostic and debugging +purposes. It is not certain that it will continue to be well-defined +when this hook is run in the future. + +C programmers: Note the new C level hooks scm_before_gc_c_hook, +scm_before_sweep_c_hook, scm_after_gc_c_hook. + * Changes to Scheme functions and syntax ** close-input-port and close-output-port are now R5RS @@ -345,6 +363,56 @@ Use scm_mutex_init and scm_cond_init instead. currently executing threads, nor call the destructor function associated with the key. +** New function: scm_c_hook_init (scm_c_hook_t *HOOK, void *HOOK_DATA, scm_c_hook_type_t TYPE) + +Initialize a C level hook HOOK with associated HOOK_DATA and type +TYPE. (See scm_c_hook_run ().) + +** New function: scm_c_hook_add (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA, int APPENDP) + +Add hook function FUNC with associated FUNC_DATA to HOOK. If APPENDP +is true, add it last, otherwise first. The same FUNC can be added +multiple times if FUNC_DATA differ and vice versa. + +** New function: scm_c_hook_remove (scm_c_hook_t *HOOK, scm_c_hook_function_t FUNC, void *FUNC_DATA) + +Remove hook function FUNC with associated FUNC_DATA from HOOK. A +function is only removed if both FUNC and FUNC_DATA matches. + +** New function: void *scm_c_hook_run (scm_c_hook_t *HOOK, void *DATA) + +Run hook HOOK passing DATA to the hook functions. + +If TYPE is SCM_C_HOOK_NORMAL, all hook functions are run. The value +returned is undefined. + +If TYPE is SCM_C_HOOK_OR, hook functions are run until a function +returns a non-NULL value. This value is returned as the result of +scm_c_hook_run. If all functions return NULL, NULL is returned. + +If TYPE is SCM_C_HOOK_AND, hook functions are run until a function +returns a NULL value, and NULL is returned. If all functions returns +a non-NULL value, the last value is returned. + +** New C level GC hooks + +Five new C level hooks has been added to the garbage collector. + + scm_before_gc_c_hook + scm_after_gc_c_hook + +are run before locking and after unlocking the heap. The system is +thus in a mode where evaluation can take place. (Except that +scm_before_gc_c_hook must not allocate new cells.) + + scm_before_mark_c_hook + scm_before_sweep_c_hook + scm_after_sweep_c_hook + +are run when the heap is locked. These are intended for extension of +the GC in a modular fashion. Examples are the weaks and guardians +modules. + * Changes to system call interfaces: ** The "select" procedure now tests port buffers for the ability to diff --git a/RELEASE b/RELEASE index 25c2dbad2..f19a2c6b6 100644 --- a/RELEASE +++ b/RELEASE @@ -14,10 +14,10 @@ In release 1.4: - remove kw.h, scm_tc16_kw - remove genio.h - remove deprecated function scm_newsmob. -- remove deprecated function scm_make_named_hook. In release 1.5: - remove deprecated macros: SCM_INPORTP, SCM_OUTPORTP +- remove gc-thunk (It has been replaced by after-gc-hook.) Modules sort.c and random.c should be factored out into separate modules (but still be distributed with guile-core) when we get a new diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 2aecf5f8e..958e345c5 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,4 +1,54 @@ -2000-04-21 Mikael Djurfeldt +2000-04-22 Mikael Djurfeldt + + Better modularization of GC extensions through new C level GC + hooks: + + * weaks.c (scm_weaks_prehistory): New function: Add + scm_weak_vector_gc_init to scm_before_mark_c_hook; Add + scm_mark_weak_vector_spines to scm_before_sweep_c_hook. + (scm_scan_weak_vectors): New function; added to + scm_after_sweep_c_hook. + + * weaks.h (scm_weak_vectors, scm_weaks_prehistory): Added + declarations. + + * guardians.h (scm_guardian_gc_init, scm_guardian_zombify): Are + now static. + + * guardians.c (scm_guardian_gc_init): Turned into a hook function + and added to scm_before_mark_c_hook. + (scm_guardian_zombify): Turned into a hook function and added to + scm_before_sweep_c_hook. + + * async.c (scm_sys_gc_async_thunk): Run after-gc-hook. + Added #include "libguile/gc.h". + + * gc.h: Added #include "libguile/hooks.h". + + * gc.c: Removed #include "libguile/guardians.h". + (scm_before_gc_c_hook, scm_before_mark_c_hook, + scm_before_sweep_c_hook, scm_after_sweep_c_hook, + scm_after_gc_c_hook): New C level hooks. + (scm_after_gc_hook): New Scheme level hook. + (scm_gc_sweep): Moved scanning of weak vectors to weaks.c. + (scm_igc): Moved initialization of scm_weak_vectors and the call + to scm_guardian_gc_init to respective module. + (scm_mark_weak_vector_spines): Moved to weaks.c; + Call to scm_guardian_zombify moved to guardians.c; + Run scm_before_gc_c_hook, scm_before_sweep_c_hook, + scm_after_gc_c_hook at appropriate places. + (scm_init_gc): Initialize scm_after_gc_hook. + + * hooks.c, hooks.h (scm_make_hook_with_name): Removed deprecated + function. + + * init.c (scm_boot_guile_1): Added `scm_init_hooks'. + + * Makefile.am: Added hooks.c, hooks.h, hooks.x. + + * feature.c, feature.h: Broke out hook code into separate files. + + * hooks.c, hooks.h: New files. * *.*: Change includes so that they always use the "prefixes" libguile/, qt/, guile-readline/, or libltdl/.