Archive for April, 2014

Duetto 0.9.6: debugging C++ web applications within the browser

logo_duetto_quadrato_192

Hello every­one! Lean­ing Tech­nolo­gies is happy to present yet another feature-packed release of duetto — our C++ com­piler for the Web.

Duetto 0.9.6 intro­duces the ini­tial sup­port for a new, highly-requested fea­ture: in-browser debug­ging of your C++ web appli­ca­tion. We hope you’ll like this! We also intro­duced some new pow­er­ful opti­miza­tions to reduce mem­ory usage and pres­sure on the garbage col­lec­tor, and extended our sup­port for the stan­dard library.

Ini­tial sup­port for inte­grated debug­ging using Source Maps

Source maps is a stan­dard tech­nol­ogy to debug code com­piled to JavaScript. It’s already used by many tools that gen­er­ate JavaScript, both from other lan­guages and from JavaScript itself. Duetto is now able to seam­lessly gen­er­ate source maps from C++ code.

Mod­ern browsers can auto­mat­i­cally load the source map and dis­play the orig­i­nal C++ code when an error occurs. You can also set break­points in the C++ file and the JavaScript exe­cu­tion will stop when the cor­re­spond­ing line is reached. You can even sin­gle step the exe­cu­tion while look­ing at C++ code.


To gen­er­ate a source map, you can use the fol­low­ing com­mand (remem­ber to enable debug infor­ma­tion in clang using the –g option):

/opt/duetto/bin/clang++ -target duetto -g test.cpp -o test.js -duetto-sourcemap=test.js.map

Enabled Scalar Replace­ment of Aggre­gates (SROA) optimization

SROA is an stan­dard com­piler opti­miza­tion which tries to replace com­plex objects with their mem­bers when­ever pos­si­ble. It’s a very crit­i­cal opti­miza­tion, espe­cially for duetto, as every object which removed by SROA reduces the pres­sure on the garbage col­lec­tor. LLVM has SROA sup­port out of the box, but the exist­ing imple­men­ta­tion would often gen­er­ate type-unsafe code that would break the duetto back­end, so we have been forced to dis­able SROA up to now.

This release includes an improved SROA which always gen­er­ates duetto-safe code, so we have been able to enable it again.

First sup­port for col­laps­ing allocations

We have intro­duced a new opti­miza­tions which tries to reduce mem­ory pres­sure even more by recy­cling mem­ory allo­cated for local vari­ables. When­ever two or more allo­ca­tions of the same type are used in dis­joint sec­tions of the same func­tion they are merged into one.

Improved stan­dard library support

We have fixed sup­port for std::map, std::multimap, std::unordered_map, std::std, std::multiset and std::unordered_set which should be now fully work­ing. sets and maps hav­ing point­ers as the key are not yet supported.

Strict-mode JavaScript

Duetto-generated JavaScript now starts with “use strict”, a cou­ple of small fixes have been made to gen­er­ate fully strict-mode com­pli­ant code.

You can down­load duetto for Win­dows and Mac OS X on launch­pad. Pack­ages for Ubuntu and Debian are avail­able from our PPA. You can also get the source code on GitHub.

Fol­low us on @leaningtech, Face­book and at www.leaningtech.com for updates.

No Comments

Duetto 0.9.6: debugging C++ web applications within the browser

logo_duetto_quadrato_192

Hello every­one! Lean­ing Tech­nolo­gies is happy to present yet another feature-packed release of duetto — our C++ com­piler for the Web.

Duetto 0.9.6 intro­duces the ini­tial sup­port for a new, highly-requested fea­ture: in-browser debug­ging of your C++ web appli­ca­tion. We hope you’ll like this! We also intro­duced some new pow­er­ful opti­miza­tions to reduce mem­ory usage and pres­sure on the garbage col­lec­tor, and extended our sup­port for the stan­dard library.

Ini­tial sup­port for inte­grated debug­ging using Source Maps

Source maps is a stan­dard tech­nol­ogy to debug code com­piled to JavaScript. It’s already used by many tools that gen­er­ate JavaScript, both from other lan­guages and from JavaScript itself. Duetto is now able to seam­lessly gen­er­ate source maps from C++ code.

Mod­ern browsers can auto­mat­i­cally load the source map and dis­play the orig­i­nal C++ code when an error occurs. You can also set break­points in the C++ file and the JavaScript exe­cu­tion will stop when the cor­re­spond­ing line is reached. You can even sin­gle step the exe­cu­tion while look­ing at C++ code.


To gen­er­ate a source map, you can use the fol­low­ing com­mand (remem­ber to enable debug infor­ma­tion in clang using the –g option):

/opt/duetto/bin/clang++ -target duetto -g test.cpp -o test.js -duetto-sourcemap=test.js.map

Enabled Scalar Replace­ment of Aggre­gates (SROA) optimization

SROA is an stan­dard com­piler opti­miza­tion which tries to replace com­plex objects with their mem­bers when­ever pos­si­ble. It’s a very crit­i­cal opti­miza­tion, espe­cially for duetto, as every object which removed by SROA reduces the pres­sure on the garbage col­lec­tor. LLVM has SROA sup­port out of the box, but the exist­ing imple­men­ta­tion would often gen­er­ate type-unsafe code that would break the duetto back­end, so we have been forced to dis­able SROA up to now.

This release includes an improved SROA which always gen­er­ates duetto-safe code, so we have been able to enable it again.

First sup­port for col­laps­ing allocations

We have intro­duced a new opti­miza­tions which tries to reduce mem­ory pres­sure even more by recy­cling mem­ory allo­cated for local vari­ables. When­ever two or more allo­ca­tions of the same type are used in dis­joint sec­tions of the same func­tion they are merged into one.

Improved stan­dard library support

We have fixed sup­port for std::map, std::multimap, std::unordered_map, std::std, std::multiset and std::unordered_set which should be now fully work­ing. sets and maps hav­ing point­ers as the key are not yet supported.

Strict-mode JavaScript

Duetto-generated JavaScript now starts with “use strict”, a cou­ple of small fixes have been made to gen­er­ate fully strict-mode com­pli­ant code.

You can down­load duetto for Win­dows and Mac OS X on launch­pad. Pack­ages for Ubuntu and Debian are avail­able from our PPA. You can also get the source code on GitHub.

Fol­low us on @leaningtech, Face­book and at www.leaningtech.com for updates.

No Comments