summaryrefslogtreecommitdiff
path: root/vm_args.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-01 02:57:43 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-01 02:57:43 (GMT)
commit32289fbed439e00ce8624834ced7a6bc3a12d70b (patch)
treeb59387af439ff922d7d6c396ff13efcc839608a9 /vm_args.c
parent563127d710583f412168eac4f067e33f4ae628d5 (diff)
vm_args.c: GC guard
* vm_args.c (vm_caller_setup_arg_block): prevent newly created ifunc object from GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_args.c')
-rw-r--r--vm_args.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/vm_args.c b/vm_args.c
index 1ed98b5..7211701 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -766,10 +766,11 @@ vm_caller_setup_arg_kw(rb_control_frame_t *cfp, struct rb_calling_info *calling,
calling->argc -= kw_len - 1;
}
-static void
+static VALUE
vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
struct rb_calling_info *calling, const struct rb_call_info *ci, rb_iseq_t *blockiseq, const int is_super)
{
+ VALUE mark = 0;
if (ci->flag & VM_CALL_ARGS_BLOCKARG) {
rb_proc_t *po;
VALUE proc;
@@ -778,8 +779,10 @@ vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
if (SYMBOL_P(proc) && rb_method_basic_definition_p(rb_cSymbol, idTo_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);
+ blockiseq = (rb_iseq_t *)IFUNC_NEW(rb_sym_proc_call, SYM2ID(proc), 0);
+ calling->blockptr->iseq = blockiseq;
calling->blockptr->proc = 0;
+ mark = (VALUE)blockiseq;
}
else if (!NIL_P(proc)) {
if (!rb_obj_is_proc(proc)) {
@@ -814,6 +817,8 @@ vm_caller_setup_arg_block(const rb_thread_t *th, rb_control_frame_t *reg_cfp,
calling->blockptr = NULL;
}
}
+
+ return mark;
}
#define IS_ARGS_SPLAT(ci) ((ci)->flag & VM_CALL_ARGS_SPLAT)