Here's another hair-brained idea; perhaps instead of assembling each jump instruction as:
call F_INSTRUCTION jmp *%eax
Perhaps it is possible to use just "call F_INSTRUCTION", but instead of changing the return address, you just define DO_JUMP(X) as:
movl %ebp, %esp ; Unlink stack frame (-fno-omit-frame-pointer) popl %ebp ; restore %ebp addl $4,%esp ; pop return address movl X,%eax ; Jump jmp *%eax
IE. a standard gcc-function-epilogue, but with a pop/jump instead of a ret. It should be possible to make it work with -fomit-frame-pointer as well, but that's a little trickier.
Although, it is possible that this will be just as slow as changing the return address on the stack.
/ Fredrik (Naranek) Hubinette (Real Build Master)
Previous text:
2003-08-08 01:52: Subject: Machine code efficiency
The calls via mega_apply aren't the problem. Rather it's those that use low_mega_apply and low_return at different points, i.e. whenever a pike function calls another pike function. I don't think that has changed. Wasn't it you that implemented the stuff that avoids recursion on the C stack in that case?
/ Martin Stjernholm, Roxen IS