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

ruby-changes:4398

From: ko1@a...
Date: Thu, 3 Apr 2008 09:01:36 +0900 (JST)
Subject: [ruby-changes:4398] nobu - Ruby:r15889 (trunk): * compile.c (iseq_set_sequence, iseq_insns_unification,

nobu	2008-04-03 09:00:48 +0900 (Thu, 03 Apr 2008)

  New Revision: 15889

  Modified files:
    trunk/ChangeLog
    trunk/compile.c
    trunk/iseq.c
    trunk/template/insns_info.inc.tmpl
    trunk/template/opt_sc.inc.tmpl
    trunk/template/optunifs.inc.tmpl
    trunk/tool/instruction.rb
    trunk/version.h

  Log:
    * compile.c (iseq_set_sequence, iseq_insns_unification,
      insn_data_to_s_detail): constified.
    
    * iseq.c (insn_operand_intern, ruby_iseq_disasm_insn): ditto.
    
    * template/{insns_info,opt_sc,optunifs}.inc.tmpl: ditto.
    
    * tool/instruction.rb (OptUnifsIncGenerator): ditto.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/version.h?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/tool/instruction.rb?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/template/optunifs.inc.tmpl?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/iseq.c?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/template/opt_sc.inc.tmpl?r1=15889&r2=15888&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/template/insns_info.inc.tmpl?r1=15889&r2=15888&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15888)
+++ ChangeLog	(revision 15889)
@@ -1,3 +1,14 @@
+Thu Apr  3 09:00:45 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* compile.c (iseq_set_sequence, iseq_insns_unification,
+	  insn_data_to_s_detail): constified.
+
+	* iseq.c (insn_operand_intern, ruby_iseq_disasm_insn): ditto.
+
+	* template/{insns_info,opt_sc,optunifs}.inc.tmpl: ditto.
+
+	* tool/instruction.rb (OptUnifsIncGenerator): ditto.
+
 Wed Apr  2 22:29:35 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* rational.c (nurat_int_check): function for DRY integer check.
Index: iseq.c
===================================================================
--- iseq.c	(revision 15888)
+++ iseq.c	(revision 15889)
@@ -597,7 +597,7 @@
 		    int insn, int op_no, VALUE op,
 		    int len, int pos, VALUE *pnop, VALUE child)
 {
-    char *types = insn_op_types(insn);
+    const char *types = insn_op_types(insn);
     char type = types[op_no];
     VALUE ret;
     char buff[0x100];
@@ -706,7 +706,7 @@
     int insn = iseq[pos];
     int len = insn_len(insn);
     int i, j;
-    char *types = insn_op_types(insn);
+    const char *types = insn_op_types(insn);
     VALUE str = rb_str_new(0, 0);
     char buff[0x100];
     char insn_name_buff[0x100];
@@ -724,7 +724,7 @@
     rb_str_cat2(str, buff);
 
     for (j = 0; types[j]; j++) {
-	char *types = insn_op_types(insn);
+	const char *types = insn_op_types(insn);
 	VALUE opstr = insn_operand_intern(iseqdat, insn, j, iseq[pos + j + 1],
 					  len, pos, &iseq[pos + j + 2],
 					  child);
Index: compile.c
===================================================================
--- compile.c	(revision 15888)
+++ compile.c	(revision 15889)
@@ -1034,7 +1034,7 @@
 	  case ISEQ_ELEMENT_INSN:
 	    {
 		int j, len, insn;
-		char *types;
+		const char *types;
 		VALUE *operands;
 
 		iobj = (INSN *)list;
@@ -1655,9 +1655,9 @@
 	    iobj = (INSN *)list;
 	    id = iobj->insn_id;
 	    if (unified_insns_data[id] != 0) {
-		int **entry = unified_insns_data[id];
+		const int *const *entry = unified_insns_data[id];
 		for (j = 1; j < (int)entry[0]; j++) {
-		    int *unified = entry[j];
+		    const int *unified = entry[j];
 		    LINK_ELEMENT *li = list->next;
 		    for (k = 2; k < unified[1]; k++) {
 			if (li->type != ISEQ_ELEMENT_INSN ||
@@ -4588,7 +4588,7 @@
 
     str = rb_sprintf("%-16s", insn_name(iobj->insn_id));
     if (iobj->operands) {
-	char *types = insn_op_types(iobj->insn_id);
+	const char *types = insn_op_types(iobj->insn_id);
 	int j;
 
 	for (j = 0; types[j]; j++) {
Index: version.h
===================================================================
--- version.h	(revision 15888)
+++ version.h	(revision 15889)
@@ -1,7 +1,7 @@
 #define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2008-04-02"
+#define RUBY_RELEASE_DATE "2008-04-03"
 #define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20080402
+#define RUBY_RELEASE_CODE 20080403
 #define RUBY_PATCHLEVEL 0
 
 #define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
 #define RUBY_VERSION_TEENY 0
 #define RUBY_RELEASE_YEAR 2008
 #define RUBY_RELEASE_MONTH 4
-#define RUBY_RELEASE_DAY 2
+#define RUBY_RELEASE_DAY 3
 
 #ifdef RUBY_EXTERN
 RUBY_EXTERN const char ruby_version[];
Index: tool/instruction.rb
===================================================================
--- tool/instruction.rb	(revision 15888)
+++ tool/instruction.rb	(revision 15889)
@@ -1139,7 +1139,7 @@
 
           uni_insn, uni_insns = *unif
           uni_insns = uni_insns[1..-1]
-          unif_insns_each << "static int UNIFIED_#{insn.name}_#{i}[] = {" +
+          unif_insns_each << "static const int UNIFIED_#{insn.name}_#{i}[] = {" +
                              "  BIN(#{uni_insn.name}), #{uni_insns.size + 2}, \n  " +
                              uni_insns.map{|e| "BIN(#{e.name})"}.join(", ") + "};\n"
           }
@@ -1147,14 +1147,14 @@
           
         end
         if size > 0
-          unif_insns << "static int *UNIFIED_#{insn.name}[] = {(int *)#{size+1}, \n"
+          unif_insns << "static const int *const UNIFIED_#{insn.name}[] = {(int *)#{size+1}, \n"
           unif_insns << (0...size).map{|e| "  UNIFIED_#{insn.name}_#{e}"}.join(",\n") + "};\n"
           unif_insns_data << "  UNIFIED_#{insn.name}"
         else
           unif_insns_data << "  0"
         end
       }
-      unif_insns_data = "static int **unified_insns_data[] = {\n" +
+      unif_insns_data = "static const int *const *const unified_insns_data[] = {\n" +
                         unif_insns_data.join(",\n") + "};\n"
       ERB.new(vpath.read('template/optunifs.inc.tmpl')).result(binding)
     end
Index: template/insns_info.inc.tmpl
===================================================================
--- template/insns_info.inc.tmpl	(revision 15888)
+++ template/insns_info.inc.tmpl	(revision 15889)
@@ -11,20 +11,20 @@
 
 <%= insn_type_chars %>
 
-static char *insn_name_info[] = {
+static const char *const insn_name_info[] = {
 <%= insn_names %>
 };
 
-static char *insn_operand_info[] = {
+static const char *const insn_operand_info[] = {
 <%= operands_info %>
 };
 
-static int insn_len_info[] = {
+static const int insn_len_info[] = {
 <%= operands_num_info %>
 };
 
 #ifdef USE_INSN_RET_NUM
-static int insn_stack_push_num_info[] = {
+static const int insn_stack_push_num_info[] = {
 <%= stack_num_info %>
 };
 #endif
@@ -50,13 +50,13 @@
   return insn_len_info[insn];
 }
 
-static char *
+static const char *
 insn_name(int insn)
 {
   return insn_name_info[insn];
 }
 
-static char *
+static const char *
 insn_op_types(int insn)
 {
   return insn_operand_info[insn];
Index: template/opt_sc.inc.tmpl
===================================================================
--- template/opt_sc.inc.tmpl	(revision 15888)
+++ template/opt_sc.inc.tmpl	(revision 15889)
@@ -22,11 +22,11 @@
 
 #define SC_ERROR 0xffffffff
 
-static VALUE sc_insn_info[][SC_STATE_SIZE] = {
+static const VALUE sc_insn_info[][SC_STATE_SIZE] = {
 <%= sc_insn_info %>
 };
 
-static VALUE sc_insn_next[] = {
+static const VALUE sc_insn_next[] = {
 <%= sc_insn_next %>
 };
 
Index: template/optunifs.inc.tmpl
===================================================================
--- template/optunifs.inc.tmpl	(revision 15888)
+++ template/optunifs.inc.tmpl	(revision 15889)
@@ -13,16 +13,16 @@
  */
 
 /*
-  static int UNIFIED_insn_name_1[] = {id, size, ...};
-  static int UNIFIED_insn_name_2[] = {id, size, ...};
+  static const int UNIFIED_insn_name_1[] = {id, size, ...};
+  static const int UNIFIED_insn_name_2[] = {id, size, ...};
   ...
 
-  static *int UNIFIED_insn_name[] = {size,
+  static const int *const UNIFIED_insn_name[] = {size,
     UNIFIED_insn_name_1,
     UNIFIED_insn_name_2, ...};
   ...
   
-  static **int unified_insns_data[] = {
+  static const int *const *const unified_insns_data[] = {
     UNIFIED_insn_nameA,
     UNIFIED_insn_nameB, ...};
  */

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

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