diff options
author | Jeremy Evans <[email protected]> | 2021-09-30 12:35:27 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2021-10-01 08:12:46 -0900 |
commit | 9b04909a85b07004ce4aa133c567fd78aa43f2ee (patch) | |
tree | 7454e8bf2f4c6e1585fb6607709a90c49721d943 /vm_eval.c | |
parent | 0ad3ed5e0e6e6239fbc348f730b3f298ef4e944c (diff) |
Introduce rb_vm_call_with_refinements to DRY up a few calls
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4919
Diffstat (limited to 'vm_eval.c')
-rw-r--r-- | vm_eval.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -57,6 +57,20 @@ rb_vm_call0(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE return vm_call0_body(ec, &calling, argv); } +MJIT_FUNC_EXPORTED VALUE +rb_vm_call_with_refinements(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE *argv, int kw_splat) +{ + const rb_callable_method_entry_t *me = + rb_callable_method_entry_with_refinements(CLASS_OF(recv), id, NULL); + if (me) { + return rb_vm_call0(ec, recv, id, argc, argv, me, kw_splat); + } + else { + /* fallback to funcall (e.g. method_missing) */ + return rb_funcallv(recv, id, argc, argv); + } +} + static inline VALUE vm_call0_cc(rb_execution_context_t *ec, VALUE recv, ID id, int argc, const VALUE *argv, const struct rb_callcache *cc, int kw_splat) { |