ruby-changes:47522
From: nobu <ko1@a...>
Date: Tue, 22 Aug 2017 13:40:20 +0900 (JST)
Subject: [ruby-changes:47522] nobu:r59638 (trunk): pack insn_operand_info and insn_len_info
nobu 2017-08-22 13:40:16 +0900 (Tue, 22 Aug 2017) New Revision: 59638 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59638 Log: pack insn_operand_info and insn_len_info Modified files: trunk/template/insns_info.inc.tmpl Index: template/insns_info.inc.tmpl =================================================================== --- template/insns_info.inc.tmpl (revision 59637) +++ template/insns_info.inc.tmpl (revision 59638) @@ -30,22 +30,17 @@ static const char insn_name_info_base[<% https://github.com/ruby/ruby/blob/trunk/template/insns_info.inc.tmpl#L30 #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, https://github.com/ruby/ruby/blob/trunk/template/insns_info.inc.tmpl#L73 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) https://github.com/ruby/ruby/blob/trunk/template/insns_info.inc.tmpl#L85 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) https://github.com/ruby/ruby/blob/trunk/template/insns_info.inc.tmpl#L93 { 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; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/