summaryrefslogtreecommitdiff
path: root/mach_dep.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 /mach_dep.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 'mach_dep.c')
-rw-r--r--mach_dep.c65
1 files changed, 36 insertions, 29 deletions
diff --git a/mach_dep.c b/mach_dep.c
index 0d12d7c1..782fdc51 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -79,15 +79,16 @@ asm static void PushMacRegisters()
#undef HAVE_PUSH_REGS
#if defined(USE_ASM_PUSH_REGS)
-# define HAVE_PUSH_REGS
+# define HAVE_PUSH_REGS
#else /* No asm implementation */
-void GC_push_regs()
-{
-# if defined(M68K) && defined(AMIGA)
+
+# if defined(M68K) && defined(AMIGA)
+ STATIC void GC_push_regs(void)
+ {
/* AMIGA - could be replaced by generic code */
/* a0, a1, d0 and d1 are caller save */
-# ifdef __GNUC__
+# ifdef __GNUC__
asm("subq.w &0x4,%sp"); /* allocate word on top of stack */
asm("mov.l %a2,(%sp)"); asm("jsr _GC_push_one");
@@ -104,12 +105,11 @@ void GC_push_regs()
asm("mov.l %d7,(%sp)"); asm("jsr _GC_push_one");
asm("addq.w &0x4,%sp"); /* put stack back where it was */
-# define HAVE_PUSH_REGS
-# else /* !__GNUC__ */
+# else /* !__GNUC__ */
GC_push_one(getreg(REG_A2));
GC_push_one(getreg(REG_A3));
# ifndef __SASC
- /* Can probably be changed to #if 0 -Kjetil M. (a4=globals)*/
+ /* Can probably be changed to #if 0 -Kjetil M. (a4=globals) */
GC_push_one(getreg(REG_A4));
# endif
GC_push_one(getreg(REG_A5));
@@ -121,17 +121,20 @@ void GC_push_regs()
GC_push_one(getreg(REG_D5));
GC_push_one(getreg(REG_D6));
GC_push_one(getreg(REG_D7));
-# define HAVE_PUSH_REGS
-# endif /* !__GNUC__ */
-# endif /* AMIGA */
+# endif /* !__GNUC__ */
+ }
+# define HAVE_PUSH_REGS
+
+# elif defined(M68K) && defined(MACOS)
-# if defined(M68K) && defined(MACOS)
-# if defined(THINK_C)
-# define PushMacReg(reg) \
+# if defined(THINK_C)
+# define PushMacReg(reg) \
move.l reg,(sp) \
jsr GC_push_one
+ STATIC void GC_push_regs(void)
+ {
asm {
- sub.w #4,sp ; reserve space for one parameter.
+ sub.w #4,sp ; reserve space for one parameter.
PushMacReg(a2);
PushMacReg(a3);
PushMacReg(a4);
@@ -142,17 +145,20 @@ void GC_push_regs()
PushMacReg(d5);
PushMacReg(d6);
PushMacReg(d7);
- add.w #4,sp ; fix stack.
+ add.w #4,sp ; fix stack.
}
-# define HAVE_PUSH_REGS
-# undef PushMacReg
-# endif /* THINK_C */
-# if defined(__MWERKS__)
+ }
+# define HAVE_PUSH_REGS
+# undef PushMacReg
+# elif defined(__MWERKS__)
+ STATIC void GC_push_regs(void)
+ {
PushMacRegisters();
-# define HAVE_PUSH_REGS
-# endif /* __MWERKS__ */
-# endif /* MACOS */
-}
+ }
+# define HAVE_PUSH_REGS
+# endif /* __MWERKS__ */
+# endif /* MACOS */
+
#endif /* !USE_ASM_PUSH_REGS */
#if defined(HAVE_PUSH_REGS) && defined(THREADS)
@@ -236,8 +242,8 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), ptr_t arg)
/* _setjmp won't, but is less portable. */
# endif
# endif /* !HAVE_PUSH_REGS ... */
- /* FIXME: context here is sometimes just zero. At the moment the callees */
- /* don't really need it. */
+ /* FIXME: context here is sometimes just zero. At the moment the */
+ /* callees don't really need it. */
fn(arg, context);
/* Strongly discourage the compiler from treating the above */
/* as a tail-call, since that would pop the register */
@@ -248,9 +254,10 @@ void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), ptr_t arg)
#if defined(ASM_CLEAR_CODE)
# ifdef LINT
/*ARGSUSED*/
- ptr_t GC_clear_stack_inner(arg, limit)
- ptr_t arg; word limit;
- { return(arg); }
+ ptr_t GC_clear_stack_inner(ptr_t arg, word limit)
+ {
+ return(arg);
+ }
/* The real version is in a .S file */
# endif
#endif /* ASM_CLEAR_CODE */