ruby-changes:6211
From: ko1 <ko1@a...>
Date: Mon, 30 Jun 2008 02:26:34 +0900 (JST)
Subject: [ruby-changes:6211] Ruby:r17723 (trunk): * vm.c, vm_core.h,vm_core.h, vm_dump.c, iseq.c: rename class name
ko1 2008-06-30 02:26:16 +0900 (Mon, 30 Jun 2008) New Revision: 17723 Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h trunk/iseq.c trunk/test/ruby/test_method.rb trunk/test/ruby/test_settracefunc.rb trunk/vm.c trunk/vm_core.h trunk/vm_dump.c Log: * vm.c, vm_core.h,vm_core.h, vm_dump.c, iseq.c: rename class name VM -> RubyVM, and rename rb_cVM -> rb_cRubyVM. "VM" is too short name for class. * test/ruby/test_method.rb, test/ruby/test_settracefunc.rb: ditto. * include/ruby/ruby.h: rb_cRubyVM, rb_cEnv, rb_cISeq should not be exposed. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_dump.c?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/ruby.h?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm_core.h?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/iseq.c?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/vm.c?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_settracefunc.rb?r1=17723&r2=17722&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_method.rb?r1=17723&r2=17722&diff_format=u Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 17722) +++ include/ruby/ruby.h (revision 17723) @@ -907,9 +907,6 @@ RUBY_EXTERN VALUE rb_cTime; RUBY_EXTERN VALUE rb_cTrueClass; RUBY_EXTERN VALUE rb_cUnboundMethod; -RUBY_EXTERN VALUE rb_cISeq; -RUBY_EXTERN VALUE rb_cVM; -RUBY_EXTERN VALUE rb_cEnv; RUBY_EXTERN VALUE rb_eException; RUBY_EXTERN VALUE rb_eStandardError; Index: ChangeLog =================================================================== --- ChangeLog (revision 17722) +++ ChangeLog (revision 17723) @@ -1,3 +1,14 @@ +Mon Jun 30 02:14:34 2008 Koichi Sasada <ko1@a...> + + * vm.c, vm_core.h,vm_core.h, vm_dump.c, iseq.c: rename class name + VM -> RubyVM, and rename rb_cVM -> rb_cRubyVM. + "VM" is too short name for class. + + * test/ruby/test_method.rb, test/ruby/test_settracefunc.rb: ditto. + + * include/ruby/ruby.h: rb_cRubyVM, rb_cEnv, rb_cISeq should not be + exposed. + Mon Jun 30 02:10:32 2008 Koichi Sasada <ko1@a...> * process.c (Init_process): fix to avoid a warning. Index: vm_core.h =================================================================== --- vm_core.h (revision 17722) +++ vm_core.h (revision 17723) @@ -502,6 +502,9 @@ VALUE ruby_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child); const char *ruby_node_name(int node); +RUBY_EXTERN VALUE rb_cISeq; +RUBY_EXTERN VALUE rb_cRubyVM; +RUBY_EXTERN VALUE rb_cEnv; /* each thread has this size stack : 128KB */ #define RUBY_VM_THREAD_STACK_SIZE (128 * 1024) Index: iseq.c =================================================================== --- iseq.c (revision 17722) +++ iseq.c (revision 17723) @@ -1290,7 +1290,7 @@ Init_ISeq(void) { /* declare ::VM::InstructionSequence */ - rb_cISeq = rb_define_class_under(rb_cVM, "InstructionSequence", rb_cObject); + rb_cISeq = rb_define_class_under(rb_cRubyVM, "InstructionSequence", rb_cObject); rb_define_alloc_func(rb_cISeq, iseq_alloc); rb_define_method(rb_cISeq, "inspect", iseq_inspect, 0); rb_define_method(rb_cISeq, "disasm", ruby_iseq_disasm, 0); Index: vm.c =================================================================== --- vm.c (revision 17722) +++ vm.c (revision 17723) @@ -21,7 +21,7 @@ #define BUFSIZE 0x100 #define PROCDEBUG 0 -VALUE rb_cVM; +VALUE rb_cRubyVM; VALUE rb_cThread; VALUE rb_cEnv; @@ -1674,11 +1674,11 @@ VALUE opts; /* ::VM */ - rb_cVM = rb_define_class("VM", rb_cObject); - rb_undef_alloc_func(rb_cVM); + rb_cRubyVM = rb_define_class("RubyVM", rb_cObject); + rb_undef_alloc_func(rb_cRubyVM); /* Env */ - rb_cEnv = rb_define_class_under(rb_cVM, "Env", rb_cObject); + rb_cEnv = rb_define_class_under(rb_cRubyVM, "Env", rb_cObject); rb_undef_alloc_func(rb_cEnv); /* ::Thread */ @@ -1686,10 +1686,10 @@ rb_undef_alloc_func(rb_cThread); /* ::VM::USAGE_ANALYSIS_* */ - rb_define_const(rb_cVM, "USAGE_ANALYSIS_INSN", rb_hash_new()); - rb_define_const(rb_cVM, "USAGE_ANALYSIS_REGS", rb_hash_new()); - rb_define_const(rb_cVM, "USAGE_ANALYSIS_INSN_BIGRAM", rb_hash_new()); - rb_define_const(rb_cVM, "OPTS", opts = rb_ary_new()); + rb_define_const(rb_cRubyVM, "USAGE_ANALYSIS_INSN", rb_hash_new()); + rb_define_const(rb_cRubyVM, "USAGE_ANALYSIS_REGS", rb_hash_new()); + rb_define_const(rb_cRubyVM, "USAGE_ANALYSIS_INSN_BIGRAM", rb_hash_new()); + rb_define_const(rb_cRubyVM, "OPTS", opts = rb_ary_new()); #if OPT_DIRECT_THREADED_CODE rb_ary_push(opts, rb_str_new2("direct threaded code")); @@ -1720,12 +1720,12 @@ #endif /* ::VM::InsnNameArray */ - rb_define_const(rb_cVM, "INSTRUCTION_NAMES", insns_name_array()); + rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", insns_name_array()); /* debug functions ::VM::SDR(), ::VM::NSDR() */ #if VMDEBUG - rb_define_singleton_method(rb_cVM, "SDR", sdr, 0); - rb_define_singleton_method(rb_cVM, "NSDR", nsdr, 0); + rb_define_singleton_method(rb_cRubyVM, "SDR", sdr, 0); + rb_define_singleton_method(rb_cRubyVM, "NSDR", nsdr, 0); #else (void)sdr; (void)nsdr; @@ -1741,7 +1741,7 @@ rb_iseq_t *iseq; /* create vm object */ - vm->self = Data_Wrap_Struct(rb_cVM, rb_vm_mark, vm_free, vm); + vm->self = Data_Wrap_Struct(rb_cRubyVM, rb_vm_mark, vm_free, vm); /* create main thread */ th_self = th->self = Data_Wrap_Struct(rb_cThread, rb_thread_mark, thread_free, th); Index: vm_dump.c =================================================================== --- vm_dump.c (revision 17722) +++ vm_dump.c (revision 17723) @@ -435,7 +435,7 @@ CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN"); CONST_ID(bigram_hash, "USAGE_ANALYSIS_INSN_BIGRAM"); - uh = rb_const_get(rb_cVM, usage_hash); + uh = rb_const_get(rb_cRubyVM, usage_hash); if ((ihash = rb_hash_aref(uh, INT2FIX(insn))) == Qnil) { ihash = rb_hash_new(); rb_hash_aset(uh, INT2FIX(insn), ihash); @@ -455,7 +455,7 @@ ary[1] = INT2FIX(insn); bi = rb_ary_new4(2, &ary[0]); - uh = rb_const_get(rb_cVM, bigram_hash); + uh = rb_const_get(rb_cRubyVM, bigram_hash); if ((cv = rb_hash_aref(uh, bi)) == Qnil) { cv = INT2FIX(0); } @@ -481,7 +481,7 @@ CONST_ID(usage_hash, "USAGE_ANALYSIS_INSN"); - uh = rb_const_get(rb_cVM, usage_hash); + uh = rb_const_get(rb_cRubyVM, usage_hash); if ((ihash = rb_hash_aref(uh, INT2FIX(insn))) == Qnil) { ihash = rb_hash_new(); rb_hash_aset(uh, INT2FIX(insn), ihash); @@ -540,7 +540,7 @@ } valstr = syms[reg][isset]; - uh = rb_const_get(rb_cVM, usage_hash); + uh = rb_const_get(rb_cRubyVM, usage_hash); if ((cv = rb_hash_aref(uh, valstr)) == Qnil) { cv = INT2FIX(0); } Index: test/ruby/test_method.rb =================================================================== --- test/ruby/test_method.rb (revision 17722) +++ test/ruby/test_method.rb (revision 17723) @@ -70,7 +70,7 @@ def test_body o = Object.new def o.foo; end - assert_nothing_raised { VM::InstructionSequence.disasm(o.method(:foo)) } + assert_nothing_raised { RubyVM::InstructionSequence.disasm(o.method(:foo)) } end def test_new Index: test/ruby/test_settracefunc.rb =================================================================== --- test/ruby/test_settracefunc.rb (revision 17722) +++ test/ruby/test_settracefunc.rb (revision 17723) @@ -2,15 +2,15 @@ class TestSetTraceFunc < Test::Unit::TestCase def setup - @original_compile_option = VM::InstructionSequence.compile_option - VM::InstructionSequence.compile_option = { + @original_compile_option = RubyVM::InstructionSequence.compile_option + RubyVM::InstructionSequence.compile_option = { :trace_instruction => true, :specialized_instruction => false } end def teardown - VM::InstructionSequence.compile_option = @original_compile_option + RubyVM::InstructionSequence.compile_option = @original_compile_option end def test_c_call -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/