summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2025-04-29 11:03:13 -0700
committerGitHub <[email protected]>2025-04-29 11:03:13 -0700
commit0f3d6ee57825f6ecbcbab797ef8e9ca9f84bc095 (patch)
tree0d6e112eb555e161e9feecf7c00dfa13622cf67b /test/ruby
parent0c44e5ab5efc3a54a0d18bf9c2a206c714e1d1c7 (diff)
ZJIT: Disable ZJIT instructions when USE_ZJIT is 0 (#13199)
* ZJIT: Disable ZJIT instructions when USE_ZJIT is 0 * Test the order of ZJIT instructions * Add more jobs that disable JITs * Show instruction names in the message
Notes
Notes: Merged-By: k0kubun <[email protected]>
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_zjit.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb
index ff43827c5a..5336c6cc47 100644
--- a/test/ruby/test_zjit.rb
+++ b/test/ruby/test_zjit.rb
@@ -479,6 +479,19 @@ class TestZJIT < Test::Unit::TestCase
}, call_threshold: 5, num_profiles: 3
end
+ # tool/ruby_vm/views/*.erb relies on the zjit instructions a) being contiguous and
+ # b) being reliably ordered after all the other instructions.
+ def test_instruction_order
+ insn_names = RubyVM::INSTRUCTION_NAMES
+ zjit, others = insn_names.map.with_index.partition { |name, _| name.start_with?('zjit_') }
+ zjit_indexes = zjit.map(&:last)
+ other_indexes = others.map(&:last)
+ zjit_indexes.product(other_indexes).each do |zjit_index, other_index|
+ assert zjit_index > other_index, "'#{insn_names[zjit_index]}' at #{zjit_index} "\
+ "must be defined after '#{insn_names[other_index]}' at #{other_index}"
+ end
+ end
+
private
# Assert that every method call in `test_script` can be compiled by ZJIT