A Look Into the New CTFE Engine
Stefan Koch
May 4 @ 15:30
Duration: 50 minutes
Talk type: Presentation
Level: Intermediate
Slides: ODP
Video
Abstract:
Two parts: The first is me talking about my experience,
writing the engine. The second goes into deeper technical
detail explaining the trade-offs, and design decisions.
- What is CTFE and what can it be used for?
- Examples std.regex and sqlite-d.
- Show how the utility of ctfe is not just in the big things but
the simple convenience of assigning cos(viewAngle) to a
static immutable variable.
- Example: the newCTFE-Engine is ctfeable itself so the
compiler itself will not compile if the bytecode-tests fail.
- Discussion of the old Engine, pointing out why it is
suboptimal.
- Exposition of different interpretation models:
- AST-Interpreter.
- ByteCode-Interpreter (and its extension to JIT).
- Overview: of the newCTFE Codegen-API
Explanation of rationale; Backends are pluggable via a
template parameter.
Showing 2 back-ends
BC-Interpreter
DebugPrinter-Backend.
- Explaining the design of the BC-Interpreter
Showing the 10x performance improvements as a live demo.
- Explanation of the intricacies of Code-Generation.
“2 Months of Development. 6 Months of Debugging”.
- Status of what the engine can currently compile.
- Future outlook and showing the 50x Improvement using
pseudo-JIT.
- Acknowledgements.
Speaker Bio:
- 25 Years old.
- Programing since the age of 7.
- Begun using D in 2013 while working on the SDC-Compiler.
- Wrote a CTFE reader for Sqlite3-Databases in 2015.
- Working on the new CTFE-Engine and other DMD
improvements since July 2016.