ruby/test/lib/jit_support.rb
Takashi Kokubun 33a052486b Assert everything is compiled in test_zjit (https://github.com/Shopify/zjit/pull/40)
* Assert everything is compiled in test_zjit

* Update a comment on rb_zjit_assert_compiles

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>

* Add a comment about assert_compiles

* Actually use pipe_fd

---------

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
2025-04-18 21:52:59 +09:00

26 lines
654 B
Ruby

require 'rbconfig'
module JITSupport
module_function
def yjit_supported?
return @yjit_supported if defined?(@yjit_supported)
# nil in mswin
@yjit_supported = ![nil, 'no'].include?(RbConfig::CONFIG['YJIT_SUPPORT'])
end
def yjit_enabled?
defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?
end
def yjit_force_enabled?
"#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?YJIT_FORCE_ENABLE\b/)
end
def zjit_supported?
return @zjit_supported if defined?(@zjit_supported)
# nil in mswin
@zjit_supported = ![nil, 'no'].include?(RbConfig::CONFIG['ZJIT_SUPPORT'])
end
end