October 04, 2012
On 2012-10-04 08:01, thedeemon wrote:

> BTW, where can I learn about the current progress with GC? Is
> this work concentrated in one project or are there several
> parallel works on improving GC? Is anyone already working on
> making memory allocation and GC more multicore friendly?

If I recall correctly someone worked on a GC project during GSOC 2012. Trying search through "announce" list/forum.

-- 
/Jacob Carlborg
October 04, 2012
On 04-10-2012 08:49, Jacob Carlborg wrote:
> On 2012-10-04 00:01, DypthroposTheImposter wrote:
>>   Did that hook thing to let peoples write custom GC ever make it in?
>
> Yes, it's pluggable at link time. Here's an example of a stub
> implementation:
>
> http://www.dsource.org/projects/tango/browser/trunk/tango/core/rt/gc/stub
>
> It's for Tango but the runtimes are basically the same.
>

More relevant to D2: https://github.com/D-Programming-Language/druntime/tree/master/src/gcstub

(Though admittedly nobody has built it for a while - so, disclaimer: there may be some silly build errors if you try to build it, but they should be easy to fix.)

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
October 04, 2012
On 04-10-2012 08:50, Jacob Carlborg wrote:
> On 2012-10-04 01:33, Alex Rønne Petersen wrote:
>
>> Use tuples. Multiple return values (as far as ABI goes) are impractical
>> because every major compiler back end (GCC, LLVM, ...) would have to be
>> adjusted for every architecture.
>
> Why can't it just be syntax sugar for returning a struct?
>

I agree that it should be, FWIW. The problem is that some people really expect the ABI to be altered, which is unrealistic.

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
October 04, 2012
On 2012-10-04 12:58, Alex Rønne Petersen wrote:

> More relevant to D2:
> https://github.com/D-Programming-Language/druntime/tree/master/src/gcstub
>
> (Though admittedly nobody has built it for a while - so, disclaimer:
> there may be some silly build errors if you try to build it, but they
> should be easy to fix.)

There it is, I've been looking for the corresponding one in druntie.

-- 
/Jacob Carlborg
October 04, 2012
On 2012-10-04 12:59, Alex Rønne Petersen wrote:

> I agree that it should be, FWIW. The problem is that some people really
> expect the ABI to be altered, which is unrealistic.

Is there an advantage of altering the ABI?

-- 
/Jacob Carlborg
October 04, 2012
On 04-10-2012 14:26, Jacob Carlborg wrote:
> On 2012-10-04 12:59, Alex Rønne Petersen wrote:
>
>> I agree that it should be, FWIW. The problem is that some people really
>> expect the ABI to be altered, which is unrealistic.
>
> Is there an advantage of altering the ABI?
>

Presumably speed; returning small structs in registers will be faster than doing so on the stack.

But I don't agree that the vast complexity of altering well-established ABIs for multiple architectures is worth that speed gain.

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
October 04, 2012
On 2012-10-04 14:36, Alex Rønne Petersen wrote:

> Presumably speed; returning small structs in registers will be faster
> than doing so on the stack.

Are sturcts currently always returned on the stack?

> But I don't agree that the vast complexity of altering well-established
> ABIs for multiple architectures is worth that speed gain.

I agree.

-- 
/Jacob Carlborg
October 04, 2012
Jacob Carlborg wrote:
> On 2012-10-04 14:36, Alex Rønne Petersen wrote:
>
>> Presumably speed; returning small structs in registers will be faster
>> than doing so on the stack.
>
> Are sturcts currently always returned on the stack?

From: http://dlang.org/abi.html, for Windows x86 extern(D):

* 1, 2 and 4 byte structs are returned in EAX.
* 8 byte structs are returned in EDX,EAX, where EDX gets the most significant half.
* For other struct sizes, the return value is stored through a hidden pointer passed as an argument to the function.
October 04, 2012
On 04-10-2012 15:06, Jacob Carlborg wrote:
> On 2012-10-04 14:36, Alex Rønne Petersen wrote:
>
>> Presumably speed; returning small structs in registers will be faster
>> than doing so on the stack.
>
> Are sturcts currently always returned on the stack?

As always, it depends on the arch, but on 32-bit x86: Yes. On 64-bit x86: Yes, if the struct size is larger than 8 bytes (otherwise it's returned in RAX).

>
>> But I don't agree that the vast complexity of altering well-established
>> ABIs for multiple architectures is worth that speed gain.
>
> I agree.
>

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org
October 04, 2012
On 04-10-2012 15:21, Piotr Szturmaj wrote:
> Jacob Carlborg wrote:
>> On 2012-10-04 14:36, Alex Rønne Petersen wrote:
>>
>>> Presumably speed; returning small structs in registers will be faster
>>> than doing so on the stack.
>>
>> Are sturcts currently always returned on the stack?
>
> From: http://dlang.org/abi.html, for Windows x86 extern(D):
>
> * 1, 2 and 4 byte structs are returned in EAX.
> * 8 byte structs are returned in EDX,EAX, where EDX gets the most
> significant half.
> * For other struct sizes, the return value is stored through a hidden
> pointer passed as an argument to the function.

I strongly advise ignoring the D calling convention. Only DMD implements it and nowhere else than on Windows for 32-bit x86.

Instead, refer to the Windows and System V x86 ABIs.

-- 
Alex Rønne Petersen
alex@lycus.org
http://lycus.org