141 Commits

Author SHA1 Message Date
Stenzek
0479500357
CPU: Correctly mask upper 1.5GB of KUSEG
Stops fastmem going into a loop when trying to backpatch accesses
above 512MB.
2025-04-08 21:39:29 +10:00
Stenzek
3687697d0e
CPU/CodeCache: Only reset used portion of buffer
Saves writing 48MB every reset.
2025-01-15 21:02:56 +10:00
Stenzek
ffef0c2e38
CPU/CodeCache: Don't compile invalid jumps via block links 2025-01-01 14:10:55 +10:00
Stenzek
242561debf
CPU/Recompiler: Align dispatchers and JIT blocks
A couple of percent difference if we're lucky. Practically probably <1%.
2024-12-29 18:11:58 +10:00
Stenzek
2a8cfc7922
CPU/CodeCache: Simplify code LUT addressing
One more instruction on x86/ARM32, no additional instructions on ARM64.

Worth it so that the application doesn't crash if the game jumps to an
invalid PC. Note that the lower 2 bits are truncated, so an unaligned
jump will round down to the closest instruction. Obviously not correct,
but if a game ends up doing this, it's a lost cause anyway.
2024-12-27 15:02:40 +10:00
Stenzek
4b34825afd
CPU/CodeCache: Remove InstructionInfo pc field
No longer needed since oldrecs are gone.
2024-12-27 15:02:40 +10:00
Stenzek
ce71b168c3
CPU/CodeCache: Add static to a couple of missing functions 2024-12-27 15:02:40 +10:00
Stenzek
448009f4ef
CPU/CodeCache: Fastmem RAM faults are always writes 2024-12-22 16:48:45 +10:00
Stenzek
568667753d
CPU/CodeCache: Avoid log calls in faults outside of JIT code
Could be in other functions that are unsafe to call log functions from.
2024-12-19 18:44:08 +10:00
Stenzek
726aa67d1b
CPU/CodeCache: Only cache EXP1 blocks up to 0x1F060000
Neither cart type has code mapped above this address.

Saves ~91MB of memory.
2024-12-14 14:10:06 +10:00
Stenzek
99f133223c
CPU/Recompiler: Create block links for self-looping blocks
This way invalidation will rewrite the jump back to the compiler.
Otherwise a SMC block can end up looping itself indefinitely.

Might help with Spyro 2/3. I can't seem to make them crash anymore.
2024-12-12 16:28:51 +10:00
Stenzek
2e805d56dd
CPU/CodeCache: Always backpatch KSEG2 writes 2024-12-12 16:24:54 +10:00
Stenzek
c3a2156c79
CPU/CodeCache: Fix event kicking for Cached Interpreter 2024-12-12 16:24:19 +10:00
Stenzek
5bf7227790
CPU/CodeCache: Use code buffer section on Android 2024-12-08 19:44:27 +10:00
Stenzek
d3ceda0c5b
CPU/CodeCache: Improve block host size heuristics
Codegen is much better these days, especially with NewRec.
2024-12-03 16:54:28 +10:00
Stenzek
0faa9cf650
Build: Add Devel configuration
Gets you debug assertions and logging, while still producing an
optimized executable.
2024-12-01 23:21:33 +10:00
Stenzek
5261cfe8e4
CPU/Recompiler: Tidy up type names
And reduce global namespace pollution.
2024-11-23 18:52:46 +10:00
Stenzek
f67eacc071
CPU: Default to new recompiler/remove old recompiler 2024-11-23 18:52:46 +10:00
Stenzek
8bd0e6c3f7
CPU/CodeCache: Clear blocks on system shutdown
Means we release all allocated memory on system shutdown, rather
than waiting until the next VM/system start.
2024-11-05 13:06:46 +10:00
Stenzek
6551358212
Log: Replace channel string search with bitset
Knocks off around ~20KB of code.
2024-10-31 14:41:33 +10:00
Stenzek
26b6c704f0
MemMap: Support dynamic page size selection
i.e. 4K to 16K on ARM64.
2024-10-05 19:25:23 +10:00
Stenzek
b36e2ce6be
CPU/CodeCache: Don't create a branch block with no delay slot
Can't compile that.
2024-09-26 20:55:13 +10:00
Stenzek
3dca598063
Log: Switch to enum class
Need to change the channel to a bitset too.. the string lookups are
horribly slow, and conflict when one is a prefix of another.
2024-09-21 22:26:06 +10:00
Stenzek
ab1c85790c
CPU: Refactor execution mode switching
Fixes single step breaking in branch delay slots with recompiler.
Simplifies initialization.
Removes multiple sources of truth for fastmem.
2024-09-06 20:00:30 +10:00
Stenzek
7f4e5d55db
Misc: Update copyright headers 2024-09-01 22:08:31 +10:00
Stenzek
86d4d92753
TimingEvents: Switch to 64-bit counters 2024-08-13 23:52:25 +10:00
Stenzek
2e2451998c
Misc: Fix ARM32 build (again) 2024-08-14 21:39:29 +10:00
Stenzek
a2f98541b3
Misc: Slim down some header includes 2024-08-04 14:49:55 +10:00
Stenzek
2e96931c32
CPU/CodeCache: Dynamically compute BIOS memory access timing
The timings can change if the game does so. Instead of forcing the
blocks to recompile, we can just manually multiply size * word_time.

Improves stability of Nightmare Creatures booting, and fixes corrupted
text in Formula Circus when using the cached interpreter.
2024-07-19 22:25:57 +10:00
Stenzek
2ac2ad605e
CPU/Recompiler: Break blocks on invalid instructions 2024-07-11 17:17:25 +10:00
Stenzek
3b9c489787
CPU: Pass instruction query values by reference 2024-07-11 17:17:25 +10:00
Stenzek
f3671d21f3
CPU/CodeCache: Reduce far code size when using NewRec 2024-06-30 16:45:51 +10:00
Stenzek
9b42ad3859
CPU/CodeCache: Purge JitCodeBuffer 2024-06-30 16:45:51 +10:00
Stenzek
be8fbafd71
CPU/CodeCache: Always dynamically allocate code buffer
Reduces .bss size.
2024-06-30 16:45:51 +10:00
Stenzek
4e922a34a7
Log: Simplify macros 2024-05-24 02:08:14 +10:00
Stenzek
9f90f14c48
CPU/CodeCache: Only print code size stats on request 2024-05-24 00:30:06 +10:00
Stenzek
b6d019db66
Misc: Replace log printf calls with fmt 2024-05-24 00:29:49 +10:00
Stenzek
8f415a44e6
CPU/NewRec: Fix register allocation crash on Linux 2024-05-14 15:13:18 +10:00
Stenzek
fa104acdd1
Misc: Purge unused code and report startup error to host 2024-05-05 22:29:26 +10:00
Stenzek
71f50566f3
System: Consider pending ticks when using global ticks 2024-04-07 19:01:48 +10:00
Stenzek
4599109854
CPU/CodeCache: Clear backpatch info for blocks when recompiled 2024-02-27 22:16:59 +10:00
Stenzek
454cceab80
CPU/CodeCache: Move backpatch lookup after RAM check
Saves a map lookup if we're just invalidating code.
2024-02-27 21:04:26 +10:00
Stenzek
4a70164dac
CMake: Determine host page size at build time
Needed for running on Asahi Linux.
2024-02-25 20:30:41 +10:00
Stenzek
c1381cfda6
System: Gracefully handle memory allocaion failure 2024-02-25 20:30:41 +10:00
Stenzek
ff9dc11a38
CPU/CodeCache: Increase frame delta for manual protected blocks
Reduces stutter in Wild Arms 2.
2024-02-24 15:06:24 +10:00
Stenzek
14e3969736
Misc: Warning fixes 2024-01-26 14:31:03 +10:00
Stenzek
21bbe5c76c
CPU/CodeCache: Fix page error when rewinding 2023-12-19 22:38:27 +10:00
Stenzek
6a7dea6908
CPU/CodeCache: Fix rewinding on Apple Silicon 2023-12-18 21:01:57 +10:00
Stenzek
a499e21453
CPU/CodeCache: Don't try to compile direct double branches
Invalidation nightmare.
2023-12-15 13:46:48 +10:00
Stenzek
8ce2be57c5
CPU/CodeCache: Call Block constructor/destructor
Fixes crash in MSVC Debug build.
2023-11-29 19:16:33 +10:00