What should happen here?
deadalnix
deadalnix at gmail.com
Mon Sep 27 09:53:53 UTC 2021
On Sunday, 26 September 2021 at 20:39:48 UTC, Steven
Schveighoffer wrote:
> You realize what `GC.addRoot` does? It adds a pointer to a
> treap, through a virtual function call after taking a global
> lock. Pushing a stack item is going to be at least 10x faster,
> probably more compared to that. In the function call alone,
> there are a few stack pushes.
>
> -Steve
Sure, but it does so exclusively for one specific address. The
optimizer would have to do so for every single thing that might
be pointing to something that is owned by the GC.
However, one thing that could be done is to have an intrinsic to
do so, so the optimizer knows exactly which references not to
mess with. LLVM already has intrinsics for this at the IR level.
More information about the Digitalmars-d
mailing list