Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/compile: rewrite f(g()) to use OAS2FUNC earlier #29197
Currently, there's a bunch of complexity from handling f(g()) where g is multi-valued.
It makes variadic functions and implicit conversions to interface type more complicated too. For example, given
it should be possible to stack allocate the
order.go (callArgs/copyRet) already rewrites
A side benefit will be that we can also rewrite calls to variadic functions to always use a slice parameter (i.e., the
I feel like there have been other subtleties around multi-value and variadic functions, so I expect this should help improve compiler robustness.
I uploaded CL 153841 as a proof-of-concept of the idea. It mostly works with two notable caveats:
CL 153841 addresses these concerns now:
Inlining sees the post-rewrite form, which means
I'll send the CL out for review once the next dev cycle opens.
And for the record, here's a memory corruption bug due to escape analysis mishandling implicit conversions in f(g()) calls:
(Note that this is distinct from the test case in #29353.)