ruby/test/lib/jit_support.rb
2025-02-13 18:01:03 +09:00

20 lines
472 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
end