I checked in the delay-past-destruct_objects_to_destruct kludge yesterday and I think it'll do. Afterall, there has been no 100% guarantee that the current object is destructed immediately at return anyway, since the destruct_objects_to_destruct call only has been made if there are things to pop on the stack.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-08-08 23:48: Subject: Machine code efficiency
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)