Repository navigation
Conversation
startCompile cancels the previous generation's run, and the run's finalizer cancels its running stages. Stage threads start under the coordinator's mask and inherit it. So do the threads that a stage starts, such as the type checker's workers and its progress reporter. A masked thread receives a cancel only where it blocks. The parse and the front passes are pure evaluation, forced with evaluate and force, and do not block. A stage's parse now runs under interruptible. So does the checking part of its front passes: building the environment, kinds, types, forcing the type check's results, escape analysis and hashing. interruptible unmasks only these passes, and every thread they start inherits the unmasked state. What a stage commits keeps the coordinator's mask: the .tydb, the doc and --tydb copy outputs, and the module cache entry. That masked region runs from the .tydb commit through the cache update with no unmasked gap in between. The front stage of a cached module whose dependencies changed parses the source again, and that parse also runs under interruptible. Before: the LSP server and acton watch call startCompile on every edit or save. startCompile holds the scheduler's MVar while it cancels the previous run, and the cancel waited until every running parse and type check of that run had finished. An edit made during a long type check blocked the LSP handler or watch for the rest of that check, before the debounce delay even started. stopCompile, and a failed front stage that cancels its dependents' parse stages, waited the same way. After: a cancel stops running parse and check passes where they are. startCompile returns without waiting for them, and the debounce starts at once. Unchanged: a run still waits for every background output its stages started before it ends, and a stale generation still writes nothing. A stage's commit keeps the coordinator's mask, so a cancel still reaches it only where it blocks. Test 61 in the incremental suite fails without this change.
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.
Stage threads run masked, and the parse and type check passes never block, so a cancel waited until a running check finished. In the LSP server and acton watch, every edit made during a long type check blocked until then.
The parse and check passes now run interruptible, so a cancel stops them where they are. The .tydb commit, the outputs and the module cache update stay masked.