ruby-changes:57139
From: Nobuyoshi <ko1@a...>
Date: Sun, 18 Aug 2019 00:37:50 +0900 (JST)
Subject: [ruby-changes:57139] Nobuyoshi Nakada: 1d11a8b193 (master): Ensure non-OPT_GLOBAL_METHOD_CACHE code valid
https://git.ruby-lang.org/ruby.git/commit/?id=1d11a8b193 From 1d11a8b1938d3310d6b573c2feb173661a82b6a6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 17 Aug 2019 23:29:54 +0900 Subject: Ensure non-OPT_GLOBAL_METHOD_CACHE code valid diff --git a/vm_method.c b/vm_method.c index 0bc32ad..d5ebaa4 100644 --- a/vm_method.c +++ b/vm_method.c @@ -803,8 +803,8 @@ verify_method_cache(VALUE klass, ID id, VALUE defined_class, rb_method_entry_t * https://github.com/ruby/ruby/blob/trunk/vm_method.c#L803 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) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L814 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) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L2090 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) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L2109 fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } -#endif } void -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/