summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/views/_insn_len_info.erb
blob: 569dca5845bb3ae34a7c7c8dd13f61f2a56b46d8 (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
%# -*- 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.
CONSTFUNC(MAYBE_UNUSED(static int insn_len(VALUE insn)));

RUBY_SYMBOL_EXPORT_BEGIN /* for debuggers */
extern const uint8_t rb_vm_insn_len_info[VM_INSTRUCTION_SIZE];
RUBY_SYMBOL_EXPORT_END

#ifdef RUBY_VM_INSNS_INFO
const uint8_t rb_vm_insn_len_info[] = {
% RubyVM::Instructions.each_slice 23 do |a|
    <%= a.map(&:width).join(', ') -%>,
% end
};

ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_len_info);
#endif

int
insn_len(VALUE i)
{
    return rb_vm_insn_len_info[i];
}