summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/views/_insn_type_chars.erb
blob: 27daec6c6dc0c08383852c42b0a799e1a4821eb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%# -*- C -*-
%# Copyright (c) 2017 Urabe, Shyouhei.  All rights reserved.
%#
%# This file is a part of  the programming language Ruby.  Permission is hereby
%# granted, to either  redistribute and/or modify this file,  provided that the
%# conditions mentioned  in the  file COPYING  are met.   Consult the  file for
%# details.
%
enum ruby_insn_type_chars {
% RubyVM::Typemap.each_value do |(c, t)|
    <%= t %> = '<%= c %>',
% end
};

static inline union iseq_inline_storage_entry *
ISEQ_IS_ENTRY_START(const struct rb_iseq_constant_body *body, char op_type)
{
    unsigned int relative_ic_offset = 0;
    switch (op_type) {
      case TS_IC:
        relative_ic_offset += body->ise_size;
      case TS_ISE:
        relative_ic_offset += body->icvarc_size;
      case TS_ICVARC:
        relative_ic_offset += body->ivc_size;
      case TS_IVC:
        break;
      default:
        rb_bug("Wrong op type");
    }
    return &body->is_entries[relative_ic_offset];
}