summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-03 00:00:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-04-03 00:00:48 +0000
commit5c1926ac82b9a9c20b2ea7f7707622b4d8dc3ecc (patch)
treeebc886bfd59fd110056603ca64277fc80f0d6204
parent48206485212c2ba0d18b44a2afa34c483bed3c05 (diff)
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--compile.c8
-rw-r--r--iseq.c6
-rw-r--r--template/insns_info.inc.tmpl12
-rw-r--r--template/opt_sc.inc.tmpl4
-rw-r--r--template/optunifs.inc.tmpl8
-rw-r--r--tool/instruction.rb6
-rw-r--r--version.h6
8 files changed, 36 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 7085a08..b1e0966 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Thu Apr 3 09:00:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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@ruby-lang.org>
* rational.c (nurat_int_check): function for DRY integer check.
diff --git a/compile.c b/compile.c
index 8d4a78b..ea76aa1 100644
--- a/compile.c
+++ b/compile.c
@@ -1034,7 +1034,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case ISEQ_ELEMENT_INSN:
{
int j, len, insn;
- char *types;
+ const char *types;
VALUE *operands;
iobj = (INSN *)list;
@@ -1655,9 +1655,9 @@ iseq_insns_unification(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
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 @@ insn_data_to_s_detail(INSN *iobj)
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++) {
diff --git a/iseq.c b/iseq.c
index 2b2b855..515980b 100644
--- a/iseq.c
+++ b/iseq.c
@@ -597,7 +597,7 @@ insn_operand_intern(rb_iseq_t *iseq,
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 @@ ruby_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
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 @@ ruby_iseq_disasm_insn(VALUE ret, VALUE *iseq, int pos,
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);
diff --git a/template/insns_info.inc.tmpl b/template/insns_info.inc.tmpl
index d7e745b..a58ac3c 100644
--- a/template/insns_info.inc.tmpl
+++ b/template/insns_info.inc.tmpl
@@ -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 @@ insn_len(int insn)
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];
diff --git a/template/opt_sc.inc.tmpl b/template/opt_sc.inc.tmpl
index fc1c2f7..f5ad339 100644
--- a/template/opt_sc.inc.tmpl
+++ b/template/opt_sc.inc.tmpl
@@ -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 %>
};
diff --git a/template/optunifs.inc.tmpl b/template/optunifs.inc.tmpl
index 8a3ae3e..9b268f0 100644
--- a/template/optunifs.inc.tmpl
+++ b/template/optunifs.inc.tmpl
@@ -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, ...};
*/
diff --git a/tool/instruction.rb b/tool/instruction.rb
index fd8c0f0..4612e7e 100644
--- a/tool/instruction.rb
+++ b/tool/instruction.rb
@@ -1139,7 +1139,7 @@ module RubyVM
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 @@ module RubyVM
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
diff --git a/version.h b/version.h
index 084e9e4..5c7af53 100644
--- a/version.h
+++ b/version.h
@@ -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[];