summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-10-22 17:00:59 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:51 +0200
commitc06769bfb05036d0ab57114d3b4568d8f743ad49 (patch)
treea0715b580d2c0bd3b565c6fa42109e2671bc6f0c /mark_rts.c
parentbad4c7acb6060861cd4be55968c1f58b2026a747 (diff)
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 'mark_rts.c')
-rw-r--r--mark_rts.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/mark_rts.c b/mark_rts.c
index b872319..41b942f 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -24,9 +24,9 @@
struct roots {
ptr_t r_start;
ptr_t r_end;
- # if !defined(MSWIN32) && !defined(MSWINCE)
+# if !defined(MSWIN32) && !defined(MSWINCE)
struct roots * r_next;
- # endif
+# endif
GC_bool r_tmp;
-- Delete before registering new dynamic libraries
};
@@ -61,10 +61,11 @@ static int n_root_sets = 0;
}
#endif /* !NO_DEBUGGING */
-/* Primarily for debugging support: */
-/* Is the address p in one of the registered static root sections? */
-GC_bool GC_is_static_root(ptr_t p)
-{
+#ifndef THREADS
+ /* Primarily for debugging support: */
+ /* Is the address p in one of the registered static root sections? */
+ GC_bool GC_is_static_root(ptr_t p)
+ {
static int last_root_set = MAX_ROOT_SETS;
int i;
@@ -79,7 +80,8 @@ GC_bool GC_is_static_root(ptr_t p)
}
}
return(FALSE);
-}
+ }
+#endif /* !THREADS */
#if !defined(MSWIN32) && !defined(MSWINCE)
/*
@@ -92,8 +94,8 @@ GC_bool GC_is_static_root(ptr_t p)
-- really defined in gc_priv.h
*/
-GC_INLINE int rt_hash(ptr_t addr)
-{
+ GC_INLINE int rt_hash(ptr_t addr)
+ {
word result = (word) addr;
# if CPP_WORDSZ > 8*LOG_RT_SIZE
result ^= result >> 8*LOG_RT_SIZE;
@@ -105,12 +107,12 @@ GC_INLINE int rt_hash(ptr_t addr)
result ^= result >> LOG_RT_SIZE;
result &= (RT_SIZE-1);
return(result);
-}
+ }
-/* Is a range starting at b already in the table? If so return a */
-/* pointer to it, else NIL. */
-struct roots * GC_roots_present(ptr_t b)
-{
+ /* Is a range starting at b already in the table? If so return a */
+ /* pointer to it, else NIL. */
+ struct roots * GC_roots_present(ptr_t b)
+ {
int h = rt_hash(b);
struct roots *p = GC_root_index[h];
@@ -119,18 +121,17 @@ struct roots * GC_roots_present(ptr_t b)
p = p -> r_next;
}
return(FALSE);
-}
+ }
-/* Add the given root structure to the index. */
-GC_INLINE void add_roots_to_index(struct roots *p)
-{
+ /* Add the given root structure to the index. */
+ GC_INLINE void add_roots_to_index(struct roots *p)
+ {
int h = rt_hash(p -> r_start);
p -> r_next = GC_root_index[h];
GC_root_index[h] = p;
-}
-
-# endif
+ }
+#endif /* !MSWIN32 */
GC_INNER word GC_root_size = 0;
@@ -300,10 +301,10 @@ STATIC void GC_remove_tmp_roots(void)
#endif
#if !defined(MSWIN32) && !defined(MSWINCE)
-STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e);
+ STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e);
-GC_API void GC_CALL GC_remove_roots(void *b, void *e)
-{
+ GC_API void GC_CALL GC_remove_roots(void *b, void *e)
+ {
DCL_LOCK_STATE;
/* Quick check whether has nothing to do */
@@ -314,11 +315,11 @@ GC_API void GC_CALL GC_remove_roots(void *b, void *e)
LOCK();
GC_remove_roots_inner((ptr_t)b, (ptr_t)e);
UNLOCK();
-}
+ }
-/* Should only be called when the lock is held */
-STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e)
-{
+ /* Should only be called when the lock is held */
+ STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e)
+ {
int i;
for (i = 0; i < n_root_sets; ) {
if (GC_static_roots[i].r_start >= b
@@ -329,15 +330,15 @@ STATIC void GC_remove_roots_inner(ptr_t b, ptr_t e)
}
}
GC_rebuild_root_index();
-}
+ }
#endif /* !defined(MSWIN32) && !defined(MSWINCE) */
#if (defined(MSWIN32) || defined(MSWINCE)) && !defined(NO_DEBUGGING)
-/* Not used at present (except for, may be, debugging purpose). */
-/* Workaround for the OS mapping and unmapping behind our back: */
-/* Is the address p in one of the temporary static root sections? */
-GC_bool GC_is_tmp_root(ptr_t p)
-{
+ /* Not used at present (except for, may be, debugging purpose). */
+ /* Workaround for the OS mapping and unmapping behind our back: */
+ /* Is the address p in one of the temporary static root sections? */
+ GC_bool GC_is_tmp_root(ptr_t p)
+ {
static int last_root_set = MAX_ROOT_SETS;
register int i;
@@ -353,7 +354,7 @@ GC_bool GC_is_tmp_root(ptr_t p)
}
}
return(FALSE);
-}
+ }
#endif /* MSWIN32 || MSWINCE */
ptr_t GC_approx_sp(void)
@@ -363,7 +364,6 @@ ptr_t GC_approx_sp(void)
/* Also force stack to grow if necessary. Otherwise the */
/* later accesses might cause the kernel to think we're */
/* doing something wrong. */
-
return((ptr_t)sp);
}
@@ -477,10 +477,10 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
}
#ifdef IA64
-/* Similar to GC_push_all_stack_frames() but for IA-64 registers store. */
-void GC_push_all_register_frames(ptr_t bs_lo, ptr_t bs_hi, int eager,
- struct GC_activation_frame_s *activation_frame)
-{
+ /* Similar to GC_push_all_stack_frames() but for IA-64 registers store. */
+ void GC_push_all_register_frames(ptr_t bs_lo, ptr_t bs_hi,
+ int eager, struct GC_activation_frame_s *activation_frame)
+ {
while (activation_frame != NULL) {
ptr_t frame_bs_lo = activation_frame -> backing_store_end;
GC_ASSERT(frame_bs_lo <= bs_hi);
@@ -498,7 +498,7 @@ void GC_push_all_register_frames(ptr_t bs_lo, ptr_t bs_hi, int eager,
} else {
GC_push_all_stack(bs_lo, bs_hi);
}
-}
+ }
#endif /* IA64 */
#ifdef THREADS
@@ -549,7 +549,7 @@ void GC_push_all_stack_frames(ptr_t lo, ptr_t hi,
* GC_dirty() call.
*/
STATIC void GC_push_all_stack_partially_eager(ptr_t bottom, ptr_t top,
- ptr_t cold_gc_frame)
+ ptr_t cold_gc_frame)
{
if (!NEED_FIXUP_POINTER && GC_all_interior_pointers) {
/* Push the hot end of the stack eagerly, so that register values */
@@ -634,7 +634,7 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
/* For IA64, the register stack backing store is handled */
/* in the thread-specific code. */
# else
- GC_push_all_eager( cold_gc_frame, GC_approx_sp() );
+ GC_push_all_eager(cold_gc_frame, GC_approx_sp());
# endif
# else
GC_push_all_stack_part_eager_frames(GC_approx_sp(), GC_stackbottom,
@@ -664,7 +664,7 @@ STATIC void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
TRUE /* eager */, GC_activation_frame);
}
/* All values should be sufficiently aligned that we */
- /* dont have to worry about the boundary. */
+ /* don't have to worry about the boundary. */
}
# endif
# endif /* !THREADS */