BatSmacker84 on old upstream PR 7998:
- The summary line now separates indirect vtable calls, indirect vtable tail jumps, and sites
through a verified dispatch routine. The JSON gains calls, tail_jumps and dispatch_sites. On the
1.0.2.1 executable: 95 sites = 94 calls + 1 tail jump (slot 2), 0 through a dispatch routine.
- "lists every" and "lower bound" are gone from the docstring, the help text and §5. The tool reports
the statically resolved sites for the device paths it follows; a slot without a row isn't shown
to be uncalled.
tupacfan04's secondary points from the review of the dispatch-routine commit, still open until now:
- A creator out-pointer in an object member was labelled "memory slot", yet it was dropped at the
next call. It is now "object member (followed until the next call)"; a stack slot is "stack slot".
- The no-.pdata window walk is tested, and it now goes on past a ret while a forward branch target
is still ahead.
- Conditional branches have tests: the device carried past an early return, and a join where only
one path holds the device.
Census unchanged: 95 sites across 42 slots, 12 not resolved. 15 tests pass.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every E9 was a tail call, including the `jmp rel32` MSVC emits for a long branch inside a function.
With the device in an argument register, such a jump counted as the device passed to another call,
it cleared the state, and it ended a window walk early (YordiLorenzo, pr-sorter). Slot 14 dropped out
of the fixture with pr-sorter's patch.
The walk now follows forward branches. A `jmp` (E9 or EB) or a conditional branch to a later
address in the walked range carries the known state to its target. There it is met with the
fall-through's state, keeping a fact only when both paths agree (vtable loads from either path are
merged). Past a `ret` or unconditional jump, the carried state replaces it. A jump back into the range
(a loop) carries nothing and isn't a tail call. Only a `jmp` out of the range is a tail call.
pr-sorter's repro is a test, together with the short form and a backward jump.
Census on the 1.0.2.1 executable: 83 -> 95 sites, still 42 slots, with no site or slot lost. 12 more
sites are behind a conditional branch around an early return: slot 17 (+5), slot 24 (+5), slot 133
(+2). Not resolved stays at 12: vtable loads with no matched call 2 -> 1, calls handed the device
9 -> 10, stores 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A direct call with a method pointer left in rax was counted as that slot whatever the call reached,
so a helper that only returns made a slot appear (shdann's repro on old upstream PR 7998). The target, or for
`call [rip+p]` the code the file's pointer p holds, must now reach `jmp rax` or `call rax` within 16
instructions without writing rax, calling or returning first (conditional branches allowed): the CFG
no-op dispatch and a guard check that ends in `jmp rax`. Verified targets are cached. Any other
target goes to a new "dispatch calls to unverified targets" count, never a slot.
The fixture's GUARD pointer now holds a `jmp rax` stub; new functions call a guard-check stub (slot
counted) and a helper that only returns (not counted, reported as not resolved), and shdann's patch
is a test. The census on the 1.0.2.1 executable is unchanged: all 83 sites are `call [vtable+disp]`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/d3d12_device_calls.py follows D3D12XboxCreateDevice's (or D3D12CreateDevice's) out-pointer to
the globals and stack slots that hold the device, and counts per vtable slot the `mov v,[device]` then
`call [v+disp]` / `call reg` / dispatch-with-rax sites, with the register that holds the device (rcx,
or rdx for the console's return-buffer form) and an argument-count estimate. What it can't follow
(vtable loads with no matched call, the device handed to other functions or stored to non-stack
memory, creator out-pointers it can't follow) is counted, not guessed. Slots 0-43 carry the PC
method names; past 43 only the slots the repository has measured are named.
The text report holds slot numbers and counts only; --out is required. Tested on a hand-built PE
(tests/test_d3d12_device_calls.py); docs/retail_boot_chain.md §5 has the method and its limits.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>