aboutsummaryrefslogtreecommitdiffstats
path: root/yjit
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2023-11-28 17:27:11 -0500
committerGitHub <noreply@github.com>2023-11-28 22:27:11 +0000
commitea3e17e430b74b4e58535a707319025e008cc123 (patch)
treeaff895ceb0803be8eadb6ebb7ae8bc1d6755670c /yjit
parenta9c07cbd2128ae8fcb11862265d5fa24feaf3d4f (diff)
downloadruby-ea3e17e430b74b4e58535a707319025e008cc123.tar.gz
YJIT: fix bug in top cfunc logging in `--yjit-stats` (#9056)
YJIT: correctly handle case where there are no cfunc calls Fix bug in top cfunc logging in `--yjit-stats`
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/stats.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/yjit/src/stats.rs b/yjit/src/stats.rs
index 7a52fc0e23..74443edea4 100644
--- a/yjit/src/stats.rs
+++ b/yjit/src/stats.rs
@@ -743,9 +743,10 @@ fn rb_yjit_gen_stats_dict(context: bool) -> VALUE {
}
// Create a hash for the cfunc call counts
+ let calls_hash = rb_hash_new();
+ rb_hash_aset(hash, rust_str_to_sym("cfunc_calls"), calls_hash);
if let Some(cfunc_name_to_idx) = CFUNC_NAME_TO_IDX.as_mut() {
let call_counts = CFUNC_CALL_COUNT.as_mut().unwrap();
- let calls_hash = rb_hash_new();
for (name, idx) in cfunc_name_to_idx {
let count = call_counts[*idx];
@@ -755,8 +756,6 @@ fn rb_yjit_gen_stats_dict(context: bool) -> VALUE {
let value = VALUE::fixnum_from_usize(count as usize);
rb_hash_aset(calls_hash, key, value);
}
-
- rb_hash_aset(hash, rust_str_to_sym("cfunc_calls"), calls_hash);
}
}