Commit graph

58 commits

Author SHA1 Message Date
Connor McLaughlin f34a048009 CPU/CodeCache: Fall back constantly-modified blocks to interpreter
Partial fix for slowdown in Colin McRae Rally 2.0.
2021-04-27 02:56:57 +10:00
Connor McLaughlin dd5277321b CPU/CachedInterpreter: Fix infinite loop when block compile fails 2021-04-14 19:06:52 +10:00
Connor McLaughlin e087e6f3a2 CPU/Recompiler: Prevent using fastmem when cache is isolated
No point even trying since it's just going to fault.
2021-04-12 02:08:56 +10:00
Connor McLaughlin 922d320523 CPU/Recompiler: Reserve whole fastmem region to avoid clashes 2021-04-11 12:42:51 +10:00
Connor McLaughlin 5bbbb8d3d5 CPU/Recompiler: Use MAP_JIT for code space on Apple Silicon 2021-03-19 18:47:31 +10:00
Connor McLaughlin bf5f53e1d1 CPU/CodeCache: Don't choke on indirect -> direct branch in delay slot 2021-03-06 02:21:27 +10:00
Connor McLaughlin 520b64e711 CPU/Recompiler: Don't zero read-only bits in mtc0
Fixes memory card error in Digimon Digital Card Battle.
2021-02-28 15:06:24 +10:00
Connor McLaughlin 701edb335a Various warning fixes 2021-02-06 19:19:55 +10:00
Connor McLaughlin c9240eea72 CPU/Recompiler: Use PGXP interpreter for fallback
Fixes holes in geometry with PGXP enabled in Threads of Fate.
2021-01-01 17:16:55 +10:00
Connor McLaughlin 02377b1a92 CPU/CodeCache: Fix possible crash on invalidate->recompile->overflow 2020-12-31 02:10:49 +10:00
Connor McLaughlin a894b295b6 CPU/CodeCache: Fix assertion failure when patching in double branch 2020-12-29 22:49:52 +10:00
Connor McLaughlin 3b23542ec9 CPU: Provide debugger/breakpoint/step functionality 2020-12-17 11:57:47 +10:00
Connor McLaughlin 5164840c25 CPU/CodeCache: Don't choke on indirect branches in delay slot
Fixes emulator crash/memory usage explosion in Shadow Master.
2020-12-14 01:35:53 +10:00
Connor McLaughlin f5ccb6ea60 CPU: Fall back to mmap'ed buffer if reprotecting code space fails 2020-12-06 18:13:07 +10:00
Connor McLaughlin bf2e38aed5 CPU/Recompiler: Implement LUT-based fastmem 2020-11-24 14:49:21 +10:00
Connor McLaughlin 0793f98c87 CPU/Recompiler: Reduce armv7 code buffer size 2020-11-22 13:59:26 +10:00
Connor McLaughlin a03bca2f72 CPU: Make fastmem a compile-time feature (support 32-bit targets) 2020-11-21 18:39:03 +10:00
Connor McLaughlin 53f81d067a CPU/CodeCache: Remove warning about executing uncompiled blocks 2020-11-21 18:39:03 +10:00
Connor McLaughlin 042bdd9c0c CPU/CodeCache: Fetch second delay slot from first branch for double branches 2020-11-19 00:40:02 +10:00
Connor McLaughlin 576914cd2c CPU/CodeCache: Backpatch code writes after they exceed 10 faults
Small performance improvement in Driver 2.
2020-11-08 00:22:35 +10:00
Connor McLaughlin 2e53bf914e CPU/CodeCache: Fix crash when jumping to invalid block in recompiler 2020-10-31 14:27:57 +10:00
Connor McLaughlin be63d893cd CPU: Use partial icache fills for non-line-aligned addresses 2020-10-30 00:44:40 +10:00
Connor McLaughlin cbc7e3d64a CPU/Recompiler: Add register allocation safety check to fastmem 2020-10-26 21:59:29 +10:00
Connor McLaughlin 7566c45f64 CPU/Recompiler: Implement fastmem 2020-10-18 14:54:38 +10:00
Connor McLaughlin a6f8dde790 CPU/Recompiler: Faster ASM dispatcher 2020-10-18 14:54:38 +10:00
Connor McLaughlin cb351a7dbd CPU: Move interrupt check out of inner-most exec loop 2020-10-18 14:54:38 +10:00
Connor McLaughlin 19d6037b99 CPU: Implement instruction cache simulation
Implemented for all execution modes. Disabled by default in the cached
interpreter and recompiler, always enabled in the pure interpreter.
2020-08-29 22:07:40 +10:00
Connor McLaughlin d3f530f96e CPU/CachedInterpreter: Very slight optmization 2020-08-23 01:41:55 +10:00
Connor McLaughlin 1d4d1d06a7 CPU/Recompiler: Disable static code buffer on macOS/Haiku 2020-08-22 13:24:57 +10:00
kwyxz 31695c4ff7
Haiku port of duckstation libretro core (#716)
* Haiku build 1st attempt

* fix load on Haiku

* Removed debugging flags

* Added a couple ifndef
2020-08-22 13:20:37 +10:00
Connor McLaughlin 2e9f656546 CPU: Implement PGXP CPU Mode
This is *very* slow. You don't want to enable it if you don't need it.
It is also incompatible with the recompiler and will disable it if the
option is enabled.
2020-08-20 00:49:39 +10:00
Connor McLaughlin 5b9db71b87 CPU/Recompiler: Fix mid-block software interrupts not updating pc
Fixes Need for Speed: High Stakes hanging at boot.
2020-08-09 04:32:53 +10:00
Connor McLaughlin 1d5f810a4b CPU/Recompiler: Disable memory access exceptions by default
This means it'll no longer pass amidog's CPU test in the default config.
But no games rely on this. You can enable it in advanced options if you
want to pass the CPU test.
2020-08-08 23:44:13 +10:00
Connor McLaughlin b1377fe0d9 CPU/Recompiler: Add a fast block lookup array
Up to 15% perf improvement.
2020-08-08 23:06:28 +10:00
Connor McLaughlin f6e88353eb CPU/Recompiler: Make generated code invariant to virtual PC 2020-08-08 23:06:28 +10:00
Connor McLaughlin 2885d2e547 CPU/CodeCache: Hopefully fix 32-bit compile errors 2020-08-01 03:53:53 +10:00
Connor McLaughlin b6f871d2b9
JIT optimizations and refactoring (#675)
* CPU/Recompiler: Use rel32 call where possible for no-args

* JitCodeBuffer: Support using preallocated buffer

* CPU/Recompiler/AArch64: Use bl instead of blr for short branches

* CPU/CodeCache: Allocate recompiler buffer in program space

This means we don't need 64-bit moves for every call out of the
recompiler.

* GTE: Don't store as u16 and load as u32

* CPU/Recompiler: Add methods to emit global load/stores

* GTE: Convert class to namespace

* CPU/Recompiler: Call GTE functions directly

* Settings: Turn into a global variable

* GPU: Replace local pointers with global

* InterruptController: Turn into a global pointer

* System: Replace local pointers with global

* Timers: Turn into a global instance

* DMA: Turn into a global instance

* SPU: Turn into a global instance

* CDROM: Turn into a global instance

* MDEC: Turn into a global instance

* Pad: Turn into a global instance

* SIO: Turn into a global instance

* CDROM: Move audio FIFO to the heap

* CPU/Recompiler: Drop ASMFunctions

No longer needed since we have code in the same 4GB window.

* CPUCodeCache: Turn class into namespace

* Bus: Local pointer -> global pointers

* CPU: Turn class into namespace

* Bus: Turn into namespace

* GTE: Store registers in CPU state struct

Allows relative addressing on ARM.

* CPU/Recompiler: Align code storage to page size

* CPU/Recompiler: Fix relative branches on A64

* HostInterface: Local references to global

* System: Turn into a namespace, move events out

* Add guard pages

* Android: Fix build
2020-07-31 17:09:18 +10:00
Connor McLaughlin d5a5432a8b CPU/CodeCache: Fix crash when BIOS is missing 2020-04-19 16:03:35 +10:00
Connor McLaughlin a43a0a14cc CPU/CodeCache: Don't leak blocks on shutdown 2020-04-16 20:23:54 +10:00
Connor McLaughlin 7a87b9b5bb CPU/CodeCache: Don't leak blocks on flush 2020-04-16 19:40:52 +10:00
Connor McLaughlin 71c1e243fe Remove YBaseLib dependency 2020-01-10 13:40:53 +10:00
Connor McLaughlin 41298a74e1 CPU/Recompiler: Fetch instruction before dispatching interrupts
Fixes polygon glitches in Crash.
2019-12-12 23:55:42 +10:00
Connor McLaughlin aa52dbfeb8 CPU/Recompiler: Use register cache for managing pc
Reduces the number of loadstores after each instruction.
2019-12-12 23:55:23 +10:00
Connor McLaughlin 002d1cd4fd CPU/CoreCache: Use virtual (unmasked) address as PC 2019-12-12 20:23:53 +10:00
Connor McLaughlin eeea5125f7 CPU: Use pending ticks as downcount comparison
Saves a few cycles decrementing the downcount.
2019-12-05 16:28:46 +10:00
Connor McLaughlin e518cbfffb CPU/Recompiler: Fallback-all-instructions working in AArch64 2019-12-03 20:45:14 +10:00
Connor McLaughlin f11d357ab9 Compile fixes for Android 2019-11-28 01:55:33 +10:00
Connor McLaughlin 519dbc818d CPU/CodeCache: Fix DMA writes not invalidating code blocks
Fixes Crash Team Racing and Spyro in Cached Interpreter/Recompiler
modes.
2019-11-26 19:45:38 +10:00
Connor McLaughlin 8c5fcc8f48 CPU: Fix more load delay slot issues
Fixes Spyro again. b{ltz,gez}(al)? disabled in the recompiler until
issues are fixed.
2019-11-24 01:11:51 +10:00
Connor McLaughlin 889bd73ac8 CPU: Add settings for execution mode 2019-11-23 20:22:09 +10:00