Compare a source-built x64 EXE with its statically recompiled execution end to end #207

Closed
opened 2026-11-21 18:26:30 +00:00 by R0Y00 · 3 comments
R0Y00 commented 2026-11-21 18:26:30 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:26:30Z.


Add an end-to-end static recompilation comparison using a source-built x64 EXE. Start at the fixture entry, call an internal function and a named DLL import, and exercise two input-dependent results. Launch the native reference and the build containing the translated entry and caller on Windows. Compare import arguments, output bytes and process exit codes for both inputs, including a control that can distinguish the paths. Register the public fixture in Windows CI.

Coordinate fixture inputs with #165 where useful. That issue independently tests native mapping and process startup. This milestone measures execution of statically translated code. Refs #132.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532728126 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/210). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T18:26:30Z. --- Add an end-to-end static recompilation comparison using a source-built x64 EXE. Start at the fixture entry, call an internal function and a named DLL import, and exercise two input-dependent results. Launch the native reference and the build containing the translated entry and caller on Windows. Compare import arguments, output bytes and process exit codes for both inputs, including a control that can distinguish the paths. Register the public fixture in Windows CI. Coordinate fixture inputs with #165 where useful. That issue independently tests native mapping and process startup. This milestone measures execution of statically translated code. Refs #132.
R0Y00 commented 2026-11-24 06:47:50 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-21T18:41:40Z.


Taking the integration for #210. @yummancito, thanks for the CRT-free child-process result in #165. I checked your public fork; the startup fixture is still local. I will keep the ordinary Windows launch and 0x60d as one reference case, and reuse the merged MASM caller and named mix_args provider for the two-input AOT check. If your fixture becomes public during this work, please link it here so we can reuse the shared parts. Your mapped-startup and TLS work stays in #165.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067442374 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/210#issuecomment-7067442374). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-21T18:41:40Z. --- Taking the integration for #210. @yummancito, thanks for the CRT-free child-process result in #165. I checked your public fork; the startup fixture is still local. I will keep the ordinary Windows launch and 0x60d as one reference case, and reuse the merged MASM caller and named mix_args provider for the two-input AOT check. If your fixture becomes public during this work, please link it here so we can reuse the shared parts. Your mapped-startup and TLS work stays in #165.
RonLogic commented 2026-11-24 06:47:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-21T18:48:05Z.


Independent Windows x64 check for the internal-call and named-import sequence in this milestone.

I built a small MASM DLL locally. Its exported function calls an internal local_mix(x, y) that returns x + y, then passes x and that sum to the existing cpu_import_provider!mix_args through the import table. Native execution produced these results:

Inputs Trace Return
(3, 5) (3, 8, 6) 6
(7, 8) (7, 15, 3) 3

Running cpu_call_aot.py on the same DLL with --bind for mix_args exited with status 1 at the second call, RVA 0x102d:

  • main (e8895ad): unexpected additional call. All 6 selected direct-call, import-call, and xmem tests passed.
  • #219 (331eb8c): call to a second target. All 4 selected tests passed, including 249 native comparisons for repeated calls to the same import.
  • #223 (b796779): mixed import and direct calls. All 5 selected tests passed, including 249 input pairs for two distinct direct callees and the swapped order.

The PR heads were tested separately. The mixed-call rejection matches the scope requested for their combined change. This DLL isolates the call sequence for the EXE milestone. I can share the fixture source or rerun it on the combined branch when it is ready.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067522695 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/210#issuecomment-7067522695). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-21T18:48:05Z. --- Independent Windows x64 check for the internal-call and named-import sequence in this milestone. I built a small MASM DLL locally. Its exported function calls an internal `local_mix(x, y)` that returns `x + y`, then passes `x` and that sum to the existing `cpu_import_provider!mix_args` through the import table. Native execution produced these results: | Inputs | Trace | Return | | --- | --- | --- | | `(3, 5)` | `(3, 8, 6)` | `6` | | `(7, 8)` | `(7, 15, 3)` | `3` | Running `cpu_call_aot.py` on the same DLL with `--bind` for `mix_args` exited with status 1 at the second call, RVA `0x102d`: - `main` (`e8895ad`): `unexpected additional call`. All 6 selected direct-call, import-call, and `xmem` tests passed. - #219 (`331eb8c`): `call to a second target`. All 4 selected tests passed, including 249 native comparisons for repeated calls to the same import. - #223 (`b796779`): `mixed import and direct calls`. All 5 selected tests passed, including 249 input pairs for two distinct direct callees and the swapped order. The PR heads were tested separately. The mixed-call rejection matches the scope requested for their combined change. This DLL isolates the call sequence for the EXE milestone. I can share the fixture source or rerun it on the combined branch when it is ready.
Spaghetih commented 2026-11-24 06:47:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by Spaghetih on 2026-11-21T19:08:26Z.


Independent run of the merged EXE reference on a Windows 11 client. This complements the Windows 10 19045 run requested above.

Commit f85723e (current main, includes #228, #219 and #223). Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.14.6, pefile 2024.8.26, iced-x86 1.21.0.

cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^cpu_aot_exe_entry$' -V
selector=0 import=(0x100000303, 0xfffffffd) output=1103000000000000 exit=0x60d (inversion detected)
selector=1 import=(0x30, 0x6) output=3500000000000000 exit=0x57 (inversion detected)
1/1 Test #82: cpu_aot_exe_entry ................   Passed    0.77 sec

Both rows match the expected import arguments, output bytes and exit codes.

On the call sequence @RonLogic isolated: on f85723e, tools/cpu_call_aot.py:64 still rejects a function that makes both a direct call and an import call (mixed import and direct calls). If that sequence is in scope for this milestone and nobody already has it on a branch, I can take it. The shared interface is the call loop in cpu_call_aot.py and its --bind contract. I would reuse the merged mix_args provider and the #223 direct-callee fixture rather than add a third pattern. I will wait for a go-ahead or a pointer to the combined branch before writing code, to avoid a duplicate.

AI-assisted (Claude Code). The run above was executed locally on the configuration listed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7067791567 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/210#issuecomment-7067791567). Originally posted by [Spaghetih](https://github.com/Spaghetih) on 2026-11-21T19:08:26Z. --- Independent run of the merged EXE reference on a Windows 11 client. This complements the Windows 10 19045 run requested above. Commit `f85723e` (current `main`, includes #228, #219 and #223). Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100, Python 3.14.6, `pefile` 2024.8.26, `iced-x86` 1.21.0. ```powershell cmake --preset dev cmake --build --preset dev ctest --preset dev --no-tests=error -R '^cpu_aot_exe_entry$' -V ``` ```text selector=0 import=(0x100000303, 0xfffffffd) output=1103000000000000 exit=0x60d (inversion detected) selector=1 import=(0x30, 0x6) output=3500000000000000 exit=0x57 (inversion detected) 1/1 Test #82: cpu_aot_exe_entry ................ Passed 0.77 sec ``` Both rows match the expected import arguments, output bytes and exit codes. On the call sequence @RonLogic isolated: on `f85723e`, `tools/cpu_call_aot.py:64` still rejects a function that makes both a direct call and an import call (`mixed import and direct calls`). If that sequence is in scope for this milestone and nobody already has it on a branch, I can take it. The shared interface is the call loop in `cpu_call_aot.py` and its `--bind` contract. I would reuse the merged `mix_args` provider and the #223 direct-callee fixture rather than add a third pattern. I will wait for a go-ahead or a pointer to the combined branch before writing code, to avoid a duplicate. _AI-assisted (Claude Code). The run above was executed locally on the configuration listed._
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#207
No description provided.