summaryrefslogtreecommitdiff
path: root/load.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-16 00:03:40 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-16 00:03:40 +0000
commit3fc5459977a9434c576a0e3d2686d42031bdb403 (patch)
tree13b86f61b48f7891e29bd6599209253dde29784b /load.c
parent5522e010e55a3bdeaed400ffca675e3a8e468257 (diff)
load.c: use fstring for loaded features and expanded load path
Loaded features is an obvious candidate for fstring since feature paths of Ruby sources are included in iseq locations, and iseq locations are in the fstring table anyways. Deduplicating expanded load path can reuse old objects, since since repeated expansions may recycle before old expanded paths are GC-ed away. * load.c (rb_construct_expanded_load_path): fstring expanded path (get_loaded_features_index): fstring feature path (rb_provide_feature): ditto [ruby-core:69871] [Feature #11331] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'load.c')
-rw-r--r--load.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/load.c b/load.c
index 69be692..91122c7 100644
--- a/load.c
+++ b/load.c
@@ -87,7 +87,7 @@ rb_construct_expanded_load_path(int type, int *has_relative, int *has_non_cache)
as_str = rb_get_path_check_convert(path, as_str, level);
expanded_path = rb_file_expand_path_fast(as_str, Qnil);
rb_str_freeze(expanded_path);
- rb_ary_push(ary, expanded_path);
+ rb_ary_push(ary, rb_fstring(expanded_path));
}
rb_obj_freeze(ary);
vm->expanded_load_path = ary;
@@ -287,9 +287,9 @@ get_loaded_features_index(void)
VALUE entry, as_str;
as_str = entry = rb_ary_entry(features, i);
StringValue(as_str);
+ as_str = rb_fstring(rb_str_freeze(as_str));
if (as_str != entry)
rb_ary_store(features, i, as_str);
- rb_str_freeze(as_str);
features_index_add(as_str, INT2FIX(i));
}
reset_loaded_features_snapshot();
@@ -560,7 +560,7 @@ rb_provide_feature(VALUE feature)
}
rb_str_freeze(feature);
- rb_ary_push(features, feature);
+ rb_ary_push(features, rb_fstring(feature));
features_index_add(feature, INT2FIX(RARRAY_LEN(features)-1));
reset_loaded_features_snapshot();
}