2007-02-02 10:21:41 -05:00
|
|
|
/** -*-c-*-
|
|
|
|
This file contains instruction information for yarv instruction sequence.
|
2008-12-09 02:14:13 -05:00
|
|
|
|
2007-02-02 10:21:41 -05:00
|
|
|
----
|
|
|
|
This file is auto generated by insns2vm.rb
|
|
|
|
DO NOT TOUCH!
|
2008-12-09 02:14:13 -05:00
|
|
|
|
2007-02-02 10:21:41 -05:00
|
|
|
If you want to fix something, you must edit 'template/insns_info.inc.tmpl'
|
2014-10-25 23:26:31 -04:00
|
|
|
or tool/insns2vm.rb
|
2007-02-02 10:21:41 -05:00
|
|
|
*/
|
|
|
|
|
2017-08-22 00:22:01 -04:00
|
|
|
% TYPE_CHARS.each do |t, c|
|
|
|
|
#define <%=t%> '<%=c%>'
|
|
|
|
% end
|
2007-02-02 10:21:41 -05:00
|
|
|
|
2017-08-22 00:37:08 -04:00
|
|
|
static const unsigned short insn_name_info_offset[] = {
|
|
|
|
% insn_name_length = @insns.inject(0) do |ofs, insn|
|
|
|
|
<%= ofs %>,
|
|
|
|
% ofs + insn.name.size + 1
|
2017-08-22 00:22:01 -04:00
|
|
|
% end
|
2007-02-02 10:21:41 -05:00
|
|
|
};
|
|
|
|
|
2017-08-22 00:37:08 -04:00
|
|
|
ASSERT_VM_INSTRUCTION_SIZE(insn_name_info_offset);
|
|
|
|
|
|
|
|
static const char insn_name_info_base[<%=insn_name_length%>] = ""
|
|
|
|
% @insns.each do |insn|
|
|
|
|
"<%= insn.name %>\0"
|
|
|
|
% end
|
|
|
|
;
|
|
|
|
|
|
|
|
#define insn_name_info insn_name_info_base+insn_name_info_offset
|
2017-08-21 23:07:01 -04:00
|
|
|
|
2017-08-22 00:40:16 -04:00
|
|
|
static const char insn_operand_info[][8] = {
|
2017-08-22 00:22:01 -04:00
|
|
|
% @insns.each do |insn|
|
2017-08-22 00:40:16 -04:00
|
|
|
"\<%= (insn.opes.size+1).to_s(8) %>""<%
|
|
|
|
insn.opes.each {|type, _|
|
|
|
|
%><%=TYPE_CHARS.fetch(op2typesig(type))%><%
|
|
|
|
}%>",
|
2017-08-22 00:22:01 -04:00
|
|
|
% end
|
2007-02-02 10:21:41 -05:00
|
|
|
};
|
|
|
|
|
2017-08-21 23:07:01 -04:00
|
|
|
ASSERT_VM_INSTRUCTION_SIZE(insn_operand_info);
|
|
|
|
|
2007-08-23 02:48:28 -04:00
|
|
|
#ifdef USE_INSN_RET_NUM
|
2017-08-22 00:37:08 -04:00
|
|
|
static const unsigned short insn_stack_push_num_info[] = {
|
2017-08-22 00:22:01 -04:00
|
|
|
% @insns.each do |insn|
|
|
|
|
<%= insn.rets.size %>,
|
|
|
|
% end
|
2007-02-02 10:21:41 -05:00
|
|
|
};
|
2017-08-21 23:07:01 -04:00
|
|
|
|
|
|
|
ASSERT_VM_INSTRUCTION_SIZE(insn_stack_push_num_info);
|
2007-08-23 02:48:28 -04:00
|
|
|
#endif
|
2007-02-02 10:21:41 -05:00
|
|
|
|
2007-08-23 02:48:28 -04:00
|
|
|
#ifdef USE_INSN_STACK_INCREASE
|
2007-02-02 10:21:41 -05:00
|
|
|
static int
|
|
|
|
insn_stack_increase(int depth, int insn, VALUE *opes)
|
|
|
|
{
|
2017-08-22 00:22:01 -04:00
|
|
|
switch (insn) {
|
|
|
|
% @insns.each do |insn|
|
|
|
|
case BIN(<%= insn.name %>): {
|
|
|
|
<%= insn.sp_increase_c_expr %>
|
|
|
|
}
|
|
|
|
% end
|
|
|
|
default:
|
|
|
|
rb_bug("insn_sp_increase: unreachable");
|
|
|
|
}
|
|
|
|
return 0;
|
2007-02-02 10:21:41 -05:00
|
|
|
}
|
2007-08-23 02:48:28 -04:00
|
|
|
#endif
|
2007-02-02 10:21:41 -05:00
|
|
|
|
|
|
|
/* some utilities */
|
|
|
|
|
|
|
|
static int
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
insn_len(VALUE insn)
|
2007-02-02 10:21:41 -05:00
|
|
|
{
|
2017-08-22 00:40:16 -04:00
|
|
|
return (unsigned char)insn_operand_info[(int)insn][0];
|
2007-02-02 10:21:41 -05:00
|
|
|
}
|
|
|
|
|
2008-04-02 20:00:48 -04:00
|
|
|
static const char *
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
insn_name(VALUE insn)
|
2007-02-02 10:21:41 -05:00
|
|
|
{
|
2017-08-22 00:22:01 -04:00
|
|
|
return insn_name_info[(int)insn];
|
2007-02-02 10:21:41 -05:00
|
|
|
}
|
|
|
|
|
2008-04-02 20:00:48 -04:00
|
|
|
static const char *
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
insn_op_types(VALUE insn)
|
2007-02-02 10:21:41 -05:00
|
|
|
{
|
2017-08-22 00:40:16 -04:00
|
|
|
return insn_operand_info[(int)insn]+1;
|
2007-02-02 10:21:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
insn_op_type(VALUE insn, long pos)
|
2007-02-02 10:21:41 -05:00
|
|
|
{
|
2017-08-22 00:22:01 -04:00
|
|
|
int len = insn_len(insn) - 1;
|
|
|
|
if (pos < len) {
|
2017-08-22 00:40:16 -04:00
|
|
|
return insn_operand_info[(int)insn][pos+1];
|
2017-08-22 00:22:01 -04:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
return 0;
|
|
|
|
}
|
2007-02-02 10:21:41 -05:00
|
|
|
}
|
|
|
|
|
2007-08-23 02:48:28 -04:00
|
|
|
#ifdef USE_INSN_RET_NUM
|
2007-02-02 10:21:41 -05:00
|
|
|
static int
|
* compile.c, cont.c, gc.c, insns.def, iseq.c, iseq.h, process.c,
thread.c, vm.c, vm_core.h, vm_dump.c, vm_eval.c,
vm_insnhelper.c, vm_method.c, template/insns_info.inc.tmpl,
tool/instruction.rb: fixed types.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-21 16:58:26 -04:00
|
|
|
insn_ret_num(VALUE insn)
|
2007-02-02 10:21:41 -05:00
|
|
|
{
|
2017-08-22 00:22:01 -04:00
|
|
|
return insn_stack_push_num_info[(int)insn];
|
2007-02-02 10:21:41 -05:00
|
|
|
}
|
2007-08-23 02:48:28 -04:00
|
|
|
#endif
|