ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
reductum has joined #zig
schme245 has joined #zig
shawn_ has quit [Read error: Connection reset by peer]
schme245 has quit [Ping timeout: 255 seconds]
reductum has quit [Quit: WeeChat 2.4]
kristate has quit [Remote host closed the connection]
marmotini_ has joined #zig
marmotini_ has quit [Ping timeout: 246 seconds]
<andrewrk> mikdusan, to be clear: mtime is not assumed to be monotonically increasing; the caching system does an equality check: https://github.com/ziglang/zig/blob/fec4555476e38d2eeb1dfb02572404b243acd0b2/src/cache_hash.cpp#L359
<andrewrk> there would never be a "timewarp detected" message. zig would just treat the file as dirty
<andrewrk> (2) is correct if you replace > with ==
kristate has joined #zig
<mikdusan> ah ok so the approach is basically → if we detect any attrs changes (!= mtime, != inode, != size) then compute new hash and compare.
<andrewrk> yes precisely. and, importantly, when collecting the hash originally, if clock time is within the time resolution of mtime, we actually cannot cache the entry
kristate has quit [Ping timeout: 245 seconds]
<mikdusan> “we actually cannot cache the entry” confuses me. is this correct: whenever creating or updating cache, if mtime.isBogus uncache { mtime } but cache { inode, size, hash }?
<andrewrk> mikdusan, I don't understand your pseudocode
<andrewrk> the idea is that if clock time is too close to mtime, then a future write to the file, may actually have the same mtime, which means that we would not detect an invalidation
<andrewrk> however if an mtime is old enough, then a future write to the file is guaranteed to change the mtime
<mikdusan> if mtime.isBogus(), what is stored to cache, if anything?
<andrewrk> for the particular file in question - a marker that means "this file is an unconditional cache miss" - for other files that are part of the build, they may have their hashes computed and stored
<andrewrk> note that if a build depends on 10 files, and only 1 is changed, then only 1 has their hash recomputed, and in fact the build may still be a cache hit
kristate has joined #zig
<mikdusan> andrewrk: tiny note gist defining 1 case that i can think of. at step 3 i’m not sure anything work can be done. https://gist.github.com/mikdusan/7ee11794de1c418d7d2072c1c4a91d58
<andrewrk> mikdusan, in order for me to explain, your gist also needs wall clock timestamps at each step
<mikdusan> udpated. i hope that makes sense
<andrewrk> mikdusan, yes thank you. so here's what happens: in step 2, we look at the mtime, and notice that the nanoseconds are all 0s. And so we conclude it only has second granularity. So we look at the wall clock, and floor it to seconds. both == 10. So we know that we cannot store the hash; instead we store a special value that means foo.c is an unconditional cache miss.
<andrewrk> in step 3, we look at the cache, and see that foo.c is an unconditional cache miss. we look at the mtime, and see that it is != floored wall clock time, and so this time after computing the hash we can save it in the cache
<mikdusan> ok i muffed up. sorry. step 2 is supposed to be just the edit/save. no build. let me update the case.
<andrewrk> no problem, tell me when it is done
<mikdusan> ok updated. note step 2 is NOT a build.
schme245 has joined #zig
<andrewrk> mikdusan, step 1 describes an invalid state that would never happen
schme245 has quit [Ping timeout: 246 seconds]
<andrewrk> the cache would never have an mtime that is equal to wall clock time, within the mtime granularity, because zig would never save something into the cache if the wall clock time was that close
<mikdusan> ah. so case is completely avoided because { truncate(WALLCLOCK) - foo.c.mtime } == 0 and as you described earlier, THIS is when cache-save is avoided. but “zig would never save something into the cache” <— “something?” if “something” means all 4 itmes { mtime/inode/size/hash } i would ask what’s issue of storing { inode/size/hash }
<mikdusan> typo: means all 4 items
<andrewrk> mikdusan, that's correct - it's avoided not when we later check the cache, but originally, when we consider saving something in the cache. maybe it will help if I show an example of what a cache manifest file looks like
<andrewrk> here is an example: https://clbin.com/PGn1A
<mikdusan> ok so not currently dealing with complexity of partially populated rows; ie. null mtime.
<mikdusan> i get that would be only a small win anyways.
<mikdusan> thanks for clearing this up for me.
<andrewrk> no problem
<mikdusan> re #2044 i was testing out the “zig cc -c foo.c -MV -MD -MF foo.o.d -Ia -Ib” stuff. noticed -MG and tried it. i’m thinking -MG is actually what you may end up using/needing. it gives you deps that are as-specified in the include directive and you can run it with **ZERO** -I search dirs. this produces a clean directive list without resolving against a search path.
<andrewrk> mikdusan, I just tried `zig cc -c test.c -MG -M` and `zig cc -c test.c -MG -MM` and in both cases it printed: `test.o: test.c foo.h`. can you comment on the issue with an example to show what you mean?
<andrewrk> oh, I see what you mean. it does not have the `b/` part
<mikdusan> one sec. i have a pastie ready for your issue.
<andrewrk> so zig could do the search itself to discover the files that must not exist
<mikdusan> i was already half-way typing it. got too long. gave you the short version lol
<mikdusan> (reply to issue).
<andrewrk> yes this makes sense, thank you! and then we just need the concept of "if this file exists, invalidate the build" in the cache system
<mikdusan> i wonder if it could even survive no rebuild: changed search.dirs, changed file locations, if the hashes match. that would be wow.
<andrewrk> the current system would rebuild, because the search dirs go into the "input parameters hash"
brakmic has joined #zig
brakmic_ has joined #zig
brakmic has quit [Ping timeout: 245 seconds]
brakmic has joined #zig
brakmic_ has quit [Ping timeout: 245 seconds]
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
marmotini_ has joined #zig
marmotini_ has quit [Read error: Connection reset by peer]
brakmic has quit [Remote host closed the connection]
brakmic has joined #zig
brakmic has quit [Ping timeout: 245 seconds]
schme245 has joined #zig
redj has quit [Ping timeout: 240 seconds]
schme245 has quit []
_whitelogger has joined #zig
dewf has joined #zig
brakmic has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Zaab1t has joined #zig
Zaab1t has quit [Client Quit]
brakmic has quit [Ping timeout: 250 seconds]
DutchGh0st has joined #zig
brakmic has joined #zig
dewf has quit [Quit: Leaving]
brakmic has quit [Remote host closed the connection]
brakmic has joined #zig
brakmic has quit []
<DutchGh0st> @ptrToInt doesn't work at comptime
<DutchGh0st> comptime { var x: usize = 0; var n = @ptrToInt(&x); }
kristate has quit [Ping timeout: 255 seconds]
Zaab1t has joined #zig
DutchGh0st has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Zaab1t has quit [Client Quit]
develonepi3 has quit [Remote host closed the connection]
develonepi3 has joined #zig
<andrewrk> DutchGh0st, that's another reason to avoid @ptrToInt
<andrewrk> It actually does work at comptime in certain contexts. For example you can do comptime { var x = @intToPtr([*]u8, 0x1234); x += 1; var y = @ptrToInt(x); }
bheads has joined #zig
brakmic has joined #zig
brakmic has left #zig [#zig]
brakmic has joined #zig
halosghost has joined #zig
brakmic has quit [Ping timeout: 245 seconds]
brakmic has joined #zig
brakmic_ has joined #zig
brakmic has quit [Ping timeout: 245 seconds]
gamester has joined #zig
<gamester> amateur question hour: at least when compiling c code via .addCSourceFile, header files in /usr/include are not being found unless they're part of libc (and thus are actually being found in /usr/local/lib/zig/libc/ I think). Do I pass in /usr/include explicitly?
<andrewrk> I'll address this today
<gamester> ok
<andrewrk> the workaround for now, yes, is to pass /usr/include explicitly
<gamester> that's fine
fsateler has quit [Read error: Connection reset by peer]
fsateler has joined #zig
<gamester> I like the idea of zig not dealing with system include paths by default, however it is implemented
<andrewrk> yeah. although I can understand how it can be frustrating for some until we have zig package manager
brakmic_ has left #zig [#zig]
brakmic_ has joined #zig
brakmic_ has quit []
brakmic has joined #zig
brakmic has quit [Ping timeout: 246 seconds]
brakmic has joined #zig
brakmic_ has joined #zig
brakmic has quit [Ping timeout: 245 seconds]
brakmic has joined #zig
darithorn has joined #zig
brakmic_ has quit [Ping timeout: 240 seconds]
<andrewrk> daurnimator, I want to merge your valgrind pull request, but not the changes to std/mem.zig and std/heap.zig yet
<andrewrk> it's a great proof of concept you did, and I want to have an open issue with the diff to std.mem.Allocator for consideration. but I'm also thinking about https://github.com/ziglang/zig/issues/1291 and this would take us further from our goal
redj has joined #zig
<andrewrk> I'm typing up an issue
<andrewrk> oh, here it already is: https://github.com/ziglang/zig/issues/1837
brakmic has quit [Read error: Connection reset by peer]
brakmic has joined #zig
Akuli has joined #zig
darithorn has quit [Remote host closed the connection]
Zaab1t has joined #zig
_whitelogger has joined #zig
schme245 has joined #zig
Ichorio_ has joined #zig
schme245 has quit [Remote host closed the connection]
<andrewrk> Akuli, do you have a zig build from source? I have a potential fix for you for #2041 if you would like to try it
<Akuli> ok
<Akuli> i'm building the latest master now
jjido has joined #zig
<andrewrk> Akuli, try the `system-paths` branch
<andrewrk> you should be able to remove the addIncludeDir and addLibPath lines from your build.zig
<Akuli> Yay it works again :D
<Akuli> so is this the new default?
<andrewrk> yeah I'll push this to master
<Akuli> nice
<andrewrk> idea being that if you're calling "linkSystemLibrary" you're obviously trying to look for a library on your system
<Akuli> yes
<andrewrk> gamester, ^
Zaab1t has quit [Quit: bye bye friends]
<andrewrk> I think you can remove your hardcoded /usr/include now
<gamester> will do :)
<Akuli> this is awesome :)
<halosghost> andrewrk: you do a good job of pleasing the mob :P
<andrewrk> maybe some day zig will be so popular that I can't have one on one conversations with everyone who uses zig, but I can enjoy it while it lasts :)
<halosghost> hehe
<gamester> This does feel temporary because of special casing linkSystemLibrary("c"), maybe people should call linkCLibrary instead? Also if you're compiling some C code to be linked with the rest of your program, then you have to remember to link the system library to the C code, and not just to the final executable.
<gamester> Right? Because you have some C files that you compile into a static library and you might have just linked it to the exe, and also called exe.linkSystemLibrary("foobar") but that doesn't work here. You have to link the system library to the static library.
<gamester> It works but it feels a bit weird
<andrewrk> gamester, hmm oh right, artifacts need to inherit the system dependency from their dependencies
<andrewrk> the dependency inheriting thing is already hooked up for other stuff
<gamester> cool
develonepi3 has quit [Quit: Leaving]
develonepi3 has joined #zig
<andrewrk> gamester, is your project open source?
<andrewrk> feel free to show me some awkward zig code and i'll see if I can recommend something different, or become inspired to change zig to make it less awkward :)
<gamester> I don't think I have any awkward code at the moment but I will feel free to do so in the future!
brakmic has quit [Remote host closed the connection]
schme245 has joined #zig
schme245 has quit [Remote host closed the connection]
Dennis__ has joined #zig
darithorn has joined #zig
brakmic has joined #zig
brakmic has quit [Remote host closed the connection]
brakmic has joined #zig
brakmic_ has joined #zig
brakmic has quit [Read error: Connection reset by peer]
brakmic__ has joined #zig
brakmic_ has quit [Ping timeout: 272 seconds]
marmotini_ has joined #zig
dimenus has joined #zig
marmotini_ has quit [Ping timeout: 252 seconds]
darithorn has quit [Remote host closed the connection]
Akuli has quit [Quit: Leaving]
dimenus has quit [Quit: Leaving]
schme245 has joined #zig
marmotini_ has joined #zig
marmotini_ has quit [Remote host closed the connection]
halosghost has quit [Quit: WeeChat 2.4]
brakmic has joined #zig
brakmic__ has quit [Read error: Connection reset by peer]
brakmic has quit [Read error: Connection reset by peer]
brakmic has joined #zig
brakmic has quit [Read error: Connection reset by peer]
brakmic_ has joined #zig
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brakmic has joined #zig
brakmic_ has quit [Read error: Connection reset by peer]
kristate has joined #zig
brakmic has quit []
schme245 has quit [Remote host closed the connection]
Ichorio_ has quit [Ping timeout: 246 seconds]
wootehfoot has quit [Read error: Connection reset by peer]
return0e has joined #zig
return0e_ has quit [Ping timeout: 252 seconds]
Dennis__ has quit [Ping timeout: 256 seconds]
darithorn has joined #zig
darithorn has quit [Remote host closed the connection]
darithorn has joined #zig