Repository navigation
bugc: test exit counts, tail calls, and exits without data - #350
Merged
Merged
Conversation
Contributor
|
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.
Follow-up to #349, closing test gaps found in its review. Tests only.
expectExitsinoptimizer-contexts.test.tscompared only the names of functions with an exitreturn, so a secondreturnon another JUMP in the same function would pass unnoticed. It now takes exact counts per function. The counts followreturnterminators in the IR, which can be one more than the source shows: an if/else whose branches both return leaves an empty merge block with an implicit void return, until the optimizer drops it at O2. I checked the counts forfact,checkand the others against the IR blocks.call-timing.test.tsgains a tail-call program (count/succ). From O2 the back-edge JUMP carries areturnwith nodataand the frame depth stays constant, which the replay now covers against real traces. It also asserts that no exit with areturnand nodatais ever executed. Those exits are the empty merge blocks above at O0 and O1.On whether a reachable exit can lack
data: not through any code the tests use, and the check above fails if one is reached. A void function cannot be called (its call has a failure type), so the only way to reach a void return in a value-returning function is to run off its end, which the type checker accepts today without a diagnostic. That is a missing-return check, not a context bug, so it is left out of this PR.