aboutsummaryrefslogtreecommitdiffstats
path: root/yjit/src/stats.rs
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-02-28 10:03:24 -0800
committerGitHub <noreply@github.com>2023-02-28 10:03:24 -0800
commit67ad831b5f6fd7a637adf3a385af3df8d8ad519b (patch)
tree0af9a29b907d91471b4ee301bb38a4b3f4fa9ae9 /yjit/src/stats.rs
parent3766cbce135e14ad9b7ce072e41279c7f1ae4d0f (diff)
downloadruby-67ad831b5f6fd7a637adf3a385af3df8d8ad519b.tar.gz
YJIT: Use a boxed slice for gc_obj_offsets (#7397)
* YJIT: Use a boxed slice for gc_obj_offsets * YJIT: Stop using Option * YJIT: s/add_counter/incr_counter_by/ Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Diffstat (limited to 'yjit/src/stats.rs')
-rw-r--r--yjit/src/stats.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index 05e970702c..5d32f613c8 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -141,6 +141,19 @@ macro_rules! make_counters {
}
}
+/// Macro to increase a counter by name and count
+macro_rules! incr_counter_by {
+ // Unsafe is ok here because options are initialized
+ // once before any Ruby code executes
+ ($counter_name:ident, $count:expr) => {
+ #[allow(unused_unsafe)]
+ {
+ unsafe { $crate::stats::COUNTERS.$counter_name += $count as u64 }
+ }
+ };
+}
+pub(crate) use incr_counter_by;
+
/// Macro to increment a counter by name
macro_rules! incr_counter {
// Unsafe is ok here because options are initialized