Summary: Compiler should call separate function when allocating
a struct on the heap
--- Comment #0 from Steven Schveighoffer <schvei...@yahoo.com> 2012-01-07
12:00:56 PST ---
Note, this requires druntime fixes too, but I can't select both DMD and
Currently, when creating a struct on the heap, _d_newarrayT is called with a
length of 1.
However, the runtime must assume this is an array of length 1. Therefore, it
must set the appendable bit, and reserve space for the 'used' length.
This can waste space.
For instance, the following could fit in a 16-byte block, but will go into a
32-byte block due to the used field:
auto s = new S;
assert(GC.sizeof(s) == 32);
I think instead, a _d_newstruct function should be called (and implemented in
druntime) to initialize a single struct on the heap in the most efficient
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------