Inlining std.atomic.AtomicFence

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Jan 16 15:10:45 PST 2015


Hi Dan,

On Wed, Jan 14, 2015 at 6:08 PM, Dan Olson via digitalmars-d-ldc
<digitalmars-d-ldc at puremagic.com> wrote:
> In LDC, how do we make std.atomic.atomicFence inline?

The short answer: Fix inlining and implement @forceinline.

Cross-module inlining is not functional at all since the big code
emission strategy change. This is a big problem, as it also causes
issues like std.array.front not being inlined for template instances
that are already available from imported modules (e.g. from Phobos).

After this is fixed, we should also implement a forceinline
attribute/pragma/… to make sure "single instruction wrappers" such as
this are actually inlined even in debug mode. Just applying the LLVM
attribute alone obviously won't work for situations where the
definition isn't emitted in the first place (such as in your test
case).

Jernej had a go at the latter in
https://github.com/ldc-developers/ldc/issues/561. Might be worth a
look.

David



More information about the digitalmars-d-ldc mailing list