simple ABI change to enable implicit conversion of functions to delegates?

kinke via Digitalmars-d digitalmars-d at puremagic.com
Mon May 15 13:34:15 PDT 2017


On Monday, 15 May 2017 at 20:14:49 UTC, ag0aep6g wrote:
> Say, the function ABI uses EAX, EBX, and ECX for the first 
> three arguments (in that order). For a function call `f(1, 2)` 
> that means:
>
>     EAX: 1
>     EBX: 2
>     ECX: not used
>
> For a delegate call `dg(1, 2)` I'd also put 1 and 2 into EAX 
> and EBX. Additionally, the context pointer would be passed in 
> ECX.
>
> Calls to normal functions are supposed to stay as they are. 
> Only method/delegate calls should be affected.

If you just want to append an extra context arg by passing it as 
last actual arg, it'll end up in the stack sooner or later, and 
that, I guess, is where bad things may happen by just pushing an 
additional arg, not matching the function signature.


More information about the Digitalmars-d mailing list