Conversation
- more readable in markdown - remove confusing stuff - linkification - rewording - move parameter documentation to parameter documentation
The zig way is to let the compiler provide errors, rather than trying to implement the compiler in the standard library. I played around with this and found the compile errors to be easier to comprehend without this logic.
Rather than an ArrayList. Provides deduplication.
Some users are hitting this limit. I think it's primarily due to not deduplicating (solved in the previous commit) but this seems like a better limit regardless.
Member
|
Hitting a segfault on Windows after this, will try to investigate more and file an issue (EDIT: Issue filed here: #19408), but here's the reproduction: > zig init
> zig buildthen modify anything in > zig build
thread 19376 panic: Segmentation fault at address 0xffffffffffffffff
C:\Users\Ryan\Programming\Zig\zig\lib\std\Build\Cache.zig:65:46: 0xeeb63c in hash (zig.exe.obj)
return @truncate(std.hash.Wyhash.hash(pp.prefix, pp.sub_path));
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\Build\Cache.zig:323:43: 0xa0117b in hash (zig.exe.obj)
return file.prefixed_path.hash();
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\array_hash_map.zig:1849:28: 0x6f66ee in checkedHash__anon_79003 (zig.exe.obj)
return ctx.hash(key);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\array_hash_map.zig:1634:87: 0x1391d4b in getSlotByIndex__anon_115743 (zig.exe.obj)
const h = if (store_hash) slice.items(.hash)[entry_index] else checkedHash(ctx, slice.items(.key)[entry_index]);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\array_hash_map.zig:1599:45: 0xeebc8f in removeFromIndexByIndexGeneric__anon_105092 (zig.exe.obj)
const slot = self.getSlotByIndex(entry_index, ctx, header, I, indexes);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\array_hash_map.zig:1593:58: 0xa017c1 in removeFromIndexByIndex (zig.exe.obj)
.u8 => self.removeFromIndexByIndexGeneric(entry_index, ctx, header, u8, header.indexes(u8)),
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\array_hash_map.zig:1379:48: 0x6f8707 in shrinkRetainingCapacityContext (zig.exe.obj)
self.removeFromIndexByIndex(i, if (store_hash) {} else ctx, header);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\array_hash_map.zig:1367:55: 0x428a2f in shrinkRetainingCapacity (zig.exe.obj)
return self.shrinkRetainingCapacityContext(new_len, undefined);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\Build\Cache.zig:639:43: 0x2511c2 in unhit (zig.exe.obj)
self.files.shrinkRetainingCapacity(input_file_count);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\Build\Cache.zig:605:27: 0x24f935 in hit (zig.exe.obj)
self.unhit(bin_digest, input_file_count);
^
C:\Users\Ryan\Programming\Zig\zig\src\Compilation.zig:2003:35: 0x2b09ec in update (zig.exe.obj)
const is_hit = man.hit() catch |err| {
^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:4507:24: 0x2e3212 in updateModule (zig.exe.obj)
try comp.update(main_progress_node);
^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:5250:25: 0x36b428 in cmdBuild (zig.exe.obj)
updateModule(comp, color) catch |err| switch (err) {
^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:276:24: 0x18433b in mainArgs (zig.exe.obj)
return cmdBuild(gpa, arena, cmd_args);
^
C:\Users\Ryan\Programming\Zig\zig\src\main.zig:206:20: 0x18151e in main (zig.exe.obj)
return mainArgs(gpa, arena, args);
^
C:\Users\Ryan\Programming\Zig\zig\lib\std\start.zig:484:5: 0x18124a in main (zig.exe.obj)
return callMainWithArgs(@as(usize, @intCast(c_argc)), @as([*][*:0]u8, @ptrCast(c_argv)), envp);
^
C:\Users\Ryan\Programming\Zig\zig\lib\libc\mingw\crt\crtexe.c:267:0: 0x294b7c4 in __tmainCRTStartup (crt2.obj)
mainret = _tmain (argc, argv, envp);
C:\Users\Ryan\Programming\Zig\zig\lib\libc\mingw\crt\crtexe.c:188:0: 0x294b81b in mainCRTStartup (crt2.obj)
ret = __tmainCRTStartup ();
???:?:?: 0x7ffe569f7343 in ??? (KERNEL32.DLL)
???:?:?: 0x7ffe571426b0 in ??? (ntdll.dll)
%errorlevel% -2147483645 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
closes #16149
Contains some bonus enhancements to array hash maps.
Performance
Good news, this appears to make cache hits significantly faster.
Data point: cache hit building hello world with static musl libc