Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YJIT: Skip defer_compilation for fixnums if possible #7168

Merged
merged 3 commits into from
Jan 30, 2023

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Jan 21, 2023

This partly addresses Shopify#462.

When "compile-time stack-top values are fixnums?" can be answered from the type info in ctx, this PR skips defer_compilation.

As investigated in Shopify#462 (comment), it's not supposed to have a huge impact on the number of blocks. However, as I started experimenting with register allocation, targeting only intra-block allocation as a first step, I noticed even very simple blocks are split now. Supporting this is useful for that first milestone and I figured the implementation is not that complicated.

Impact

It does have a small impact though. It eliminates some unneeded blocks on railsbench, reducing Rust memory consumption from 9.01MB to 9.00MB.

Before

compiled_block_count:       20739
defer_count:                 6871
code_region_size:         6733824
yjit_alloc_size:          9010417

After

compiled_block_count:       20699
defer_count:                 6836
code_region_size:         6733824
yjit_alloc_size:          9500787

@matzbot matzbot requested a review from a team January 21, 2023 00:49
yjit/src/codegen.rs Outdated Show resolved Hide resolved
@noahgibbs
Copy link
Contributor

This looks like a good idea to me, and unlikely to cause problems.

yjit/src/codegen.rs Outdated Show resolved Hide resolved
@k0kubun k0kubun requested a review from a team January 30, 2023 17:01
@maximecb maximecb merged commit bc0dc9d into ruby:master Jan 30, 2023
@maximecb maximecb deleted the yjit-skip-defer branch January 30, 2023 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants