Skip to content

Commit

Permalink
fix spec failure
Browse files Browse the repository at this point in the history
  • Loading branch information
shyouhei committed Sep 19, 2019
1 parent d74fa8e commit fcfe36b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions vm_insnhelper.c
Expand Up @@ -1380,7 +1380,7 @@ __attribute__((__artificial__))
#endif
#endif
static inline vm_call_handler
calccall(const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
calccall(const struct rb_call_info *ci, const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
{
if (UNLIKELY(!me)) {
return vm_call_general; /* vm_call_method_nome() situation */
Expand All @@ -1391,6 +1391,14 @@ calccall(const struct rb_call_cache *cc, const rb_callable_method_entry_t *me)
else if (UNLIKELY(cc->def != me->def)) {
return vm_call_general; /* cc->me was refined elsewhere */
}
/* "Calling a formerly-public method, which is now privatised, with an
* explicit receiver" is the only situation we have to check here. A
* formerly-private method now publicised is an absolutely safe thing.
* Calling a private method without specifying a receiver is also safe. */
else if ((METHOD_ENTRY_VISI(cc->me) != METHOD_VISI_PUBLIC) &&
!(ci->flag & VM_CALL_FCALL)) {
return vm_call_general;
}
else {
return cc->call;
}
Expand All @@ -1406,7 +1414,7 @@ rb_vm_search_method_slowpath(const struct rb_call_info *ci, struct rb_call_cache
RCLASS_SERIAL(klass),
me,
me ? me->def : NULL,
calccall(cc, me),
calccall(ci, cc, me),
};
VM_ASSERT(callable_method_entry_p(cc->me));
}
Expand Down

0 comments on commit fcfe36b

Please sign in to comment.