github.com/moarvm/moarvm | IRC logs at colabti.org/irclogger/irclogger_logs/moarvm
Set by AlexDaniel on 12 June 2018.
[Coke] nine++ 01:04
nwc10 good *able6, #moarvm 10:04
[Coke] any volunteers to document the *invoke* ops that nqp exposes from MoarVM? 14:12
(there are 9 with 'native' in the opcode name) 14:13
if someone wrote up a gist, I'd be happy to reformat and get into the docs file.
buildnativecall initnativecall nativecall nativecallcast nativecallglobal nativecallinvoke nativecallrefresh nativecallsizeof nativeinvoke 14:16
(this is technically an nqp issue, but many opcodes are just passthrough and moarvm is most likely to have the experts to discuss) 14:17
[Coke] (there's also some osr & spesh opcodes that need docs) 15:53
looks like osrpoint is a direct invocation of MVM_spesh_osr_poll_for_result 15:55
could someone give me a sentence on that for nqp users?
(and, should it be considered Internal?)
(looks like it's only used in nqp loop body generation, not in rakudo 15:56
timotimo no idea how moar would react if someone just put osrpoints in random spots 16:28
[Coke] nqp: nqp::osrpoint; nqp::say('eek'); 16:29
camelia No registered operation handler for 'osrpoint'
at gen/moar/stage2/QAST.nqp:1504 (/home/camelia/rakudo-m-inst-2/share/nqp/lib/QAST.moarvm:compile_op)
from gen/moar/stage2/QAST.nqp:6174 (/home/camelia/rakudo-m-inst-2/share/nqp/lib/QAST.moarvm:compile_nod…
[Coke] oh.
well, that simplifies the docs. :)
must have missed that one the last culling. 16:30
timotimo++ 16:31
timotimo nativecallglobal gets you the value of "a symbol" in the ldsym and such sense; when you load a library that has some global variables, this is how you get at 'em 16:34
nativecallsizeof gives you the number of bytes something's size would be, for differestly sized integers, nums, but also structs and such 16:35
nativecallrefresh will read the values from the objects over on the C side and recreates the objects on the p6 side, that's how things like pointers from one struct to another would work i think? 16:36
nativecallcast takes a native object of one type and reinterprets it as another type, like turning a Pointer[AStruct] to a Pointer[AnotherStruct] 16:37
nine buildnativecall connects a routine with a native function. The routine must have an attribute with NativeCall REPR as a box target. buildnativecall needs the name of the native library, the name of the symbol representing the native function, the calling convention, argument information and a hash with type information for the return type. It returns 1 if the call can be JITed and 0 otherwise. 17:53
The call convention will usually be an empty string. arg_info is an array containing a hash for each parameter. The hashes contain the typeobj, rw, type (type code) and optionally a free_str flag for Str parameters and a similar structure in callback_args for callback parameters for Callable parameters 17:58
The return_hash has similar keys with typeobj, type and free_str and a couple of fields that aren't actually related to the return type, but are there because it was the easiest place to extend: they are entry_point, resolve_lib_name and resolve_lib_name_arg. 17:59
resolve_lib_name is optional and contains a code object. This gets called with resolve_lib_name_arg to resolve this name to the actual name or path of the library to be loaded. This is used for relocatability of repositories and native libraries they contain (it keeps the absolute paths out of precomp files) 18:01
nine nativecall is the most high level op (actually just sugar) for actually calling native code. It takes a return type, the HLL sub itself and an array containing the arguments and returns the result. 18:06
nativecallinvoke is the corresponding low level ops with a similar interface. The difference is mostly that it needs deconted values in the argument array. 18:07
nativeinvoke must only be used for call sites where buildnativecall returned 1 (JITable). It works much more like a standard invoke op in that it expects arguments in the arg buffer (via prepargs/arg_[inso]) 18:16
samcv sorry took a while to handle it. But reviewed and commented on thundergnat's MoarVM, Rakudo, roast PR for Unicode 13 20:15
looks like a mostly uneventful update aside from a new script and CJK ideograph extension. though thundergnat mentioned in his Rakudo PR about grapheme changes, so need clarification on that. I'm guessing it's just some characters changed their Grapheme cluster break or other properties, and no logical changes to how graphemes are segmented 20:18
[Coke] timotimo++ nine++ 21:01
I'll steal those and put them into doc form. Thanks!
samcv++ review 21:02
Geth MoarVM/debugserver_invoke_code_support: de38edbb4c | (Timo Paulssen)++ | 2 files
debugserver: Implement parsing "arguments" array for invoke

string arguments and named arguments are currently NYI, and the invoke command only does a few sanity checks before aborting.
21:40
[Coke] nine,timotimo: thank you, about to push a doc patch. Any notes for 'initnativecall' or 'nativeinvoke' (moar only) 22:19
(er, former is all 3, latter is moar only)
... shit. I meant to ++ you in the commti! 22:20
nine++ timotimo++