Skip to content

Just in time OBJ/IR Caching

Stefanos Kornilios Mitsis Poiitidis requested to merge skmp/jit-ir-caching into main

Overview

Caches IR and OBJ as it gets compiled, in a multithreaded and multi process safe way.

This started as a cleanup of the loading interface, and as such has a lot of cruft, then I cherry-picked stuff in from #1548

Reading from the caches takes a shared_lock, and that's it.

Writing to the caches takes a unique_lock, and also fnctl advisory lock when the index or the data files are resized.

Index files are re-mapped as they grow, they grow in 64kb chunks.

Data files are mapped in 'chunks' of up to 16Megs.

Settings have been cleaned up. AOTIRLoad and AOTIRCapture have been merged to IRCache. AOTIRGenerate has been completely removed, and a separate executable, FEXAOTGen is used for that.

To enable caching, use

"IRCache": "auto"/"disabled"/"read"/"write"/"readwrite",
"ObjCache": "auto"/"disabled"/"read"/"write"/"readwrite"

This is ready for review, and I propose we merge it as an experimental feature for 2209, with follow ups, further testing and stability fixes planned for 2210, 2211 and 2212

Todo

  • Rework in a generic index file
  • Cleanup & Implement configuration
  • Cleanup object cache / debug changes
  • See what broke tests
  • Update Summary
  • Investigate glmark2 rare crash
  • gimp also crashes

Follow Up

  • Fix #if FIXMEs (mostly around the unused visual debugger, #1960)
  • Make sure thunk relocations work (#1842)
  • Investigating adding some form of balancing in the BSTs? (#1936)
  • Investigate adding a sorted array mode if the BSTs are not dirty (#1936)
  • Further optimise INDEX and DATA advisory locks (#1962)

Merge request reports

Loading