summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-12-16 17:38:41 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-12-16 17:52:18 +0900
commitba11a74745e10fac88a74c2da2e0032ccf254265 (patch)
tree90645559ab20180ea9eb0868a091e334b82b6fc8 /vm_eval.c
parent6545d5bbb9517a9364bd59a12a98d3e00516e07e (diff)
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.
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c21
1 files changed, 12 insertions, 9 deletions
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:
{