summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorRandy Stauner <[email protected]>2024-11-26 12:31:08 -0700
committerGitHub <[email protected]>2024-11-26 14:31:08 -0500
commit1dd40ec18a55ff46f52d0ba44ff5d7923f57c08f (patch)
treeeac4304c90dfa9df36a657af57eccd6bf3e8543c /internal
parentc1dcd1d4965100292e8f649042c74e10d58e6c0f (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 'internal')
-rw-r--r--internal/basic_operators.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/basic_operators.h b/internal/basic_operators.h
index 4732a65403..5dc8d7fe8d 100644
--- a/internal/basic_operators.h
+++ b/internal/basic_operators.h
@@ -38,6 +38,7 @@ enum ruby_basic_operators {
BOP_CMP,
BOP_DEFAULT,
BOP_PACK,
+ BOP_INCLUDE_P,
BOP_LAST_
};