|
From: | Paolo Bonzini |
Subject: | Re: [Lightning] Code patching, context switching |
Date: | Thu, 21 Feb 2008 09:34:19 +0100 |
User-agent: | Thunderbird 2.0.0.9 (Macintosh/20071031) |
For instance, on every pusharg, increment the last allocated register by one, then wrap once you reach JIT_R_NUM, and push JIT_R(0) on the stack.
Are we talking about the same pusharg? :-)
Pusharg can even accept an additional parameter as a hint (like C's 'register' storage class), to help it determine whether to allocate it to a register, or push it on the stack.
Whether an argument goes in a register or on the stack is mandated by the ABI.
The low-level API then exposes the full register set for those who actually want to generate their own code.
There is already a kind of low-level ABI. What I could do would be to provide a JIT_ALL_REGS_NUM macro, a jit_all_regs[] array, and three macros (e.g. JIT_IS_REG_CALLER_SAVE, JIT_IS_REG_CALLEE_SAVE, JIT_IS_REG_RESERVED) to tell you whether a register is caller save, callee save or reserved for use by lightning macros. I'd prefer if you wrote the patch though. :-)
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |