[前][次][番号順一覧][スレッド一覧]

ruby-changes:20494

From: nobu <ko1@a...>
Date: Thu, 14 Jul 2011 16:53:22 +0900 (JST)
Subject: [ruby-changes:20494] nobu:r32542 (ruby_1_8): * eval.c (ruby_setjmp): need to save the stack after r2 (the Table

nobu	2011-07-14 16:53:05 +0900 (Thu, 14 Jul 2011)

  New Revision: 32542

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32542

  Log:
    * eval.c (ruby_setjmp): need to save the stack after r2 (the Table
      of Contents on ppc64) is saved onto the stack by getcontext().
      based on <https://bugzilla.redhat.com/show_bug.cgi?id=628715>.
      Bug#4411

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/eval.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 32541)
+++ ruby_1_8/ChangeLog	(revision 32542)
@@ -1,3 +1,10 @@
+Thu Jul 14 16:53:01 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* eval.c (ruby_setjmp): need to save the stack after r2 (the Table
+	  of Contents on ppc64) is saved onto the stack by getcontext().
+	  based on <https://bugzilla.redhat.com/show_bug.cgi?id=628715>.
+	  Bug#4411
+
 Sun Jul  3 13:44:51 2011  Nobuyoshi Nakada  <nobu@r...>
 
 	* array.c (ary_reject_bang): should not remove elements which are
Index: ruby_1_8/eval.c
===================================================================
--- ruby_1_8/eval.c	(revision 32541)
+++ ruby_1_8/eval.c	(revision 32542)
@@ -188,6 +188,9 @@
        (function_call_may_return_twice_false_2 ? \
         setjmp(function_call_may_return_twice_jmp_buf) : \
         0)
+#  elif defined(__PPC64__)
+#    define JUST_BEFORE_SETJMP(extra_save, j) ((void)0)
+#    define JUST_AFTER_SETJMP(extra_save, j) ((j)->status ? (void)0 : (extra_save))
 #  elif defined(__FreeBSD__) && __FreeBSD__ < 7
 /*
  * workaround for FreeBSD/i386 getcontext/setcontext bug.
@@ -205,16 +208,23 @@
 #  ifndef POST_GETCONTEXT
 #    define POST_GETCONTEXT 0
 #  endif
+#  ifndef JUST_BEFORE_SETJMP
+#    define JUST_BEFORE_SETJMP(extra_save, j) (extra_save)
+#  endif
+#  ifndef JUST_AFTER_SETJMP
+#    define JUST_AFTER_SETJMP(extra_save, j) ((void)0)
+#  endif
 #  define ruby_longjmp(env, val) rb_jump_context(env, val)
-#  define ruby_setjmp(just_before_setjmp, j) ((j)->status = 0, \
-     (just_before_setjmp), \
+#  define ruby_setjmp(extra_save, j) ((j)->status = 0, \
+     JUST_BEFORE_SETJMP(extra_save, j), \
      PRE_GETCONTEXT, \
      getcontext(&(j)->context), \
      POST_GETCONTEXT, \
+     JUST_AFTER_SETJMP(extra_save, j), \
      (j)->status)
 #else
-#  define ruby_setjmp(just_before_setjmp, env) \
-     ((just_before_setjmp), RUBY_SETJMP(env))
+#  define ruby_setjmp(extra_save, env) \
+     ((extra_save), RUBY_SETJMP(env))
 #  define ruby_longjmp(env,val) RUBY_LONGJMP(env,val)
 #  ifdef __CYGWIN__
 #    ifndef _setjmp

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]