# IRC log for #moarvm, 2017-09-13

All times shown according to UTC.

Time Nick Message
01:55 ilbot3 joined #moarvm
01:55 Topic for #moarvm is now https://github.com/moarvm/moarvm | IRC logs at  http://irclog.perlgeek.de/moarvm/today
02:09 yoleaux joined #moarvm
05:48 brrt joined #moarvm
05:59 domidumont joined #moarvm
06:04 domidumont joined #moarvm
06:50 brrt joined #moarvm
07:03 * jnthn yawns
07:20 brrt good hi jnthn
07:21 jnthn o/ brrt
07:24 brrt any plans for today?
07:25 nwc10 lunch!
07:26 jnthn Having some nice lights installed in my office. Winter is coming. :-)
07:27 nine Screen not large enough to light the room? ;)
07:27 nwc10 Aye. I put jeans on today. Shorts felt a bit cold yesterday.
07:29 samcv jnthn, I was thinking of trying to implement perl's -a option to split commands into an array @f for stdin but i am not doing the QAST totally correctly
07:29 samcv i'm getting Cannot resolve caller STORE(Array: Seq); none of these signatures match: (Array:D $: Iterable:D \iterable, *%_) (Array:D$: Mu \item, *%_)
07:29 * jnthn stuck with shorts for now, though my commute is pretty short :)
07:30 jnthn It's a quite large room with high ceilings, so needs some good lights :)
07:31 nine samcv: you asked on #perl6-dev about getting a defined array. That's not solved yet?
07:31 samcv no clue
07:31 samcv that's what i'm guessing the issue is
07:31 nine samcv: just generate the code for the .new call
07:32 samcv hmm okay
07:32 * jnthn looks up what -a does
07:32 samcv this is what i have right now
07:32 samcv https://github.com/rakudo/rakudo/compare/nom...samcv:a?expand=1
07:32 samcv it splits the input with a delimiter
07:33 jnthn ah, right
07:33 jnthn Hmm
07:33 jnthn But I'm quite sure a magically named
07:33 jnthn @F is not the way to go in Perl 6 ;)
07:33 nine samcv: Something like QAST::Op(:op<callmethod>, :name<new>, QAST::WVal.new( :value($*W.find_symbol(['Array'])) )) 07:33 samcv well i agree jnthn 07:33 samcv ah awesome nine 07:34 jnthn Probably we can pass it as an argument to the loop body, perhaps as @_ or something 07:34 samcv but i'm guessing it's not defined. though the error doesn't show you if defineness had an effect 07:34 samcv which would be nice to add to the errors 07:35 jnthn Anyways, now that the light installers are hear and seemingly getting on with things, I plan to work on the scheduler :) 07:36 samcv nice :) 07:37 jnthn https://gist.github.com/jnthn/398d84b088d6c4ed8b79c2a5bfe89497 in case anyone missed it yesterday 07:41 * brrt just saw the animoji things and is sure to have nightmares 07:42 moritz jnthn: nice 07:42 moritz fwiw my regex book will be called "Parsing with Perl 6 Regexes and Grammars", subtitle "A Recursive Descent into Parsing" 07:43 jnthn Cute :) 07:43 moritz I'm quite fond of the subtitle; bdmatatu++ came up with it 07:43 brrt i like that as well 07:43 samcv looks good jnthn 07:44 moritz and I was positively surprised that the publisher didn't reject it :-) 07:44 jnthn Now all I need to do is implement the proposed design and see if it works ;) 07:45 moritz sounds like a walk in the park :-) 07:45 nine So a plain normal Perl 6 program will at least have 3 threads? 07:46 jnthn 2 like today; we'll still lazily start further ones 07:46 jnthn (Where 1 is the main thread, and 1 is the specializer/JIT thread) 07:49 domidumont joined #moarvm 08:24 zakharyas joined #moarvm 08:29 robertle joined #moarvm 08:48 cog_ joined #moarvm 09:53 timo1 joined #moarvm 10:05 timo1 joined #moarvm 10:30 timo1 joined #moarvm 11:16 lizmat joined #moarvm 12:04 domidumont joined #moarvm 12:44 MasterDuke do things allocated by FSA need any special care when being serialized? 12:58 brrt didn't read that yesterday, but i like the idea of monitor threads 12:58 brrt (i do not know MasterDuke) 13:06 timotimo serialization just means something reads the data and puts it into a file 13:06 timotimo so i don't think any special care has to be taken 13:08 jnthn What timotimo said, fwiw 13:09 MasterDuke thanks 13:11 MasterDuke nqp builds ok...make m-test's ok... 13:13 MasterDuke rakudo built ok... 13:13 MasterDuke make m-test ok... 13:15 MasterDuke doh, did *not* make m-spectest ok... Error in /home/dan/Source/perl6/install/bin/moar': free(): invalid next size (fast): 0x0000562ba9c4e2f0 13:17 nwc10 oooh, hammer that with ASAN 13:19 timotimo could very well be a free being called on an fsa alloced piece of memory 13:19 timotimo valgrind will know where it was allocated. not sure if asan can do it, too 13:19 MasterDuke i'm afk for a bunch of hours, but will attempt to debug later 13:19 MasterDuke i've never successfully used asan, if someone could post instructions, i'll backlog 13:20 timotimo in that case it might be easier to just valgrind it 13:20 timotimo did you push your code yet? 13:29 samcv so i got -a on perl 6 sort of working (splitting the line into a variable) right now it's$f, but it's not availible to me with perl6 code
13:30 samcv but i have a QAST::Op.new call say on the variable i declare with the quast nodes
13:30 samcv but i'm guessing i need to do something else to have it be availible to the rest of the code
13:30 geekosaur should it perhaps be a dynamic scope variable?
13:31 samcv maybe. though i'm wondering why i can't access it by name. i assigned it $f 13:33 samcv geekosaur, https://github.com/samcv/rakudo/blob/a/src/Perl6/Actions.nqp#L871-L892 13:34 samcv running: echo '3,3,4' | perl6 -ae ".say" i get it to print out an array of [3 3 4] which is progress 13:34 samcv since i pt a say down there 13:35 samcv well the .say in the -e just prints out$_ which is the line, not the array. but i have it print out $f in the qast code i did 13:39 MasterDuke timotimo: work so far is here: https://github.com/MasterDuke17/MoarVM/tree/fsa_support_for_VMArrays 13:42 timotimo did it show you where the free was b0rked? 13:43 timotimo you might be misunderstanding what "root" does 13:44 timotimo i believe it's the "outermost" object when another object, like a p6opaque, has other object bodies inlined into its own body 13:44 timotimo you need to refer to the root object to do write barriers correctly for example 13:48 timotimo the storage spec on the VMArray should tell us if we'll ever inline the body into a p6opaque or similar 13:48 timotimo so maybe we won't do that ever 13:48 timotimo but multiple VMArrays might share the same root object, and thus the header bit won't work properly 13:48 timotimo i wonder if there's a good succinct description of root object and friends somewhere 13:49 ilmari[m] joined #moarvm 13:51 MasterDukeMobile joined #moarvm 13:51 MasterDukeMobile timotimo: yeah, I am/was pretty sure that was suspect 13:53 MasterDukeMobile But iirc, set-size-internal only took an arraybody, and I needed an MVMObject to get to the header flags 13:54 MasterDukeMobile Any suggestions much appreciated 13:57 timotimo vmarray is already set up to never be inlined it looks like 13:57 timotimo so this shouldn't actually be a problem 13:58 nine samcv: you also need to push the variable to the lexpad 13:58 geekosaur was wondering about that but couldn't even say "lexpad" --- don't know internals that well 13:58 nine Something like$*W.cur_lexpad.push(QAST::Var.new( :name(<$f>), :scope(<lexical>), :decl<var>)); 13:59 geekosaur just suspect some symbol-table-y thingy needed to be told about it 13:59 geekosaur *suspected 13:59 jnthn Probably more like cur_lexpad[0].push(...) but there's also various things you can call to decalre a varaible 13:59 jnthn In fact, the sub iirc is called declare_variable :) 14:00 samcv :) 14:00 samcv oh i set it to$*f and it works
14:00 samcv and moved the variable declaration
14:01 samcv now how to accept a delimiter as a command line argument
14:01 nine jnthn: no really, declare_variable would be much too readable :)
14:01 MasterDukeMobile timotimo: maybe I need to go back even further in the call chain and pass the actual array everywhere, not just the arraybody, so I have the right thing to get the header from (i.e., not root)
14:01 samcv should have named the sub: dcv` so everyone can understand it
14:01 jnthn root is the collectable
14:01 jnthn I think I've abbreviated enough things... :P
14:02 jnthn \$*W ;)
14:02 MasterDukeMobile jnthn: ah, so I do want to be checking its flags?
14:02 samcv tgt
14:03 jnthn MasterDukeMobile: I'd add a https://github.com/MoarVM/MoarVM/blob/master/src/6model/6model.h#L97 enum entry like MVM_CF_REPR_PRIVATE
14:04 jnthn MasterDukeMobile: And then in VMArray.h #define MVM_ARRAY_USES_FSA MVM_CF_REPR_PRIVATE or so
14:04 jnthn And yeah, you'd set it on root
14:04 MasterDukeMobile I did add an entry to that enum
14:05 jnthn root->header.flags |= MVM_ARRAY_USES_FSA; or so
14:06 MasterDukeMobile Yep, that's what I did
14:06 MasterDukeMobile Can't link it easily from this client, but I put a link to my repo earlier
14:06 MasterDukeMobile Anyway, really afk, thanks all, bbl
14:08 jnthn Hm, the flags usage looks right enough
14:09 timotimo i'll try to valgrind it
14:47 zakharyas joined #moarvm
14:56 Geth ¦ MoarVM: 9e7c16e778 | (Jonathan Worthington)++ | src/6model/reprs/ConcBlockingQueue.c
14:56 Geth ¦ MoarVM: Fix elems of ConcBlockingQueue REPR
14:56 Geth ¦ MoarVM: review: https://github.com/MoarVM/MoarVM/commit/9e7c16e778
15:01 Skarsnik joined #moarvm
15:08 jnthn Hmmm
15:08 jnthn So for the scheduler to make decent decisions, we could do with having some idea of whether threads are actively working or not
15:08 jnthn There's a few options here
15:09 jnthn One is to use uv_cpu_info
15:09 jnthn Which gets per-CPU utilization info, or at least I figure that's what it is doing
15:09 jnthn On Linux it does something like this: https://github.com/libuv/libuv/blob/f1e0fc43d17d9f2d16b6c4f9da570a4f3f6063ed/src/unix/linux-core.c
15:10 jnthn This approach has the benefit of telling us if we're on a system that's under load
15:10 jnthn Though it doesn't tell us if our process is making any progress
15:11 jnthn afaict, the data is system global
15:11 jnthn Which means it's less useful for deciding whether we should add another thread or not
15:11 replacementimo joined #moarvm
15:11 replacementimo the server i irc from has somehow fallen off of the 'net
15:11 replacementimo MasterDuke: did you see my comment on your commit? i found out what caused the explosions
15:12 jnthn I'm thinking of a scheme like
15:12 jnthn 1) Up to the number of CPU cores, if we see that there's a backlog of work in the queue, add extra threads to help take it on
15:13 jnthn 2) Once we reach that, try to figure out if we're making progress, and only add more threads if we're not (and thus are deadlocked)
15:14 jnthn uv_getrusage is thus perhaps more useful
15:15 jnthn Hm, it also looks a lot cheaper to call
15:16 jnthn Anyway, that's probably the better option in the immediate.
15:16 jnthn The overall system load maybe wants to be factored into the calculation in part 1
15:17 * lizmat would love to see some nqp ops for getting usage statistics  :-)
15:17 replacementimo hm, uv_getrusage might not need any setup, perhaps you can just nativecall that
15:18 jnthn A futher option is that we could just use something MoarVM specific since we can look at a thread context and tell if progres *didn't* happen (pc and frame counter wouldn't change would)
15:19 jnthn Though it can give false negatives in a tight fully inlined loop if the PC happens to be at the same point I guess
15:19 jnthn replacementimo: Maybe, though I'm going to use this in CORE.setting
15:20 jnthn And also Windows is different :)
15:20 replacementimo ah, of course the scheduler is hll code
15:20 jnthn oh, but calling the libuv one would hadnle that
15:21 replacementimo btw, would you say for the sampling profiler we should have a thread that regularly sends a signal to each of our threads so they hold still for a little bit so we can grab data?
15:21 jnthn We can do something much simpler
15:21 jnthn Use instrumenting to add a "maybe take a sample now" op
15:22 jnthn At entry, before each back branch, and after each instruction with a line number annotation
15:22 jnthn If we don't get any samples, we can extrapolate that all of the last samples were in the same place
15:23 replacementimo i thought something like that, too, but i feared it would be too intrusive
15:23 jnthn And if we already did one sufficiently recently, then we don't take one
15:23 jnthn Well, depends how we engineer it
15:23 jnthn If we make it just a few instructions... :)
15:23 replacementimo if only the performance counter i'm using for telemeh were available everywhere ...
15:23 replacementimo that's a really cheap thing to query at runtime
15:24 jnthn We could also have a thread that is firing every interval, bumping a global counter
15:25 jnthn And the thread context has a "last time I logged"
15:25 jnthn So then it's just an integer comparison
15:25 jnthn I suspect an op to expose rusage is my best bet, anyways
15:26 jnthn Anyway, that can be for tomorrow :)
15:30 replacementimo my spectest will be done soon. wasn't as explosive as before my change
15:31 Skarsnik nativecallable6, https://raw.githubusercontent.com/libuv/libuv/v1.x/include/uv.h
15:31 nativecallable6 Skarsnik, Successfully fetched the code from the provided URL.
15:31 nativecallable6 Skarsnik, https://gist.github.com/ac12ef1be686069ec240fefbc419aec8
15:32 Skarsnik damn, was too easy x)
15:32 replacementimo hah
15:38 brrt joined #moarvm
15:38 replacementimo heyo brrt
15:39 brrt hey replacementimo
15:42 replacementimo spec tests are clean with masterduke's "vmarray uses fsa now" branch; i think it still wants to have the size parameters moved into the allocated blob, too, though
15:45 replacementimo that'll be a nice thing to have in the next release
15:45 replacementimo "concurrently changing the size of VMArray now causes only memory loss, not crashes
15:45 replacementimo "
16:43 dogbert17 joined #moarvm
16:49 leont joined #moarvm
16:54 robertle joined #moarvm
17:07 AlexDaniel joined #moarvm
17:24 domidumont joined #moarvm
17:48 leont joined #moarvm
19:04 nine I've marked nativecallinvokejit .a in oplist, yet I still get "Bytecode validation error: expected instruction marked 'a' but got ' '"
19:04 nine What else would I have to do?
19:05 Skarsnik did you run the script to update the ops? (dumb question
19:05 nine I did
19:12 timo joined #moarvm
19:42 geekosaur joined #moarvm
20:02 geekosaur joined #moarvm
20:03 geekosaur joined #moarvm
20:27 Skarsnik_ joined #moarvm
21:01 timo i think i'll want to reconsider ; as separator for the profiler kind and its options, as shells see that as a character they own
21:02 lizmat .oO( everybody wants the semi-colon )
22:33 replacementimo joined #moarvm
22:38 vendethiel- joined #moarvm
23:30 replacementimo joined #moarvm
23:37 geekosaur joined #moarvm