[Issue 14571] [REG2.064] Large static arrays seem to lock up DMD

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri May 22 03:57:10 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14571

--- Comment #14 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Vladimir Panteleev from comment #11)
> Certain data structures are much easier to implement using static arrays
> (for example, object pools with statically-sized chunks).
> 
> > Global arrays already have that extra indirection.
> 
> You mean TLS?

Take a look at the code generated for global data. In 64 bit code, it's all
relative to the program counter. In 32 bit code, it's indirect because of
shared library support (PIC).


> Arrays in the data segment have a fixed address. This means that arr.ptr is
> actually known at compile time (whether the language exposes it or not).

Link time, not compile time.


> arr[5] involves no address calculation at all during program execution as
> well.

That died a couple decades ago with the advent of DLLs. x86-64 bit code doesn't
even have a direct addressing mode. Even the presumably direct addressing modes
in x32 are indirect because of the segment registers, and despite that, the CPU
does such a good job of address pipelining you'll never see the effect of using
a register offset.


> BSS does not bloat executable size, only virtual memory.

I know, that's why I mentioned it. BSS is special.

--


More information about the Digitalmars-d-bugs mailing list