| ... | ... | @@ -90,9 +90,6 @@ modules: std.StringArrayHashMap(*Module), |
| 90 | 90 | |
| 91 | 91 | named_writefiles: std.StringArrayHashMap(*Step.WriteFile), |
| 92 | 92 | named_lazy_paths: std.StringArrayHashMap(LazyPath), |
| 93 | | /// A map from build root dirs to the corresponding `*Dependency`. This is shared with all child |
| 94 | | /// `Build`s. |
| 95 | | initialized_deps: *InitializedDepMap, |
| 96 | 93 | /// The hash of this instance's package. `""` means that this is the root package. |
| 97 | 94 | pkg_hash: []const u8, |
| 98 | 95 | /// A mapping from dependency names to package hashes. |
| ... | ... | @@ -125,6 +122,7 @@ pub const Graph = struct { |
| 125 | 122 | host: ResolvedTarget, |
| 126 | 123 | incremental: ?bool = null, |
| 127 | 124 | random_seed: u32 = 0, |
| 125 | dependency_cache: InitializedDepMap = .empty, |
| 128 | 126 | }; |
| 129 | 127 | |
| 130 | 128 | const AvailableDeps = []const struct { []const u8, []const u8 }; |
| ... | ... | @@ -144,7 +142,7 @@ const SystemLibraryMode = enum { |
| 144 | 142 | declared_enabled, |
| 145 | 143 | }; |
| 146 | 144 | |
| 147 | | const InitializedDepMap = std.HashMap(InitializedDepKey, *Dependency, InitializedDepContext, std.hash_map.default_max_load_percentage); |
| 145 | const InitializedDepMap = std.HashMapUnmanaged(InitializedDepKey, *Dependency, InitializedDepContext, std.hash_map.default_max_load_percentage); |
| 148 | 146 | const InitializedDepKey = struct { |
| 149 | 147 | build_root_string: []const u8, |
| 150 | 148 | user_input_options: UserInputOptionsMap, |
| ... | ... | @@ -252,8 +250,6 @@ pub fn create( |
| 252 | 250 | available_deps: AvailableDeps, |
| 253 | 251 | ) !*Build { |
| 254 | 252 | const arena = graph.arena; |
| 255 | | const initialized_deps = try arena.create(InitializedDepMap); |
| 256 | | initialized_deps.* = InitializedDepMap.initContext(arena, .{ .allocator = arena }); |
| 257 | 253 | |
| 258 | 254 | const b = try arena.create(Build); |
| 259 | 255 | b.* = .{ |
| ... | ... | @@ -304,7 +300,6 @@ pub fn create( |
| 304 | 300 | .modules = .init(arena), |
| 305 | 301 | .named_writefiles = .init(arena), |
| 306 | 302 | .named_lazy_paths = .init(arena), |
| 307 | | .initialized_deps = initialized_deps, |
| 308 | 303 | .pkg_hash = "", |
| 309 | 304 | .available_deps = available_deps, |
| 310 | 305 | .release_mode = .off, |
| ... | ... | @@ -398,7 +393,6 @@ fn createChildOnly( |
| 398 | 393 | .modules = .init(allocator), |
| 399 | 394 | .named_writefiles = .init(allocator), |
| 400 | 395 | .named_lazy_paths = .init(allocator), |
| 401 | | .initialized_deps = parent.initialized_deps, |
| 402 | 396 | .pkg_hash = pkg_hash, |
| 403 | 397 | .available_deps = pkg_deps, |
| 404 | 398 | .release_mode = parent.release_mode, |
| ... | ... | @@ -2127,10 +2121,10 @@ fn dependencyInner( |
| 2127 | 2121 | args: anytype, |
| 2128 | 2122 | ) *Dependency { |
| 2129 | 2123 | const user_input_options = userInputOptionsFromArgs(b.allocator, args); |
| 2130 | | if (b.initialized_deps.get(.{ |
| 2124 | if (b.graph.dependency_cache.getContext(.{ |
| 2131 | 2125 | .build_root_string = build_root_string, |
| 2132 | 2126 | .user_input_options = user_input_options, |
| 2133 | | })) |dep| |
| 2127 | }, .{ .allocator = b.graph.arena })) |dep| |
| 2134 | 2128 | return dep; |
| 2135 | 2129 | |
| 2136 | 2130 | const build_root: std.Build.Cache.Directory = .{ |
| ... | ... | @@ -2155,10 +2149,10 @@ fn dependencyInner( |
| 2155 | 2149 | const dep = b.allocator.create(Dependency) catch @panic("OOM"); |
| 2156 | 2150 | dep.* = .{ .builder = sub_builder }; |
| 2157 | 2151 | |
| 2158 | | b.initialized_deps.put(.{ |
| 2152 | b.graph.dependency_cache.putContext(b.graph.arena, .{ |
| 2159 | 2153 | .build_root_string = build_root_string, |
| 2160 | 2154 | .user_input_options = user_input_options, |
| 2161 | | }, dep) catch @panic("OOM"); |
| 2155 | }, dep, .{ .allocator = b.graph.arena }) catch @panic("OOM"); |
| 2162 | 2156 | return dep; |
| 2163 | 2157 | } |
| 2164 | 2158 | |