summaryrefslogtreecommitdiff
path: root/lang/ruby18
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2006-01-22 05:47:53 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2006-01-22 05:47:53 +0000
commitf35229590b6b5b323c1b01abd2946e20fc1a0476 (patch)
tree8951ae1e7cba19c2e12ccf906bd304d14ffc29b6 /lang/ruby18
parentUpdate to Wine 0.9.6. (diff)
Better fix for the problem on AMD64 and Pentium4 since rev1.4.
getcontext() saves EFLAGS and setcontext() restores it. When carry flag is set in EFLAGS, setcontext() treats it as an system call error. This problem is filed as misc/92110. rev1.3 and before hid this problem, and rev1.4 exposed it. Drop carry flag before getcontext() for workaround for this problem. Submitted by: Tanaka Akira <akr__at__m17n.org> Tested by: TAKANO Yuji <takachan__at__running-dog.net>
Notes
Notes: svn path=/head/; revision=154133
Diffstat (limited to 'lang/ruby18')
-rw-r--r--lang/ruby18/files/patch-eval.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/lang/ruby18/files/patch-eval.c b/lang/ruby18/files/patch-eval.c
index 9c0f6694b835..72fc25e22608 100644
--- a/lang/ruby18/files/patch-eval.c
+++ b/lang/ruby18/files/patch-eval.c
@@ -1,8 +1,8 @@
Index: eval.c
diff -u -p eval.c.orig eval.c
--- eval.c.orig Tue Dec 20 22:41:47 2005
-+++ eval.c Sun Jan 22 02:50:12 2006
-@@ -129,20 +129,44 @@ rb_jump_context(env, val)
++++ eval.c Sun Jan 22 13:59:48 2006
+@@ -129,32 +129,64 @@ rb_jump_context(env, val)
* But it has not the problem because gcc knows setjmp may return twice.
* gcc detects setjmp and generates setjmp safe code.
*
@@ -34,42 +34,39 @@ diff -u -p eval.c.orig eval.c
+ * http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
*/
-#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__))
-+#define FUNCTION_CALL_MAY_RETURN_TWICE \
-+ ({ __asm__ volatile ("" : : : \
-+ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
-+ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
-+ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-+#else
#define FUNCTION_CALL_MAY_RETURN_TWICE \
({ __asm__ volatile ("" : : : \
"%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
+- "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
++ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
"%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
-+#endif
#else
++#define FUNCTION_CALL_MAY_RETURN_TWICE \
++ ({ __asm__ volatile ("" : : : \
++ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
++ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
++ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
++#endif
++#elif defined(__ia64)
static jmp_buf function_call_may_return_twice_jmp_buf;
int function_call_may_return_twice_false = 0;
-@@ -151,11 +175,23 @@ int function_call_may_return_twice_false
+ #define FUNCTION_CALL_MAY_RETURN_TWICE \
+ (function_call_may_return_twice_false ? \
setjmp(function_call_may_return_twice_jmp_buf) : \
0)
- #endif
+#else
+#define FUNCTION_CALL_MAY_RETURN_TWICE 0
+#endif
- #define ruby_longjmp(env, val) rb_jump_context(env, val)
-+#if GCC_VERSION_BEFORE(4,0,3) && \
-+ (defined(sparc) || defined(__sparc__) || defined(__ia64))
-+#define ruby_setjmp(j) ((j)->status = 0, \
-+ FUNCTION_CALL_MAY_RETURN_TWICE, \
-+ getcontext(&(j)->context), \
-+ FUNCTION_CALL_MAY_RETURN_TWICE, \
-+ (j)->status)
+#else
++#define FUNCTION_CALL_MAY_RETURN_TWICE 0
+ #endif
+ #define ruby_longjmp(env, val) rb_jump_context(env, val)
++static volatile int freebsd_clear_carry_flag = 0;
#define ruby_setjmp(j) ((j)->status = 0, \
FUNCTION_CALL_MAY_RETURN_TWICE, \
++ freebsd_clear_carry_flag = freebsd_clear_carry_flag + freebsd_clear_carry_flag, \
getcontext(&(j)->context), \
++ FUNCTION_CALL_MAY_RETURN_TWICE, \
(j)->status)
-+#endif
#else
typedef jmp_buf rb_jmpbuf_t;
- #if !defined(setjmp) && defined(HAVE__SETJMP)