What should happen here?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Sep 23 19:40:29 UTC 2021


On Thu, Sep 23, 2021 at 03:22:26PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
> 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.
[...]

All of this long discussion begs the question: why not just use
GC.addRoot() and call it a day?


T

-- 
He who laughs last thinks slowest.


More information about the Digitalmars-d mailing list