1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Ensure VM_DEBUG_VERIFY_METHOD_CACHE code valid

This commit is contained in:
Nobuyoshi Nakada 2019-08-17 23:28:46 +09:00
parent aa00f7b8ec
commit 6db3051fcc
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -787,10 +787,10 @@ method_entry_get_without_cache(VALUE klass, ID id,
return me;
}
#if VM_DEBUG_VERIFY_METHOD_CACHE
static void
verify_method_cache(VALUE klass, ID id, VALUE defined_class, rb_method_entry_t *me)
{
if (!VM_DEBUG_VERIFY_METHOD_CACHE) return;
VALUE actual_defined_class;
rb_method_entry_t *actual_me =
method_entry_get_without_cache(klass, id, &actual_defined_class);
@ -799,7 +799,6 @@ verify_method_cache(VALUE klass, ID id, VALUE defined_class, rb_method_entry_t *
rb_bug("method cache verification failed");
}
}
#endif
static rb_method_entry_t *
method_entry_get(VALUE klass, ID id, VALUE *defined_class_ptr)
@ -810,9 +809,7 @@ method_entry_get(VALUE klass, ID id, VALUE *defined_class_ptr)
if (ent->method_state == GET_GLOBAL_METHOD_STATE() &&
ent->class_serial == RCLASS_SERIAL(klass) &&
ent->mid == id) {
#if VM_DEBUG_VERIFY_METHOD_CACHE
verify_method_cache(klass, id, ent->defined_class, ent->me);
#endif
if (defined_class_ptr) *defined_class_ptr = ent->defined_class;
RB_DEBUG_COUNTER_INC(mc_global_hit);
return ent->me;