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

ruby-changes:68764

From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:13:29 +0900 (JST)
Subject: [ruby-changes:68764] faafe716af (master): Add jit_print_loc() for debugging, based on Alan Wu's snippet

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

From faafe716af5ea2d31eb175885032a6fe46b92834 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Thu, 11 Feb 2021 12:46:46 -0500
Subject: Add jit_print_loc() for debugging, based on Alan Wu's snippet

---
 ujit_codegen.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ujit_codegen.c b/ujit_codegen.c
index ba215dc008..452849d53c 100644
--- a/ujit_codegen.c
+++ b/ujit_codegen.c
@@ -26,6 +26,17 @@ codeblock_t* cb = NULL; https://github.com/ruby/ruby/blob/trunk/ujit_codegen.c#L26
 static codeblock_t outline_block;
 codeblock_t* ocb = NULL;
 
+// Print the current source location for debugging purposes
+static void __attribute__((unused))
+jit_print_loc(jitstate_t* jit, const char* msg)
+{
+    char *ptr;
+    long len;
+    VALUE path = rb_iseq_path(jit->iseq);
+    RSTRING_GETMEM(path, ptr, len);
+    fprintf(stderr, "%s %s:%u\n", msg, ptr, rb_iseq_line_no(jit->iseq, jit->insn_idx));
+}
+
 // Get the current instruction's opcode
 static int
 jit_get_opcode(jitstate_t* jit)
-- 
cgit v1.2.1


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

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