diff options
author | Randy Stauner <[email protected]> | 2024-11-26 12:31:08 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-11-26 14:31:08 -0500 |
commit | 1dd40ec18a55ff46f52d0ba44ff5d7923f57c08f (patch) | |
tree | eac4304c90dfa9df36a657af57eccd6bf3e8543c /yjit/src/cruby.rs | |
parent | c1dcd1d4965100292e8f649042c74e10d58e6c0f (diff) |
Optimize instructions when creating an array just to call `include?` (#12123)
* Add opt_duparray_send insn to skip the allocation on `#include?`
If the method isn't going to modify the array we don't need to copy it.
This avoids the allocation / array copy for things like `[:a, :b].include?(x)`.
This adds a BOP for include? and tracks redefinition for it on Array.
Co-authored-by: Andrew Novoselac <[email protected]>
* YJIT: Implement opt_duparray_send include_p
Co-authored-by: Andrew Novoselac <[email protected]>
* Update opt_newarray_send to support simple forms of include?(arg)
Similar to opt_duparray_send but for non-static arrays.
* YJIT: Implement opt_newarray_send include_p
---------
Co-authored-by: Andrew Novoselac <[email protected]>
Notes
Notes:
Merged-By: maximecb <[email protected]>
Diffstat (limited to 'yjit/src/cruby.rs')
-rw-r--r-- | yjit/src/cruby.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/yjit/src/cruby.rs b/yjit/src/cruby.rs index 25fabec1d0..dc4843255e 100644 --- a/yjit/src/cruby.rs +++ b/yjit/src/cruby.rs @@ -824,6 +824,7 @@ pub(crate) mod ids { name: respond_to_missing content: b"respond_to_missing?" name: to_ary content: b"to_ary" name: eq content: b"==" + name: include_p content: b"include?" } } |