diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-16 18:49:26 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-30 00:39:06 +0900 |
commit | fcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch) | |
tree | 64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/template/insns_info.inc.tmpl |
Fresh start
Diffstat (limited to 'jni/ruby/template/insns_info.inc.tmpl')
-rw-r--r-- | jni/ruby/template/insns_info.inc.tmpl | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/jni/ruby/template/insns_info.inc.tmpl b/jni/ruby/template/insns_info.inc.tmpl new file mode 100644 index 0000000..14b4ef5 --- /dev/null +++ b/jni/ruby/template/insns_info.inc.tmpl @@ -0,0 +1,83 @@ +/** -*-c-*- + This file contains instruction information for yarv instruction sequence. + + ---- + This file is auto generated by insns2vm.rb + DO NOT TOUCH! + + If you want to fix something, you must edit 'template/insns_info.inc.tmpl' + or tool/insns2vm.rb + */ + +<%= insn_type_chars %> + +static const char *const insn_name_info[] = { +<%= insn_names %> +}; + +static const char *const insn_operand_info[] = { +<%= operands_info %> +}; + +static const int insn_len_info[] = { +<%= operands_num_info %> +}; + +#ifdef USE_INSN_RET_NUM +static const int insn_stack_push_num_info[] = { +<%= stack_num_info %> +}; +#endif + +#ifdef USE_INSN_STACK_INCREASE +static int +insn_stack_increase(int depth, int insn, VALUE *opes) +{ + switch(insn){ +<%= stack_increase %> + default: + rb_bug("insn_sp_increase: unreachable"); + } + return 0; +} +#endif + +/* some utilities */ + +static int +insn_len(VALUE insn) +{ + return insn_len_info[(int)insn]; +} + +static const char * +insn_name(VALUE insn) +{ + return insn_name_info[(int)insn]; +} + +static const char * +insn_op_types(VALUE insn) +{ + return insn_operand_info[(int)insn]; +} + +static int +insn_op_type(VALUE insn, long pos) +{ + int len = insn_len(insn) - 1; + if(pos < len){ + return insn_operand_info[(int)insn][pos]; + } + else{ + return 0; + } +} + +#ifdef USE_INSN_RET_NUM +static int +insn_ret_num(VALUE insn) +{ + return insn_stack_push_num_info[(int)insn]; +} +#endif |