Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RubyVM::YJIT.enabled? doesn't respect RUBYOPT="--yjit-pause" #545

Closed
intrip opened this issue Nov 6, 2023 · 3 comments
Closed

RubyVM::YJIT.enabled? doesn't respect RUBYOPT="--yjit-pause" #545

intrip opened this issue Nov 6, 2023 · 3 comments

Comments

@intrip
Copy link

intrip commented Nov 6, 2023

I noticed that if you boot Ruby with RUBYOPT="--yjit-pause" the output of "RubyVM::YJIT.enabled?" is always "true" even if you haven't called yet "RubyVM::YJIT.resume".

Example:

jacopo-37s-mb 3.3.0-preview2 ~ cat yjit.rb
#!/usr/bin/env ruby

puts "RUBY_DESCRIPTION: #{RUBY_DESCRIPTION}"
puts "RUBYOPT: #{ENV['RUBYOPT']}"
puts "YJIT enabled before resuming: #{RubyVM::YJIT.enabled?}"
puts "Resuming"
RubyVM::YJIT.resume
puts "YJIT enabled after resuming #{RubyVM::YJIT.enabled?}"
jacopo-37s-mb 3.3.0-preview2 ~ for rubyopt in "--yjit" "--yjit-pause" ""; do RUBYOPT=$rubyopt ruby yjit.rb; done
RUBY_DESCRIPTION: ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) +YJIT [arm64-darwin22]
RUBYOPT: --yjit
YJIT enabled before resuming: true
Resuming
YJIT enabled after resuming true
RUBY_DESCRIPTION: ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) +YJIT [arm64-darwin22]
RUBYOPT: --yjit-pause
YJIT enabled before resuming: true
Resuming
YJIT enabled after resuming true
RUBY_DESCRIPTION: ruby 3.3.0preview2 (2023-09-14 master e50fcca9a7) [arm64-darwin22]
RUBYOPT:
YJIT enabled before resuming: false
Resuming
YJIT enabled after resuming false
jacopo-37s-mb 3.3.0-preview2 ~
@maximecb
Copy link

maximecb commented Nov 6, 2023

We are in the process of removing --yjit-pause.

Future versions of Ruby will always have YJIT in paused mode when you don't specify --yjit, and you will be able to call RubyVM::YJIT::enable to start it.

@intrip
Copy link
Author

intrip commented Nov 6, 2023

Thanks @maximecb! We can close this one then.
I suppose RubyVM::YJIT.enabled? will return false until you call RubyVM::YJIT::enable correct?

@intrip intrip closed this as completed Nov 6, 2023
@maximecb
Copy link

maximecb commented Nov 6, 2023

Thanks @maximecb! We can close this one then. I suppose RubyVM::YJIT.enabled? will return false until you call RubyVM::YJIT::enable correct?

Yes that should be the case. You'll be able to test this in Ruby 3.3.0 preview3 or on Ruby head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants