pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
pawnbox has quit [Ping timeout: 246 seconds]
pawnbox has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
mahlgrimm has joined #crystal-lang
Kug3lis_off is now known as Kug3lis
<FromGitter>
<splattael> "linux perf" works for me
Kug3lis is now known as Kug3lis_off
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Philpax_ has joined #crystal-lang
Philpax has quit [Ping timeout: 256 seconds]
soveran has joined #crystal-lang
Philpax_ has quit [Ping timeout: 268 seconds]
mahlgrimm has quit [Quit: mahlgrimm]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
bjz has joined #crystal-lang
Kug3lis_off is now known as Kug3lis
pawnbox has quit [Remote host closed the connection]
Kug3lis is now known as Kug3lis_off
Kug3lis has joined #crystal-lang
pawnbox has joined #crystal-lang
_whitelogger has joined #crystal-lang
bjz_ has joined #crystal-lang
bjz has quit [Ping timeout: 258 seconds]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
ssvb has quit [Remote host closed the connection]
matp has quit [Read error: Connection reset by peer]
Philpax_ has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
matp has joined #crystal-lang
Kug3lis has joined #crystal-lang
_whitelogger has joined #crystal-lang
Raimondii has joined #crystal-lang
hmans has quit [Quit: ZNC 1.6.3+deb1+xenial0 - http://znc.in]
hmans has joined #crystal-lang
Raimondi has quit [Ping timeout: 244 seconds]
Raimondii is now known as Raimondi
hmans has quit [Client Quit]
hmans has joined #crystal-lang
bjz has joined #crystal-lang
bjz_ has quit [Ping timeout: 265 seconds]
<Yxhuvud>
you can probably use valgrind too
<RX14>
literal, callgrind or perf work great
<RX14>
`valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --simulate-cache=yes --toggle-collect=GC_init --collect-atstart=yes` is what I use for callgrind
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
<literal>
cool
<RX14>
literal, also make sure to compile with debug info
pawnbox has quit [Remote host closed the connection]
soveran has quit [Remote host closed the connection]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pawnbox has joined #crystal-lang
Kug3lis_off has quit [Ping timeout: 246 seconds]
jaitaiwan has joined #crystal-lang
<jaitaiwan>
Hey Guys, anyone in here know how to get or has a basic example of UDP multicast in crystal?
<literal>
RX14: yeah
soveran has joined #crystal-lang
<splitty_>
Hey, how can I export Crystal functions to C or Asm?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<BlaXpirit>
splitty_, well it probably means you're one step away from getting the pointer
pawnbox has quit [Remote host closed the connection]
<splitty_>
Awesome. Can I just use pointerof with the Proc?
Chronium has joined #crystal-lang
pawnbox has joined #crystal-lang
<splitty_>
Ah I see, there's a pointer member
unshadow has joined #crystal-lang
<FromGitter>
<foi> sorry about my post, i don't know crystal doesn't use : as key delimiter in hash ( => does
<BlaXpirit>
foi, what does this data structure represent? are you working with json?
<FromGitter>
<foi> @FromIRC yes, json :( i've tried with => and it also fails https://carc.in/#/r/1iu4
<BlaXpirit>
foi, this is extremely unidiomatic crystal code, that's why it's so hard. you can do this though https://carc.in/#/r/1iu6
<BlaXpirit>
the problem with your code above. line 1 has no effect because that variable is immediately rewritten with a variable of a different type in the next line. line 3 tries to put a hash that is of a slightly different type - `Hash(String, Bool)` can't be assigned where `Hash(String, String | Int32 | Bool)` is expected
<FromGitter>
<foi> @FromIRC <BlaXpirit> Thanks!
am_ has joined #crystal-lang
<jaitaiwan>
Trying again... anyone here have a multicast example for crystal or point me in the right direction?
<RX14>
jaitaiwan, there's a UDP sockets example, you're just going to have to work it out from that
<RX14>
i don't know what you need to do special to bind multicast
<jaitaiwan>
RX14 thanks. I'd got that far. Right now I can only get multicast working with allhost casting which is not idea so I'm trying to figure out exactly what's going on... THanks for the nidge
am_ has quit [Read error: Connection reset by peer]
DTZUZU2 has quit [Ping timeout: 245 seconds]
vivus-ignis has joined #crystal-lang
<RX14>
jaitaiwan, the best way would be to work out how you would do it in C then find those function's usaged in the stdlib
<RX14>
it might not be possible
<RX14>
(yet)
Ven has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 246 seconds]
Ven has quit [Ping timeout: 252 seconds]
ome has joined #crystal-lang
user9998 has joined #crystal-lang
mgarciaisaia has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
<splitty_>
Is a StaticArray contiguous?
<RX14>
a StaticArray is exactly like a C array iirc splitty_
<splitty_>
RX14, does Crystal change endianness on structures?
<splitty_>
This is really strange
<RX14>
pretty sure it doesn't
<splitty_>
I had to calculate the GDT entries by hand with bit shifts and masking because just using a struct triple-faulted
<splitty_>
Apparently, a C struct with a size of 64 bits is not the same as the same data encoded directly into a UInt64
<splitty_>
And now we're having the same problem with the IDT
<RX14>
well
pawnbox has quit [Remote host closed the connection]
<RX14>
it should be
<RX14>
it's a bug at some level of the stack
<splitty_>
I'll do some testing on this
<RX14>
maybe you can work out a pattern of what is being written
<FromGitter>
<asterite> splitty: are you using the @[Packed] attribute?
<splitty_>
Yes asterite, I am
_whitelogger has joined #crystal-lang
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Kug3lis has joined #crystal-lang
vivus-ignis has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 264 seconds]
vivus-ignis has joined #crystal-lang
pawnbox has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 246 seconds]
vivus-ignis has joined #crystal-lang
user9998 has quit [Quit: Leaving]
soveran has quit [Remote host closed the connection]
Kug3lis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<BlaXpirit>
uhm, it seems like this macro can return uninitialized variables if jobs raise an exception
<unshadow>
Thanks BlaXpirit
Kug3lis has quit [Ping timeout: 245 seconds]
chino has quit [Ping timeout: 240 seconds]
poikon has quit [Ping timeout: 240 seconds]
aarongodin has quit [Ping timeout: 245 seconds]
emmanueloga has quit [Ping timeout: 246 seconds]
twisterghost has quit [Ping timeout: 240 seconds]
kiliankoe has quit [Ping timeout: 245 seconds]
poikon has joined #crystal-lang
aarongodin has joined #crystal-lang
twisterghost has joined #crystal-lang
emmanueloga has joined #crystal-lang
kiliankoe has joined #crystal-lang
pawnbox has quit [Remote host closed the connection]
chino has joined #crystal-lang
pawnbox has joined #crystal-lang
<unshadow>
Is there a way to kill or abort a Fiber from the outside?
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<splitty_>
RX14, Papierkorb, my IDT is still not working
<splitty_>
I've been trying to fix this for the last four hours
<splitty_>
It really looks like C structs are broken in some cases
<splitty_>
Which I can't really imagine.. they should be well tested
<BlaXpirit>
unshadow, i don't think so
<BlaXpirit>
obviously it should be possible to make the event loop just forget about it
<BlaXpirit>
but it's completely unpredictable what garbage will be left behind by it
<unshadow>
BlaXpirit: I'm trying to implamente a FiberPool (like a thread pool) and want to have a shutdown option where all Fibers in the pool are stoped
<BlaXpirit>
unshadow, ideologically a FiberPool is nonsense
<unshadow>
how come ?
<BlaXpirit>
there is little to no advantage in their reuse, compared to ending one fiber and starting another
<BlaXpirit>
just end fibers together with the task they carried out, and you'll never need to kill em
<BlaXpirit>
if it is for the purpose of limiting the number of active tasks, that's also doable but it doesn't mean you have to implement a classic pool
<unshadow>
BlaXpirit: not regarding reuse, more about a "task pool" , lets you decide a max running tasks at any giving time, and it has a queue where new jobs are witing untill the max jobs are down
<unshadow>
BlaXpirit: exactly :)
<BlaXpirit>
start N tasks. when a task ends, it sends something to a channel. the fiber ends. receiver of that channel will start the next task.
<BlaXpirit>
...in a new fiber
<splitty_>
BlaXpirit, do you have experience with setting up an IDT, by any chance? :P
<BlaXpirit>
splitty_, you speak in terms i don't know about
<splitty_>
I'm trying to enable interrupts in my kernel and I just can't get it to work
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #crystal-lang
<BlaXpirit>
unshadow, i have no idea what that 'value.kill' does
<BlaXpirit>
presumably Fiber#kill but where is it defined?
<unshadow>
BlaXpirit: it's not XD I just added it there to show what I wanted to achive, but I guess cleaning the hash will just tell the GC to swipe the Fibers up right ?
<BlaXpirit>
unshadow, certainly not
Dreamer3 has quit [Quit: Computer has gone to sleep.]
<BlaXpirit>
event loop remembers the fibers and you cant do anything (within sane bounds) to make it forget about them, until they end
<BlaXpirit>
unshadow, just make a fiber that feeds tasks into a non blocking channel, and worker fibers that pull tasks from it and end when there is nothing more
<BlaXpirit>
unshadow, but i would still recommend 1 fiber per task
<BlaXpirit>
splitty_, be very careful not to mix up the meaning of `pointerof`
<BlaXpirit>
for example, pointerof(gates) - do you want a pointer to a pointer - or a pointer to the first item
<BlaXpirit>
although i probably pointed this out some days ago
<BlaXpirit>
if that was you
<splitty_>
BlaXpirit, I want the address of the whole thing
<BlaXpirit>
what whole thing
<splitty_>
Oh wait
<splitty_>
Does unitialized already create a pointer?
<splitty_>
uninitialized*
<BlaXpirit>
splitty_, i;'m not sure. i assume that a StaticArray works much like a Slice, but i may be wrong
<splitty_>
I just need a pointer to the first item, so it points to a contiguous block of memory
<BlaXpirit>
>> a = uninitialized Int32[5]; p({pointerof(a), a.to_unsafe})
<BlaXpirit>
output is {Pointer(StaticArray(Int32, 5))@0xbff07f1c, Pointer(Int32)@0xbff07f1c}
<BlaXpirit>
so this does seem to be correct
<BlaXpirit>
i dont see anything obviously wrong. sorry, i'm off
<splitty_>
okay thank you
Dreamer3 has quit [Quit: Computer has gone to sleep.]
Dreamer3 has joined #crystal-lang
Dreamer3 has quit [Quit: Computer has gone to sleep.]
soveran has quit [Remote host closed the connection]
vivus-ignis has joined #crystal-lang
Chronium has quit [Quit: Leaving]
emmanueloga has left #crystal-lang [#crystal-lang]
Ven has joined #crystal-lang
Ven has quit [Ping timeout: 246 seconds]
bjz has joined #crystal-lang
matp has quit [Ping timeout: 252 seconds]
mgarciaisaia1 has joined #crystal-lang
matp has joined #crystal-lang
mgarciaisaia has quit [Ping timeout: 265 seconds]
soveran has joined #crystal-lang
<crystal-gh>
[crystal] wmoxam opened pull request #3823: Use the OpenBSD version of LLVM when cross-compiling for it (master...fix-openbsd-cross-compile) https://git.io/vMmGF
<wmoxam>
wow, 0.20.3 is so much faster on OpenBSD than 0.19.4 was
Ven has quit [Ping timeout: 264 seconds]
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Ven has joined #crystal-lang
vivus-ignis has quit [Ping timeout: 258 seconds]
<Papierkorb>
Chronium: Depends on your definition of easy'
<Papierkorb>
The #define b could be turned into a macro I guess
Ven has quit [Ping timeout: 258 seconds]
<Chronium>
Easy as in not take half a day
<Papierkorb>
Chronium: rewrite the macro, then make use of `sed` or similar to rewrite the C code to something that Crystal will parse
<Papierkorb>
Chronium: If you're in a Kernel you'll want to turn that stuff into a binary string btw
<Papierkorb>
In which case I'd suggest using a small ruby script
<Chronium>
What do you mean by binary string?
<Papierkorb>
"\x12\x34"
<Chronium>
Ah
<Chronium>
Papierkorb: I think it would be easier just to get C to write out the binary string in text format as it already knows how to interpret it so I don't have much work to do xD
Ven has joined #crystal-lang
<Papierkorb>
Or that way, anyway really ;)
<Chronium>
Thanks for the suggestions :D
<splitty_>
Btw Papierkorb, are you German? :D
<Papierkorb>
Ja
<splitty_>
Ah nice, I suspected that the whole time because of your nick but wasn't sure because of your really good English :P
<FromGitter>
<crisward> how do back references work in crystal sub - `"hello".sub(/e/,"*\1*")` I'd expect this to equal - `h*e*llo`, but it outputs `"h*\u{1}*llo"`
<Papierkorb>
crisward, use single quotes instead: '*\1*'
Philpax_ has quit [Ping timeout: 268 seconds]
bjz has joined #crystal-lang
<FromGitter>
<crisward> thought single quotes are for characters?
<FromGitter>
<crisward> found it
<FromGitter>
<crisward> `"hello".gsub(/(e)/,"*\\1*",true)` double slashes and true at the end to use back references.
<FromGitter>
<crisward> Thanks Papierkorb... should really check the docs first. Think your answer is correct for Ruby though.
<Papierkorb>
crisward, ah damnit we're in #crystal-lang, sorry
<literal>
is there a PEG implementation or something similar for Crystal?
bjz has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<literal>
or any interesting parsing tools really
Ven has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
soveran has joined #crystal-lang
soveran has quit [Remote host closed the connection]
soveran has joined #crystal-lang
soveran has joined #crystal-lang
soveran has quit [Changing host]
<crystal-gh>
[crystal] bcardiff closed pull request #3823: Use the OpenBSD version of LLVM when cross-compiling for it (master...fix-openbsd-cross-compile) https://git.io/vMmGF