summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-03-25 20:29:09 +0900
committerGitHub <noreply@github.com>2022-03-25 20:29:09 +0900
commit69967ee64eac9ce65b83533a566d69d12a6046d0 (patch)
treeb7012ba8b7ad5b1c99d7b1f9b2345ecd8117f433 /variable.c
parent7ee26740e41f99d3da37df36b956237fbf36868e (diff)
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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5715 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/variable.c b/variable.c
index d127bd11ea..8cb507628c 100644
--- a/variable.c
+++ b/variable.c
@@ -2848,7 +2848,7 @@ rb_const_remove(VALUE mod, ID id)
undefined_constant(mod, ID2SYM(id));
}
- rb_clear_constant_cache_for_id(id);
+ rb_clear_constant_cache();
val = ce->value;
if (val == Qundef) {
@@ -3132,7 +3132,7 @@ rb_const_set(VALUE klass, ID id, VALUE val)
struct rb_id_table *tbl = RCLASS_CONST_TBL(klass);
if (!tbl) {
RCLASS_CONST_TBL(klass) = tbl = rb_id_table_create(0);
- rb_clear_constant_cache_for_id(id);
+ rb_clear_constant_cache();
ce = ZALLOC(rb_const_entry_t);
rb_id_table_insert(tbl, id, (VALUE)ce);
setup_const_entry(ce, klass, val, CONST_PUBLIC);
@@ -3210,7 +3210,7 @@ const_tbl_update(struct autoload_const *ac)
struct autoload_data_i *ele = current_autoload_data(klass, id, &ac);
if (ele) {
- rb_clear_constant_cache_for_id(id);
+ rb_clear_constant_cache();
ac->value = val; /* autoload_i is non-WB-protected */
ac->file = rb_source_location(&ac->line);
@@ -3238,11 +3238,11 @@ const_tbl_update(struct autoload_const *ac)
"previous definition of %"PRIsVALUE" was here", name);
}
}
- rb_clear_constant_cache_for_id(id);
+ rb_clear_constant_cache();
setup_const_entry(ce, klass, val, visibility);
}
else {
- rb_clear_constant_cache_for_id(id);
+ rb_clear_constant_cache();
ce = ZALLOC(rb_const_entry_t);
rb_id_table_insert(tbl, id, (VALUE)ce);
@@ -3297,6 +3297,10 @@ set_const_visibility(VALUE mod, int argc, const VALUE *argv,
VALUE val = argv[i];
id = rb_check_id(&val);
if (!id) {
+ if (i > 0) {
+ rb_clear_constant_cache();
+ }
+
undefined_constant(mod, val);
}
if ((ce = rb_const_lookup(mod, id))) {
@@ -3311,12 +3315,15 @@ set_const_visibility(VALUE mod, int argc, const VALUE *argv,
ac->flag |= flag;
}
}
- rb_clear_constant_cache_for_id(id);
}
else {
+ if (i > 0) {
+ rb_clear_constant_cache();
+ }
undefined_constant(mod, ID2SYM(id));
}
}
+ rb_clear_constant_cache();
}
void