From 2fab485a46bde9948ac70f57e1058d48a4aca141 Mon Sep 17 00:00:00 2001 From: akr Date: Fri, 20 Jan 2006 15:39:58 +0000 Subject: * eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): use only for SPARC and IA64 before gcc 4.0.3. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval.c | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5462d0bd60..59a169509f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 21 00:36:47 2006 Tanaka Akira + + * eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): use only for SPARC and IA64 + before gcc 4.0.3. + Thu Jan 19 22:21:23 2006 Minero Aoki * lib/fileutils.rb (mv): should remove file after copying. diff --git a/eval.c b/eval.c index 3556f20c87..c87d70d4f3 100644 --- a/eval.c +++ b/eval.c @@ -137,8 +137,19 @@ rb_jump_context(env, val) * * Since the magic setjmp is not enough for SPARC, * inline asm is used to prohibit registers in register windows. + * + * 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 */ -#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__)) +#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. @@ -156,13 +167,18 @@ rb_jump_context(env, val) "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \ "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }) #endif -#else +#elif defined(__ia64) static jmp_buf function_call_may_return_twice_jmp_buf; int function_call_may_return_twice_false = 0; #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, \ -- cgit v1.2.3