summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--alloc.c20
-rw-r--r--dbg_mlc.c4
-rw-r--r--dyn_load.c4
-rw-r--r--finalize.c17
-rw-r--r--fnlz_mlc.c2
-rw-r--r--gc_dlopen.c1
-rw-r--r--gcj_mlc.c5
-rw-r--r--include/private/gc_locks.h5
-rw-r--r--malloc.c6
-rw-r--r--mallocx.c4
-rw-r--r--mark.c2
-rw-r--r--mark_rts.c8
-rw-r--r--misc.c46
-rw-r--r--obj_map.c2
-rw-r--r--os_dep.c5
-rw-r--r--pthread_stop_world.c3
-rw-r--r--pthread_support.c20
-rw-r--r--ptr_chck.c9
-rw-r--r--reclaim.c1
-rw-r--r--typd_mlc.c4
20 files changed, 14 insertions, 154 deletions
diff --git a/alloc.c b/alloc.c
index 489ba74f..ec778891 100644
--- a/alloc.c
+++ b/alloc.c
@@ -118,8 +118,6 @@ STATIC GC_bool GC_disable_automatic_collection = FALSE;
GC_API void GC_CALL GC_set_disable_automatic_collection(int value)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_disable_automatic_collection = (GC_bool)value;
UNLOCK();
@@ -128,7 +126,6 @@ GC_API void GC_CALL GC_set_disable_automatic_collection(int value)
GC_API int GC_CALL GC_get_disable_automatic_collection(void)
{
int value;
- DCL_LOCK_STATE;
LOCK();
value = (int)GC_disable_automatic_collection;
@@ -224,7 +221,6 @@ STATIC GC_stop_func GC_default_stop_func = GC_never_stop_func;
GC_API void GC_CALL GC_set_stop_func(GC_stop_func stop_func)
{
- DCL_LOCK_STATE;
GC_ASSERT(NONNULL_ARG_NOT_NULL(stop_func));
LOCK();
GC_default_stop_func = stop_func;
@@ -234,7 +230,7 @@ GC_API void GC_CALL GC_set_stop_func(GC_stop_func stop_func)
GC_API GC_stop_func GC_CALL GC_get_stop_func(void)
{
GC_stop_func stop_func;
- DCL_LOCK_STATE;
+
LOCK();
stop_func = GC_default_stop_func;
UNLOCK();
@@ -395,9 +391,8 @@ STATIC void GC_clear_a_few_frames(void)
GC_API void GC_CALL GC_start_incremental_collection(void)
{
# ifndef GC_DISABLE_INCREMENTAL
- DCL_LOCK_STATE;
-
if (!GC_incremental) return;
+
LOCK();
GC_should_start_incremental_collection = TRUE;
ENTER_GC();
@@ -439,7 +434,6 @@ GC_INNER GC_bool GC_should_collect(void)
GC_API void GC_CALL GC_set_start_callback(GC_start_callback_proc fn)
{
- DCL_LOCK_STATE;
LOCK();
GC_start_call_back = fn;
UNLOCK();
@@ -448,7 +442,7 @@ GC_API void GC_CALL GC_set_start_callback(GC_start_callback_proc fn)
GC_API GC_start_callback_proc GC_CALL GC_get_start_callback(void)
{
GC_start_callback_proc fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_start_call_back;
UNLOCK();
@@ -522,7 +516,6 @@ STATIC GC_on_collection_event_proc GC_on_collection_event = 0;
GC_API void GC_CALL GC_set_on_collection_event(GC_on_collection_event_proc fn)
{
/* fn may be 0 (means no event notifier). */
- DCL_LOCK_STATE;
LOCK();
GC_on_collection_event = fn;
UNLOCK();
@@ -531,7 +524,7 @@ GC_API void GC_CALL GC_set_on_collection_event(GC_on_collection_event_proc fn)
GC_API GC_on_collection_event_proc GC_CALL GC_get_on_collection_event(void)
{
GC_on_collection_event_proc fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_on_collection_event;
UNLOCK();
@@ -751,7 +744,6 @@ GC_INNER void (*GC_print_all_smashed)(void) = 0;
GC_API int GC_CALL GC_collect_a_little(void)
{
int result;
- DCL_LOCK_STATE;
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
LOCK();
@@ -1261,7 +1253,6 @@ STATIC GC_bool GC_try_to_collect_general(GC_stop_func stop_func,
GC_bool result;
IF_USE_MUNMAP(int old_unmap_threshold;)
IF_CANCEL(int cancel_state;)
- DCL_LOCK_STATE;
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
if (GC_debugging_started) GC_print_all_smashed();
@@ -1482,7 +1473,7 @@ GC_API void GC_CALL GC_set_max_heap_size(GC_word n)
GC_max_heapsize = n;
}
-GC_word GC_max_retries = 0;
+word GC_max_retries = 0;
GC_INNER void GC_scratch_recycle_inner(void *ptr, size_t bytes)
{
@@ -1573,7 +1564,6 @@ GC_API int GC_CALL GC_expand_hp(size_t bytes)
word n_blocks = OBJ_SZ_TO_BLOCKS_CHECKED(bytes);
word old_heapsize;
GC_bool result;
- DCL_LOCK_STATE;
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
LOCK();
diff --git a/dbg_mlc.c b/dbg_mlc.c
index 4a1d774b..d408e745 100644
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -249,7 +249,6 @@
GC_API void GC_CALL GC_generate_random_backtrace(void)
{
void *current;
- DCL_LOCK_STATE;
GC_ASSERT(I_DONT_HOLD_LOCK());
if (GC_try_to_collect(GC_never_stop_func) == 0) {
@@ -304,7 +303,6 @@ static void *store_debug_info(void *p, size_t lb,
const char *fn, GC_EXTRA_PARAMS)
{
void *result;
- DCL_LOCK_STATE;
if (NULL == p) {
GC_err_printf("%s(%lu) returning NULL (%s:%d)\n",
@@ -503,8 +501,6 @@ GC_API size_t GC_CALL GC_get_debug_header_size(void) {
GC_API void GC_CALL GC_debug_register_displacement(size_t offset)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_register_displacement_inner(offset);
GC_register_displacement_inner((word)sizeof(oh) + offset);
diff --git a/dyn_load.c b/dyn_load.c
index 2289b68c..7c5fc2c8 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -1326,7 +1326,6 @@ STATIC void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr,
const struct GC_MACH_SECTION *sec;
const char *name;
GC_has_static_roots_func callback = GC_has_static_roots;
- DCL_LOCK_STATE;
GC_ASSERT(I_DONT_HOLD_LOCK());
if (GC_no_dls) return;
@@ -1394,9 +1393,6 @@ STATIC void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr,
unsigned long start, end;
unsigned i, j;
const struct GC_MACH_SECTION *sec;
-# if defined(DARWIN_DEBUG) && !defined(NO_DEBUGGING)
- DCL_LOCK_STATE;
-# endif
GC_ASSERT(I_DONT_HOLD_LOCK());
for (i = 0; i < sizeof(GC_dyld_sections)/sizeof(GC_dyld_sections[0]); i++) {
diff --git a/finalize.c b/finalize.c
index 0a4353d0..ffbf96ce 100644
--- a/finalize.c
+++ b/finalize.c
@@ -164,7 +164,6 @@ STATIC int GC_register_disappearing_link_inner(
struct disappearing_link *curr_dl;
size_t index;
struct disappearing_link * new_dl;
- DCL_LOCK_STATE;
GC_ASSERT(GC_is_initialized);
if (EXPECT(GC_find_leak, FALSE)) return GC_UNIMPLEMENTED;
@@ -278,7 +277,6 @@ GC_INLINE struct disappearing_link *GC_unregister_disappearing_link_inner(
GC_API int GC_CALL GC_unregister_disappearing_link(void * * link)
{
struct disappearing_link *curr_dl;
- DCL_LOCK_STATE;
if (((word)link & (ALIGNMENT-1)) != 0) return 0; /* Nothing to do. */
@@ -396,8 +394,6 @@ GC_INLINE void GC_complete_ongoing_collection(void) {
GC_API void GC_CALL GC_set_toggleref_func(GC_toggleref_func fn)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_toggleref_callback = fn;
UNLOCK();
@@ -406,7 +402,6 @@ GC_INLINE void GC_complete_ongoing_collection(void) {
GC_API GC_toggleref_func GC_CALL GC_get_toggleref_func(void)
{
GC_toggleref_func fn;
- DCL_LOCK_STATE;
LOCK();
fn = GC_toggleref_callback;
@@ -453,7 +448,6 @@ GC_INLINE void GC_complete_ongoing_collection(void) {
GC_API int GC_CALL GC_toggleref_add(void *obj, int is_strong_ref)
{
int res = GC_SUCCESS;
- DCL_LOCK_STATE;
GC_ASSERT(NONNULL_ARG_NOT_NULL(obj));
LOCK();
@@ -478,8 +472,6 @@ STATIC GC_await_finalize_proc GC_object_finalized_proc = 0;
GC_API void GC_CALL GC_set_await_finalize_proc(GC_await_finalize_proc fn)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_object_finalized_proc = fn;
UNLOCK();
@@ -488,7 +480,6 @@ GC_API void GC_CALL GC_set_await_finalize_proc(GC_await_finalize_proc fn)
GC_API GC_await_finalize_proc GC_CALL GC_get_await_finalize_proc(void)
{
GC_await_finalize_proc fn;
- DCL_LOCK_STATE;
LOCK();
fn = GC_object_finalized_proc;
@@ -508,7 +499,6 @@ GC_API GC_await_finalize_proc GC_CALL GC_get_await_finalize_proc(void)
GC_API int GC_CALL GC_unregister_long_link(void * * link)
{
struct disappearing_link *curr_dl;
- DCL_LOCK_STATE;
if (((word)link & (ALIGNMENT-1)) != 0) return 0; /* Nothing to do. */
@@ -581,7 +571,6 @@ GC_API GC_await_finalize_proc GC_CALL GC_get_await_finalize_proc(void)
GC_API int GC_CALL GC_move_disappearing_link(void **link, void **new_link)
{
int result;
- DCL_LOCK_STATE;
if (((word)new_link & (ALIGNMENT-1)) != 0
|| !NONNULL_ARG_NOT_NULL(new_link))
@@ -599,7 +588,6 @@ GC_API GC_await_finalize_proc GC_CALL GC_get_await_finalize_proc(void)
GC_API int GC_CALL GC_move_long_link(void **link, void **new_link)
{
int result;
- DCL_LOCK_STATE;
if (((word)new_link & (ALIGNMENT-1)) != 0
|| !NONNULL_ARG_NOT_NULL(new_link))
@@ -686,7 +674,6 @@ STATIC void GC_register_finalizer_inner(void * obj,
size_t index;
struct finalizable_object *new_fo = 0;
hdr *hhdr = NULL; /* initialized to prevent warning. */
- DCL_LOCK_STATE;
GC_ASSERT(GC_is_initialized);
if (EXPECT(GC_find_leak, FALSE)) {
@@ -1213,8 +1200,6 @@ GC_INNER void GC_finalize(void)
*/
GC_API void GC_CALL GC_finalize_all(void)
{
- DCL_LOCK_STATE;
-
LOCK();
while (GC_fo_entries > 0) {
GC_enqueue_all_finalizers();
@@ -1248,7 +1233,6 @@ GC_API int GC_CALL GC_invoke_finalizers(void)
{
int count = 0;
word bytes_freed_before = 0; /* initialized to prevent warning. */
- DCL_LOCK_STATE;
GC_ASSERT(I_DONT_HOLD_LOCK());
while (GC_should_invoke_finalizers()) {
@@ -1304,7 +1288,6 @@ GC_INNER void GC_notify_or_invoke_finalizers(void)
# if defined(KEEP_BACK_PTRS) || defined(MAKE_BACK_GRAPH)
static word last_back_trace_gc_no = 1; /* Skip first one. */
# endif
- DCL_LOCK_STATE;
# if defined(THREADS) && !defined(KEEP_BACK_PTRS) \
&& !defined(MAKE_BACK_GRAPH)
diff --git a/fnlz_mlc.c b/fnlz_mlc.c
index 746dc9b4..e3de29b4 100644
--- a/fnlz_mlc.c
+++ b/fnlz_mlc.c
@@ -54,8 +54,6 @@ STATIC int GC_CALLBACK GC_finalized_disclaim(void *obj)
GC_API void GC_CALL GC_init_finalized_malloc(void)
{
- DCL_LOCK_STATE;
-
GC_init(); /* In case it's not already done. */
LOCK();
if (GC_finalized_kind != 0) {
diff --git a/gc_dlopen.c b/gc_dlopen.c
index 54903e5b..b10644a2 100644
--- a/gc_dlopen.c
+++ b/gc_dlopen.c
@@ -43,7 +43,6 @@
#ifndef USE_PROC_FOR_LIBRARIES
static void disable_gc_for_dlopen(void)
{
- DCL_LOCK_STATE;
LOCK();
while (GC_incremental && GC_collection_in_progress()) {
ENTER_GC();
diff --git a/gcj_mlc.c b/gcj_mlc.c
index c09ffe34..b6dd8c23 100644
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -61,7 +61,6 @@ GC_API void GC_CALL GC_init_gcj_malloc(int mp_index,
# ifndef GC_IGNORE_GCJ_INFO
GC_bool ignore_gcj_info;
# endif
- DCL_LOCK_STATE;
if (mp == 0) /* In case GC_DS_PROC is unused. */
mp = (void *)(word)GC_gcj_fake_mark_proc;
@@ -128,7 +127,6 @@ GC_API void GC_CALL GC_init_gcj_malloc(int mp_index,
static void maybe_finalize(void)
{
static word last_finalized_no = 0;
- DCL_LOCK_STATE;
GC_ASSERT(I_HOLD_LOCK());
if (GC_gc_no == last_finalized_no ||
@@ -151,7 +149,6 @@ static void maybe_finalize(void)
#endif
{
ptr_t op;
- DCL_LOCK_STATE;
GC_DBG_COLLECT_AT_MALLOC(lb);
if(SMALL_OBJ(lb)) {
@@ -196,7 +193,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_gcj_malloc(size_t lb,
void * ptr_to_struct_containing_descr, GC_EXTRA_PARAMS)
{
void * result;
- DCL_LOCK_STATE;
/* We're careful to avoid extra calls, which could */
/* confuse the backtrace. */
@@ -228,7 +224,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_gcj_malloc_ignore_off_page(size_t lb,
void * ptr_to_struct_containing_descr)
{
ptr_t op;
- DCL_LOCK_STATE;
GC_DBG_COLLECT_AT_MALLOC(lb);
if(SMALL_OBJ(lb)) {
diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h
index e5418c37..665c6dd6 100644
--- a/include/private/gc_locks.h
+++ b/include/private/gc_locks.h
@@ -21,7 +21,6 @@
/*
* Mutual exclusion between allocator/collector routines.
* Needed if there is more than one allocator thread.
- * DCL_LOCK_STATE declares any local variables needed by LOCK and UNLOCK.
*
* Note that I_HOLD_LOCK and I_DONT_HOLD_LOCK are used only positively
* in assertions, and may return TRUE in the "don't know" case.
@@ -281,8 +280,4 @@
# define EXIT_GC()
# endif
-# ifndef DCL_LOCK_STATE
-# define DCL_LOCK_STATE
-# endif
-
#endif /* GC_LOCKS_H */
diff --git a/malloc.c b/malloc.c
index 5101df64..7d998c63 100644
--- a/malloc.c
+++ b/malloc.c
@@ -45,7 +45,6 @@ GC_INNER ptr_t GC_alloc_large(size_t lb, int k, unsigned flags,
lb = ROUNDUP_GRANULE_SIZE(lb);
n_blocks = OBJ_SZ_TO_BLOCKS_CHECKED(SIZET_SAT_ADD(lb, align_m1));
if (!EXPECT(GC_is_initialized, TRUE)) {
- DCL_LOCK_STATE;
UNLOCK(); /* just to unset GC_lock_holder */
GC_init();
LOCK();
@@ -168,7 +167,6 @@ GC_INNER void * GC_generic_malloc_inner(size_t lb, int k)
if (EXPECT(0 == op, FALSE)) {
if (lg == 0) {
if (!EXPECT(GC_is_initialized, TRUE)) {
- DCL_LOCK_STATE;
UNLOCK(); /* just to unset GC_lock_holder */
GC_init();
LOCK();
@@ -239,7 +237,6 @@ GC_INNER void * GC_generic_malloc_inner(size_t lb, int k)
GC_INNER void * GC_generic_malloc_aligned(size_t lb, int k, size_t align_m1)
{
void * result;
- DCL_LOCK_STATE;
GC_ASSERT(k < MAXOBJKINDS);
if (EXPECT(get_have_errors(), FALSE))
@@ -302,7 +299,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_kind_global(size_t lb, int k)
void *op;
void **opp;
size_t lg;
- DCL_LOCK_STATE;
GC_DBG_COLLECT_AT_MALLOC(lb);
LOCK();
@@ -356,7 +352,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_generic_malloc_uncollectable(
size_t lb, int k)
{
void *op;
- DCL_LOCK_STATE;
GC_ASSERT(k < MAXOBJKINDS);
if (SMALL_OBJ(lb)) {
@@ -598,7 +593,6 @@ static void free_internal(void *p, hdr *hhdr)
GC_API void GC_CALL GC_free(void * p)
{
hdr *hhdr;
- DCL_LOCK_STATE;
if (p /* != NULL */) {
/* CPPCHECK */
diff --git a/mallocx.c b/mallocx.c
index 77ba5675..47cca9ee 100644
--- a/mallocx.c
+++ b/mallocx.c
@@ -126,8 +126,6 @@ GC_API void * GC_CALL GC_realloc(void * p, size_t lb)
AO_store((volatile AO_t *)&hhdr->hb_descr, (AO_t)descr);
# else
{
- DCL_LOCK_STATE;
-
LOCK();
hhdr -> hb_sz = sz;
hhdr -> hb_descr = descr;
@@ -200,7 +198,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
size_t lb_rounded;
word n_blocks;
GC_bool init;
- DCL_LOCK_STATE;
if (SMALL_OBJ(lb))
return GC_generic_malloc(lb, k);
@@ -307,7 +304,6 @@ GC_API void GC_CALL GC_generic_malloc_many(size_t lb, int k, void **result)
signed_word my_bytes_allocd = 0;
struct obj_kind * ok = &(GC_obj_kinds[k]);
struct hblk ** rlh;
- DCL_LOCK_STATE;
GC_ASSERT(lb != 0 && (lb & (GRANULE_BYTES-1)) == 0);
/* Currently a single object is always allocated if manual VDB. */
diff --git a/mark.c b/mark.c
index 9f9027d0..da737906 100644
--- a/mark.c
+++ b/mark.c
@@ -1488,8 +1488,6 @@ GC_API void GC_CALL GC_print_trace_inner(word gc_no)
GC_API void GC_CALL GC_print_trace(word gc_no)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_print_trace_inner(gc_no);
UNLOCK();
diff --git a/mark_rts.c b/mark_rts.c
index d4bd6fb7..bb39e9da 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -146,8 +146,6 @@ GC_INNER word GC_root_size = 0;
GC_API void GC_CALL GC_add_roots(void *b, void *e)
{
- DCL_LOCK_STATE;
-
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
LOCK();
GC_add_roots_inner((ptr_t)b, (ptr_t)e, FALSE);
@@ -268,8 +266,6 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp)
GC_API void GC_CALL GC_clear_roots(void)
{
- DCL_LOCK_STATE;
-
if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
LOCK();
# ifdef THREADS
@@ -340,8 +336,6 @@ STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e);
GC_API void GC_CALL GC_remove_roots(void *b, void *e)
{
- DCL_LOCK_STATE;
-
/* Quick check whether has nothing to do */
if ((((word)b + (sizeof(word) - 1)) & ~(word)(sizeof(word) - 1)) >=
((word)e & ~(word)(sizeof(word) - 1)))
@@ -602,8 +596,6 @@ GC_INNER void GC_exclude_static_roots_inner(void *start, void *finish)
GC_API void GC_CALL GC_exclude_static_roots(void *b, void *e)
{
- DCL_LOCK_STATE;
-
if (b == e) return; /* nothing to exclude? */
/* Round boundaries (in direction reverse to that of GC_add_roots). */
diff --git a/misc.c b/misc.c
index cfffa4cb..134fee1b 100644
--- a/misc.c
+++ b/misc.c
@@ -527,8 +527,6 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size,
GC_word *pfree_bytes, GC_word *punmapped_bytes,
GC_word *pbytes_since_gc, GC_word *ptotal_bytes)
{
- DCL_LOCK_STATE;
-
LOCK();
if (pheap_size != NULL)
*pheap_size = GC_heapsize - GC_unmapped_bytes;
@@ -573,7 +571,6 @@ GC_API void GC_CALL GC_get_heap_usage_safe(GC_word *pheap_size,
size_t stats_sz)
{
struct GC_prof_stats_s stats;
- DCL_LOCK_STATE;
LOCK();
fill_prof_stats(stats_sz >= sizeof(stats) ? pstats : &stats);
@@ -785,8 +782,6 @@ GC_API int GC_CALL GC_is_init_called(void)
{
if (GC_find_leak && !skip_gc_atexit) {
# ifdef THREADS
- DCL_LOCK_STATE;
-
/* GC_in_thread_creation should always be updated holding the */
/* lock even if we are about to exit. */
LOCK();
@@ -932,9 +927,6 @@ GC_API void GC_CALL GC_init(void)
/* LOCK(); -- no longer does anything this early. */
word initial_heap_sz;
IF_CANCEL(int cancel_state;)
-# if defined(GC_ASSERTIONS) && defined(GC_ALWAYS_MULTITHREADED)
- DCL_LOCK_STATE;
-# endif
if (EXPECT(GC_is_initialized, TRUE)) return;
# ifdef REDIRECT_MALLOC
@@ -1401,7 +1393,6 @@ GC_API void GC_CALL GC_init(void)
GC_API void GC_CALL GC_enable_incremental(void)
{
# if !defined(GC_DISABLE_INCREMENTAL) && !defined(KEEP_BACK_PTRS)
- DCL_LOCK_STATE;
/* If we are keeping back pointers, the GC itself dirties all */
/* pages on which objects have been marked, making */
/* incremental GC pointless. */
@@ -1456,7 +1447,6 @@ GC_API void GC_CALL GC_start_mark_threads(void)
{
# ifdef PARALLEL_MARK
IF_CANCEL(int cancel_state;)
- DCL_LOCK_STATE;
DISABLE_CANCEL(cancel_state);
LOCK();
@@ -1946,7 +1936,6 @@ GC_API void GC_CALLBACK GC_ignore_warn_proc(char *msg, GC_word arg)
GC_API void GC_CALL GC_set_warn_proc(GC_warn_proc p)
{
- DCL_LOCK_STATE;
GC_ASSERT(NONNULL_ARG_NOT_NULL(p));
# ifdef GC_WIN32_THREADS
# ifdef CYGWIN32
@@ -1964,7 +1953,7 @@ GC_API void GC_CALL GC_set_warn_proc(GC_warn_proc p)
GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
{
GC_warn_proc result;
- DCL_LOCK_STATE;
+
LOCK();
result = GC_current_warn_proc;
UNLOCK();
@@ -2021,7 +2010,6 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
GC_API void GC_CALL GC_set_abort_func(GC_abort_func fn)
{
- DCL_LOCK_STATE;
GC_ASSERT(NONNULL_ARG_NOT_NULL(fn));
LOCK();
GC_on_abort = fn;
@@ -2031,7 +2019,7 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
GC_API GC_abort_func GC_CALL GC_get_abort_func(void)
{
GC_abort_func fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_on_abort;
UNLOCK();
@@ -2041,8 +2029,6 @@ GC_API GC_warn_proc GC_CALL GC_get_warn_proc(void)
GC_API void GC_CALL GC_enable(void)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_ASSERT(GC_dont_gc != 0); /* ensure no counter underflow */
GC_dont_gc--;
@@ -2054,7 +2040,6 @@ GC_API void GC_CALL GC_enable(void)
GC_API void GC_CALL GC_disable(void)
{
- DCL_LOCK_STATE;
LOCK();
if (!GC_dont_gc)
GC_heapsize_on_gc_disable = GC_heapsize;
@@ -2082,7 +2067,7 @@ GC_API void ** GC_CALL GC_new_free_list_inner(void)
GC_API void ** GC_CALL GC_new_free_list(void)
{
void ** result;
- DCL_LOCK_STATE;
+
LOCK();
result = GC_new_free_list_inner();
UNLOCK();
@@ -2124,7 +2109,7 @@ GC_API unsigned GC_CALL GC_new_kind(void **fl, GC_word descr, int adjust,
int clear)
{
unsigned result;
- DCL_LOCK_STATE;
+
LOCK();
result = GC_new_kind_inner(fl, descr, adjust, clear);
UNLOCK();
@@ -2147,7 +2132,7 @@ GC_API unsigned GC_CALL GC_new_proc_inner(GC_mark_proc proc)
GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc proc)
{
unsigned result;
- DCL_LOCK_STATE;
+
LOCK();
result = GC_new_proc_inner(proc);
UNLOCK();
@@ -2157,7 +2142,6 @@ GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc proc)
GC_API void * GC_CALL GC_call_with_alloc_lock(GC_fn_type fn, void *client_data)
{
void * result;
- DCL_LOCK_STATE;
# ifdef THREADS
LOCK();
@@ -2323,8 +2307,6 @@ GC_API void * GC_CALL GC_do_blocking(GC_fn_type fn, void * client_data)
#if !defined(NO_DEBUGGING)
GC_API void GC_CALL GC_dump(void)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_dump_named(NULL);
UNLOCK();
@@ -2372,7 +2354,6 @@ static void GC_CALLBACK block_add_size(struct hblk *h, GC_word pbytes)
GC_API size_t GC_CALL GC_get_memory_use(void)
{
word bytes = 0;
- DCL_LOCK_STATE;
LOCK();
GC_apply_to_all_blocks(block_add_size, (word)(&bytes));
@@ -2409,13 +2390,11 @@ GC_API int GC_CALL GC_get_parallel(void)
#ifdef THREADS
GC_API void GC_CALL GC_alloc_lock(void)
{
- DCL_LOCK_STATE;
LOCK();
}
GC_API void GC_CALL GC_alloc_unlock(void)
{
- /* no DCL_LOCK_STATE */
UNLOCK();
}
@@ -2424,7 +2403,6 @@ GC_API int GC_CALL GC_get_parallel(void)
GC_API void GC_CALL GC_set_on_thread_event(GC_on_thread_event_proc fn)
{
/* fn may be 0 (means no event notifier). */
- DCL_LOCK_STATE;
LOCK();
GC_on_thread_event = fn;
UNLOCK();
@@ -2433,7 +2411,7 @@ GC_API int GC_CALL GC_get_parallel(void)
GC_API GC_on_thread_event_proc GC_CALL GC_get_on_thread_event(void)
{
GC_on_thread_event_proc fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_on_thread_event;
UNLOCK();
@@ -2447,8 +2425,6 @@ GC_API int GC_CALL GC_get_parallel(void)
GC_API void GC_CALL GC_set_oom_fn(GC_oom_func fn)
{
- DCL_LOCK_STATE;
-
GC_ASSERT(NONNULL_ARG_NOT_NULL(fn));
LOCK();
GC_oom_fn = fn;
@@ -2458,7 +2434,7 @@ GC_API void GC_CALL GC_set_oom_fn(GC_oom_func fn)
GC_API GC_oom_func GC_CALL GC_get_oom_fn(void)
{
GC_oom_func fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_oom_fn;
UNLOCK();
@@ -2468,7 +2444,6 @@ GC_API GC_oom_func GC_CALL GC_get_oom_fn(void)
GC_API void GC_CALL GC_set_on_heap_resize(GC_on_heap_resize_proc fn)
{
/* fn may be 0 (means no event notifier). */
- DCL_LOCK_STATE;
LOCK();
GC_on_heap_resize = fn;
UNLOCK();
@@ -2477,7 +2452,7 @@ GC_API void GC_CALL GC_set_on_heap_resize(GC_on_heap_resize_proc fn)
GC_API GC_on_heap_resize_proc GC_CALL GC_get_on_heap_resize(void)
{
GC_on_heap_resize_proc fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_on_heap_resize;
UNLOCK();
@@ -2487,7 +2462,6 @@ GC_API GC_on_heap_resize_proc GC_CALL GC_get_on_heap_resize(void)
GC_API void GC_CALL GC_set_finalizer_notifier(GC_finalizer_notifier_proc fn)
{
/* fn may be 0 (means no finalizer notifier). */
- DCL_LOCK_STATE;
LOCK();
GC_finalizer_notifier = fn;
UNLOCK();
@@ -2496,7 +2470,7 @@ GC_API void GC_CALL GC_set_finalizer_notifier(GC_finalizer_notifier_proc fn)
GC_API GC_finalizer_notifier_proc GC_CALL GC_get_finalizer_notifier(void)
{
GC_finalizer_notifier_proc fn;
- DCL_LOCK_STATE;
+
LOCK();
fn = GC_finalizer_notifier;
UNLOCK();
@@ -2523,8 +2497,6 @@ GC_API int GC_CALL GC_get_find_leak(void)
GC_API void GC_CALL GC_set_all_interior_pointers(int value)
{
- DCL_LOCK_STATE;
-
GC_all_interior_pointers = value ? 1 : 0;
if (GC_is_initialized) {
/* It is not recommended to change GC_all_interior_pointers value */
diff --git a/obj_map.c b/obj_map.c
index e3b22b4c..d4a4452e 100644
--- a/obj_map.c
+++ b/obj_map.c
@@ -26,8 +26,6 @@
GC_API void GC_CALL GC_register_displacement(size_t offset)
{
- DCL_LOCK_STATE;
-
LOCK();
GC_register_displacement_inner(offset);
UNLOCK();
diff --git a/os_dep.c b/os_dep.c
index 9b4c98da..06345341 100644
--- a/os_dep.c
+++ b/os_dep.c
@@ -1335,9 +1335,6 @@ GC_INNER size_t GC_page_size = 0;
{
pthread_attr_t attr;
size_t size;
-# ifdef IA64
- DCL_LOCK_STATE;
-# endif
# ifdef HAVE_PTHREAD_ATTR_GET_NP
if (pthread_attr_init(&attr) != 0)
@@ -1495,7 +1492,6 @@ GC_INNER size_t GC_page_size = 0;
GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *b)
{
IF_CANCEL(int cancel_state;)
- DCL_LOCK_STATE;
LOCK();
DISABLE_CANCEL(cancel_state); /* May be unnecessary? */
@@ -5151,7 +5147,6 @@ GC_INNER void GC_print_callers(struct callinfo info[NFRAMES])
{
int i;
static int reentry_count = 0;
- DCL_LOCK_STATE;
/* FIXME: This should probably use a different lock, so that we */
/* become callable with or without the allocation lock. */
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index d171dc68..72529b6c 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -638,7 +638,6 @@ STATIC void GC_restart_handler(int sig)
AO_t next_stop_count;
word suspend_cnt;
IF_CANCEL(int cancel_state;)
- DCL_LOCK_STATE;
LOCK();
t = GC_lookup_by_pthread((pthread_t)thread);
@@ -718,7 +717,6 @@ STATIC void GC_restart_handler(int sig)
GC_API void GC_CALL GC_resume_thread(GC_SUSPEND_THREAD_ID thread) {
GC_thread t;
- DCL_LOCK_STATE;
LOCK();
t = GC_lookup_by_pthread((pthread_t)thread);
@@ -756,7 +754,6 @@ STATIC void GC_restart_handler(int sig)
GC_API int GC_CALL GC_is_thread_suspended(GC_SUSPEND_THREAD_ID thread) {
GC_thread t;
int is_suspended = 0;
- DCL_LOCK_STATE;
LOCK();
t = GC_lookup_by_pthread((pthread_t)thread);
diff --git a/pthread_support.c b/pthread_support.c
index bf7b6c28..a0923e65 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -879,7 +879,6 @@ GC_INNER GC_thread GC_lookup_thread(thread_id_t id)
GC_bool GC_is_thread_tsd_valid(void *tsd)
{
GC_thread me;
- DCL_LOCK_STATE;
LOCK();
me = GC_lookup_thread(thread_id_self());
@@ -893,7 +892,6 @@ GC_API int GC_CALL GC_thread_is_registered(void)
{
thread_id_t self_id = thread_id_self();
GC_thread me;
- DCL_LOCK_STATE;
LOCK();
me = GC_lookup_thread(self_id);
@@ -914,7 +912,6 @@ GC_API void GC_CALL GC_register_altstack(void *normstack,
GC_thread me;
GC_stack_context_t crtn;
thread_id_t self_id = thread_id_self();
- DCL_LOCK_STATE;
LOCK();
me = GC_lookup_thread(self_id);
@@ -1182,8 +1179,6 @@ GC_INNER void GC_wait_for_gc_completion(GC_bool wait_for_all)
/* Make sure that no part of our stack is still on the mark */
/* stack, since it's about to be unmapped. */
do {
- DCL_LOCK_STATE;
-
ENTER_GC();
GC_ASSERT(!GC_in_thread_creation);
GC_in_thread_creation = TRUE;
@@ -1701,7 +1696,6 @@ GC_INNER void GC_init_parallel(void)
{
# ifdef THREAD_LOCAL_ALLOC
GC_thread me;
- DCL_LOCK_STATE;
GC_ASSERT(GC_is_initialized);
LOCK();
@@ -1817,7 +1811,6 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void *context)
struct blocking_data *d = (struct blocking_data *)data;
GC_thread me;
GC_bool topOfStackUnset;
- DCL_LOCK_STATE;
UNUSED_ARG(context);
LOCK();
@@ -1867,7 +1860,6 @@ GC_INNER void GC_do_blocking_inner(ptr_t data, void *context)
{
GC_thread me = (GC_thread)thread_me;
GC_bool topOfStackUnset;
- DCL_LOCK_STATE;
UNUSED_ARG(context);
GC_ASSERT(I_HOLD_LOCK());
@@ -1929,7 +1921,6 @@ GC_API void * GC_CALL GC_get_my_stackbottom(struct GC_stack_base *sb)
{
thread_id_t self_id = thread_id_self();
GC_thread me;
- DCL_LOCK_STATE;
LOCK();
me = GC_lookup_thread(self_id);
@@ -1971,7 +1962,6 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn,
# ifdef E2K
size_t stack_size;
# endif
- DCL_LOCK_STATE;
LOCK(); /* This will block if the world is stopped. */
me = GC_lookup_thread(self_id);
@@ -2107,7 +2097,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void)
thread_id_t self_id = thread_id_self();
GC_thread me;
IF_CANCEL(int cancel_state;)
- DCL_LOCK_STATE;
/* Client should not unregister the thread explicitly if it */
/* is registered by DllMain, except for the main thread. */
@@ -2147,7 +2136,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void)
{
# ifdef CANCEL_SAFE
GC_thread t;
- DCL_LOCK_STATE;
# endif
INIT_REAL_SYMS();
@@ -2172,7 +2160,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void)
{
thread_id_t self_id = thread_id_self();
GC_thread me;
- DCL_LOCK_STATE;
INIT_REAL_SYMS();
LOCK();
@@ -2192,8 +2179,6 @@ GC_API int GC_CALL GC_unregister_my_thread(void)
GC_API void GC_CALL GC_allow_register_threads(void)
{
# ifdef GC_ASSERTIONS
- DCL_LOCK_STATE;
-
/* Check GC is initialized and the current thread is registered. */
LOCK(); /* needed for Win32 */
GC_ASSERT(GC_lookup_thread(thread_id_self()) != 0);
@@ -2208,7 +2193,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
{
thread_id_t self_id = thread_id_self();
GC_thread me;
- DCL_LOCK_STATE;
if (GC_need_to_lock == FALSE)
ABORT("Threads explicit registering is not previously enabled");
@@ -2278,7 +2262,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
{
GC_thread me = (GC_thread)arg;
IF_CANCEL(int cancel_state;)
- DCL_LOCK_STATE;
# ifdef DEBUG_THREADS
GC_log_printf("Called GC_thread_exit_proc on %p, gc_thread= %p\n",
@@ -2296,7 +2279,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
{
int result;
GC_thread t;
- DCL_LOCK_STATE;
INIT_REAL_SYMS();
# ifdef DEBUG_THREADS
@@ -2350,7 +2332,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
{
int result;
GC_thread t;
- DCL_LOCK_STATE;
INIT_REAL_SYMS();
LOCK();
@@ -2389,7 +2370,6 @@ GC_API int GC_CALL GC_register_my_thread(const struct GC_stack_base *sb)
struct start_info *psi = (struct start_info *)arg;
thread_id_t self_id = thread_id_self();
GC_thread me;
- DCL_LOCK_STATE;
# ifdef DEBUG_THREADS
GC_log_printf("Starting thread %p, sp= %p\n",
diff --git a/ptr_chck.c b/ptr_chck.c
index d83af110..831022ed 100644
--- a/ptr_chck.c
+++ b/ptr_chck.c
@@ -261,8 +261,6 @@ GC_API void * GC_CALL GC_post_incr(void **p, ptrdiff_t how_much)
GC_API void GC_CALL GC_set_same_obj_print_proc(GC_same_obj_print_proc_t fn)
{
- DCL_LOCK_STATE;
-
GC_ASSERT(NONNULL_ARG_NOT_NULL(fn));
LOCK();
GC_same_obj_print_proc = fn;
@@ -272,7 +270,6 @@ GC_API void GC_CALL GC_set_same_obj_print_proc(GC_same_obj_print_proc_t fn)
GC_API GC_same_obj_print_proc_t GC_CALL GC_get_same_obj_print_proc(void)
{
GC_same_obj_print_proc_t fn;
- DCL_LOCK_STATE;
LOCK();
fn = GC_same_obj_print_proc;
@@ -283,8 +280,6 @@ GC_API GC_same_obj_print_proc_t GC_CALL GC_get_same_obj_print_proc(void)
GC_API void GC_CALL GC_set_is_valid_displacement_print_proc(
GC_valid_ptr_print_proc_t fn)
{
- DCL_LOCK_STATE;
-
GC_ASSERT(NONNULL_ARG_NOT_NULL(fn));
LOCK();
GC_is_valid_displacement_print_proc = fn;
@@ -295,7 +290,6 @@ GC_API GC_valid_ptr_print_proc_t GC_CALL
GC_get_is_valid_displacement_print_proc(void)
{
GC_valid_ptr_print_proc_t fn;
- DCL_LOCK_STATE;
LOCK();
fn = GC_is_valid_displacement_print_proc;
@@ -305,8 +299,6 @@ GC_get_is_valid_displacement_print_proc(void)
GC_API void GC_CALL GC_set_is_visible_print_proc(GC_valid_ptr_print_proc_t fn)
{
- DCL_LOCK_STATE;
-
GC_ASSERT(NONNULL_ARG_NOT_NULL(fn));
LOCK();
GC_is_visible_print_proc = fn;
@@ -316,7 +308,6 @@ GC_API void GC_CALL GC_set_is_visible_print_proc(GC_valid_ptr_print_proc_t fn)
GC_API GC_valid_ptr_print_proc_t GC_CALL GC_get_is_visible_print_proc(void)
{
GC_valid_ptr_print_proc_t fn;
- DCL_LOCK_STATE;
LOCK();
fn = GC_is_visible_print_proc;
diff --git a/reclaim.c b/reclaim.c
index 12a325ae..86b8d399 100644
--- a/reclaim.c
+++ b/reclaim.c
@@ -77,7 +77,6 @@ GC_INNER void GC_print_all_errors(void)
GC_bool have_errors;
unsigned i, n_leaked;
ptr_t leaked[MAX_LEAKED];
- DCL_LOCK_STATE;
LOCK();
if (printing_errors) {
diff --git a/typd_mlc.c b/typd_mlc.c
index 758255d2..4427a8f6 100644
--- a/typd_mlc.c
+++ b/typd_mlc.c
@@ -67,7 +67,6 @@ STATIC signed_word GC_add_ext_descriptor(const word * bm, word nbits)
size_t nwords = divWORDSZ(nbits + WORDSZ-1);
signed_word result;
size_t i;
- DCL_LOCK_STATE;
LOCK();
while (EXPECT(GC_avail_descr + nwords >= GC_ed_size, FALSE)) {
@@ -205,7 +204,6 @@ GC_API GC_descr GC_CALL GC_make_descriptor(const GC_word * bm, size_t len)
{
signed_word last_set_bit = (signed_word)len - 1;
GC_descr d;
- DCL_LOCK_STATE;
# if defined(AO_HAVE_load_acquire) && defined(AO_HAVE_store_release)
if (!EXPECT(AO_load_acquire(&GC_explicit_typing_initialized), TRUE)) {
@@ -306,7 +304,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL
{
void *op;
size_t lg;
- DCL_LOCK_STATE;
GC_ASSERT(GC_explicit_typing_initialized);
if (EXPECT(0 == lb, FALSE)) lb = 1;
@@ -502,7 +499,6 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n,
complex_descriptor *complex_d;
int descr_type;
struct LeafDescriptor leaf;
- DCL_LOCK_STATE;
GC_STATIC_ASSERT(sizeof(struct LeafDescriptor) % sizeof(word) == 0);
GC_ASSERT(GC_explicit_typing_initialized);