New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JIT: support immediate stores #805
Conversation
| @@ -195,7 +215,13 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void) | |||
| } | |||
|
|
|||
| u32 registersInUse = it->second; | |||
|
|
|||
| /*if (info.hasImmediate) | |||
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
Would be nice to fix SafeWriteRegToReg so it doesn't clobber both its argument registers. Looks like it only clobbers source if it needs to do a BSWAP instruction and it only needs to clobber addr if it needs to call the external write function. But probably out of scope of this PR. LGTM. |
c428ae4
to
768c957
Compare
768c957
to
b2dd520
Compare
b2dd520
to
0c4cc16
Compare
|
I've rewritten this to work with all of comex's latest changes, but I'm not sure what I should do about the register issue. If the fast path fails, we need to allocate a register for the immediate reg_value for the slow path, but it's not clear which register we should pick (RSCRATCH or RSCRATCH2 might already be used by addr, and might be requested as callee-save by the caller?). This should work with MMU games now. |
0c4cc16
to
4879ef2
Compare
|
You've already saved registers that are in use (other than RSCRATCHes, but those were never going to be saved across a function call anyway - |
|
Comex, is FioraAeterna@df2fafe#diff-9aa48ec8e209a074e590018a52b78eb6R70 bad? should I not be doing that? |
4879ef2
to
934f7c2
Compare
|
I think it's fine... |
|
I thought I should be avoiding using RSCRATCH across function calls though? |
|
It'll work if you ask for it to be saved. |
|
Okay, makes sense! |
56cca4a
to
929fc8a
Compare
929fc8a
to
d02b7c7
Compare
This is a bit of a WIP given that it.... turned out to be a lot bigger than I expected it to be, and I still need to bench it, but I'd love comments.
Basically I noticed there were tons of examples of code like this:
mov eax, 0x8
bswap eax, eax
mov [rdx+rbx], eax
This was clearly quite silly, so I decided to add support for immediate stores, a'la:
mov [rdx+rbx], 0x08000000
How hard could this be? Well, after a journey into the backpatcher, I can say "much harder than I originally thought..."