From 340c70374894e651e9ed32adcdebfb3e3fa2c69c Mon Sep 17 00:00:00 2001 From: ivmai Date: Sat, 17 Oct 2009 11:18:17 +0000 Subject: [PATCH] 2009-10-17 Ivan Maidanski * alloc.c (GC_copyright): Define as const. * alloc.c (GC_collect_at_heapsize): Replace "static" with "STATIC" (since the name starts with "GC_" prefix). * dbg_mlc.c (GC_describe_type_fns): Ditto. * dyn_load.c (GC_FirstDLOpenedLinkMap, GC_register_dynlib_callback, GC_dyld_sections, GC_dyld_name_for_hdr, GC_dyld_image_add, GC_dyld_image_remove): Ditto. * malloc.c (GC_libpthread_start, GC_libpthread_end, GC_libld_start, GC_libld_end): Ditto. * mark_rts.c (GC_remove_root_at_pos, GC_rebuild_root_index): Ditto. * os_dep.c (GC_gww_read_dirty, GC_gww_page_was_dirty, GC_gww_page_was_ever_dirty, GC_mprotect_thread_notify, GC_mprotect_thread_reply, GC_mprotect_thread, GC_darwin_sigbus, GC_forward_exception): Ditto. * pthread_support.c (GC_syms_initialized): Ditto. * typd_mlc.c (GC_push_typed_structures_proc): Ditto. * win32_threads.c (GC_win32_dll_threads, GC_register_my_thread_inner, GC_lookup_pthread, GC_get_stack_min, GC_waitForSingleObjectInfinite): Ditto. * darwin_stop_world.c (GC_use_mach_handler_thread, GC_use_mach_handler_thread, GC_mach_threads_count): Replace "static" with "STATIC" and add zero initializer. * os_dep.c (GC_task_self, GC_ports, GC_mprotect_state, GC_sigbus_count): Ditto. * headers.c (free_hdr): Replace "static" with GC_INLINE. * misc.c (GC_tmp): Rename static variable to fwrite_gc_res. * os_dep.c (memory): Rename static variable to ecos_gc_memory. * os_dep.c (async_set_pht_entry_from_index): Make static (for MPROTECT_VDB case). * pthread_support.c (GC_real_pthread_create, GC_real_pthread_sigmask, GC_real_pthread_join, GC_real_pthread_detach, GC_init_real_syms): Use REAL_FUNC() macro for static GC_real_XXX symbols. * win32_threads.c (GC_may_be_in_stack): Remove "GC_" prefix. --- ChangeLog | 39 ++++++++++++++++++++++++++++++++++ alloc.c | 4 ++-- darwin_stop_world.c | 6 +++--- dbg_mlc.c | 2 +- dyn_load.c | 16 +++++++------- headers.c | 2 +- malloc.c | 8 +++---- mark_rts.c | 10 ++++----- misc.c | 8 +++---- os_dep.c | 51 +++++++++++++++++++++++++-------------------- pthread_support.c | 18 ++++++++-------- typd_mlc.c | 5 +++-- win32_threads.c | 22 +++++++++---------- 13 files changed, 118 insertions(+), 73 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c2d12970..0a5f877ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2009-10-17 Ivan Maidanski + + * alloc.c (GC_copyright): Define as const. + * alloc.c (GC_collect_at_heapsize): Replace "static" with "STATIC" + (since the name starts with "GC_" prefix). + * dbg_mlc.c (GC_describe_type_fns): Ditto. + * dyn_load.c (GC_FirstDLOpenedLinkMap, + GC_register_dynlib_callback, GC_dyld_sections, + GC_dyld_name_for_hdr, GC_dyld_image_add, GC_dyld_image_remove): + Ditto. + * malloc.c (GC_libpthread_start, GC_libpthread_end, + GC_libld_start, GC_libld_end): Ditto. + * mark_rts.c (GC_remove_root_at_pos, GC_rebuild_root_index): + Ditto. + * os_dep.c (GC_gww_read_dirty, GC_gww_page_was_dirty, + GC_gww_page_was_ever_dirty, GC_mprotect_thread_notify, + GC_mprotect_thread_reply, GC_mprotect_thread, GC_darwin_sigbus, + GC_forward_exception): Ditto. + * pthread_support.c (GC_syms_initialized): Ditto. + * typd_mlc.c (GC_push_typed_structures_proc): Ditto. + * win32_threads.c (GC_win32_dll_threads, + GC_register_my_thread_inner, GC_lookup_pthread, GC_get_stack_min, + GC_waitForSingleObjectInfinite): Ditto. + * darwin_stop_world.c (GC_use_mach_handler_thread, + GC_use_mach_handler_thread, GC_mach_threads_count): Replace + "static" with "STATIC" and add zero initializer. + * os_dep.c (GC_task_self, GC_ports, GC_mprotect_state, + GC_sigbus_count): Ditto. + * headers.c (free_hdr): Replace "static" with GC_INLINE. + * misc.c (GC_tmp): Rename static variable to fwrite_gc_res. + * os_dep.c (memory): Rename static variable to ecos_gc_memory. + * os_dep.c (async_set_pht_entry_from_index): Make static (for + MPROTECT_VDB case). + * pthread_support.c (GC_real_pthread_create, + GC_real_pthread_sigmask, GC_real_pthread_join, + GC_real_pthread_detach, GC_init_real_syms): Use REAL_FUNC() macro + for static GC_real_XXX symbols. + * win32_threads.c (GC_may_be_in_stack): Remove "GC_" prefix. + 2009-10-17 Ivan Maidanski * alloc.c (GC_never_stop_func, GC_check_fl_marks, diff --git a/alloc.c b/alloc.c index e953a0a2c..2ceed26b8 100644 --- a/alloc.c +++ b/alloc.c @@ -81,7 +81,7 @@ STATIC GC_bool GC_need_full_gc = FALSE; STATIC word GC_used_heap_size_after_full = 0; -char * GC_copyright[] = +char * const GC_copyright[] = {"Copyright 1988,1989 Hans-J. Boehm and Alan J. Demers ", "Copyright (c) 1991-1995 by Xerox Corporation. All rights reserved. ", "Copyright (c) 1996-1998 by Silicon Graphics. All rights reserved. ", @@ -279,7 +279,7 @@ STATIC void GC_clear_a_few_frames(void) /* Heap size at which we need a collection to avoid expanding past */ /* limits used by blacklisting. */ -static word GC_collect_at_heapsize = (word)(-1); +STATIC word GC_collect_at_heapsize = (word)(-1); /* Have we allocated enough to amortize a collection? */ GC_bool GC_should_collect(void) diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 90c7bda8e..edd707f22 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -412,11 +412,11 @@ void GC_push_all_stacks(void) } #endif /* !DARWIN_DONT_PARSE_STACK */ -static mach_port_t GC_mach_handler_thread; -static int GC_use_mach_handler_thread = 0; +STATIC mach_port_t GC_mach_handler_thread = 0; +STATIC int GC_use_mach_handler_thread = 0; static struct GC_mach_thread GC_mach_threads[THREAD_TABLE_SZ]; -static int GC_mach_threads_count; +STATIC int GC_mach_threads_count = 0; void GC_stop_init(void) { diff --git a/dbg_mlc.c b/dbg_mlc.c index 75426da31..96a64b735 100644 --- a/dbg_mlc.c +++ b/dbg_mlc.c @@ -329,7 +329,7 @@ STATIC ptr_t GC_check_annotated_obj(oh *ohdr) } #endif /* !SHORT_DBG_HDRS */ -static GC_describe_type_fn GC_describe_type_fns[MAXOBJKINDS] = {0}; +STATIC GC_describe_type_fn GC_describe_type_fns[MAXOBJKINDS] = {0}; GC_API void GC_CALL GC_register_describe_type_fn(int kind, GC_describe_type_fn fn) diff --git a/dyn_load.c b/dyn_load.c index 93db044f3..469d9d169 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -122,7 +122,7 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; Elf32_Dyn _DYNAMIC; #endif -static struct link_map * +STATIC struct link_map * GC_FirstDLOpenedLinkMap(void) { extern ElfW(Dyn) _DYNAMIC; @@ -420,8 +420,8 @@ static int n_load_segs; # endif /* PT_GNU_RELRO */ -static int GC_register_dynlib_callback(struct dl_phdr_info * info, - size_t size, void * ptr) +STATIC int GC_register_dynlib_callback(struct dl_phdr_info * info, + size_t size, void * ptr) { const ElfW(Phdr) * p; ptr_t start, end; @@ -584,7 +584,7 @@ GC_bool GC_register_main_static_data(void) #endif extern ElfW(Dyn) _DYNAMIC[]; -static struct link_map * +STATIC struct link_map * GC_FirstDLOpenedLinkMap(void) { ElfW(Dyn) *dp; @@ -1145,7 +1145,7 @@ void GC_register_dynamic_libraries(void) /*#define DARWIN_DEBUG*/ -const static struct { +STATIC const struct { const char *seg; const char *sect; } GC_dyld_sections[] = { @@ -1154,7 +1154,7 @@ const static struct { { SEG_DATA, SECT_COMMON } }; -static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) +STATIC const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) { unsigned long i, c; c = _dyld_image_count(); @@ -1165,7 +1165,7 @@ static const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) } /* This should never be called by a thread holding the lock */ -static void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide) +STATIC void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide) { unsigned long start,end,i; const struct GC_MACH_SECTION *sec; @@ -1201,7 +1201,7 @@ static void GC_dyld_image_add(const struct GC_MACH_HEADER *hdr, intptr_t slide) } /* This should never be called by a thread holding the lock */ -static void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr, +STATIC void GC_dyld_image_remove(const struct GC_MACH_HEADER *hdr, intptr_t slide) { unsigned long start,end,i; diff --git a/headers.c b/headers.c index 3cf8ad4b2..82a60f567 100644 --- a/headers.c +++ b/headers.c @@ -178,7 +178,7 @@ static hdr * alloc_hdr(void) return(result); } -static void free_hdr(hdr * hhdr) +GC_INLINE void free_hdr(hdr * hhdr) { hhdr -> hb_next = (struct hblk *) hdr_free_list; hdr_free_list = hhdr; diff --git a/malloc.c b/malloc.c index e8d397c48..cf330a896 100644 --- a/malloc.c +++ b/malloc.c @@ -323,10 +323,10 @@ void * malloc(size_t lb) } #if defined(GC_LINUX_THREADS) /* && !defined(USE_PROC_FOR_LIBRARIES) */ - static ptr_t GC_libpthread_start = 0; - static ptr_t GC_libpthread_end = 0; - static ptr_t GC_libld_start = 0; - static ptr_t GC_libld_end = 0; + STATIC ptr_t GC_libpthread_start = 0; + STATIC ptr_t GC_libpthread_end = 0; + STATIC ptr_t GC_libld_start = 0; + STATIC ptr_t GC_libld_end = 0; GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp); /* From os_dep.c */ diff --git a/mark_rts.c b/mark_rts.c index 0dd25ad2d..69f7fdbe7 100644 --- a/mark_rts.c +++ b/mark_rts.c @@ -240,7 +240,7 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp) static GC_bool roots_were_cleared = FALSE; -GC_API void GC_CALL GC_clear_roots (void) +GC_API void GC_CALL GC_clear_roots(void) { DCL_LOCK_STATE; @@ -259,7 +259,7 @@ GC_API void GC_CALL GC_clear_roots (void) } /* Internal use only; lock held. */ -static void GC_remove_root_at_pos(int i) +STATIC void GC_remove_root_at_pos(int i) { GC_root_size -= (GC_static_roots[i].r_end - GC_static_roots[i].r_start); GC_static_roots[i].r_start = GC_static_roots[n_root_sets-1].r_start; @@ -269,14 +269,14 @@ static void GC_remove_root_at_pos(int i) } #if !defined(MSWIN32) && !defined(MSWINCE) -static void GC_rebuild_root_index(void) -{ + STATIC void GC_rebuild_root_index(void) + { int i; for (i = 0; i < RT_SIZE; i++) GC_root_index[i] = 0; for (i = 0; i < n_root_sets; i++) add_roots_to_index(GC_static_roots + i); -} + } #endif #if defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \ diff --git a/misc.c b/misc.c index 49c53cd05..35e61a283 100644 --- a/misc.c +++ b/misc.c @@ -845,7 +845,7 @@ GC_API void GC_CALL GC_init(void) /* Convince lint that some things are used */ # ifdef LINT { - extern char * GC_copyright[]; + extern char * const GC_copyright[]; GC_noop(GC_copyright, GC_find_header, GC_push_one, GC_call_with_alloc_lock, GC_read, GC_dont_expand, @@ -1028,7 +1028,6 @@ GC_API void GC_CALL GC_enable_incremental(void) STATIC FILE * GC_stdout = NULL; STATIC FILE * GC_stderr = NULL; STATIC FILE * GC_log = NULL; -static int GC_tmp; /* Should really be local ... */ STATIC void GC_set_files(void) { @@ -1102,9 +1101,10 @@ STATIC int GC_write(int fd, const char *buf, size_t len) # define WRITE(f, buf, len) GC_write(buf, len) #else # if defined(OS2) || defined(MACOS) + static int fwrite_gc_res; /* Should really be local ... */ # define WRITE(f, buf, len) (GC_set_files(), \ - GC_tmp = fwrite((buf), 1, (len), (f)), \ - fflush(f), GC_tmp) + fwrite_gc_res = fwrite((buf), 1, (len), (f)), \ + fflush(f), fwrite_gc_res) # else # define WRITE(f, buf, len) GC_write((f), (buf), (len)) # endif diff --git a/os_dep.c b/os_dep.c index e51bacd02..fa4a8c973 100644 --- a/os_dep.c +++ b/os_dep.c @@ -482,8 +482,8 @@ static ptr_t backing_store_base_from_proc(void) /* compatible with ECOS early releases. Later releases use a more */ /* sophisticated means of allocating memory than this simple static */ /* allocator, but this method is at least bound to work. */ -static char memory[ECOS_GC_MEMORY_SIZE]; -static char *brk = memory; +static char ecos_gc_memory[ECOS_GC_MEMORY_SIZE]; +static char *brk = ecos_gc_memory; static void *tiny_sbrk(ptrdiff_t increment) { @@ -491,7 +491,7 @@ static void *tiny_sbrk(ptrdiff_t increment) brk += increment; - if (brk > memory + sizeof memory) + if (brk > ecos_gc_memory + sizeof(ecos_gc_memory)) { brk -= increment; return NULL; @@ -2362,7 +2362,7 @@ STATIC void GC_or_pages(page_hash_table pht1, page_hash_table pht2) # endif # ifdef MPROTECT_VDB - static void GC_gww_read_dirty(void) + STATIC void GC_gww_read_dirty(void) # else void GC_read_dirty(void) # endif @@ -2440,7 +2440,7 @@ STATIC void GC_or_pages(page_hash_table pht1, page_hash_table pht2) } # ifdef MPROTECT_VDB - static GC_bool GC_gww_page_was_dirty(struct hblk * h) + STATIC GC_bool GC_gww_page_was_dirty(struct hblk * h) # else GC_bool GC_page_was_dirty(struct hblk * h) # endif @@ -2450,7 +2450,7 @@ STATIC void GC_or_pages(page_hash_table pht1, page_hash_table pht2) } # ifdef MPROTECT_VDB - static GC_bool GC_gww_page_was_ever_dirty(struct hblk * h) + STATIC GC_bool GC_gww_page_was_ever_dirty(struct hblk * h) # else GC_bool GC_page_was_ever_dirty(struct hblk * h) # endif @@ -2625,7 +2625,7 @@ void GC_remove_protection(struct hblk *h, word nblocks, GC_bool is_ptrfree) /* Using vm_protect (mach syscall) over mprotect (BSD syscall) seems to decrease the likelihood of some of the problems described below. */ # include - static mach_port_t GC_task_self; + STATIC mach_port_t GC_task_self = 0; # define PROTECT(addr,len) \ if(vm_protect(GC_task_self,(vm_address_t)(addr),(vm_size_t)(len), \ FALSE,VM_PROT_READ) != KERN_SUCCESS) { \ @@ -2698,8 +2698,12 @@ STATIC GC_bool GC_old_segv_handler_used_si = FALSE; /* correctly. */ #ifdef AO_HAVE_test_and_set_acquire volatile AO_TS_t GC_fault_handler_lock = 0; - void async_set_pht_entry_from_index(volatile page_hash_table db, size_t index) { - while (AO_test_and_set_acquire(&GC_fault_handler_lock) == AO_TS_SET) {} + static void async_set_pht_entry_from_index(volatile page_hash_table db, + size_t index) + { + while (AO_test_and_set_acquire(&GC_fault_handler_lock) == AO_TS_SET) { + /* empty */ + } /* Could also revert to set_pht_entry_from_index_safe if initial */ /* GC_test_and_set fails. */ set_pht_entry_from_index(db, index); @@ -2716,7 +2720,9 @@ STATIC GC_bool GC_old_segv_handler_used_si = FALSE; /* leave it this way while we think of something better, or support */ /* GC_test_and_set on the remaining platforms. */ static volatile word currently_updating = 0; - void async_set_pht_entry_from_index(volatile page_hash_table db, size_t index) { + static void async_set_pht_entry_from_index(volatile page_hash_table db, + size_t index) + { unsigned int update_dummy; currently_updating = (word)(&update_dummy); set_pht_entry_from_index(db, index); @@ -3533,12 +3539,12 @@ static struct { thread_state_flavor_t flavors[MAX_EXCEPTION_PORTS]; } GC_old_exc_ports; -static struct { +STATIC struct { mach_port_t exception; -#if defined(THREADS) - mach_port_t reply; -#endif -} GC_ports; +# if defined(THREADS) + mach_port_t reply; +# endif +} GC_ports = {0}; typedef struct { mach_msg_header_t head; @@ -3559,10 +3565,10 @@ typedef enum { #if defined(THREADS) -static GC_mprotect_state_t GC_mprotect_state; +STATIC GC_mprotect_state_t GC_mprotect_state = 0; /* The following should ONLY be called when the world is stopped */ -static void GC_mprotect_thread_notify(mach_msg_id_t id) +STATIC void GC_mprotect_thread_notify(mach_msg_id_t id) { struct { @@ -3588,9 +3594,8 @@ static void GC_mprotect_thread_notify(mach_msg_id_t id) } /* Should only be called by the mprotect thread */ -static void GC_mprotect_thread_reply(void) +STATIC void GC_mprotect_thread_reply(void) { - GC_msg_t msg; mach_msg_return_t r; /* remote, local */ @@ -3620,7 +3625,7 @@ void GC_mprotect_resume(void) #define GC_mprotect_state GC_MP_NORMAL #endif -static void *GC_mprotect_thread(void *arg) +STATIC void *GC_mprotect_thread(void *arg) { mach_msg_return_t r; /* These two structures contain some private kernel data. We don't need to @@ -3713,9 +3718,9 @@ static void *GC_mprotect_thread(void *arg) /* Updates to this aren't atomic, but the SIGBUSs seem pretty rare. Even if this doesn't get updated property, it isn't really a problem */ -static int GC_sigbus_count; +STATIC int GC_sigbus_count = 0; -static void GC_darwin_sigbus(int num, siginfo_t *sip, void *context) +STATIC void GC_darwin_sigbus(int num, siginfo_t *sip, void *context) { if(num != SIGBUS) ABORT("Got a non-sigbus signal in the sigbus handler"); @@ -3815,7 +3820,7 @@ void GC_dirty_init(void) /* The source code for Apple's GDB was used as a reference for the exception forwarding code. This code is similar to be GDB code only because there is only one way to do it. */ -static kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task, +STATIC kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task, exception_type_t exception, exception_data_t data, mach_msg_type_number_t data_count) diff --git a/pthread_support.c b/pthread_support.c index 8294f7ccd..fc9aae681 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -129,13 +129,13 @@ unsigned long GC_lock_holder = NO_THREAD; /* FIXME: Needs work for DARWIN and True64 (OSF1) */ typedef int (* GC_pthread_create_t)(pthread_t *, const pthread_attr_t *, void * (*)(void *), void *); - static GC_pthread_create_t GC_real_pthread_create; + static GC_pthread_create_t REAL_FUNC(pthread_create); typedef int (* GC_pthread_sigmask_t)(int, const sigset_t *, sigset_t *); - static GC_pthread_sigmask_t GC_real_pthread_sigmask; + static GC_pthread_sigmask_t REAL_FUNC(pthread_sigmask); typedef int (* GC_pthread_join_t)(pthread_t, void **); - static GC_pthread_join_t GC_real_pthread_join; + static GC_pthread_join_t REAL_FUNC(pthread_join); typedef int (* GC_pthread_detach_t)(pthread_t); - static GC_pthread_detach_t GC_real_pthread_detach; + static GC_pthread_detach_t REAL_FUNC(pthread_detach); # else # define WRAP_FUNC(f) GC_##f # if !defined(GC_DGUX386_THREADS) @@ -174,7 +174,7 @@ unsigned long GC_lock_holder = NO_THREAD; #endif /* Linker-based interception. */ #ifdef GC_USE_DLOPEN_WRAP - static GC_bool GC_syms_initialized = FALSE; + STATIC GC_bool GC_syms_initialized = FALSE; STATIC void GC_init_real_syms(void) { @@ -199,13 +199,13 @@ unsigned long GC_lock_holder = NO_THREAD; } if (NULL == dl_handle) ABORT("Couldn't open libpthread\n"); # endif - GC_real_pthread_create = (GC_pthread_create_t) + REAL_FUNC(pthread_create) = (GC_pthread_create_t) dlsym(dl_handle, "pthread_create"); - GC_real_pthread_sigmask = (GC_pthread_sigmask_t) + REAL_FUNC(pthread_sigmask) = (GC_pthread_sigmask_t) dlsym(dl_handle, "pthread_sigmask"); - GC_real_pthread_join = (GC_pthread_join_t) + REAL_FUNC(pthread_join) = (GC_pthread_join_t) dlsym(dl_handle, "pthread_join"); - GC_real_pthread_detach = (GC_pthread_detach_t) + REAL_FUNC(pthread_detach) = (GC_pthread_detach_t) dlsym(dl_handle, "pthread_detach"); GC_syms_initialized = TRUE; } diff --git a/typd_mlc.c b/typd_mlc.c index ce49419d9..759ff82db 100644 --- a/typd_mlc.c +++ b/typd_mlc.c @@ -100,9 +100,10 @@ STATIC size_t GC_avail_descr = 0; /* Next available slot. */ STATIC int GC_typed_mark_proc_index = 0; /* Indices of my mark */ STATIC int GC_array_mark_proc_index = 0; /* procedures. */ -static void GC_push_typed_structures_proc (void) +STATIC void GC_push_typed_structures_proc(void) { - GC_push_all((ptr_t)&GC_ext_descriptors, (ptr_t)&GC_ext_descriptors + sizeof(word)); + GC_push_all((ptr_t)&GC_ext_descriptors, + (ptr_t)&GC_ext_descriptors + sizeof(word)); } /* Add a multiword bitmap to GC_ext_descriptors arrays. Return */ diff --git a/win32_threads.c b/win32_threads.c index 6b447ab36..6260e34a3 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -100,7 +100,7 @@ && !defined(THREAD_LOCAL_ALLOC) && !defined(GC_PTHREADS) # include "atomic_ops.h" - static GC_bool GC_win32_dll_threads = FALSE; + STATIC GC_bool GC_win32_dll_threads = FALSE; /* This code operates in two distinct modes, depending on */ /* the setting of GC_win32_dll_threads. If */ /* GC_win32_dll_threads is set, all threads in the process */ @@ -371,7 +371,7 @@ GC_bool GC_in_thread_creation = FALSE; /* Protected by allocation lock. */ * If GC_win32_dll_threads is not set, we already hold the allocation lock, * except possibly during single-threaded start-up code. */ -static GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, +STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb, DWORD thread_id) { GC_vthread me; @@ -844,7 +844,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, /* have not yet terminated or are still joinable, and */ /* cannot be concurrently terminated. */ /* Assumes we do NOT hold the allocation lock. */ - static GC_thread GC_lookup_pthread(pthread_t id) + STATIC GC_thread GC_lookup_pthread(pthread_t id) { # ifndef GC_NO_DLLMAIN if (GC_win32_dll_threads) { @@ -1099,7 +1099,7 @@ static MEMORY_BASIC_INFORMATION last_info; /* lowest address (i.e. stack top). */ /* S must be a mapped address inside the region, NOT the first */ /* unmapped address. */ -static ptr_t GC_get_stack_min(ptr_t s) +STATIC ptr_t GC_get_stack_min(ptr_t s) { ptr_t bottom; @@ -1119,7 +1119,7 @@ static ptr_t GC_get_stack_min(ptr_t s) /* Return true if the page at s has protections appropriate */ /* for a stack page. */ -static GC_bool GC_may_be_in_stack(ptr_t s) +static GC_bool may_be_in_stack(ptr_t s) { GC_ASSERT(I_HOLD_LOCK()); if (s != last_address) { @@ -1225,9 +1225,9 @@ STATIC void GC_push_stack_for(GC_thread thread) stack_min = sp; } else { /* In the current thread it is always safe to use sp value. */ - if (GC_may_be_in_stack(thread -> id == me && - sp < thread -> last_stack_min ? - sp : thread -> last_stack_min)) { + if (may_be_in_stack(thread -> id == me && + sp < thread -> last_stack_min ? + sp : thread -> last_stack_min)) { stack_min = last_info.BaseAddress; /* Do not probe rest of the stack if sp is correct. */ if (sp < stack_min || sp >= thread->stack_base) @@ -1420,7 +1420,7 @@ void GC_get_next_stack(char *start, char *limit, } # endif - if (current_min > limit && !GC_may_be_in_stack(limit)) { + if (current_min > limit && !may_be_in_stack(limit)) { /* Skip the rest since the memory region at limit address is */ /* not a stack (so the lowest address of the found stack would */ /* be above the limit value anyway). */ @@ -1431,7 +1431,7 @@ void GC_get_next_stack(char *start, char *limit, /* Get the minimum address of the found stack by probing its memory */ /* region starting from the recent known minimum (if set). */ if (*plast_stack_min == ADDR_LIMIT - || !GC_may_be_in_stack(*plast_stack_min)) { + || !may_be_in_stack(*plast_stack_min)) { /* Unsafe to start from last_stack_min value. */ *lo = GC_get_stack_min(current_min); } else { @@ -2126,7 +2126,7 @@ void GC_get_next_stack(char *start, char *limit, args->lpCmdLine, args->nShowCmd); } - static void * GC_waitForSingleObjectInfinite(void * handle) + STATIC void * GC_waitForSingleObjectInfinite(void * handle) { return (void *)(word)WaitForSingleObject((HANDLE)handle, INFINITE); }