ABI and exception handling

Sean Kelly sean at f4.ca
Tue Feb 28 10:37:24 PST 2006


Lionello Lunesu wrote:
>> The x64 __fastcall may not be fully compatible with D. Note:
> 
> Yes, probably, but they need not be.
> 
>> "Any argument that doesn’t fit in 8 bytes, or is not 1, 2, 4, or 8 bytes, 
>> must be passed by reference. The x87 register stack is unused. It may be 
>> used, but must be considered volatile across function calls."
>>
>> Sounds like yet another savage attack on 80-bit reals; it seems their ABI 
>> will not allow you to generate efficient x87 code.
>> I'm also a little unclear about whether the scheme is compatible with 
>> nested functions, which as I understand it, manipulate ESP but not EBP.
> 
> I was not talking about adopting the x64 calling convention in D : ) but was 
> interested in the new way of stack unwinding. I must say, it's not really 
> clear to me (way over my head), but making the "try" fast and the "catch" 
> slow (which seems to be O(1) now) makes a lot of sense, and I was wondering 
> if it were _in theory_ possible to use a different unwind mechanism for D 
> code.

The spec doesn't impose any requirements on how exception handling is 
implemented, so I'd assume you could do it any way you want.  The most 
common approach in C++ is for no-cost try blocks and correspondingly 
higher cost throws, but this isn't the only approach.  This technical 
report on C++ performance goes into the costs of various exception 
handling approaches if anyone is interested:

http://public.research.att.com/~bs/performanceTR.pdf


Sean



More information about the Digitalmars-d mailing list