[前][次][番号順一覧][スレッド一覧]

ruby-changes:10110

From: ko1 <ko1@a...>
Date: Mon, 19 Jan 2009 10:07:20 +0900 (JST)
Subject: [ruby-changes:10110] Ruby:r21653 (trunk): * iseq.c:

ko1	2009-01-19 10:06:56 +0900 (Mon, 19 Jan 2009)

  New Revision: 21653

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21653

  Log:
    * iseq.c:
      rename ruby_iseq_disasm_insn() -> rb_iseq_disasm_insn().
      rename ruby_iseq_disasm() -> rb_iseq_disasm().
    * compile.c:
      rename ruby_iseq_compile() -> rb_iseq_compile_node().
      rename ruby_iseq_translate_threaded_code() ->
      rb_iseq_translate_threaded_code().
      rename ruby_insns_name_array() -> rb_insns_name_array().
      rename ruby_iseq_build_from_ary() -> rb_iseq_build_from_ary().
    * iseq.c, compile.c: remove ruby_insn_make_insn_table() and make
      static function insn_make_insn_table().
    * iseq.h, ruby.c, vm.c, vm_core.h, vm_eval.c, vm_dump.c,
      blockinlining.c: ditto.
      Rename strange "ruby_" prefix to "rb_" prefix.
      This changes may affect only core because renamed functions
      require a pointer of rb_iseq_t which is not exposed.

  Modified files:
    trunk/ChangeLog
    trunk/blockinlining.c
    trunk/compile.c
    trunk/iseq.c
    trunk/iseq.h
    trunk/ruby.c
    trunk/vm.c
    trunk/vm_core.h
    trunk/vm_dump.c
    trunk/vm_eval.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21652)
+++ ChangeLog	(revision 21653)
@@ -1,3 +1,25 @@
+Mon Jan 19 09:53:43 2009  Koichi Sasada  <ko1@a...>
+
+	* iseq.c:
+	  rename ruby_iseq_disasm_insn() -> rb_iseq_disasm_insn().
+	  rename ruby_iseq_disasm() -> rb_iseq_disasm().
+
+	* compile.c:
+	  rename ruby_iseq_compile() -> rb_iseq_compile_node().
+	  rename ruby_iseq_translate_threaded_code() ->
+	         rb_iseq_translate_threaded_code().
+	  rename ruby_insns_name_array() -> rb_insns_name_array().
+	  rename ruby_iseq_build_from_ary() -> rb_iseq_build_from_ary().
+
+	* iseq.c, compile.c: remove ruby_insn_make_insn_table() and make
+	  static function insn_make_insn_table().
+
+	* iseq.h, ruby.c, vm.c, vm_core.h, vm_eval.c, vm_dump.c, 
+	  blockinlining.c: ditto.
+	  Rename strange "ruby_" prefix to "rb_" prefix.
+	  This changes may affect only core because renamed functions
+	  require a pointer of rb_iseq_t which is not exposed.
+
 Mon Jan 19 09:21:04 2009  NAKAMURA Usaku  <usa@r...>
 
 	* ext/socket/mkconstants.rb: define macros with default value in
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 21652)
+++ vm_core.h	(revision 21653)
@@ -436,8 +436,8 @@
 VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE);
 VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
 VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
-VALUE ruby_iseq_disasm(VALUE self);
-VALUE ruby_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
+VALUE rb_iseq_disasm(VALUE self);
+VALUE rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
 const char *ruby_node_name(int node);
 int rb_iseq_first_lineno(rb_iseq_t *iseq);
 
Index: iseq.c
===================================================================
--- iseq.c	(revision 21652)
+++ iseq.c	(revision 21653)
@@ -331,7 +331,7 @@
     iseq->self = self;
 
     prepare_iseq_build(iseq, name, filename, parent, type, bopt, option);
-    ruby_iseq_compile(self, node);
+    rb_iseq_compile_node(self, node);
     cleanup_iseq_build(iseq);
     return self;
 }
@@ -431,7 +431,7 @@
     prepare_iseq_build(iseq, name, filename,
 		       parent, iseq_type, 0, &option);
 
-    ruby_iseq_build_from_ary(iseq, locals, args, exception, body);
+    rb_iseq_build_from_ary(iseq, locals, args, exception, body);
 
     cleanup_iseq_build(iseq);
     return iseqval;
@@ -739,7 +739,7 @@
 	break;
 
       default:
-	rb_bug("ruby_iseq_disasm: unknown operand type: %c", type);
+	rb_bug("rb_iseq_disasm: unknown operand type: %c", type);
     }
     return ret;
 }
@@ -749,8 +749,8 @@
  * Iseq -> Iseq inspect object
  */
 VALUE
-ruby_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
-		      rb_iseq_t *iseqdat, VALUE child)
+rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
+		    rb_iseq_t *iseqdat, VALUE child)
 {
     int insn = iseq[pos];
     int len = insn_len(insn);
@@ -831,7 +831,7 @@
 }
 
 VALUE
-ruby_iseq_disasm(VALUE self)
+rb_iseq_disasm(VALUE self)
 {
     rb_iseq_t *iseqdat = iseq_check(self);
     VALUE *iseq;
@@ -867,7 +867,7 @@
 		    catch_type((int)entry->type), (int)entry->start,
 		    (int)entry->end, (int)entry->sp, (int)entry->cont);
 	if (entry->iseq) {
-	    rb_str_concat(str, ruby_iseq_disasm(entry->iseq));
+	    rb_str_concat(str, rb_iseq_disasm(entry->iseq));
 	}
     }
     if (iseqdat->catch_table_size != 0) {
@@ -920,12 +920,12 @@
 
     /* show each line */
     for (i = 0; i < size;) {
-	i += ruby_iseq_disasm_insn(str, iseq, i, iseqdat, child);
+	i += rb_iseq_disasm_insn(str, iseq, i, iseqdat, child);
     }
 
     for (i = 0; i < RARRAY_LEN(child); i++) {
 	VALUE isv = rb_ary_entry(child, i);
-	rb_str_concat(str, ruby_iseq_disasm(isv));
+	rb_str_concat(str, rb_iseq_disasm(isv));
     }
 
     return str;
@@ -943,7 +943,7 @@
     if ((node = rb_method_body(body)) != 0) {
 	if (nd_type(node) == RUBY_VM_METHOD_NODE) {
  	    VALUE iseqval = (VALUE)node->nd_body;
-	    ret = ruby_iseq_disasm(iseqval);
+	    ret = rb_iseq_disasm(iseqval);
 	}
     }
 
@@ -1248,20 +1248,6 @@
     return val;
 }
 
-struct st_table *
-ruby_insn_make_insn_table(void)
-{
-    struct st_table *table;
-    int i;
-    table = st_init_numtable();
-
-    for (i=0; i<VM_INSTRUCTION_SIZE; i++) {
-	st_insert(table, ID2SYM(rb_intern(insn_name(i))), i);
-    }
-
-    return table;
-}
-
 VALUE
 rb_iseq_clone(VALUE iseqval, VALUE newcbase)
 {
@@ -1415,7 +1401,7 @@
 	iseq->iseq[i+1] = (VALUE)func;
     }
 
-    ruby_iseq_translate_threaded_code(iseq);
+    rb_iseq_translate_threaded_code(iseq);
 
 #define ALLOC_AND_COPY(dst, src, type, size) do { \
   if (size) { \
@@ -1445,8 +1431,8 @@
     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);
-    rb_define_method(rb_cISeq, "disassemble", ruby_iseq_disasm, 0);
+    rb_define_method(rb_cISeq, "disasm", rb_iseq_disasm, 0);
+    rb_define_method(rb_cISeq, "disassemble", rb_iseq_disasm, 0);
     rb_define_method(rb_cISeq, "to_a", iseq_to_a, 0);
     rb_define_method(rb_cISeq, "eval", iseq_eval, 0);
 
Index: iseq.h
===================================================================
--- iseq.h	(revision 21652)
+++ iseq.h	(revision 21653)
@@ -13,11 +13,10 @@
 #define RUBY_COMPILE_H
 
 /* 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);
+VALUE rb_iseq_compile_node(VALUE self, NODE *node);
+int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
+VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
+			     VALUE exception, VALUE body);
 
 /* iseq.c */
 VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
Index: compile.c
===================================================================
--- compile.c	(revision 21652)
+++ compile.c	(revision 21653)
@@ -415,7 +415,7 @@
 }
 
 VALUE
-ruby_iseq_compile(VALUE self, NODE *node)
+rb_iseq_compile_node(VALUE self, NODE *node)
 {
     DECL_ANCHOR(ret);
     rb_iseq_t *iseq;
@@ -503,7 +503,7 @@
 }
 
 int
-ruby_iseq_translate_threaded_code(rb_iseq_t *iseq)
+rb_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);
@@ -961,10 +961,10 @@
     iseq_set_optargs_table(iseq);
 
     debugs("[compile step 5 (iseq_translate_threaded_code)] \n");
-    ruby_iseq_translate_threaded_code(iseq);
+    rb_iseq_translate_threaded_code(iseq);
 
     if (compile_debug > 1) {
-	VALUE str = ruby_iseq_disasm(iseq->self);
+	VALUE str = rb_iseq_disasm(iseq->self);
 	printf("%s\n", StringValueCStr(str));
 	fflush(stdout);
     }
@@ -5000,7 +5000,7 @@
 }
 
 VALUE
-ruby_insns_name_array(void)
+rb_insns_name_array(void)
 {
     VALUE ary = rb_ary_new();
     int i;
@@ -5090,6 +5090,20 @@
     return COMPILE_OK;
 }
 
+static struct st_table *
+insn_make_insn_table(void)
+{
+    struct st_table *table;
+    int i;
+    table = st_init_numtable();
+
+    for (i=0; i<VM_INSTRUCTION_SIZE; i++) {
+	st_insert(table, ID2SYM(rb_intern(insn_name(i))), i);
+    }
+
+    return table;
+}
+
 static int
 iseq_build_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
 		VALUE body, struct st_table *labels_table)
@@ -5105,7 +5119,7 @@
     static struct st_table *insn_table;
 
     if (insn_table == 0) {
-	insn_table = ruby_insn_make_insn_table();
+	insn_table = insn_make_insn_table();
     }
 
     for (i=0; i<len; i++) {
@@ -5226,7 +5240,7 @@
 static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;}
 
 VALUE
-ruby_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
+rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
 			 VALUE exception, VALUE body)
 {
     int i;
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 21652)
+++ vm_eval.c	(revision 21653)
@@ -729,8 +729,7 @@
 	th->base_block = 0;
 
 	if (0) {		/* for debug */
-	    extern VALUE ruby_iseq_disasm(VALUE);
-	    printf("%s\n", RSTRING_PTR(ruby_iseq_disasm(iseqval)));
+	    printf("%s\n", RSTRING_PTR(rb_iseq_disasm(iseqval)));
 	}
 
 	/* save new env */
Index: blockinlining.c
===================================================================
--- blockinlining.c	(revision 21652)
+++ blockinlining.c	(revision 21653)
@@ -42,7 +42,7 @@
 				      parent, iseq->type,
 				      GC_GUARDED_PTR(builder));
     if (0) {
-	printf("%s\n", RSTRING_PTR(ruby_iseq_disasm(iseqval)));
+	printf("%s\n", RSTRING_PTR(rb_iseq_disasm(iseqval)));
     }
     iseq->cached_special_block = iseqval;
     iseq->cached_special_block_builder = builder;
Index: vm.c
===================================================================
--- vm.c	(revision 21652)
+++ vm.c	(revision 21653)
@@ -41,6 +41,8 @@
 rb_thread_t *ruby_current_thread = 0;
 rb_vm_t *ruby_current_vm = 0;
 
+VALUE rb_insns_name_array(void);
+
 void vm_analysis_operand(int insn, int n, VALUE op);
 void vm_analysis_register(int reg, int isset);
 void vm_analysis_insn(int insn);
@@ -1890,7 +1892,7 @@
 #endif
 
     /* ::VM::InsnNameArray */
-    rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", ruby_insns_name_array());
+    rb_define_const(rb_cRubyVM, "INSTRUCTION_NAMES", rb_insns_name_array());
 
     /* debug functions ::VM::SDR(), ::VM::NSDR() */
 #if VMDEBUG
Index: vm_dump.c
===================================================================
--- vm_dump.c	(revision 21652)
+++ vm_dump.c	(revision 21653)
@@ -365,7 +365,7 @@
 	int pc = cfp->pc - iseq->iseq_encoded;
 
 	printf("%3"PRIdPTRDIFF" ", VM_CFP_CNT(th, cfp));
-	ruby_iseq_disasm_insn(0, seq, pc, iseq, 0);
+	rb_iseq_disasm_insn(0, seq, pc, iseq, 0);
     }
 
 #if VMDEBUG > 3
Index: ruby.c
===================================================================
--- ruby.c	(revision 21652)
+++ ruby.c	(revision 21653)
@@ -1420,7 +1420,7 @@
     });
 
     if (opt->dump & DUMP_BIT(insns)) {
-	rb_io_write(rb_stdout, ruby_iseq_disasm(iseq));
+	rb_io_write(rb_stdout, rb_iseq_disasm(iseq));
 	rb_io_flush(rb_stdout);
 	return Qtrue;
     }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]