diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2020-07-19 10:15:42 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2020-07-19 10:15:42 +0300 |
commit | 802e47d5e8dcbddd2e80cd4587eacc5f4ffbc745 (patch) | |
tree | 3aa4dc1de6f55f0f76812040a7059aed139ecd2e /finalize.c | |
parent | 43e1d537de493e0fd5b8e1e52acbea7e872ed87a (diff) | |
download | bdwgc-802e47d5e8dcbddd2e80cd4587eacc5f4ffbc745.tar.gz |
Move GC state pointer variables into GC_arrays
This commit is intended to simplify GC reinitialization.
GC_push_finalizer_structures() and GC_push_typed_structures() are
called now regardless of GC_no_dls and GC_roots_were_cleared values.
* finalize.c (dl_hashtbl_s, fnlz_roots_s): Move struct to gc_priv.h.
* typd_mlc.c (typed_ext_descr_t): Likewise.
* finalize.c [!GC_NO_FINALIZATION] (GC_dl_hashtbl, GC_fnlz_roots):
Remove static variable.
* finalize.c [!GC_NO_FINALIZATION && !GC_LONG_REFS_NOT_NEEDED]
(GC_ll_hashtbl): Likewise.
* finalize.c [!GC_NO_FINALIZATION && !GC_TOGGLE_REFS_NOT_NEEDED]
(GC_toggleref_arr): Likewise.
* gcj_mlc.c [GC_GCJ_SUPPORT] (GC_gcjobjfreelist): Likewise.
* headers.c (GC_all_bottom_indices, GC_all_bottom_indices_end,
GC_scratch_free_ptr, GC_hdr_free_list): Likewise.
* mark.c (GC_scan_ptr): Likewise.
* mark.c [PARALLEL_MARK] (GC_main_local_mark_stack): Likewise.
* typd_mlc.c (GC_ext_descriptors): Likewise.
* finalize.c [!GC_NO_FINALIZATION && !GC_TOGGLE_REFS_NOT_NEEDED]
(GCToggleRef): Define type as an alias to union toggle_ref_u.
* finalize.c [!GC_NO_FINALIZATION && !GC_TOGGLE_REFS_NOT_NEEDED]
(GC_mark_togglerefs): Remove TODO item.
* include/private/gc_priv.h (disappearing_link, finalizable_object):
Declare struct.
* include/private/gc_priv.h (GC_arrays): Add _all_bottom_indices,
_all_bottom_indices_end, _scratch_free_ptr, _hdr_free_list, _scan_ptr,
_ext_descriptors fields.
* include/private/gc_priv.h [PARALLEL_MARK] (GC_arrays): Add
_main_local_mark_stack field.
* include/private/gc_priv.h [GC_GCJ_SUPPORT] (GC_arrays): Add
_gcjobjfreelist field.
* include/private/gc_priv.h [!GC_NO_FINALIZATION
&& GC_LONG_REFS_NOT_NEEDED] (GC_arrays): Add _ll_hashtbl field.
* include/private/gc_priv.h [!GC_NO_FINALIZATION] (GC_arrays): Add
_dl_hashtbl, _fnlz_roots fields.
* include/private/gc_priv.h [!GC_NO_FINALIZATION
&& !GC_TOGGLE_REFS_NOT_NEEDED] (GC_arrays): Add _toggleref_arr field.
* include/private/gc_priv.h (GC_arrays._roots_were_cleared): Define
field only if THREADS.
* mark_rts.c (GC_clear_roots): Set GC_roots_were_cleared only if
THREADS.
* mark_rts.c (GC_push_gc_structures): Remove static function.
* mark_rts.c (GC_push_roots): Do not call GC_push_gc_structures.
* mark_rts.c [!GC_NO_FINALIZATION] (GC_push_roots): Call
GC_push_finalizer_structures (regardless of GC_no_dls and
GC_roots_were_cleared).
* mark_rts.c [THREADS] (GC_push_roots): If GC_no_dls or
GC_roots_were_cleared then call GC_push_thread_structures.
* mark_rts.c (GC_push_roots): If GC_push_typed_structures is non-null
then call GC_push_typed_structures (regardless of GC_no_dls and
GC_roots_were_cleared).
Diffstat (limited to 'finalize.c')
-rw-r--r-- | finalize.c | 26 |
1 files changed, 1 insertions, 25 deletions
@@ -44,18 +44,6 @@ struct disappearing_link { word dl_hidden_obj; /* Pointer to object base */ }; -struct dl_hashtbl_s { - struct disappearing_link **head; - word entries; - unsigned log_size; -}; - -STATIC struct dl_hashtbl_s GC_dl_hashtbl = { - /* head */ NULL, /* entries */ 0, /* log_size */ 0 }; -#ifndef GC_LONG_REFS_NOT_NEEDED - STATIC struct dl_hashtbl_s GC_ll_hashtbl = { NULL, 0, 0 }; -#endif - struct finalizable_object { struct hash_chain_entry prolog; # define fo_hidden_base prolog.hidden_key @@ -70,12 +58,6 @@ struct finalizable_object { finalization_mark_proc fo_mark_proc; /* Mark-through procedure */ }; -STATIC struct fnlz_roots_s { - struct finalizable_object **fo_head; - /* List of objects that should be finalized now: */ - struct finalizable_object *finalize_now; -} GC_fnlz_roots = { NULL, NULL }; - #ifdef AO_HAVE_store /* Update finalize_now atomically as GC_should_invoke_finalizers does */ /* not acquire the allocation lock. */ @@ -306,14 +288,9 @@ GC_API int GC_CALL GC_unregister_disappearing_link(void * * link) /* Toggle-ref support. */ #ifndef GC_TOGGLE_REFS_NOT_NEEDED - typedef union { - /* Lowest bit is used to distinguish between choices. */ - void *strong_ref; - GC_hidden_pointer weak_ref; - } GCToggleRef; + typedef union toggle_ref_u GCToggleRef; STATIC GC_toggleref_func GC_toggleref_callback = 0; - STATIC GCToggleRef *GC_toggleref_arr = NULL; GC_INNER void GC_process_togglerefs(void) { @@ -378,7 +355,6 @@ GC_API int GC_CALL GC_unregister_disappearing_link(void * * link) if (NULL == GC_toggleref_arr) return; - /* TODO: Hide GC_toggleref_arr to avoid its marking from roots. */ GC_set_mark_bit(GC_toggleref_arr); for (i = 0; i < GC_toggleref_array_size; ++i) { void *obj = GC_toggleref_arr[i].strong_ref; |