marmotini_ has quit [Remote host closed the connection]
Akuli has joined #zig
halosghost has joined #zig
<andrewrk>
damn, the is_packed=true test of std.io.Serializer/Deserializer is tripping an assertion in a debug build of llvm 8.0.0rc3
<andrewrk>
reported upstream. I hope they just fix it and call it a day
<tgschultz>
how does that work? Wouldn't that have been compiled out by then? By which I mean the packed/not packed versions of the function would have been separated out?
<andrewrk>
llvm does have the concept of a packed struct - it means no alignment padding
<tgschultz>
Oh ok, if I read this correctly, it doesn't have to do with the test per-se, but with type bitwidth information in general.
<andrewrk>
it has to do with an optimization that LLVM is doing in release-safe mode, it had an invalid assumption
<andrewrk>
it's either zig emitting an invalid LLVM IR file, and the llvm bug is that the verifier didn't catch the problem, or it's a legitimate bug in one of llvm's optimization passes that made an incorrect assumption about integer widths
<andrewrk>
damn, it's an issue in llvm 7 too. so we just have been tripping this assertion for some time now and didn't know it because we usually use release builds of llvm
<andrewrk>
I'm going to open an issue and disable the failing tests and comment a link to the issue
kristate has quit [Remote host closed the connection]
darithorn has joined #zig
Ichorio has joined #zig
<daurnimator>
andrewrk: I caught up on your stream. One thing I kept noticing was that you had workarounds due to `align` being unavailable for the usize and isize used with e.g. mprotect
<daurnimator>
andrewrk: possible ideas: 1. add a 'pointer to unknown' type that allows pointer attributes. other pointers can implicitly cast to the unknown pointer type with matching align/etc. 2. allow `align` to be used on non-pointer types
<andrewrk>
I'm not sure what you're referring to
<daurnimator>
andrewrk: e.g. the mprotect address argument.
<andrewrk>
pointer to opaque is pointer to unknown
<andrewrk>
oh that's a good point, the addr argument can be *align(page_size) @OpaqueType()
<andrewrk>
the length still has to be checked the same way though
<andrewrk>
no language changes needed, just an API change
<daurnimator>
okay. I didn't think you could use an opaque type there, as a user wouldn't be able to pass an arbitrary pointer?
<andrewrk>
ah right you would need a reference to the type for the first arg of @ptrCast or @intToPtr
<andrewrk>
`[*]align(page_size) u8` is probably fine
<andrewrk>
the second argument could be an aligned end pointer rather than a length
<andrewrk>
it shouldn't make a difference in optimized builds; a function that small is probably getting inlined, and then the addition/subtraction would cancel out
<andrewrk>
nope that's a bad idea. consider the last page of memory
<daurnimator>
andrewrk: `2` above would also work for length. e.g. if you could have `fn foo(bar: align(page_size) usize)` which would essentially add an assert that the last X bits are 0?
<daurnimator>
if that was more general it could also lead to interesting memory optimizations: `struct {a:align(4096) u64, b:u12}` // this struct can fit in 8 bytes!
<andrewrk>
I haven't ruled out yet an enum type that supports ranges
<Akuli>
i could have done: enum KlonCardPlace { STOCK, DISCARD, FOUNDATION0, ..., FOUNDATION3, TABLEAU0, ..., TABLEAU6 }; but how do i access the enum value for the n'th tableau or foundation easily then
<andrewrk>
Akuli, yep this is the use case for the thing above
<andrewrk>
the _NUM macros would be @enumToInt
<andrewrk>
KLON_FOUNDATION and KLON_TABLEAU would be @intToEnum
<Akuli>
how would i put foundation enums, tableau enums, STOCK and DISCARD all in the same enum though?
<andrewrk>
and then val == KlonCardPlace.FOUNDATION would do a range check
Ichorio has quit [Ping timeout: 258 seconds]
<Akuli>
hmm
<andrewrk>
with the syntax above
<Akuli>
i'm not sure if that's a bit too magical for ==, but anyway :D