What should happen here?

max haughton maxhaton at gmail.com
Fri Sep 24 15:31:18 UTC 2021


On Friday, 24 September 2021 at 15:25:55 UTC, deadalnix wrote:
> On Thursday, 23 September 2021 at 19:54:56 UTC, Steven 
> Schveighoffer wrote:
>> You can. But wouldn't you prefer just pushing something on the 
>> stack?
>>
>
> Not really. If the optimizer can remove dead stack pushes, then 
> program will become 2x slower instantly in addition of 
> consuming more stack memory.

Doubt it would be 2x on a modern CPU. Point stands though. LLVM 
and GCC both have intrinsics for GC roots so perhaps they could 
be used here (calling into the GC is going to be very slow anyway 
so keeping it's return value on the stack wouldn't matter)


More information about the Digitalmars-d mailing list