2023-03-27 12:28:11 +09:00
|
|
|
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
|
|
|
|
|
2023-11-03 22:18:15 -07:00
|
|
|
def yjit_enabled?
|
|
|
|
defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled?
|
|
|
|
end
|
|
|
|
|
2023-03-27 12:28:11 +09:00
|
|
|
def yjit_force_enabled?
|
|
|
|
"#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?YJIT_FORCE_ENABLE\b/)
|
|
|
|
end
|
2025-03-07 12:55:47 -08:00
|
|
|
|
|
|
|
def zjit_supported?
|
|
|
|
return @zjit_supported if defined?(@zjit_supported)
|
|
|
|
# nil in mswin
|
|
|
|
@zjit_supported = ![nil, 'no'].include?(RbConfig::CONFIG['ZJIT_SUPPORT'])
|
|
|
|
end
|
2023-03-27 12:28:11 +09:00
|
|
|
end
|