summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/views/_insn_len_info.erb
blob: b29a40591841cd1bb6085063744b0289998f6967 (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
33
34
35
36
%# -*- 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.
%
% zjit_insns, insns = RubyVM::Instructions.partition { |i| i.name.start_with?('zjit_') }
%
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[] = {
% insns.each_slice(23) do |row|
    <%= row.map(&:width).join(', ') -%>,
% end
#if USE_ZJIT
% zjit_insns.each_slice(23) do |row|
    <%= row.map(&:width).join(', ') -%>,
% end
#endif
};

ASSERT_VM_INSTRUCTION_SIZE(rb_vm_insn_len_info);
#endif

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