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
implement =dup
hook eliminating wasMoved
and =copy
pairs
#21586
Conversation
ringabout
commented
Mar 30, 2023
•
edited
edited
This comment was marked as off-topic.
This comment was marked as off-topic.
@@ -851,6 +869,8 @@ proc ownedClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = | |||
of attachedDeepCopy: assert(false, "cannot happen") | |||
of attachedTrace: discard | |||
of attachedWasMoved: body.add genBuiltin(c, mWasMoved, "wasMoved", x) | |||
of attachedDup: | |||
assert false, "cannot happen" |
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.
In follow-up PRs we should lift =dup
like other hooks.
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.
@Araq Hi, may I ask what's the benefit of lifting an operation? Like it can be used by other hooks or something?
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.
The =dup
hook is more efficient than the wasMoved(tmp); =sink(tmp, y)
combination in principle. If you lift it so that more types are affected it remains to be more efficient.
Thanks for your hard work on this PR! Hint: mm: orc; opt: speed; options: -d:release |
…ang#21586) * import `=dup` hook eliminating `wasMoved` and `=copy` pairs * add dup * add a test for dup * fixes documentation * fixes signature * resolve comments * fixes tests * fixes tests * clean up
…ang#21586) * import `=dup` hook eliminating `wasMoved` and `=copy` pairs * add dup * add a test for dup * fixes documentation * fixes signature * resolve comments * fixes tests * fixes tests * clean up
…ang#21586) * import `=dup` hook eliminating `wasMoved` and `=copy` pairs * add dup * add a test for dup * fixes documentation * fixes signature * resolve comments * fixes tests * fixes tests * clean up