Move yjit_force_enabled? to JITSupport
for consistency
This commit is contained in:
parent
4445b9e2a2
commit
e4caf59cc1
@ -3,18 +3,22 @@ require 'rbconfig'
|
||||
module JITSupport
|
||||
module_function
|
||||
|
||||
def rjit_supported?
|
||||
return @rjit_supported if defined?(@rjit_supported)
|
||||
# nil in mswin
|
||||
@rjit_supported = ![nil, 'no'].include?(RbConfig::CONFIG['RJIT_SUPPORT'])
|
||||
end
|
||||
|
||||
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_force_enabled?
|
||||
"#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?YJIT_FORCE_ENABLE\b/)
|
||||
end
|
||||
|
||||
def rjit_supported?
|
||||
return @rjit_supported if defined?(@rjit_supported)
|
||||
# nil in mswin
|
||||
@rjit_supported = ![nil, 'no'].include?(RbConfig::CONFIG['RJIT_SUPPORT'])
|
||||
end
|
||||
|
||||
def rjit_force_enabled?
|
||||
"#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?RJIT_FORCE_ENABLE\b/)
|
||||
end
|
||||
|
@ -151,7 +151,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
||||
assert_match(VERSION_PATTERN, r[0])
|
||||
if self.class.rjit_enabled? && !JITSupport.rjit_force_enabled?
|
||||
assert_equal(NO_JIT_DESCRIPTION, r[0])
|
||||
elsif self.class.yjit_enabled? && !yjit_force_enabled? # checking -DYJIT_FORCE_ENABLE
|
||||
elsif self.class.yjit_enabled? && !JITSupport.yjit_force_enabled?
|
||||
assert_equal(NO_JIT_DESCRIPTION, r[0])
|
||||
else
|
||||
assert_equal(RUBY_DESCRIPTION, r[0])
|
||||
@ -228,7 +228,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
||||
|
||||
def test_rjit_disabled_version
|
||||
return unless JITSupport.rjit_supported?
|
||||
return if yjit_force_enabled?
|
||||
return if JITSupport.yjit_force_enabled?
|
||||
|
||||
env = { 'RUBY_YJIT_ENABLE' => nil } # unset in children
|
||||
[
|
||||
@ -246,7 +246,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
||||
|
||||
def test_rjit_version
|
||||
return unless JITSupport.rjit_supported?
|
||||
return if yjit_force_enabled?
|
||||
return if JITSupport.yjit_force_enabled?
|
||||
|
||||
env = { 'RUBY_YJIT_ENABLE' => nil } # unset in children
|
||||
[
|
||||
@ -1124,10 +1124,4 @@ class TestRubyOptions < Test::Unit::TestCase
|
||||
omit "#{IO::NULL} is not a character device" unless File.chardev?(IO::NULL)
|
||||
assert_in_out_err([IO::NULL], success: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def yjit_force_enabled?
|
||||
"#{RbConfig::CONFIG['CFLAGS']} #{RbConfig::CONFIG['CPPFLAGS']}".match?(/(\A|\s)-D ?YJIT_FORCE_ENABLE\b/)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user