Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6-lwp-gsoc, 2015-02-18

| Channels | #perl6-lwp-gsoc index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
02:49 ilbot3 joined #perl6-lwp-gsoc
02:49 Topic for #perl6-lwp-gsoc is now logs at http://irclog.perlgeek.de/perl6-lwp-gsoc/
07:54 FROGGS joined #perl6-lwp-gsoc
09:41 FROGGS joined #perl6-lwp-gsoc
10:19 sergot hey o/
10:20 sergot I will try to write more advanced mangle_cpp_symbol today, ok?
11:14 FROGGS sure, I'll also have time for this hopefully
11:15 FROGGS sergot: though, yuo were able to run the test without segfaults?
14:22 dalek joined #perl6-lwp-gsoc
14:26 sergot FROGGS: yes, it passes
14:26 sergot I will have some time at 18:00 today
14:26 sergot will be back then
14:26 sergot :)
14:31 FROGGS that's dinner time for me... I'm usually available from 20:30
16:34 sergot okok :)
16:38 sergot do I have to rebuild rakudo after changing lib/NativeCall.pm?
16:43 FROGGS no
16:43 FROGGS just 'make install'
16:43 FROGGS nativecall is still just a module
16:51 sergot ok :)
16:53 sergot _ZN8Derived1C1Ev
16:54 sergot what is the C there?
16:54 sergot C1
16:54 sergot i dont get it
16:55 FROGGS Constructor
16:55 FROGGS there is also D for Destructor
16:56 FROGGS and it is 1C, not C1
16:56 FROGGS ohh, hmmm, that probably means that mangle_cpp_symbol() is misleading about C1 here
16:57 sergot I though E has no "prefix" (length)
16:57 FROGGS ahh, no, it is C1
16:57 sergot thought
16:57 FROGGS _ZN4BaseC1Ev
16:57 FROGGS sergot: aye, the E is a delemiter
16:58 FROGGS it is between the args and the return value
16:59 sergot does only .new go to mangle_cpp_symbol?
16:59 sergot no I guess
16:59 FROGGS no, all methods (and subs in future)
17:00 FROGGS all methods and subs that get the 'is native' trait get to a point where we decide if the symbol needs to be mangled or not
17:00 FROGGS for methods on CPPStructs we know that we need to mangle it
17:00 sergot is it here
17:00 sergot https://github.com/rakudo/rakudo/blob/cpp/lib/NativeCall.pm#L109
17:00 sergot ?
17:01 FROGGS though for subs it is not clear if it is a sub for a C lib or a C++ lib
17:01 FROGGS yes, and here: https://github.com/rakudo/rakudo/blob/cpp/lib/NativeCall.pm#L164
17:01 FROGGS and the mangling itself happens here: https://github.com/rakudo/rakudo/blob/cpp/lib/NativeCall.pm#L387
17:01 sergot yeah, how can we distinguish these cases?
17:03 FROGGS I'm not sure yet
17:04 FROGGS let's care about that later :o)
17:04 sergot ok, so the point now, is to write better mangling, right?
17:04 FROGGS yes
17:04 sergot is there any TODO list or "known bugs"?
17:04 FROGGS extend the tests, and add extra mappings
17:05 FROGGS no
17:05 sergot ok,  let's see what I can do
17:05 FROGGS the easiest thing is to add more mappings to basic C types here: https://github.com/rakudo/rakudo/blob/cpp/lib/NativeCall.pm#L401
17:06 FROGGS just add attributes to the Derived class (or add another class), with more C types
17:06 FROGGS and the run `nm` over that library, to see what the letters are
17:07 FROGGS you can also paste a list of symbols to this form: http://demangler.com/
17:07 sergot nice, thanks!
17:08 FROGGS ohh, you can even paste the entire output of nm to that form!
17:08 FROGGS and then you get that:
17:08 FROGGS 0000000000000c3c T Derived2::~Derived2()
17:08 FROGGS 0000000000000c3c T Derived2::~Derived2()
17:08 FROGGS 0000000000201df0 V typeinfo for Base
17:08 FROGGS 0000000000201dc0 V typeinfo for Derived2
17:08 FROGGS Derived2::~Derived2() is a destructor
17:09 FROGGS hmmm
17:09 sergot are attributes treated the same as methods?
17:09 FROGGS the symbols about typeinfo and vtable sound interesting
17:09 sergot what is vtable?
17:10 FROGGS sergot: no, and attribute does not show up as a symbol in the nm output
17:10 FROGGS only methods and functions do
17:10 sergot ok
17:10 FROGGS a vtable is a virtual method table
17:10 sergot ohh ,ok
17:10 sergot thanks
17:11 sergot what does this do: is nativeconv('thisgnu') ?
17:11 FROGGS that tells dyncall that we want to use the thiscall calling convention for that library
17:11 sergot is this necessary?
17:12 FROGGS you know, C++ expects THIS (like `self`) as the first arguments for method calls
17:12 FROGGS yes
17:12 sergot ok
17:12 sergot what about running cpp on another compiler in the future?
17:13 sergot where the manglings works diffrently
17:13 sergot mangling*
17:18 FROGGS we need to take care about that
17:20 sergot _ZN8Derived16methodEi
17:20 FROGGS yes?
17:20 sergot hmm, is there any need to "escape" numbers in the name?
17:21 FROGGS no
17:21 sergot Derived16
17:21 FROGGS the numbers before the name tell the length of the identifier
17:21 sergot oh, right
17:21 FROGGS so, it is: _ZN 8Derived1 6method E i
17:24 sergot well... I dont know why nm doesn't show that there is Derived16method
17:24 sergot but shows Derived26method
17:26 sergot is it because Derived26method is virtual?
17:36 FROGGS yes
17:36 FROGGS exposing the symbol depends on these things
17:40 FROGGS see you in a bit
18:20 FROGGS joined #perl6-lwp-gsoc
18:21 FROGGS back
18:34 sergot \o/
18:35 sergot how can we get the symbol of non-virtual method?
18:35 FROGGS we cant
18:35 FROGGS nobody can
18:35 sergot are we able to have such an method in p6?
18:35 sergot a*
18:35 FROGGS well, you can call it if you compile against that lib, and inline the desired function
18:36 FROGGS in p6?
18:36 FROGGS we are talking about accessing existing C++ libs, so they have to export the interesting symbols
18:36 FROGGS that's their job
18:36 sergot yes, we want to bind a non-virtual method called method() in p6 CPPStruct
18:37 FROGGS every language (except C++) can only access symbol that are exported (= visible via nm)
18:37 sergot ohh, ok
18:37 FROGGS no, we cannot access those
18:37 sergot then we HAVE to export it manually in our library
18:37 sergot right?
18:37 FROGGS in case we want to access it, yes
18:38 sergot How can we do this without making it virtual
18:38 sergot can i read about it?
18:38 FROGGS google for C++ virtual methods
18:39 FROGGS I bet there are some good wikipedia articles or stackoverflow pages
18:39 sergot we expect that every C++ lib cares about exporting methods, what if it doesn't?
18:39 sergot is there such a possibility?
18:41 FROGGS yes, then we (and python and other languages) can't use it
18:42 sergot ok, it's clear for me, will read more later
18:42 FROGGS so, it is like 'good practice' for lib authors to make sure symbols got exported
18:49 sergot I'm working on adding new types and tests for them
18:49 sergot ok?
18:49 sergot are you going to do something with all this stuff today?
18:50 sergot btw. can't we add something like "is cpp" trait when we want to have a sub from cpp lib?
18:50 sergot just for now
18:51 sergot for making it work
18:52 FROGGS I am currently fixing something on the jvm for the release tomorrow
18:52 FROGGS so, go ahead :o)
18:52 FROGGS we could add an 'is cpp' trait for subs only, but I'd like to keep on implementing classes and methods
18:53 FROGGS we have enough to do in that area for now
18:55 sergot how do long and long long look like in p6?
18:55 sergot int64 is long?
18:55 sergot or long long?
19:04 FROGGS no, long is long
19:05 FROGGS it is exported via NativeCall.pm directly
19:05 FROGGS a long long should be like Int
19:05 FROGGS though, we might want to export longlong too
19:08 sergot hmm, my battery is low, I will be back soon-ish
19:08 sergot because I'm not at home
19:09 FROGGS k :o)
20:33 dalek joined #perl6-lwp-gsoc
21:02 dalek joined #perl6-lwp-gsoc
21:15 FROGGS I'm off for today, gnight
21:51 sergot I'm back :)
21:51 sergot good night anyway o/ :)
22:05 FROGGS_ joined #perl6-lwp-gsoc

| Channels | #perl6-lwp-gsoc index | Today | | Search | Google Search | Plain-Text | summary