ruby-changes:16373
From: mame <ko1@a...>
Date: Thu, 17 Jun 2010 23:32:39 +0900 (JST)
Subject: [ruby-changes:16373] Ruby:r28351 (trunk): * load.c (rb_load_internal): remove call to rb_realpath_internal
mame 2010-06-17 23:32:20 +0900 (Thu, 17 Jun 2010) New Revision: 28351 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=28351 Log: * load.c (rb_load_internal): remove call to rb_realpath_internal within rb_load_internal which caused big performance degradation. Instead, call rb_realpath_internal in the caller of rb_load_internal. [ruby-dev:41502] [ruby-dev:41610] * vm.c (rb_vm_call_cfunc): ditto. * eval_intern.h (rb_vm_call_cfunc): ditto. * ruby.c (process_options): ditto. Modified files: trunk/ChangeLog trunk/eval_intern.h trunk/iseq.c trunk/load.c trunk/ruby.c trunk/vm.c Index: eval_intern.h =================================================================== --- eval_intern.h (revision 28350) +++ eval_intern.h (revision 28351) @@ -205,7 +205,7 @@ VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val); NODE *rb_vm_cref(void); -VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename, VALUE filepath); +VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, const rb_block_t *blockptr, VALUE filename); void rb_vm_set_progname(VALUE filename); void rb_thread_terminate_all(void); VALUE rb_vm_top_self(); Index: ChangeLog =================================================================== --- ChangeLog (revision 28350) +++ ChangeLog (revision 28351) @@ -1,3 +1,16 @@ +Thu Jun 17 23:20:14 2010 Yusuke Endoh <mame@t...> + + * load.c (rb_load_internal): remove call to rb_realpath_internal + within rb_load_internal which caused big performance degradation. + Instead, call rb_realpath_internal in the caller of + rb_load_internal. [ruby-dev:41502] [ruby-dev:41610] + + * vm.c (rb_vm_call_cfunc): ditto. + + * eval_intern.h (rb_vm_call_cfunc): ditto. + + * ruby.c (process_options): ditto. + Thu Jun 17 18:37:47 2010 NAKAMURA Usaku <usa@r...> * file.c (rb_str_encode_ospath): when the encoding of the parameter Index: iseq.c =================================================================== --- iseq.c (revision 28350) +++ iseq.c (revision 28351) @@ -228,7 +228,7 @@ iseq->name = name; iseq->filename = filename; - iseq->filepath = filepath == Qnil ? Qnil : rb_realpath_internal(Qnil, filepath, 1); + iseq->filepath = filepath; iseq->line_no = (unsigned short)line_no; /* TODO: really enough? */ iseq->defined_method_id = 0; iseq->mark_ary = rb_ary_tmp_new(3); @@ -606,7 +606,8 @@ parser = rb_parser_new(); node = rb_parser_compile_file(parser, fname, f, NUM2INT(line)); make_compile_option(&option, opt); - return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), file, file, line, Qfalse, + return rb_iseq_new_with_opt(node, rb_str_new2("<main>"), file, + rb_realpath_internal(Qnil, file, 1), line, Qfalse, ISEQ_TYPE_TOP, &option); } Index: load.c =================================================================== --- load.c (revision 28350) +++ load.c (revision 28351) @@ -297,7 +297,7 @@ th->mild_compile_error++; node = (NODE *)rb_load_file(RSTRING_PTR(fname)); loaded = TRUE; - iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, fname, Qfalse); + iseq = rb_iseq_new_top(node, rb_str_new2("<top (required)>"), fname, rb_realpath_internal(Qnil, fname, 1), Qfalse); th->mild_compile_error--; rb_iseq_eval(iseq); } @@ -596,7 +596,7 @@ case 's': handle = (long)rb_vm_call_cfunc(rb_vm_top_self(), load_ext, - path, 0, path, path); + path, 0, path); rb_ary_push(ruby_dln_librefs, LONG2NUM(handle)); break; } @@ -643,7 +643,7 @@ { if (load_lock(name)) { rb_vm_call_cfunc(rb_vm_top_self(), init_ext_call, (VALUE)init, - 0, rb_str_new2(name), Qnil); + 0, rb_str_new2(name)); rb_provide(name); load_unlock(name, 1); } Index: vm.c =================================================================== --- vm.c (revision 28350) +++ vm.c (revision 28351) @@ -1450,11 +1450,11 @@ VALUE rb_vm_call_cfunc(VALUE recv, VALUE (*func)(VALUE), VALUE arg, - const rb_block_t *blockptr, VALUE filename, VALUE filepath) + const rb_block_t *blockptr, VALUE filename) { rb_thread_t *th = GET_THREAD(); const rb_control_frame_t *reg_cfp = th->cfp; - volatile VALUE iseqval = rb_iseq_new(0, filename, filename, filepath, 0, ISEQ_TYPE_TOP); + volatile VALUE iseqval = rb_iseq_new(0, filename, filename, Qnil, 0, ISEQ_TYPE_TOP); VALUE val; vm_push_frame(th, DATA_PTR(iseqval), VM_FRAME_MAGIC_TOP, Index: ruby.c =================================================================== --- ruby.c (revision 28350) +++ ruby.c (revision 28351) @@ -1462,7 +1462,8 @@ PREPARE_PARSE_MAIN({ VALUE path = Qnil; - if (!opt->e_script && strcmp(opt->script, "-")) path = opt->script_name; + if (!opt->e_script && strcmp(opt->script, "-")) + path = rb_realpath_internal(Qnil, opt->script_name, 1); iseq = rb_iseq_new_main(tree, opt->script_name, path); }); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/