ruby-changes:48428
From: ko1 <ko1@a...>
Date: Sun, 29 Oct 2017 22:49:50 +0900 (JST)
Subject: [ruby-changes:48428] ko1:r60542 (trunk): rb_ec_stack_check()
ko1 2017-10-29 22:49:45 +0900 (Sun, 29 Oct 2017) New Revision: 60542 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60542 Log: rb_ec_stack_check() * gc.c (rb_ec_stack_check): renamed from rb_threadptr_stack_check() and it accepts `ec`. Modified files: trunk/eval_intern.h trunk/gc.c trunk/vm_eval.c Index: eval_intern.h =================================================================== --- eval_intern.h (revision 60541) +++ eval_intern.h (revision 60542) @@ -286,7 +286,7 @@ int rb_threadptr_reset_raised(rb_thread_ https://github.com/ruby/ruby/blob/trunk/eval_intern.h#L286 #define rb_thread_raised_reset(th, f) ((th)->ec->raised_flag &= ~(f)) #define rb_thread_raised_p(th, f) (((th)->ec->raised_flag & (f)) != 0) #define rb_thread_raised_clear(th) ((th)->ec->raised_flag = 0) -int rb_threadptr_stack_check(rb_thread_t *th); +int rb_ec_stack_check(rb_execution_context_t *ec); 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 60541) +++ vm_eval.c (revision 60542) @@ -257,7 +257,7 @@ stack_check(rb_execution_context_t *ec) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L257 rb_thread_t *th = rb_ec_thread_ptr(ec); if (!rb_thread_raised_p(th, RAISED_STACKOVERFLOW) && - rb_threadptr_stack_check(th)) { + rb_ec_stack_check(ec)) { rb_thread_raised_set(th, RAISED_STACKOVERFLOW); rb_ec_stack_overflow(th->ec, FALSE); } Index: gc.c =================================================================== --- gc.c (revision 60541) +++ gc.c (revision 60542) @@ -4028,9 +4028,8 @@ ruby_stack_length(VALUE **p) https://github.com/ruby/ruby/blob/trunk/gc.c#L4028 #endif #if PREVENT_STACK_OVERFLOW static int -stack_check(rb_thread_t *th, int water_mark) +stack_check(rb_execution_context_t *ec, int water_mark) { - rb_execution_context_t *ec = th->ec; int ret; SET_STACK_END; ret = STACK_LENGTH > STACK_LEVEL_MAX - water_mark; @@ -4043,21 +4042,21 @@ stack_check(rb_thread_t *th, int water_m https://github.com/ruby/ruby/blob/trunk/gc.c#L4042 return ret; } #else -#define stack_check(th, water_mark) FALSE +#define stack_check(ec, water_mark) FALSE #endif #define STACKFRAME_FOR_CALL_CFUNC 838 int -rb_threadptr_stack_check(rb_thread_t *th) +rb_ec_stack_check(rb_execution_context_t *ec) { - return stack_check(th, STACKFRAME_FOR_CALL_CFUNC); + return stack_check(ec, STACKFRAME_FOR_CALL_CFUNC); } int ruby_stack_check(void) { - return stack_check(GET_THREAD(), STACKFRAME_FOR_CALL_CFUNC); + return stack_check(GET_EC(), STACKFRAME_FOR_CALL_CFUNC); } ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/