summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2021-09-18 17:37:35 -0700
committerJeremy Evans <code@jeremyevans.net>2021-09-18 17:37:35 -0700
commit162ad65fdd5e3f826eff4e0208c58a21151e993a (patch)
tree37f725f4561606beb314b31d15218fca318f4715 /load.c
parentf9fd04ffbc334bb5a3e8a0898ad201ad1c11709d (diff)
downloadruby-162ad65fdd5e3f826eff4e0208c58a21151e993a.tar.gz
Revert "Do not load file with same realpath twice when requiring"
This reverts commit ddb85c5d2bdf75a83eb163856508691a7436b446. This commit causes unexpected warnings in TestTranscode#test_loading_race occasionally in CI.
Diffstat (limited to 'load.c')
-rw-r--r--load.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/load.c b/load.c
index 4fb13017a5..28c17e8b9c 100644
--- a/load.c
+++ b/load.c
@@ -153,12 +153,6 @@ get_loaded_features(void)
}
static VALUE
-get_loaded_features_realpaths(void)
-{
- return GET_VM()->loaded_features_realpaths;
-}
-
-static VALUE
get_LOADED_FEATURES(ID _x, VALUE *_y)
{
return get_loaded_features();
@@ -323,9 +317,6 @@ get_loaded_features_index(void)
/* The sharing was broken; something (other than us in rb_provide_feature())
modified loaded_features. Rebuild the index. */
st_foreach(vm->loaded_features_index, loaded_features_index_clear_i, 0);
-
- VALUE realpaths = vm->loaded_features_realpaths;
- rb_hash_clear(realpaths);
features = vm->loaded_features;
for (i = 0; i < RARRAY_LEN(features); i++) {
VALUE entry, as_str;
@@ -337,15 +328,6 @@ get_loaded_features_index(void)
features_index_add(as_str, INT2FIX(i));
}
reset_loaded_features_snapshot();
-
- features = rb_ary_dup(vm->loaded_features_snapshot);
- long j = RARRAY_LEN(features);
- for (i = 0; i < j; i++) {
- VALUE as_str = rb_ary_entry(features, i);
- VALUE realpath = rb_check_realpath(Qnil, as_str, NULL);
- if (NIL_P(realpath)) realpath = as_str;
- rb_hash_aset(realpaths, rb_fstring(realpath), Qtrue);
- }
}
return vm->loaded_features_index;
}
@@ -1081,8 +1063,6 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
char *volatile ftptr = 0;
VALUE path;
volatile VALUE saved_path;
- VALUE realpath = 0;
- VALUE realpaths = get_loaded_features_realpaths();
volatile bool reset_ext_config = false;
struct rb_ext_config prev_ext_config;
@@ -1110,10 +1090,6 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
else if (!*ftptr) {
result = TAG_RETURN;
}
- else if (RTEST(rb_hash_aref(realpaths,
- realpath = rb_realpath_internal(Qnil, path, 1)))) {
- result = 0;
- }
else {
switch (found) {
case 'r':
@@ -1165,12 +1141,7 @@ require_internal(rb_execution_context_t *ec, VALUE fname, int exception)
rb_exc_raise(ec->errinfo);
}
- if (result == TAG_RETURN) {
- rb_provide_feature(path);
- if (realpath) {
- rb_hash_aset(realpaths, rb_fstring(realpath), Qtrue);
- }
- }
+ if (result == TAG_RETURN) rb_provide_feature(path);
ec->errinfo = saved.errinfo;
RUBY_DTRACE_HOOK(REQUIRE_RETURN, RSTRING_PTR(fname));
@@ -1370,8 +1341,6 @@ Init_load(void)
vm->loaded_features = rb_ary_new();
vm->loaded_features_snapshot = rb_ary_tmp_new(0);
vm->loaded_features_index = st_init_numtable();
- vm->loaded_features_realpaths = rb_hash_new();
- rb_obj_hide(vm->loaded_features_realpaths);
rb_define_global_function("load", rb_f_load, -1);
rb_define_global_function("require", rb_f_require, 1);