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

ruby-changes:69056

From: Noah <ko1@a...>
Date: Thu, 21 Oct 2021 08:20:42 +0900 (JST)
Subject: [ruby-changes:69056] b70383fbea (master): YJIT stats should always include the inlined and outlined sizes, regardless of RUBY_DEBUG and --yjit-stats/YJIT_STATS settings

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

From b70383fbea8d4acc49eceed24c83d87637412ff4 Mon Sep 17 00:00:00 2001
From: Noah Gibbs <noah.gibbs@s...>
Date: Mon, 19 Jul 2021 12:19:25 +0100
Subject: YJIT stats should always include the inlined and outlined sizes,
 regardless of RUBY_DEBUG and --yjit-stats/YJIT_STATS settings

---
 yjit_iface.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/yjit_iface.c b/yjit_iface.c
index db91b07e5a..d347cbd5ef 100644
--- a/yjit_iface.c
+++ b/yjit_iface.c
@@ -713,10 +713,8 @@ comments_for(rb_execution_context_t *ec, VALUE self, VALUE start_address, VALUE https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L713
 static VALUE
 get_yjit_stats(rb_execution_context_t *ec, VALUE self)
 {
-#if RUBY_DEBUG
-    if (!rb_yjit_opts.gen_stats) return Qnil;
-
     VALUE hash = rb_hash_new();
+
     RB_VM_LOCK_ENTER();
 
     {
@@ -729,10 +727,14 @@ get_yjit_stats(rb_execution_context_t *ec, VALUE self) https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L727
         rb_hash_aset(hash, key, value);
     }
 
-    {
+#if RUBY_DEBUG
+    if (rb_yjit_opts.gen_stats) {
         int64_t *counter_reader = (int64_t *)&yjit_runtime_counters;
         int64_t *counter_reader_end = &yjit_runtime_counters.last_member;
 
+        // For each counter in yjit_counter_names, add that counter as
+        // a key/value pair.
+
         // Iterate through comma separated counter name list
         char *name_reader = yjit_counter_names;
         char *counter_name_end = yjit_counter_names + sizeof(yjit_counter_names);
@@ -742,7 +744,7 @@ get_yjit_stats(rb_execution_context_t *ec, VALUE self) https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L744
                 continue;
             }
 
-            // Compute name of counter name
+            // Compute length of counter name
             int name_len;
             char *name_end;
             {
@@ -759,11 +761,9 @@ get_yjit_stats(rb_execution_context_t *ec, VALUE self) https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L761
             counter_reader++;
             name_reader = name_end;
         }
-    }
 
-    {
-        // For each entry in exit_op_count, add a stats entry with key "exit_INSTRUCTION_NAME",
-        // where the value is the count of side exits for that instruction.
+        // For each entry in exit_op_count, add a stats entry with key "exit_INSTRUCTION_NAME"
+        // and the value is the count of side exits for that instruction.
 
         char key_string[rb_vm_max_insn_name_size + 6]; // Leave room for "exit_" and a final NUL
         for (int i = 0; i < VM_INSTRUCTION_SIZE; i++) {
@@ -774,13 +774,13 @@ get_yjit_stats(rb_execution_context_t *ec, VALUE self) https://github.com/ruby/ruby/blob/trunk/yjit_iface.c#L774
             VALUE value = LL2NUM((long long)exit_op_count[i]);
             rb_hash_aset(hash, key, value);
         }
+
     }
+#endif
 
     RB_VM_LOCK_LEAVE();
+
     return hash;
-#else
-    return Qnil;
-#endif // if RUBY_DEBUG
 }
 
 // Primitive called in yjit.rb. Zero out all the counters.
-- 
cgit v1.2.1


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

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