Skip to content

Commit 946308a

Browse files
committed
* 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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent c81b214 commit 946308a

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
Wed Jan 18 23:37:06 2006 Tanaka Akira <akr@m17n.org>
2+
3+
* eval.c (FUNCTION_CALL_MAY_RETURN_TWICE): don't clobber %l7 of SPARC
4+
if enable-shared.
5+
(ruby_setjmp): call FUNCTION_CALL_MAY_RETURN_TWICE after getcontext
6+
too.
7+
reported by Pav Lucistnik and Marius Strobl.
8+
http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
9+
110
Tue Jan 17 11:32:46 2006 NAKAMURA Usaku <usa@ruby-lang.org>
211

312
* win32/setup.mak (MAKE): workaround for nmake 8.

eval.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ rb_jump_context(env, val)
129129
* But it has not the problem because gcc knows setjmp may return twice.
130130
* gcc detects setjmp and generates setjmp safe code.
131131
*
132-
* So setjmp call before getcontext call makes the code somewhat safe.
132+
* So setjmp calls before and after the getcontext call makes the code
133+
* somewhat safe.
133134
* It fix the problem on IA64.
134135
* It is not required that setjmp is called at run time, since the problem is
135136
* register usage.
@@ -138,11 +139,23 @@ rb_jump_context(env, val)
138139
* inline asm is used to prohibit registers in register windows.
139140
*/
140141
#if defined (__GNUC__) && (defined(sparc) || defined(__sparc__))
142+
#ifdef __pic__
143+
/*
144+
* %l7 is excluded for PIC because it is PIC register.
145+
* http://lists.freebsd.org/pipermail/freebsd-sparc64/2006-January/003739.html
146+
*/
147+
#define FUNCTION_CALL_MAY_RETURN_TWICE \
148+
({ __asm__ volatile ("" : : : \
149+
"%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
150+
"%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
151+
"%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
152+
#else
141153
#define FUNCTION_CALL_MAY_RETURN_TWICE \
142154
({ __asm__ volatile ("" : : : \
143155
"%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
144156
"%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
145157
"%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); })
158+
#endif
146159
#else
147160
static jmp_buf function_call_may_return_twice_jmp_buf;
148161
int function_call_may_return_twice_false = 0;
@@ -155,6 +168,7 @@ int function_call_may_return_twice_false = 0;
155168
#define ruby_setjmp(j) ((j)->status = 0, \
156169
FUNCTION_CALL_MAY_RETURN_TWICE, \
157170
getcontext(&(j)->context), \
171+
FUNCTION_CALL_MAY_RETURN_TWICE, \
158172
(j)->status)
159173
#else
160174
typedef jmp_buf rb_jmpbuf_t;

0 commit comments

Comments
 (0)