summaryrefslogtreecommitdiff
path: root/test/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-27 12:28:11 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-03-27 12:28:11 +0900
commitcc8a48a496e4466d50f14473216786bba1e9fc93 (patch)
treefaf6728bddc2b119096c58ccb24e7280131503bb /test/lib
parent67feb782f947046f65951303893713052a19a546 (diff)
downloadruby-cc8a48a496e4466d50f14473216786bba1e9fc93.tar.gz
Revert an accidentally sync.
Revert "[ruby/open3] Removed to load jit_support.rb" This reverts commit 67feb782f947046f65951303893713052a19a546.
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/jit_support.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/lib/jit_support.rb b/test/lib/jit_support.rb
new file mode 100644
index 0000000000..3f21367987
--- /dev/null
+++ b/test/lib/jit_support.rb
@@ -0,0 +1,25 @@
+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_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
+end