mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ensure non-OPT_GLOBAL_METHOD_CACHE code valid
This commit is contained in:
parent
6db3051fcc
commit
1d11a8b193
1 changed files with 3 additions and 4 deletions
|
@ -803,8 +803,8 @@ verify_method_cache(VALUE klass, ID id, VALUE defined_class, rb_method_entry_t *
|
|||
static rb_method_entry_t *
|
||||
method_entry_get(VALUE klass, ID id, VALUE *defined_class_ptr)
|
||||
{
|
||||
#if OPT_GLOBAL_METHOD_CACHE
|
||||
struct cache_entry *ent;
|
||||
if (!OPT_GLOBAL_METHOD_CACHE) goto nocache;
|
||||
ent = GLOBAL_METHOD_CACHE(klass, id);
|
||||
if (ent->method_state == GET_GLOBAL_METHOD_STATE() &&
|
||||
ent->class_serial == RCLASS_SERIAL(klass) &&
|
||||
|
@ -814,8 +814,8 @@ method_entry_get(VALUE klass, ID id, VALUE *defined_class_ptr)
|
|||
RB_DEBUG_COUNTER_INC(mc_global_hit);
|
||||
return ent->me;
|
||||
}
|
||||
#endif
|
||||
|
||||
nocache:
|
||||
RB_DEBUG_COUNTER_INC(mc_global_miss);
|
||||
return method_entry_get_without_cache(klass, id, defined_class_ptr);
|
||||
}
|
||||
|
@ -2090,7 +2090,7 @@ obj_respond_to_missing(VALUE obj, VALUE mid, VALUE priv)
|
|||
void
|
||||
Init_Method(void)
|
||||
{
|
||||
#if OPT_GLOBAL_METHOD_CACHE
|
||||
if (!OPT_GLOBAL_METHOD_CACHE) return;
|
||||
char *ptr = getenv("RUBY_GLOBAL_METHOD_CACHE_SIZE");
|
||||
int val;
|
||||
|
||||
|
@ -2109,7 +2109,6 @@ Init_Method(void)
|
|||
fprintf(stderr, "[FATAL] failed to allocate memory\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue