~ chicken-core (chicken-5) 78c15c477f6109bc2f25281c9611c5bc96b13c74
commit 78c15c477f6109bc2f25281c9611c5bc96b13c74
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Sun Jun 16 00:04:55 2013 +0200
Commit: Peter Bex <peter.bex@xs4all.nl>
CommitDate: Mon Jun 17 09:23:08 2013 +0200
If sigsetjmp(3) is used, "gc_restart" must be of the correct type.
Signed-off-by: Peter Bex <peter.bex@xs4all.nl>
diff --git a/chicken.h b/chicken.h
index ce54b3c1..fb7418e3 100644
--- a/chicken.h
+++ b/chicken.h
@@ -1591,7 +1591,11 @@ C_varextern C_TLS C_long
C_varextern C_TLS C_byte
*C_fromspace_top,
*C_fromspace_limit;
+#ifdef HAVE_SIGSETJMP
+C_varextern C_TLS sigjmp_buf C_restart;
+#else
C_varextern C_TLS jmp_buf C_restart;
+#endif
C_varextern C_TLS void *C_restart_address;
C_varextern C_TLS int C_entry_point_status;
C_varextern C_TLS int C_gui_mode;
diff --git a/runtime.c b/runtime.c
index 5ce267e1..ea16aadb 100644
--- a/runtime.c
+++ b/runtime.c
@@ -334,7 +334,11 @@ C_TLS C_long
C_TLS C_byte
*C_fromspace_top,
*C_fromspace_limit;
+#ifdef HAVE_SIGSETJMP
+C_TLS sigjmp_buf C_restart;
+#else
C_TLS jmp_buf C_restart;
+#endif
C_TLS void *C_restart_address;
C_TLS int C_entry_point_status;
C_TLS int (*C_gc_mutation_hook)(C_word *slot, C_word val);
@@ -442,7 +446,11 @@ static C_TLS unsigned int
mutation_count,
stack_size;
static C_TLS int chicken_is_initialized;
+#ifdef HAVE_SIGSETJMP
+static C_TLS sigjmp_buf gc_restart;
+#else
static C_TLS jmp_buf gc_restart;
+#endif
static C_TLS double
timer_start_ms,
gc_ms,
@@ -1917,7 +1925,7 @@ C_word C_fcall C_callback(C_word closure, int argc)
if(old && C_block_item(callback_continuation_stack_symbol, 0) == C_SCHEME_END_OF_LIST)
panic(C_text("callback invoked in non-safe context"));
- C_memcpy(&prev, &C_restart, sizeof(jmp_buf));
+ C_memcpy(&prev, &C_restart, sizeof(C_restart));
callback_returned_flag = 0;
chicken_is_running = 1;
@@ -1931,7 +1939,7 @@ C_word C_fcall C_callback(C_word closure, int argc)
if(!callback_returned_flag) (C_restart_trampoline)(C_restart_address);
else {
- C_memcpy(&C_restart, &prev, sizeof(jmp_buf));
+ C_memcpy(&C_restart, &prev, sizeof(C_restart));
callback_returned_flag = 0;
}
Trap