Commit Graph

4 Commits

Author SHA1 Message Date
f85de7d953 gen_gdk_runtime_classes: write --out atomically
Write the generated JSON to a temporary file in the destination directory, then atomically replace the output. Remove the temporary file on write errors and preserve output permissions.

Before: with 128 synthetic classes and an existing 14-byte output, `bash -c 'trap "" XFSZ; ulimit -f 1; python3 -I tools/gen_gdk_runtime_classes.py /home/hampa/.hermes/profiles/mikuling/cache/scratch/gdk-atomic-repro/docs --out /home/hampa/.hermes/profiles/mikuling/cache/scratch/gdk-atomic-repro/out.json'` returned 1 (Errno 27, File too large); output grew to 1024 bytes (partial JSON).

After: the same command returned 1, left the 14-byte sentinel unchanged, and left no temporary file. Tests against upstream/main: 1 failed, 2 passed; against the fix: 3 passed.
2026-11-25 08:10:38 +01:00
47f6878e93 gen_gdk_runtime_classes: create missing parent directory for --out 2026-11-24 09:14:26 +05:00
33905dc9dd Fix what the round-43 merges broke (pytest)
Merges that each passed alone but clash together:
- v_cmp_class_f64: the earlier cmp_class_f64 (685d16ed9) (operand-form checks, test_cmp_class_f64) and the later f64 branch
  in cmp_class both handled the opcode; f64 goes to cmp_class_f64 again, f16 stays in cmp_class.
- rdna2spirv CLI tests: spirv-as/spirv-val now run in the output folder with the staging file's bare name, so
  the test doubles resolve it against cwd; assemble_spirv decodes the output only when it is bytes. (The doubles
  had been writing .spirv-*.tmp files into the repository root.)
- ps_w64 fixtures (TEST-722): an 18th fixture (ps_w64_a_discard) landed; its killed lanes export nothing and
  keep the clear value.
- first_light: a run without an OBJ removes mesh.bin, and harness_env reads manifest["files"]; batch_glb's stats
  name failures and dropped textures; run_gpu_tests reports a frame never written as a missing readback
  (TEST-837).
- make_game TRANSLATION_SOURCES and runtime.yml's paths include spirv_opt.py and report_paths.py (and
  wave64_emulate_opt.py), which the translator imports.
Repo rules: stdout guard on six tools; encoding on two opens (gen_gdk_runtime_classes' helper is read_utf8);
newline on one write; anim_skeleton_match's joaat encodes like hashdict.joaat; test_feature_scan's new test is
listed with the others its globals() runner reaches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:07:41 -05:00
95f822d11b Add gdk_runtime_calls: list the runtime classes and slots an image calls through xgameruntime.lib
A title linked with xgameruntime.lib imports no GDK function: each thunk asks
QueryApiImpl (through a helper) for a class and interface, calls one vtable
slot and releases the object. tools/gdk_runtime_calls.py finds those thunks in
a PE without running it: the helper a known id's lea feeds, every call to it,
the class id in rcx and the interface id in rdx (unknown ids reported as such,
calls whose ids it can't read listed) and each slot called up to Release (CFG
dispatch, call [r+disp8/disp32], any vtable register, register copies
followed), scoped by .pdata or a byte window. Slots are named from
tools/gdk_runtime_classes.json (ids, inheritance and method order of
xgameruntime-docs, GPL-3.0, facts only; made by
tools/gen_gdk_runtime_classes.py). The report flags classes
runtime/shims/xgameruntime.cpp serves, estimates argument counts, says whether
anything in the image reaches each thunk, and lists known ids no thunk uses.
Text by default, --json, --out DIR.

Measured on the package: XCurl.dll and the four classes read by hand in
libHttpClient.GDK.dll match the slots in docs/runtime_imports.md.
libHttpClient holds the ids of 23 of the 24 documented classes (not
XGameActivationImpl's) and thunks for all 23, but is incrementally linked and
references only 15 of its 404 thunks (XThreadingImpl, XErrorImpl); the
module table now says so instead of "24 of 24, five called through thunks".
scripts/first_look.ps1 runs the tool on the executable, and the day-one
checklist in docs/design.md points at its report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:28:05 +00:00