-
Notifications
You must be signed in to change notification settings - Fork 15
Open
ruby/ruby
#15051Description
At the moment, invokeblock always resorts to dynamic dispatch, but JIT code can do better.
There are four vm_block_handler_types:
- block_handler_type_iseq
- block_handler_type_ifunc
- block_handler_type_proc
- block_handler_type_symbol
TODO
- We should profile block_handler on invokeblock and generate specialized code based on compile-time block_handler. It's also nice to have runtime stats to prioritize the most frequent block_handler. YJIT doesn't specialize
block_handler_type_procorblock_handler_type_symbol, so majority of them would beblock_handler_type_iseqorblock_handler_type_ifuncin our benchmarks and production. - If compile-time block_handler is
block_handler_type_iseq, you can guard on the expected ISEQ in the block_handler and statically dispatch the callee ISEQ using a JIT-to-JIT call. - If compile-time block_handler is
block_handler_type_ifunc, you can just guard the block_handler type is ifunc (blocks in C), and letrb_vm_yield_with_cfunccall the ifunc.
Metadata
Metadata
Assignees
Labels
No labels