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

Jit64: Treat branch-to-self instruction as an idle loop #4452

Merged
merged 2 commits into from Nov 16, 2016
Merged

Jit64: Treat branch-to-self instruction as an idle loop #4452

merged 2 commits into from Nov 16, 2016

Conversation

stenzek
Copy link
Contributor

@stenzek stenzek commented Nov 14, 2016

I'm guessing this is the result of calling VIDEO_WaitVSync in libogc (perhaps indirectly, I haven't looked closely at the code for this function).

Both Interpreter and JitIL interpret this as an idle loop, Jit64 looked like it did at some point, but it has been commented out for a long time. Was there a reason for this?

JitArm64 has a similar optimization, except it was emitting redundant code as the exception exit would jump out of the block before the normal exit was executed.


This change is Reviewable

The normal block exit is redundant as the exception exit will jump out of
the block first, meaning this code is never executed.
ABI_PushRegistersAndAdjustStack({}, 0);
ABI_CallFunction(CoreTiming::Idle);
ABI_PopRegistersAndAdjustStack({}, 0);
MOV(32, PPCSTATE(pc), Imm32(destination));

This comment was marked as off-topic.

This comment was marked as off-topic.

@degasus
Copy link
Member

degasus commented Nov 14, 2016

LGTM

@JMC47
Copy link
Contributor

JMC47 commented Nov 16, 2016

I need to test this actually; there are potentially games that only work on JIT that could run into this and cause a problem.

@JMC47
Copy link
Contributor

JMC47 commented Nov 16, 2016

checked the CPU backend games and they're unaffected. LGTM

@degasus degasus merged commit 71be84e into dolphin-emu:master Nov 16, 2016
@stenzek stenzek deleted the jmp-self-idle-loop branch June 13, 2017 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants