Partially load modules from compiler cache, handling possible race condition #440
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.
Motivation and Context
See #414 for motivation behind commits 65b622c, f0747ba, 12e35a8.
These commits introduced an issue where if two processes working in parallel generated the same function in different cache modules, our assumptions about the module -> function mapping would break and the functions would not be properly linked. (Previously this would be dealt with by marking one of the modules invalid). Commit ffd7492 handles this by maintaining a function name and a (realized name / link name / instance name), and using the latter internally.
Approach
Key approach here was ensuring that the concept of a link name did not leak outside the cache - cache users should not need to have any notion of which modules a given function is in.
How Has This Been Tested?
We use a MockDirectory class (written by @guslonergan ) to generate versions of the cache with multiple modules containing the same function, approximating the state of the cache following a race.
Types of changes
Checklist: