AOT: fix intermittent free() on e08_spread (#24226) - #24269
Merged
Merged
Conversation
__ref__init/addref/delref discarded insertValue results (never stored), and valueDelref bitcast value-box payload storage as a ref header. Together with writeHashtable not retaining the HT, by-value array args corrupted the heap ~43% of the time on e08_spread. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
__ref__aggregate updates:insertValueresults are now stored in__ref__init/__ref__addref/__ref__delref(previously a no-op, so refcounts never hit memory).__value__valueDelrefto load the heap pointer for string/object/hashtable tags only, then clear the type (old codegen bitcast the payload storage as__ref__virtual*).__value__writeHashtableretain likewriteObject; drop redundant call-site addrefs.@differential-repeat: 30one08_spreadso any regress stays honest.Closes #24226
Test plan
php bin/compile.php -o /tmp/e08 test/differential/cases/e08_spread.php &&50× run → 50/50 OK (was ~50%free(): invalid pointer)script/differential-sweep.sh --aot --dir <e08-only> --repeat 30→ok e08_spread.php (30/30 runs)implode(",", $p)+ hello still green under the new refcount pathTRY_FIRST
release-readiness --json:user_release_ready=yes(before change)Note
Non-variadic
function s($v){ implode(",", $v); } s($p)still segfaults early in this workspace — separate from the filed e08 spread/variadic path; not claimed fixed here.Made with Cursor