ruby-changes:37844
From: ko1 <ko1@a...>
Date: Wed, 11 Mar 2015 04:57:46 +0900 (JST)
Subject: [ruby-changes:37844] ko1:r49925 (trunk): * vm_insnhelper.h: define struct IFUNC.
ko1 2015-03-11 04:57:30 +0900 (Wed, 11 Mar 2015) New Revision: 49925 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49925 Log: * vm_insnhelper.h: define struct IFUNC. * vm_eval.c (rb_iterate): use it. * vm_insnhelper.c (vm_yield_with_cfunc): ditto. Modified files: trunk/ChangeLog trunk/vm_eval.c trunk/vm_insnhelper.c trunk/vm_insnhelper.h Index: ChangeLog =================================================================== --- ChangeLog (revision 49924) +++ ChangeLog (revision 49925) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Mar 11 04:56:04 2015 Koichi Sasada <ko1@a...> + + * vm_insnhelper.h: define struct IFUNC. + + * vm_eval.c (rb_iterate): use it. + + * vm_insnhelper.c (vm_yield_with_cfunc): ditto. + Wed Mar 11 03:52:12 2015 Koichi Sasada <ko1@a...> * eval_intern.h (THROW_DATA_P): use RB_TYPE_P() instead of Index: vm_eval.c =================================================================== --- vm_eval.c (revision 49924) +++ vm_eval.c (revision 49925) @@ -1104,22 +1104,23 @@ rb_iterate(VALUE (* it_proc) (VALUE), VA https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1104 { int state; volatile VALUE retval = Qnil; - NODE *node = NEW_IFUNC(bl_proc, data2); + struct IFUNC *ifunc = (struct IFUNC *)NEW_IFUNC(bl_proc, data2); rb_thread_t *th = GET_THREAD(); rb_control_frame_t *volatile cfp = th->cfp; - node->nd_aid = rb_frame_this_func(); + ifunc->id = rb_frame_this_func(); + TH_PUSH_TAG(th); state = TH_EXEC_TAG(); if (state == 0) { VAR_INITIALIZED(th); - VAR_INITIALIZED(node); + VAR_INITIALIZED(ifunc); iter_retry: { rb_block_t *blockptr; if (bl_proc) { blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(th->cfp); - blockptr->iseq = (void *)node; + blockptr->iseq = (void *)ifunc; blockptr->proc = 0; } else { Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 49924) +++ vm_insnhelper.c (revision 49925) @@ -2040,7 +2040,7 @@ vm_yield_with_cfunc(rb_thread_t *th, con https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2040 int argc, const VALUE *argv, const rb_block_t *blockargptr) { - NODE *ifunc = (NODE *) block->iseq; + struct IFUNC *ifunc = (struct IFUNC *)block->iseq; VALUE val, arg, blockarg; int lambda = block_proc_is_lambda(block->proc); @@ -2071,7 +2071,7 @@ vm_yield_with_cfunc(rb_thread_t *th, con https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2071 VM_ENVVAL_PREV_EP_PTR(block->ep), NULL /* cref */, 0, th->cfp->sp, 1, th->passed_bmethod_me, 0); - val = (*ifunc->nd_cfnc) (arg, ifunc->nd_tval, argc, argv, blockarg); + val = (*ifunc->func) (arg, ifunc->data, argc, argv, blockarg); th->cfp++; return val; Index: vm_insnhelper.h =================================================================== --- vm_insnhelper.h (revision 49924) +++ vm_insnhelper.h (revision 49925) @@ -283,4 +283,12 @@ THROW_DATA_STATE(const struct THROW_DATA https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L283 return obj->throw_state; } +struct IFUNC { + VALUE flags; + VALUE reserved; + VALUE (*func)(ANYARGS); + void *data; + ID id; +}; + #endif /* RUBY_INSNHELPER_H */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/