mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
4820648521
commit
5c1926ac82
8 changed files with 36 additions and 25 deletions
11
ChangeLog
11
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.
|
||||
|
|
|
@ -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++) {
|
||||
|
|
6
iseq.c
6
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);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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 %>
|
||||
};
|
||||
|
||||
|
|
|
@ -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, ...};
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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[];
|
||||
|
|
Loading…
Add table
Reference in a new issue