diff options
author | Takashi Kokubun <[email protected]> | 2024-03-01 15:01:20 -0800 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2024-03-01 15:02:28 -0800 |
commit | 61fbd29e14c0bd06ca4c063ff34332b272874a13 (patch) | |
tree | 2e42f1d8a09525cdfdea06d71ce9de818557a957 /hash.c | |
parent | 5a3ae06a09d183bf1b7752ddd9f5e800a033f7ae (diff) |
Skip a redundant check for the rb_obj_hash case
Also, refactor the cfunc struct to use a new rb_cfunc_t.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -220,12 +220,12 @@ obj_any_hash(VALUE obj) VALUE klass = CLASS_OF(obj); if (klass) { const rb_callable_method_entry_t *cme = rb_callable_method_entry(klass, id_hash); - if (cme && METHOD_ENTRY_BASIC(cme) && RBASIC_CLASS(cme->defined_class) == rb_mKernel) { + if (cme && METHOD_ENTRY_BASIC(cme)) { // Optimize away the frame push overhead if it's the default Kernel#hash - if (cme->def->type == VM_METHOD_TYPE_CFUNC && cme->def->body.cfunc.func == (VALUE (*)(ANYARGS))rb_obj_hash) { + if (cme->def->type == VM_METHOD_TYPE_CFUNC && cme->def->body.cfunc.func == (rb_cfunc_t)rb_obj_hash) { hval = rb_obj_hash(obj); } - else { + else if (RBASIC_CLASS(cme->defined_class) == rb_mKernel) { hval = rb_vm_call0(GET_EC(), obj, id_hash, 0, 0, cme, 0); } } |