Skip to content

Commit 8a88172

Browse files
authored
YJIT: Skip printing stats at exit if --yjit-disable (#8727)
1 parent 01787d5 commit 8a88172

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

test/ruby/test_yjit.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,10 @@ def test_opt_mult_overflow
13881388
assert_no_exits('0xfff_ffff_ffff_ffff * 0x10')
13891389
end
13901390

1391+
def test_disable_stats
1392+
assert_in_out_err(%w[--yjit-stats --yjit-disable])
1393+
end
1394+
13911395
private
13921396

13931397
def code_gc_helpers

yjit/src/stats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ pub extern "C" fn rb_yjit_stats_enabled_p(_ec: EcPtr, _ruby_self: VALUE) -> VALU
515515
/// Check if stats generation should print at exit
516516
#[no_mangle]
517517
pub extern "C" fn rb_yjit_print_stats_p(_ec: EcPtr, _ruby_self: VALUE) -> VALUE {
518-
if get_option!(print_stats) {
518+
if yjit_enabled_p() && get_option!(print_stats) {
519519
return Qtrue;
520520
} else {
521521
return Qfalse;

0 commit comments

Comments
 (0)