mirror of git://gcc.gnu.org/git/gcc.git
allchblk.c (GC_allochblk_nth): Dont overlook available space if GC disabled...
* allchblk.c (GC_allochblk_nth): Dont overlook available space if GC disabled, correctly convert GC_finalizer_mem_freed to byte, total_size to words. * dyn_load.c (win32 GC_register_dynamic_libraries): Consider only MEM_IMAGE regions. * mach_dep.c (GC_with_callee_saves_pushed): separate into new function, and indent appropriately. * mark_rts.c (GC_approx_sp): Access stack. * pthread_stop_world.c: (GC_suspend_handler): Explicitly push callee-saves registers when appropriate. (GC_stop_world): Handle EINTR from sem_wait (sync with Mono GC). From-SVN: r94776
This commit is contained in:
parent
dab80c81c6
commit
328d1d4c1c
|
@ -1,3 +1,17 @@
|
||||||
|
2005-02-07 Hans Boehm <Hans.Boehm@hp.com>
|
||||||
|
|
||||||
|
* allchblk.c (GC_allochblk_nth): Dont overlook available space if
|
||||||
|
GC disabled, correctly convert GC_finalizer_mem_freed to byte,
|
||||||
|
total_size to words.
|
||||||
|
* dyn_load.c (win32 GC_register_dynamic_libraries): Consider only
|
||||||
|
MEM_IMAGE regions.
|
||||||
|
* mach_dep.c (GC_with_callee_saves_pushed): separate into new function,
|
||||||
|
and indent appropriately.
|
||||||
|
* mark_rts.c (GC_approx_sp): Access stack.
|
||||||
|
* pthread_stop_world.c: (GC_suspend_handler): Explicitly push
|
||||||
|
callee-saves registers when appropriate.
|
||||||
|
(GC_stop_world): Handle EINTR from sem_wait (sync with Mono GC).
|
||||||
|
|
||||||
2005-01-01 Bryce McKinlay <mckinlay@redhat.com>
|
2005-01-01 Bryce McKinlay <mckinlay@redhat.com>
|
||||||
|
|
||||||
* configure.ac (AC_CONFIG_HEADERS): Build both include/gc_config.h
|
* configure.ac (AC_CONFIG_HEADERS): Build both include/gc_config.h
|
||||||
|
|
|
@ -590,8 +590,9 @@ int n;
|
||||||
GET_HDR(hbp, hhdr);
|
GET_HDR(hbp, hhdr);
|
||||||
size_avail = hhdr->hb_sz;
|
size_avail = hhdr->hb_sz;
|
||||||
if (size_avail < size_needed) continue;
|
if (size_avail < size_needed) continue;
|
||||||
if (!GC_use_entire_heap
|
if (size_avail != size_needed
|
||||||
&& size_avail != size_needed
|
&& !GC_use_entire_heap
|
||||||
|
&& !GC_dont_gc
|
||||||
&& USED_HEAP_SIZE >= GC_requested_heapsize
|
&& USED_HEAP_SIZE >= GC_requested_heapsize
|
||||||
&& !TRUE_INCREMENTAL && GC_should_collect()) {
|
&& !TRUE_INCREMENTAL && GC_should_collect()) {
|
||||||
# ifdef USE_MUNMAP
|
# ifdef USE_MUNMAP
|
||||||
|
@ -608,7 +609,8 @@ int n;
|
||||||
/* If we are deallocating lots of memory from */
|
/* If we are deallocating lots of memory from */
|
||||||
/* finalizers, fail and collect sooner rather */
|
/* finalizers, fail and collect sooner rather */
|
||||||
/* than later. */
|
/* than later. */
|
||||||
if (GC_finalizer_mem_freed > (GC_heapsize >> 4)) {
|
if (WORDS_TO_BYTES(GC_finalizer_mem_freed)
|
||||||
|
> (GC_heapsize >> 4)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
# endif /* !USE_MUNMAP */
|
# endif /* !USE_MUNMAP */
|
||||||
|
@ -698,7 +700,7 @@ int n;
|
||||||
struct hblk * h;
|
struct hblk * h;
|
||||||
struct hblk * prev = hhdr -> hb_prev;
|
struct hblk * prev = hhdr -> hb_prev;
|
||||||
|
|
||||||
GC_words_wasted += total_size;
|
GC_words_wasted += BYTES_TO_WORDS(total_size);
|
||||||
GC_large_free_bytes -= total_size;
|
GC_large_free_bytes -= total_size;
|
||||||
GC_remove_from_fl(hhdr, n);
|
GC_remove_from_fl(hhdr, n);
|
||||||
for (h = hbp; h < limit; h++) {
|
for (h = hbp; h < limit; h++) {
|
||||||
|
|
|
@ -735,6 +735,10 @@ void GC_register_dynamic_libraries()
|
||||||
|
|
||||||
# define HAVE_REGISTER_MAIN_STATIC_DATA
|
# define HAVE_REGISTER_MAIN_STATIC_DATA
|
||||||
|
|
||||||
|
/* The frame buffer testing code is dead in this version. */
|
||||||
|
/* We leave it here temporarily in case the switch to just */
|
||||||
|
/* testing for MEM_IMAGE sections causes un expected */
|
||||||
|
/* problems. */
|
||||||
GC_bool GC_warn_fb = TRUE; /* Warn about traced likely */
|
GC_bool GC_warn_fb = TRUE; /* Warn about traced likely */
|
||||||
/* graphics memory. */
|
/* graphics memory. */
|
||||||
GC_bool GC_disallow_ignore_fb = FALSE;
|
GC_bool GC_disallow_ignore_fb = FALSE;
|
||||||
|
@ -856,7 +860,11 @@ void GC_register_dynamic_libraries()
|
||||||
&& (protect == PAGE_EXECUTE_READWRITE
|
&& (protect == PAGE_EXECUTE_READWRITE
|
||||||
|| protect == PAGE_READWRITE)
|
|| protect == PAGE_READWRITE)
|
||||||
&& !GC_is_heap_base(buf.AllocationBase)
|
&& !GC_is_heap_base(buf.AllocationBase)
|
||||||
&& !is_frame_buffer(p, buf.RegionSize)) {
|
/* This used to check for
|
||||||
|
* !is_frame_buffer(p, buf.RegionSize, buf.Type)
|
||||||
|
* instead of just checking for MEM_IMAGE.
|
||||||
|
* If something breaks, change it back. */
|
||||||
|
&& buf.Type == MEM_IMAGE) {
|
||||||
# ifdef DEBUG_VIRTUALQUERY
|
# ifdef DEBUG_VIRTUALQUERY
|
||||||
GC_dump_meminfo(&buf);
|
GC_dump_meminfo(&buf);
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -400,13 +400,13 @@ void GC_push_regs()
|
||||||
}
|
}
|
||||||
#endif /* !USE_GENERIC_PUSH_REGS && !USE_ASM_PUSH_REGS */
|
#endif /* !USE_GENERIC_PUSH_REGS && !USE_ASM_PUSH_REGS */
|
||||||
|
|
||||||
#if defined(USE_GENERIC_PUSH_REGS)
|
void GC_with_callee_saves_pushed(fn, arg)
|
||||||
void GC_generic_push_regs(cold_gc_frame)
|
void (*fn)();
|
||||||
ptr_t cold_gc_frame;
|
ptr_t arg;
|
||||||
{
|
|
||||||
{
|
{
|
||||||
word dummy;
|
word dummy;
|
||||||
|
|
||||||
|
# if defined(USE_GENERIC_PUSH_REGS)
|
||||||
# ifdef HAVE_BUILTIN_UNWIND_INIT
|
# ifdef HAVE_BUILTIN_UNWIND_INIT
|
||||||
/* This was suggested by Richard Henderson as the way to */
|
/* This was suggested by Richard Henderson as the way to */
|
||||||
/* force callee-save registers and register windows onto */
|
/* force callee-save registers and register windows onto */
|
||||||
|
@ -436,6 +436,15 @@ ptr_t cold_gc_frame;
|
||||||
/* _setjmp won't, but is less portable. */
|
/* _setjmp won't, but is less portable. */
|
||||||
# endif
|
# endif
|
||||||
# endif /* !HAVE_BUILTIN_UNWIND_INIT */
|
# endif /* !HAVE_BUILTIN_UNWIND_INIT */
|
||||||
|
# elif defined(PTHREADS) && !defined(MSWIN32) /* !USE_GENERIC_PUSH_REGS */
|
||||||
|
/* We may still need this to save thread contexts. */
|
||||||
|
/* This should probably be used in all Posix/non-gcc */
|
||||||
|
/* settings. We defer that change to minimize risk. */
|
||||||
|
ucontext_t ctxt;
|
||||||
|
getcontext(&ctxt);
|
||||||
|
# else /* Shouldn't be needed */
|
||||||
|
ABORT("Unexpected call to GC_with_callee_saves_pushed");
|
||||||
|
# endif
|
||||||
# if (defined(SPARC) && !defined(HAVE_BUILTIN_UNWIND_INIT)) \
|
# if (defined(SPARC) && !defined(HAVE_BUILTIN_UNWIND_INIT)) \
|
||||||
|| defined(IA64)
|
|| defined(IA64)
|
||||||
/* On a register window machine, we need to save register */
|
/* On a register window machine, we need to save register */
|
||||||
|
@ -452,12 +461,18 @@ ptr_t cold_gc_frame;
|
||||||
/* and later. */
|
/* and later. */
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
GC_push_current_stack(cold_gc_frame);
|
fn(arg);
|
||||||
/* Strongly discourage the compiler from treating the above */
|
/* Strongly discourage the compiler from treating the above */
|
||||||
/* as a tail-call, since that would pop the register */
|
/* as a tail-call, since that would pop the register */
|
||||||
/* contents before we get a chance to look at them. */
|
/* contents before we get a chance to look at them. */
|
||||||
GC_noop1((word)(&dummy));
|
GC_noop1((word)(&dummy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(USE_GENERIC_PUSH_REGS)
|
||||||
|
void GC_generic_push_regs(cold_gc_frame)
|
||||||
|
ptr_t cold_gc_frame;
|
||||||
|
{
|
||||||
|
GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame);
|
||||||
}
|
}
|
||||||
#endif /* USE_GENERIC_PUSH_REGS */
|
#endif /* USE_GENERIC_PUSH_REGS */
|
||||||
|
|
||||||
|
|
|
@ -368,8 +368,11 @@ ptr_t p;
|
||||||
|
|
||||||
ptr_t GC_approx_sp()
|
ptr_t GC_approx_sp()
|
||||||
{
|
{
|
||||||
word dummy;
|
VOLATILE word dummy;
|
||||||
|
|
||||||
|
dummy = 42; /* Force stack to grow if necessary. Otherwise the */
|
||||||
|
/* later accesses might cause the kernel to think we're */
|
||||||
|
/* doing something wrong. */
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# pragma warning(disable:4172)
|
# pragma warning(disable:4172)
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -101,8 +101,28 @@ word GC_stop_count; /* Incremented at the beginning of GC_stop_world. */
|
||||||
|
|
||||||
sem_t GC_suspend_ack_sem;
|
sem_t GC_suspend_ack_sem;
|
||||||
|
|
||||||
|
void GC_suspend_handler_inner(ptr_t sig_arg);
|
||||||
|
|
||||||
|
#if defined(IA64) || defined(HP_PA)
|
||||||
|
extern void GC_with_callee_saves_pushed();
|
||||||
|
|
||||||
void GC_suspend_handler(int sig)
|
void GC_suspend_handler(int sig)
|
||||||
{
|
{
|
||||||
|
GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* We believe that in all other cases the full context is already */
|
||||||
|
/* in the signal handler frame. */
|
||||||
|
void GC_suspend_handler(int sig)
|
||||||
|
{
|
||||||
|
GC_suspend_handler_inner((ptr_t)(word)sig);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void GC_suspend_handler_inner(ptr_t sig_arg)
|
||||||
|
{
|
||||||
|
int sig = (int)(word)sig_arg;
|
||||||
int dummy;
|
int dummy;
|
||||||
pthread_t my_thread = pthread_self();
|
pthread_t my_thread = pthread_self();
|
||||||
GC_thread me;
|
GC_thread me;
|
||||||
|
@ -369,11 +389,13 @@ void GC_stop_world()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < n_live_threads; i++) {
|
for (i = 0; i < n_live_threads; i++) {
|
||||||
if (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
|
while (0 != (code = sem_wait(&GC_suspend_ack_sem))) {
|
||||||
|
if (errno != EINTR) {
|
||||||
GC_err_printf1("Sem_wait returned %ld\n", (unsigned long)code);
|
GC_err_printf1("Sem_wait returned %ld\n", (unsigned long)code);
|
||||||
ABORT("sem_wait for handler failed");
|
ABORT("sem_wait for handler failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
# ifdef PARALLEL_MARK
|
# ifdef PARALLEL_MARK
|
||||||
GC_release_mark_lock();
|
GC_release_mark_lock();
|
||||||
# endif
|
# endif
|
||||||
|
|
Loading…
Reference in New Issue