Perl 6 language and compiler development | Logs at colabti.org/irclogger/irclogger_log/perl6-dev | For toolchain/installation stuff see #perl6-toolchain | For MoarVM see #moarvm
Set by Zoffix on 27 July 2018.
00:34 softmoth joined 00:43 anatofuz joined 00:51 anatofuz left 00:57 anatofuz joined 01:05 anatofuz left 01:18 anatofuz joined 01:21 anatofuz_ joined 01:23 anatofuz left, anatofuz_ left, anatofuz_ joined 01:26 anatofuz_ left 01:27 Kaiepi joined 01:30 anatofuz joined, anatofuz left 01:34 anatofuz joined 01:36 anatofuz left 01:40 anatofuz joined 01:49 anatofuz left, anatofuz joined 01:50 anatofuz left, anatofuz joined 02:01 anatofuz left 02:06 anatofuz joined 02:27 anatofuz left 03:41 [Coke] left 03:43 [Coke] joined 03:45 anatofuz joined 03:56 softmoth left 04:33 anatofuz left 04:35 anatofuz joined 05:45 ZzZombo_ joined 05:48 ZzZombo left, ZzZombo_ is now known as ZzZombo 06:32 reportable6 left 06:34 reportable6 joined 06:38 anatofuz left 06:39 anatofuz joined 06:44 anatofuz left 06:52 anatofuz joined 07:50 ZzZombo_ joined 07:53 ZzZombo left, ZzZombo_ is now known as ZzZombo 08:38 leont joined 08:56 ZzZombo_ joined 08:59 ZzZombo left, ZzZombo_ is now known as ZzZombo 09:39 leont left 10:17 softmoth joined 10:28 anatofuz left 10:58 squashable6 left 11:01 squashable6 joined, ChanServ sets mode: +v squashable6 11:05 softmoth left
|Tux| Rakudo version 2019.07.1-388-g1fef78388 - MoarVM version 2019.07.1-257-g39f577438
csv-ip5xs0.764 - 0.780
csv-ip5xs-206.492 - 6.494
csv-parser20.678 - 21.529
csv-test-xs-200.421 - 0.432
test6.861 - 7.081
test-t1.731 - 1.732
test-t --race0.773 - 0.798
test-t-2029.496 - 29.668
test-t-20 --race8.723 - 9.048
12:00
12:28 lucasb joined 13:30 cognominal joined
cognominal hi, how come in nqp/moarvm (and perl6) say(0.0) prints 0 instead of 0.0 ? Also where does that happen ? 13:32
lizmat Rational.Str 13:52
13:57 cognomin_ joined 14:00 cognominal left
[Coke] m: say 0.0; dd 0.0 14:01
camelia 0
0.0
lizmat cognomin_: more specifically github.com/rakudo/rakudo/blob/mast...l.pm6#L127 14:11
cognomin_ thx. lizmat, right now I am more interested in nqp :). Even if I don't understand that .gist in this particular case does not behave as .perl 14:16
lizmat because if a class does not have a gist method, then it will fall back to .Str 14:17
cognomin_ But where does that happen in nqp ?
Apparently not in P6Num itself 14:18
lizmat hmmm... github.com/rakudo/rakudo/blob/mast...u.pm6#L604 looks like it falls back to .perl 14:19
cognomin_ I am writing code in nqp that I want to roundtrip as a sanity test and it does not because 0 is an int not a num 14:21
timotimo oh, yeah, the nqp compiler is a bit weird with num vs int 14:24
a few months ago we merged a branch that makes it use int much more often, whereas it used to use num for almost everything
cognomin_ 00017 getlex_no loc_6_obj, '&say'
00018 decont loc_6_obj, loc_6_obj
00019 const_n64 loc_7_num, 0.000000
0
timotimo does that have something to do with it?
cognomin_ No magic with the compiler 14:25
timotimo m: say(my int $ := 0)
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot bind to natively typed variable '$ANON_VAR__1'; use assignment instead
at <tmp>:1
------> 3say(my int $ := 07ā5)
timotimo m: say(my int $ = 0)
camelia 0
timotimo m: say(0); say(0e0) 14:26
camelia 0
0
timotimo oh, that's not nqp :)
nqp: say("test")
camelia test
timotimo nqp: say(0); say(0e0)
camelia 0
0
timotimo nqp: say(my int $ := 0)
camelia Confused at line 2, near "say(my int"
at gen/moar/stage2/NQPHLL.nqp:1025 (/home/camelia/rakudo-m-inst-2/share/nqp/lib/NQPHLL.moarvm:panic)
from gen/moar/stage2/NQP.nqp:924 (/home/camelia/rakudo-m-inst-2/share/nqp/lib/nqp.moarvm:comp_unit)
from gen/mā€¦
cognomin_ I can't pinpoint where in nqp the num is converted to an int 14:28
timotimo what have you tried?
cognomin_ I just expected ~0.0 eq '0'. I will work around it 14:32
I am more pissed at not understanding the internals than at them not doing what I expected 14:33
timotimo i assume you've checked the output of --target= for optimize as well as ast? 14:34
cognomin_ Yes I pasted the relevant part of a moar dump.
ok, I guess I got it. using nqp::say I see a coerce_ns op in the dump 14:41
timotimo the optimize and ast are rather different from the moar dump 14:42
cognomin_ github.com/MoarVM/MoarVM/blob/mast...isu.c#L342 15:01
So .perl probably does not use that fast algorithm if it correctly prints 0.0 15:03
15:06 vrurg left 15:07 vrurg joined 15:08 cognominal joined 15:11 cognomin_ left 15:27 grayrider joined 15:30 vrurg left, vrurg joined 15:34 Kaiepi left 15:36 Guest3346 left 16:09 grayrider left
MasterDuke any reason that couldn't be changed to make it '0.0'? 16:18
well, nqp has a bunch of tests explicitly checking that 0.0 stringifies to '0' 16:24
16:26 Kaiepi joined
Kaiepi did what i sent right before dcing actually get sent? 16:27
timotimo doesn't seem so
Kaiepi aight 16:28
i want to make it so IO::Socket::INET only uses the enums defined in IO to represent socket families/types/protocols, which are handled using Int at the moment, since backends will not support using any other values than the ones those will contain. how should i go about this, since this is a breaking change?
MasterDuke so does rakudo
but cognominal brings up a good point. should 0.0 really stringify to '0'? 16:30
hm, perl5 does the same: `perl -E 'say 0.0'` prints '0' 16:32
but ruby and python(2|3) both print '0.0' 16:33
cognominal perl tends to play fast and loose with type but there is no reason not to please the functional crowd when we can 16:36
nqp -e 'my $i := 0.0; say(nqp::eqaddr($i.WHAT, (+~$i).WHAT))' # should print 1 for any numeric type 16:40
I created a MoarVM pull request but was unable to test. github.com/MoarVM/MoarVM/pull/1191 16:51
literaly much ado about nothing :) 16:54
If someone can read the comment in the pull request so as to test with nqp, I would be thankful 17:01
japhb nqp: say(0e0); say(1e0) 17:08
camelia 0
1
japhb cognominal: Make sure your patch doesn't lead to a discontinuity in the other direction (that 0e0 is the *only* integer-valued float that gets a decimal point). 17:09
17:16 grayrider joined
cognominal yup, I didn't 17:23
ok, MasterDuke run tests. And the fallout is huge. So better forget about my request. 17:58
MasterDuke cognominal: i think it might make sense to create an issue in the problem-solving repo 17:59
cognominal So I close the request and create an issue ? 18:00
lizmat m: say 0.0.Str; say 0.0.perl
camelia 0
0.0
lizmat cognominal: do I understand correctly that the problem is that 0.0.Str is "0" ? 18:01
cognominal yes, even my problem was at the nqp level. 0.0 and 0 are different things typewise so cycling using ~ than + gives an int instead of a num, so it is not a noop 18:04
lizmat yeah, but .Str is not guaranteed to roundtrip, nor is .gist
only .perl is supposed to roundtrip
so it doesn't feel like an issue to me, but actually a design decision 18:05
made long ago, probably to match Perl 5's behaviour 18:06
$ perl -E 'say 0.0'
0
cognominal ok. I close the pull request (which was incomplete anyway) with your comments and don't open an issue. Thx lizmat. Sorry for the mess 18:08
lizmat well, opening a problem-solving issue might make sense, because following Perl 5's behaviour may not be the best in the long run? 18:10
afk&
[Coke] m: print 0.0 18:32
camelia 0
Geth_ Ā¦ problem-solving: cognominal assigned to jnthn Issue 0.0.gist returns "0.0" instead of "0" but 0.0.perl works as expected github.com/perl6/problem-solving/issues/113 18:33
cognominal I got the subject backward, corrected 18:36
nine I got a working branch where Inline::Perl5 no longer blocks precompilation of its users! 20:01
I.e. a module that has a "use Foo:from<Perl5>;" in it can now be precompiled. When loaded it will load the Perl 5 interpreter and restore all the modules that were loaded during compilation and fix up all the code references it took when creating wrapper methods. 20:03
MasterDuke wow. how much work was that? 20:04
nine Depending on how you count a couple of days or years. I've had plans for this for years and made several attempts during that period but only now got the skill to actually pull it off. 20:05
In case you read yesterday's backlog, the "Cannot invoke this object (REPR: Null; VMNull)" issue is something that made it really hard. 20:06
MasterDuke yeah, i don't like running into those 20:08
nine I hit another hard issue today though that's still unsolved. Some cases won't work with NativeCall exporting that CHECK phaser for creating optimized function bodies at compile time 20:09
This breaks when a script uses Inline::Perl5 and loads a module that also uses Inline::Perl5. Will segfault due to a NULL jitcode in the NativeCallBody 20:13
MasterDuke that seems tricky to fix 20:15
nine It may help that I wrote the whole damn thing...but even so I only have the faintest idea of what may go wrong 20:17
jnthn Wow, nine++ 20:29
timotimo impressive 21:02
japhb Yeah, that's some good hacking right there. nine++ 21:16
vrurg nine: BTW, I'm wandering the jungles of grammar/action/serialization. So far, my prime suspect is block_closure which clones a code object but neither serializes it itself not proclaims it a clone of the source cuid. 21:44
So, unless the method clone does serialize it, that's most certainly the cause of 'REPR: Null' bug. 21:45
21:58 MasterDuke left
jnthn vrurg: Hmmm 23:12
Interesting.
(I thought I had something useful to say, but I don't think it is quite useful, having re-read what you said :))
I'd thought the problem was not quite in the cloning, but in the later lexical fixup, fwiw 23:15
vrurg jnthn: I'm not sure if I'm right. Would the clone be lost method installed on the class would be VMNill'ed
And I don't figure out if the fixup is being executed or if it's ever installed. 23:16
s/don't/can't/
finish_code_object doesn't install any fixup if in precompilation mode. 23:17
Due to lack of knowledge, I'm not even sure what's to be done in it. Wild guess is it must add the closure to the SC. 23:20
23:28 camelCaser left 23:30 leont joined, b2gills left 23:33 camelCaser joined
vrurg I'm lost, but neither compstuff[2] is getting called upon cloning nor fixup code. 23:38
23:45 b2gills joined