mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
YJIT: Delete otherwise-empty defer_compilation() blocks
Calls to defer_compilation() leave behind a stub and a `struct Block` that we retain. If the block is empty, it only exits to hold the `struct Branch` that the stub needs. This patch transplants the branch out of the empty block into the newly generated block when the defer_compilation() stub is hit, and deletes the empty block to save memory. To assist the transplantation, `Block::outgoing` is now a `MutableBranchList`, and `Branch::Block` now in a `Cell`. These types don't incur a size cost. On the `lobsters` benchmark, `yjit_alloc_size` is roughly 98% of what it was before the change. Co-authored-by: Kevin Menard <kevin.menard@shopify.com> Co-authored-by: Randy Stauner <randy@r4s6.net> Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
This commit is contained in:
parent
28d1685ebb
commit
ffd895156f
3 changed files with 102 additions and 28 deletions
1
yjit.rb
1
yjit.rb
|
@ -366,6 +366,7 @@ module RubyVM::YJIT
|
|||
out.puts "compiled_iseq_count: " + format_number(13, stats[:compiled_iseq_count])
|
||||
out.puts "compiled_blockid_count:" + format_number(13, stats[:compiled_blockid_count])
|
||||
out.puts "compiled_block_count: " + format_number(13, stats[:compiled_block_count])
|
||||
out.puts "deleted_defer_block_count:" + format_number_pct(10, stats[:deleted_defer_block_count], stats[:compiled_block_count])
|
||||
if stats[:compiled_blockid_count] != 0
|
||||
out.puts "versions_per_block: " + format_number(13, "%4.3f" % (stats[:compiled_block_count].fdiv(stats[:compiled_blockid_count])))
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue