diff options
-rw-r--r-- | hash.c | 6 | ||||
-rw-r--r-- | method.h | 3 |
2 files changed, 5 insertions, 4 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); } } @@ -136,8 +136,9 @@ typedef struct rb_method_iseq_struct { rb_cref_t * cref; /*!< class reference, should be marked */ } rb_method_iseq_t; /* check rb_add_method_iseq() when modify the fields */ +typedef VALUE (*rb_cfunc_t)(ANYARGS); typedef struct rb_method_cfunc_struct { - VALUE (*func)(ANYARGS); + rb_cfunc_t func; VALUE (*invoker)(VALUE recv, int argc, const VALUE *argv, VALUE (*func)(ANYARGS)); int argc; } rb_method_cfunc_t; |