diff options
author | Daniel Colson <[email protected]> | 2025-06-18 18:58:34 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2025-06-18 15:58:34 -0700 |
commit | 3290d3d7f004fdf19311c3f4e40b01e45f14c23c (patch) | |
tree | 13413ac6c8983b65d80bf0fb9ee967cbef24e38e /test/ruby/test_zjit.rb | |
parent | 521b2fcba4e96898bfd237c79f17f19530b7a030 (diff) |
ZJIT: Support invokebuiltin opcodes (#13632)
* `invokebuiltin`
* `invokebuiltin_delegate`
* `invokebuiltin_delegate_leave`
These instructions all call out to a C function, passing EC, self, and
some number of arguments. `invokebuiltin` gets the arguments from the
stack, whereas the `_delegate` instructions use a subset of the locals.
`opt_invokebuiltin_delegate_leave` has a fast path for `leave`, but I'm
not sure we need to do anything special for that here (FWIW YJIT appears
to treat the two delegate instructions the same).
Notes
Notes:
Merged-By: k0kubun <[email protected]>
Diffstat (limited to 'test/ruby/test_zjit.rb')
-rw-r--r-- | test/ruby/test_zjit.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_zjit.rb b/test/ruby/test_zjit.rb index 2b171b02b1..e10e9a8742 100644 --- a/test/ruby/test_zjit.rb +++ b/test/ruby/test_zjit.rb @@ -76,6 +76,21 @@ class TestZJIT < Test::Unit::TestCase } end + def test_invokebuiltin + assert_compiles '["."]', %q{ + def test = Dir.glob(".") + test + } + end + + def test_invokebuiltin_delegate + assert_compiles '[[], true]', %q{ + def test = [].clone(freeze: true) + r = test + [r, r.frozen?] + } + end + def test_opt_plus_const assert_compiles '3', %q{ def test = 1 + 2 |