diff options
author | Jean Boussier <[email protected]> | 2024-06-05 11:52:16 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-06-05 20:53:49 +0200 |
commit | 33f92b3c88e8f03ec2aaf9db762e1eea845bee10 (patch) | |
tree | cc4410fabdc50d75d3ff6ed687a95156c6111a37 /yjit/src | |
parent | fa038f838f5c3b5a8d19b867a4ea66769f61f17a (diff) |
Don't add `+YJIT` to `RUBY_DESCRIPTION` until it's actually enabled
If you start Ruby with `--yjit-disable`, the `+YJIT` shouldn't be
added until `RubyVM::YJIT.enable` is actually called. Otherwise
it's confusing in crash reports etc.
Diffstat (limited to 'yjit/src')
-rw-r--r-- | yjit/src/yjit.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/yjit/src/yjit.rs b/yjit/src/yjit.rs index cc2c8fe066..b2429df61e 100644 --- a/yjit/src/yjit.rs +++ b/yjit/src/yjit.rs @@ -22,6 +22,11 @@ pub extern "C" fn rb_yjit_parse_option(str_ptr: *const raw::c_char) -> bool { return parse_option(str_ptr).is_some(); } +#[no_mangle] +pub extern "C" fn rb_yjit_option_disable() -> bool { + return get_option!(disable); +} + /// Like rb_yjit_enabled_p, but for Rust code. pub fn yjit_enabled_p() -> bool { unsafe { rb_yjit_enabled_p } @@ -34,7 +39,7 @@ pub extern "C" fn rb_yjit_init(yjit_enabled: bool) { yjit_reg_method_codegen_fns(); // If --yjit-disable, yjit_init() will not be called until RubyVM::YJIT.enable. - if yjit_enabled && !get_option!(disable) { + if yjit_enabled { yjit_init(); } } |