mirror of
https://github.com/lucannez64/darling-lol.git
synced 2026-10-26 19:47:42 +00:00
Game process (ARAM Hexgate: 84 -> 127 FPS average, slowest stretches ~110): - Local pthread mutexes, condition variables and Mach semaphores are on by default in the game process only, with /tmp/rclol-no-local-* opt-outs. The main thread's darlingserver waits fell from 1.36 to 0.10 ms per frame. - Local semaphores: the count and the slot generation change in one compare-exchange, a destroy leaves a negative marker, the table is reset after fork, and names the table did not create go to the server. - Metal: drop identical re-binds (keyed on the Indium object, depth-stencil retained), pass blit resources by reference, and stop resetting vertex descriptors twice. - Core isolation of the main thread is opt-in (/tmp/rclol-core-isolation); it lowered FPS in its only match. - Optimized libc/libc++/Foundation overlays, AVX2 string primitives, real CPU topology and their installers and offline checks. Tools and docs: - tools/riot-match-capture: passive /proc sampler, user-space IP profiler and reports, plus a comparison against the game's netstats. - tools/riot-lsem-model and tools/riot-metal-bind-model: host models that extract the shipped code and check it. - tools/install-riot-metal-pair.sh installs Metal and Indium together. - Status, setup, testing and troubleshooting docs updated with the measured matches and the switch table; manifest file counts match the patches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
84 lines
3.9 KiB
Python
84 lines
3.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Check the Foundation-overlay installer policy in temporary directories.
|
|
|
|
The installer is imported, never executed against a real prefix: temporary SDK,
|
|
prefix and backup directories only. Properties under test: the overlay is
|
|
seeded from the SDK framework, the built binary replaces Versions/C/Foundation
|
|
with a backup of the previous one, re-running is a no-op, and a non-Mach-O
|
|
source is refused.
|
|
"""
|
|
import importlib.util
|
|
import os
|
|
from pathlib import Path
|
|
import tempfile
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
|
|
def load_installer():
|
|
path = ROOT / "tools/install-riot-foundation-runtime.py"
|
|
spec = importlib.util.spec_from_file_location("riot_foundation_installer", path)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
|
|
def write_library(path, fill):
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_bytes(b"\xcf\xfa\xed\xfe" + bytes([fill]) * 4096)
|
|
|
|
|
|
def check():
|
|
installer = load_installer()
|
|
_, defaults = installer.parse_arguments([])
|
|
assert defaults.binary == installer.DEFAULT_ARTIFACT, "default source is not the built artifact"
|
|
assert defaults.backup_dir == ROOT / "build/foundation-runtime-backups", "default backup directory changed"
|
|
|
|
with tempfile.TemporaryDirectory(prefix="riot-foundation-offline-") as directory:
|
|
folder = Path(directory)
|
|
sdk_framework = folder / "sdk/System/Library/Frameworks/Foundation.framework"
|
|
old_binary = sdk_framework / "Versions/C/Foundation"
|
|
write_library(old_binary, 0x22)
|
|
os.symlink("C", sdk_framework / "Versions/Current")
|
|
os.symlink("Versions/Current/Foundation", sdk_framework / "Foundation")
|
|
|
|
framework = folder / "prefix/Users/offline-check/RuntimeFrameworks/Foundation.framework"
|
|
backups = folder / "backups"
|
|
artifact = folder / "riot-Foundation"
|
|
write_library(artifact, 0x11)
|
|
artifact_hash = installer.digest(artifact)
|
|
old_hash = installer.digest(old_binary)
|
|
|
|
# First run: seeds the overlay from the SDK and replaces the binary.
|
|
result = installer.install(artifact, sdk_framework, framework, backups)
|
|
assert result["installed"], "first installation failed"
|
|
installed = framework / "Versions/C/Foundation"
|
|
assert installer.digest(installed) == artifact_hash, "built library not installed"
|
|
assert (framework / "Foundation").is_symlink() and os.readlink(framework / "Foundation") == "Versions/Current/Foundation", "outer symlink not preserved"
|
|
assert (framework / "Versions/Current").is_symlink(), "Current symlink not preserved"
|
|
assert any(installer.digest(path) == old_hash for path in backups.iterdir()), "no backup of the SDK binary staged"
|
|
assert not result["restart_performed"], "installer claims a restart"
|
|
|
|
# Second run: already current, no new backup directory entries.
|
|
before = sorted(path.name for path in backups.iterdir())
|
|
result = installer.install(artifact, sdk_framework, framework, backups)
|
|
assert any(record.get("already_current") for record in result["libraries"]), "re-run not detected as current"
|
|
assert sorted(path.name for path in backups.iterdir()) == before, "re-run changed the backups"
|
|
|
|
# A non-Mach-O source is refused before anything is touched.
|
|
bad = folder / "not-a-library"
|
|
bad.write_bytes(b"not a Mach-O")
|
|
try:
|
|
installer.install(bad, sdk_framework, framework, backups)
|
|
except ValueError as error:
|
|
assert "Mach-O" in str(error), "unexpected rejection reason"
|
|
else:
|
|
raise AssertionError("non-Mach-O source accepted")
|
|
assert installer.digest(installed) == artifact_hash, "refused run changed the installed library"
|
|
|
|
print("FOUNDATION_INSTALLER_OFFLINE pass=1 default_source=artifact overlay_seeded=1 symlinks_preserved=1 backup_staged=1 rerun_noop=1 bad_source_refused=1")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
check()
|