The Bink heap shim duplicates the ERA heap policy #188
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#188
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@raulmoracode on GitHub · 2026-11-21 18:10 UTC · original
Problem
The desktop Bink shim and the ERA heap experiment implement the same
XMemAlloc/XMemFreepolicy twice.src/era_heap.cppdecodes the publicXALLOC_ATTRIBUTESlayout (page size, allocator id, alignment, memory type), aligns heap blocks, zeroes them and releases heap and graphics types.tests/cpu/bink_heap_provider.cppaccepted the single word0x05e50000, allocated withHeapAllocand released withHeapFree, with no alignment or zeroing rule of its own.The two agree today only because the Bink caller happens to request a 32-byte alignment and writes its own headroom. Nothing enforces that they stay in step, and #132 records this as a missing shared contract for shimmed calls.
Proposed change
Serve the binding from
era_heap:windows_allocatecallsera_heap::allocate(bytes, flags)andwindows_releasecallsera_heap::release_with_attributes(base, flags). Keep the profile's own guard (a nonempty payload needs 64 bytes of headroom) and the observer hooks used by the test.This does not widen which words the Bink profile accepts; it makes the allocation and release policy come from the one implementation that decodes the word.
Verification path
bink_heap_check.pygains two direct calls to the binding: a 97- and a 129-byte request with0x05e50000must return a 32-byte-aligned, zeroed block, and the matching release must free it.ctest --preset dev --no-tests=error -R '^(cpu_aot_bink_heap|era_heap_)'covers the binding and the heap scenarios.AI-assisted.