1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* proc.c (rb_block_arity): use ec directly.

* proc.c (rb_mod_define_method): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2017-10-28 11:46:32 +00:00
parent 7df94b0f3d
commit 42d137ff19

14
proc.c
View file

@ -1046,8 +1046,8 @@ int
rb_block_arity(void) rb_block_arity(void)
{ {
int min, max; int min, max;
rb_thread_t *th = GET_THREAD(); const rb_execution_context_t *ec = GET_EC();
rb_control_frame_t *cfp = th->ec->cfp; rb_control_frame_t *cfp = ec->cfp;
VALUE block_handler = rb_vm_frame_block_handler(cfp); VALUE block_handler = rb_vm_frame_block_handler(cfp);
struct rb_block block; struct rb_block block;
@ -1079,8 +1079,8 @@ rb_block_arity(void)
int int
rb_block_min_max_arity(int *max) rb_block_min_max_arity(int *max)
{ {
rb_thread_t *th = GET_THREAD(); const rb_execution_context_t *ec = GET_EC();
rb_control_frame_t *cfp = th->ec->cfp; rb_control_frame_t *cfp = ec->cfp;
VALUE block_handler = rb_vm_frame_block_handler(cfp); VALUE block_handler = rb_vm_frame_block_handler(cfp);
struct rb_block block; struct rb_block block;
@ -1908,8 +1908,8 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
#if PROC_NEW_REQUIRES_BLOCK #if PROC_NEW_REQUIRES_BLOCK
body = rb_block_lambda(); body = rb_block_lambda();
#else #else
rb_thread_t *th = GET_THREAD(); const rb_execution_context_t *ec = GET_EC();
VALUE block_handler = rb_vm_frame_block_handler(th->ec->cfp); VALUE block_handler = rb_vm_frame_block_handler(ec->cfp);
if (block_handler == VM_BLOCK_HANDLER_NONE) rb_raise(rb_eArgError, proc_without_block); if (block_handler == VM_BLOCK_HANDLER_NONE) rb_raise(rb_eArgError, proc_without_block);
switch (vm_block_handler_type(block_handler)) { switch (vm_block_handler_type(block_handler)) {
@ -1921,7 +1921,7 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
break; break;
case block_handler_type_iseq: case block_handler_type_iseq:
case block_handler_type_ifunc: case block_handler_type_ifunc:
body = rb_vm_make_proc_lambda(th->ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc, TRUE); body = rb_vm_make_proc_lambda(ec, VM_BH_TO_CAPT_BLOCK(block_handler), rb_cProc, TRUE);
} }
#endif #endif
} }