ruby-changes:8999
From: nobu <ko1@a...>
Date: Fri, 5 Dec 2008 12:36:05 +0900 (JST)
Subject: [ruby-changes:8999] Ruby:r20535 (trunk): * compile.c (ruby_iseq_compile, ruby_iseq_translate_threaded_code),
nobu 2008-12-05 12:35:48 +0900 (Fri, 05 Dec 2008) New Revision: 20535 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20535 Log: * compile.c (ruby_iseq_compile, ruby_iseq_translate_threaded_code), (ruby_insns_name_array, ruby_iseq_build_from_ary): prefixed with ruby_. * iseq.c (ruby_iseq_load, ruby_insn_make_insn_table): ditto. Modified files: trunk/ChangeLog trunk/compile.c trunk/iseq.c trunk/iseq.h trunk/vm.c Index: ChangeLog =================================================================== --- ChangeLog (revision 20534) +++ ChangeLog (revision 20535) @@ -1,3 +1,11 @@ +Fri Dec 5 12:35:46 2008 Nobuyoshi Nakada <nobu@r...> + + * compile.c (ruby_iseq_compile, ruby_iseq_translate_threaded_code), + (ruby_insns_name_array, ruby_iseq_build_from_ary): prefixed with + ruby_. + + * iseq.c (ruby_iseq_load, ruby_insn_make_insn_table): ditto. + Fri Dec 5 10:01:43 2008 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_cmp_m): fixed rdoc. pointed out by <Thomas Index: iseq.c =================================================================== --- iseq.c (revision 20534) +++ iseq.c (revision 20535) @@ -19,10 +19,6 @@ #include "insns.inc" #include "insns_info.inc" -/* compile.c */ -void iseq_compile(VALUE self, NODE *node); -int iseq_translate_threaded_code(rb_iseq_t *iseq); - VALUE rb_cISeq; static void @@ -326,7 +322,7 @@ iseq->self = self; prepare_iseq_build(iseq, name, filename, parent, type, bopt, option); - iseq_compile(self, node); + ruby_iseq_compile(self, node); cleanup_iseq_build(iseq); return self; } @@ -348,17 +344,14 @@ bopt, &COMPILE_OPTION_DEFAULT); } -VALUE iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, - VALUE exception, VALUE body); - #define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary") #define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str") #define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym") static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;} -VALUE +static VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt) { - VALUE iseqval = iseq_alloc(rb_cISeq); + VALUE iseqval = iseq_alloc(self); VALUE magic, version1, version2, format_type, misc; VALUE name, filename; @@ -428,7 +421,7 @@ prepare_iseq_build(iseq, name, filename, parent, iseq_type, 0, &option); - iseq_build_from_ary(iseq, locals, args, exception, body); + ruby_iseq_build_from_ary(iseq, locals, args, exception, body); cleanup_iseq_build(iseq); return iseqval; @@ -443,6 +436,12 @@ return iseq_load(self, data, 0, opt); } +VALUE +ruby_iseq_load(VALUE data, VALUE parent, VALUE opt) +{ + return iseq_load(rb_cISeq, data, parent, opt); +} + static NODE * compile_string(VALUE str, VALUE file, VALUE line) { @@ -1237,7 +1236,7 @@ } struct st_table * -insn_make_insn_table(void) +ruby_insn_make_insn_table(void) { struct st_table *table; int i; @@ -1383,7 +1382,7 @@ iseq->iseq[i+1] = (VALUE)func; } - iseq_translate_threaded_code(iseq); + ruby_iseq_translate_threaded_code(iseq); #define ALLOC_AND_COPY(dst, src, type, size) do { \ if (size) { \ Index: iseq.h =================================================================== --- iseq.h (revision 20534) +++ iseq.h (revision 20535) @@ -12,8 +12,17 @@ #ifndef RUBY_COMPILE_H #define RUBY_COMPILE_H -VALUE iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt); +/* compile.c */ +VALUE ruby_iseq_compile(VALUE self, NODE *node); +int ruby_iseq_translate_threaded_code(rb_iseq_t *iseq); +VALUE ruby_insns_name_array(void); +VALUE ruby_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, + VALUE exception, VALUE body); +/* iseq.c */ +VALUE ruby_iseq_load(VALUE data, VALUE parent, VALUE opt); +struct st_table *ruby_insn_make_insn_table(void); + #define ISEQ_TYPE_TOP INT2FIX(1) #define ISEQ_TYPE_METHOD INT2FIX(2) #define ISEQ_TYPE_BLOCK INT2FIX(3) Index: compile.c =================================================================== --- compile.c (revision 20534) +++ compile.c (revision 20535) @@ -415,7 +415,7 @@ } VALUE -iseq_compile(VALUE self, NODE *node) +ruby_iseq_compile(VALUE self, NODE *node) { DECL_ANCHOR(ret); rb_iseq_t *iseq; @@ -502,7 +502,7 @@ } int -iseq_translate_threaded_code(rb_iseq_t *iseq) +ruby_iseq_translate_threaded_code(rb_iseq_t *iseq) { #if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE extern const void **vm_get_insns_address_table(void); @@ -960,7 +960,7 @@ iseq_set_optargs_table(iseq); debugs("[compile step 5 (iseq_translate_threaded_code)] \n"); - iseq_translate_threaded_code(iseq); + ruby_iseq_translate_threaded_code(iseq); if (compile_debug > 1) { VALUE str = ruby_iseq_disasm(iseq->self); @@ -4974,14 +4974,14 @@ } VALUE -insns_name_array(void) +ruby_insns_name_array(void) { VALUE ary = rb_ary_new(); int i; for (i = 0; i < sizeof(insn_name_info) / sizeof(insn_name_info[0]); i++) { - rb_ary_push(ary, rb_str_new2(insn_name_info[i])); + rb_ary_push(ary, rb_obj_freeze(rb_str_new2(insn_name_info[i]))); } - return ary; + return rb_obj_freeze(ary); } static LABEL * @@ -5051,7 +5051,7 @@ eiseqval = 0; } else { - eiseqval = iseq_load(0, ptr[1], iseq->self, Qnil); + eiseqval = ruby_iseq_load(ptr[1], iseq->self, Qnil); } lstart = register_label(iseq, labels_table, ptr[2]); @@ -5064,8 +5064,6 @@ return COMPILE_OK; } -struct st_table *insn_make_insn_table(void); - static int iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor, VALUE body, struct st_table *labels_table) @@ -5081,7 +5079,7 @@ static struct st_table *insn_table; if (insn_table == 0) { - insn_table = insn_make_insn_table(); + insn_table = ruby_insn_make_insn_table(); } for (i=0; i<len; i++) { @@ -5137,7 +5135,7 @@ { if (op != Qnil) { if (TYPE(op) == T_ARRAY) { - argv[j] = iseq_load(0, op, iseq->self, Qnil); + argv[j] = ruby_iseq_load(op, iseq->self, Qnil); } else if (CLASS_OF(op) == rb_cISeq) { argv[j] = op; @@ -5202,8 +5200,8 @@ static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;} VALUE -iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, - VALUE exception, VALUE body) +ruby_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args, + VALUE exception, VALUE body) { int i; ID *tbl; Index: vm.c =================================================================== --- vm.c (revision 20534) +++ vm.c (revision 20535) @@ -1737,7 +1737,6 @@ return Qnil; } -VALUE insns_name_array(void); extern VALUE *rb_gc_stack_start; extern size_t rb_gc_stack_maxsize; #ifdef __ia64 @@ -1845,7 +1844,7 @@ #endif /* ::VM::InsnNameArray */ - rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", insns_name_array()); + rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", ruby_insns_name_array()); /* debug functions ::VM::SDR(), ::VM::NSDR() */ #if VMDEBUG -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/