summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'class.c')
-rw-r--r--class.c16
1 files changed, 4 insertions, 12 deletions
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;
}