I have a few questions concerning execute() in vm/cpu-x86.[hS]:
- Why is the frame pointer (%ebp) explicitely saved? Is there a risk
to have it modified from within a Factor word?
- Is there a reason to have the reference to the word in %eax in
addition to the top of the stack?
I have replaced execute() by an inline version that:
- declares %ebx as a clobber instead of saving it explicitely;
- allows GCC to use another register as %eax (in practive, it will
use %edx and save a useless move) while still marking %eax as
dirty as it may have been directly or indirectly by a Factor word
(%eax cannot be declared as a clobber as it would prevent it from
being used as input should it fit better than %edx)
The inline version (in vm/cpu-x86.h) reads:
INLINE void execute(F_WORD *word)
{
CELL ret;
asm volatile("push %%ebp\n\t"
"push %1\n\t"
"call *32(%1)\n\t"
"pop %0\n\t"
"pop %%ebp" : "=a"(ret) : "r"(word) : "%ebx");
}
Can you see any drawback in doing this?
Sam
--
Samuel Tardieu -- [EMAIL PROTECTED] -- http://www.rfc1149.net/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk