runtime: check every field of an ERA attribute word #1744
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1751"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T18:07:22Z.
Refs #1149.
Change
src/era_heap.cppdecode()splits an attribute word with the public ERA layout: objectType:14, pageSize:2, allocatorId:8, alignment:5, memoryType:4 and reserved:31.era_heap_checkread it only through the two recorded words (0x05e50000and0xa8004000). Both leave the object type and the reserved bits at 0.I probed
decodewith 9 single-point mutants:decode_fieldsThe new
decode_fieldsscenario reads:0x3fff, 3,0xff,0x1f,0xf,0x7fffffff);0x2a5c, 2,0xb7,0x13, 9,0x5a5a5a5).A mismatch prints the decoded fields.
era_heap_decode_fields_controlexpects a 13-bit object type and is registered withWILL_FAIL. The new row in theera_heap_*table ofdocs/experiments.mddescribes both.The header and
decodeare not changed.Results
Commit
a992dbaaonorigin/main. Windows 11 Pro 26300.9974, MSVC from Visual Studio,devpreset (Debug):The 10 tests are the eight existing scenarios,
era_heap_decode_fieldsand theWILL_FAILcontrol, with no skips. Each mutant above was applied tosrc/era_heap.cppalone, rebuilt and reverted; the probe script is not committed.docs_links_check.pypasses.AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T18:56:23Z.
Review: COMMENTED
Reviewed at commit
a992dbaaf79d7414e97f572dc441852e5f4cc239(CMakeLists.txt,docs/experiments.md,tests/era_heap_check.cpp).Code Review
tests/era_heap_check.cppaddsdecode_field_checks(bool narrow_object_type)exercising every bit field ofera_heap::decode()(objectType:14,pageSize:2,allocatorId:8,alignment:5,memoryType:4,reserved:31) individually at max width, all-ones, and with distinct mixed values, plus theWILL_FAILnegative control (narrow_object_type=truemaskingwant.object_type &= 0x1fff).CMakeLists.txttouches onlyera_heap_checktest registration (era_heap_decode_fieldsandera_heap_decode_fields_controlwithWILL_FAIL TRUE).docs/experiments.mddocuments the new scenario and negative control cleanly.Verification
git diff --check origin/main...HEAD: pass/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (Checked 17 Markdown files and 365 links.)/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (Checked 1298 tracked source, script and build/CI files: no bidirectional controls.)--preset dev,cmake --build --preset dev --target era_heap_check,ctest --preset dev -R '^era_heap_' --parallel 6 --no-tests=error --output-on-failure): 10/10 passed (0.14s, includingera_heap_decode_fields0.01sandera_heap_decode_fields_control0.01s)/O2(--preset release,cmake --build --preset release --target era_heap_check,ctest --preset release -R '^era_heap_' --parallel 6 --no-tests=error --output-on-failure): 10/10 passed (0.14s, includingera_heap_decode_fields0.02sandera_heap_decode_fields_control0.01s)object_typemask (0x3fff->0xfff) and shiftingreserved(>> 33->>> 32) insrc/era_heap.cpp:era_heap_decode_fieldsfailed (0/1 passed, reportingFAIL: decode object type,memory type,reserved,all ones, andmixed).AI-assisted; commands listed were executed locally.
upstream-sync referenced this pull request2026-11-24 19:01:36 +00:00
Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T19:06:47Z.
Both "survived" mutants reproduce exactly as the PR body says
At
a992dbaa, MSVC 14.44.35207, Windows 11 build 26300.9974. The two new tests register and pass:I then reproduced the two mutants the description lists as survived before this change, rebuilding
era_heap_check.exeeach time (binary timestamp checked) and running the eight old scenarios and the new one separately:
era_heap_decode_fieldsattributes & 0x3fff→attributes & 0xfffattributes >> 33→attributes >> 32That is the claim in the description, confirmed independently: the old fixtures cannot see either change, and the new
scenario kills both. Reverted, all ten pass again.
The negative control is real
era_heap_decode_fields_controlis registered withWILL_FAIL TRUEand expects a 13-bit object type; the widest objecttype in the new scenario makes it fail. Worth keeping, because it is the one test that would still pass if the fixture
stopped producing wide words.
One small thing
The first
ctest --preset dev -NI ran right after checking the branch out did not list either new test; a secondcmake --preset devmade them appear. That was my own sequence (configure ran against the pre-checkoutCMakeLists.txtin the same command), not a property of the change — but it cost me two minutes, so the reproduction in the body might
mention that the configure has to run after the checkout.
Verdict
Reviewed
a992dbaa. The new scenario reads every field at its widest value and one word with a distinct value per field,the two mutants that used to survive are dead, and the
WILL_FAILcontrol is the right shape. No objections.Notes