_argptr woes

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sat Mar 17 03:47:38 PDT 2007


Daniel Keep wrote:
> 
> Sean Kelly wrote:
>> Frits van Bommel wrote:
>>> http://www.x86-64.org/documentation/abi.pdf)
>> Perhaps I'm being thick, but why in the world would a CPU spec need to
>> contain parameter passing rules?  Or even stack frame information?  I
>> can see an OS caring about stack frame, but parameter passing seems like
>> it should be language-dependent.

I don't think it's a CPU spec, it's just a document written in an 
attempt to make sure compilers for a new architecture are (somewhat) 
compatible.

> I imagine it's more a case of: "here's an ABI we came up with for our
> new architecture--you don't have to use it, but wouldn't it be nice if
> we all just got along?"

Yeah, looks like. And AFAICT it's pretty good, but the vararg calling 
convention sucks. This probably has to do with unprototyped C functions, 
since those can be both normal and vararg functions. So they made sure 
the calling convention remains compatible, screwing everyone else using 
it over :(.

> If nothing else, it gives everyone a common calling convention to
> implement so that their language can do interop on that platform easily.

Which is always a good idea. Especially when the majority of developers 
probably come from a register-starved platform (x86) where the "default" 
calling convention is pretty much stack-only, and the new architecture 
has extra registers that can be used to handle this more efficiently.



More information about the Digitalmars-d mailing list