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 (patch) | |
tree | 68732e79fac871a629fc815b525f0cc20ed1c8bc /vm.c | |
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
Notes:
Merged: https://github.com/ruby/ruby/pull/11406
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2232,7 +2232,7 @@ vm_init_redefined_flag(void) OP(EmptyP, EMPTY_P), (C(Array), C(String), C(Hash)); OP(Succ, SUCC), (C(Integer), C(String)); OP(EqTilde, MATCH), (C(Regexp), C(String)); - OP(Freeze, FREEZE), (C(String), C(Array)); + OP(Freeze, FREEZE), (C(String), C(Array), C(Hash)); OP(UMinus, UMINUS), (C(String)); OP(Max, MAX), (C(Array)); OP(Min, MIN), (C(Array)); |