diff options
author | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-05 15:27:08 +0000 |
---|---|---|
committer | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-05 15:27:08 +0000 |
commit | d33b9a8a724f5c46308b1a76062ac5722269905b (patch) | |
tree | feab65ac1008f1ff64fea87eff57b72972e39f9c /internal.h | |
parent | 9823c46189d7447692ea6c33e07b4cae5fed74f2 (diff) | |
download | ruby-d33b9a8a724f5c46308b1a76062ac5722269905b.tar.gz |
Fix compatibility of cached expanded load path
* file.c (rb_get_path_check_to_string): extract from
rb_get_path_check(). We change the spec not to call to_path of
String object.
* file.c (rb_get_path_check_convert): extract from rb_get_path_check().
* file.c (rb_get_path_check): follow the above change.
* file.c (rb_file_expand_path_fast): remove check_expand_path_args().
Instead we call it in load.c.
* file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to
reduce expand cost.
* file.c (rb_find_file_safe): ditto.
* internal.h (rb_get_expanded_load_path): add a declaration.
* internal.h (rb_get_path_check_to_string, rb_get_path_check_convert):
add declarations.
* load.c (rb_construct_expanded_load_path): fix for compatibility.
Same checks in rb_get_path_check() are added. We don't replace
$LOAD_PATH and ensure that String object of $LOAD_PATH are frozen.
We don't freeze non String object and expand it every times. We add
arguments for expanding load path partially and checking if load path
have relative paths or non String objects.
* load.c (load_path_getcwd): get current working directory for checking
if it's changed when getting load path.
* load.c (rb_get_expanded_load_path): fix for rebuilding cache properly.
We check if current working directory is changed and rebuild expanded
load path cache. We expand paths which start with ~ (User HOME) and
non String objects every times for compatibility. We make this
accessible from other source files.
* load.c (rb_feature_provided): call rb_get_path() since we changed
rb_file_expand_path_fast() not to call it.
* load.c (Init_load): initialize vm->load_path_check_cache.
* vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC.
* vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data
to check load path cache validity.
* test/ruby/test_require.rb (TestRequire): add tests for require
compatibility related to cached expanded load path.
[ruby-core:47970] [Bug #7158]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal.h b/internal.h index e538de4404..6e6a071f92 100644 --- a/internal.h +++ b/internal.h @@ -108,6 +108,8 @@ void rb_file_const(const char*, VALUE); int rb_file_load_ok(const char *); VALUE rb_file_expand_path_fast(VALUE, VALUE); VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE); +VALUE rb_get_path_check_to_string(VALUE, int); +VALUE rb_get_path_check_convert(VALUE, VALUE, int); void Init_File(void); #ifdef _WIN32 @@ -133,6 +135,7 @@ VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase); /* load.c */ VALUE rb_get_load_path(void); +VALUE rb_get_expanded_load_path(void); NORETURN(void rb_load_fail(VALUE, const char*)); /* math.c */ |