diff options
author | Étienne Barrié <[email protected]> | 2024-08-05 12:31:24 +0200 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-09-05 12:46:02 +0200 |
commit | bf9879791af11a20e50921551220c08d1c7f7f02 () | |
tree | 68732e79fac871a629fc815b525f0cc20ed1c8bc /internal/hash.h | |
parent | a99707cd9c6a1d53cf8ebc883dc210219bd67a28 (diff) |
Optimized instruction for Hash#freeze
If a Hash which is empty or only using literals is frozen, we detect this as a peephole optimization and change the instructions to be `opt_hash_freeze`. [Feature #20684] Co-authored-by: Jean Boussier <[email protected]>
Notes: Merged: https://.com/ruby/ruby/pull/11406
-rw-r--r-- | internal/hash.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -88,6 +88,7 @@ int rb_hash_stlike_foreach_with_replace(VALUE hash, st_foreach_check_callback_fu int rb_hash_stlike_update(VALUE hash, st_data_t key, st_update_callback_func *func, st_data_t arg); VALUE rb_ident_hash_new_with_size(st_index_t size); void rb_hash_free(VALUE hash); static inline unsigned RHASH_AR_TABLE_SIZE_RAW(VALUE h); static inline VALUE RHASH_IFNONE(VALUE h); |