[前][次][番号順一覧][スレッド一覧]

ruby-changes:59315

From: John <ko1@a...>
Date: Wed, 18 Dec 2019 02:57:25 +0900 (JST)
Subject: [ruby-changes:59315] 8e56d3a6ab (master): Define PREV_CLASS_SERIAL

https://git.ruby-lang.org/ruby.git/commit/?id=8e56d3a6ab

From 8e56d3a6ab7cc05be586010acd9f85384d53403a Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Thu, 12 Dec 2019 16:42:34 -0800
Subject: Define PREV_CLASS_SERIAL

Avoids genereating a "throwaway" sentinel class serial. There wasn't any
read harm in doing so (we're at no risk of exhaustion and there'd be no
measurable performance impact), but if feels cleaner that all class
serials actually end up assigned and used (especially now that we won't
overwrite them in a single method definition).

diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index aabbf83..1a3dbc0 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) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.h#L184
 } 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 2e94814..90ed0ba 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -104,7 +104,7 @@ rb_clear_method_cache_by_class(VALUE klass) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L104
 	    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);
 	}
     }
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]