Bug #3443: requiree$B$,CY$/$J$ke(B
http://redmine.ruby-lang.org/issues/show/3443
e$B5/I<<Te(B: Yusuke E.
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
Target version: 1.9.2
ruby -v: ruby 1.9.3dev (2010-05-30 trunk 28086) [i386-cygwin]
[ruby-dev:41502] e$B$r%A%1%C%H2=$7$^$9!#e(B
e$B;01:$H?=$7$^$9!#e(B
1e$BG/$V$j$/$i$$$K:G?7%P!<%8%g%s$Ne(BRubye$B$Ge(Byarv2llvme$B$rF0$+$7$F$$?$i!"e(B
e$B$9$4$/;~4V$,$+$+$k$h$&$K$J$C$F$$$?$N$GD4$Y$F$$^$7$?!#e(B
e$B4D6-$O0J2<$NDL$j$G$9!#e(B
e$B!!!e(BCPU AMD Athlon™X2 Dual-Core QL-60 1.90 GHz
e$B!!e(BRAM 4GBytes
OS Windows Vista
CYGWIN_NT-6.0 miura-PC 1.7.5(0.225/5/3) 2010-04-12 19:07 i686 Cygwin
Ruby ruby 1.9.3dev (2010-05-30 trunk 28086) [i386-cygwin]
e$B$=$N7k2L!"e(Brequiree$B;~$K%U%!%$%kF~NO$N8e$KBgNL$Ne(BRead/Writee$B$G$O$J$$e(B
File Operatione$B$,H/@8$7$F$$$k$3$H$,J,$+$j$^$7$?!#e(B
e$B$5$i$K!“e(Bstrace(Cygwine$BHGe(B)e$B$r8+$?$H$3$m!”<!$N$h$&$J%7%9%F%`%3!<%k$,e(B
e$BBgNL$KH/@8$7$F$$$^$7$?!#e(B
857 67985110 [main] ruby 4896 open: open
(/home/miura/demo/yarv2llvm64/yarv2llvm/lib/vmtraverse.rb, 0x0)
101 67985211 [main] ruby 4896 normalize_posix_path: src
/home/miura/demo/yarv2llvm64/yarv2llvm/lib/vmtraverse.rb
96 67985307 [main] ruby 4896 normalize_posix_path:
/home/miura/demo/yarv2llvm64/yarv2llvm/lib/vmtraverse.rb =
normalize_posix_path
(/home/miura/demo/yarv2llvm64/yarv2llvm/lib/vmtraverse.rb)
96 67985403 [main] ruby 4896 mount_info::conv_to_win32_path:
conv_to_win32_path
(/home/miura/demo/yarv2llvm64/yarv2llvm/lib/vmtraverse.rb)
96 67985499 [main] ruby 4896 set_flags: flags: binary (0x2)
90 67985589 [main] ruby 4896 mount_info::conv_to_win32_path: src_path
/home/miura/demo/yarv2llvm64/yarv2llvm/lib/vmtraverse.rb, dst
C:\cygwin\home\miura\demo\yarv2llvm64\yarv2llvm\lib\vmtraverse.rb, flags
0x3000A, rc 0
954 67986543 [main] ruby 4896 symlink_info::check: 0x0 = NtCreateFile
(??\C:\cygwin\home\miura\demo\yarv2llvm64\yarv2llvm\lib\vmtraverse.rb)
352 67986895 [main] ruby 4896 symlink_info::check: not a symlink
575 67987470 [main] ruby 4896 symlink_info::check: 0 = symlink.check
(C:\cygwin\home\miura\demo\yarv2llvm64\yarv2llvm\lib\vmtraverse.rb,
0x22A320) (0x3000A)
156 67987626 [main] ruby 4896 path_conv::check:
this->path(C:\cygwin\home\miura\demo\yarv2llvm64\yarv2llvm\lib\vmtraverse.rb),
has_acls(1)
144 67987770 [main] ruby 4896 build_fh_pc: fh 0x612269D4
103 67987873 [main] ruby 4896 fhandler_base::open:
(??\C:\cygwin\home\miura\demo\yarv2llvm64\yarv2llvm\lib\vmtraverse.rb,
0x100000)
711 67988584 [main] ruby 4896 fhandler_base::set_flags: flags
0x100000,
supplied_bin 0x10000
e$B$3$l$r8+$k8B$j!"e(BCygwine$B$G$O%U%!%$%k$N%Q%9$rF@$k$?$a$Ke(B
e$B%U%!%$%k%7%9%F%$N%"%/%;%9$r4^$
7k9==E$$=hM}$r9T$C$F$$$k$h$&$G$9!#e(B
e$B$=$3$G!"%U%!%$%k%Q%9$r7+$jJV$7F@$k=hM}$r$7$F$$$k$H$3$m$re(B
e$BC5$7$?$H$3$m!"e(Biseq.ce$B$Ne(Bprepare_iseq_builde$BCf$Ne(B
iseq->filepath = filepath == Qnil ? Qnil : rb_realpath_internal(Qnil,
filepath, 1);
e$B$,8+$D$+$j$^$7$?!#;n$7$Ke(Biseq->filepathe$B$r>o$Ke(BQnile$B$K$9$k$h$&$KJQ99e(B
e$B$7$F!"<B9TB.EY$N:9$r8+$F$_$^$7$?!#e(B
e$B7k2L$G$9!#e(B
time ruby -I . yarv2llvm.rb fib.rb
e$B%*%j%8%J%ke(B
real 0m35.954s
user 0m4.163s
sys 0m14.351s
e$B>o$Ke(BQnile$B!!!e(B
real 0m10.323s
user 0m2.525s
sys 0m3.197s
e$B$^$?!"e(Brb_realpath_internal(Qnil, filepath,
1)e$B$N7k2L$r%-%c%C%7%e$9$ke(B
e$B$h$&$K$7$F$_$^$7$?!#$=$N7k2L$G$9!#e(B
e$B%-%c%C%7%ee(B
real 0m26.757s
user 0m3.291s
sys 0m10.623s
e$B$3$N<B83$G;H$C$?JQ99E@$r0J2<$K<($7$^$9!#e(B
e$B$J$*!"e(Biseq_s_compilee$B$Ne(B
- rb_scan_args(argc, argv, “13”, &src, &file, &path, &line, &opt);
- rb_scan_args(argc, argv, “14”, &src, &file, &path, &line, &opt);
e$B$OD>@\4X78$J$$$N$G$9$,!"$D$$$G$K>h$;$F$*$-$^$9!#e(B
e$B$3$A$i$b8f8!F$$7$F$b$i$($k$H9,$$$G$9!#e(B
Index: iseq.c
— iseq.c (revision 28086)
+++ iseq.c (working copy)
@@ -217,7 +217,22 @@
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
+static VALUE path_cache;
+static VALUE realpath_cache;
static VALUE
+realpath_iseq(VALUE path)
+{
- if (path_cache == path) {
-
return realpath_cache;
- }
- path_cache = path;
- realpath_cache = rb_realpath_internal(Qnil, path, 1);
- return realpath_cache;
+}
+static VALUE
prepare_iseq_build(rb_iseq_t *iseq,
VALUE name, VALUE filename, VALUE filepath, VALUE line_no,
VALUE parent, VALUE type, VALUE block_opt,
@@ -228,7 +243,9 @@
iseq->name = name;
iseq->filename = filename;
- iseq->filepath = filepath == Qnil ? Qnil :
rb_realpath_internal(Qnil,
filepath, 1);
-
//iseq->filepath = filepath == Qnil ? Qnil :
rb_realpath_internal(Qnil,
filepath, 1); -
iseq->filepath = filepath == Qnil ? Qnil : realpath_iseq(filepath);
-
// iseq->filepath = Qnil;
iseq->line_no = (unsigned short)line_no; /* TODO: really enough? */
iseq->defined_method_id = 0;
iseq->mark_ary = rb_ary_tmp_new(3);
@@ -579,7 +596,7 @@rb_secure(1);
- rb_scan_args(argc, argv, “13”, &src, &file, &path, &line, &opt);
- rb_scan_args(argc, argv, “14”, &src, &file, &path, &line, &opt);
if (NIL_P(file)) file = rb_str_new2(“”);
if (NIL_P(line)) line = INT2FIX(1);
@@ -1516,5 +1533,7 @@
rb_define_singleton_method(rb_cISeq, “compile_option=”,
iseq_s_compile_option_set, 1);
rb_define_singleton_method(rb_cISeq, “disasm”, iseq_s_disasm, 1);
rb_define_singleton_method(rb_cISeq, “disassemble”, iseq_s_disasm,
1);
+
- rb_global_variable(&path_cache);
}