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