From 06799865aaeb8aa08218aff0346e2144b635dd7b Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 28 Jul 2015 11:20:44 +0300 Subject: [PATCH] Replace non-API occurrences of GC_word to word (code refactoring) * finalize.c (last_finalizer_notification): Use "word" type instead of GC_word. * include/private/dbg_mlc.h (HIDE_BACK_PTR): Likewise. * include/private/gc_priv.h (WARN): Likewise. * include/private/gcconfig.h (POINTER_MASK): Likewise. * mark.c (GC_push_marked): Likewise. * misc.c (GC_init, GC_set_max_retries): Likewise. * os_dep.c (GC_unmap, GC_remap, GC_unmap_gap): Likewise. * typd_mlc.c (GC_add_ext_descriptor): Likewise. * include/private/gcconfig.h (GC_amiga_get_mem, ps3_get_mem): Rename argument to bytes. --- finalize.c | 2 +- include/private/dbg_mlc.h | 2 +- include/private/gc_priv.h | 2 +- include/private/gcconfig.h | 6 +++--- mark.c | 2 +- misc.c | 4 ++-- os_dep.c | 6 +++--- typd_mlc.c | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/finalize.c b/finalize.c index 26adb11c..9b67224e 100644 --- a/finalize.c +++ b/finalize.c @@ -1033,7 +1033,7 @@ GC_API int GC_CALL GC_invoke_finalizers(void) return count; } -static GC_word last_finalizer_notification = 0; +static word last_finalizer_notification = 0; GC_INNER void GC_notify_or_invoke_finalizers(void) { diff --git a/include/private/dbg_mlc.h b/include/private/dbg_mlc.h index deda69c7..663de702 100644 --- a/include/private/dbg_mlc.h +++ b/include/private/dbg_mlc.h @@ -78,7 +78,7 @@ typedef struct { /* We're careful never to overwrite a value with lsb 0. */ # if ALIGNMENT == 1 /* Fudge back pointer to be even. */ -# define HIDE_BACK_PTR(p) GC_HIDE_POINTER(~1 & (GC_word)(p)) +# define HIDE_BACK_PTR(p) GC_HIDE_POINTER(~1 & (word)(p)) # else # define HIDE_BACK_PTR(p) GC_HIDE_POINTER(p) # endif diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 1411b275..f3f0718e 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -532,7 +532,7 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ /* The argument (if any) format specifier should be: */ /* "%s", "%p" or "%"WARN_PRIdPTR. */ #define WARN(msg, arg) (*GC_current_warn_proc)("GC Warning: " msg, \ - (GC_word)(arg)) + (word)(arg)) GC_EXTERN GC_warn_proc GC_current_warn_proc; /* Print format type macro for decimal signed_word value passed WARN(). */ diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index f1aca2c0..5714acdc 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -2968,7 +2968,7 @@ #endif #if defined(POINTER_SHIFT) && !defined(POINTER_MASK) -# define POINTER_MASK ((GC_word)(-1)) +# define POINTER_MASK ((word)(-1)) #endif #if !defined(FIXUP_POINTER) && defined(POINTER_MASK) @@ -3052,12 +3052,12 @@ ptr_t GC_wince_get_mem(GC_word bytes); # define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes) # elif defined(AMIGA) && defined(GC_AMIGA_FASTALLOC) - void *GC_amiga_get_mem(size_t size); + void *GC_amiga_get_mem(size_t bytes); # define GET_MEM(bytes) HBLKPTR((size_t) \ GC_amiga_get_mem((size_t)(bytes) + GC_page_size) \ + GC_page_size-1) # elif defined(SN_TARGET_PS3) - void *ps3_get_mem(size_t size); + void *ps3_get_mem(size_t bytes); # define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes) # else ptr_t GC_unix_get_mem(GC_word bytes); diff --git a/mark.c b/mark.c index 89f64cc7..642dfebd 100644 --- a/mark.c +++ b/mark.c @@ -1805,7 +1805,7 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr) GC_mark_stack_top_reg = GC_mark_stack_top; for (p = h -> hb_body; (word)p <= (word)lim; p += sz) - if ((*(GC_word *)p & 0x3) != 0) + if ((*(word *)p & 0x3) != 0) PUSH_OBJ(p, hhdr, GC_mark_stack_top_reg, mark_stack_limit); GC_mark_stack_top = GC_mark_stack_top_reg; } diff --git a/misc.c b/misc.c index 344d7b83..8b871966 100644 --- a/misc.c +++ b/misc.c @@ -1098,7 +1098,7 @@ GC_API void GC_CALL GC_init(void) if (space_divisor_string != NULL) { int space_divisor = atoi(space_divisor_string); if (space_divisor > 0) - GC_free_space_divisor = (GC_word)space_divisor; + GC_free_space_divisor = (word)space_divisor; } } # ifdef USE_MUNMAP @@ -2243,7 +2243,7 @@ GC_API GC_word GC_CALL GC_get_free_space_divisor(void) GC_API void GC_CALL GC_set_max_retries(GC_word value) { - GC_ASSERT(value != ~(GC_word)0); + GC_ASSERT(value != ~(word)0); GC_max_retries = value; } diff --git a/os_dep.c b/os_dep.c index c79058db..d5bbc70b 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2371,7 +2371,7 @@ GC_INNER void GC_unmap(ptr_t start, size_t bytes) # ifdef USE_WINALLOC while (len != 0) { MEMORY_BASIC_INFORMATION mem_info; - GC_word free_len; + word free_len; if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info)) != sizeof(mem_info)) @@ -2410,7 +2410,7 @@ GC_INNER void GC_remap(ptr_t start, size_t bytes) # ifdef USE_WINALLOC while (len != 0) { MEMORY_BASIC_INFORMATION mem_info; - GC_word alloc_len; + word alloc_len; ptr_t result; if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info)) @@ -2479,7 +2479,7 @@ GC_INNER void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2, # ifdef USE_WINALLOC while (len != 0) { MEMORY_BASIC_INFORMATION mem_info; - GC_word free_len; + word free_len; if (VirtualQuery(start_addr, &mem_info, sizeof(mem_info)) != sizeof(mem_info)) diff --git a/typd_mlc.c b/typd_mlc.c index 30646a48..52fe61d0 100644 --- a/typd_mlc.c +++ b/typd_mlc.c @@ -110,7 +110,7 @@ STATIC void GC_push_typed_structures_proc(void) /* starting index. */ /* Returns -1 on failure. */ /* Caller does not hold allocation lock. */ -STATIC signed_word GC_add_ext_descriptor(const GC_word * bm, word nbits) +STATIC signed_word GC_add_ext_descriptor(const word * bm, word nbits) { size_t nwords = divWORDSZ(nbits + WORDSZ-1); signed_word result; -- 2.40.0