diff options
| author | Aaron Patterson <tenderlove@ruby-lang.org> | 2024-04-24 10:02:06 -0700 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2024-04-24 11:21:18 -0700 |
| commit | 2cc59c1b3167da6a554c37cf66b3b95633b6ec9f (patch) | |
| tree | 42c121b5fa973568790a561dcd46bde46e62db1e | |
| parent | 58847b7df8d46ebb5887d7a5fc97acaa24a78912 (diff) | |
pass CI to gccct_method_search_slowpath
Also the slow path only needs to look up the method once: via
vm_search_method_slowpath0. gccct just returns whatever cc normal
method lookup does.
| -rw-r--r-- | vm_eval.c | 59 |
1 files changed, 26 insertions, 33 deletions
@@ -400,46 +400,19 @@ gccct_hash(VALUE klass, ID mid) return (klass >> 3) ^ (VALUE)mid; } -NOINLINE(static const struct rb_callcache *gccct_method_search_slowpath(rb_vm_t *vm, VALUE klass, ID mid, int argc, unsigned int index, call_type scope)); +NOINLINE(static const struct rb_callcache *gccct_method_search_slowpath(rb_vm_t *vm, VALUE klass, unsigned int index, const struct rb_callinfo * ci)); static const struct rb_callcache * -gccct_method_search_slowpath(rb_vm_t *vm, VALUE klass, ID mid, int argc, unsigned int index, call_type scope) +gccct_method_search_slowpath(rb_vm_t *vm, VALUE klass, unsigned int index, const struct rb_callinfo *ci) { - const rb_callable_method_entry_t *cme = rb_callable_method_entry(klass, mid); - const struct rb_callcache *cc; - int flags = 0; - - switch(scope) { - case CALL_PUBLIC: - break; - case CALL_FCALL: - flags |= VM_CALL_FCALL; - break; - case CALL_VCALL: - flags |= VM_CALL_VCALL; - break; - case CALL_PUBLIC_KW: - flags |= VM_CALL_KWARG; - break; - case CALL_FCALL_KW: - flags |= (VM_CALL_KWARG | VM_CALL_FCALL); - break; - } - struct rb_call_data cd = { - .ci = &VM_CI_ON_STACK(mid, flags, argc, NULL), + .ci = ci, .cc = NULL }; - if (cme != NULL) { - vm_search_method_slowpath0(vm->self, &cd, klass); - cc = cd.cc; - } - else { - cc = NULL; - } + vm_search_method_slowpath0(vm->self, &cd, klass); - return vm->global_cc_cache_table[index] = cc; + return vm->global_cc_cache_table[index] = cd.cc; } static inline const struct rb_callcache * @@ -478,7 +451,27 @@ gccct_method_search(rb_execution_context_t *ec, VALUE recv, ID mid, int argc, ca } RB_DEBUG_COUNTER_INC(gccct_miss); - return gccct_method_search_slowpath(vm, klass, mid, argc, index, call_scope); + + int flags = 0; + + switch(call_scope) { + case CALL_PUBLIC: + break; + case CALL_FCALL: + flags |= VM_CALL_FCALL; + break; + case CALL_VCALL: + flags |= VM_CALL_VCALL; + break; + case CALL_PUBLIC_KW: + flags |= VM_CALL_KWARG; + break; + case CALL_FCALL_KW: + flags |= (VM_CALL_KWARG | VM_CALL_FCALL); + break; + } + + return gccct_method_search_slowpath(vm, klass, index, &VM_CI_ON_STACK(mid, flags, argc, NULL)); } /** |
