Skip to content

Commit

Permalink
YJIT: Fix assert_no_exits (#8579)
Browse files Browse the repository at this point in the history
  • Loading branch information
k0kubun committed Oct 2, 2023
1 parent e6d7300 commit 492e943
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/ruby/test_yjit.rb
Expand Up @@ -1153,7 +1153,7 @@ def foo
end

def test_invalidate_cyclic_branch
assert_compiles(<<~'RUBY', result: 2)
assert_compiles(<<~'RUBY', result: 2, exits: { opt_plus: 1 })
def foo
i = 0
while i < 2
Expand All @@ -1171,7 +1171,7 @@ def +(x) = self - -x
end

def test_tracing_str_uplus
assert_compiles(<<~RUBY, frozen_string_literal: true, result: :ok)
assert_compiles(<<~RUBY, frozen_string_literal: true, result: :ok, exits: { putspecialobject: 1, definemethod: 1 })
def str_uplus
_ = 1
_ = 2
Expand Down Expand Up @@ -1216,7 +1216,7 @@ def test(str)

def test_return_to_invalidated_block
# [Bug #19463]
assert_compiles(<<~RUBY, result: [1, 1, :ugokanai])
assert_compiles(<<~RUBY, result: [1, 1, :ugokanai], exits: { definesmethod: 1, getlocal_WC_0: 1 })
klass = Class.new do
def self.lookup(hash, key) = hash[key]
Expand Down Expand Up @@ -1257,7 +1257,7 @@ def freeze = :ugokanai

def test_setivar_on_class
# Bug in https://github.com/ruby/ruby/pull/8152
assert_compiles(<<~RUBY, result: :ok)
assert_compiles(<<~RUBY, result: :ok, exits: { opt_getconstant_path: 2 })
class Base
def self.or_equal
@or_equal ||= Object.new
Expand All @@ -1280,7 +1280,7 @@ class Child < Base

def test_nested_send
#[Bug #19464]
assert_compiles(<<~RUBY, result: [:ok, :ok])
assert_compiles(<<~RUBY, result: [:ok, :ok], exits: { opt_getconstant_path: 1, defineclass: 1 })
klass = Class.new do
class << self
alias_method :my_send, :send
Expand Down Expand Up @@ -1318,7 +1318,7 @@ def foo(a, b, h)
end

def test_io_reopen_clobbering_singleton_class
assert_compiles(<<~RUBY, result: [:ok, :ok])
assert_compiles(<<~RUBY, result: [:ok, :ok], exits: { definesmethod: 1, opt_eq: 2 })
def $stderr.to_i = :i
def test = $stderr.to_i
Expand Down Expand Up @@ -1434,7 +1434,7 @@ def collect_insns(iseq)
# barriers, cache misses.)
if exits != :any &&
exits != recorded_exits &&
!exits.all? { |k, v| v === recorded_exits[k] } # triple-equal checks range membership or integer equality
(exits.keys != recorded_exits.keys || !exits.all? { |k, v| v === recorded_exits[k] }) # triple-equal checks range membership or integer equality
flunk "Expected #{exits.empty? ? "no" : exits.inspect} exits" \
", but got\n#{recorded_exits.inspect}"
end
Expand Down

0 comments on commit 492e943

Please sign in to comment.