mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-03 08:10:31 +02:00
Deprecate C hooks
* libguile/chooks.c: * libguile/chooks.h: Remove. * libguile/deprecated.h: * libguile/deprecated.c: Add deprecated implementations. * libguile/gc.c: * libguile/gc.h: Arrange to call before/after C hooks if deprecated code is enabled. * libguile/Makefile.am: * libguile.h: Remove chooks.[ch] references.
This commit is contained in:
parent
08296e6022
commit
a6b848dcba
8 changed files with 148 additions and 204 deletions
|
@ -33,6 +33,7 @@
|
|||
#include "arrays.h"
|
||||
#include "async.h"
|
||||
#include "atomics-internal.h"
|
||||
#include "deprecated.h"
|
||||
#include "deprecation.h"
|
||||
#include "dynwind.h"
|
||||
#include "eval.h"
|
||||
|
@ -98,13 +99,6 @@ int scm_debug_cells_gc_interval = 0;
|
|||
garbage collection. */
|
||||
static SCM scm_protects;
|
||||
|
||||
/* Hooks. */
|
||||
scm_t_c_hook scm_before_gc_c_hook;
|
||||
scm_t_c_hook scm_before_mark_c_hook;
|
||||
scm_t_c_hook scm_before_sweep_c_hook;
|
||||
scm_t_c_hook scm_after_sweep_c_hook;
|
||||
scm_t_c_hook scm_after_gc_c_hook;
|
||||
|
||||
static SCM after_gc_thunks = SCM_EOL;
|
||||
static SCM after_gc_async_cell;
|
||||
|
||||
|
@ -141,7 +135,9 @@ scm_gc_event_listener_mutators_stopped (void *data)
|
|||
{
|
||||
struct scm_gc_event_listener *scm_listener = data;
|
||||
gc_basic_stats_mutators_stopped (&scm_listener->stats);
|
||||
scm_c_hook_run (&scm_before_gc_c_hook, NULL);
|
||||
#if (SCM_ENABLE_DEPRECATED == 1)
|
||||
scm_i_c_hook_run (&scm_before_gc_c_hook, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -186,9 +182,11 @@ scm_gc_event_listener_restarting_mutators (void *data)
|
|||
struct scm_gc_event_listener *scm_listener = data;
|
||||
gc_basic_stats_restarting_mutators (&scm_listener->stats);
|
||||
|
||||
#if (SCM_ENABLE_DEPRECATED == 1)
|
||||
/* Run any C hooks. The mutator is not yet let go, so we can't
|
||||
allocate here. */
|
||||
scm_c_hook_run (&scm_after_gc_c_hook, NULL);
|
||||
scm_i_c_hook_run (&scm_after_gc_c_hook, NULL);
|
||||
#endif
|
||||
|
||||
/* If there are Scheme hooks and we have a current Guile thread,
|
||||
enqueue those to be run on the current thread. */
|
||||
|
@ -662,12 +660,6 @@ scm_storage_prehistory (struct gc_stack_addr base)
|
|||
// gets called.
|
||||
gc_heap_set_roots (the_gc_heap, &heap_roots);
|
||||
|
||||
scm_c_hook_init (&scm_before_gc_c_hook, 0, SCM_C_HOOK_NORMAL);
|
||||
scm_c_hook_init (&scm_before_mark_c_hook, 0, SCM_C_HOOK_NORMAL);
|
||||
scm_c_hook_init (&scm_before_sweep_c_hook, 0, SCM_C_HOOK_NORMAL);
|
||||
scm_c_hook_init (&scm_after_sweep_c_hook, 0, SCM_C_HOOK_NORMAL);
|
||||
scm_c_hook_init (&scm_after_gc_c_hook, 0, SCM_C_HOOK_NORMAL);
|
||||
|
||||
return mut;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue