summaryrefslogtreecommitdiff
path: root/vm_args.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-01 10:52:52 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-01 10:52:52 (GMT)
commitc90550c251f0c598458d52dd2cbd5445e8d26c65 (patch)
treed8aef428c1f3e22d9f9261ccd402f50f93d4453c /vm_args.c
parentde2c8c9dbc1e324ce9bb04a01cd209b76f2edc26 (diff)
vm_args.c: fix marking symbol ifunc
* vm_args.c (vm_caller_setup_arg_block): store new ifunc for symbol in control frame proc to be marked. * proc.c (proc_new), vm_insnhelper.c (vm_yield_with_cfunc): block->proc may be an ifunc now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/vm_args.c b/vm_args.c
index 1ed98b5..18911b4 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -776,12 +776,21 @@ vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
proc = *(--reg_cfp->sp);
- if (SYMBOL_P(proc) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
+ if (NIL_P(proc)) {
+ calling->blockptr = NULL;
+ }
+ else if (SYMBOL_P(proc) && rb_method_basic_definition_p(rb_cSymbol, idTo_proc)) {
+ calling->blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(reg_cfp);
+ blockiseq = (rb_iseq_t *)IFUNC_NEW(rb_sym_proc_call, SYM2ID(proc), 0);
+ calling->blockptr->iseq = blockiseq;
+ calling->blockptr->proc = (VALUE)blockiseq;
+ }
+ else if (RUBY_VM_IFUNC_P(proc)) {
calling->blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(reg_cfp);
- calling->blockptr->iseq = (rb_iseq_t *)IFUNC_NEW(rb_sym_proc_call, SYM2ID(proc), 0);
- calling->blockptr->proc = 0;
+ calling->blockptr->iseq = (rb_iseq_t *)proc;
+ calling->blockptr->proc = proc;
}
- else if (!NIL_P(proc)) {
+ else {
if (!rb_obj_is_proc(proc)) {
VALUE b;
b = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
@@ -797,9 +806,6 @@ vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
calling->blockptr = &po->block;
RUBY_VM_GET_BLOCK_PTR_IN_CFP(reg_cfp)->proc = proc;
}
- else {
- calling->blockptr = NULL;
- }
}
else if (blockiseq != 0) { /* likely */
rb_block_t *blockptr = calling->blockptr = RUBY_VM_GET_BLOCK_PTR_IN_CFP(reg_cfp);