-
-
Notifications
You must be signed in to change notification settings - Fork 127
arm64 JIT: Fix broken cache invalidation #1958
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a new public final override method invalidateCache() to DynaRecCPU that zero-fills I-cache state (sets iCacheAddr and iCacheCode to 0xff) and calls uncompileAll() to mark all JIT-compiled blocks as uncompiled. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant DynaRecCPU
participant ICache
participant JITBlocks
Caller->>DynaRecCPU: invalidateCache()
DynaRecCPU->>ICache: fill iCacheAddr/iCacheCode with 0xff
DynaRecCPU->>JITBlocks: uncompileAll()
JITBlocks-->>DynaRecCPU: all blocks marked uncompiled
DynaRecCPU-->>Caller: return
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/core/DynaRec_aa64/recompiler.h (1)
246-250
: Nit: error message says “x64 JIT” in the aa64 JITThe message can be misleading when thrown from the arm64 dynarec.
Apply this diff:
- throw std::runtime_error("PGXP not supported in x64 JIT"); + throw std::runtime_error("PGXP not supported in arm64 JIT");
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/core/DynaRec_aa64/recompiler.h
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/core/DynaRec_aa64/recompiler.h (3)
src/core/r3000a.h (2)
void
(323-326)void
(448-451)src/core/DynaRec_x64/recompiler.h (4)
void
(210-213)void
(221-226)void
(228-232)void
(234-238)src/core/DynaRec_aa64/recompiler.cc (2)
uncompileAll
(131-139)uncompileAll
(131-131)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: pcsx-redux (aarch64-linux)
- GitHub Check: pcsx-redux (x86_64-linux)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: build
- GitHub Check: coverage
- GitHub Check: build-openbios
- GitHub Check: toolchain
- GitHub Check: aur-build
- GitHub Check: macos-build-and-test-toolchain
- GitHub Check: asan
- GitHub Check: cross-arm64
🔇 Additional comments (1)
src/core/DynaRec_aa64/recompiler.h (1)
240-245
: Cache invalidation integration verified—ready to merge
- The
invalidateCache()
override insrc/core/DynaRec_aa64/recompiler.h
is present and matches the x64 implementation.- The base CPU
Reset()
insrc/core/r3000a.h
callsinvalidateCache()
.- All BIOS/OS “FlushCache” paths (e.g. in
src/core/psxmem.cc
, Lua bindings, patch manager, web server, assembly widget) invokeg_emulator->m_cpu->invalidateCache()
.- JIT-internal over-size cache flushes in both x64 and aa64 use their respective
flushCache()
to reset code emitters and re-emit the dispatcher.This aligns arm64 behavior with x64 semantics; no further changes needed.
Fully flushes JIT cache when FlushCache is called. Should fix several games. Tested with Castlevania: Symphony of the Night, which fails to read from memcards without this patch.
Unlike the x64 equivalent, this doesn't use optimized SIMD code for invalidation yet, but it should be fine for now since most ARM users are probably on Apple Silicon which is plenty fast.