| ... | ... | @@ -510,11 +510,11 @@ pub const InitOptions = struct { |
| 510 | 510 | fn addPackageTableToCacheHash( |
| 511 | 511 | hash: *Cache.HashHelper, |
| 512 | 512 | arena: *std.heap.ArenaAllocator, |
| 513 | | pkg_table: Package.Table, |
| 513 | package: *Package, |
| 514 | 514 | hash_type: union(enum) { path_bytes, files: *Cache.Manifest }, |
| 515 | 515 | ) (error{OutOfMemory} || std.os.GetCwdError)!void { |
| 516 | 516 | const allocator = &arena.allocator; |
| 517 | | |
| 517 | const pkg_table = package.table; |
| 518 | 518 | const packages = try allocator.alloc(Package.Table.Entry, pkg_table.count()); |
| 519 | 519 | { |
| 520 | 520 | // Copy over the hashmap entries to our slice |
| ... | ... | @@ -547,7 +547,8 @@ fn addPackageTableToCacheHash( |
| 547 | 547 | }, |
| 548 | 548 | } |
| 549 | 549 | // Recurse to handle the package's dependencies |
| 550 | | try addPackageTableToCacheHash(hash, arena, pkg.value.table, hash_type); |
| 550 | if (package != pkg.value) |
| 551 | try addPackageTableToCacheHash(hash, arena, pkg.value, hash_type); |
| 551 | 552 | } |
| 552 | 553 | } |
| 553 | 554 | |
| ... | ... | @@ -885,7 +886,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 885 | 886 | { |
| 886 | 887 | var local_arena = std.heap.ArenaAllocator.init(gpa); |
| 887 | 888 | defer local_arena.deinit(); |
| 888 | | try addPackageTableToCacheHash(&hash, &local_arena, root_pkg.table, .path_bytes); |
| 889 | try addPackageTableToCacheHash(&hash, &local_arena, root_pkg, .path_bytes); |
| 889 | 890 | } |
| 890 | 891 | hash.add(valgrind); |
| 891 | 892 | hash.add(single_threaded); |
| ... | ... | @@ -908,6 +909,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation { |
| 908 | 909 | |
| 909 | 910 | const builtin_pkg = try Package.create(gpa, zig_cache_artifact_directory.path.?, "builtin2.zig"); |
| 910 | 911 | try root_pkg.add(gpa, "builtin", builtin_pkg); |
| 912 | try root_pkg.add(gpa, "root", root_pkg); |
| 911 | 913 | |
| 912 | 914 | // TODO when we implement serialization and deserialization of incremental compilation metadata, |
| 913 | 915 | // this is where we would load it. We have open a handle to the directory where |
| ... | ... | @@ -3203,7 +3205,7 @@ fn updateStage1Module(comp: *Compilation, main_progress_node: *std.Progress.Node |
| 3203 | 3205 | { |
| 3204 | 3206 | var local_arena = std.heap.ArenaAllocator.init(comp.gpa); |
| 3205 | 3207 | defer local_arena.deinit(); |
| 3206 | | try addPackageTableToCacheHash(&man.hash, &local_arena, mod.root_pkg.table, .{ .files = &man }); |
| 3208 | try addPackageTableToCacheHash(&man.hash, &local_arena, mod.root_pkg, .{ .files = &man }); |
| 3207 | 3209 | } |
| 3208 | 3210 | man.hash.add(comp.bin_file.options.valgrind); |
| 3209 | 3211 | man.hash.add(comp.bin_file.options.single_threaded); |