-
-
Notifications
You must be signed in to change notification settings - Fork 414
Optimise module to filename #4600
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
Draft
guibou
wants to merge
18
commits into
master
Choose a base branch
from
optimise_module_to_filename
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+224
−138
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
dcbe163
nix shell
guibou 98d16f3
refactor: WIP. Module name to filepath optimisation
guibou 3426ffc
wip: remove the normalized target
guibou ef0a92d
fix: do not crash when some include path does not exists
guibou 9b9a4f4
fix: find module not yet written on disk but are part of known files
guibou 81b4db6
chore: clean comments / unused symbols
guibou 2b5a332
chore: clean unused symbols
guibou a863041
chore: clean unused symbols
guibou 066f82b
fix: clean naming and hopefully handle -boot files from known targets
guibou 0618c70
multiples robustness cleanup when there are multiples target for one
guibou 8d87214
Fix path comparison using normalize
guibou 3e7f043
Module map and source map were inverted.
guibou 5c1d301
fix: remove the unsafePerformIO and head usage
guibou fabe3c4
WIP fix: do not check for file existance when added to the context and
guibou 5dd978e
Clean path comparison
guibou 15c312d
Only integrate known target in the cache once
guibou f250efa
Run stylish-haskell
guibou 550ba22
Clean a bit the reexport logic and try to fix it
guibou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fendor, this is the offending change.
When
extendKnownTargetsis called with files which are not yet available on disk, theTargetFile fcontains a file (either.hsor.hs-boot) andtargetLocationscontains a list of files and it seems that it always contains the.hsand.hs-boot.However, these file do not exist on the disk, so the
filterMalways filter them out.This "fix" allows the file to be added.
The bug is certainly NOT here, see #4754 for more details.
My current understanding is that there is a caching process which, when a
.hsor.hs-bootfile is registered, it callsextendKnownTargetswith both.hsand.hs-bootfiles listed intargetLocations, but only the.hsor.hs-bootinTargetFile f.However, it seems that there is some sort of caching which once a
.hs-bootfile or.hsfile is registered, it blocks registration for the other file.It means that depending on the registration order, we may end up with only one or the other file in the
knownTarget.The result is that during module name to filename association (the target of this MR), we won't be able to find either the
.hsor the.hs-bootfile, because we look into theknownTargetmap for them.Note that I don't understand why it was not failing before, because the previous implementation was actually looking in the
knownTargettoo, and on the filesystem. But for files not on the filesystem (as it is the case for tests and newly created files), it seems that the previous implementation was behaving the same.My guess is that, because it seems that it is a race, my change had an impact on the way
extendKnownTargetsis called concurrently and as a result the problem appears more often. But I had not been able to confirm that the issue was there before my MR.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to extendKnownTargets, we should do so in the
restart thread, see Note [Serializing runs in separate thread] . Otherwise we risk of destablizing the build system.For the .hs or .hs-boot mess, one of the possible solution, we can update the sessionLoader to invalidate related cache and consult the cradle again if the missing .hs or .hs-boot is added.