]> granicus.if.org Git - gc/commitdiff
2011-05-31 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Tue, 31 May 2011 15:27:11 +0000 (15:27 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:07:00 +0000 (21:07 +0400)
* alloc.c (GC_add_current_malloc_heap, GC_build_back_graph,
GC_traverse_back_graph): Move prototype to gc_priv.h.
* checksums.c (GC_page_was_ever_dirty): Ditto.
* dbg_mlc.c (GC_default_print_heap_obj_proc): Ditto.
* dyn_load.c (GC_parse_map_entry, GC_get_maps,
GC_segment_is_thread_stack, GC_roots_present, GC_is_heap_base,
GC_get_next_stack): Ditto.
* finalize.c (GC_reset_finalizer_nested,
GC_check_finalizer_nested): Ditto.
* gcj_mlc.c (GC_start_debugging, GC_store_debug_info): Ditto.
* malloc.c (GC_extend_size_map, GC_text_mapping): Ditto.
* mark_rts.c (GC_mark_thread_local_free_lists): Ditto.
* misc.c (GC_register_main_static_data, GC_init_win32,
GC_setpagesize, GC_init_linux_data_start,
GC_set_and_save_fault_handler, GC_init_dyld, GC_init_netbsd_elf,
GC_initialize_offsets, GC_bl_init, GC_do_blocking_inner,
GC_bl_init_no_interiors): Ditto.
* os_dep.c (GC_greatest_stack_base_below, GC_push_all_stacks):
Ditto.
* reclaim.c (GC_check_leaked): Ditto.
* win32_threads.c (GC_gww_dirty_init): Ditto.
* darwin_stop_world.c (GC_is_mach_marker, GC_mprotect_stop,
GC_mprotect_resume): Move prototype to darwin_stop_world.h.
* pthread_support.c (GC_FindTopOfStack): Ditto.
* dyn_load.c (GC_cond_add_roots): Merge adjacent definitions.
* mark.c (GC_page_was_ever_dirty): Remove (as already declared).
* mark_rts.c (GC_roots_present): Change return type to void
pointer (to match the prototype); return NULL instead of FALSE.
* mark_rts.c (GC_add_roots_inner): Cast GC_roots_present() result.
* os_dep.c (NEED_PROC_MAPS): Move definition to gcconfig.h.
* os_dep.c (GC_write_fault_handler): Make STATIC.
* os_dep.c (GC_set_write_fault_handler): New function (only if
GC_WIN32_THREADS).
* pthread_start.c (GC_start_rtn_prepare_thread,
GC_thread_exit_proc): Move prototype to pthread_support.h.
* pthread_support.c (GC_nacl_initialize_gc_thread,
GC_nacl_shutdown_gc_thread, GC_unblock_gc_signals):
Ditto.
* pthread_support.c (GC_stop_init): Move prototype to
pthread_stop_world.h.
* thread_local_alloc.c (GC_check_tls_for): Reformat comment.
* win32_threads.c (GC_write_fault_handler): Remove prototype.
* win32_threads.c (GC_register_my_thread_inner): Call
GC_set_write_fault_handler instead of SetUnhandledExceptionFilter
(only if MPROTECT_VDB).
* doc/README.win32: Add information about DMC.
* include/private/gc_priv.h (GC_set_write_fault_handler): New
prototype (only if GC_WIN32_THREADS and MPROTECT_VDB).

24 files changed:
ChangeLog
alloc.c
checksums.c
darwin_stop_world.c
dbg_mlc.c
doc/README.win32
dyn_load.c
finalize.c
gcj_mlc.c
include/private/darwin_stop_world.h
include/private/gc_priv.h
include/private/gcconfig.h
include/private/pthread_stop_world.h
include/private/pthread_support.h
malloc.c
mark.c
mark_rts.c
misc.c
os_dep.c
pthread_start.c
pthread_support.c
reclaim.c
thread_local_alloc.c
win32_threads.c

index cbba25277e372433259681a0481b8b096a614263..a67cde62acb217cbc97852910dfcbe19cabddbb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,54 @@
+2011-05-31  Ivan Maidanski  <ivmai@mail.ru>
+
+       * alloc.c (GC_add_current_malloc_heap, GC_build_back_graph,
+       GC_traverse_back_graph): Move prototype to gc_priv.h.
+       * checksums.c (GC_page_was_ever_dirty): Ditto.
+       * dbg_mlc.c (GC_default_print_heap_obj_proc): Ditto.
+       * dyn_load.c (GC_parse_map_entry, GC_get_maps,
+       GC_segment_is_thread_stack, GC_roots_present, GC_is_heap_base,
+       GC_get_next_stack): Ditto.
+       * finalize.c (GC_reset_finalizer_nested,
+       GC_check_finalizer_nested): Ditto.
+       * gcj_mlc.c (GC_start_debugging, GC_store_debug_info): Ditto.
+       * malloc.c (GC_extend_size_map, GC_text_mapping): Ditto.
+       * mark_rts.c (GC_mark_thread_local_free_lists): Ditto.
+       * misc.c (GC_register_main_static_data, GC_init_win32,
+       GC_setpagesize, GC_init_linux_data_start,
+       GC_set_and_save_fault_handler, GC_init_dyld, GC_init_netbsd_elf,
+       GC_initialize_offsets, GC_bl_init, GC_do_blocking_inner,
+       GC_bl_init_no_interiors): Ditto.
+       * os_dep.c (GC_greatest_stack_base_below, GC_push_all_stacks):
+       Ditto.
+       * reclaim.c (GC_check_leaked): Ditto.
+       * win32_threads.c (GC_gww_dirty_init): Ditto.
+       * darwin_stop_world.c (GC_is_mach_marker, GC_mprotect_stop,
+       GC_mprotect_resume): Move prototype to darwin_stop_world.h.
+       * pthread_support.c (GC_FindTopOfStack): Ditto.
+       * dyn_load.c (GC_cond_add_roots): Merge adjacent definitions.
+       * mark.c (GC_page_was_ever_dirty): Remove (as already declared).
+       * mark_rts.c (GC_roots_present): Change return type to void
+       pointer (to match the prototype); return NULL instead of FALSE.
+       * mark_rts.c (GC_add_roots_inner): Cast GC_roots_present() result.
+       * os_dep.c (NEED_PROC_MAPS): Move definition to gcconfig.h.
+       * os_dep.c (GC_write_fault_handler): Make STATIC.
+       * os_dep.c (GC_set_write_fault_handler): New function (only if
+       GC_WIN32_THREADS).
+       * pthread_start.c (GC_start_rtn_prepare_thread,
+       GC_thread_exit_proc): Move prototype to pthread_support.h.
+       * pthread_support.c (GC_nacl_initialize_gc_thread,
+       GC_nacl_shutdown_gc_thread, GC_unblock_gc_signals):
+       Ditto.
+       * pthread_support.c (GC_stop_init): Move prototype to
+       pthread_stop_world.h.
+       * thread_local_alloc.c (GC_check_tls_for): Reformat comment.
+       * win32_threads.c (GC_write_fault_handler): Remove prototype.
+       * win32_threads.c (GC_register_my_thread_inner): Call
+       GC_set_write_fault_handler instead of SetUnhandledExceptionFilter
+       (only if MPROTECT_VDB).
+       * doc/README.win32: Add information about DMC.
+       * include/private/gc_priv.h (GC_set_write_fault_handler): New
+       prototype (only if GC_WIN32_THREADS and MPROTECT_VDB).
+
 2011-05-31  Ivan Maidanski  <ivmai@mail.ru>
 
        * misc.c (vsnprintf): Redirect to vsprintf() if NO_VSNPRINTF.
diff --git a/alloc.c b/alloc.c
index 592535217c41fdd75bd72b953f5fb3f8bb6e5e40..a41cb1db05b1507f3b50cfa472829691d4e694ea 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -557,14 +557,6 @@ GC_API int GC_CALL GC_collect_a_little(void)
     return(result);
 }
 
-#if !defined(REDIRECT_MALLOC) && (defined(MSWIN32) || defined(MSWINCE))
-  GC_INNER void GC_add_current_malloc_heap(void);
-#endif
-
-#ifdef MAKE_BACK_GRAPH
-  GC_INNER void GC_build_back_graph(void);
-#endif
-
 #ifndef SMALL_CONFIG
   /* Variables for world-stop average delay time statistic computation. */
   /* "divisor" is incremented every world-stop and halved when reached  */
@@ -788,10 +780,6 @@ STATIC void GC_clear_fl_marks(ptr_t q)
   void GC_check_tls(void);
 #endif
 
-#ifdef MAKE_BACK_GRAPH
-  GC_INNER void GC_traverse_back_graph(void);
-#endif
-
 /* Finish up a collection.  Assumes mark bits are consistent, lock is   */
 /* held, but the world is otherwise running.                            */
 STATIC void GC_finish_collection(void)
index b93bcf985a90f231a1a93dd1598e856f48fd4cba..3f2af93852c394de5fc298d097fa517fe55a7a27 100644 (file)
@@ -97,8 +97,6 @@ int GC_n_changed_errors = 0;
 int GC_n_clean = 0;
 int GC_n_dirty = 0;
 
-GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk * h);
-
 STATIC void GC_update_check_page(struct hblk *h, int index)
 {
     page_entry *pe = GC_sums + index;
index 4fcd7bac36eb0d3716e69811b62b454ae9772186..f05dc685a1fe5b304d34d80a53f5e81df713285c 100644 (file)
@@ -352,10 +352,6 @@ GC_INNER void GC_push_all_stacks(void)
   STATIC int GC_mach_threads_count = 0;
   /* FIXME: it is better to implement GC_mach_threads as a hash set.  */
 
-# ifdef PARALLEL_MARK
-    GC_INNER GC_bool GC_is_mach_marker(thread_act_t thread);
-# endif
-
 /* returns true if there's a thread in act_list that wasn't in old_list */
 STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
                                       thread_act_array_t old_list,
@@ -460,11 +456,6 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
 
 #endif /* !GC_NO_THREADS_DISCOVERY */
 
-#ifdef MPROTECT_VDB
-  GC_INNER void GC_mprotect_stop(void);
-  GC_INNER void GC_mprotect_resume(void);
-#endif
-
 /* Caller holds allocation lock.        */
 GC_INNER void GC_stop_world(void)
 {
index c2820602f93bcd6714ea6d80b10b02ea5d2e92a7..6f51c0303abd65794895a2b6430fff8d5fda9326 100644 (file)
--- a/dbg_mlc.c
+++ b/dbg_mlc.c
@@ -22,8 +22,6 @@
 #endif
 #include <string.h>
 
-GC_INNER void GC_default_print_heap_obj_proc(ptr_t p);
-
 #ifndef SHORT_DBG_HDRS
   /* Check whether object with base pointer p has debugging info. */
   /* p is assumed to point to a legitimate object in our part     */
index 44656faeccc822551db69168ef6fb0a222bc97b3..4a030cf358138e360d9b3aa4c9b1d57cfee06aab 100644 (file)
@@ -107,6 +107,12 @@ version, change the line near the top.  By default, it does not
 require the assembler.  If you do have the assembler, I recommend
 removing the -DUSE_GENERIC.
 
+Digital Mars compiler
+---------------------
+
+Same as MS Visual C++ but might require
+-DAO_OLD_STYLE_INTERLOCKED_COMPARE_EXCHANGE option to compile with the
+parallel marker enabled.
 
 Watcom compiler
 ---------------
index 7cdceffb0f44f012ef3317c874947948e251d1ce..563550db72dee5e0c1f448d328f992282051a653 100644 (file)
@@ -239,11 +239,6 @@ GC_INNER void GC_register_dynamic_libraries(void)
 
 #define MAPS_BUF_SIZE (32*1024)
 
-GC_INNER char *GC_parse_map_entry(char *buf_ptr, ptr_t *start, ptr_t *end,
-                                  char **prot, unsigned int *maj_dev,
-                                  char **mapping_name);
-GC_INNER char *GC_get_maps(void); /* from os_dep.c */
-
 /* Sort an array of HeapSects by start address.                         */
 /* Unfortunately at least some versions of                              */
 /* Linux qsort end up calling malloc by way of sysconf, and hence can't */
@@ -274,10 +269,6 @@ static void sort_heap_sects(struct HeapSect *base, size_t number_of_elements)
     }
 }
 
-#ifdef THREADS
-  GC_INNER GC_bool GC_segment_is_thread_stack(ptr_t lo, ptr_t hi);
-#endif
-
 STATIC word GC_register_map_entries(char *maps)
 {
     char *prot;
@@ -725,10 +716,6 @@ GC_INNER void GC_register_dynamic_libraries(void)
 # define IRIX6
 #endif
 
-GC_INNER void * GC_roots_present(ptr_t);
-        /* The type is a lie, since the real type doesn't make sense here, */
-        /* and we only test for NULL.                                      */
-
 /* We use /proc to track down all parts of the address space that are   */
 /* mapped by the process, and throw out regions we know we shouldn't    */
 /* worry about.  This may also work under other SVR4 variants.          */
@@ -854,15 +841,9 @@ GC_INNER void GC_register_dynamic_libraries(void)
 
   /* We traverse the entire address space and register all segments     */
   /* that could possibly have been written to.                          */
-
-  GC_INNER GC_bool GC_is_heap_base(ptr_t p);
-
-# ifdef GC_WIN32_THREADS
-    GC_INNER void GC_get_next_stack(char *start, char * limit, char **lo,
-                                    char **hi);
-
-    STATIC void GC_cond_add_roots(char *base, char * limit)
-    {
+  STATIC void GC_cond_add_roots(char *base, char * limit)
+  {
+#   ifdef GC_WIN32_THREADS
       char * curr_base = base;
       char * next_stack_lo;
       char * next_stack_hi;
@@ -876,10 +857,7 @@ GC_INNER void GC_register_dynamic_libraries(void)
           curr_base = next_stack_hi;
       }
       if (curr_base < limit) GC_add_roots_inner(curr_base, limit, TRUE);
-    }
-# else
-    STATIC void GC_cond_add_roots(char *base, char * limit)
-    {
+#   else
       char dummy;
       char * stack_top
          = (char *) ((word)(&dummy) & ~(GC_sysinfo.dwAllocationGranularity-1));
@@ -889,8 +867,8 @@ GC_INNER void GC_register_dynamic_libraries(void)
           return;
       }
       GC_add_roots_inner(base, limit, TRUE);
-    }
-# endif
+#   endif
+  }
 
 #ifdef DYNAMIC_LOADING
   /* GC_register_main_static_data is not needed unless DYNAMIC_LOADING. */
index c10d854379d1b06987b8f4da18605ac427703837..40c725a97702be05cb352927d6b65ce41f44c0c2 100644 (file)
@@ -485,18 +485,13 @@ GC_API void GC_CALL GC_register_finalizer_unreachable(void * obj,
       }
     }
   }
-#endif
+#endif /* !NO_DEBUGGING */
 
 #ifndef SMALL_CONFIG
   STATIC word GC_old_dl_entries = 0; /* for stats printing */
 #endif
 
-#ifdef THREADS
-  /* Defined in pthread_support.c or win32_threads.c.  Called with the  */
-  /* allocation lock held.                                              */
-  GC_INNER void GC_reset_finalizer_nested(void);
-  GC_INNER unsigned char *GC_check_finalizer_nested(void);
-#else
+#ifndef THREADS
   /* Global variables to minimize the level of recursion when a client  */
   /* finalizer allocates memory.                                        */
   STATIC unsigned char GC_finalizer_nested = 0;
index 3c54974cdc584f045b0e610ca8f913ac1736f95e..3467a39649e70645a823e9819dc87c930f80768d 100644 (file)
--- a/gcj_mlc.c
+++ b/gcj_mlc.c
@@ -204,13 +204,6 @@ static void maybe_finalize(void)
     return((void *) op);
 }
 
-GC_INNER void GC_start_debugging(void); /* defined in dbg_mlc.c */
-
-/* Store debugging info into p.  Return displaced pointer.      */
-/* Assumes we don't hold allocation lock.                       */
-GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
-                                   int linenum);
-
 /* Similar to GC_gcj_malloc, but add debug info.  This is allocated     */
 /* with GC_gcj_debug_kind.                                              */
 GC_API void * GC_CALL GC_debug_gcj_malloc(size_t lb,
index ee60114488a0d1dc4f0a71e15403887812e8975b..399304ead07950d935aca25c2d27ae47115d7192 100644 (file)
@@ -30,4 +30,17 @@ struct thread_stop_info {
   ptr_t stack_ptr; /* Valid only when thread is in a "blocked" state.   */
 };
 
+#ifndef DARWIN_DONT_PARSE_STACK
+  GC_INNER ptr_t GC_FindTopOfStack(unsigned long);
+#endif
+
+#ifdef MPROTECT_VDB
+  GC_INNER void GC_mprotect_stop(void);
+  GC_INNER void GC_mprotect_resume(void);
+#endif
+
+#if defined(PARALLEL_MARK) && !defined(GC_NO_THREADS_DISCOVERY)
+  GC_INNER GC_bool GC_is_mach_marker(thread_act_t);
+#endif
+
 #endif
index 8ff8c0fca40146c07932e28a7d8f9a3c6ddd6908..eb40fdcd18207c38d618fb23fe910b30cabf1414 100644 (file)
@@ -1267,8 +1267,10 @@ GC_EXTERN word GC_page_size;
 #if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32)
   struct _SYSTEM_INFO;
   GC_EXTERN struct _SYSTEM_INFO GC_sysinfo;
+  GC_INNER GC_bool GC_is_heap_base(ptr_t p);
 #endif
 
+
 GC_EXTERN word GC_black_list_spacing;
                         /* Average number of bytes between blacklisted  */
                         /* blocks. Approximate.                         */
@@ -1794,6 +1796,7 @@ GC_EXTERN void (*GC_print_heap_obj)(ptr_t p);
                         /* Do not immediately deallocate object on      */
                         /* free() in the leak-finding mode, just mark   */
                         /* it as freed (and deallocate it after GC).    */
+  GC_INNER GC_bool GC_check_leaked(ptr_t base); /* from dbg_mlc.c */
 #endif
 
 GC_EXTERN GC_bool GC_have_errors; /* We saw a smashed or leaked object. */
@@ -2008,6 +2011,7 @@ GC_EXTERN signed_word GC_bytes_found;
 
 #ifdef THREAD_LOCAL_ALLOC
   GC_EXTERN GC_bool GC_world_stopped; /* defined in alloc.c */
+  GC_INNER void GC_mark_thread_local_free_lists(void);
 #endif
 
 #ifdef GC_GCJ_SUPPORT
@@ -2017,6 +2021,106 @@ GC_EXTERN signed_word GC_bytes_found;
   GC_EXTERN ptr_t * GC_gcjobjfreelist;
 #endif
 
+#if defined(GWW_VDB) && defined(MPROTECT_VDB)
+  GC_INNER GC_bool GC_gww_dirty_init(void);
+  /* Defined in os_dep.c.  Returns TRUE if GetWriteWatch is available.  */
+  /* May be called repeatedly.                                          */
+#endif
+
+#if defined(CHECKSUMS) || defined(PROC_VDB)
+  GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk * h);
+                        /* Could the page contain valid heap pointers?  */
+#endif
+
+GC_INNER void GC_default_print_heap_obj_proc(ptr_t p);
+
+GC_INNER void GC_extend_size_map(size_t); /* in misc.c */
+
+GC_INNER void GC_setpagesize(void);
+
+GC_INNER void GC_initialize_offsets(void);      /* defined in obj_map.c */
+
+GC_INNER void GC_bl_init(void);
+GC_INNER void GC_bl_init_no_interiors(void);    /* defined in blacklst.c */
+
+GC_INNER void GC_start_debugging(void); /* defined in dbg_mlc.c */
+
+/* Store debugging info into p.  Return displaced pointer.      */
+/* Assumes we don't hold allocation lock.                       */
+GC_INNER ptr_t GC_store_debug_info(ptr_t p, word sz, const char *str,
+                                   int linenum);
+
+#ifdef REDIRECT_MALLOC
+# ifdef GC_LINUX_THREADS
+    GC_INNER GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp);
+                                                /* from os_dep.c */
+# endif
+#elif defined(MSWIN32) || defined(MSWINCE)
+  GC_INNER void GC_add_current_malloc_heap(void);
+#endif /* !REDIRECT_MALLOC */
+
+#ifdef MAKE_BACK_GRAPH
+  GC_INNER void GC_build_back_graph(void);
+  GC_INNER void GC_traverse_back_graph(void);
+#endif
+
+#ifdef MSWIN32
+  GC_INNER void GC_init_win32(void);
+#endif
+
+#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(CYGWIN32)
+  GC_INNER void * GC_roots_present(ptr_t);
+        /* The type is a lie, since the real type doesn't make sense here, */
+        /* and we only test for NULL.                                      */
+#endif
+
+#ifdef GC_WIN32_THREADS
+  GC_INNER void GC_get_next_stack(char *start, char * limit, char **lo,
+                                  char **hi);
+# ifdef MPROTECT_VDB
+    GC_INNER void GC_set_write_fault_handler(void);
+# endif
+#endif /* GC_WIN32_THREADS */
+
+#ifdef THREADS
+  GC_INNER void GC_reset_finalizer_nested(void);
+  GC_INNER unsigned char *GC_check_finalizer_nested(void);
+  GC_INNER void GC_do_blocking_inner(ptr_t data, void * context);
+  GC_INNER void GC_push_all_stacks(void);
+# ifdef USE_PROC_FOR_LIBRARIES
+    GC_INNER GC_bool GC_segment_is_thread_stack(ptr_t lo, ptr_t hi);
+# endif
+# ifdef IA64
+    GC_INNER ptr_t GC_greatest_stack_base_below(ptr_t bound);
+# endif
+#endif /* THREADS */
+
+#ifdef DYNAMIC_LOADING
+  GC_INNER GC_bool GC_register_main_static_data(void);
+# ifdef DARWIN
+    GC_INNER void GC_init_dyld(void);
+# endif
+#endif /* DYNAMIC_LOADING */
+
+#ifdef SEARCH_FOR_DATA_START
+  GC_INNER void GC_init_linux_data_start(void);
+#endif
+
+#if defined(NETBSD) && defined(__ELF__)
+  GC_INNER void GC_init_netbsd_elf(void);
+#endif
+
+#ifdef UNIX_LIKE
+  GC_INNER void GC_set_and_save_fault_handler(void (*handler)(int));
+#endif
+
+#ifdef NEED_PROC_MAPS
+  GC_INNER char *GC_parse_map_entry(char *buf_ptr, ptr_t *start, ptr_t *end,
+                                    char **prot, unsigned int *maj_dev,
+                                    char **mapping_name);
+  GC_INNER char *GC_get_maps(void); /* from os_dep.c */
+#endif
+
 #ifdef GC_ASSERTIONS
 #  define GC_ASSERT(expr) \
                 if (!(expr)) { \
index bd99e6d0d639b77843c9bbb89cd2a4c25490b167..81c77d65f728736a8c17c9aaee7b328de95f426d 100644 (file)
 # endif
 #endif
 
+#if defined(LINUX) && (defined(USE_PROC_FOR_LIBRARIES) || defined(IA64) \
+                       || !defined(SMALL_CONFIG))
+# define NEED_PROC_MAPS
+#endif
+
 #if defined(LINUX) || defined(HURD) || defined(__GLIBC__)
 # define REGISTER_LIBRARIES_EARLY
   /* We sometimes use dl_iterate_phdr, which may acquire an internal    */
index c883c3c8076b730bad447d29b0c29546a6744fe5..cb67d230b3869a697581c5c090c7f03d2b7adeff 100644 (file)
@@ -39,4 +39,6 @@ struct thread_stop_info {
 #   endif
 };
 
+GC_INNER void GC_stop_init(void);
+
 #endif
index 2b16bd56642d9cbcfd80632d741485e3277cecfc..ba0f69360b12d18aa22977caee2a374a47896323 100644 (file)
@@ -30,7 +30,7 @@
 
 #ifdef THREAD_LOCAL_ALLOC
 # include "thread_local_alloc.h"
-#endif /* THREAD_LOCAL_ALLOC */
+#endif
 
 /* We use the allocation lock to protect thread-related data structures. */
 
@@ -126,9 +126,20 @@ GC_EXTERN GC_bool GC_in_thread_creation;
         /* Only set to TRUE while allocation lock is held.              */
         /* When set, it is OK to run GC from unknown thread.            */
 
-# ifdef NACL
-    GC_EXTERN __thread GC_thread GC_nacl_gc_thread_self;
-# endif
+#ifdef NACL
+  GC_EXTERN __thread GC_thread GC_nacl_gc_thread_self;
+  GC_INNER void GC_nacl_initialize_gc_thread(void);
+  GC_INNER void GC_nacl_shutdown_gc_thread(void);
+#endif
+
+#ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
+  GC_INNER void GC_unblock_gc_signals(void);
+#endif
+
+GC_INNER GC_thread GC_start_rtn_prepare_thread(void *(**pstart)(void *),
+                                        void **pstart_arg,
+                                        struct GC_stack_base *sb, void *arg);
+GC_INNER void GC_thread_exit_proc(void *);
 
 #endif /* GC_PTHREADS && !GC_WIN32_THREADS */
 
index fceb9dc6d0b99fc6715a68826d4e1dc3a5b188d3..d01f1e7f86d00845475683f398aa9c901cef9451 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -18,8 +18,6 @@
 #include <stdio.h>
 #include <string.h>
 
-GC_INNER void GC_extend_size_map(size_t); /* in misc.c */
-
 /* Allocate reclaim list for kind:      */
 /* Return TRUE on success               */
 STATIC GC_bool GC_alloc_reclaim_list(struct obj_kind *kind)
@@ -352,8 +350,6 @@ void * malloc(size_t lb)
   STATIC ptr_t GC_libpthread_end = 0;
   STATIC ptr_t GC_libld_start = 0;
   STATIC ptr_t GC_libld_end = 0;
-  GC_INNER GC_bool GC_text_mapping(char *nm, ptr_t *startp, ptr_t *endp);
-                                                /* From os_dep.c */
 
   STATIC void GC_init_lib_bounds(void)
   {
diff --git a/mark.c b/mark.c
index 658110841ef61119663990a5b68a9f69dae61b12..fa67ef750843e23e6beb42720dc8458c7c4c1cf1 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1331,11 +1331,6 @@ GC_INNER void GC_push_all(ptr_t bottom, ptr_t top)
     }
   }
 
-# ifdef PROC_VDB
-    GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk *h);
-                        /* Could the page contain valid heap pointers?  */
-# endif
-
   GC_INNER void GC_push_conditional(ptr_t bottom, ptr_t top, GC_bool all)
   {
     if (!all) {
index 02acf3bd40c54a3cf3f4568b02908631dcb1714b..4cd97bdc22a36241bf6af082b88d928503903036 100644 (file)
@@ -111,7 +111,7 @@ static int n_root_sets = 0;
 
   /* Is a range starting at b already in the table? If so return a      */
   /* pointer to it, else NULL.                                          */
-  GC_INNER struct roots * GC_roots_present(ptr_t b)
+  GC_INNER void * GC_roots_present(ptr_t b)
   {
     int h = rt_hash(b);
     struct roots *p = GC_root_index[h];
@@ -120,7 +120,7 @@ static int n_root_sets = 0;
         if (p -> r_start == (ptr_t)b) return(p);
         p = p -> r_next;
     }
-    return(FALSE);
+    return NULL;
   }
 
   /* Add the given root structure to the index. */
@@ -216,7 +216,7 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp)
         }
       }
 #   else
-      old = GC_roots_present(b);
+      old = (struct roots *)GC_roots_present(b);
       if (old != 0) {
         if (e <= old -> r_end) /* already there */ return;
         /* else extend */
@@ -690,10 +690,6 @@ STATIC void GC_push_gc_structures(void)
       GC_push_typed_structures();
 }
 
-#ifdef THREAD_LOCAL_ALLOC
-  GC_INNER void GC_mark_thread_local_free_lists(void);
-#endif
-
 GC_INNER void GC_cond_register_dynamic_libraries(void)
 {
 # if defined(DYNAMIC_LOADING) || defined(MSWIN32) || defined(MSWINCE) \
diff --git a/misc.c b/misc.c
index 428cffe61603e7956d292a071174f161fec7d74a..34bb570e337b2b647c61ef04944c386814fbc088 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -59,7 +59,6 @@
 #ifdef DYNAMIC_LOADING
   /* We need to register the main data segment.  Returns  TRUE unless   */
   /* this is done implicitly as part of dynamic library registration.   */
-  GC_INNER GC_bool GC_register_main_static_data(void);
 # define GC_REGISTER_MAIN_STATIC_DATA() GC_register_main_static_data()
 #else
   /* Don't unnecessarily call GC_register_main_static_data() in case    */
@@ -586,25 +585,12 @@ GC_INNER GC_bool GC_is_initialized = FALSE;
     GC_INNER CRITICAL_SECTION GC_write_cs;
 #endif
 
-#ifdef MSWIN32
-    GC_INNER void GC_init_win32(void);
-#endif
-
-GC_INNER void GC_setpagesize(void);
-
 STATIC void GC_exit_check(void)
 {
    GC_gcollect();
 }
 
-#ifdef SEARCH_FOR_DATA_START
-  GC_INNER void GC_init_linux_data_start(void);
-#endif
-
 #ifdef UNIX_LIKE
-
-  GC_INNER void GC_set_and_save_fault_handler(void (*handler)(int));
-
   static void looping_handler(int sig)
   {
     GC_err_printf("Caught signal %d: looping in handler\n", sig);
@@ -627,14 +613,6 @@ STATIC void GC_exit_check(void)
 # define maybe_install_looping_handler()
 #endif
 
-#if defined(DYNAMIC_LOADING) && defined(DARWIN)
-  GC_INNER void GC_init_dyld(void);
-#endif
-
-#if defined(NETBSD) && defined(__ELF__)
-  GC_INNER void GC_init_netbsd_elf(void);
-#endif
-
 #if !defined(OS2) && !defined(MACOS) && !defined(MSWIN32) && !defined(MSWINCE)
   STATIC int GC_stdout = 1;
   STATIC int GC_stderr = 2;
@@ -675,9 +653,6 @@ STATIC word GC_parse_mem_size_arg(const char *str)
   return result;
 }
 
-GC_INNER void GC_initialize_offsets(void);      /* defined in obj_map.c */
-GC_INNER void GC_bl_init(void); /* defined in blacklst.c */
-
 GC_API void GC_CALL GC_init(void)
 {
     /* LOCK(); -- no longer does anything this early. */
@@ -1556,12 +1531,7 @@ GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func fn, void *arg)
     return fn(&base, arg);
 }
 
-#ifdef THREADS
-
-  /* Defined in pthread_support.c or win32_threads.c.     */
-  GC_INNER void GC_do_blocking_inner(ptr_t data, void * context);
-
-#else
+#ifndef THREADS
 
 GC_INNER ptr_t GC_blocked_sp = NULL;
         /* NULL value means we are not inside GC_do_blocking() call. */
@@ -1754,8 +1724,6 @@ GC_API int GC_CALL GC_get_find_leak(void)
     return GC_find_leak;
 }
 
-GC_INNER void GC_bl_init_no_interiors(void);    /* defined in blacklst.c */
-
 GC_API void GC_CALL GC_set_all_interior_pointers(int value)
 {
     DCL_LOCK_STATE;
index 21613d9a189ed9ad50483606e9cc984b47e2db9b..73b493969fdf46fd480bfdf5e8577f8e199ff5a0 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
 #define IGNORE_PAGES_EXECUTABLE 1
                         /* Undefined on GC_pages_executable real use.   */
 
-#if defined(LINUX) && (defined(USE_PROC_FOR_LIBRARIES) || defined(IA64) \
-                       || !defined(SMALL_CONFIG))
-# define NEED_PROC_MAPS
-#endif
-
 #ifdef NEED_PROC_MAPS
 /* We need to parse /proc/self/maps, either to find dynamic libraries,  */
 /* and/or to find the register backing store base (IA64).  Do it once   */
@@ -474,7 +469,7 @@ GC_bool GC_enclosing_mapping(ptr_t addr, ptr_t *startp, ptr_t *endp)
 #   endif /* LINUX */
     GC_data_start = GC_find_limit((ptr_t)(_end), FALSE);
   }
-#endif
+#endif /* SEARCH_FOR_DATA_START */
 
 #ifdef ECOS
 
@@ -1220,11 +1215,6 @@ GC_INNER word GC_page_size = 0;
 # include <pthread.h>
   /* extern int pthread_getattr_np(pthread_t, pthread_attr_t *); */
 
-# ifdef IA64
-    GC_INNER ptr_t GC_greatest_stack_base_below(ptr_t bound);
-                                /* From pthread_support.c */
-# endif
-
   GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *b)
   {
     pthread_attr_t attr;
@@ -2555,16 +2545,11 @@ STATIC void GC_default_push_other_roots(void)
 
 # endif /* PCR */
 
-
 # if defined(GC_PTHREADS) || defined(GC_WIN32_THREADS)
-
-GC_INNER void GC_push_all_stacks(void);
-
-STATIC void GC_default_push_other_roots(void)
-{
-    GC_push_all_stacks();
-}
-
+    STATIC void GC_default_push_other_roots(void)
+    {
+      GC_push_all_stacks();
+    }
 # endif /* GC_WIN32_THREADS || GC_PTHREADS */
 
 # ifdef SN_TARGET_PS3
@@ -3096,7 +3081,7 @@ STATIC void GC_default_push_other_roots(void)
                      == STATUS_ACCESS_VIOLATION)
 #   define CODE_OK (exc_info -> ExceptionRecord -> ExceptionInformation[0] \
                       == 1) /* Write fault */
-    GC_INNER LONG WINAPI GC_write_fault_handler(
+    STATIC LONG WINAPI GC_write_fault_handler(
                                 struct _EXCEPTION_POINTERS *exc_info)
 # endif /* MSWIN32 || MSWINCE */
   {
@@ -3209,6 +3194,13 @@ STATIC void GC_default_push_other_roots(void)
       ABORT("Unexpected bus error or segmentation fault");
 #   endif
   }
+
+# ifdef GC_WIN32_THREADS
+    GC_INNER void GC_set_write_fault_handler(void)
+    {
+      SetUnhandledExceptionFilter(GC_write_fault_handler);
+    }
+# endif
 #endif /* !DARWIN */
 
 /* We hold the allocation lock.  We expect block h to be written        */
index c3a01c418268986ef174f30d38e7e9fd4a03ed9c..9d3556b4d85fd98ec830744130db517a46020789 100644 (file)
 #include <pthread.h>
 #include <sched.h>
 
-GC_INNER GC_thread GC_start_rtn_prepare_thread(void *(**pstart)(void *),
-                                        void **pstart_arg,
-                                        struct GC_stack_base *sb, void *arg);
-GC_INNER void GC_thread_exit_proc(void *arg);
-                                        /* defined in pthread_support.c */
-
 /* Invoked from GC_start_routine(). */
 void * GC_CALLBACK GC_inner_start_routine(struct GC_stack_base *sb, void *arg)
 {
index f2d1754c154aed9b5df8b9bf20a14a88d564bbde..33e3792466aaf3cd527ad973fe42401082f64ec4 100644 (file)
@@ -462,11 +462,6 @@ void GC_push_thread_structures(void)
 /* It may not be safe to allocate when we register the first thread.    */
 static struct GC_Thread_Rep first_thread;
 
-#ifdef NACL
-  GC_INNER void GC_nacl_initialize_gc_thread(void);
-  GC_INNER void GC_nacl_shutdown_gc_thread(void);
-#endif
-
 /* Add a thread to GC_threads.  We assume it wasn't already there.      */
 /* Caller holds allocation lock.                                        */
 STATIC GC_thread GC_new_thread(pthread_t id)
@@ -886,10 +881,6 @@ STATIC void GC_fork_child_proc(void)
   __thread int GC_dummy_thread_local;
 #endif
 
-#ifndef GC_DARWIN_THREADS
-  GC_INNER void GC_stop_init(void); /* defined in pthread_stop_world.c */
-#endif
-
 /* We hold the allocation lock. */
 GC_INNER void GC_thr_init(void)
 {
@@ -1046,10 +1037,6 @@ GC_INNER void GC_init_parallel(void)
   }
 #endif /* !GC_NO_PTHREAD_SIGMASK */
 
-#if defined(GC_DARWIN_THREADS) && !defined(DARWIN_DONT_PARSE_STACK)
-  GC_INNER ptr_t GC_FindTopOfStack(unsigned long);
-#endif
-
 /* Wrapper for functions that are likely to block for an appreciable    */
 /* length of time.                                                      */
 
@@ -1358,10 +1345,6 @@ GC_INLINE void GC_record_stack_base(GC_thread me,
 #   endif
 }
 
-#ifdef GC_EXPLICIT_SIGNALS_UNBLOCK
-  GC_INNER void GC_unblock_gc_signals(void); /* from pthread_stop_world.c */
-#endif
-
 STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
                                              pthread_t my_pthread)
 {
index 68dd1b9842995e7996ed2b99ae3e81a391161c2f..405087b80d35a2e876187c7839b666df57ff68b0 100644 (file)
--- a/reclaim.c
+++ b/reclaim.c
@@ -41,10 +41,6 @@ STATIC unsigned GC_n_leaked = 0;
 
 GC_INNER GC_bool GC_have_errors = FALSE;
 
-#ifndef SHORT_DBG_HDRS
-  GC_INNER GC_bool GC_check_leaked(ptr_t base); /* from dbg_mlc.c */
-#endif
-
 GC_INLINE void GC_add_leaked(ptr_t leaked)
 {
 #  ifndef SHORT_DBG_HDRS
index 1540f9ffe0c0616d5404174c5e59ee5f5999e6f8..610db6fd45caa08ca5ec401857a163f0824e3e04 100644 (file)
@@ -284,7 +284,7 @@ GC_INNER void GC_mark_thread_local_fls_for(GC_tlfs p)
 }
 
 #if defined(GC_ASSERTIONS)
-    /* Check that all thread-local free-lists in p are completely marked.       */
+    /* Check that all thread-local free-lists in p are completely marked. */
     void GC_check_tls_for(GC_tlfs p)
     {
         ptr_t q;
index 15b4b15cbf22bca2ce41bc20e4bb7934496de3db..47dc39c1d452e8097819ddce27f2ff97b3d1e5f5 100644 (file)
@@ -350,17 +350,6 @@ STATIC GC_thread GC_new_thread(DWORD id)
   return(result);
 }
 
-#ifdef MPROTECT_VDB
-  GC_INNER LONG WINAPI GC_write_fault_handler(
-                                struct _EXCEPTION_POINTERS *exc_info);
-#endif
-
-#if defined(GWW_VDB) && defined(MPROTECT_VDB)
-  GC_INNER GC_bool GC_gww_dirty_init(void);
-  /* Defined in os_dep.c.  Returns TRUE if GetWriteWatch is available.  */
-  /* may be called repeatedly.                                          */
-#endif
-
 STATIC GC_bool GC_in_thread_creation = FALSE;
                                 /* Protected by allocation lock. */
 
@@ -389,12 +378,12 @@ STATIC GC_thread GC_register_my_thread_inner(const struct GC_stack_base *sb,
   /* documentation.  There is empirical evidence that it        */
   /* isn't.             - HB                                    */
 # if defined(MPROTECT_VDB)
-#   if defined(GWW_VDB)
-      if (GC_incremental && !GC_gww_dirty_init())
-        SetUnhandledExceptionFilter(GC_write_fault_handler);
-#   else
-      if (GC_incremental) SetUnhandledExceptionFilter(GC_write_fault_handler);
-#   endif
+    if (GC_incremental
+#       ifdef GWW_VDB
+          && !GC_gww_dirty_init()
+#       endif
+        )
+      GC_set_write_fault_handler();
 # endif
 
 # ifndef GC_NO_THREADS_DISCOVERY
@@ -1403,7 +1392,7 @@ GC_INNER void GC_push_all_stacks(void)
                                 /* in stack (or ADDR_LIMIT if unset)    */
                                 /* for markers.                         */
 
-#endif
+#endif /* PARALLEL_MARK */
 
 /* Find stack with the lowest address which overlaps the        */
 /* interval [start, limit).                                     */