Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2015-03-13

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:03 timotimo seems like i need a decont to get the value, which makes obvious sense
00:05 timotimo and the localref shouldn't :returns(int) of course
00:06 timotimo aaah
00:06 timotimo i'm not allowed to declare a variable with localref yet
00:09 timotimo yay, i got an OK out of it :)
00:10 timotimo bump the plan, save the planet
00:13 jnthn timotimo: uh, can I see the test you ended up wthi?
00:13 jnthn something looks...odd
00:14 jnthn I'd expect the second bind would want to be an assign_i of another IVal
00:14 jnthn Followed by reading either the reference or the local
00:15 timotimo sure
00:15 timotimo hold on
00:16 timotimo gist updated, jnthn
00:17 dalek joined #moarvm
00:17 timotimo i get all ok's, but i have not tried to make tests fail :S
00:17 timotimo which is how i was supposed to do it ...
00:17 jnthn QAST::Op.new(
00:17 jnthn :op<bind>,
00:17 jnthn QAST::Var.new( :name<intlocref>, :scope<localref>, :decl<var> ),
00:17 jnthn QAST::Var.new( :name<intloc>, :scope<local> )
00:17 jnthn ),
00:17 jnthn That really wants to be assign_i
00:18 jnthn And I'd assign and IVal
00:18 timotimo mhm
00:18 jnthn QAST::IVal.new( :value(99e1) )
00:18 jnthn Did you mean NVal?
00:18 jnthn But yeah, you want assign_*
00:19 timotimo er, yes
00:19 timotimo well, now i get segv :)
00:20 vendethiel joined #moarvm
00:20 timotimo i updated the gist with the nqp diff i made, you might be able to spot dumbness
00:21 timotimo was i supposed to use assign_i in the local and localref interacting pieces of compile_var?
00:22 jnthn my $localref := $*REGALLOC.fresh_register($kind, !$temporary);
00:22 jnthn No, you were supposed to use it in your tests
00:22 jnthn That line looks wrong
00:22 timotimo OK, i put that in now
00:22 timotimo oh, $kind ought to be $MVM_reg_obj
00:22 jnthn Right
00:23 timotimo i wrote that before i got told about the objness of ref registers
00:23 jnthn +                $res_reg  := $localref;
00:23 jnthn That can't be right
00:24 jnthn Especially given
00:24 jnthn +                push_op(@ins, @decont_opnames[@kind_to_op_slot[$res_kind]], $res_reg, $localref);
00:24 timotimo okay, let's see what the code i wrote actually does ... :S
00:24 jnthn Simply on kinds it can't be; $localref has to be an obj register, but the target has to be a natively typed one.
00:24 jnthn I think you need to allocate a temporary there
00:25 timotimo and decont, yeah?
00:25 jnthn Your decont_opnames thing looks right
00:25 jnthn But you need $res_reg (result of the decont) to be a fresh register of kind $res_kind
00:26 timotimo OK
00:27 jnthn Also here:
00:27 jnthn push_op(@ins, @localref_opnames[@kind_to_op_slot[$lex_kind]], $res_reg, $local);
00:27 jnthn $res_reg needs to be a fresh object register
00:27 jnthn I don't think it's being initialized at all on that code path
00:27 timotimo could be ;(
00:28 timotimo i did it kind of sloppishly and was wondering why the tests didn't blow up
00:28 timotimo for the first part, do i just "set" the $tmp_reg := $localref? because the decont already comes after that
00:28 timotimo and i'd only need one decont, eh?
00:29 jnthn $tmp_reg?
00:30 timotimo oh, you told me to get a res_reg from the allocator
00:30 timotimo not a temporary
00:30 jnthn But no, for the localref -> local case, and the local -> localref case, you need to allocate a register
00:31 timotimo i'm finding it a bit hard to concentrate, but i'd like to power through regardless
00:31 * jnthn needs to undo a few days of insufficient sleep, so will go and rest now :)
00:31 timotimo already updated the gist with a few more of your betterments
00:32 timotimo aaw, i'll have to shotgun-debug this stuff again :)
00:32 jnthn :)
00:32 timotimo have a good rest!
00:32 jnthn Good luck!
00:32 jnthn Thanks
00:32 jnthn o/
00:32 timotimo thanks, i'll need it ;\
00:33 timotimo now where do i dig to find out what to do in the localref -> localref case
00:33 timotimo i think i just have to take over the register
00:37 timotimo i must have misunderstood you when you said i ought to assign_i ...
00:37 timotimo hm.
00:38 timotimo because i get the segfault in assign_i
00:40 timotimo oh dang
00:40 timotimo a core dump of 9 gigs size
00:40 timotimo thank you, asan %)
00:43 timotimo hmpf. this is an SSD. dumping the core dump shouldn't take this long ...
00:43 timotimo oooh
00:44 timotimo hm. no you really did tell me to assign from an IVal into a :scope<localref>
00:50 timotimo i suppose there can't be a localref without a local that's ref'd
00:56 timotimo but the container is still 0x0 :\
01:17 timotimo oh, i think i get it now
01:17 timotimo oh, i'm a big, big derp
01:20 timotimo of course i had to use the same name, just different scopes to get the combinations of local and localref
01:28 timotimo maybe i'm barking up the wrong tree right now, but this seems very wrong:
01:28 timotimo (gdb) print MVM_hll_current(tc)->int_lex_ref
01:28 timotimo $6 = (MVMObject *) 0x0
01:30 timotimo OK, i seem to understand stuff i see right here
01:32 timotimo hum. it uses the same type for lex refs and reg refs
01:34 timotimo so ... is nqp supposed to expose a class that's properly repr'd in NQPMu.nqp to use for those?
01:36 timotimo well, rakudo certainly does that
01:36 timotimo is that what i'm doing wrong? could be.
01:43 * timotimo maybe goes to bed
01:44 timotimo the gist from earlier (which was https://gist.github.com/timo/b68416dedda71b72a458 for local reference) is now updated with my latest compiler code as well as the only test i need to segfaultify stuff
02:09 colomon joined #moarvm
02:11 agentzh joined #moarvm
02:11 agentzh joined #moarvm
03:15 agentzh joined #moarvm
03:23 vendethiel joined #moarvm
03:47 vendethiel joined #moarvm
04:18 vendethiel joined #moarvm
05:03 vendethiel joined #moarvm
05:13 agentzh joined #moarvm
05:30 vendethiel joined #moarvm
06:10 agentzh joined #moarvm
07:25 FROGGS joined #moarvm
07:48 Ven joined #moarvm
08:21 agentzh joined #moarvm
08:27 rurban joined #moarvm
08:34 zakharyas joined #moarvm
08:58 Ven joined #moarvm
09:16 kjs_ joined #moarvm
09:43 Ven joined #moarvm
09:51 kjs_ joined #moarvm
09:53 jnthn timotimo: Well, the immediate issue is that there's no native lex ref types set up for the VM to use for the NQP language
09:54 brrt joined #moarvm
09:54 timotimo a-HA!
09:54 timotimo and i don't know how to implement the NativeRef protocol
09:54 brrt \o
09:54 timotimo or something like that
09:55 timotimo o/ brrt
09:55 timotimo as in: the simplest thing that could possibly have worked would have been class NativeRef is repr('NativeRef') { }
09:55 timotimo but that lacks all the stuff like what type of thing it refs and whether it's a lexical or local
09:56 jnthn duh, the code is missing the "do we have one" check in some places
09:58 timotimo that causes the segfault rather than giving a pretty error message, aye
09:58 timotimo the segfaults i used to have were caused by trying to assign_i a value into a low-level null
10:05 timotimo all these null checks must be really expensive! :P
10:06 jnthn Not particularly
10:06 jnthn You're already reading the bit of people
10:06 jnthn wtf
10:06 jnthn the bit of *memory*
10:06 timotimo :D
10:06 jnthn And the branch is predictable.
10:06 timotimo i'll be AFK for at least an hour in a few minutes
10:06 jnthn We can elide them in spesh/JIT too :)
10:08 timotimo ah, NativeRef doesn't even have a spesh function yet
10:10 dalek MoarVM: ffb1257 | jnthn++ | src/6model/reprs/NativeRef.c:
10:10 dalek MoarVM: Add missing checks for HLL ref type configuration.
10:10 dalek MoarVM: review: https://github.com/MoarVM/MoarVM/commit/ffb125782a
10:11 jnthn The native ref protocol is defined in the NQP repo under docs/6model, btw
10:11 timotimo k
10:15 timotimo to be honest, i forgot how to pass the configuration hash for the compose protocols on towards the repr when building a class :\
10:15 timotimo but i'm going to be doing that AFK thing right now
10:16 jnthn k o/
10:16 timotimo o/
10:16 * timotimo ... vroom vroom ...
10:31 brrt left #moarvm
10:51 kjs_ joined #moarvm
11:09 agentzh joined #moarvm
11:12 kjs_ joined #moarvm
11:13 Ven joined #moarvm
11:34 vendethiel joined #moarvm
11:58 brrt joined #moarvm
13:23 kjs_ joined #moarvm
13:54 vendethiel joined #moarvm
13:57 timotimo if you (or someone) tells me where to pass the compose protocol data, i'll go ahead and build the ref classes for nqp
13:58 timotimo but first, afk for a while
13:59 jnthn timotimo: nqp::composetype; see NativeRefHOW in Rakudo for a full example
14:07 Ven joined #moarvm
14:22 timotimo thanks
14:24 timotimo well, i have a full example now, but i don't quite know how much i'm supposed to cut out of it
14:24 jnthn Most of it
14:25 jnthn You just need an nqp::newtype and nqp::composetype really
14:25 jnthn Once for each native type
14:26 timotimo and it'd go at the bottom of NQP's core/NQPMu?
14:26 timotimo in the "not parrot" section
14:27 timotimo and then my \NativeIntLexRef := nqp::newtype? or something to do with stashes and EXPORTblah?
14:28 timotimo i also don't know what metaclass to supply for nqp::newtype
14:29 timotimo nqp-m: say nqp::gethow(NQPMu)
14:29 camelia nqp-moarvm: OUTPUT«Confused at line 2, near "say nqp::g"␤   at gen/moar/stage2/NQPHLL.nqp:490  (/home/camelia/rakudo-inst-1/languages/nqp/lib/NQPHLL.moarvm:panic:105)␤ from gen/moar/stage2/NQP.nqp:921  (/home/camelia/rakudo-inst-1/languages/nqp/lib/nqp.moarvm:comp_unit:872)␤ f…»
14:30 timotimo nqp-m: say(nqp::gethow(NQPMu))
14:30 camelia nqp-moarvm: OUTPUT«No registered operation handler for 'gethow'␤   at gen/moar/stage2/QAST.nqp:1406  (/home/camelia/rakudo-inst-1/languages/nqp/lib/QAST.moarvm:compile_op:64)␤ from gen/moar/stage2/QAST.nqp:5194  (/home/camelia/rakudo-inst-1/languages/nqp/lib/QAST.moarvm:compile_…»
14:30 timotimo nqp-m: say(nqp::how(NQPMu))
14:30 camelia nqp-moarvm: OUTPUT«cannot stringify this␤   at gen/moar/stage2/NQPCORE.setting:682  (/home/camelia/rakudo-inst-1/languages/nqp/lib/NQPCORE.setting.moarvm:print:13)␤ from gen/moar/stage2/NQPCORE.setting:688  (/home/camelia/rakudo-inst-1/languages/nqp/lib/NQPCORE.setting.moarvm:sa…»
14:30 timotimo nqp-m: say(nqp::how(NQPMu).name)
14:30 camelia nqp-moarvm: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤   at gen/moar/stage2/nqpmo.nqp:1201  (/home/camelia/rakudo-inst-1/languages/nqp/lib/nqpmo.moarvm:name:0)␤ from /tmp/i_kN5rDW64:1  (<ephemeral file>:<mainline>:28)␤ from gen/moar/stage2/NQPHLL.nqp:12…»
14:30 timotimo nqp-m: say(nqp::how(NQPMu).name(nqp::how(NQPMu)))
14:30 camelia nqp-moarvm: OUTPUT«NQPMu␤»
14:30 timotimo nqp-m: say(nqp::how(NQPMu) =:= NQPMu)
14:30 camelia nqp-moarvm: OUTPUT«0␤»
14:30 jnthn timotimo: no no no, you're not meant to add anything ot NQP
14:30 jnthn Just write this in the test
14:31 timotimo oh
14:31 timotimo i'd use NQPClassHOW, duh
14:31 jnthn Doesn't matter too much what meta-class you use either
14:31 jnthn Any class will do
14:32 timotimo huh, all right
14:37 timotimo the repr protocol says there's "attribute", "positional" and "lexical", is there another for locals or does that fall under one of those three?
14:39 jnthn lexical covers locals
14:39 timotimo OK
14:39 timotimo just saw it in moar's code for nativeref.c
14:40 timotimo .o( that means only half the amount of classes to make! )
14:40 timotimo and then i'd gethllconfig, add the keys and sethllconfig again?
14:43 jnthn No, you can just sethllconfig
14:43 jnthn It doesn't remove existing things
14:44 timotimo ah, cool
14:44 timotimo this should get me a lot closer to something working :)
14:45 timotimo yesterday when i wrote the tests i had a massive brainfart; i thought i could only refer to the same local with the same scope, even though i had just implemented looking for the same name in both local and localref scope and differentiating behavior based on that
14:47 jnthn local and localref are kinda two views of the same scope
14:47 agentzh joined #moarvm
14:47 timotimo aye
14:48 timotimo https://gist.github.com/timo/20f6731d7f67e82f4f55 - this is how i build the classes, but in gdb i see the current hll's config still doesn't have the *_lex_ref attributes set :\
14:49 timotimo i'll be afk for a bit now
14:51 jnthn timotimo: You may need to add a QAST::CompUnit around your tests and :hll('nqp')
15:06 vendethiel joined #moarvm
15:18 FROGGS joined #moarvm
15:32 timotimo understood
15:33 timotimo not ok 1 - localref of type int with value 23 assigned to itCannot assign to an immutable value
15:33 timotimo progress!
15:33 brrt many progress
15:34 jnthn so test fail
15:34 timotimo yes
15:35 * jnthn will prolly add ~300 tests to roast today :)
15:35 timotimo https://gist.github.com/timo/b68416dedda71b72a458#file-gistfile1-txt-L33 - it's basically exactly this test, but with a compunit around it
15:35 FROGGS add to what?
15:35 timotimo that test should work that way, shouldn't it?
15:35 timotimo FROGGS: for native arrays
15:35 FROGGS to nqp/t/nsa?
15:36 FROGGS or to moarvm
15:36 timotimo he said "to roast"
15:36 FROGGS ahh
15:36 timotimo :)(
15:36 timotimo er
15:36 FROGGS I read 'from roast'
15:36 timotimo :)
15:36 timotimo oh
15:37 * timotimo removed the decont call from there also and turned the last localref into local instead
15:37 timotimo that's a better way to read from a localref
15:44 vendethiel joined #moarvm
15:44 timotimo https://gist.github.com/timo/b68416dedda71b72a458 - the tests section of this gist is now up to date; jnthn, can you tell me that the qast tree is correct like this and i should be looking elsewhere?
15:45 jnthn timotimo: First test looks sane
15:45 timotimo ho-hum
15:45 timotimo i wonder what i'm doing wrong, then
15:45 jnthn Second test wants assign_n, and third assign_s
15:46 timotimo ah! yes
15:46 timotimo but the exception i'm getting is Cannot assign to an immutable value
15:47 jnthn Oh!
15:47 jnthn Sorry
15:47 jnthn You also need to set up the container spec on the types too
15:47 timotimo ooooh
15:47 jnthn It's one line addition, thankfully :)
15:48 jnthn nqp::setcontspec($class, 'native_ref', nqp::null());
15:48 timotimo in the part that creates the classes in that test file, eh?
15:48 jnthn Right after nqp::composetype line
15:48 timotimo good
15:48 timotimo doesn't seem to be enough yet
15:49 jnthn Oh?
15:49 timotimo i have to set it rw maybe?
15:49 jnthn No, making it a container does that
15:49 timotimo mhm
15:49 jnthn If you mean the type
15:49 * brrt afk :-)
15:50 brrt left #moarvm
15:50 timotimo same exception. i wonder where i should look to figure out what's going wrong here
15:50 jnthn What error do you get now?
15:50 timotimo ... immubatle value
15:50 jnthn OK, that doens't make much sense...
15:50 timotimo do i need the Stmts + Stmts setup for setting up variables and then having code that uses them?
15:50 jnthn I wonder if the code-gen is correct
15:51 timotimo i'll give you an up-to-date diff
15:51 jnthn No, your test case looks uqite legit
15:51 timotimo diff of nqp i mean
15:51 jnthn QAST::Var.new( :name<intloc>, :scope<localref> ),
15:51 jnthn Does adding :returns(int) to this line help?
15:52 timotimo doesn't
15:52 jnthn OK, good
15:52 timotimo ah, the nqp diff was already correct, i just added an empty line to NQPMu.nqp by accident
15:53 dalek joined #moarvm
15:54 timotimo i don't think i recall having written any code that'd instantiate a container of the *_lex_ref type from the hll, but i suppose that's done for me by moarvm?
15:56 jnthn Yes, that's what the getregref_* ops doe
15:57 jnthn *do
15:57 jnthn afk for a little bit
15:57 timotimo did i have to build a reg first before i use a regref?
15:58 timotimo er, i'm already doing that
16:00 kjs_ joined #moarvm
16:04 [Coke] joined #moarvm
16:13 vendethiel joined #moarvm
16:31 timotimo i'm going to go have dinner with my parents now
16:36 agentzh joined #moarvm
16:44 retupmoca joined #moarvm
16:45 Util joined #moarvm
16:45 btyler joined #moarvm
17:22 tgt joined #moarvm
17:34 * jnthn back
18:19 * FROGGS forth
18:20 * jnthn stacks FROGGS
18:29 kjs_ joined #moarvm
18:40 lizmat_ joined #moarvm
18:46 timotimo i've had dinner and still don't really know how to go on with my stuff; i suppose i could try to dump the MAST that the test qasts generate and look at them in more details
18:46 timotimo ?
18:47 timotimo alternatively have a look in gdb what happens around the assign_i that errors out?
18:51 jnthn I'd look at the MAST first
18:52 jnthn I really can't spot what's missing
18:53 jnthn dinner; bbs
18:55 timotimo 'k
19:01 timotimo i can't just set the target to mbc and dump it to a --output file because "compunitmainline requires an MVMCompUnit" :(
19:34 jnthn eek, my native arrays tests hit a spesh bug...
19:35 * timotimo ducks
19:36 jnthn oh
19:37 jnthn It's actually a JIT bug
19:37 timotimo ah, so perhaps it's not my fault :)
19:38 timotimo hm. :from('ast'), :target('mast') also complains about the compunitmainline thing :\
19:46 dalek MoarVM: cd381e1 | jnthn++ | src/jit/graph.c:
19:46 dalek MoarVM: Fix JIT of bindpos_n.
19:46 dalek MoarVM: review: https://github.com/MoarVM/MoarVM/commit/cd381e1bec
19:48 jnthn That fixes it.
19:50 timotimo oh yeah ... float values
19:50 timotimo weird registers and stuff
19:50 japhb jnthn: I haven't kept track, unfortunately.  Are native arrays in for r-m 2015.03?  What about CUnion?
19:51 jnthn japhb: Yeah, to some level
19:51 jnthn japhb: They won't be optimized, and there'll probably be rough edges.
19:51 jnthn japhb: But I've got a couple of hundred passing native array tests so far. So at least something works. :)
19:52 timotimo \o/
20:13 FROGGS japhb: in theory CUnions could go in after some more testing on other platforms than windows/linux
20:14 timotimo sounds like something nwc10 ought to hea r:)
20:15 FROGGS true
20:44 japhb FROGGS: Erm ... why couldn't that be merged now and improved for other platforms later, as with previous parts of NativeCall?  Is it a fear that the *API* will have to change?
20:44 japhb jnthn: Oh, excellent!
20:45 FROGGS jnthn: the only issue (I think) is that I'd like to change the default for CStructs and CUnions...
20:45 * japhb dreams of being able to dabble in OpenGL again, slinging around big float arrays efficiently
20:45 japhb Default?
20:45 FROGGS so that they are inlined by default instead of referenced when they appear as attributes in CStructs
20:50 FROGGS ... which would break quite some modules out there...
20:51 FROGGS but to me it is a sane choice, and I'd just need to convince jnthn I guess :o)
20:51 FROGGS err, jnthn++ :P
20:53 japhb Oh sure, butter him up.  :-)
20:53 jnthn What what? :P
20:53 FROGGS *g*
20:53 jnthn FROGGS: How would you get the current semantics?
20:54 japhb Actually, given that we have Pointer[Type], changing the default begins to make more sense.  Certainly when you're thinking in C-mind it does.
20:54 jnthn Yes, was gonna ask if it's Pointer[Type]
20:54 jnthn The deeper question is how far we go with this though
20:54 jnthn For example
20:55 jnthn sub foo(SomeCStructType $x) is native(...) {*}
20:55 jnthn Does that need Pointer[SomeCStructType]?
20:55 FROGGS no
20:55 FROGGS since you cannot pass a struct by itself
20:56 japhb .oO( class SomeCStructTypePtr is Pointer[SomeCStructType]; sub foo(SomeCStructTypePtr $x) ... }
20:56 japhb s/'}'/ = ')'
20:57 jnthn FROGGS: You can in C! :P
20:57 FROGGS hmmm
20:58 jnthn It's not the best of ideas though, iirc
20:58 FROGGS I guess I'd have to play with that in another branch and see where would end up
20:59 jnthn FROGGS: http://stackoverflow.com/questions/161788/are-there-any-downsides-to-passing-structs-by-value-in-c-rather-than-passing-a has some discussion
20:59 jnthn While it's certainly *possible*, it's not common
21:01 jnthn However, passing a C union type as an argument is more common.
21:02 FROGGS hmmm, yeah
21:03 FROGGS well, I guess it would be more sane to also pass a 'Pointer[MyStruct]' or 'MyStruct is rw' to a native sub...
22:27 FROGGS Heap corruption detected: pointer 0x7fccef931fc8 to past fromspace
22:27 FROGGS :o(
22:33 jnthn f**k :/
22:33 jnthn How'd you get that one, ooc?
22:34 FROGGS running https://github.com/perl6/cpandatesters.perl6.org/blob/master/jobs/gen-dists.pl
22:34 FROGGS but happens very rarely
22:34 FROGGS hmmm
22:34 FROGGS I should probably update my rakudo+moar
22:35 FROGGS because I am not sure if DBIish does use callbacks for the postgres stuff I do
22:37 FROGGS hmmm no, I dont think callbacks are involved
23:19 donaldh joined #moarvm

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary