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

ruby-changes:72438

From: Maxime <ko1@a...>
Date: Thu, 7 Jul 2022 00:13:44 +0900 (JST)
Subject: [ruby-changes:72438] 3c61e1e77f (master): YJIT: add a counter for gc object refs in the machine code (#6089)

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

From 3c61e1e77f9e501dd5ef19d6c661ceba6b84cac8 Mon Sep 17 00:00:00 2001
From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...>
Date: Wed, 6 Jul 2022 11:13:22 -0400
Subject: YJIT: add a counter for gc object refs in the machine code (#6089)

Add a counter for gc object refs in the machine code

This is to gather data for the eventual implementation of
a constant pool.
---
 yjit.rb             |  1 +
 yjit/src/codegen.rs |  2 ++
 yjit/src/stats.rs   | 18 ++++++++++--------
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/yjit.rb b/yjit.rb
index b3c1efdbd4..15c84d0c61 100644
--- a/yjit.rb
+++ b/yjit.rb
@@ -211,6 +211,7 @@ module RubyVM::YJIT https://github.com/ruby/ruby/blob/trunk/yjit.rb#L211
       $stderr.puts "constant_state_bumps:  " + ("%10d" % stats[:constant_state_bumps])
       $stderr.puts "inline_code_size:      " + ("%10d" % stats[:inline_code_size])
       $stderr.puts "outlined_code_size:    " + ("%10d" % stats[:outlined_code_size])
+      $stderr.puts "num_gc_obj_refs:       " + ("%10d" % stats[:num_gc_obj_refs])
 
       $stderr.puts "total_exit_count:      " + ("%10d" % total_exits)
       $stderr.puts "total_insns_count:     " + ("%10d" % total_insns_count)
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index cdd01221d4..12c97411b0 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -121,6 +121,8 @@ impl JITState { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L121
     pub fn add_gc_object_offset(self: &mut JITState, ptr_offset: u32) {
         let mut gc_obj_vec: RefMut<_> = self.block.borrow_mut();
         gc_obj_vec.add_gc_object_offset(ptr_offset);
+
+        incr_counter!(num_gc_obj_refs);
     }
 
     pub fn get_pc(self: &JITState) -> *mut VALUE {
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index 6bad8db7e7..4118f894b4 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -218,6 +218,14 @@ make_counters! { https://github.com/ruby/ruby/blob/trunk/yjit/src/stats.rs#L218
 
     opt_getinlinecache_miss,
 
+    expandarray_splat,
+    expandarray_postarg,
+    expandarray_not_array,
+    expandarray_rhs_too_small,
+
+    gbpp_block_param_modified,
+    gbpp_block_handler_not_iseq,
+
     binding_allocations,
     binding_set,
 
@@ -237,17 +245,11 @@ make_counters! { https://github.com/ruby/ruby/blob/trunk/yjit/src/stats.rs#L245
 
     constant_state_bumps,
 
-    expandarray_splat,
-    expandarray_postarg,
-    expandarray_not_array,
-    expandarray_rhs_too_small,
-
-    gbpp_block_param_modified,
-    gbpp_block_handler_not_iseq,
-
     // Currently, it's out of the ordinary (might be impossible) for YJIT to leave gaps in
     // executable memory, so this should be 0.
     exec_mem_non_bump_alloc,
+
+    num_gc_obj_refs,
 }
 
 //===========================================================================
-- 
cgit v1.2.1


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

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