github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
00:16 samcv left 00:18 samcv joined 01:00 lizmat joined
timotimo who wants an off-by-one fixed? 01:24
Geth MoarVM: f55ecdecd2 | (Timo Paulssen)++ | src/jit/graph.c
JIT: Fix Harmless Off-By-One Preventing Optimization
01:26
timotimo i saw this because CStruct doesn't turn bindattr_* into more optimized forms, but it sure could 01:28
01:34 lizmat left
masak .oO( "who wants an off-by-one fixed?" - "me too, me too!" ) 01:42
timotimo :D 01:44
(segmentation fault)
looks like during a rakudo build spesh encounters a bunch of cases where bindattr_i or getattr_i is used on a 32bit wide attribute, and the spesh function for P6Opaque bails out in that case 01:49
SubBuffer, MoarVM::Handler, MAST::Frame 01:50
that could be interesting
that requires new spesh ops, tho 01:52
02:57 Kaiepi joined 05:07 Kaiepi left 05:08 Kaiepi joined 09:58 lizmat joined 10:35 lizmat left 11:02 lizmat joined
timotimo brrt, can you hear me? :3 11:08
i'm trying to teach the nativecall jit implementation to handle double args, and i'm not getting the right result; i think i might accidentally be passing an address? 11:09
oh
from an earlier debug output i thought i was always getting JIT_ARG_DOUBLE, but it turns out i'm actually getting JIT_PARAM_DOUBLE here, which i copy-pasted from I64 or something which indeed had a lea in it 11:10
cool. 11:11
nine Obviously it should only pass an address for rw args 11:12
The lea is in MVM_JIT_ARG_I64_RW
timotimo copy-paste fail :) 11:14
but that also means that an rw double argument should be trivial
Geth MoarVM/more-nativecall-jit-arg-types: 5679821a9b | (Timo Paulssen)++ | 2 files
Change CStruct For Compatibility With Native Call JIT

Having the pointer to the actual data be first in the struct lets us handle a CStruct exactly like most other things in there.
11:16
MoarVM/more-nativecall-jit-arg-types: 62669be8dd | (Timo Paulssen)++ | 3 files
Support double Arguments In NativeCall JIT
MoarVM/spesh-optimize-more-bindattr-getattr-32bit: 03d4271cff | (Timo Paulssen)++ | 8 files
Spesh Optimize Get/Bind Attribute For int32

These are used in parts of the new bytecode compiler that's written in nqp.
The code isn't exactly hot, but it could still be worth something.
Plus, user code might have 32 bit integer attributes in use.
11:19
timotimo thanks for your help, nine :) 11:20
at first i was like "hey i can use p6o[get|bind]_i32 for CStruct, too!" but then i remembered p6o ops are for following the object body when resizing has happened due to mixins, and CStruct doesn't do that 11:32
if i knew what to replace int_sz with to get 32bit i can also build an expr template for those ops 11:35
11:42 domidumont joined
nine glad to help :) 11:47
12:57 lucasb joined, dogbert2_ left
timotimo i thought i could use sp_get_i64 on the object pointer's body 14:22
but i'm only allowed to do that on 64bit!
it's not crashing any more, even though it does get emitted! 15:16
15:16 lucasb left
timotimo why would spesh be called for a push_o when the object in question is a CStruct? 15:25
whoopsie 15:27
that's not right
Kaiepi what sort of code is MVM_frame_capturelex called on? i find the comments for it kinda lacking 15:30
timotimo whenever a block is entered that has inner blocks i guess? there's an op that gets generated and that calls this function iirc 15:32
Kaiepi i'm trying to debug github.com/rakudo/rakudo/issues/2635 since there's been a regression some point in the last week bringing it back but i don't really know where to start 15:35
all i know is that there's a shitload of VMArray and MVMCode REPRs being allocated
timotimo theoretically the heap snapshot debugger could help here, i think 15:37
actually
the allocation that trips the memory limit isn't necessarily the one that allocates too much before that 15:38
you should be able to gather some stack traces for allocations, right? with dtrace? 15:39
Kaiepi dtrace doesn't seem to be available for my os 15:44
timotimo i kind of thought dtrace came from your os :D 15:45
hm, actually i think it comes from solaris?
15:46 Ven`` joined
Kaiepi it does iirc 15:46
Geth MoarVM/spesh-optimize-more-bindattr-getattr-32bit: a37c0bff71 | (Timo Paulssen)++ | src/spesh/optimize.c
Spesh: Fix Wrong Type Selection For push_* And pop_*

The repr optimization would have depended on the type that was being pushed or the type that would be returned (although the latter wouldn't ever be known at that point) rather than the type of object that the operation was performed upon.
That would have lead to bogus optimization for push_* and missed opportunities for pop_*.
15:48
MoarVM/spesh-optimize-more-bindattr-getattr-32bit: 215430c4db | (Timo Paulssen)++ | 2 files
Spesh: Lower bindattr_i On CStruct Objects

turns the op that would usually start by finding the right slot in the struct via metadata into two cheap pointer operations
timotimo i've done improved some stuff, and that's nice 15:57
the push/pop one should also get to master independent of whether the other stuff can get into the release 15:58
16:00 lizmat left 16:08 zakharyas joined
Kaiepi ok ktrace shows that moar keeps trying to call mmap on an fd of -1 16:33
???
evalable6 Stub code executed
in block <unit> at /tmp/k9yurkK9mu line 1
timotimo isn't that just how to get an anonymous mapping? 16:34
Kaiepi only if MAP_ANON is passed 16:35
lemme check again
yeah, it is using MAP_ANON 16:36
timotimo could just be malloc 16:38
16:52 patrickb joined
timotimo the bindattr/getattr branch is currently surviving the stresstest just fine 16:57
i should have perhaps used nonblocking and maybe even nodelay 16:59
17:14 lizmat joined
Geth MoarVM: 03d4271cff | (Timo Paulssen)++ | 8 files
Spesh Optimize Get/Bind Attribute For int32

These are used in parts of the new bytecode compiler that's written in nqp.
The code isn't exactly hot, but it could still be worth something.
Plus, user code might have 32 bit integer attributes in use.
17:35
MoarVM: a37c0bff71 | (Timo Paulssen)++ | src/spesh/optimize.c
Spesh: Fix Wrong Type Selection For push_* And pop_*

The repr optimization would have depended on the type that was being pushed or the type that would be returned (although the latter wouldn't ever be known at that point) rather than the type of object that the operation was performed upon.
That would have lead to bogus optimization for push_* and missed opportunities for pop_*.
MoarVM: 215430c4db | (Timo Paulssen)++ | 2 files
Spesh: Lower bindattr_i On CStruct Objects

turns the op that would usually start by finding the right slot in the struct via metadata into two cheap pointer operations
17:45 Ven`` left
Kaiepi ok moar's spamming running MVM_repr_pos_splice with two of the exact same VMString and both offsets being 0 18:06
timotimo wouldn't that not do anything? 18:08
or insert stuff at the beginning of the array?
by both offsets you mean the offset and the length?
but what's the other array that's being spliced in? 18:09
Kaiepi offset and the length yes
there is no other array being spliced in, it's the same as the original
same offset and everything
timotimo ok, that's effectively adding stuff to the beginning 18:12
so where does it happen?
Kaiepi it happens with the sp_jit_enter op 18:20
as well as the splice op 18:25
timotimo "with the sp_jit_enter" op? that probably just means it's going into jit which totally messes up stack traces 18:28
i recommend turning off the jit when doing anything instrumentationy
Kaiepi ok i narrowed the bug down to Blob.new 19:24
20:04 brrt joined
brrt ohai 20:05
nine++ for helping timotimo++ out :-)
timotimo yo brrt :) 20:06
brrt timotimo++ for fixing JIT issues :-)
timotimo i haven't yet implemented support for "is rw" doubles, and no support for floats either
brrt why, make my job harder still :-P 20:07
I've promised to port that stuff over to expr JIT
20:08 domidumont left
timotimo oh i haven't implemented p6obind_i32 (and the get variant) to the exprjit yet 20:08
what do i have to put in place of int_sz to make it work right? 20:09
Kaiepi the jit and spesh are way beyond me
well
not so much the jit since i contributed to it before 20:10
but apart from adding templates i wouldn't know what to change
timotimo the old jit is "easy" to extend for some things
but of course it won't generate very good code
brrt Kaiepi: I'm somewhat saddened by that 20:15
can't blame you, of course
the legacy JIT is (essentially) a single pass compiler, as in, nothing changes really between the first pass and the second 20:16
Kaiepi i have the compilers: principles, techniques, & tools book that i need to get around to reading at some point
would that help?
Geth MoarVM: efdf568975 | (Timo Paulssen)++ | 2 files
Change CStruct For Compatibility With Native Call JIT

Having the pointer to the actual data be first in the struct lets us handle a CStruct exactly like most other things in there.
20:22
MoarVM: f818bd6d5e | (Timo Paulssen)++ | 3 files
Support double Arguments In NativeCall JIT
brrt Kaiepi: maybe. But I have read that book also, and I found that it wasn't very detailed on the code generation and register allocation bits 20:24
which is most of what the expr jit is :-) 20:25
timotimo turning spesh up with nodelay and blocking there gets isDEPRECATED to have different line numbers and fail :o
brrt oops 20:31
so... part of the way in which luajit handles register allocation, is by not handling it; there are a few cases in which it just gives up 20:32
also, luajit just blends register allocation, instruction selection and assembly in one process 20:36
so it's an interesting design and algorithm but it is *nothing* like the algorithm for moarvm 20:41
one of the interesting bits is that it works in reverse order, so (by virtue of SSA form), the first encounter is the last use, and the (only) definition is the first definition; so as soon as the definition is encountered, the register can be released 20:47
20:49 zakharyas left 21:47 patrickb left 21:51 brrt left
timotimo i just checked to make sure the saem failures appeared in the spec tests before my changes 21:51
23:51 AlexDaniel left