summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vm.c b/vm.c
index 08c96d5..d9ac028 100644
--- a/vm.c
+++ b/vm.c
@@ -1147,8 +1147,9 @@ rb_vm_check_redefinition_by_prepend(VALUE klass)
static void
add_opt_method(VALUE klass, ID mid, VALUE bop)
{
- rb_method_entry_t *me;
- if (st_lookup(RCLASS_M_TBL(klass), mid, (void *)&me) && me->def &&
+ rb_method_entry_t *me = rb_method_entry_at(klass, mid);
+
+ if (me && me->def &&
me->def->type == VM_METHOD_TYPE_CFUNC) {
st_insert(vm_opt_method_table, (st_data_t)me, (st_data_t)bop);
}