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: Support nil and blockparamproxy as blockarg in send #6492
Conversation
This reduces total exits by 9%, from 2509837 to 2275480 Before:
After:
|
enum SpecVal { | ||
None, | ||
CurrentFrame, | ||
BlockISeq(IseqPtr), | ||
BlockParamProxy, | ||
PrevEP(*const VALUE), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also like a comment explaining what SpecVal is generally used for. In general, it's best not to assume that people are familiar with all the details of the CRuby codebase and send imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good over all with some minor comments and one test failure.
Nice 👌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice!
90717dd
to
d4c1004
Compare
FYI for the Arm CI failure:
|
d4c1004
to
faccc17
Compare
Co-authored-by: John Hawthorn <john@hawthorn.email>
faccc17
to
535d2aa
Compare
ratio_in_yjit: 88.3% (https://github.com/ruby/ruby/actions/runs/3330379311/jobs/5508791316) → 89.7% (https://github.com/ruby/ruby/actions/runs/3331130072/jobs/5510507239) Nice 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! :)
Co-authored-by: John Hawthorn <john@hawthorn.email> Co-authored-by: John Hawthorn <john@hawthorn.email>
Here, @jhawthorn and I have implemented support for the simple but common cases of supplying a block to send via a blockparamproxy (or a nil). Because the blockparamproxy only appears in controlled circumstances, we are able to rely entirely on the type system to recognise this case, without runtime checks.
To support that, we've added a new
Type::BlockParamProxy
. It mostly fits in there with the other singleton types likeType::True
, though it's unique in that it's not accessible from Ruby code (despite being a real VALUE object).We've also moved some logic into
gen_push_frame
, turningCurrentFrame
into a parameterizedBlockISeq(IseqPtr)
. In the process, we've folded inPrevEP
, renaming the enum fromBlockHandler
toSpecVal
. They're mutually exclusive (they both end up storing their value in the same place), so this allows the type system to enforce that.