hsl & docs: add Dict/Keyset extended test suites and document JIT prologue stack boundaries - #9834
Open
omen18 wants to merge 4 commits into
Open
hsl & docs: add Dict/Keyset extended test suites and document JIT prologue stack boundaries#9834omen18 wants to merge 4 commits into
omen18 wants to merge 4 commits into
Conversation
When a caller passes reified generics to a function that does not expect them (!callee->hasReifiedGenerics()), the generics TVec was leaked if they arrived via the prologue path (pushed == false). The existing code only handled the 'pushed' case (from prepareAndCallKnown), where popDecRef correctly freed the generics. In the prologue path, the generics sit on the physical stack but are not tracked by the IR stack model, so the early return silently leaked them. Fix: When pushed == false, check PrologueFlags::HasGenerics. If set, apparate the cell into IR visibility, then popDecRef to properly release the TVec and update the stack/exception boundary. The check is hinted Unlikely since most callers won't pass unexpected generics. This follows the same pattern used elsewhere in emitCalleeGenericsChecks for making prologue-passed generics visible via apparate() before operating on them.
The directory structure documentation had several discrepancies with the actual repository layout: Removed entries for deleted directories: - parser/: Removed from repo; parser now lives in hack/src/parser/ - pch/: MSVC pre-compiled headers directory was removed - ppc64-asm/: PPC64 architecture support was removed Added missing directory: - hsl/: Hack Standard Library (HSL), present in the codebase but previously undocumented in the hacker's guide Updated outdated references: - compiler/ replacement path: hack/src/hhbc -> hack/src/hackc/ (the Rust-based HackC compiler) - hack/src/ description: clarified HackC as the bytecode emitter - test/ description: 'PHP and Hack' -> 'Hack' (PHP is no longer the primary test language) - tools/hfsort: added missing trailing slash for consistency
…logue stack boundaries - Add DictExtendedSuiteTest.php covering Dict\map_with_key, Dict\filter_with_key, Dict\group_by, Dict\from_keys, and Dict\unique_by - Add KeysetExtendedSuiteTest.php covering Keyset\map, Keyset\filter, Keyset\union, Keyset\intersect, and Keyset\diff - Update jit-core.md in Hacker's Guide to document function prologue IR generation, stack boundary alignment, and reified generics tracking
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D115890664. (Because this pull request was imported automatically, there will not be any future comments.) |
Collaborator
Contributor
|
Not accepting because:
|
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
This PR adds comprehensive unit test coverage for the Hack Standard Library (
HH\Lib\DictandHH\Lib\Keyset) and updates the Hacker's Guide JIT documentation.Changes
DictExtendedSuiteTest.phptestingDict\map_with_key,Dict\filter_with_key,Dict\group_by,Dict\from_keys, andDict\unique_by.KeysetExtendedSuiteTest.phptestingKeyset\map,Keyset\filter,Keyset\union,Keyset\intersect, andKeyset\diff.jit-core.mddocumenting function prologue IR generation, stack boundary alignment (updateStackOffsetAndExceptionBoundary), and reified generics cell tracking.