Perl 6 language and compiler development | Logs at colabti.org/irclogger/irclogger_logs/perl6-dev | For toolchain/installation stuff see #perl6-toolchain | For MoarVM see #moarvm
Set by AlexDaniel on 12 June 2018.
japhb jnthn: My mind immediately riffed on putting the world back together again, and I had an image of you with a bottle of Gorilla Glue except s/Gorilla/Camelia/ 00:05
02:02 ufobat___ joined 02:05 ufobat_ left 02:44 MasterDuke_ joined 02:45 MasterDuke left 02:59 ufobat_ joined 03:02 ufobat___ left 03:10 lizmat left 03:27 MasterDuke_ is now known as MasterDuke 03:52 MasterDuke left
Geth nqp: 339c39d203 | (Samantha McVey)++ | src/vm/moar/QAST/QASTCompilerMAST.nqp
Add the coerce_us op to QASTCOMpilerMAST for coercions
05:56
06:24 lizmat joined
samcv m: my uint $foo = 18446744073709551615; say $foo 06:28
camelia -1
samcv it seems to be treating it as an int 06:31
m: my $var = 18446744073709551610; my uint $foo = $var; say $var
camelia Cannot unbox 64 bit wide bigint into native integer
in block <unit> at <tmp> line 1
07:29 [Coke] left, [Coke] joined
Geth roast: 3e4710b02e | (Samantha McVey)++ | S03-operators/bit.t
Test that bitwise string ops maintain normalization

This adds tests for MoarVM/MoarVM#867. I fixed this in MoarVM recently and had already added tests to make sure that synthetics were handled properly and the bitwise ops operated on a codepoint basis.
I constructed codepoints which result in a codepoint that is normalized to multiple codepoints: for example 2940 +& 2910 = 2908. But 2908.chr.ords will give (2849, 2876). Test AND, OR and XOR string ops.
08:01
samcv cool. got that dealt with
08:08 Geth joined, ChanServ sets mode: +v Geth, synopsebot joined, ChanServ sets mode: +v synopsebot 08:12 lizmat left 09:21 pmurias joined
jnthn samcv++ 11:21
yoleaux 10:39Z <atroxaper> jnthn: Hi, I made a feedback about debugger in the commaide commaide.com/subscriber/feedback/2. Please take a look. Maybe you know a workaround for now :)
AlexDaniel samcv: can you update stackoverflow.com/a/44104556/2698019 to mention that %() is not an empty hash? :) 11:54
samcv m: say %().WHAT; say %() eqv {} 12:02
camelia (Hash)
True
samcv m: dd %() 12:04
camelia Hash % = {}
samcv it's not?
i did see that github conversation but how is it not empty now that i'm testing it
timotimo m: "foo" ~~ /<ident>/; say %().perl 12:05
camelia Map.new((:ident(Match.new(pos => 3, from => 0, list => (), orig => "foo", hash => Map.new(()), made => Any))))
timotimo samcv: ^
samcv ah ok that's it
timotimo it's extra trap-ish because it's eqv to {} if your $/ doesn't have anything
samcv were we proposing to change it for 6.d or 6.e?
timotimo i expect deprecate in .d, remove in .e, maybe re-introduce in .f? or maybe switch over in .e already 12:06
samcv also is it specced?
timotimo it's specced to do that, yes
i haven't actually participated in the %() discussion yet, fwiw 12:07
so my .e/.f thing was more speculation than knowledg
AlexDaniel samcv: yeah, deprecation in v6.d is a safe bet 12:34
don't know when we will be able to reintroduce it properly though
in fact, somewhere deep inside I wish for unicode brackets for creating hashesā€¦ 12:35
12:59 MasterDuke joined
MasterDuke anyone have a suggestion for speeding up has_attribute github.com/perl6/nqp/blob/master/s...nqp#L8-L14 ? 13:26
for a 3mb script that's 191k lines long (most of which is a hash literal) and takes over 2m just to parse, the top function in a --profile-compile by exclusive time is has_attribute in gen/moar/stage2/nqpmo.nqp 13:30
timotimo can you check what calls that? 13:31
MasterDuke the only thing is the apply method in the same file (at line 55) 13:33
however, there is also a src/Perl6/Metamodel/RoleToClassApplier.nqp that looks very similar (haven't checked if actually identical yet) 13:35
timotimo it sounds like we're missing a mixin cache or something 13:38
MasterDuke i haven't tried dumping the count of @attributes yet, but it is just doing a linear scan to see if the $target exists 13:39
dogbert17 I'm a bit sceptical towards this test code, is this really a good way to force a GC?? github.com/perl6/roast/blob/master...tion.t#L35 13:41
13:47 perlpilot joined 14:11 [TuxCM] joined 14:16 lizmat joined
MasterDuke ugh, printing to stderr in nqp is incredibly annoying 14:31
`nqp::writefh(nqp::getstderr(), nqp::encode('Class attributes count = ' ~ +@attributes, 'utf8', nqp::create(nqp::newtype(nqp::knowhow(), 'VMArray'))));` complains `encode requires a native int array`
timotimo that's why there is a "note" sub, no? 14:40
nqp: note("test")
camelia test
timotimo could of course be you can't use that from where you are
in which case, yeah, that's a bit wordy
MasterDuke note() causes `Cannot invoke this object (REPR: Null; VMNull)` 14:42
timotimo yeah, sounds like you don't have that sub available at that location 14:43
MasterDuke i'm in src/how/RoleToClassApplier.nqp
timotimo hm, that's strange
i'd expect you could use that there
MasterDuke i wish i could. i still haven't figured out how to output to stderr otherwise 14:44
timotimo i think you've got the right way there
MasterDuke well, changing `nqp::create(nqp::newtype(nqp::knowhow(), 'VMArray'))` into `nqp::list_i()` now complains `write_fhb requires a native array of uint8 or int8` 14:47
timotimo yep
oh
somehow i totally missed that you also pasted an error with that up there
MasterDuke yeah 14:48
timotimo check t/nqp/082-decode.t
MasterDuke so wordy... 14:50
huh. copied stuff in from t/nqp/082-decode.t and still getting `encode requires a native int array` 14:54
timotimo can i see what you did? 14:55
MasterDuke gist.github.com/MasterDuke17/3c2fa...26d359aefa 14:57
timotimo does it explode because you have create_buf twice? 14:58
also $buf8 twice
um, the sub has_attribute seems to be b0rked by copy-paste or something 15:00
it doesn't have a {
15:02 perlpilot left
MasterDuke oops, that was just a copy/paste problem 15:02
but create_buf is declared as my inside each of the other methods 15:03
the indenting is off, so it does look odd
timotimo OK
the error doesn't say what it got, right? only what it wanted? 15:04
MasterDuke correct
timotimo i'd go into gdb and see what the debug name of the object is
i.e. STABLE(obj)->debugname or debug_name, i can never remember which
we do have a function that gets it for you, though 15:05
MasterDuke huh. those errors are only thrown when `if (!elem_size)`
if moarvm
timotimo OK, can you output buf_rd->slot_type? 15:07
or maybe buf_rd is null?
MasterDuke 'value has been optimized out'. recompiling... 15:08
timotimo of course :(
MasterDuke (gdb) p buf_rd->slot_type $1 = 0 '\000' 15:10
output was `$1 = 0 '\000'`
timotimo that's an object array, i think 15:12
indeed
the question is: why
geekosaur is it me, or should 0 be reserved there? might catch bugs instead of having them manifest as misinterpretation of e.g. object arrays
timotimo MasterDuke: could you check if uint8 is perhaps NQPMu in create_buf? 15:14
MasterDuke fwiw, i get the same error with int8 15:15
i added `say(nqp::istype($type, NQPMu));` as the first line of create_buf, but it dies with `Cannot invoke this object (REPR: Null; VMNull)` 15:16
timotimo you can't get a slot type of 0 if you pass in an int :\
that's because of "say" i bet
here's what you can do
put nqp::tan(1); before that line, and disable the jit
MasterDuke geekosaur: might be a good idea, not sure of implications
timotimo put a breakpoint into interp.c for the tan function
and from there set a breakpoint in VMArray.c's compose function 15:17
but my suspicion is indeed that we're being bit, once again, by any name that's not defined giving you NQPMu :| 15:20
MasterDuke huh, the breakpoint at tan isn't getting hit 15:22
timotimo you put it in interp.c on line 769? 15:23
MasterDuke i just did `b tan`, but i just did it in interp.c and now it worked
and now broken at compose
*now i'm 15:24
src/6model/reprs/VMArray.c:1164
timotimo you'll be interested in seeing what it does inside spec_to_repr_data, i'd say. but single-step to see if it reaches that at all
or maybe just inspect what "type" comes to be 15:27
MasterDuke where? 15:28
timotimo inside compose itself
after it grabs it out of the hash
line 1171 has the type in it, for example
MasterDuke is there a way to continue to a specific line?
'cause single stepping is taking forever
timotimo yeah, but i don't know the command
MasterDuke $1 = (MVMObject *) 0x5555557b4e30 15:30
timotimo what's the debugname?
MasterDuke $2 = 0x5555557c4770 "VMNull"
timotimo aha!
and this definitely is the one time we're in create_buf? 15:31
though it shouldn't reach line 1171 if that's the case, because MVM_is_null should give true there
MasterDuke yeah, i moved it out a scope, so there's only one create_buf now
timotimo looks like you'll also need to compose your own uint8 right there 15:32
my native uint8 is repr('P6int') is nativesize( 8) is unsigned { }
MasterDuke `Cannot call method 'new_type' on a null object` 15:33
timotimo ...?! 15:34
how is all of this even
MasterDuke and all because i want to print out the length of an array to stderr... 15:36
timotimo here's my super hacky recommendation 15:37
nqp::isprime(+@attributes), breakpoint in gdb
you can give a breakpoint commands
ah, damn, that's a big int op 15:38
MasterDuke why not tan_n again?
or would it be simpler to just open a file to write to? 15:39
timotimo tan_n wants a num, but i guess it'll happily coerce for you
but for opening a file and writing, you'll still need to have a buf8
but yeah, use tan_n
MasterDuke ah, right
timotimo anyway 15:41
if you have breakpoint 5, "commands 5", then one per line: "print GET_REG(cur_op, 2).n64)", "c", "end" 15:42
"set pagination off"
then it'll print every argument passed to tan
MasterDuke k. building rakudo now 15:43
timotimo i'm sorry this is so terrible :\ 15:44
... we could have used the debugserver for this 15:45
MasterDuke ooooh
easier? 15:46
timotimo probably a bit
it doesn't yet have support for "whenever it hits this breakpoint, run that command"
MasterDuke rakudo just built, now to try compiling that pm6 in gdb... 15:47
timotimo BBIAB 15:49
Geth Ā¦ rakudo: zoffixznet self-assigned Improve empty hash creation performance with {} github.com/rakudo/rakudo/issues/1951
MasterDuke huh. the results are not very helpful 15:56
only 8 prints, with the largest value being 2 15:57
then `===SORRY!=== Frame 2 local access out of range`
so i wonder if that profile i created was incorrect/corrupted or something 16:00
the one that told me has_attribute was expensive 16:01
heh. a perf recording of compiling this .pm6 is 8gb 16:05
hm. gc_mark as the most expensive at 12.8% 16:06
a new --profile-compile say nullterm_alt is the most expensive 16:37
i'm not sure these profiles can be trusted, they're all kind of different 16:57
Geth roast: dogbert17++ created pull request #438:
Add test for RT #133016
17:08
synopsebot RT#133016 [open]: rt.perl.org/Ticket/Display.html?id=133016 Wrong set difference of Bag and List
Geth Ā¦ rakudo: zoffixznet self-unassigned Improve empty hash creation performance with {} github.com/rakudo/rakudo/issues/1951 17:14
17:22 evalable6 left 17:23 evalable6 joined 17:33 perlpilot joined
MasterDuke well, a couple in a row have said github.com/perl6/nqp/blob/master/s....nqp#L1439 is the most expensive 17:34
pmurias MasterDuke: re note not working in role that's a known bug in nqp 18:01
MasterDuke: you could try to copy&paste note 18:02
MasterDuke pmurias: i did try that, think i got the 'cannot invoke object (repr VMNull)' or whatever that error is 18:23
timotimo: why do operand indexes have to be <= 32768? 18:28
timotimo that's the max of a signed 16bit integer, right? 18:29
m: say 2 ** 15 18:30
camelia 32768
MasterDuke yeah. but MAS_Local.index is actually an MVMint64
timotimo may i ask what you'd need more than that for? :D
register arguments in the bytecode are actually 16bit, though
japhb MasterDuke: Aren't they represented by 16-bit shorts in the opcode stream?
MasterDuke i guess this `write_int16(ws->bytecode_seg, ws->bytecode_pos, (unsigned short)l->index);` is why that check is made 18:31
i'm still trying to compile that .pm6 with the large hash literal
timotimo we could get a tiny amount of memory savings by making that a 16bit int in the MAST::Local class maybe
MasterDuke and the compile dies with `===SORRY!=== Frame 2 local access out of range` 18:32
works if i shorten the file from 191k lines to 50k 18:34
100k was still too big
timotimo the code it generates is probably pretty crappy then 18:36
maybe it tries to put all objects that go into the hash into a single argument list 18:37
MasterDuke you want to see the file? 18:38
ok, the shorter version that does actually compile and produce a profile says `method MATCH()` from NQPMatch is the most expensive. that's more expected 18:40
timotimo mhm
MasterDuke it's only 6.1% though
timotimo i'd say "give me the MAST dump" but it's so hard to read compared to moar --dump of the corresponding .moar file 18:41
MasterDuke you want the moar --dump? 18:43
timotimo if that's possible.. :)
18:46 lizmat left
MasterDuke gist.github.com/MasterDuke17/d31f8...3c666c0ba4 18:46
timotimo huh 18:47
MasterDuke that's from the 50k line version that does actually compile
timotimo oh, the obvious result would be to just have a wval 18:48
so what we really need is to see how exactly that object is being created by the parser
sorry for the misdirection
MasterDuke how do we see that? 18:49
timotimo hm, but the "local access out of range" thing, that comes from code
i'm confused
but for now i'll go to the kitchen and cook something
MasterDuke pmurias: for the truffle branch, does every nqp:: op need an implementation? 18:55
pmurias MasterDuke: yes 18:56
MasterDuke: the plan is to steal most of them from the JVM backend 18:57
MasterDuke: do you want to implement some ops? ;) 19:02
pmurias is working on getting variables working on nqp-truffle atm 19:05
Geth roast: 702d866999 | (Jan-Olof Hendig)++ | S03-operators/set_difference.t
Add test for RT #133016
19:07
roast: 2288d4a3c5 | dogbert17++ (committed using GitHub Web editor) | S03-operators/set_difference.t
Merge pull request #438 from dogbert17/test-rt-133016

Add test for RT #133016
synopsebot RT#133016 [open]: rt.perl.org/Ticket/Display.html?id=133016 Wrong set difference of Bag and List
pmurias MasterDuke: once the variables and then the type coercions are in place a lot of the nqp::ops can be implemented in a pretty unstructured order 19:19
MasterDuke pmurias: i am definitely curious/interested 19:23
i may experiment with some of the simpler ops 19:26
pmurias MasterDuke: if you have any question/suggestion I'll happily answer them, as building something that people can get involved with is somethink I haven't figured out (but would be great to learn it this time) 19:29
19:59 MasterDuke left 20:03 [Tux] joined 20:18 Kaiepi left, Kaiepi joined 20:29 MasterDuke joined 21:57 ufobat_ left 22:02 MasterDuke left 22:08 pmurias left 22:09 PufferBot left 22:10 Kaiepi left 22:11 Kaiepi joined 22:17 Kaiepi left, Kaiepi joined 22:18 Kaiepi left 22:19 Kaiepi joined
Geth nqp: edf38476fa | (Jonathan Worthington)++ | tools/build/MOAR_REVISION
Get MoarVM with negated object literal spesh guard
22:45
nqp: version bump brought these changes: github.com/MoarVM/MoarVM/compare/2...9-gb3ce4f6
2c223f096b | (Jonathan Worthington)++ | src/vm/moar/QAST/QASTOperationsMAST.nqp
nqp: 50bb7de4da | (Jonathan Worthington)++ | t/moar/52-pluggable-spesh.t
Test spesh plugin object literal non-match op
22:48 MasterDuke joined 23:40 MasterDuke left 23:48 MasterDuke joined