* eval.c (POST_GETCONTEXT): define separately from PRE_GETCONTEXT on

IA64 to avoid reusing variable address.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2006-01-22 13:17:39 +00:00
parent 8902cab770
commit 205e7c74ea
2 changed files with 58 additions and 44 deletions

View File

@ -1,7 +1,14 @@
Sun Jan 22 22:09:52 2006 Tanaka Akira <akr@m17n.org>
* eval.c (POST_GETCONTEXT): define separately from PRE_GETCONTEXT on
IA64 to avoid reusing variable address.
Sun Jan 22 20:03:35 2006 Tanaka Akira <akr@m17n.org> Sun Jan 22 20:03:35 2006 Tanaka Akira <akr@m17n.org>
* eval.c (ruby_setjmp): workaround for FreeBSD/i386 * eval.c (ruby_setjmp): define PRE_GETCONTEXT and POST_GETCONTEXT
getcontext/setcontext bug. instead of FUNCTION_CALL_MAY_RETURN_TWICE.
define PRE_GETCONTEXT to clear carry flag for workaround of
FreeBSD/i386 getcontext/setcontext bug.
[ruby-dev:28263] [ruby-dev:28263]
Thu Jan 19 22:19:18 2006 Minero Aoki <aamine@loveruby.net> Thu Jan 19 22:19:18 2006 Minero Aoki <aamine@loveruby.net>

33
eval.c
View File

@ -148,23 +148,27 @@ rb_jump_context(env, val)
({ __asm__ volatile ("" : : : \ ({ __asm__ volatile ("" : : : \
"%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
"%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", \
"%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }) "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }),
# else # else
# define PRE_GETCONTEXT \ # define PRE_GETCONTEXT \
({ __asm__ volatile ("" : : : \ ({ __asm__ volatile ("" : : : \
"%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \ "%o0", "%o1", "%o2", "%o3", "%o4", "%o5", "%o7", \
"%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \ "%l0", "%l1", "%l2", "%l3", "%l4", "%l5", "%l6", "%l7", \
"%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }) "%i0", "%i1", "%i2", "%i3", "%i4", "%i5", "%i7"); }),
# endif # endif
# define POST_GETCONTEXT PRE_GETCONTEXT # define POST_GETCONTEXT PRE_GETCONTEXT
# elif GCC_VERSION_BEFORE(4,0,3) && defined(__ia64) # elif GCC_VERSION_BEFORE(4,0,3) && defined(__ia64)
static jmp_buf function_call_may_return_twice_jmp_buf; static jmp_buf function_call_may_return_twice_jmp_buf;
int function_call_may_return_twice_false = 0; int function_call_may_return_twice_false_1 = 0;
int function_call_may_return_twice_false_2 = 0;
# define PRE_GETCONTEXT \ # define PRE_GETCONTEXT \
(function_call_may_return_twice_false ? \ (function_call_may_return_twice_false_1 ? \
setjmp(function_call_may_return_twice_jmp_buf) : \ setjmp(function_call_may_return_twice_jmp_buf) : \
0) 0),
#define POST_GETCONTEXT PRE_GETCONTEXT # define POST_GETCONTEXT \
(function_call_may_return_twice_false_2 ? \
setjmp(function_call_may_return_twice_jmp_buf) : \
0),
# elif defined(__FreeBSD__) # elif defined(__FreeBSD__)
/* /*
* workaround for FreeBSD/i386 getcontext/setcontext bug. * workaround for FreeBSD/i386 getcontext/setcontext bug.
@ -173,28 +177,31 @@ int function_call_may_return_twice_false = 0;
* [ruby-dev:28263] * [ruby-dev:28263]
*/ */
static int volatile freebsd_clear_carry_flag = 0; static int volatile freebsd_clear_carry_flag = 0;
#define PRE_GETCONTEXT (freebsd_clear_carry_flag ? (freebsd_clear_carry_flag = 0) : 0) # define PRE_GETCONTEXT \
(freebsd_clear_carry_flag ? (freebsd_clear_carry_flag = 0) : 0),
# endif # endif
# ifndef PRE_GETCONTEXT # ifndef PRE_GETCONTEXT
# define PRE_GETCONTEXT 0 # define PRE_GETCONTEXT
# endif # endif
# ifndef POST_GETCONTEXT # ifndef POST_GETCONTEXT
# define POST_GETCONTEXT 0 # define POST_GETCONTEXT
# endif # endif
# define ruby_longjmp(env, val) rb_jump_context(env, val) # define ruby_longjmp(env, val) rb_jump_context(env, val)
# define ruby_setjmp(just_before_setjmp, j) ((j)->status = 0, \ # define ruby_setjmp(just_before_setjmp, j) ((j)->status = 0, \
(just_before_setjmp), \ (just_before_setjmp), \
PRE_GETCONTEXT, \ PRE_GETCONTEXT \
getcontext(&(j)->context), \ getcontext(&(j)->context), \
POST_GETCONTEXT, \ POST_GETCONTEXT \
(j)->status) (j)->status)
#else #else
typedef jmp_buf rb_jmpbuf_t; typedef jmp_buf rb_jmpbuf_t;
# if !defined(setjmp) && defined(HAVE__SETJMP) # if !defined(setjmp) && defined(HAVE__SETJMP)
#define ruby_setjmp(just_before_setjmp, env) ((just_before_setjmp), _setjmp(env)) # define ruby_setjmp(just_before_setjmp, env) \
((just_before_setjmp), _setjmp(env))
# define ruby_longjmp(env,val) _longjmp(env,val) # define ruby_longjmp(env,val) _longjmp(env,val)
# else # else
#define ruby_setjmp(just_before_setjmp, env) ((just_before_setjmp), setjmp(env)) # define ruby_setjmp(just_before_setjmp, env) \
((just_before_setjmp), setjmp(env))
# define ruby_longjmp(env,val) longjmp(env,val) # define ruby_longjmp(env,val) longjmp(env,val)
# endif # endif
#endif #endif