Jean Boussier e85ef212de [ruby/set] Avoid the block or return pattern to save Proc allocations
Using the block param in a boolean context like this cause it to be
allocated.

Using it with an `if` or `unless` was optimized in 3.2
(https://github.com/ruby/ruby/pull/6286) but using it with `or`
or `and` wasn't.

```ruby
def foo(&block)
  block or return 1
end

puts RubyVM::InstructionSequence.of(method(:foo)).disasm
== disasm: #<ISeq:foo@(irb):11 (11,0)-(13,3)> (catch: false)
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: 0, kw: -1@-1, kwrest: -1])
[ 1] block@0<Block>
0000 getblockparam                          block@0, 0                (  12)[LiCa]
0003 dup
0004 branchif                               10
0006 pop
0007 putobject_INT2FIX_1_
0008 leave                                  [Re]
0009 putnil
0010 leave
```

versus

```
def foo(&block)
  return 1 if block
end

puts RubyVM::InstructionSequence.of(method(:foo)).disasm
== disasm: #<ISeq:foo@(irb):15 (15,0)-(17,3)> (catch: false)
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: 0, kw: -1@-1, kwrest: -1])
[ 1] block@0<Block>
0000 getblockparamproxy                     block@0, 0                (  16)[LiCa]
0003 branchunless                           7
0005 putobject_INT2FIX_1_
0006 leave                                                            (  17)[Re]
0007 putnil                                                           (  16)
0008 leave
```

https://github.com/ruby/set/commit/e89da977d4
2023-01-11 09:26:08 +00:00
..
2023-01-10 15:53:07 +09:00
2022-12-26 15:09:21 +09:00
2022-12-05 05:59:33 +00:00
2022-11-29 04:58:29 +00:00
2023-01-04 09:35:57 +00:00
2022-12-14 05:49:14 +00:00
2022-12-23 09:51:52 +09:00
2022-12-09 16:36:22 +09:00
2023-01-10 15:53:07 +09:00
2022-11-28 04:40:26 +00:00
2022-12-09 16:36:22 +09:00
2022-12-05 06:32:03 +00:00
2022-12-05 07:35:19 +00:00
2022-12-05 07:38:23 +00:00
2023-01-10 15:53:07 +09:00
2022-12-14 16:07:44 +09:00
2022-12-05 08:18:33 +00:00