ruby-changes:6764
From: nobu <ko1@a...>
Date: Thu, 31 Jul 2008 01:36:25 +0900 (JST)
Subject: [ruby-changes:6764] Ruby:r18280 (mvm): * file.c (rb_file_s_join, Init_File): moved separator to VM.
nobu 2008-07-31 01:36:05 +0900 (Thu, 31 Jul 2008) New Revision: 18280 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18280 Log: * file.c (rb_file_s_join, Init_File): moved separator to VM. * complex.c (make_patterns), rational.c (make_patterns): ditto. Modified files: branches/mvm/ChangeLog branches/mvm/complex.c branches/mvm/file.c branches/mvm/rational.c Index: mvm/complex.c =================================================================== --- mvm/complex.c (revision 18279) +++ mvm/complex.c (revision 18280) @@ -1073,9 +1073,17 @@ return rb_complex_new1(self); } -static VALUE comp_pat1, comp_pat2, a_slash, a_dot_and_an_e, - null_string, underscores_pat, an_underscore; +static int vmkey_comp_pat1, vmkey_comp_pat2, vmkey_a_slash, vmkey_a_dot_and_an_e, + vmkey_null_string, vmkey_underscores_pat, vmkey_an_underscore; +#define comp_pat1 *rb_vm_specific_ptr(vmkey_comp_pat1) +#define comp_pat2 *rb_vm_specific_ptr(vmkey_comp_pat2) +#define a_slash *rb_vm_specific_ptr(vmkey_a_slash) +#define a_dot_and_an_e *rb_vm_specific_ptr(vmkey_a_dot_and_an_e) +#define null_string *rb_vm_specific_ptr(vmkey_null_string) +#define underscores_pat *rb_vm_specific_ptr(vmkey_underscores_pat) +#define an_underscore *rb_vm_specific_ptr(vmkey_an_underscore) + #define DIGITS "(?:\\d(?:_\\d|\\d)*)" #define NUMERATOR "(?:" DIGITS "?\\.)?" DIGITS "(?:[eE][-+]?" DIGITS ")?" #define DENOMINATOR "[-+]?" DIGITS @@ -1091,8 +1099,16 @@ static const char comp_pat2_source[] = PATTERN2; static const char underscores_pat_source[] = "_+"; - if (comp_pat1) return; + if (vmkey_comp_pat1) return; + vmkey_comp_pat1 = rb_vm_key_create(); + vmkey_comp_pat2 = rb_vm_key_create(); + vmkey_a_slash = rb_vm_key_create(); + vmkey_a_dot_and_an_e = rb_vm_key_create(); + vmkey_null_string = rb_vm_key_create(); + vmkey_underscores_pat = rb_vm_key_create(); + vmkey_an_underscore = rb_vm_key_create(); + comp_pat1 = rb_reg_new(comp_pat1_source, sizeof comp_pat1_source - 1, 0); rb_global_variable(&comp_pat1); Index: mvm/ChangeLog =================================================================== --- mvm/ChangeLog (revision 18279) +++ mvm/ChangeLog (revision 18280) @@ -1,5 +1,9 @@ -Thu Jul 31 01:33:17 2008 Nobuyoshi Nakada <nobu@r...> +Thu Jul 31 01:36:02 2008 Nobuyoshi Nakada <nobu@r...> + * file.c (rb_file_s_join, Init_File): moved separator to VM. + + * complex.c (make_patterns), rational.c (make_patterns): ditto. + * include/ruby/mvm.h (rb_thread_lock_t): needed for inter-VM lock. * io.c (max_file_descriptor_lock): should be initialized. Index: mvm/rational.c =================================================================== --- mvm/rational.c (revision 18279) +++ mvm/rational.c (revision 18280) @@ -1228,8 +1228,15 @@ f_expt(INT2FIX(FLT_RADIX), RARRAY_PTR(a)[1])); } -static VALUE rat_pat, an_e_pat, a_dot_pat, underscores_pat, an_underscore; +static int vmkey_rat_pat, vmkey_an_e_pat, vmkey_a_dot_pat, + vmkey_underscores_pat, vmkey_an_underscore; +#define rat_pat *rb_vm_specific_ptr(vmkey_rat_pat) +#define an_e_pat *rb_vm_specific_ptr(vmkey_an_e_pat) +#define a_dot_pat *rb_vm_specific_ptr(vmkey_a_dot_pat) +#define underscores_pat *rb_vm_specific_ptr(vmkey_underscores_pat) +#define an_underscore *rb_vm_specific_ptr(vmkey_an_underscore) + #define DIGITS "(?:\\d(?:_\\d|\\d)*)" #define NUMERATOR "(?:" DIGITS "?\\.)?" DIGITS "(?:[eE][-+]?" DIGITS ")?" #define DENOMINATOR "[-+]?" DIGITS @@ -1243,8 +1250,14 @@ static const char a_dot_pat_source[] = "\\."; static const char underscores_pat_source[] = "_+"; - if (rat_pat) return; + if (vmkey_rat_pat) return; + vmkey_rat_pat = rb_vm_key_create(); + vmkey_an_e_pat = rb_vm_key_create(); + vmkey_a_dot_pat = rb_vm_key_create(); + vmkey_underscores_pat = rb_vm_key_create(); + vmkey_an_underscore = rb_vm_key_create(); + rat_pat = rb_reg_new(rat_pat_source, sizeof rat_pat_source - 1, 0); rb_global_variable(&rat_pat); Index: mvm/file.c =================================================================== --- mvm/file.c (revision 18279) +++ mvm/file.c (revision 18280) @@ -3209,7 +3209,7 @@ return rb_assoc_new(rb_file_s_dirname(Qnil, path), rb_file_s_basename(1,&path)); } -static VALUE separator; +static int vmkey_separator; static VALUE rb_file_join(VALUE ary, VALUE sep); @@ -3292,7 +3292,7 @@ static VALUE rb_file_s_join(VALUE klass, VALUE args) { - return rb_file_join(args, separator); + return rb_file_join(args, *rb_vm_specific_ptr(vmkey_separator)); } /* @@ -4663,6 +4663,8 @@ void Init_File(void) { + VALUE separator; + rb_mFileTest = rb_define_module("FileTest"); rb_cFile = rb_define_class("File", rb_cIO); @@ -4727,6 +4729,8 @@ rb_define_singleton_method(rb_cFile, "path", rb_file_s_path, 1); separator = rb_obj_freeze(rb_usascii_str_new2("/")); + vmkey_separator = rb_vm_key_create(); + *rb_vm_specific_ptr(vmkey_separator) = separator; rb_define_const(rb_cFile, "Separator", separator); rb_define_const(rb_cFile, "SEPARATOR", separator); rb_define_singleton_method(rb_cFile, "split", rb_file_s_split, 1); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/