diff options
| author | Daniel Colson <danieljamescolson@gmail.com> | 2025-06-10 09:47:03 -0400 |
|---|---|---|
| committer | Alan Wu <XrXr@users.noreply.github.com> | 2025-06-17 20:35:47 +0900 |
| commit | 01ff17fa40cdfbd811ec3b0c13034936451e693a (patch) | |
| tree | 042daecf46f307ab5256f7b8c0368e831b8642c2 /test/ruby | |
| parent | 9e5c74f2196f34cee4b241ab9dba2ed9adc89f60 (diff) | |
ZJIT: Parse opt freeze insns to HIR
* `opt_hash_freeze`
* `opt_ary_freeze`
* `opt_str_freeze`
* `opt_str_uminus`
Similar to `opt_neq`, but there are no args for `freeze`
Co-authored-by: ywenc <ywenc@github.com>
Co-authored-by: Max Bernstein <max@bernsteinbear.com>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13588
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_zjit.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index d7249053e5..1a9f326c0a 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -295,6 +295,34 @@ class TestZJIT < Test::Unit::TestCase }, insns: [:opt_ge], call_threshold: 2 end + def test_opt_hash_freeze + assert_compiles '{}', <<~RUBY, insns: [:opt_hash_freeze] + def test = {}.freeze + test + RUBY + end + + def test_opt_ary_freeze + assert_compiles '[]', <<~RUBY, insns: [:opt_ary_freeze] + def test = [].freeze + test + RUBY + end + + def test_opt_str_freeze + assert_compiles '""', <<~RUBY, insns: [:opt_str_freeze] + def test = "".freeze + test + RUBY + end + + def test_opt_str_uminus + assert_compiles '""', <<~RUBY, insns: [:opt_str_uminus] + def test = -"" + test + RUBY + end + def test_new_array_empty assert_compiles '[]', %q{ def test = [] |
