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

ruby-changes:46258

From: nobu <ko1@a...>
Date: Mon, 17 Apr 2017 09:10:51 +0900 (JST)
Subject: [ruby-changes:46258] nobu:r58375 (trunk): gc.c: rb_threadptr_stack_check

nobu	2017-04-17 09:10:47 +0900 (Mon, 17 Apr 2017)

  New Revision: 58375

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58375

  Log:
    gc.c: rb_threadptr_stack_check
    
    * gc.c (rb_threadptr_stack_check): check probability of stack
      overflow for the given thread, not the current thread.
    
    * vm_eval.c (stack_check): check the given thread, not the current
      thread.

  Modified files:
    trunk/eval_intern.h
    trunk/gc.c
    trunk/vm_eval.c
Index: gc.c
===================================================================
--- gc.c	(revision 58374)
+++ gc.c	(revision 58375)
@@ -3966,6 +3966,12 @@ stack_check(rb_thread_t *th, int water_m https://github.com/ruby/ruby/blob/trunk/gc.c#L3966
 #define STACKFRAME_FOR_CALL_CFUNC 512
 
 int
+rb_threadptr_stack_check(rb_thread_t *th)
+{
+    return stack_check(th, STACKFRAME_FOR_CALL_CFUNC);
+}
+
+int
 ruby_stack_check(void)
 {
     return stack_check(GET_THREAD(), STACKFRAME_FOR_CALL_CFUNC);
Index: eval_intern.h
===================================================================
--- eval_intern.h	(revision 58374)
+++ eval_intern.h	(revision 58375)
@@ -268,6 +268,7 @@ int rb_threadptr_reset_raised(rb_thread_ https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L268
 #define rb_thread_raised_reset(th, f) ((th)->raised_flag &= ~(f))
 #define rb_thread_raised_p(th, f)     (((th)->raised_flag & (f)) != 0)
 #define rb_thread_raised_clear(th)    ((th)->raised_flag = 0)
+int rb_threadptr_stack_check(rb_thread_t *th);
 
 VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
 VALUE rb_make_exception(int argc, const VALUE *argv);
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 58374)
+++ vm_eval.c	(revision 58375)
@@ -300,7 +300,8 @@ rb_current_receiver(void) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L300
 static inline void
 stack_check(rb_thread_t *th)
 {
-    if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) && ruby_stack_check()) {
+    if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) &&
+	rb_threadptr_stack_check(th)) {
 	rb_thread_raised_set(th, RAISED_STACKOVERFLOW);
 	rb_exc_raise(sysstack_error);
     }

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

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