aboutsummaryrefslogtreecommitdiffstats
path: root/yjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-12-19 11:47:27 -0800
committerGitHub <noreply@github.com>2023-12-19 11:47:27 -0800
commitbd91c5127ff30f5a21547e73a493c06fbd6da7ae (patch)
tree461f5cd88079ac5c1ad47d050ad2a504acc4ade4 /yjit
parent084b44e79dd456c9ce09ac06c6faf538160ac6b0 (diff)
downloadruby-bd91c5127ff30f5a21547e73a493c06fbd6da7ae.tar.gz
YJIT: Add stats option to RubyVM::YJIT.enable (#9297)
Diffstat (limited to 'yjit')
-rw-r--r--yjit/src/options.rs6
-rw-r--r--yjit/src/yjit.rs10
2 files changed, 8 insertions, 8 deletions
diff --git a/yjit/src/options.rs b/yjit/src/options.rs
index 522acc24c4..72db513030 100644
--- a/yjit/src/options.rs
+++ b/yjit/src/options.rs
@@ -249,9 +249,9 @@ pub fn parse_option(str_ptr: *const std::os::raw::c_char) -> Option<()> {
("no-type-prop", "") => unsafe { OPTIONS.no_type_prop = true },
("stats", _) => match opt_val {
"" => unsafe { OPTIONS.gen_stats = true },
- "quiet" => {
- unsafe { OPTIONS.gen_stats = true }
- unsafe { OPTIONS.print_stats = false }
+ "quiet" => unsafe {
+ OPTIONS.gen_stats = true;
+ OPTIONS.print_stats = false;
},
_ => {
return None;
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs
index d2ec5f0568..cd51ed048b 100644
--- a/yjit/src/yjit.rs
+++ b/yjit/src/yjit.rs
@@ -168,13 +168,13 @@ pub extern "C" fn rb_yjit_code_gc(_ec: EcPtr, _ruby_self: VALUE) -> VALUE {
/// Enable YJIT compilation, returning true if YJIT was previously disabled
#[no_mangle]
-pub extern "C" fn rb_yjit_enable(_ec: EcPtr, _ruby_self: VALUE) -> VALUE {
+pub extern "C" fn rb_yjit_enable(_ec: EcPtr, _ruby_self: VALUE, gen_stats: VALUE, print_stats: VALUE) -> VALUE {
with_vm_lock(src_loc!(), || {
- if yjit_enabled_p() {
- return Qfalse;
+ // Initialize and enable YJIT
+ unsafe {
+ OPTIONS.gen_stats = gen_stats.test();
+ OPTIONS.print_stats = print_stats.test();
}
-
- // Initialize and enable YJIT if currently disabled
yjit_init();
// Add "+YJIT" to RUBY_DESCRIPTION