00:06
davr0s has joined #zig
00:16
mnoronha has quit [Ping timeout: 244 seconds]
00:38
reductum has quit [Quit: WeeChat 2.2]
00:45
mnoronha has joined #zig
00:50
mnoronha has quit [Ping timeout: 250 seconds]
01:27
mnoronha has joined #zig
01:30
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
01:31
davr0s has joined #zig
01:31
mnoronha has quit [Ping timeout: 240 seconds]
01:31
davr0s has quit [Client Quit]
01:36
davr0s has joined #zig
01:36
davr0s has quit [Client Quit]
01:46
mnoronha has joined #zig
03:01
mnoronha has quit [Ping timeout: 244 seconds]
03:23
phrost has joined #zig
03:23
phrost has left #zig [#zig]
03:33
mnoronha has joined #zig
03:39
mnoronha has quit [Ping timeout: 245 seconds]
03:45
mnoronha has joined #zig
04:17
_whitelogger has joined #zig
04:55
reductum has joined #zig
04:56
<
tyler569 >
I am working on some network code, and the way you take a dhcp address on linux and open a socket to it is to cast a char * (h_addr) to a struct in_addr *, but doing this in zig is causing pointer alignment problems, anyone know how I can convince the compiler that this is ok?
04:56
<
tyler569 >
I tried @bitCast, but it doesn't seem to like casting from an 8 bit value to a 32 bit value, since it's not taking the addresses as far as I can tell
04:58
<
scientes >
x86 doesn't have alignment problems
04:59
<
tyler569 >
right, but I get a compile error
04:59
<
tyler569 >
"error: cast increases pointer alignment"
04:59
<
scientes >
ahh yeah there needs to be a way to get around that
05:00
<
scientes >
use @alignCast()
05:01
<
tyler569 >
aha, that seemed to do the trick!
05:01
<
scientes >
you could also use @memcpy, but that doesn't accept any type yet, open a bug to bother andrewrk about it
05:02
<
scientes >
any memcpy would avoid undefined behavior
05:02
<
tyler569 >
what do you mean by it doesn't accept any type?
05:03
<
scientes >
you have to cast to [*]u8
05:03
<
tyler569 >
oh, I see, that it's just [*]const u8
05:03
<
scientes >
andrew said he was considering changing that however, and i think its a good idea
05:04
<
scientes >
welcome to zig! hope you stay and contribute
05:05
<
tyler569 >
thanks! I've been watching for a while, but this is the first major thing I've done, really enjoying it so far
05:20
mnoronha has quit [Ping timeout: 246 seconds]
05:28
davr0s has joined #zig
05:56
<
kristate >
scientes: is that test case failing, or is it a valid case?
05:58
<
kristate >
scientes: it's failing -- lowercase: 0febabe
05:58
<
kristate >
it should be double width...
05:59
<
scientes >
<kristate> it should be double width...
05:59
<
kristate >
scientes: this is bigger than just printing strings -- it should be the same for all hexbytes
06:00
<
scientes >
I just was using it to print the value of a promise and notice the bug
06:00
<
kristate >
hmm, not only that \x0E prints 0
06:00
<
kristate >
\x0E prints E
06:02
<
kristate >
scientes: okay, I have a patch
06:02
<
kristate >
I will add you as a co-author and setup a PR
06:02
<
scientes >
you can push it directly to my pull request
06:02
<
scientes >
if you have commit access
06:02
<
scientes >
i guess you are not a member however
06:11
mnoronha has joined #zig
06:30
mnoronha has quit [Quit: Ping timeout (120 seconds)]
06:31
mnoronha has joined #zig
06:35
mnoronha has quit [Read error: Connection reset by peer]
06:36
mnoronha has joined #zig
06:38
reductum has quit [Quit: WeeChat 2.2]
06:46
<
kristate >
scientes: we are already using futexes where available
06:46
<
scientes >
oh, the event stuff said no syscalls
06:47
<
kristate >
do a grep on the repo
06:47
<
scientes >
yeah i just did
06:49
<
kristate >
what we are generally aiming for is for co-routines to be implementation independent from the event loop
06:49
<
kristate >
rather, we can use coroutines to build the event loop
06:49
<
scientes >
if it uses Loop it makes syscalls
06:50
<
scientes >
should have used grep
06:51
<
kristate >
yeah, good idea to grep the stdlib
06:52
<
kristate >
i'm glad that andy outlined the problem so well
06:53
<
scientes >
can you fallow my proposal, its kinda complicated?
06:55
unique_id has joined #zig
06:55
<
kristate >
co routines are backed by llvm intrinsics
06:56
<
kristate >
so the keywords are easier to implement
06:56
<
scientes >
yes i've read that
06:56
<
scientes >
but cancel is not an llvm intrinsic, destroy is
06:57
<
scientes >
and doing .scheduleCancellation() is difficult
06:59
<
kristate >
ir_render_cancel -> get_coro_destroy_fn_val -> llvm.coro.destroy
06:59
<
kristate >
cancel keyword is connected to the llvm.coro.destroy intrinsic
06:59
<
scientes >
no, ir_render_suspend calls destroy
06:59
<
scientes >
if the is_cancelled_bit is set
06:59
<
scientes >
which gets set by ir_render_cancel
07:00
<
kristate >
I don't see a ir_render_suspend ?
07:02
<
scientes >
oh ir_gen suspend
07:03
<
kristate >
hmm, we should try to keep coros as simple as possible
07:03
<
scientes >
we could drop cancel, and replace it with destroy
07:05
<
scientes >
yeah that is the clean way to do it
07:06
<
kristate >
I think we should make a diagram outlining each process
07:06
<
kristate >
there are only so many states --
07:06
<
scientes >
my proposal is entirely user-space
07:07
<
scientes >
if we replace cancel with destroy...
07:08
<
kristate >
scientes: yeah, I don't know if we should have co-routines be half compiler half user-space
07:08
<
kristate >
it's kind of like a bridge without guardrails
07:09
<
scientes >
yeah i don't like cancel
07:09
<
kristate >
obviously
07:09
<
kristate >
obviously co-routines will be used in userspace to create loops, etc.
07:09
<
scientes >
and getting rid of cancel brings promise back to alignment 4
07:10
<
kristate >
what is it at right now? 8?
07:10
<
kristate >
I thought that using lower 8 bits was nifty
07:10
<
kristate >
rather lower 3
07:10
<
scientes >
yeah i use the low bit in my rb.zig
07:13
<
scientes >
back, my graphics driver crashed ---i need a new video card
07:13
<
scientes >
last line i got:
07:13
<
scientes >
<scientes> yeah i use the low bit in my rb.zig
07:23
mnoronha has quit [Quit: Ping timeout (120 seconds)]
07:23
mnoronha has joined #zig
07:27
mnoronha has quit [Read error: Connection reset by peer]
07:27
mnoronha has joined #zig
07:31
<
kristate >
scientes: remember to sleep
07:47
mnoronha has quit [Remote host closed the connection]
08:52
stratact has joined #zig
11:20
_whitelogger has joined #zig
13:11
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
13:14
davr0s has joined #zig
13:14
davr0s has quit [Client Quit]
13:15
davr0s has joined #zig
13:15
davr0s has quit [Client Quit]
13:16
davr0s has joined #zig
13:16
davr0s has quit [Client Quit]
13:30
very-mediocre has joined #zig
14:57
<
scientes >
kristate, back
15:04
<
scientes >
all this complicated stuff with co-routines is why I was proposing the go threading model
15:04
<
scientes >
but we want to be like c, so we can build that on top
15:51
<
tyler569 >
ach oops
16:11
davr0s has joined #zig
16:15
ofelas has joined #zig
16:25
<
kristate >
andrewrk: what are your thoughts on the current co-routine situation ?
16:26
<
kristate >
I've been trying to map it out in some ASCII art
16:40
<
scientes >
Mutexs should be done right so they can be shared (in shared memory) between 32-bit and 64-bit processes and even on heterogeneous systems
16:40
<
scientes >
which would be an improovement over glibc
16:42
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
16:45
davr0s has joined #zig
16:49
Thorn has quit [Quit: Quit]
16:53
Thorn has joined #zig
17:01
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
17:04
davr0s has joined #zig
17:34
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
17:36
davr0s has joined #zig
17:37
<
scientes >
i have to look at the source more
17:38
<
scientes >
IrBasicBlock *canceled_block = ir_create_basic_block(irb, parent_scope, "IsCanceled");
17:38
<
scientes >
what does that do?
17:39
<
scientes >
IrInstruction *destroy_ourselves = ir_build_phi(irb, parent_scope, node, 2, incoming_blocks, incoming_values);
17:39
<
scientes >
yeah the co-routine destroys itsself, despite the docs saying,
17:39
<
scientes >
The ‘llvm.coro.destroy’ intrinsic destroys a
*suspended* coroutine.
17:44
<
scientes >
i guess that just means the co-routine can't do anything after llvm.coro.destroy is called---the docs should be updated
17:44
<
scientes >
(if that is the case)
17:45
<
scientes >
this bears the question: Does llvm.coro.destroy use the stack?
17:47
<
kristate >
check-out this pdf
17:52
dbandstra has joined #zig
17:54
<
scientes >
yeah i think we are using llvm.coro.destroy wrong
17:55
<
scientes >
but it might be necessary for NM scheduling, so we could ask that it be supported
17:59
<
scientes >
this might be why optimizations are not working with co-routines
18:05
<
scientes >
wtf::lock look beautiful except for being written in C++
18:07
<
scientes >
its so complicated thought that re-implementing it would be time-consuming, making it temping to wrap it in a C API
18:07
<
scientes >
we are going to be tempted to bring in c/C++ code to zig for regular expressions to, I think that needs to be discussed
18:21
<
scientes >
oh WTF::Lock doesn't use robust mutexes anyways, so they can't be shared accross processes
18:54
<
scientes >
kristate, ParkingLot is like go's netpoller threading model, but for locks
20:10
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
20:12
davr0s has joined #zig
20:20
very-mediocre has quit [Quit: Page closed]
20:52
dbandstra has quit [Quit: Leaving]
21:16
clownpriest has joined #zig
21:19
clownpriest has quit [Client Quit]
21:20
clownpriest has joined #zig
21:40
clownpriest has joined #zig
21:47
clownpriest has joined #zig
21:49
clownpriest has left #zig [#zig]
21:57
<
andrewrk >
I'm about to merge this
22:03
clownpriest has joined #zig
22:24
stratact has quit [Remote host closed the connection]
22:33
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
23:04
kristate has quit [Remote host closed the connection]
23:04
kristate has joined #zig
23:08
kristate has quit [Remote host closed the connection]
23:08
kristate has joined #zig
23:17
dbandstra has joined #zig
23:35
kristate has quit [Ping timeout: 246 seconds]
23:52
minus has quit [Ping timeout: 240 seconds]