Author: yamakenz
Date: Mon Aug 27 07:19:54 2007
New Revision: 4893

Added:
   sigscheme-trunk/m4/ax_func_sigsetjmp.m4
      - copied unchanged from r4884, /trunk/m4/ax_func_sigsetjmp.m4
Modified:
   sigscheme-trunk/NEWS
   sigscheme-trunk/QALog
   sigscheme-trunk/configure.in
   sigscheme-trunk/m4/Makefile.am
   sigscheme-trunk/src/continuation.c

Log:
* src/continuation.c
  - (JMP_BUF, SETJMP, LONGJMP): New macro
  - (struct scm_continuation_frame, scm_call_with_current_continuation,
    scm_call_continuation): Use sigsetjmp(3) and siglongjmp(3) if available
* m4/ax_func_sigsetjmp.m4
  - New file copied from trunk/m4/ax_func_sigsetjmp.m4
* m4/Makefile.am
  - (EXTRA_DIST): Add ax_func_sigsetjmp.m4
* configure.in
  - Add AX_FUNC_SIGSETJMP
* QALog
* NEWS
  - Update


Modified: sigscheme-trunk/NEWS
==============================================================================
--- sigscheme-trunk/NEWS        (original)
+++ sigscheme-trunk/NEWS        Mon Aug 27 07:19:54 2007
@@ -70,6 +70,9 @@
     standard current ports handling on with-input-from-file and
     with-output-to-file are now continuation-safe by dynamic-wind
 
+  - Continuation implementation now uses sigsetjmp(3) and siglongjmp(3) if
+    available
+
 * Fixes
 
   - [CRITICAL] Fix unterminated string generation on singlebyte character codec

Modified: sigscheme-trunk/QALog
==============================================================================
--- sigscheme-trunk/QALog       (original)
+++ sigscheme-trunk/QALog       Mon Aug 27 07:19:54 2007
@@ -679,7 +679,7 @@
 
 file:              continuation.c
 category:          core
-spec by eyes:      [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
+spec by eyes:      [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], 
[EMAIL PROTECTED]
 spec by tests:     [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
 general review:    [EMAIL PROTECTED]
 64-bit by eyes:    [EMAIL PROTECTED]

Modified: sigscheme-trunk/configure.in
==============================================================================
--- sigscheme-trunk/configure.in        (original)
+++ sigscheme-trunk/configure.in        Mon Aug 27 07:19:54 2007
@@ -203,6 +203,7 @@
 #
 
 AX_FUNC_GETCONTEXT
+AX_FUNC_SIGSETJMP
 
 AC_CHECK_FUNCS([strtoll strtoimax \
                 memalign \

Modified: sigscheme-trunk/m4/Makefile.am
==============================================================================
--- sigscheme-trunk/m4/Makefile.am      (original)
+++ sigscheme-trunk/m4/Makefile.am      Mon Aug 27 07:19:54 2007
@@ -7,5 +7,6 @@
              ax_create_stdint_h.m4                      \
              ax_feature_configurator.m4                 \
              ax_func_getcontext.m4                      \
+             ax_func_sigsetjmp.m4                       \
              ax_lib_glibc.m4                            \
              check_gnu_make.m4

Modified: sigscheme-trunk/src/continuation.c
==============================================================================
--- sigscheme-trunk/src/continuation.c  (original)
+++ sigscheme-trunk/src/continuation.c  Mon Aug 27 07:19:54 2007
@@ -46,6 +46,16 @@
 /*=======================================
   File Local Macro Definitions
 =======================================*/
+#if HAVE_SIGSETJMP
+#define JMP_BUF           sigjmp_buf
+#define SETJMP(env)       sigsetjmp((env), 1)
+#define LONGJMP(env, val) siglongjmp((env), (val))
+#else
+#define JMP_BUF           jmp_buf
+#define SETJMP(env)       setjmp(env)
+#define LONGJMP(env, val) longjmp((env), (val))
+#endif
+
 #define CONTINUATION_FRAME(cont)                                             \
     ((struct scm_continuation_frame *)SCM_CONTINUATION_OPAQUE(cont))
 #define CONTINUATION_SET_FRAME    SCM_CONTINUATION_SET_OPAQUE
@@ -63,7 +73,7 @@
 #if SCM_USE_BACKTRACE
     volatile ScmObj trace_stack;
 #endif
-    jmp_buf c_env;
+    JMP_BUF c_env;
 };
 
 /*=======================================
@@ -277,7 +287,7 @@
     continuation_stack_push(cont);
 #endif
 
-    if (setjmp(cont_frame.c_env)) {
+    if (SETJMP(cont_frame.c_env)) {
         /* returned back to the original continuation */
         /* Don't refer cont because it may already be invalidated by
          * continuation_stack_unwind(). */
@@ -332,7 +342,7 @@
         exit_dynamic_extent(frame->dyn_ext);
 
         frame->ret_val = ret;
-        longjmp(frame->c_env, scm_true);
+        LONGJMP(frame->c_env, scm_true);
         /* NOTREACHED */
     } else {
         ERR("expired continuation");

Reply via email to