Archive for April, 2014
Duetto 0.9.6: debugging C++ web applications within the browser
Posted by Alessandro Pignotti in Leaningtech on April 18, 2014
Hello everyone! Leaning Technologies is happy to present yet another feature-packed release of duetto — our C++ compiler for the Web.
Duetto 0.9.6 introduces the initial support for a new, highly-requested feature: in-browser debugging of your C++ web application. We hope you’ll like this! We also introduced some new powerful optimizations to reduce memory usage and pressure on the garbage collector, and extended our support for the standard library.
Initial support for integrated debugging using Source Maps
Source maps is a standard technology to debug code compiled to JavaScript. It’s already used by many tools that generate JavaScript, both from other languages and from JavaScript itself. Duetto is now able to seamlessly generate source maps from C++ code.
Modern browsers can automatically load the source map and display the original C++ code when an error occurs. You can also set breakpoints in the C++ file and the JavaScript execution will stop when the corresponding line is reached. You can even single step the execution while looking at C++ code.
To generate a source map, you can use the following command (remember to enable debug information 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 Replacement of Aggregates (SROA) optimization
SROA is an standard compiler optimization which tries to replace complex objects with their members whenever possible. It’s a very critical optimization, especially for duetto, as every object which removed by SROA reduces the pressure on the garbage collector. LLVM has SROA support out of the box, but the existing implementation would often generate type-unsafe code that would break the duetto backend, so we have been forced to disable SROA up to now.
This release includes an improved SROA which always generates duetto-safe code, so we have been able to enable it again.
First support for collapsing allocations
We have introduced a new optimizations which tries to reduce memory pressure even more by recycling memory allocated for local variables. Whenever two or more allocations of the same type are used in disjoint sections of the same function they are merged into one.
Improved standard library support
We have fixed support for std::map, std::multimap, std::unordered_map, std::std, std::multiset and std::unordered_set which should be now fully working. sets and maps having pointers as the key are not yet supported.
Strict-mode JavaScript
Duetto-generated JavaScript now starts with “use strict”, a couple of small fixes have been made to generate fully strict-mode compliant code.
You can download duetto for Windows and Mac OS X on launchpad. Packages for Ubuntu and Debian are available from our PPA. You can also get the source code on GitHub.
Follow us on @leaningtech, Facebook and at www.leaningtech.com for updates.
Duetto 0.9.6: debugging C++ web applications within the browser
Posted by Alessandro Pignotti in Leaningtech on April 18, 2014
Hello everyone! Leaning Technologies is happy to present yet another feature-packed release of duetto — our C++ compiler for the Web.
Duetto 0.9.6 introduces the initial support for a new, highly-requested feature: in-browser debugging of your C++ web application. We hope you’ll like this! We also introduced some new powerful optimizations to reduce memory usage and pressure on the garbage collector, and extended our support for the standard library.
Initial support for integrated debugging using Source Maps
Source maps is a standard technology to debug code compiled to JavaScript. It’s already used by many tools that generate JavaScript, both from other languages and from JavaScript itself. Duetto is now able to seamlessly generate source maps from C++ code.
Modern browsers can automatically load the source map and display the original C++ code when an error occurs. You can also set breakpoints in the C++ file and the JavaScript execution will stop when the corresponding line is reached. You can even single step the execution while looking at C++ code.
To generate a source map, you can use the following command (remember to enable debug information 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 Replacement of Aggregates (SROA) optimization
SROA is an standard compiler optimization which tries to replace complex objects with their members whenever possible. It’s a very critical optimization, especially for duetto, as every object which removed by SROA reduces the pressure on the garbage collector. LLVM has SROA support out of the box, but the existing implementation would often generate type-unsafe code that would break the duetto backend, so we have been forced to disable SROA up to now.
This release includes an improved SROA which always generates duetto-safe code, so we have been able to enable it again.
First support for collapsing allocations
We have introduced a new optimizations which tries to reduce memory pressure even more by recycling memory allocated for local variables. Whenever two or more allocations of the same type are used in disjoint sections of the same function they are merged into one.
Improved standard library support
We have fixed support for std::map, std::multimap, std::unordered_map, std::std, std::multiset and std::unordered_set which should be now fully working. sets and maps having pointers as the key are not yet supported.
Strict-mode JavaScript
Duetto-generated JavaScript now starts with “use strict”, a couple of small fixes have been made to generate fully strict-mode compliant code.
You can download duetto for Windows and Mac OS X on launchpad. Packages for Ubuntu and Debian are available from our PPA. You can also get the source code on GitHub.
Follow us on @leaningtech, Facebook and at www.leaningtech.com for updates.