ABI and exception handling

Oskar Linde oskar.lindeREM at OVEgmail.com
Tue Feb 28 08:42:54 PST 2006


Lionello Lunesu skrev:
> I came across an interesting article:
> 
> http://blogs.msdn.com/freik/archive/2005/03/17/398200.aspx
> 
> and I was wondering if it would be possible to use a calling convention 
> similar to x64's "__fastcall" for D programs? Apparently there should be a 
> speed-up, especially when using exception handling (or those new 
> on_scope_xxx constructs).
> 
> Or is D "obliged" to use the C calling convention? I wouldn't think so, 
> since what's the point of "extern(C)" in that case, for the decoration?

For D on x86_64 (x64) it would also be interesting to consider out and 
inout passed in registers instead of as pointers (in registers).

Example: The x86_64 C ABI specifies that argument 1 is passed in %rdi, 
argument 2 is passed in %rsi, etc... Calling void func(out int x) would 
just mean that %rdi got assigned in the function. No address would be 
sent to func.

A D function would skip passing anything at all on out parameters that 
would be assigned to registers.

/Oskar



More information about the Digitalmars-d mailing list