Welcome to the main channel on the development of MoarVM, a virtual machine for NQP and Rakudo (moarvm.org). This channel is being logged for historical purposes.
Set by lizmat on 24 May 2021.
MasterDuke ok, this really is blowing my mind 17:42
nine ? 17:44
MasterDuke if i add an `if (ins->info->opcode == MVM_OP_cmp_i)` in the emit.dasc implementation of cmp_(i|u), it starts returning the right operand
gist.github.com/MasterDuke17/76057...b095bf4e8c 17:45
when i do that, `my uint $b = -1; say $b; use nqp; my $c; for ^100_000 -> uint $a { $c := nqp::cmp_i($b,$a) }; say $c` prints: 18446744073709551615 17:46
o = 62, cmp_i = 62
99999
MasterDuke m: my uint $b = -1; say $b; use nqp; my $c; for ^100_000 -> uint $a { $c := nqp::cmp_i($b,$a) }; say $c 17:47
camelia 18446744073709551615
-1
MasterDuke my implementations of the *_u ops seem correct, but cmp_i is getting messed up 17:49
it's fine if i copy the cmp_i case into a new cmp_u case, and just hard code the different if/else branches 17:51
does the same thing if i build with clang 17:52
Nicholas for the failing version, if you run it under valgrind, does valgrind get excited? 17:53
MasterDuke oh! it's fine if i put braces in the ifs/elses 17:54
MasterDuke and also interesting, under valgrind but without braces it gives the right value, no complaints 17:56
don't understand what's happening, but adding braces to the if/else bodies is a simple enough fix. 17:57
afk&
Nicholas usually if it worked under valgrind, that can mean that you forgot to zero a variable in a function 17:58
ASAN might reveal what
"works with braces" might have meant "a trailing else that you thought went with one if, but the C grammar thought went with a different if" 17:59
but that wouldn't be affected by valgrind
MasterDuke no complaints from asan without braces, just the incorrect value 20:47
huh. and if i add `if $a == 90_000 { $c := nqp::cos_n(rand) };` in the loop body as something to break on after it's been jitted, the value changes to '0', which is still different from when without the jit, but not the value of the right operand 20:53