summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/views/lib/ruby_vm/mjit/instruction.rb.erb
blob: 16c10a9928cf711e87b32b6fe3257bb40204a8c9 (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
module RubyVM::MJIT # :nodoc: all
  Instruction = Struct.new(
    :name,
    :bin,
    :len,
    :expr,
    :declarations,
    :preamble,
    :opes,
    :pops,
    :rets,
    :always_leaf?,
    :leaf_without_check_ints?,
    :handles_sp?,
  )

  INSNS = {
% RubyVM::Instructions.each_with_index do |insn, i|
    <%= i %> => Instruction.new(
      name: :<%= insn.name %>,
      bin: <%= i %>, # BIN(<%= insn.name %>)
      len: <%= insn.width %>, # insn_len
%   unless insn.name.start_with?('trace_')
      expr: <<-EXPR,
<%= insn.expr.expr.dump.sub(/\A"/, '').sub(/"\z/, '').gsub(/\\n/, "\n").gsub(/\\t/, ' ' * 8) %>
      EXPR
      declarations: <%= insn.declarations.inspect %>,
      preamble: <%= insn.preamble.map(&:expr).inspect %>,
      opes: <%= insn.opes.inspect %>,
      pops: <%= insn.pops.inspect %>,
      rets: <%= insn.rets.inspect %>,
      always_leaf?: <%= insn.always_leaf? %>,
      leaf_without_check_ints?: <%= insn.leaf_without_check_ints? %>,
      handles_sp?: <%= insn.handles_sp? %>,
%   end
    ),
% end
  }
end