Fix Boehm-Weiser gc so that we can use our mprotect() mechanism for deferring signals together with B-W's memory protection and generational garbage collector.

This commit is contained in:
Juan Jose Garcia Ripoll 2009-05-23 15:53:30 +02:00
parent 82f27b15c0
commit 94725152ce
7 changed files with 29 additions and 27 deletions

View file

@ -28,6 +28,13 @@ ECL 9.5:
By default a correctable error is signaled and the user is given the
chance to increase the heap size.
- Under Mac OS/X, ECL now uses its own modified version of the Boehm-Weiser
garbage collector that allows both --enable-gengc and our optimized
code for signal handling.
- New condition EXT:SEGMENTATION-VIOLATION signaled by SIGSEGV and SIGBUS
events.
* Bugs fixed:
- Remove an obsolete #if statement for Solaris that broke current builds

3
src/aclocal.m4 vendored
View file

@ -324,6 +324,9 @@ case "${host_os}" in
else
export ABI=mode32
fi
# The Boehm-Weiser GC library shipped with Fink does not work
# well with our signal handler.
enable_boehm=included
# ECL, due to some of the libraries, does not build on
# 64 bit mode on OSX. We prevent GMP using that mode.
SONAME="${SHAREDPREFIX}ecl.SOVERSION.${SHAREDEXT}"

View file

@ -417,7 +417,7 @@ init_alloc(void)
GC_start_call_back = (void (*)())finalize_queued;
GC_java_finalization = 1;
GC_oom_fn = out_of_memory;
GC_set_warn_proc(no_warnings);
/*GC_set_warn_proc(no_warnings);*/
GC_enable();
}

View file

@ -256,23 +256,11 @@ handler_fn_protype(lisp_signal_handler, int sig, siginfo_t *info, void *aux)
cl_error(1, condition);
break;
}
case SIGSEGV: {
ecl_frame_ptr destination = frs_sch(OBJNULL);
if (destination) {
the_env->nvalues = 0;
ecl_unwind(the_env, destination);
}
ecl_internal_error("SIGSEGV without handler to jump to.");
}
case SIGSEGV:
cl_error(1, @'ext::segmentation-violation');
#ifdef SIGBUS
case SIGBUS: {
ecl_frame_ptr destination = frs_sch(OBJNULL);
if (destination) {
the_env->nvalues = 0;
ecl_unwind(the_env, destination);
}
ecl_internal_error("SIGBUS without handler to jump to.");
}
case SIGBUS:
cl_error(1, @'ext::segmentation-violation');
#endif
default:
FEerror("Serious signal ~D caught.", 1, MAKE_FIXNUM(sig));

View file

@ -538,7 +538,11 @@ returns with NIL."
(define-condition storage-condition (serious-condition) ())
(define-condition ext:segmentation-violation (storage-condition) ())
(define-condition ext:segmentation-violation (storage-condition)
()
(:REPORT
(lambda (condition stream)
(format stream "Detected access to an invalid or protected memory address."))))
(define-condition ext:stack-overflow (storage-condition)
((size :initarg :size :initform 0 :reader ext:stack-overflow-size)

3
src/configure vendored
View file

@ -4459,6 +4459,9 @@ case "${host_os}" in
else
export ABI=mode32
fi
# The Boehm-Weiser GC library shipped with Fink does not work
# well with our signal handler.
enable_boehm=included
# ECL, due to some of the libraries, does not build on
# 64 bit mode on OSX. We prevent GMP using that mode.
SONAME="${SHAREDPREFIX}ecl.SOVERSION.${SHAREDEXT}"

View file

@ -3808,16 +3808,13 @@ static kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task,
behavior = GC_old_exc_ports.behaviors[i];
flavor = GC_old_exc_ports.flavors[i];
if(behavior != EXCEPTION_DEFAULT) {
if (behavior == EXCEPTION_STATE || behavior == EXCEPTION_STATE_IDENTITY) {
r = thread_get_state(thread, flavor, thread_state, &thread_state_count);
if(r != KERN_SUCCESS)
ABORT("thread_get_state failed in forward_exception");
}
}
switch(behavior) {
case EXCEPTION_DEFAULT:
r = exception_raise(port, thread, task, exception, data, data_count);
break;
case EXCEPTION_STATE:
r = exception_raise_state(port, thread, task, exception, data, data_count,
&flavor, thread_state, thread_state_count,
@ -3829,13 +3826,13 @@ static kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task,
thread_state_count, thread_state,
&thread_state_count);
break;
default:
r = KERN_FAILURE; /* make gcc happy */
ABORT("forward_exception: unknown behavior");
case EXCEPTION_DEFAULT: /* default signal handlers */
default: /* user supplied signal handlers */
r = exception_raise(port, thread, task, exception, data, data_count);
break;
}
if(behavior != EXCEPTION_DEFAULT) {
if (behavior == EXCEPTION_STATE || behavior == EXCEPTION_STATE_IDENTITY) {
r = thread_set_state(thread, flavor, thread_state, thread_state_count);
if(r != KERN_SUCCESS)
ABORT("thread_set_state failed in forward_exception");