Re: spurious gc allocation

2013-11-09 Thread lomereiter
Indeed, disassembly reveals an allocation (with all three compilers = it's the front-end which generates this crap). I guess the compiler incorrectly treats { node.value; } as a delegate and copies the node to GC heap. void foo() { int* node = null; enum mutable = __traits(compiles,

Re: spurious gc allocation

2013-11-09 Thread bearophile
Ellery Newcomer: can anyone confirm? I only see the class instance allocation in the main(). I use two modules, with your code. I compile on Windows 32, using no compilation flags, and I see this asm, with obj2asm: _D1a1C13_InsertAllButMFiZv: pushEAX

Re: spurious gc allocation

2013-11-09 Thread Ellery Newcomer
On 11/09/2013 12:35 AM, lomereiter wrote: Indeed, disassembly reveals an allocation (with all three compilers = it's the front-end which generates this crap). ouch. I guess the compiler incorrectly treats { node.value; } as a delegate and copies the node to GC heap. void foo() { int*

Re: spurious gc allocation

2013-11-08 Thread Timon Gehr
On 11/08/2013 07:12 AM, Benjamin Thaut wrote: The problem is that you define the struct Thing as a inner struct. struct Thing only exists in the decompiled version, not in the original source. So far it looks like a bug to me.

Re: spurious gc allocation

2013-11-08 Thread Ellery Newcomer
On 11/08/2013 06:19 AM, Timon Gehr wrote: On 11/08/2013 07:12 AM, Benjamin Thaut wrote: The problem is that you define the struct Thing as a inner struct. struct Thing only exists in the decompiled version, not in the original source. So far it looks like a bug to me. I've reduced it to

spurious gc allocation

2013-11-07 Thread Ellery Newcomer
hello all. I have a class member function that essentially looks like this: ThisNode* _InsertAllBut(int value) { ThisNode* node = MallocAllocator.allocate!(ThisNode)(1); node.value = value; node_count++; return node; } I compile it on x86_64 and the compiler inserts a gc

Re: spurious gc allocation

2013-11-07 Thread Benjamin Thaut
Am 08.11.2013 06:19, schrieb Ellery Newcomer: hello all. I have a class member function that essentially looks like this: ThisNode* _InsertAllBut(int value) { ThisNode* node = MallocAllocator.allocate!(ThisNode)(1); node.value = value; node_count++; return node; } I