]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Use "sigsetjmp" instead of "setjmp", because "setjmp" may
authorRhys Weatherley <rweather@southern-storm.com.au>
Mon, 7 Jun 2004 01:01:33 +0000 (01:01 +0000)
committerRhys Weatherley <rweather@southern-storm.com.au>
Mon, 7 Jun 2004 01:01:33 +0000 (01:01 +0000)
be a macro on some systems.

ChangeLog
configure.in
jit/jit-insn.c

index 5541f442d18c9c330ea99a2cbf3b352287440e85..5cfb54d447f633d770e3bbdb9c814d28fcf046e9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,9 @@
 
        * jit/jit-value.c: fix a warning.
 
+       * configure.in, jit/jit-insn.c: use "sigsetjmp" instead of
+       "setjmp", because "setjmp" may be a macro on some systems.
+
 2004-06-06  Miroslaw Dobrzanski-Neumann  <mne@mosaic-ag.com>
 
        * jit/jit-alloc.c (jit_flush_exec): flush cache lines properly
index 0c2a8b59d745c7ddb3c21316b40bbe772ea2c3d5..d5c50ec1c1fbf0613f2135243d709937b53b8642 100644 (file)
@@ -419,6 +419,7 @@ AC_CHECK_FUNCS(isnanl isinfl finitel fmodl remainderl dreml ceill floorl)
 AC_CHECK_FUNCS(acosl asinl atanl atan2l cosl coshl expl logl log10l powl)
 AC_CHECK_FUNCS(sinl sinhl sqrtl tanl tanhl)
 AC_CHECK_FUNCS(dlopen cygwin_conv_to_win32_path mmap munmap mprotect)
+AC_CHECK_FUNCS(sigsetjmp __sigsetjmp)
 AC_FUNC_ALLOCA
 
 AC_OUTPUT([
index 4df77654469a8987f315f32b5c16f47ba5abea8d..994b1a4a055c3639fa1ba802c28c8ff4f30829ca 100644 (file)
@@ -6397,7 +6397,7 @@ static int initialize_setjmp_block(jit_function_t func)
        jit_label_t end_label = jit_label_undefined;
        jit_label_t rethrow_label = jit_label_undefined;
        jit_type_t type;
-       jit_value_t args[1];
+       jit_value_t args[2];
        jit_value_t value;
 
        /* Bail out if we have already done this before */
@@ -6443,7 +6443,37 @@ static int initialize_setjmp_block(jit_function_t func)
                 (void *)_jit_unwind_push_setjmp, type, args, 1, JIT_CALL_NOTHROW);
        jit_type_free(type);
 
-       /* Call "setjmp" with "&setjmp_value" as its argument */
+       /* Call "__sigsetjmp" or "setjmp" with "&setjmp_value" as its argument.
+          We prefer "__sigsetjmp" because it is least likely to be a macro */
+#if defined(HAVE___SIGSETJMP) || defined(HAVE_SIGSETJMP)
+       {
+               jit_type_t params[2];
+               params[0] = jit_type_void_ptr;
+               params[1] = jit_type_sys_int;
+               type = jit_type_create_signature
+                       (jit_abi_cdecl, jit_type_int, params, 2, 1);
+       }
+       if(!type)
+       {
+               return 0;
+       }
+       args[0] = jit_insn_address_of(func, func->builder->setjmp_value);
+       args[1] = jit_value_create_nint_constant(func, jit_type_sys_int, 1);
+#if defined(HAVE___SIGSETJMP)
+       value = jit_insn_call_native
+               (func, "__sigsetjmp", (void *)__sigsetjmp,
+                type, args, 2, JIT_CALL_NOTHROW);
+#else
+       value = jit_insn_call_native
+               (func, "sigsetjmp", (void *)sigsetjmp,
+                type, args, 2, JIT_CALL_NOTHROW);
+#endif
+       jit_type_free(type);
+       if(!value)
+       {
+               return 0;
+       }
+#else  /* !HAVE_SIGSETJMP */
        type = jit_type_void_ptr;
        type = jit_type_create_signature
                (jit_abi_cdecl, jit_type_int, &type, 1, 1);
@@ -6459,6 +6489,7 @@ static int initialize_setjmp_block(jit_function_t func)
        {
                return 0;
        }
+#endif /* !HAVE_SIGSETJMP */
 
        /* Branch to the end of the init code if "setjmp" returned zero */
        if(!jit_insn_branch_if_not(func, value, &end_label))