Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loop bug(s) in recursion checking #234

Merged
merged 3 commits into from
May 9, 2023
Merged

Conversation

dburgener
Copy link
Owner

The first commit is just a minor reordering to 1. Prepare to totally rewrite search_for_recursion() on top of the call tree added recently and 2. Delay the performance hit associated with it until later, in case there are errors earlier in compilation.

The second commit turns the infinite loop we were seeing on alias conflicts into an internal error. This should help detect any future bugs in this area more easily.

The final commit is the real fix, which checks for alias conflicts and reports an error. The error handling is an extremely awkward dance with a performance hit, as described in the commit message. We should get everything back in terms of both code complexity and performance once we implement #219.

dburgener added 3 commits May 5, 2023 17:38
This will allow future optimizations to take advantage of the call tree
built during validate_functions() to improve performance
If for some reason, remove() doesn't remove something, then we'll keep
trying to remove it infinitely.  remove() should never fail in this
contexts in the absence of Cascade bugs.

Transform the infinite loop bugs in this case into InternalErrors for
easiest discoverability and debugging in the event that something has
gone wrong.
The actual validation and error reporting part here is straightforward.
Most of the complexity of this commit comes from tracking the file the
alias is declared in through to the error site.  That is both complex,
and will likely hurt performance due to file clone()s in a non-error
path.

The good news is that we'll likely get all the performance back, and
reduce code complexity once we implement #219.  When we do that, it's
probably worth revisiting this commit to make sure everything is cleaned
up appropriately and we're not tracking files around for no reason.
@dburgener dburgener merged commit fefd435 into main May 9, 2023
@dburgener dburgener deleted the dburgener/recursion branch May 9, 2023 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant