diff options
author | ume <ume@FreeBSD.org> | 2006-01-21 03:32:32 +0800 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2006-01-21 03:32:32 +0800 |
commit | 4f4e1daae22d5ef531adb1e9db9aa1df57dd14b1 (patch) | |
tree | 8bbf1b88c4042bc2c1ae3a6a1c945d7997d868f2 /lang/ruby18/files | |
parent | 1bf77a60d2a570e0c4585827cb95b31bd75d5072 (diff) | |
download | freebsd-ports-gnome-4f4e1daae22d5ef531adb1e9db9aa1df57dd14b1.tar.gz freebsd-ports-gnome-4f4e1daae22d5ef531adb1e9db9aa1df57dd14b1.tar.zst freebsd-ports-gnome-4f4e1daae22d5ef531adb1e9db9aa1df57dd14b1.zip |
eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): use only for SPARC and IA64
before gcc 4.0.3.
previous one broke xcgroup of XCAST6:
http://sourceforge.net/projects/xcast6/
Reported by: SUZUKI Koichi <metal__at__gc5.so-net.ne.jp>
Obtained from: http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/ruby/eval.c.diff?r1=1.616.2.148;r2=1.616.2.149
Diffstat (limited to 'lang/ruby18/files')
-rw-r--r-- | lang/ruby18/files/patch-eval.c | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/lang/ruby18/files/patch-eval.c b/lang/ruby18/files/patch-eval.c index 92160482485c..06f539215e5e 100644 --- a/lang/ruby18/files/patch-eval.c +++ b/lang/ruby18/files/patch-eval.c @@ -1,6 +1,8 @@ ---- eval.c 2005/12/31 13:57:36 1.616.2.147 -+++ eval.c 2006/01/18 15:01:22 1.616.2.148 -@@ -129,7 +129,8 @@ rb_jump_context(env, val) +Index: eval.c +diff -u -p eval.c.orig eval.c +--- eval.c.orig Tue Dec 20 22:41:47 2005 ++++ eval.c Sat Jan 21 04:13:25 2006 +@@ -129,32 +129,62 @@ 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. * @@ -10,31 +12,55 @@ * It fix the problem on IA64. * It is not required that setjmp is called at run time, since the problem is * register usage. -@@ -138,11 +139,23 @@ rb_jump_context(env, val) + * + * Since the magic setjmp is not enough for SPARC, * inline asm is used to prohibit registers in register windows. - */ - #if defined (__GNUC__) && (defined(sparc) || defined(__sparc__)) ++ * ++ * Since the problem is fixed at gcc 4.0.3, the magic is applied only for ++ * prior versions of gcc. ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21957 ++ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22127 ++ */ ++#define GCC_VERSION_BEFORE(major, minor, patchlevel) \ ++ (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \ ++ ((__GNUC__ < (major)) || \ ++ (__GNUC__ == (major) && __GNUC_MINOR__ < (minor)) || \ ++ (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ < (patchlevel)))) ++#if GCC_VERSION_BEFORE(4,0,3) ++#if defined(sparc) || defined(__sparc__) +#ifdef __pic__ +/* + * %l7 is excluded for PIC because it is PIC register. + * http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html -+ */ -+#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 + */ +-#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", "%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; -@@ -155,6 +168,7 @@ 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) ++#else ++#define FUNCTION_CALL_MAY_RETURN_TWICE 0 ++#endif ++#else ++#define FUNCTION_CALL_MAY_RETURN_TWICE 0 + #endif + #define ruby_longjmp(env, val) rb_jump_context(env, val) #define ruby_setjmp(j) ((j)->status = 0, \ FUNCTION_CALL_MAY_RETURN_TWICE, \ getcontext(&(j)->context), \ |