summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--finalize.c26
-rw-r--r--gcj_mlc.c2
-rw-r--r--headers.c15
-rw-r--r--include/private/gc_priv.h72
-rw-r--r--mark.c4
-rw-r--r--mark_rts.c37
-rw-r--r--typd_mlc.c12
7 files changed, 79 insertions, 89 deletions
diff --git a/finalize.c b/finalize.c
index ee6c793d..4b8a9e6d 100644
--- a/finalize.c
+++ b/finalize.c
@@ -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;
diff --git a/gcj_mlc.c b/gcj_mlc.c
index abc623d6..f83e8974 100644
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -45,8 +45,6 @@ int GC_gcj_debug_kind = 0;
/* The kind of objects that is always marked */
/* with a mark proc call. */
-GC_INNER ptr_t * GC_gcjobjfreelist = NULL;
-
STATIC struct GC_ms_entry * GC_gcj_fake_mark_proc(word * addr GC_ATTR_UNUSED,
struct GC_ms_entry *mark_stack_ptr,
struct GC_ms_entry * mark_stack_limit GC_ATTR_UNUSED,
diff --git a/headers.c b/headers.c
index 6a353686..199ce85c 100644
--- a/headers.c
+++ b/headers.c
@@ -24,14 +24,6 @@
* level tree.
*/
-STATIC bottom_index * GC_all_bottom_indices = 0;
- /* Pointer to the first (lowest address) */
- /* bottom_index. Assumes the lock is held. */
-
-STATIC bottom_index * GC_all_bottom_indices_end = 0;
- /* Pointer to the last (highest address) */
- /* bottom_index. Assumes the lock is held. */
-
/* Non-macro version of header location routine */
GC_INNER hdr * GC_find_header(ptr_t h)
{
@@ -110,11 +102,6 @@ GC_INNER hdr *
/* Routines to dynamically allocate collector data structures that will */
/* never be freed. */
-STATIC ptr_t GC_scratch_free_ptr = 0;
-
-/* GC_scratch_last_end_ptr is end point of last obtained scratch area. */
-/* GC_scratch_end_ptr is end point of current scratch area. */
-
GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
{
ptr_t result = GC_scratch_free_ptr;
@@ -162,8 +149,6 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
}
}
-STATIC hdr * GC_hdr_free_list = 0;
-
/* Return an uninitialized header */
static hdr * alloc_hdr(void)
{
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 6a9528fe..5d0156cb 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -1288,6 +1288,35 @@ typedef int mark_state_t; /* Current state of marking, as follows: */
/* Used to remember where we are during */
/* concurrent marking. */
+struct disappearing_link;
+struct finalizable_object;
+
+struct dl_hashtbl_s {
+ struct disappearing_link **head;
+ word entries;
+ unsigned log_size;
+};
+
+struct fnlz_roots_s {
+ struct finalizable_object **fo_head;
+ /* List of objects that should be finalized now: */
+ struct finalizable_object *finalize_now;
+};
+
+union toggle_ref_u {
+ /* The lowest bit is used to distinguish between choices. */
+ void *strong_ref;
+ GC_hidden_pointer weak_ref;
+};
+
+/* Extended descriptors. GC_typed_mark_proc understands these. */
+/* These are used for simple objects that are larger than what */
+/* can be described by a BITMAP_BITS sized bitmap. */
+typedef struct {
+ word ed_bitmap; /* lsb corresponds to first word. */
+ GC_bool ed_continued; /* next entry is continuation. */
+} typed_ext_descr_t;
+
/* Lists of all heap blocks and free lists */
/* as well as other random data structures */
/* that should not be scanned by the */
@@ -1348,6 +1377,14 @@ struct _GC_arrays {
/* Bytes of memory explicitly deallocated while */
/* finalizers were running. Used to approximate memory */
/* explicitly deallocated by finalizers. */
+ bottom_index *_all_bottom_indices;
+ /* Pointer to the first (lowest address) bottom_index; */
+ /* assumes the lock is held. */
+ bottom_index *_all_bottom_indices_end;
+ /* Pointer to the last (highest address) bottom_index; */
+ /* assumes the lock is held. */
+ ptr_t _scratch_free_ptr;
+ hdr *_hdr_free_list;
ptr_t _scratch_end_ptr;
/* GC_scratch_end_ptr is end point of the current scratch area. */
ptr_t _scratch_last_end_ptr;
@@ -1378,7 +1415,11 @@ struct _GC_arrays {
# define GC_unmapped_bytes 0
# endif
bottom_index * _all_nils;
+# define GC_scan_ptr GC_arrays._scan_ptr
+ struct hblk * _scan_ptr;
# ifdef PARALLEL_MARK
+# define GC_main_local_mark_stack GC_arrays._main_local_mark_stack
+ mse *_main_local_mark_stack;
# define GC_first_nonempty GC_arrays._first_nonempty
volatile AO_t _first_nonempty;
/* Lowest entry on mark stack that may be */
@@ -1409,14 +1450,28 @@ struct _GC_arrays {
# define GC_n_memory GC_arrays._n_memory
word _n_memory; /* Number of GET_MEM allocated memory sections. */
# endif
+# ifdef GC_GCJ_SUPPORT
+# define GC_gcjobjfreelist GC_arrays._gcjobjfreelist
+ ptr_t *_gcjobjfreelist;
+# endif
# define GC_fo_entries GC_arrays._fo_entries
word _fo_entries;
# ifndef GC_NO_FINALIZATION
+# define GC_dl_hashtbl GC_arrays._dl_hashtbl
+# define GC_fnlz_roots GC_arrays._fnlz_roots
# define GC_log_fo_table_size GC_arrays._log_fo_table_size
+# ifndef GC_LONG_REFS_NOT_NEEDED
+# define GC_ll_hashtbl GC_arrays._ll_hashtbl
+ struct dl_hashtbl_s _ll_hashtbl;
+# endif
+ struct dl_hashtbl_s _dl_hashtbl;
+ struct fnlz_roots_s _fnlz_roots;
unsigned _log_fo_table_size;
# ifndef GC_TOGGLE_REFS_NOT_NEEDED
+# define GC_toggleref_arr GC_arrays._toggleref_arr
# define GC_toggleref_array_size GC_arrays._toggleref_array_size
# define GC_toggleref_array_capacity GC_arrays._toggleref_array_capacity
+ union toggle_ref_u *_toggleref_arr;
size_t _toggleref_array_size;
size_t _toggleref_array_capacity;
# endif
@@ -1431,14 +1486,17 @@ struct _GC_arrays {
# endif
# define n_root_sets GC_arrays._n_root_sets
# define GC_excl_table_entries GC_arrays._excl_table_entries
-# define GC_roots_were_cleared GC_arrays._roots_were_cleared
int _n_root_sets; /* GC_static_roots[0..n_root_sets) contains the */
/* valid root sets. */
size_t _excl_table_entries; /* Number of entries in use. */
- GC_bool _roots_were_cleared;
+# ifdef THREADS
+# define GC_roots_were_cleared GC_arrays._roots_were_cleared
+ GC_bool _roots_were_cleared;
+# endif
# define GC_explicit_typing_initialized GC_arrays._explicit_typing_initialized
# define GC_ed_size GC_arrays._ed_size
# define GC_avail_descr GC_arrays._avail_descr
+# define GC_ext_descriptors GC_arrays._ext_descriptors
# ifdef AO_HAVE_load_acquire
volatile AO_t _explicit_typing_initialized;
# else
@@ -1446,6 +1504,8 @@ struct _GC_arrays {
# endif
size_t _ed_size; /* Current size of above arrays. */
size_t _avail_descr; /* Next available slot. */
+ typed_ext_descr_t *_ext_descriptors; /* Points to array of extended */
+ /* descriptors. */
GC_mark_proc _mark_procs[MAX_MARK_PROCS];
/* Table of user-defined mark procedures. There is */
/* a small number of these, which can be referenced */
@@ -1570,6 +1630,10 @@ GC_API_PRIV GC_FAR struct _GC_arrays GC_arrays;
#define GC_modws_valid_offsets GC_arrays._modws_valid_offsets
#define GC_prev_heap_addr GC_arrays._prev_heap_addr
#define GC_requested_heapsize GC_arrays._requested_heapsize
+#define GC_all_bottom_indices GC_arrays._all_bottom_indices
+#define GC_all_bottom_indices_end GC_arrays._all_bottom_indices_end
+#define GC_scratch_free_ptr GC_arrays._scratch_free_ptr
+#define GC_hdr_free_list GC_arrays._hdr_free_list
#define GC_scratch_end_ptr GC_arrays._scratch_end_ptr
#define GC_scratch_last_end_ptr GC_arrays._scratch_last_end_ptr
#define GC_size_map GC_arrays._size_map
@@ -2486,10 +2550,6 @@ GC_EXTERN signed_word GC_bytes_found;
GC_INNER void GC_mark_thread_local_free_lists(void);
#endif
-#ifdef GC_GCJ_SUPPORT
- GC_EXTERN ptr_t * GC_gcjobjfreelist;
-#endif
-
#if defined(MPROTECT_VDB) && defined(GWW_VDB)
GC_INNER GC_bool GC_gww_dirty_init(void);
/* Returns TRUE if GetWriteWatch is available. */
diff --git a/mark.c b/mark.c
index 84527221..73dc5ca3 100644
--- a/mark.c
+++ b/mark.c
@@ -101,8 +101,6 @@ GC_INNER struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
GC_INNER GC_bool GC_parallel_mark_disabled = FALSE;
#endif
-STATIC struct hblk * GC_scan_ptr;
-
/* Is a collection in progress? Note that this can return true in the */
/* non-incremental case, if a collection has been abandoned and the */
/* mark state is now MS_INVALID. */
@@ -890,8 +888,6 @@ STATIC unsigned GC_active_count = 0; /* Number of active helpers. */
GC_INNER word GC_mark_no = 0;
-STATIC mse *GC_main_local_mark_stack;
-
#ifdef LINT2
# define LOCAL_MARK_STACK_SIZE (HBLKSIZE / 8)
#else
diff --git a/mark_rts.c b/mark_rts.c
index e88f8a72..6a576681 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -274,7 +274,9 @@ GC_API void GC_CALL GC_clear_roots(void)
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
LOCK();
- GC_roots_were_cleared = TRUE;
+# ifdef THREADS
+ GC_roots_were_cleared = TRUE;
+# endif
n_root_sets = 0;
GC_root_size = 0;
# if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
@@ -833,27 +835,6 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame,
GC_INNER void (*GC_push_typed_structures)(void) = 0;
- /* Push GC internal roots. These are normally */
- /* included in the static data segment, and */
- /* Thus implicitly pushed. But we must do this */
- /* explicitly if normal root processing is */
- /* disabled. */
-/*
- * Push GC internal roots. Only called if there is some reason to believe
- * these would not otherwise get registered.
- */
-STATIC void GC_push_gc_structures(void)
-{
-# ifndef GC_NO_FINALIZATION
- GC_push_finalizer_structures();
-# endif
-# if defined(THREADS)
- GC_push_thread_structures();
-# endif
- if( GC_push_typed_structures )
- GC_push_typed_structures();
-}
-
GC_INNER void GC_cond_register_dynamic_libraries(void)
{
# if (defined(DYNAMIC_LOADING) && !defined(MSWIN_XBOX1)) \
@@ -919,9 +900,15 @@ GC_INNER void GC_push_roots(GC_bool all, ptr_t cold_gc_frame GC_ATTR_UNUSED)
/* Mark from GC internal roots if those might otherwise have */
/* been excluded. */
- if (GC_no_dls || GC_roots_were_cleared) {
- GC_push_gc_structures();
- }
+# ifndef GC_NO_FINALIZATION
+ GC_push_finalizer_structures();
+# endif
+# ifdef THREADS
+ if (GC_no_dls || GC_roots_were_cleared)
+ GC_push_thread_structures();
+# endif
+ if (GC_push_typed_structures)
+ GC_push_typed_structures();
/* Mark thread local free lists, even if their mark */
/* descriptor excludes the link field. */
diff --git a/typd_mlc.c b/typd_mlc.c
index b372b4d4..bb7600ba 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -50,14 +50,6 @@ STATIC int GC_array_kind = 0;
/* Object kind for objects with complex */
/* descriptors and GC_array_mark_proc. */
-/* Extended descriptors. GC_typed_mark_proc understands these. */
-/* These are used for simple objects that are larger than what */
-/* can be described by a BITMAP_BITS sized bitmap. */
-typedef struct {
- word ed_bitmap; /* lsb corresponds to first word. */
- GC_bool ed_continued; /* next entry is continuation. */
-} typed_ext_descr_t;
-
/* Array descriptors. GC_array_mark_proc understands these. */
/* We may eventually need to add provisions for headers and */
/* trailers. Hence we provide for tree structured descriptors, */
@@ -94,10 +86,6 @@ typedef union ComplexDescriptor {
} complex_descriptor;
#define TAG ad.ad_tag
-STATIC typed_ext_descr_t * GC_ext_descriptors = NULL;
- /* Points to array of extended */
- /* descriptors. */
-
#define ED_INITIAL_SIZE 100
STATIC int GC_typed_mark_proc_index = 0; /* Indices of my mark */