From 69967ee64eac9ce65b83533a566d69d12a6046d0 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 25 Mar 2022 20:29:09 +0900 Subject: Revert "Finer-grained inline constant cache invalidation" This reverts commits for [Feature #18589]: * 8008fb7352abc6fba433b99bf20763cf0d4adb38 "Update formatting per feedback" * 8f6eaca2e19828e92ecdb28b0fe693d606a03f96 "Delete ID from constant cache table if it becomes empty on ISEQ free" * 629908586b4bead1103267652f8b96b1083573a8 "Finer-grained inline constant cache invalidation" MSWin builds on AppVeyor have been crashing since the merger. --- class.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'class.c') diff --git a/class.c b/class.c index 784942a3da..9988b080d9 100644 --- a/class.c +++ b/class.c @@ -1169,20 +1169,11 @@ module_in_super_chain(const VALUE klass, VALUE module) return false; } -// For each ID key in the class constant table, we're going to clear the VM's -// inline constant caches associated with it. -static enum rb_id_table_iterator_result -clear_constant_cache_i(ID id, VALUE value, void *data) -{ - rb_clear_constant_cache_for_id(id); - return ID_TABLE_CONTINUE; -} - static int do_include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super, bool check_cyclic) { VALUE p, iclass, origin_stack = 0; - int method_changed = 0, add_subclass; + int method_changed = 0, constant_changed = 0, add_subclass; long origin_len; VALUE klass_origin = RCLASS_ORIGIN(klass); VALUE original_klass = klass; @@ -1275,12 +1266,13 @@ do_include_modules_at(const VALUE klass, VALUE c, VALUE module, int search_super } tbl = RCLASS_CONST_TBL(module); - if (tbl && rb_id_table_size(tbl)) - rb_id_table_foreach(tbl, clear_constant_cache_i, (void *) 0); + if (tbl && rb_id_table_size(tbl)) constant_changed = 1; skip: module = RCLASS_SUPER(module); } + if (constant_changed) rb_clear_constant_cache(); + return method_changed; } -- cgit v1.2.1