`in` parameters made useful

Mathias LANG geod24 at gmail.com
Tue Aug 4 23:41:27 UTC 2020


On Tuesday, 4 August 2020 at 23:18:56 UTC, tsbockman wrote:
>
> This optimization should be implemented by querying the 
> backend, not calculated from scratch in the frontend, which is 
> redundant and error-prone; the rules in the current PR are not 
> accurate.

Indeed. The current rules were put there as a way to get the ball 
rolling, so to say. My current focus is to get things to compile 
and pass test on Buildkite, then optimize the rules.
The thing that is not going to change is that types that needs 
elaborate copy or destruction, and types that are not copyable, 
will be passed by ref. Additionally, I want to keep covariance 
for array types, which requires them to be passed by value 
(although it can be done in registers). The rest, I don't mind 
changing it.

> The correct rules are complex, platform-dependent, and depend 
> on the types of each function's full parameter list as a whole, 
> not just each parameter individually. I haven't found anywhere 
> that documents them, but by experimentation with LDC I have 
> discovered the following:
>
> [...]

Thanks for the feedback. I'll definitely incorporate it (and 
Rainer's) into the PR soon-ish, most likely via a call to a 
backend hook, as is currently done for NRVO.


More information about the Digitalmars-d mailing list