Piers Cawley <[EMAIL PROTECTED]> wrote: > Leopold Toetsch <[EMAIL PROTECTED]> writes:
>> - if it calls a PASM routine, registers have to be preserved. Which >> registers depend on the subroutine that actually gets called (ok, this >> information - which registers are changed by the sub - can be attached >> to the Sub's metadata) > No, we're in caller saves remember. Ok, yes. But MMD and delegated functions are a bit different. The caller isn't knowing that it's a caller. The PASM is run from the inside of the C code. > ... The registers that need saving are > dependent on the caller. Not quite for this case. Or in theory yes, but... As calling the subroutine mustn't have any changes to the caller's registers, it's just simpler to save these registers that the subroutine might change. > ... Since the registers used by a function at any > point are statically determined, maybe add's signature could be altered > to take an integer 'save flags' argument specifying which registers > need to be preserved for the caller, This has a performance penalty for the non-MMD case. I can imagine that overloaded MMD functions are simpler (in respect of register usage) then the caller's code. So it seems that saving, what the MMD sub might change on behalf of the caller is just more effective. leo