diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-08-09 11:00:34 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2019-08-09 11:05:11 +0900 |
commit | 71efad1ed391ee0c5398a76306fdbaaadd4dc52e (patch) | |
tree | d560b4a717ee7d15d23dc4ea02b1708f7d1d71ea /class.c | |
parent | c7acb37248d4cef76647f8bc7ebd7dc291d9a853 (diff) |
introduce RCLASS_CLONED flag for inline cache.
Methods on duplicated class/module refer same constant inline
cache (IC). Constant access lookup should be done for cloned
class/modules but inline cache doesn't check it.
To check it, this patch introduce new RCLASS_CLONED flag which
are set when if class/module is cloned (both orig and dst).
[Bug #15877]
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -308,11 +308,17 @@ class_init_copy_check(VALUE clone, VALUE orig) rb_raise(rb_eTypeError, "can't copy singleton class"); } } - +#include "gc.h" /* :nodoc: */ VALUE rb_mod_init_copy(VALUE clone, VALUE orig) { + /* cloned flag is refer at constant inline cache + * see vm_get_const_key_cref() in vm_insnhelper.c + */ + FL_SET(clone, RCLASS_CLONED); + FL_SET(orig , RCLASS_CLONED); + if (RB_TYPE_P(clone, T_CLASS)) { class_init_copy_check(clone, orig); } |