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.
00:00 reportable6 left 00:01 reportable6 joined 00:14 MasterDuke joined 01:14 linkable6 left, evalable6 left 01:15 linkable6 joined 01:16 evalable6 joined
MasterDuke timo: you're sometimes up late, around? 02:11
timo oh no what have i done :) 02:12
MasterDuke nothing...yet 02:14
i'm playing around with nine's suggestion to implement a `stat` syscall 02:16
and return the result in a new repr 02:17
i've realized i've never created a syscall before, or a repr 02:18
timo i wonder if it would be fine if it would just re-use a repr like maybe vmarray
i guess that's equivalent to the thing nine said would be The Worst 02:19
MasterDuke heh. i think the worst was a hash... 02:20
timo the array is worse since the keys are now all just integers with no inherent meaning
and something something versioning
MasterDuke well, they would(could?) have meaning up in rakudo, right? 02:21
timo how exactly are we expecting to get the individual bits out of the stat repr, do we make like accessor functions
MasterDuke that's one thing i wasn't sure about. the relationship between the moarvm struct (or array i guess) and the hll object 02:22
timo right, until now any "special" repr that wasn't sufficiently like another would get "its own" ops to work with them 02:23
in newer moarvm we'd be making syscalls for that which are less work to make new ones of
MasterDuke i was imagining what the raku would look like, e.g., `my Stat $f-s = "foo".IO.stat; say $f-s.is-empty; say $f-s.is-directory;`
timo right, and Stat is repr("MVMStat") or whatever 02:24
then the methods could be like is-empty() { nqp::syscall("stat-is-empty", self) }
MasterDuke right and right 02:25
timo and the stat-is-empty syscall would grab its argument and cast it to MVMStat and it'd have a .body.uv_stat_struct or whatever
MasterDuke yep
timo i wonder if we can save any amount of allocations in practice if we allow an existing MVMStat object to be passed for storing the info 02:27
MasterDuke (sort of off topic, but would it make sense to have an nqp::syscall that's just shorthand for nqp::dispatch('boot-syscall')?)
timo dunno, it would be easy to make at least
MasterDuke of the ~817 nqp::dispatch calls in rakudo, only ~27 of them don't have a 'boot-syscall' somewhere in the line 02:29
timo not sure what exactly we'll save from that, i guess we don't have to parse the string literal for boot-syscall if we "hide" it in the code-gen for a hypothetical nqp::syscall 02:33
MasterDuke i would be fine if it was just simply a core developer convenience thing 02:34
timo maybe we'll want to actually think about making a nqp::sc-* for a few very common syscalls as well
MasterDuke btw, hope your cat is better, it was too bad you couldn't make the summit 02:35
timo unfortunately there was no getting better 02:36
MasterDuke that sucks
timo i agree. fuck cancer
02:39 Techcable left 02:40 patrickb left 02:46 Techcable joined, patrickb joined, Techcable_ joined, Techcable left
MasterDuke well, i got nqp to segfault, maybe that's one step further than complaining it doesn't know what i'm calling? 02:47
02:48 Techcable_ is now known as Techcable
MasterDuke i just ran `nqp-m -e 'my $a := nqp::dispatch("boot-syscall", "file-stat", "VERSION", 0); say(nqp::dispatch("boot-syscall", "stat-is-reg", $a))'` 02:49
timo i'd have to see the diff and backtrace probably to know what's up 02:50
you can try nqp::dispatch("boot-syscall", "MisterMcDoesntExist")
it should give an actual proper error message rather than a segfault
MasterDuke `No MoarVM syscall with name 'foo'` 02:51
added a backtrace 02:52
oh, it doesn't have my new repr files 02:54
timo oh, you can't create an MVMObject with mvm_malloc
that needs to go through gc_allocate and such
MasterDuke gist updated 02:55
timo with mvm_malloc, the object header will not be set up properly, including the REPR pointer that it's trying to look at where the crash happens 02:57
MasterDuke ah
[dan@alexandria nqp]$ ./nqp-m -e 'my $a := nqp::dispatch("boot-syscall", "file-stat", "/home/dan/p6/nqp/VERSION", 0); say(nqp::dispatch("boot-syscall", "stat-is-reg", $a))' 03:01
timo neat 03:02
MasterDuke turns out MMVM_repr_alloc_init was *almost* the right function to use
that wasn't terrible 03:04
well, i'm off to sleep, but thanks for the help. i'll finish up the rest later and PR it 03:18
timo you're welcome, thanks for your work :) 03:26
Woodi "representation Stats" seems strange... reprs by idea are almoust lowest level but structured thing, container that have some shape but can be visible as something else... eg. objects represented as arrays or objects represented as hash or image, whatever is handy in context... 04:03
and stat returns just struct
04:46 linkable6 left, evalable6 left 04:47 evalable6 joined 04:48 linkable6 joined 05:09 MasterDuke left 05:10 MasterDuke left
nine Same as MVMOSHandle for file handles. I think it's better to think of reprs as "something where the VM knows how it's represented in memory" 05:53
06:00 reportable6 left 06:02 reportable6 joined 07:46 sena_kun joined 08:26 sena_kun left 08:53 notable6 left, statisfiable6 left, bisectable6 left 08:54 rypervenche left 08:55 rypervenche left 08:57 rypervenche joined 09:47 notable6 joined 09:49 statisfiable6 joined, bisectable6 joined 12:00 reportable6 left 12:01 reportable6 joined 12:27 jgaz left 12:32 jgaz joined 12:38 jgaz left, jgaz joined 18:00 reportable6 left 18:02 reportable6 joined 18:26 sena_kun joined 22:08 sena_kun left