[Development] Qt 5.9's new garbage collector documentation? + root_ptr
Phil Bouchard
philippeb8 at gmail.com
Sun Jul 16 01:32:28 CEST 2017
On 07/15/2017 04:58 PM, Phil Bouchard wrote:
> On 07/15/2017 02:26 PM, Phil Bouchard wrote:
>> On 07/15/2017 02:17 PM, Tim Blechmann wrote:
>>>>> fwiw, to get this thread back to the main topic, i still fail to see
>>>>> how
>>>>> root_ptr deals with objects which are reachable from multiple roots,
>>>>> which have independent lifetime
>>>>
>>>> Please provide an example.
>>>
>>> i've posted some already
>>
>> I'm working on the parser right now but I thought I proved my point with
>> the following code:
>>
>> var temporary = 0;
>>
>> var bar = function (object)
>> {
>> return 10;
>> };
>>
>> var foo = function ()
>> {
>> var object;
>> var result = function() { return object; };
>> return function() { return bar( object ); };
>> };
>>
>> for (var i = 0; i < 1000000; ++ i)
>> console_log((foo())(temporary));
>
> Alright I got good news: the parser already generates code that compiles
> and works!
>
> I still need to fix minor issues but I am on the right path.
Alright... it's good enough now so you try it out yourselves (BTW I
added the keyword: "extern" so you can already mix C++ code with
Javascript).
Instructions (you'll need: Boost, Flex, Bison, Qt):
1) Get the following code: https://github.com/philippeb8/root_ptr/tree/qt
2) In "example/js2cpp", type:
$ qmake
$ make
$ ./js2cpp < tests/input1.js > tmp.cpp
$ g++ -std=c++11 -O2 -Iinclude -I../../include tmp.cpp -otmp -lboost_system
$ time ./tmp
int main()
real 0m1.581s
user 0m1.581s
sys 0m0.000s
TODO:
1) Finish removing all dependencies from Boost
2) Figure a way to have variadic number of arguments for functions
3) Create local variables linked to the function arguments
4) Fix a -DBOOST_DISABLE_THREADS that is not working for some reason
5) ...
Thanks for your patience!
-Phil
More information about the Development
mailing list