Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
Description
The chain of commits ending with https://codereview.qt-project.org/c/qt/qtdeclarative/+/574946 adds DCE on the bytecode. It implements part of the logic of the compiler to find dead reads and writes that have no side effects to remove them from the generated bytecode. It does this solely by tracking read/written registers and without utilizing any type information.
The hope was to optimize bytecode that is generated AOT (runtime generation remained unchanged) to reduce code size and maybe even improve performance.
The results are disappointing:
- Building all the Qml under qtdeclarative/src yields zero removed dead instructions.
- Building a somewhat large BigDecimal implementation found at https://github.com/christkv/node-pure-crypto/blob/master/lib/big_decimal.js yielded a 0.5% reduction in bytecode size.
- This comes at a cost of a ~1.6x slower generation time
Potential causes for the poor results are be the nature of JavaScript. Many instructions that at first glance seem safe can actually have side effects due to user-specified code in their execution.
Examples:
- A get lookup on an id can produce side effects due a symbol that can be overriden by the user
- Same deal for the seemingly benign bitwise operators. They can coerce their operands which through user-overrideable symbols can again produce arbitrary side effects.
Attachments
Issue Links
- relates to
-
QTBUG-76025 Specify the QML language and write a QML-to-C++ compiler
- Open