pack insn_operand_info and insn_len_info

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-08-22 04:40:16 +00:00
Родитель a4d650274d
Коммит 84bc175cab
1 изменённых файлов: 8 добавлений и 13 удалений

Просмотреть файл

@ -30,22 +30,17 @@ static const char insn_name_info_base[<%=insn_name_length%>] = ""
#define insn_name_info insn_name_info_base+insn_name_info_offset
static const char *const insn_operand_info[] = {
static const char insn_operand_info[][8] = {
% @insns.each do |insn|
"<% insn.opes.each {|type, _| %><%=TYPE_CHARS.fetch(op2typesig(type))%><%}%>",
"\<%= (insn.opes.size+1).to_s(8) %>""<%
insn.opes.each {|type, _|
%><%=TYPE_CHARS.fetch(op2typesig(type))%><%
}%>",
% end
};
ASSERT_VM_INSTRUCTION_SIZE(insn_operand_info);
static const int insn_len_info[] = {
% @insns.each do |insn|
<%= insn.opes.size + 1 %>,
% end
};
ASSERT_VM_INSTRUCTION_SIZE(insn_len_info);
#ifdef USE_INSN_RET_NUM
static const unsigned short insn_stack_push_num_info[] = {
% @insns.each do |insn|
@ -78,7 +73,7 @@ insn_stack_increase(int depth, int insn, VALUE *opes)
static int
insn_len(VALUE insn)
{
return insn_len_info[(int)insn];
return (unsigned char)insn_operand_info[(int)insn][0];
}
static const char *
@ -90,7 +85,7 @@ insn_name(VALUE insn)
static const char *
insn_op_types(VALUE insn)
{
return insn_operand_info[(int)insn];
return insn_operand_info[(int)insn]+1;
}
static int
@ -98,7 +93,7 @@ insn_op_type(VALUE insn, long pos)
{
int len = insn_len(insn) - 1;
if (pos < len) {
return insn_operand_info[(int)insn][pos];
return insn_operand_info[(int)insn][pos+1];
}
else{
return 0;