diff --git a/vm_insnhelper.h b/vm_insnhelper.h index aabbf8387d..1a3dbc0326 100644 --- a/vm_insnhelper.h +++ b/vm_insnhelper.h @@ -184,6 +184,7 @@ CC_SET_ME(CALL_CACHE cc, const rb_callable_method_entry_t *me) } while (0) #endif +#define PREV_CLASS_SERIAL() (ruby_vm_class_serial) #define NEXT_CLASS_SERIAL() (++ruby_vm_class_serial) #define GET_GLOBAL_METHOD_STATE() (ruby_vm_global_method_state) #define INC_GLOBAL_METHOD_STATE() (++ruby_vm_global_method_state) diff --git a/vm_method.c b/vm_method.c index 2e948144d6..90ed0ba5f7 100644 --- a/vm_method.c +++ b/vm_method.c @@ -104,7 +104,7 @@ rb_clear_method_cache_by_class(VALUE klass) INC_GLOBAL_METHOD_STATE(); } else { - rb_serial_t old_serial = rb_next_class_serial(); + rb_serial_t old_serial = PREV_CLASS_SERIAL(); rb_class_clear_method_cache(klass, (VALUE)&old_serial); } }