Skip to content
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: avoid saving the PC on every store #807

Merged
merged 1 commit into from Aug 19, 2014

Conversation

FioraAeterna
Copy link
Contributor

Modify the backpatcher to store the PC in the trampolines.
Should be ~3.5% faster overall (measured on POV-RAY benchmark).

@delroth
Copy link
Member

delroth commented Aug 15, 2014

@JMC47 can we get some estimates of impact on some games, like VC titles which are usually CPU bound?

@delroth
Copy link
Member

delroth commented Aug 15, 2014

Also, LGTM, nice change. Almost 0 overhead for unpredicted RAM writes now.

@shuffle2
Copy link
Contributor

NICE BENCHMARK STATS

@@ -220,6 +222,14 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void)
else
{
// TODO: special case FIFO writes. Also, support 32-bit mode.
it = pcAtLoc.find(codePtr);

This comment was marked as off-topic.

@comex
Copy link
Contributor

comex commented Aug 15, 2014

It would be slightly faster to use one map containing both PC and registersInUse, rather than a map for each.

@FioraAeterna
Copy link
Contributor Author

I was thinking of that, but wasn't sure it was the best idea, because PCs are only needed for stores, not loads, I think.

@phire
Copy link
Member

phire commented Aug 16, 2014

Looking through the code, I found only one place were the program counter is actually read during a write.

It's a single debug message inside AudioInterface.when you write to the AI_INTERRUPT_TIMING io address.

@FioraAeterna
Copy link
Contributor Author

Isn't it read in the case of a DSI exception on write?

@phire
Copy link
Member

phire commented Aug 16, 2014

Oh right. Someone did a #define PC PowerPC::ppcState.pc which is used in a few more places, including many reads, if ENABLE_MEM_CHECK is enabled.

@JMC47
Copy link
Contributor

JMC47 commented Aug 16, 2014

Increases F-Zero X from 182fps to 184fps on my computer. Most other VC N64 games that I have aren't as fast as this one, and end up seeing a 1 fps increase or no noticeable increase.

@@ -110,6 +110,8 @@ const u8 *TrampolineCache::GetWriteTrampoline(const InstructionInfo &info, u32 r
// Don't treat FIFO writes specially for now because they require a burst
// check anyway.

MOV(32, M(&PC), Imm32(pc)); // for exception handling

This comment was marked as off-topic.

@phire
Copy link
Member

phire commented Aug 19, 2014

Fix up those comments and it LGTM.

Modify the backpatcher to store the PC in the trampolines.
Should be ~3.5% faster overall (measured on POV-RAY benchmark).
@Sonicadvance1
Copy link
Contributor

@FioraAeterna: This comment grants you the permission to merge this pull request whenever you think it is ready. After addressing the remaining comments, click this link to merge.


@dolphin-emu-bot allowmerge

dolphin-emu-bot added a commit that referenced this pull request Aug 19, 2014
JIT: avoid saving the PC on every store
@dolphin-emu-bot dolphin-emu-bot merged commit 2bcc8d4 into dolphin-emu:master Aug 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
8 participants