summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-18 15:01:22 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-01-18 15:01:22 +0000
commit1c2a9685b9f60c73bd61b7b1ca82fe0f63700633 (patch)
tree3c780c74274d9983cfaeec8c694eff8ac6da0aa7
parent9c5a0f4969b4f651bdd303f19c003cad27b6aeb0 (diff)
downloadruby-1c2a9685b9f60c73bd61b7b1ca82fe0f63700633.tar.gz
ruby-1c2a9685b9f60c73bd61b7b1ca82fe0f63700633.tar.xz
ruby-1c2a9685b9f60c73bd61b7b1ca82fe0f63700633.zip
* eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): don't clobber %l7 of SPARC
if enable-shared. (ruby_setjmp): call FUNCTION_CALL_MAY_RETURN_TWICE after getcontext too. reported by Pav Lucistnik and Marius Strobl. http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog9
-rw-r--r--eval.c16
2 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a81b63d5..d89a082cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Wed Jan 18 23:37:06 2006 Tanaka Akira <akr@m17n.org>
+
+ * eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): don't clobber %l7 of SPARC
+ if enable-shared.
+ (ruby_setjmp): call FUNCTION_CALL_MAY_RETURN_TWICE after getcontext
+ too.
+ reported by Pav Lucistnik and Marius Strobl.
+ http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
+
Tue Jan 17 23:59:56 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* object.c (rb_mod_const_get, rb_mod_const_defined): added optional
diff --git a/eval.c b/eval.c
index c6e336a86..221deae31 100644
--- a/eval.c
+++ b/eval.c
@@ -119,7 +119,8 @@ 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.
*
- * So setjmp call before getcontext call makes the code somewhat safe.
+ * So setjmp calls before and after getcontext call makes the code
+ * somewhat safe.
* It fix the problem on IA64.
* It is not required that setjmp is called at run time, since the problem is
* register usage.
@@ -139,11 +140,23 @@ rb_jump_context(env, val)
(__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
#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;
@@ -162,6 +175,7 @@ int function_call_may_return_twice_false = 0;
(just_before_setjmp), \
FUNCTION_CALL_MAY_RETURN_TWICE, \
getcontext(&(j)->context), \
+ FUNCTION_CALL_MAY_RETURN_TWICE, \
(j)->status)
#else
typedef jmp_buf rb_jmpbuf_t;