summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-10-22 15:00:59 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:51 +0400
commitc06769bfb05036d0ab57114d3b4568d8f743ad49 (patch)
treea0715b580d2c0bd3b565c6fa42109e2671bc6f0c /malloc.c
parentbad4c7acb6060861cd4be55968c1f58b2026a747 (diff)
downloadbdwgc-c06769bfb05036d0ab57114d3b4568d8f743ad49.tar.gz
2009-10-22 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_collection_in_progress): Move the prototype to gc_priv.h. * gc_dlopen.c (GC_collection_in_progress): Ditto. * pthread_support.c (GC_collection_in_progress): Ditto. * misc.c (GC_init_parallel): Ditto. * pthread_support.c (GC_init_parallel): Ditto. * win32_threads.c (GC_init_parallel): Ditto. * darwin_stop_world.c (GC_thr_init): Ditto. * misc.c (GC_thr_init): Ditto. * pthread_stop_world.c (GC_thr_init): Ditto. * pthread_support.c (GC_thr_init): Ditto. * blacklst.c (GC_clear_bl, GC_copy_bl, GC_number_stack_black_listed): Make STATIC. * dbg_mlc.c (GC_print_obj, GC_make_closure, GC_debug_invoke_finalizer): Ditto. * malloc.c (GC_alloc_large_and_clear): Ditto. * mark.c (GC_push_selected, GC_push_marked1, GC_push_marked2, GC_push_marked4, GC_push_marked, GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Ditto. * misc.c (GC_clear_stack_inner): Ditto. * os_dep.c (GC_repeat_read, GC_default_push_other_roots): Ditto. * darwin_stop_world.c (FindTopOfStack): Make static; define only if not DARWIN_DONT_PARSE_STACK. * dbg_mlc.c (GC_debug_free_inner): Define only if DBG_HDRS_ALL. * dyn_load.c (GC_repeat_read): Remove unused prototype. * include/private/gc_pmark.h (GC_find_start): Ditto. * misc.c (GC_read, GC_register_finalizer_no_order): Ditto. * dyn_load.c (GC_segment_is_thread_stack): Add prototype (only if THREADS). * dyn_load.c (GC_register_main_static_data): Define only if DYNAMIC_LOADING. * finalize.c (GC_enqueue_all_finalizers): Remove unnecessary tail "return" statement. * gc_dlopen.c (GC_SOLARIS_THREADS): Don't recognize (since implies GC_PTHREADS). * include/gc.h: Fix a typo. * include/gc_inline.h (GC_ASSERT): Define (if not defined) since the header is public. * include/gc_inline.h (GC_generic_malloc_many): New public function declaration. * mallocx.c (GC_generic_malloc_many): Make public. * include/private/gc_priv.h (GC_INNER): Use visibility attribute (if available). * include/private/gc_priv.h (GC_EXTERN): Define using GC_INNER. * include/private/gc_priv.h: Include atomic_ops.h if THREADS and MPROTECT_VDB. * os_dep.c: Don't include atomic_ops.h * win32_threads.c: Ditto. * include/private/gc_priv.h (GC_push_selected, GC_push_regs, GC_push_marked, GC_number_stack_black_listed, GC_alloc_large_and_clear, GC_reclaim_or_delete_all, GC_generic_malloc_many, GC_make_closure, GC_debug_invoke_finalizer, GC_print_obj, GC_page_was_ever_dirty): Remove the prototype. * mark.c (GC_page_was_ever_dirty): Add prototype (only if PROC_VDB). * include/private/gc_priv.h (GC_push_next_marked_dirty, GC_push_next_marked, GC_push_next_marked_uncollectable): Move the prototype to mark.c. * include/private/gc_priv.h (GC_is_static_root): Declare only if not THREADS. * include/private/gc_priv.h (GC_free_inner): Declare only if THREADS. * include/private/gc_priv.h (GC_debug_free_inner): Declare only if THREADS and DBG_HDRS_ALL. * include/private/gc_priv.h (GC_markers): Declare GC_markers only if PARALLEL_MARK. * include/private/gc_priv.h (GC_register_main_static_data): Move the prototype to misc.c. * mach_dep.c (GC_push_regs): Make STATIC; define only along with HAVE_PUSH_REGS definition. * mach_dep.c (GC_clear_stack_inner): Replace K&R-style function definition with the ANSI C one. * mark.c (GC_started_thread_while_stopped): Declared only if not GNU C. * win32_threads.c (GC_started_thread_while_stopped): Don't define if GNU C. * mark.c (GC_mark_from): Avoid unbalanced brackets in #if-#else-#endif blocks. * mark_rts.c (GC_is_static_root): Define only if not THREADS. * os_dep.c (GC_get_stack_base): Make public (for OpenBSD). * os_dep.c (GC_page_was_ever_dirty): Comment out the function except for PROC_VDB. * tests/test.c (main): Don't reference GC_print_obj, GC_make_closure, GC_debug_invoke_finalizer, GC_page_was_ever_dirty, GC_is_fresh (in GC_noop). * thread_local_alloc.c: Don't include "gc_inline.h". * win32_threads.c (GC_write_fault_handler): Declare only if MPROTECT_VDB.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/malloc.c b/malloc.c
index cf330a89..041a3e18 100644
--- a/malloc.c
+++ b/malloc.c
@@ -21,7 +21,7 @@
# include <errno.h>
#endif
-void GC_extend_size_map(size_t); /* in misc.c. */
+void GC_extend_size_map(size_t); /* in misc.c. */
/* Allocate reclaim list for kind: */
/* Return TRUE on success */
@@ -82,11 +82,10 @@ ptr_t GC_alloc_large(size_t lb, int k, unsigned flags)
return result;
}
-
/* Allocate a large block of size lb bytes. Clear if appropriate. */
/* We hold the allocation lock. */
/* EXTRA_BYTES were already added to lb. */
-ptr_t GC_alloc_large_and_clear(size_t lb, int k, unsigned flags)
+STATIC ptr_t GC_alloc_large_and_clear(size_t lb, int k, unsigned flags)
{
ptr_t result = GC_alloc_large(lb, k, flags);
word n_blocks = OBJ_SZ_TO_BLOCKS(lb);
@@ -302,10 +301,10 @@ GC_API char * GC_CALL GC_strdup(const char *s)
# define RA
# endif
# define GC_debug_malloc_replacement(lb) \
- GC_debug_malloc(lb, RA "unknown", 0)
+ GC_debug_malloc(lb, RA "unknown", 0)
void * malloc(size_t lb)
- {
+{
/* It might help to manually inline the GC_malloc call here. */
/* But any decent compiler should reduce the extra procedure call */
/* to at most a jump instruction in this case. */
@@ -320,7 +319,7 @@ void * malloc(size_t lb)
if (!GC_is_initialized) return sbrk(lb);
# endif /* I386 && GC_SOLARIS_THREADS */
return((void *)REDIRECT_MALLOC(lb));
- }
+}
#if defined(GC_LINUX_THREADS) /* && !defined(USE_PROC_FOR_LIBRARIES) */
STATIC ptr_t GC_libpthread_start = 0;
@@ -328,7 +327,7 @@ void * malloc(size_t lb)
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 */
+ /* From os_dep.c */
STATIC void GC_init_lib_bounds(void)
{
@@ -457,8 +456,8 @@ GC_API void GC_CALL GC_free(void * p)
/* Only used for internally allocated objects, so we can take some */
/* shortcuts. */
#ifdef THREADS
-void GC_free_inner(void * p)
-{
+ void GC_free_inner(void * p)
+ {
struct hblk *h;
hdr *hhdr;
size_t sz; /* bytes */
@@ -492,13 +491,14 @@ void GC_free_inner(void * p)
}
GC_freehblk(h);
}
-}
+ }
#endif /* THREADS */
-# if defined(REDIRECT_MALLOC) && !defined(REDIRECT_FREE)
-# define REDIRECT_FREE GC_free
-# endif
-# ifdef REDIRECT_FREE
+#if defined(REDIRECT_MALLOC) && !defined(REDIRECT_FREE)
+# define REDIRECT_FREE GC_free
+#endif
+
+#ifdef REDIRECT_FREE
void free(void * p)
{
# if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES)
@@ -520,4 +520,4 @@ void GC_free_inner(void * p)
REDIRECT_FREE(p);
# endif
}
-# endif /* REDIRECT_MALLOC */
+#endif /* REDIRECT_FREE */