What should happen here?

Steven Schveighoffer schveiguy at gmail.com
Thu Sep 23 19:22:26 UTC 2021


On 9/23/21 2:41 PM, Steven Schveighoffer wrote:
> On 9/23/21 1:45 PM, Johan wrote:
>> On Thursday, 23 September 2021 at 12:47:25 UTC, Steven Schveighoffer 
>> wrote:
>>>
>>> I think we will need a real compiler intrinsic at this point.
>>
>> For LDC (and I expect GDC too), the asm trick works.
> 
> oooh, really? That's cool. Maybe I'll update the library and re-register.
> 
> Looking at the disassembly, I do see the difference. This is it pushing 
> to the stack, right?
> 
> ```asm
>   mov     qword ptr [rsp], rax
> ```

Hm... it cancels all optimizations. No inlining either, or removal of 
the empty function. So the penalty is you are going to call the dtor 
(with an actual call instruction).

I guess that's better than nothing.

-Steve


More information about the Digitalmars-d mailing list