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

Add runtime.TupleMirror to avoid anonymous classes for mirrors of tuples #15404

Merged
merged 4 commits into from Jun 9, 2022

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented Jun 8, 2022

adds the runtime.TupleMirror class as a way to decrease bytecode generation for mirrors of Tuples. Also adapts mirror synthesis to use TupleMirror for mirrors of tuples.

Follow up work is to enable Synthesizer to accept tuples of arity > 22

fixes #15399

bishabosha and others added 2 commits June 8, 2022 19:44
Co-authored-by: Jamie Thompson <bishbashboshjt@gmail.com>
Co-authored-by: Nicolas Stucki <nicolas.stucki@gmail.com>
@bishabosha bishabosha added the needs-minor-release This PR cannot be merged until the next minor release label Jun 8, 2022
@nicolasstucki nicolasstucki self-requested a review June 8, 2022 18:29
Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise looks good.

Nice simplifications in the Synthesizer logic.

library/src/scala/runtime/TupleMirror.scala Outdated Show resolved Hide resolved
library/src/scala/runtime/TupleMirror.scala Show resolved Hide resolved
Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM

compiler/src/dotty/tools/dotc/typer/Synthesizer.scala Outdated Show resolved Hide resolved
@bishabosha bishabosha added this to the 3.2.0-RC1 milestone Jun 9, 2022
@bishabosha bishabosha enabled auto-merge June 9, 2022 14:08
@bishabosha bishabosha added the release-notes Should be mentioned in the release notes label Jun 9, 2022
@bishabosha bishabosha merged commit 47fa175 into scala:main Jun 9, 2022
@bishabosha bishabosha deleted the add-runtime-tuplemirror branch June 9, 2022 14:49
@michelou
Copy link
Collaborator

michelou commented Jun 9, 2022

@bishabosha 👍

@joroKr21
Copy link
Member

What do you think about adding a runtime constructor for anonymous mirrors that takes a function? Then we could reduce the amount of generated code to a single lambda which doesn't need an anonymous class.

@Kordyjan Kordyjan modified the milestones: 3.2.0-RC1, 3.2.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typeclass-derivation needs-minor-release This PR cannot be merged until the next minor release release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing arity check in fromProduct for Tuples
5 participants