[前][次][番号順一覧][スレッド一覧]

ruby-changes:73457

From: Takashi <ko1@a...>
Date: Wed, 7 Sep 2022 06:21:37 +0900 (JST)
Subject: [ruby-changes:73457] d5752f73d2 (master): Add another method for debugging

https://git.ruby-lang.org/ruby.git/commit/?id=d5752f73d2

From d5752f73d2288f5ccce0ff6015d929227b914588 Mon Sep 17 00:00:00 2001
From: Takashi Kokubun <takashikkbn@g...>
Date: Wed, 7 Sep 2022 06:21:00 +0900
Subject: Add another method for debugging

---
 mjit_compiler.rb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mjit_compiler.rb b/mjit_compiler.rb
index 77dcf7ef51..9e032fc747 100644
--- a/mjit_compiler.rb
+++ b/mjit_compiler.rb
@@ -90,10 +90,16 @@ if RubyVM::MJIT.enabled? https://github.com/ruby/ruby/blob/trunk/mjit_compiler.rb#L90
       }
     end
 
+    # Convert encoded VM pointers to insn BINs.
     def rb_vm_insn_decode(encoded)
       Primitive.cexpr! 'INT2NUM(rb_vm_insn_decode(NUM2PTR(encoded)))'
     end
 
+    # Convert insn BINs to encoded VM pointers. This one is not used by the compiler, but useful for debugging.
+    def rb_vm_insn_encode(bin)
+      Primitive.cexpr! 'PTR2NUM((VALUE)rb_vm_get_insns_address_table()[NUM2INT(bin)])'
+    end
+
     def insn_may_depend_on_sp_or_pc(insn, opes)
       _opes_addr = opes.to_i
       Primitive.cexpr! 'RBOOL(insn_may_depend_on_sp_or_pc(NUM2INT(insn), (VALUE *)NUM2PTR(_opes_addr)))'
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]