diff options
| author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-05-23 11:23:26 -0700 |
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2024-05-23 12:11:50 -0700 |
| commit | 49fcd33e136ee2fe8720183b63a41bb6ef8d615c (patch) | |
| tree | e089550455a8116beb379eb1e8b6f4e87652879b /tool | |
| parent | e5e079e70f8b07697f7cc3f64736f993755500cb (diff) | |
Introduce a specialize instruction for Array#pack
Instructions for this code:
```ruby
# frozen_string_literal: true
[a].pack("C")
```
Before this commit:
```
== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(3,13)>
0000 putself ( 3)[Li]
0001 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 newarray 1
0005 putobject "C"
0007 opt_send_without_block <calldata!mid:pack, argc:1, ARGS_SIMPLE>
0009 leave
```
After this commit:
```
== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(3,13)>
0000 putself ( 3)[Li]
0001 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 putobject "C"
0005 opt_newarray_send 2, :pack
0008 leave
```
Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Diffstat (limited to 'tool')
| -rwxr-xr-x | tool/rjit/bindgen.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tool/rjit/bindgen.rb b/tool/rjit/bindgen.rb index fb6653ed9c..2fc4576216 100755 --- a/tool/rjit/bindgen.rb +++ b/tool/rjit/bindgen.rb @@ -540,6 +540,7 @@ generator = BindingGenerator.new( rb_vm_opt_newarray_min rb_vm_opt_newarray_max rb_vm_opt_newarray_hash + rb_vm_opt_newarray_pack rb_vm_setinstancevariable rb_vm_splat_array rjit_full_cfunc_return |
