Created
February 24, 2020 16:07
-
-
Save niner/3b8716dfc739abe669e39d70028b9e6f to your computer and use it in GitHub Desktop.
This file contains 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
diff --git a/src/core.c/CompUnit/PrecompilationRepository.pm6 b/src/core.c/CompUnit/PrecompilationRepository.pm6 | |
index 6680da21b..329253926 100644 | |
--- a/src/core.c/CompUnit/PrecompilationRepository.pm6 | |
+++ b/src/core.c/CompUnit/PrecompilationRepository.pm6 | |
@@ -20,6 +20,7 @@ class CompUnit { ... } | |
class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationRepository { | |
has CompUnit::PrecompilationStore $.store; | |
my %loaded; | |
+ my %resolved; | |
my $loaded-lock = Lock.new; | |
my $first-repo-id; | |
@@ -124,11 +125,19 @@ class CompUnit::PrecompilationRepository::Default does CompUnit::PrecompilationR | |
$RMD("dependency: $dependency") if $RMD; | |
if $resolve { | |
- my $comp-unit = $repo.resolve($dependency.spec); | |
- $RMD("Old id: $dependency.id(), new id: {$comp-unit.repo-id}") if $RMD; | |
- return False unless $comp-unit and $comp-unit.repo-id eq $dependency.id; | |
+ $loaded-lock.protect: { | |
+ %resolved{$dependency.serialize} //= do { | |
+ my $comp-unit = $repo.resolve($dependency.spec); | |
+ $RMD("Old id: $dependency.id(), new id: {$comp-unit.repo-id}") if $RMD; | |
+ return False unless $comp-unit and $comp-unit.repo-id eq $dependency.id; | |
+ True | |
+ }; | |
+ } | |
} | |
+ $loaded-lock.protect: { | |
+ next if %loaded{$dependency.id}:exists; | |
+ } | |
my $dependency-precomp = @precomp-stores | |
.map({ $_.load-unit($compiler-id, $dependency.id) }) | |
.first(*.defined) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment