Constructor inlining #17722
scf37
started this conversation in
Feature Requests
Replies: 1 comment
-
This is related to the idea of an "inliner-optimizer" (quoted in this thread about for loops) that would perform scalar replacement (replacing the fields by local variables and inlining the constructor). I'm actually playing with the idea by implementing a new compiler phase in dotty. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dotty has method inlining but it is incomplete without constructor inlining.
Motivation
Problem
Compiles to:
which is wasted allocation.
Therefore when inlining method referencing constructor parameters only, there is no need to create object instance.
Possible solutions
Beta Was this translation helpful? Give feedback.
All reactions