summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2024-03-01 15:01:20 -0800
committerTakashi Kokubun <[email protected]>2024-03-01 15:02:28 -0800
commit61fbd29e14c0bd06ca4c063ff34332b272874a13 (patch)
tree2e42f1d8a09525cdfdea06d71ce9de818557a957 /hash.c
parent5a3ae06a09d183bf1b7752ddd9f5e800a033f7ae (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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 437fb83fc2..32b0b10e9c 100644
--- a/hash.c
+++ b/hash.c
@@ -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);
}
}