summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 04:40:16 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 04:40:16 (GMT)
commit84bc175cab620279d22ccf560685d7d0b79e9f00 (patch)
tree76033bfd1c3f2fddb93c38dec70af332459d276c /template
parenta4d650274d45f20ffae19bd60244a1ccc797fc5a (diff)
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
Diffstat (limited to 'template')
-rw-r--r--template/insns_info.inc.tmpl21
1 files changed, 8 insertions, 13 deletions
diff --git a/template/insns_info.inc.tmpl b/template/insns_info.inc.tmpl
index 6da1a98..933eb5a 100644
--- a/template/insns_info.inc.tmpl
+++ b/template/insns_info.inc.tmpl
@@ -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;