diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-11 13:31:11 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-11 13:31:11 +0000 |
commit | 7790f37efdd8dd42a0a43c3206f6afdd43f8e86a (patch) | |
tree | 38d8c41ba56f432da983148757c6c8b7ee36196b /proc.c | |
parent | 48cb7391190612c77375f924c1e202178f09f559 (diff) |
* node.h: remove NODE_IFUNC, NEW_IFUNC.
* internal.h: use T_IMEMO for IFUNC.
rename `struct IFUNC' to `struct vm_ifunc' and move the definition
from vm_insnhelper.h. Add imemo_ifunc.
* gc.c (gc_mark_children): mark imemo_ifunc type T_IMEMO object.
* compile.c: catch up these changes.
* proc.c: ditto.
* vm_core.h (RUBY_VM_IFUNC_P): ditto.
* vm_eval.c (rb_iterate): ditto.
* vm_insnhelper.c: ditto.
* ext/objspace/objspace.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -37,7 +37,7 @@ static int method_min_max_arity(VALUE, int *max); /* Proc */ -#define IS_METHOD_PROC_NODE(node) (nd_type(node) == NODE_IFUNC && (node)->nd_cfnc == bmcall) +#define IS_METHOD_PROC_ISEQ(iseq) (RB_TYPE_P((VALUE)(iseq), T_IMEMO) && ((struct vm_ifunc *)(iseq))->func == bmcall) static void proc_mark(void *ptr) @@ -850,10 +850,10 @@ rb_block_min_max_arity(rb_block_t *block, int *max) return rb_iseq_min_max_arity(iseq, max); } else { - NODE *node = (NODE *)iseq; - if (IS_METHOD_PROC_NODE(node)) { + if (IS_METHOD_PROC_ISEQ(iseq)) { + const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq; /* e.g. method(:foo).to_proc.arity */ - return method_min_max_arity(node->nd_tval, max); + return method_min_max_arity((VALUE)ifunc->data, max); } } } @@ -919,11 +919,11 @@ rb_proc_get_iseq(VALUE self, int *is_proc) iseq = proc->block.iseq; if (is_proc) *is_proc = !proc->is_lambda; if (!RUBY_VM_NORMAL_ISEQ_P(iseq)) { - NODE *node = (NODE *)iseq; + const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq; iseq = 0; - if (IS_METHOD_PROC_NODE(node)) { + if (IS_METHOD_PROC_ISEQ(ifunc)) { /* method(:foo).to_proc */ - iseq = rb_method_get_iseq(node->nd_tval); + iseq = rb_method_get_iseq((VALUE)ifunc->data); if (is_proc) *is_proc = 0; } } @@ -2465,10 +2465,10 @@ proc_binding(VALUE self) GetProcPtr(self, proc); iseq = proc->block.iseq; if (RUBY_VM_IFUNC_P(iseq)) { - if (!IS_METHOD_PROC_NODE((NODE *)iseq)) { + if (!IS_METHOD_PROC_ISEQ(iseq)) { rb_raise(rb_eArgError, "Can't create Binding from C level Proc"); } - iseq = rb_method_get_iseq(RNODE(iseq)->u2.value); + iseq = rb_method_get_iseq((VALUE)((struct vm_ifunc *)iseq)->data); } bindval = rb_binding_alloc(rb_cBinding); |