Leopold Toetsch <[EMAIL PROTECTED]> writes: > Dan Sugalski <[EMAIL PROTECTED]> wrote: >> At 11:35 AM +0200 4/30/04, Leopold Toetsch wrote: >>>Dan Sugalski <[EMAIL PROTECTED]> wrote: >>>> If we go MMD all the way, we can skip the bytecode->C->bytecode >>>> transition for MMD functions that are written in parrot bytecode, and >>>> instead dispatch to them like any other sub. >>> >>>Not really. Or not w/o significant overhead for MMD functions >>>implemented in C. > >> Well... about that. It's actually easily doable with a bit of >> trickery. We can either: > > This still doesn't work. Function calls just look different then > "plain" opcodes like "add Px, Py, Pz". > - it's not known, if C<add> calls a PASM subroutine > - 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. The registers that need saving are dependent on the caller. 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, then if MMD determines that the call needs to go out to a PASM function, the appropriate registers can be saved.