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; return me;
} }
#if VM_DEBUG_VERIFY_METHOD_CACHE
static void static void
verify_method_cache(VALUE klass, ID id, VALUE defined_class, rb_method_entry_t *me) 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; VALUE actual_defined_class;
rb_method_entry_t *actual_me = rb_method_entry_t *actual_me =
method_entry_get_without_cache(klass, id, &actual_defined_class); 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"); rb_bug("method cache verification failed");
} }
} }
#endif
static rb_method_entry_t * static rb_method_entry_t *
method_entry_get(VALUE klass, ID id, VALUE *defined_class_ptr) 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() && if (ent->method_state == GET_GLOBAL_METHOD_STATE() &&
ent->class_serial == RCLASS_SERIAL(klass) && ent->class_serial == RCLASS_SERIAL(klass) &&
ent->mid == id) { ent->mid == id) {
#if VM_DEBUG_VERIFY_METHOD_CACHE
verify_method_cache(klass, id, ent->defined_class, ent->me); verify_method_cache(klass, id, ent->defined_class, ent->me);
#endif
if (defined_class_ptr) *defined_class_ptr = ent->defined_class; if (defined_class_ptr) *defined_class_ptr = ent->defined_class;
RB_DEBUG_COUNTER_INC(mc_global_hit); RB_DEBUG_COUNTER_INC(mc_global_hit);
return ent->me; return ent->me;