March 21, 2021 Re: Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On Sunday, 21 March 2021 at 14:48:49 UTC, deadalnix wrote: > On Sunday, 21 March 2021 at 07:51:45 UTC, Max Haughton wrote: >> Godbolt example? > > https://godbolt.org/z/eK7dYx > > You'll note that there are no loads in the generated code. Is that strictly a move or "just" the struct ABI? i.e. If I add a destructor then we do go through [RDI]. https://godbolt.org/z/bn4nrEbnn dmd also generates the same code (minus some peephole optimizations for the stack operations - not trying to nerd snipe Walter!) |
March 22, 2021 Re: Discussion Thread: DIP 1040--Copying, Moving, and Forwarding--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Max Haughton | On Sunday, 21 March 2021 at 21:33:47 UTC, Max Haughton wrote:
> Is that strictly a move or "just" the struct ABI? i.e. If I add a destructor then we do go through [RDI].
>
It's not "just an ABI thing". It means that the original address of the struct is never passed down. And if it is never passed down, it is not even possible to attempt to not move the struct.
As for the destruction thing, I assume this because dmd/ldc decided to go with the same ABI as C++ and non POD are passed by ref, always, due to the way C++ does its business (I already described this in great length in the topic).
|
Copyright © 1999-2021 by the D Language Foundation