github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
00:09 Altai-man joined 00:11 sena_kun left 00:25 Altai-man left 01:15 lucasb left 03:47 MasterDuke left 08:09 Altai-man joined 08:52 MasterDuke joined 09:06 zakharyas joined
nwc10 good *, #moarvm 09:11
09:14 domidumont joined 09:39 MasterDuke left 10:44 MasterDuke joined 11:04 domidumont left
MasterDuke timotimo: any further thoughts/suggestions for github.com/MoarVM/MoarVM/pull/1376 ? or should i merge as is and someone who knows html/css/etc can prettify the output? 11:04
11:46 MasterDuke left 11:54 MasterDuke joined 12:10 sena_kun joined 12:11 Altai-man left 12:14 MasterDuke left 12:16 zakharyas left 13:08 MasterDuke joined
lizmat does this ring a bell with anyone? 13:15
Serialization Error: missing static code ref for closure 'run'
seen at github.com/lizmat/Text-Flags/runs/...focus=true 13:24
afk for a few hours&
13:33 zakharyas joined 13:47 lucasb joined
timotimo MasterDuke: i think stuff in tools/ that isn't used regularly as a necessary part of development, like unicode updates or update_ops, can be merged a bit more leniently 14:59
MasterDuke yeah, i don't mind merging as is.but if you have some easy enhancements i'll do them first 15:00
[Coke] I wouldn't worry about pretty if the functionality is improved, for this tool. 15:01
I'd be happy to look at the existing output if you gave me a sample... been a while since I've had done css for money, but could look.
also, some checks on the branch not successful? 15:02
MasterDuke github.com/MoarVM/MoarVM/files/548...e.html.txt but you need to remove the final '.txt'
the fails are some random moarvm/nqp problem, completely unrelated to my changes 15:03
15:05 MasterDuke left
[Coke] I think the span hover is fine for now - a more involved solution would be a click to modal, maybe, where you click on "2 more" and get a div instead. But that's a much bigger change (and requires JS) 15:06
(for 2 more? span is fine. for 65 more? think we do need the popup eventually)
15:12 MasterDuke joined
MasterDuke ugh, don't know why my connection keeps dropping 15:12
15:14 vrurg_ is now known as vrurg
Geth_ MoarVM: 6a2284e665 | (Daniel Green)++ | tools/parse_coverage_report.p6
Report the lines that caused coverage

This makes the program even more specific to parsing a coverage report of a Rakudo spectest. But the benefit is you can see what lines in the tests cover lines in Rakudo. It would probably be better to create a table, or hoverover/popup (maybe on the line number?), but I don't know HTML/CSS/JS/etc, so just sticking them at the end of the line.
15:22
MoarVM: aa83051a1d | (Daniel Green)++ | tools/parse_coverage_report.p6
If there are a lot of covering lines, hide them...

behind a <span>.
MoarVM: 37e4618f4d | MasterDuke17++ (committed using GitHub Web editor) | tools/parse_coverage_report.p6
Merge pull request #1376 from MasterDuke17/add_file_causing_coverage_to_parse_coverage_report
[Coke] MasterDuke++ 15:23
MasterDuke thanks for looking
timotimo: if you want to help with something completely unrelated, i was reading www.mail-archive.com/perl6-all@per...09603.html again recently and just tried to do a completely terrible implementation of doing an nqp::index before a regex with a literal 15:24
timotimo ah, you mean running the index before the regex even runs at all? 15:26
MasterDuke yeah 15:28
gist.github.com/MasterDuke17/a124b...2dae69d6f9 15:31
building nqp dies with `+++ Compiling NQPP5QRegex.moarvmThis representation (P6int) does not support attribute storage (for type BOOTInt) at gen/moar/stage2/QRegex.nqp:1695 (/home/dan/Source/perl6/nqp/QRegex.moarvm:!protoregex) from <unknown>:1 (nqp.moarvm:statement_control)` 15:32
but an nqp-m does get created and trying to run a regex with it dies with `Cannot find method 'MATCH' on 'BOOTInt': no method cache and no .^find_method at gen/moar/stage2/QRegex.nqp:2258 (/home/dan/Source/perl6/nqp/QRegex.moarvm:parse) from gen/moar/stage2/QRegex.nqp:2351 (/home/dan/Source/perl6/nqp/QRegex.moarvm:ACCEPTS) from <unknown>:1 15:33
(/home/dan/Source/perl6/nqp/NQPCORE.setting.moarvm:ACCEPTS) from -e:1 (<ephemeral file>:<mainline>)`
timotimo i wonder if having code in this place of the optimizer will get us around the regex initialization at all 15:37
or if it's too late
what does the dump look like from the optimizer? 15:38
MasterDuke gist updated 15:39
timotimo there's no else branch, right? 15:40
MasterDuke right
timotimo so if the text isn't found, what does it return actually? 0 or something? 15:41
MasterDuke i guess, that's probably where the errors about P6int and such are coming from 15:42
but i wasn't sure what the else should be
timotimo right, it'll have to return a "failed match" match object
so i guess something something !cursor-fail something
15:44 brrt joined
brrt \o 15:44
with an rpi 400 I might finally get an armv8 machine 15:45
MasterDuke hm, add an else of `- QAST::Op(callmethod !cursor_fail) - QAST::Var(lexical $/)` (or $¢) dies with `Cannot call method '!cursor_fail' on a null object` 15:56
nwc10 o/ 16:04
timotimo it's possible that $/ isn't available as a lexical, only in some register, and the regex compiler handles hooking it up to everything? 16:06
MasterDuke so gist.github.com/MasterDuke17/a124b...-txt-L8-L9 is kind of lying? 16:08
16:08 Altai-man joined
MasterDuke hm, i now have it building, but it's not any faster (and if i manually put the `nqp::index(...) && ` in the example i'm running it is) 16:10
16:11 sena_kun left
timotimo oh i didn't look at the thing right apparently 16:20
can you update the diff again? 16:21
and the output as well 16:22
MasterDuke updated to current status 16:23
if i put the `say()`s back i get `Oops!!! Cannot stringify this object of type P6opaque (QAST::Regex)` 16:25
not quite sure what i did to get it to build. may have confused myself 16:26
timotimo »Confused at line 6, near "use QRegex« sounds like the regex engine isn't working right at that point 16:28
since that's probably the start of the file, and the first file that tries parsing in the first place
MasterDuke yeah 16:29
notice anything i'm doing obviously wrong?
timotimo i'd be interested in more context around the regex itself; i'm not sure how a bare Regex node of type fail will work, like is there usually something around it? 16:30
MasterDuke dunno, there aren't many of them manually created in the source 16:32
[Coke] I would use dd instead of say in case something is generating output during the build.
(or at least note)
timotimo this is nqp code, it doesn't have dd, but it does have note() 16:33
MasterDuke yea, switching to note() doesn't change anything 16:34
[Coke] ah well 16:35
timotimo it occurs to me: do we do the scan-for-literal optimization for stuff like / [initial]+ / at all? 16:37
it's quite possible i forgot about that case completely
oh jesus 16:38
MasterDuke oh?
timotimo gist.github.com/timo/4430620df5837...timization - that looks impressive 16:39
possibly wrong?
MasterDuke hm. maybe not? 16:41
timotimo need to look at the source
MasterDuke github.com/Raku/nqp/blob/master/sr...ar.nqp#L80 16:42
timotimo this is about pod_comment, right?
i don't think it should optimize for any literals here? 16:44
MasterDuke why not?
oh, because of the alternations and such? 16:45
timotimo yeah
MasterDuke yeah, if there was a way to only do it for "simple" regexes, at least to start/test that would be good
timotimo your current optimization logic is "either the string is found somewhere, or it's not a match", right?
MasterDuke yeah 16:46
maybe only if `$n == 1`?
timotimo where does n come from?
MasterDuke `my int $n := nqp::elems(@($node));` at the top of `visit_children()` 16:47
timotimo ah
that won't do too much i'm afraid
i think it's an optimization that wants to happen only at the very top level maybe?
MasterDuke ah, only if `$i == something`? 16:48
timotimo more like, not inside of visit_children, since that is run everywhere 16:49
MasterDuke oh, a new branch in the if/else up in `optimize()`? 16:50
timotimo i think that would be a good place to start
in order to find if there's a literal you can work with, that'll be a little bit of work for an analysis step 16:51
MasterDuke hm. adding an 'elsif $type eq 'literal' { note($node.dump) }` doesn't ever print 16:53
timotimo this happens before all other optimizations
even / Foo / is actually a concat of scan + literal 16:54
MasterDuke hm 16:55
scan + concat + literal actually
oh, that was at target=ast. it is simplified somewhat at optimize 16:57
timotimo + pass 16:58
right, at the position you're in in method optimize you'll be seeing the ast output
unless you put your optimization at the end of method optimize as a second phase so to speak
that may be a good idea
since we would want to go through the tree anyway to analyze for literals that appear 16:59
MasterDuke hm. so if at the end it's just scan + literal + pass, turn into the `if index`? 17:00
as the simplest possible implementation
timotimo right. also, we shouldn't skip optimizing the rest of the regex for the "else" case 17:02
MasterDuke i was just going to introduce a new if before $node is returned 17:03
timotimo probably OK 17:04
17:08 squashable6 left 17:11 squashable6 joined
MasterDuke hm, is there an easy way to tell if more complicated ones are ok? e.g., if it has a literal anywhere, but no subrules 17:15
nwc10 nine: someone (well, the boss) has set his work status to "
Trump? Biden? pahhh! AMD Ryzen 7 5800X !!!"
Altai-man .oO ( 5950X ) 17:24
tellable6 2020-10-30T13:05:18Z #raku <[Coke]> altai-man (converting docs site) YAY
2020-11-01T21:24:17Z #raku-dev <vrurg> Altai-man Could you please do a blin run on R#4000?
linkable6 R#4000 [open]: github.com/rakudo/rakudo/pull/4000 Don't inherit mixin class language revision
Altai-man Oh, 4 days ago...
timotimo MasterDuke: not without a little more in-depth analysis i don't think? 17:25
we're already walking the whole regex tree, or at least the majority of it 17:39
on the way back down, we could perhaps pass back if there's any lexicals that have to be in the source for a match to be successful 17:40
and then an alteration would union them, for example
18:12 MasterDuke left 18:26 brrt left
Geth_ MoarVM/try_fix_missing_pthread_on_windows: 18e6f94e33 | (Timo Paulssen)++ | src/platform/threads.h
we need to import pthread on windows to get a type
18:37
MoarVM: timo++ created pull request #1377:
we need to import pthread on windows to get a type
18:40
timotimo .tell dumarchie please check out if github.com/MoarVM/MoarVM/pull/1377 fixes build on MinGW
tellable6 timotimo, I'll pass your message to dumarchie
18:55 brrt joined 19:02 MasterDuke joined
MasterDuke well, i have something that finds the pattern and makes that `if index + orig regex else fail regex`, but it doesn't work. i.e., a regex that should match isn't 19:05
timotimo i can take a look 19:09
may be a good idea to make this optimization depend on an environment variable
so that you can compile a full nqp first and then test different regexes on the commandline
unless you're already doing that?
MasterDuke gist.github.com/MasterDuke17/a124b...2dae69d6f9 updated 19:36
good idea
timotimo can you show the post-optimize qast? 19:38
MasterDuke no, because a fail regext can't be stringified 19:40
gist updated 19:41
timotimo huh? 19:42
MasterDuke hm, i thought that was the reason 19:44
nqp: say(QAST::Regex.new(:rxtype<literal>, "hi").dump)
camelia - QAST::Regex(:rxtype(literal) :subtype())
- hi
MasterDuke nqp: say(QAST::Regex.new(:rxtype<literal>, :subtype<fail>, "hi").dump)
camelia - QAST::Regex(:rxtype(literal) :subtype(fail))
- hi
MasterDuke but i guess not 19:45
nqp: say(QAST::Regex.new(:rxtype<literal>, "hi"))
camelia Cannot stringify this object of type P6opaque (QAST::Regex)
at gen/moar/stage2/NQPCORE.setting:1075 (/home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPCORE.setting.moarvm:join)
from gen/moar/stage2/NQPCORE.setting:1063 (/home/camelia/rakudo-m-inst-2/share…
MasterDuke that's the error
but i get that if i do --target=optimize 19:46
timotimo what the heck 19:47
maybe rxtype literal isn't right for a subtype fail
for example 19:48
│ │ │ - QAST::Regex(:rxtype(anchor) :subtype(fail)) <!>
MasterDuke changing to that makes --target=optimize succeed 19:53
now to figure out why the match doesn't though
i guess self isn't what to run index on? 19:54
19:55 MasterDuke left 19:58 zakharyas left
timotimo quite possibly, could try $/.target, but it'd be better if we could somehow properly™ expose the target string's local 19:59
20:09 sena_kun joined 20:10 MasterDuke joined 20:11 Altai-man left
MasterDuke changed the first argument to index to `QAST::Op.new(:op('callmethod'), :name('target'), QAST::Var.new(:name('$/'), :scope('lexical')))` but that dies with `Cannot call method 'target' on a null object` 20:22
timotimo i guess i would ahve to look at the mbc? 20:37
MasterDuke heh. `self` is `9` 20:42
timotimo so an integer? 20:43
MasterDuke looks like
`$¢` is empty 20:46
everything i've tried is empty. or '9' 21:02
oh, that '9' was the last char of the string i was matching against 21:03
i'm doing `if "123def789" ~~ / "def" / { say("match") } else { say("no match") }`. if i change it to "123def78" then `self` is '8'
that for sure i don't understand 21:04
timotimo that seems odd, i wonder if the code gen is just completely custom for QRegex and such, and our qast nodes put in there are .. ignored? 21:05
or treated wrong
i'd really need to see the mbc to understand this 21:09
MasterDuke gist updated 21:12
timotimo ok it doesn't seem to have a $_ lexical, and the target string seems to live in the first argument 21:14
MasterDuke i tried printing __lowered_lex_1 and __lowered_lex_2. one was empty, the other was '9' 21:15
timotimo ah, right, we can't easily know which local number they got, right?
lowered_lex_1 should be the same as self? 21:16
at what position did you print __lowered_lex_2?
MasterDuke same place i printed self
i just had two say()s 21:17
timotimo can you output the name of the type of self there? do we have DUMP in nqp? i don't think we do 21:18
m: say 1.DUMP
camelia 1
timotimo m: say [1, 2, "hi"].DUMP
camelia MVMArray: Can't shift from an empty array
in block <unit> at <tmp> line 1
timotimo hah
+ QAST::Regex.new( :rxtype<anchor>, :subtype<fail>, <!> ))); 21:19
that looks very wrong? what is <!> in pure nqp code anyway?
nqp: say(<!>)
camelia !
timotimo oh, just a quote of a string
MasterDuke nqp: say(nqp::reprname("a")) # that? 21:21
camelia P6str
timotimo i think we need to get the how and call its .name? perhaps you can nqp::getdebugname but i'm not sure that exists? 21:22
21:24 sena_kun left, sena_kun joined
[Coke] it's not documented, anyway. 21:26
jvm has "debugnoop", that's it. 21:27
MasterDuke Cannot find method 'HOW' on object of type NQPMatch
`QAST::Op.new(:op('say'), QAST::Op.new(:op('callmethod'), :name('name'), QAST::Op.new(:op('callmethod'), :name('HOW'), QAST::Var.new(:name('self'), :scope('local')))))` 21:28
ah ha 21:34
heh. ok now i have it working, but it's not faster 21:36
[Coke] is it faster on fail? 21:38
MasterDuke `my $a := 0; my $b := -1; my $s := nqp::time_n; while $b++ < 1_000_000 { $a++ if $b ~~ / 123 / }; say(nqp::sub_n(nqp::time_n, $s)); say($a)` is my test case
[Coke] I imagine it would have to be slower on success unless you were being clever.
ah
MasterDuke it only succeeds 4k times 21:39
takes ~3.7s with or without the optimization. but `./nqp-m -e 'my $a := 0; my $b := -1; my $s := nqp::time_n; while $b++ < 1_000_000 { $a++ if nqp::index($b, "123", 0) >= 0 && $b ~~ / 123 / }; say(nqp::sub_n(nqp::time_n, $s)); say($a)'` only takes ~0.17s 21:40
[Coke] maybe you need larger strings/needles before it helps? 21:41
MasterDuke but doing it manually as the example above shows is 20x faster 21:42
21:43 rypervenche left
MasterDuke it does happen outside/before the QAST::Block where it happens with the optimization 21:44
timotimo try nqp::gethow instead of calling .HOW
but i guess NQPMatch is the answer we needed
MasterDuke yeah, i now have `QAST::Op.new(:op('index'), QAST::Op.new(:op('callmethod'), :name('target'), QAST::Var.new(:name('self'), :scope('local'))), QAST::SVal.new(:value($c[1][0])), QAST::IVal.new(:value(0))),` 21:45
timotimo can you attach gdb, break on nqp::index, and dump the stack trace? 21:46
i would assume the code we're creating from the optimizer is already inside a thing where setup has already happened
after all, there is already an NQPMatch, right?
well, can't really return a failed match without building an NQPMatch
21:48 brrt left
timotimo i think we may have to do things a little different in general. like, we might have to annotate the regex block with the dominating literal and check for it when we see the regex be used inside an if or something 21:51
MasterDuke gist.github.com/MasterDuke17/a124b...2dae69d6f9 updated 21:52
timotimo yeah, the ACCEPTS method calls and the parse method calls are probably where the cost comes from
when you write it by hand you're skipping all of that 21:53
that's not as simple :< 21:57
MasterDuke hm
21:58 brrt joined
timotimo i don't know the order in which the optimizer encounters the QRegex tree vs the spot where it is mentioned 21:58
21:59 rypervenche joined
MasterDuke you mean we could be screwed if it optimizes if's before the things in the if? 22:00
when we want it to have optimized the regex inside first, then we can pull information out when doing the if?
timotimo not necessarily screwed, if we can navigate easily from the mention to the contents 22:01
22:03 vrurg left, vrurg_ joined
timotimo BBL 22:06
MasterDuke off to sleep for me 22:27
23:16 brrt left 23:37 sena_kun left 23:47 sena_kun joined