Repository navigation
Fix fragged rows signed-ness regression - #1392
Merged
Aidan63 merged 1 commit intoSep 8, 2026
Merged
Conversation
This was referenced Oct 15, 2026
dimensionscape
added a commit
to openfl/libhxcpp
that referenced
this pull request
Oct 15, 2026
When a collection starts, the collecting thread zeroes every other allocator's spaceEnd (spaceOversize with the nursery) without a lock, in WaitForSafe. CallAlloc read spaceEnd twice when adding an abandoned hole to the block's mFraggedRows, once to check it was above spaceStart and again to subtract, so a collection landing in between gave a negative difference that wrapped the uint16 count. It reads each of them once now. test/gc_stress hit it on Linux in debug builds, where the row-count check traps: 4 of 8 seeds before, none of 8 after. Related: HaxeFoundation/hxcpp#1392, HaxeFoundation/hxcpp#1409 Fixes #92
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a behavioural regression in 952b6ac, which caused the GC to continue allocating more blocks due to
sWorkingMemorySizebecoming corrupted.The problem is that if spaceStart is greater than spaceEnd,
spaceEnd - spaceStartwould give a very largesize_tinstead of a negativeint, and thereforefrag > 0was true andmFraggedRowsgot updated to a random value. This had a domino effect on various variables before corruptingsWorkingMemorySize.hxcpp/src/hx/gc/Immix.cpp
Lines 6293 to 6296 in f05b21c
hxcpp/src/hx/gc/Immix.cpp
Line 877 in f05b21c
hxcpp/src/hx/gc/Immix.cpp
Line 5043 in f05b21c
hxcpp/src/hx/gc/Immix.cpp
Line 5225 in f05b21c
hxcpp/src/hx/gc/Immix.cpp
Line 5235 in f05b21c
hxcpp/src/hx/gc/Immix.cpp
Lines 3607 to 3611 in f05b21c
I haven't looked into whether it even makes sense for spaceStart to be bigger than spaceEnd, but for now this brings back the old logic by skipping the update in that case.