1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2008-06-29 17:26:16 +00:00
parent 002fb8f747
commit 9ebf6473eb
8 changed files with 35 additions and 24 deletions

View file

@ -1,3 +1,14 @@
Mon Jun 30 02:14:34 2008 Koichi Sasada <ko1@atdot.net>
* 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@atdot.net>
* process.c (Init_process): fix to avoid a warning.

View file

@ -907,9 +907,6 @@ RUBY_EXTERN VALUE rb_cThread;
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;

2
iseq.c
View file

@ -1290,7 +1290,7 @@ void
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);

View file

@ -70,7 +70,7 @@ class TestMethod < Test::Unit::TestCase
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

View file

@ -2,15 +2,15 @@ require 'test/unit'
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

24
vm.c
View file

@ -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 @@ Init_VM(void)
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 @@ Init_VM(void)
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 @@ Init_VM(void)
#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 @@ Init_VM(void)
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);

View file

@ -502,6 +502,9 @@ VALUE ruby_iseq_disasm(VALUE self);
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)

View file

@ -435,7 +435,7 @@ vm_analysis_insn(int insn)
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 @@ vm_analysis_insn(int insn)
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 @@ vm_analysis_operand(int insn, int n, VALUE op)
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 @@ vm_analysis_register(int reg, int isset)
}
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);
}