Skip to content

[ARM64_DYNAREC] Don't skip dirty preloaded regs on loopback - #4626

Merged
ptitSeb merged 2 commits into
ptitSeb:mainfrom
ksco:fix-arm-1
Oct 30, 2026
Merged

ptitSeb merged 2 commits into
ptitSeb:mainfrom
ksco:fix-arm-1

Conversation

@ksco

@ksco ksco commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Registers updated inside a loop should be written back to xEmu when dirty, so the next iteration will see the correct values.

@ptitSeb

ptitSeb commented Oct 29, 2026

Copy link
Copy Markdown
Owner

Mmmm, the idea of preload was to load the regs before the loop, so the read is done only one time. I don't understand why this should be needed? or is it for another jump and not the main loop?
I don't understand this fix, as this is exactly what preload is supposed to prevent.

@ksco

ksco commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

We have to store the dirty preloaded registers back so they stay clean at the loop head -- in case there is a call_c inside the loop; the stale values of an xmm register can be restored from stale memory.

Another (maybe better?) way to do this is to have the host_call mark and skip loops with hostcalls. This is how LoongArch handles this, IIRC.

@ptitSeb

ptitSeb commented Oct 29, 2026

Copy link
Copy Markdown
Owner

We have to store the dirty preloaded registers back so they stay clean at the loop head -- in case there is a call_c inside the loop; the stale values of an xmm register can be restored from stale memory.

Another (maybe better?) way to do this is to have the host_call mark and skip loops with hostcalls. This is how LoongArch handles this, IIRC.

Not ideal, but better yes.
The ideal way would be for call_c to not skip those preloaded regs, but that might be more tricky to track down I guess.

@ksco

ksco commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

I can try.

@ksco
ksco requested a review from ptitSeb October 30, 2026 07:50
@ptitSeb
ptitSeb merged commit fb0b267 into ptitSeb:main Oct 30, 2026
29 checks passed
@ptitSeb

ptitSeb commented Oct 30, 2026

Copy link
Copy Markdown
Owner

This might help #4065 also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants