00:15 robertle_ joined 00:37 robertle joined 01:09 robertle_ joined 01:49 ilbot3 joined 03:50 geekosaur joined 05:49 domidumont joined 05:52 geekosaur joined 05:54 domidumont joined 05:58 domidumont joined 06:34 brrt joined
brrt good * #moarvm 06:34
i've changed my mind wrt to the holes 06:35
i'm not going to do any data structures at all
we're just going to do a linear search
nine Godd morning, brrt!
s/Godd/Good/
Though there's got to be a language where godd actually means good. 06:36
Anyway, why the change of heart?
brrt two reasons
one, writing a 'generic' heap in C is actually not so hard, but the naive way requires quite a bit of allocation, which i try to avoid 06:37
but two, and much more importantly, i only need them for answering 'is there a hole in this live range at point X' 06:38
and that only at a few points, and so simplicity is well served by having a linear search rather than maintaining some lookup mechanism :-) 06:40
nine So that code is simply not hot enough to warrant an elaborate optimization? 06:41
brrt probably not 06:42
nine Well....then get on with making it just work :D 06:43
brrt :-D
nwc10 to the coffee machine!
nine nwc10: an excellent idea!
nwc10 (I thought this too, but I've dropped part of it and dropped the kitchen roll when trying to clean up) 06:44
(a metal part. it's fine. I now have coffee)
nine Yep, it's a serious design flaw in humans. How are you supposed to be able to make coffee before having coffee? That we've made it so far is a miracle. 06:46
06:58 brrt joined
lizmat some coffee machines have timers so that you can prepare it before going to bed 07:15
07:58 zakharyas joined 08:31 brrt joined 08:34 brrt joined
jnthn will soon be faced with the job of ordering a coffee machine for $new-office :) 08:36
(For now I drink at home before going there...)
nwc10 install a pipeline?
08:52 colomon_ joined
dogbert11 sounds borderline traumatic :) 08:53
dogbert11 sips coffee at $work :)
jnthn I believe one Czech city got fed up of beer trucks damaging/clogging the roads in their quaint old city center where the brewery was situated, so they built a beer pipeline to carry the beer out of town a bit. :-) 08:54
oh wait, it wasn't a Czech city
Bruges. www.geek.com/geek-cetera/belgian-ci...r-1605541/ 08:55
nwc10 "back then?" or "even today?"
jnthn 2 miles
Of beer
nwc10 "As a Canadian, it saddens me deeply to think that we could be doing this instead of trying to use Keystone XL to pump boring old oil across the country." 08:56
does Canada produce enough good beer to fill a pipeline? even if it's only 2 miles long?
and given that the US is talking about reversing the flow on one of the oil piplines, surely having a beer pipeline is opening yourself up to that sort of a risk 08:57
"We've turned it round and now we're pumping Bud Light at you as fast as we can"
moritz
.oO( maple sirup pipeline! )
dogbert11 nwc10: as a Canadian, shouldn't you be asleep?
nwc10 I was quoting the article 08:58
I think I'm 100% not Canadian
dogbert11 indeed you were :) my bad
09:00 robertle joined
dogbert11 obviously I need another cup of coffee 09:02
brrt yeah, /me too 09:25
nine .tell lizmat I do in fact have a filter machine with a timer :) Guess what? In the sleepy state before going to bed, errors are made. Like...forgetting to put the pot in its place. Great way to ensure the next day starts as badly as possible ;) 09:29
yoleaux nine: I'll pass your message to lizmat.
10:01 domidumont joined 10:46 brrt joined 11:08 brrt joined 11:40 brrt joined 12:13 domidumont joined 12:20 domidumont joined 12:51 colomon_ joined 12:58 colomon joined 13:25 colomon joined
Geth MoarVM: zoffixznet++ created pull request #593:
Use -1 instead of 0 when long right-shifting negative smallints
13:33
13:34 geekosaur joined
Zoffix Is there a small-int version of store_bigint_result() ? 14:28
Ah, I'd just use MVM_repr_box_int I guess
timotimo it's a very different thing 14:29
you want store_int64_result 14:30
store_*_result works with an MVMBigintBody, MVM_repr_box_int creates a completely new object
so you'd call it on different things 14:31
Zoffix Yeah, on diff things yeah
I don't get, what's this conditional supposed to check? github.com/MoarVM/MoarVM/blob/mast...#L652-L653 I'm reading docs and mp_get_int says it returns 32 least significant bits of mp_int and docs for mp_cmp_d say they compare a number against a single digit... but the "single digit" given in that conditional is the 32-least-significant-bits. Is that one digit? 14:36
m: say 2**32
camelia 4294967296
Zoffix Is it just checking if exponent is over 32bits? 14:37
Seems that conditional is wrong 'cause the reason -15**1 is MVM_IS_BIG_BIG_INT is because that conditional ends up being false and judging by the stuff in its true branch, -15**1 is supposed to go into that branch 14:38
timotimo mp_int refers to one chunk as a "digit"
how big exactly these digits are can be influenced by #define 14:39
Zoffix Ah ok
k, so the conditional is "if exponent is larger than its 32-LSB" and it checks if it's over 32bits and the branches of conditional need to be swapped 14:41
Zoffix does so and tests
heh 14:44
Well, I'm hitting the right branch for -15**1 now but Rakudo don't wanna run :P crashes in def of $UINT64_UPPER 14:45
Zoffix looks at it
I see, my fix is no good, I think. 14:48
14:49 stmuk joined
timotimo smallbigint was supposed to just be an optimization; i wasn't so happy when code in rakudo started relying on it (if i'm not mistaken?) 14:49
Zoffix Never mind. What I said above don't apply 'cause I read `base` as `exponent` :P 14:52
timotimo: so you're saying MVM_ISBIG_BIG_INT giving true for -15**1 is not a bug?
timotimo it'd be better if it gave false 14:53
Zoffix Oh, it's actually always false 14:55
m: use nqp; say nqp::pow_I(-15, nqp::unbox_i(Int(2**32)), Num, Int)
camelia Inf
Zoffix cause that op gives Inf for anything bigger than big int
timotimo oh? 14:56
Zoffix Well, whats' MVM_ISBIG_BIGINT? >32bits?
timotimo well, if you're exponentiating with a number that big, you're bound to run into trouble unless you're exponentiating 1
Zoffix Ah, right 14:57
Oh right, it's not always smaller never mind
timotimo and numbers below 1 are another thing again 15:01
Zoffix will NOT MVM_ISBIG_BIGINT always fit into MVM_repr_box_int ? 15:02
timotimo since we also have 64bit int on 32bit systems, yes
15:08 brrt joined
Zoffix Well, if fixed -15**1 being MVM_ISBIG_BIGINT true :) 15:09
But the fix is bogus... it just does it for <32-bit ints. I've no idea what's MVM_ISBIG_BIGINT can't do MVM_ISBIG_BIGINT(ic) in that op 'cause it don't got that property or whatever 15:10
timotimo i didn't parse that sentence 15:11
Zoffix "I don't know what I'm doing" 15:12
:)
I think the fix needs to be in src/6model/reprs/P6bigint.c somewhere or something
or maybe not 15:14
timotimo there's two different concerns for the bigint is_big stuff, really 15:15
one is "is the number a big number?"
the other is "are we storing an actual mp_int struct or just a 32bit integer?"
where the 32bit integer goes into the lower half of the pointer that'd otherwise point at the mp_int struct 15:16
you can store small numbers in an mp_int even if it could fit into the 32bit integer in the lower half of the pointer 15:17
but it's some memory overhead you could save
so really, if the number's stored in those 32bits, it has to be small, but the other way around isn't guaranteed
Zoffix Thanks. 15:27
What's mp_int->used? libtommah docs in datatypes don't really say what it it's for in 2.3 Data Types and that name is tough to search for 15:32
timotimo i expect it's one third of the typical "allocated, used, data" pattern for dynamic arrays and such 15:33
i.e. two counters and one pointer
Zoffix In mp_int struct it's got `int used, alloc, sign;` 15:34
timotimo well, yeah, there also has to be a pointer to the data
that's the third part
Zoffix Yeah mp_digit
So what's `used` for?
timotimo so it knows how many entries in the mp_digit array are valid 15:35
Zoffix Ok. Thanks. 15:36
timotimo hm. we use mp_int in an immutable pattern, i wonder if we ever waste much data from libtommath allocating too much so it could in theory grow 15:38
Zoffix Well, I see why nqp::pow_I(-15, 1...) doesn't set the smallint flag. The MVM_IS_32BIT_INT(DIGIT(i, 0)) macro returns false. 15:48
I think it needs a cast or something? Digit is `DIGIT(m,k) ((m)->dp[(k)])` and if I printf("%d") it tells me "15", but the comparison (i >= -2147483648LL && i <= 2147483647LL) gives 0. but if I set `int i = 15` then it gives true 15:49
and ->dp is `mp_digit *dp` and no idea what that is
timotimo yeah, mp_digit is different depending on the #defines and #ifdefs it has at the beginning of mp_int.h or what it's called 15:50
i'd expect you'd get better info from gdb or something
Zoffix doesn't know how to use gdb 15:51
Changing it to MVM_IS_32BIT_INT((long long)DIGIT(i, 0))) seems to work, but I don't know if that's right or what
15:53 zakharyas joined
Zoffix mp_digit looks to be a uint*_t 15:54
I'll just file an Issue 15:57
timotimo i'm trying to figure it out from the output of dwarfdump but it's really unhelpful 15:58
Zoffix travis OKed PR github.com/MoarVM/MoarVM/pull/593
Filed: github.com/MoarVM/MoarVM/issues/594 16:02
16:02 brrt joined 16:15 domidumont joined 16:18 domidumont joined 16:32 stmuk_ joined 17:28 robertle_ joined 17:36 lizmat joined 18:34 TimToady joined
Geth MoarVM: 9d7bee40e4 | (Zoffix Znet)++ | src/math/bigintops.c
Use -1 instead of 0 when long right-shifting negative smallints

  - The value of -1 is what falls out when you calculate with
   fakely-big big ints, like -15**1 (that ends up going through the
   "big int" path 'cause the flag is apparently set)
  - This is also the value you get with `div` (e.g. dd -12 div 2**32)
  - This is also the value you get on JVM backend
... (6 more lines)
19:12
MoarVM: f8bc328725 | timo++ (committed using GitHub Web editor) | src/math/bigintops.c
Merge pull request #593 from zoffixznet/fix-bitshiftr_I

Use -1 instead of 0 when long right-shifting negative smallints
timotimo Zoffix: i'm not actually sure the code is correct, but i don't know enough to really argue eithe rway 19:14
nah, i think it's fine
Zoffix is fairly sure it's right 19:15
timotimo cool 19:16
so you'll bump moar and nqp revisions and finish up the work in rakudo for this? 19:17
Zoffix Yeah
timotimo a nice speed improvement we got there 19:19
samcv i heard speed improvement. did someone say speed improvement? 19:25
good morning everyone o/
Zoffix \o
just minor improvement to +>
and I think to <+ too
or whatver it was +< 19:26
hhmmm 19:27
samcv so our values were incorrect?
hmm i see
Zoffix shit. I'm fairly sure that's the right answer for negative numbers, but might not be for positive :}
samcv Zoffix, do we have enough tests :)
Zoffix but I stresstested that patch...
samcv have you checked what tests actually exist? 19:28
Zoffix checks for positives
samcv can stresstest 1000 times but if there's only like 8 tests for something
nwc10 real positives or false positives?
(not sure if that joke works)
Zoffix yeah, oops
Zoffix--
1 sec; I'll finish the bumpage I already started and fix my bug 19:29
samcv there's like
no tests for +>
Zoffix Are you for real? :S That sucks 19:30
samcv if i grep ' \+>'
yes!
same with +> as well
Zoffix I see a few in S03-operators/bit.t
with grep -FR '+>' 19:31
samcv 5 tests in bit.t
for +>
timotimo so was there no proper check for non-negative values?
and we should have set 0 sometimes?
that was what was tingling in the back of my mind
Zoffix timotimo: yeah, for positive numbers 0 is good but for negatives it was supposed to be -1 but we were setting to 0 in all cases 19:32
timotimo OK
you didn't push any bumps yet, right?
Zoffix no. 19:34
I guess I shouldn't
samcv yeah let's get some good tests added to roast :) 19:36
Zoffix trying to find the right way to find if MVMP6bigintBody is negative... 19:38
Any tips? 19:40
Just < 0 ?
samcv uh
it uses libtommath
Zoffix I mean foo->bigint.value < 0
samcv if it's too big i don't think that will work
though i haven't played with the number stuff too much 19:41
Zoffix MP_NEG == SIGN(foo->u.bigint) ?
That?
samcv yeah that sounds good 19:43
Zoffix "Segmentation fault"
samcv it's a bigintBody or a MVMP6bigint you need to get it from 19:44
Zoffix foo is a MVMP6bigintBody
samcv MVMP6bigintBody.bigint 19:45
where did the -> and u come from
er you'r right it is part of the union
it seems
Zoffix ā€˜MVMP6bigintBodyā€™ has no member named ā€˜bigintā€™
I think it's the first time in my life did I spend so much time figuring out if a number is negastive... 19:46
C sucks
samcv well then it mus have foo->u.value
since it can have multiple things
Zoffix ā€˜union <anonymous>ā€™ has no member named ā€˜valueā€™ 19:47
I need to relocate
samcv Zoffix, where are you editing? which var?
i will try it
same as in that commit?
bb/ 19:48
?
Zoffix samcv: this line needs to be changed to store_int64_result(bb, IF-NEGATIVE(ba) ? -1 : 0); github.com/MoarVM/MoarVM/blob/mast...ops.c#L744 19:49
And ba is MVMP6bigintBody *ba 19:50
I've no idea how to check if it's negative
Zoffix relocates
samcv ok great
thx :)
Zoffix And in rakudo `./perl6 -e '2 +> 100'` should give 0 and `./perl6 -e '-2 +> 100'` needs to give -1 19:51
samcv write some roast tests and i'll work on this for a bit
Zoffix Oh, they might not give that without my rakudo patch, but, this will: 19:53
m: use nqp; say nqp::bitshiftr_I(-2, 50, Int); # wrong; should give -1
camelia 0
Zoffix m: use nqp; say nqp::bitshiftr_I(2, 50, Int); # right; should give 0
camelia 0
Zoffix And on Moar master it gives -1 for both; and when that line is fixed the two will give right results
Zoffix &
19:54 AlexDaniel joined 20:05 Ven joined 20:16 praisethemoon joined
samcv Zoffix, i think i may have got it 20:23
Zoffix sweet 20:24
timotimo Zoffix: you need to have different code for when the bigint has the smallbigint flag set
because otherwise you'd be dereferencing a pointer with a bunch of fs at the start
and very unlikely an actually mapped address
samcv that code doesn't work though. the ternary thingy 20:25
yeah i wrote some timotimo
timotimo i didn't read enough of backscroll, and i have to afk again right now
Zoffix samcv: doesn't work how?
samcv Zoffix, just give me some tests i can test 20:26
use nqp; say nqp::bitshiftr_I(-2, 50, Int); # wrong; should give -1
that gives 0
Zoffix is on the bus atm
samcv oh no
it works
nvm
perfect
\o/ success
Zoffix cool samcv++ 20:27
samcv but i had to do the opposite of your ternary
!IS_NEGATIVE(ba) ? -1 : 0)
unless my is negative function is broken
oh yeah it was. heh 20:28
gonna run roast now 20:30
20:34 colomon joined
timotimo do we have more tests for shr on positive numbers also giving 0? on top of shr on negatives giving -1? 20:38
samcv we only have like 5 tests
Zoffix I have negatives covered in a branch in roast
samcv good 20:39
Zoffix fix-bitshift_r or whatver it was
Geth MoarVM: 362277b79f | (Samantha McVey)++ | src/math/bigintops.c
Better version of patch to fix right shifting negative smallints

The previous patch did not check what sign was there and didn't fully handle big/smallint containing P6int's. This one adds a new BIGINT_IS_NEGATIVE() function to check if it is negative.
This function may be very useful other places we need to check if a p6int is negative.
20:42
samcv ok. all is now good :)
maybe a variable extra i don't need there. though wanted zoffix to put it through the paces with his tests 20:43
so let me know how it goes Zoffix
samcv grabs some tea
20:46 colomon joined 21:00 Ven joined
jnthn I'm a tad surprised github.com/MoarVM/MoarVM/commit/36...58e807R726 compiles without parens around the condition 21:32
Oh, but maybe the macro provides them
But still, that's cheeky :P
21:34 Ven_ joined
samcv it's not a macro 21:35
github.com/MoarVM/MoarVM/commit/36...58e807R722 you commented on it ;)
jnthn I meant 21:36
if MVM_BIGINT_IS_BIG(ba) {
Either I'm really tired, or in C we normally put parens around conditions :)
heh, yes: github.com/MoarVM/MoarVM/blob/2eed...igint.h#L4 :) 21:38
timotimo oh lord, hahaha
perfect
textual macros are so amazing sometimes 21:39