I have some questions about the x86_64 bytecode compiler, hope someone can answer them. (You, Thilo? I notice you've been working on it a lot lately).
1. q3asm emits ENTER and LEAVE operations that respectively reserve and free 8 + currentLocals + currentArgs bytes. Why the extra 8 bytes? A seemingly obvious optimization is to skip the function prolog/epilog for functions that don't have locals and don't call other functions - but that won't happen now because the bytecode never contains ENTER 0 or LEAVE 0 opcodes. 2. The JIT emits "callq *%rax" instructions, where %rax contains a value from a lookup table. I suspect that's because it doesn't know the address of the target yet? 3. %rsi, %rdi and %r8 to %r10 are consistently saved across function calls. Just to be sure, these are "caller saves" right? IOW, the callee is free to clobber them? 4. How are arguments passed in and results returned? Most of it takes place on the stack, it seems, but the exact calling convention isn't entirely clear to me. 4. x86_64 has an abundance of registers compared to x86 - so why does the JIT use so few? For example, passing more arguments in registers would appreciably speed up function calls. Is it because it doesn't play nice with the bytecode's stack-based nature? Calling convention is the common thread here, it seems. If someone can enlighten me, I would much appreciate it. _______________________________________________ ioquake3 mailing list [email protected] http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org By sending this message I agree to love ioquake3 and libsdl.
