summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorhboehm <hboehm>2009-06-09 07:02:26 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:45 +0200
commitd52c112e09817469c2734b8554672003dc11ed7b (patch)
tree0c0e940bb63f620cab7b339b0c432cc298006c01 /mark_rts.c
parent7e59301c1d5e557a0756762646de39f97766cf3d (diff)
2009-06-08 Hans Boehm <Hans.Boehm@hp.com> (Really Ivan Maidanski)
(diff91_cvs: resembling diff3, diff27, diff33, diff45, diff47, diff49, diff60, diff67, diff68 partly) * alloc.c (GC_FULL_FREQ, GC_DONT_EXPAND, GC_FREE_SPACE_DIVISOR, GC_TIME_LIMIT): New macros (used to control the default initial values of GC_full_freq variable, GC_dont_expand, GC_free_space_divisor, GC_time_limit respectively). * include/private/gc_priv.h (TIME_LIMIT): Remove macro (replaced with GC_TIME_LIMIT in alloc.c). * alloc.c (GC_need_full_gc, GC_stopped_mark, GC_finish_collection): Define as STATIC. * mark_rts.c (GC_push_current_stack, GC_push_gc_structures): Ditto. * include/private/gc_priv.h (GC_stopped_mark, GC_finish_collection): Move the prototypes to alloc.c, make STATIC. * include/private/gc_priv.h (GC_push_current_stack, GC_push_gc_structures, GC_push_regs_and_stack): Remove prototypes (move the comments to the places where these functions are defined). * mach_dep.c (GC_push_regs_and_stack): Move to mark_rts.c and define as STATIC. * alloc.c (GC_timeout_stop_func, GC_stopped_mark, GC_print_heap_sects): Convert a group of printf() calls into a single one (for output atomicity). * mark_rts.c (GC_print_static_roots): Ditto. * alloc.c (GC_stopped_mark): Output blank line (when logging) for convenience to delimit collections. * alloc.c (GC_clear_a_few_frames): Rename NWORDS to CLEAR_NWORDS; make "frames" local variable volatile (to prevent optimization). * alloc.c (GC_try_to_collect_inner, GC_stopped_mark, GC_finish_collection, GC_allocobj): Remove outdated comments about disabling signals. * include/private/gc_priv.h (GC_register_displacement_inner, GC_gcollect_inner): Ditto. * alloc.c (GC_try_to_collect_inner, GC_stopped_mark, GC_finish_collection): Initialize "start_time" local variable (to 0) to suppress compiler warning. * mark_rts.c (GC_add_roots_inner): Ditto (for "old" variable). * alloc.c (GC_RATE, MAX_PRIOR_ATTEMPTS): Guard with "ifndef". * include/private/gc_priv.h (clock, GC_stop_world, GC_start_world, GC_acquire_mark_lock, GC_release_mark_lock, GC_notify_all_builder, GC_wait_for_reclaim, GC_notify_all_marker, GC_wait_marker): Replace K&R-style function prototypes with ANSI C one. * include/private/gc_priv.h (ABORT): Define as DebugBreak() for Win32/WinCE if SMALL_CONFIG (the same as in GC_abort()). * include/private/gc_priv.h (ROUNDED_UP_WORDS, abs): Remove unused macros. * include/private/gc_priv.h (GC_noop): Declare for Borland C the same as for Watcom. * mark_rts.c (GC_push_conditional_with_exclusions): Add ARGSUSED tag.
Diffstat (limited to 'mark_rts.c')
-rw-r--r--mark_rts.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/mark_rts.c b/mark_rts.c
index 2b8b738..3554627 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -46,14 +46,10 @@ void GC_print_static_roots(void)
size_t total = 0;
for (i = 0; i < n_root_sets; i++) {
- GC_printf("From %p to %p ",
+ GC_printf("From %p to %p%s\n",
GC_static_roots[i].r_start,
- GC_static_roots[i].r_end);
- if (GC_static_roots[i].r_tmp) {
- GC_printf(" (temporary)\n");
- } else {
- GC_printf("\n");
- }
+ GC_static_roots[i].r_end,
+ GC_static_roots[i].r_tmp ? " (temporary)" : "");
total += GC_static_roots[i].r_end - GC_static_roots[i].r_start;
}
GC_printf("Total size: %ld\n", (unsigned long) total);
@@ -172,7 +168,7 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp)
/* takes to scan the roots. */
{
register int i;
-
+ old = 0; /* initialized to prevent warning. */
for (i = 0; i < n_root_sets; i++) {
old = GC_static_roots + i;
if (b <= old -> r_end && e >= old -> r_start) {
@@ -434,6 +430,7 @@ GC_API void GC_CALL GC_exclude_static_roots(void *start, void *finish)
}
/* Invoke push_conditional on ranges that are not excluded. */
+/*ARGSUSED*/
STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
GC_bool all)
{
@@ -451,6 +448,15 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
}
}
+ /* Push enough of the current stack eagerly to */
+ /* ensure that callee-save registers saved in */
+ /* GC frames are scanned. */
+ /* In the non-threads case, schedule entire */
+ /* stack for scanning. */
+ /* The second argument is a pointer to the */
+ /* (possibly null) thread context, for */
+ /* (currently hypothetical) more precise */
+ /* stack scanning. */
/*
* In the absence of threads, push the stack contents.
* In the presence of threads, push enough of the current stack
@@ -459,7 +465,7 @@ STATIC void GC_push_conditional_with_exclusions(ptr_t bottom, ptr_t top,
* FIXME: Merge with per-thread stuff.
*/
/*ARGSUSED*/
-void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
+STATIC void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
{
# if defined(THREADS)
if (0 == cold_gc_frame) return;
@@ -509,11 +515,16 @@ void GC_push_current_stack(ptr_t cold_gc_frame, void * context)
void (*GC_push_typed_structures) (void) = NULL;
+ /* Push GC internal roots. These are normally */
+ /* included in the static data segment, and */
+ /* Thus implicitly pushed. But we must do this */
+ /* explicitly if normal root processing is */
+ /* disabled. */
/*
* Push GC internal roots. Only called if there is some reason to believe
* these would not otherwise get registered.
*/
-void GC_push_gc_structures(void)
+STATIC void GC_push_gc_structures(void)
{
GC_push_finalizer_structures();
# if defined(THREADS)
@@ -538,6 +549,11 @@ void GC_cond_register_dynamic_libraries(void)
# endif
}
+STATIC void GC_push_regs_and_stack(ptr_t cold_gc_frame)
+{
+ GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame);
+}
+
/*
* Call the mark routines (GC_tl_push for a single pointer, GC_push_conditional
* on groups of pointers) on every top level accessible pointer.