Files
psxrecomp/tools
Matthew Stanley fbc5182947 compile_overlays: parallelize capture compilation (--jobs, default cores-2)
The offline cache build ran one capture at a time - classify, recompiler
subprocess, patch/audit, gcc - so a full coverage-vault rebuild (Tomba 2:
1293 captures) took hours. The wall clock is subprocess-dominated and the
subprocesses release the GIL, so a ThreadPoolExecutor across captures
fills the machine: measured ~24x on the capture-reprocess phase
(6/min -> ~143/min, 24 concurrent recompiler/gcc children).

Concurrency contract:
- cov_lock guards the per-region dedup coverage sets. The
  check->build->update window is deliberately unlocked: concurrent
  captures may build overlapping DLLs - redundancy, never corruption
  (the loader content-matches every function by (entry, code_crc)
  across all DLLs at a region).
- A per-(region, crc32) key lock serializes captures of IDENTICAL bytes,
  which share one dll/ranges filename: the second sees the first build
  (dll-exists skip / prior-ranges merge) exactly as it would sequentially.
- The interior-fragment pass still runs after all captures, reading the
  final on-disk entry coverage (unchanged failure-domain decoupling).
- Per-thread stdout capture prints each capture log as one atomic block.
- --jobs 1 and --static take the exact sequential path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 15:52:12 -07:00
..