Perl 6 - the future is here, just unevenly distributed

IRC log for #moarvm, 2015-02-22

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:21 xiaomiao joined #moarvm
00:40 kjs_ joined #moarvm
02:47 ilbot3 joined #moarvm
02:47 Topic for #moarvm is now https://github.com/moarvm/moarvm | IRC logs at  http://irclog.perlgeek.de/moarvm/today
03:34 colomon joined #moarvm
03:52 colomon joined #moarvm
06:02 vendethiel joined #moarvm
07:32 vendethiel joined #moarvm
08:25 vendethiel joined #moarvm
08:53 rurban joined #moarvm
09:06 camelia joined #moarvm
09:13 vendethiel joined #moarvm
10:21 vendethiel joined #moarvm
10:24 mj41 joined #moarvm
10:28 FROGGS joined #moarvm
11:03 camelia joined #moarvm
11:28 FROGGS $ perl6-m -e 'class Foo is repr<CStruct> { has buf8 $.bar }'
11:28 FROGGS ===SORRY!===
11:28 FROGGS CStruct representation only handles int, num, CArray, CPointer and CStruct but got a Uninstantiable
11:28 FROGGS :o(
12:12 FROGGS_ joined #moarvm
12:20 zakharyas joined #moarvm
12:32 kjs_ joined #moarvm
12:58 Ven joined #moarvm
13:13 FROGGS_ jnthn: how do I pun the buf8 role into a class in repr/CStruct.c?
13:16 FROGGS_ this is also needed to return a VMArray like a buf8
13:25 FROGGS_ I need this basically: m: say Buf[uint8].^make_pun;
13:25 FROGGS_ m: say Buf[uint8].^make_pun;
13:25 camelia rakudo-moar 9fc66c: OUTPUT«(Buf[uint8])␤»
13:34 FROGGS_ I guess I can/should do that in NativeCall...
13:34 FROGGS_ at least for the returns trait
13:47 FROGGS_ $ perl6-m -e 'use NativeCall; sub malloc(int32) returns buf8 is native { * }; say malloc(1)'
13:47 FROGGS_ Buf[uint8]:0x<>
13:48 FROGGS_ okay, trouble here is of course that we don't know its .elems...
13:56 FROGGS_ looks like we cannot allow blobs in CStruct attribute or as return types of native subs :/
14:04 FROGGS_ unless we'd know the elems in beforehand
14:28 zakharyas joined #moarvm
15:24 hoelzro_ joined #moarvm
15:24 timotimo joined #moarvm
15:24 muraiki joined #moarvm
15:35 brrt joined #moarvm
16:12 kjs_ joined #moarvm
16:18 brrt joined #moarvm
16:26 FROGGS_ hmmm, would be nice to be able to inline structures...
16:27 timotimo yes please
16:38 FROGGS_ that an unions seem equally hard
16:39 timotimo i thought unions would be trivial
16:41 timotimo i looked at the code that places the slots in a CStruct and it looked like you could just "not increment" the starting position
16:41 FROGGS_ how do you do that at Perl 6 level?
16:42 FROGGS_ like, having num32 and int32 share the same memory
16:43 timotimo since you always just access those via getattr and bindattr, i don't think that's too difficult
16:43 FROGGS_ m: class Foo { has num32|int32 $.bar }
16:43 camelia rakudo-moar 9fc66c: OUTPUT«===SORRY!===␤Type 'num32' is not declared␤at /tmp/SqukKpL9ND:1␤------> class Foo { has num32⏏|int32 $.bar }␤Malformed has␤at /tmp/SqukKpL9ND:1␤------> class Foo { has num32⏏|int32 $.bar }␤␤»
16:43 timotimo and if they want to be rw, you'll end up using jnthn's new native attr code
16:43 timotimo ah, that's what you're asking
16:43 FROGGS_ :o)
16:44 timotimo well, you'd have to build a class that's repr CUnion or something
16:44 timotimo or is repr CStruct is union OSLT
16:44 FROGGS_ ahh, and inline that one...
16:45 timotimo well, i'd expect putting a CUnion repr'd class into a struct would inline by default, but i can see why you might want to have a pointer to such a union sometimes
16:45 FROGGS_ inline by default will happen anyway I think
16:46 timotimo so you'd have to "is pointer" if you want a pointer instead?
16:46 FROGGS_ given that 'int32 $bar is rw' as a parameter declaration will mean 'int *bar' in near future
16:46 FROGGS_ is rw
16:46 timotimo ... oh?
16:46 FROGGS_ aye
16:46 timotimo i didn't know that
16:47 FROGGS_ and it kinda makes sense to call it 'is rw' for attributes
16:48 timotimo oh?
16:48 FROGGS_ because you can shove update the pointer to another structure, whereas you cannot do that if the structure was inlined
16:48 FROGGS_ s/shove//
16:48 timotimo i'd like to have CStruct classes with "is rw" attributes just so that i can modify them without writing my own accesors
16:48 FROGGS_ true
16:52 FROGGS_ I know what you mean:
16:52 FROGGS_ method Set(Num $x, Num $y) {
16:52 FROGGS_ nqp::bindattr_n(nqp::decont(self), Box2D::Vec2, '$!x', nqp::unbox_n($x));
16:52 FROGGS_ nqp::bindattr_n(nqp::decont(self), Box2D::Vec2, '$!y', nqp::unbox_n($y));
16:52 FROGGS_ }
16:52 FROGGS_ -.-
16:52 timotimo hrhr
16:52 timotimo and with the native refs that jnthn made it'll be much more efficient than having to bindattr all the time
16:58 timotimo fwiw, i don't like the "is rw" for "is actually a pointer" very much
17:03 TimToady if we're trying to be C-like, we really want it as part of the type, not tacked on as a trait
17:04 TimToady Ptr[MyType] or so
17:07 timotimo hm, we have a CPointer REPR
17:11 timotimo a role for this would indeed be nice.
17:46 camelia joined #moarvm
17:51 kjs_ joined #moarvm
17:51 brrt joined #moarvm
18:05 FROGGS_ timotimo: that was my first thought too
18:05 FROGGS_ Pointer[int32]
18:06 FROGGS_ maybe we should TIMTOWTDI the whole thing
19:07 dalek MoarVM/cpp: 953c022 | coke++ | macports/Portfile:
19:07 dalek MoarVM/cpp: Add a macports Portfile
19:07 dalek MoarVM/cpp: review: https://github.com/MoarVM/MoarVM/commit/953c02206f
19:07 dalek MoarVM/cpp: c462d90 | coke++ | / (2 files):
19:07 dalek MoarVM/cpp: delint Portfile, move to correct location
19:07 dalek MoarVM/cpp: review: https://github.com/MoarVM/MoarVM/commit/c462d90f14
19:07 dalek MoarVM/cpp: cad876f | FROGGS++ | src/6model/reprs/CStruct.h:
19:07 dalek MoarVM/cpp: make clear what strict_size is about
19:07 dalek MoarVM/cpp: review: https://github.com/MoarVM/MoarVM/commit/cad876f9fd
19:07 dalek MoarVM/cpp: dc0bd10 | FROGGS++ | / (8 files):
19:07 dalek MoarVM/cpp: implement nativecallsizeof of
19:07 dalek MoarVM/cpp: review: https://github.com/MoarVM/MoarVM/commit/dc0bd10218
19:07 dalek MoarVM/cpp: c314d3d | FROGGS++ | src/core/nativecall.c:
19:07 dalek MoarVM/cpp: return number of bytes from MVM_nativecall_sizeof
19:19 dalek MoarVM/cpp: b33c8e3 | FROGGS++ | src/ (2 files):
19:19 dalek MoarVM/cpp: allow to nativesizeof(CPPStruct)
19:19 dalek MoarVM/cpp: review: https://github.com/MoarVM/MoarVM/commit/b33c8e372c
19:33 brrt joined #moarvm
19:41 kjs_ joined #moarvm
19:53 hoelzro joined #moarvm
19:55 dalek joined #moarvm
20:24 brrt please review this commit, i'll push it to master if you're ok with it :-) https://github.com/bdw/MoarVM/commit/a70d7ff54e627cb03a5bfcf13599df26bd4dee52
20:26 brrt fwiw, the label: { block } syntax is pretty nice in C
20:45 FROGGS_ that's working code: https://github.com/FROGGS/p6-Box2D/blob/master/lib/Box2D/BlockAllocator.pm
20:45 brrt FROGGS_++
20:46 FROGGS_ tested here: https://github.com/FROGGS/p6-Box2D/blob/master/t/28-b2blockallocator.t
20:46 FROGGS_ I like the Pointer role :o)
20:46 brrt nice
20:47 brrt i'm going to push since spectest was clean (enough)
20:47 dalek MoarVM: 8352aeb | brrt++ | src/io/fileops.c:
20:47 dalek MoarVM: Rewrite MVM_file_copy
20:47 dalek MoarVM:
20:47 dalek MoarVM: The old version could not handle file sizes larger than 2GB
20:47 dalek MoarVM: (on linux, at least). This version uses a loop to correct
20:47 dalek MoarVM: for the fact that sendfile doesn't necessarily send all bytes
20:47 dalek MoarVM: you request.
20:47 dalek MoarVM: review: https://github.com/MoarVM/MoarVM/commit/8352aebb95
20:47 FROGGS_ brrt: I would not spot an error anyway :o)
20:48 brrt i tried to make it a bit cleaner than the 3-level-deep nested ifs
20:48 FROGGS_ it is still hairy
20:48 FROGGS_ like C in general
20:50 brrt i like C, i don't think it's that hairy
20:51 brrt but then again, i like exactness in my code, and c lets you be as exact (or conversely as sloppy) as you like
20:51 FROGGS_ yeah, true
21:02 * brrt afk
21:02 brrt left #moarvm
22:38 FROGGS TimToady / timotimo / jnthn: we can now have typed pointers (e.g. Pointer[MyStruct], they have a deref method) as params, attrs and return types
22:38 timotimo and pointer arithmetic, too, yeah?
22:38 FROGGS TimToady / timotimo / jnthn: it is implemented in the cpp branch, but is not cpp specific
22:38 FROGGS timotimo: gah!
22:38 FROGGS :P
22:39 FROGGS timotimo: you are welcome to jump in :o)
22:39 FROGGS (dunno if that idiom works in English at all)
22:41 FROGGS m: use NativeCall; sub malloc(int32) returns OpaquePointer is native { * }; say my $p = malloc(32); say OpaquePointer.new( $p + 8 )
22:41 camelia rakudo-moar d850a9: OUTPUT«OpaquePointer<0x5e1f790>␤OpaquePointer<0x5e1f798>␤»
22:41 FROGGS timotimo: ^^
22:41 FROGGS not convenient but works
22:42 FROGGS and since we have nativesizeof and you can cast a certain pointer to a struct you can basically unpack a memory area into structs
22:51 FROGGS gnight
23:03 timotimo i like that

| Channels | #moarvm index | Today | | Search | Google Search | Plain-Text | summary