From ba11a74745e10fac88a74c2da2e0032ccf254265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= Date: Mon, 16 Dec 2019 17:38:41 +0900 Subject: ensure cc->def == cc->me->def The equation shall hold for every call cache. However prior to this changeset cc->me could be updated without also updating cc->def. Let's make it sure by introducing new macro named CC_SET_ME which sets cc->me and cc->def at once. --- vm_eval.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'vm_eval.c') diff --git a/vm_eval.c b/vm_eval.c index b0179423d8..cec1ea41f6 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -179,22 +179,25 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, struc super_class = RCLASS_ORIGIN(super_class); } else if (cc->me->def->body.refined.orig_me) { - cc->me = refined_method_callable_without_refinement(cc->me); + CC_SET_ME(cc, refined_method_callable_without_refinement(cc->me)); goto again; } super_class = RCLASS_SUPER(super_class); + if (super_class) { + CC_SET_ME(cc, rb_callable_method_entry(super_class, ci->mid)); + if (cc->me) { + RUBY_VM_CHECK_INTS(ec); + goto again; + } + } - if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) { - enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0; - ret = method_missing(calling->recv, ci->mid, calling->argc, argv, ex, calling->kw_splat); - goto success; - } - RUBY_VM_CHECK_INTS(ec); - goto again; + enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0; + ret = method_missing(calling->recv, ci->mid, calling->argc, argv, ex, calling->kw_splat); + goto success; } case VM_METHOD_TYPE_ALIAS: - cc->me = aliased_callable_method_entry(cc->me); + CC_SET_ME(cc, aliased_callable_method_entry(cc->me)); goto again; case VM_METHOD_TYPE_MISSING: { -- cgit v1.2.3