summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/views/insns.inc.erb
blob: 6521a89b8aec238a3723fead441be4d98154df2b (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
37
38
39
40
41
/* -*- 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_') }
%
<%= render 'copyright' %>
<%= render 'notice', locals: {
    this_file: 'contains YARV instruction list',
    edit: __FILE__,
} -%>

#ifndef INSNS_INC
#define INSNS_INC 1

/* BIN : Basic Instruction Name */
#define BIN(n) YARVINSN_##n

enum ruby_vminsn_type {
% insns.each do |i|
    <%= i.bin %>,
% end
#if USE_ZJIT
% zjit_insns.each do |i|
    <%= i.bin %>,
% end
#endif
    VM_INSTRUCTION_SIZE
};

#define VM_BARE_INSTRUCTION_SIZE <%= RubyVM::Instructions.count { |i| i.name !~ /\A(trace|zjit)_/ } %>

#define ASSERT_VM_INSTRUCTION_SIZE(array) \
    STATIC_ASSERT(numberof_##array, numberof(array) == VM_INSTRUCTION_SIZE)

#endif