diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-02-10 17:41:59 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-05 22:41:35 -0800 |
commit | 14acf9b0a3c5c06cd8a1bf60c929b25c6e7fee66 (patch) | |
tree | c85aad1e2752226ef9d1d60b3d70e09547903407 | |
parent | b30392f8ab16b10074a7362f187850e6898a20bb (diff) | |
download | ruby-14acf9b0a3c5c06cd8a1bf60c929b25c6e7fee66.tar.gz |
Decode trace insns properly
-rw-r--r-- | mjit_c.rb | 5 | ||||
-rw-r--r-- | tool/ruby_vm/views/lib/ruby_vm/mjit/instruction.rb.erb | 3 |
2 files changed, 5 insertions, 3 deletions
@@ -268,9 +268,10 @@ module RubyVM::MJIT # :nodoc: all } end - # Convert encoded VM pointers to insn BINs. + # Convert an encoded VM pointer to an insn BIN. def rb_vm_insn_decode(encoded) - Primitive.cexpr! 'INT2NUM(rb_vm_insn_decode(NUM2PTR(encoded)))' + # Using rb_vm_insn_addr2opcode to return trace_ insns + Primitive.cexpr! 'INT2NUM(rb_vm_insn_addr2opcode((void *)NUM2PTR(encoded)))' end # Convert insn BINs to encoded VM pointers. This one is not used by the compiler, but useful for debugging. diff --git a/tool/ruby_vm/views/lib/ruby_vm/mjit/instruction.rb.erb b/tool/ruby_vm/views/lib/ruby_vm/mjit/instruction.rb.erb index 38b9c1f92e..16c10a9928 100644 --- a/tool/ruby_vm/views/lib/ruby_vm/mjit/instruction.rb.erb +++ b/tool/ruby_vm/views/lib/ruby_vm/mjit/instruction.rb.erb @@ -16,11 +16,11 @@ module RubyVM::MJIT # :nodoc: all INSNS = { % RubyVM::Instructions.each_with_index do |insn, i| -% next if insn.name.start_with?('trace_') <%= 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 @@ -32,6 +32,7 @@ module RubyVM::MJIT # :nodoc: all always_leaf?: <%= insn.always_leaf? %>, leaf_without_check_ints?: <%= insn.leaf_without_check_ints? %>, handles_sp?: <%= insn.handles_sp? %>, +% end ), % end } |