On-Stack Replacement for Program Generators and Source-to-Source Compilers
summary
Implements a source-level OSR pattern that swaps loop bodies at iteration boundaries so generated C can start with a fast-to-compile version and trampoline to a heavier-optimized one, implemented in LMS and evaluated in Flare on TPC‑H queries (Q6 example). Tiered setup TCC then GCC -O1 yields best end-to-end time vs single GCC flags; speculative low-level tests pick between vectorized vs non-vectorized loops with a practical cutoff ≈15 and observe up to 4× speedup for fully vectorizable cases; hashmap high‑speculation gives ~10% when correct and safely falls back.
AI-written summary · about
chapters (15)
- 0:00Intro
- 0:18Motivation
- 1:10Compilation Time
- 1:39Case Analysis - TPC-H Q6 - SF 0.1
- 3:36Shape of generated code
- 4:00Targeting a language with OSR?
- 4:31Duplicate, Optimize, Trampoline
- 5:45Generic OSR transformation
- 7:58Example
- 9:24Tiered Execution All are the identity function
- 10:11Evaluation - Tiered Execution
- 11:52Evaluation - Low-level speculation
- 12:39Speculation High-Level Completely different pieces of code are generated, with different assumptions. 8.g. use a hashmap that is optimized for 2 key or less / wse a generic
- 12:57Evaluation - High-level speculation
- 13:37Summary • Reduced the overhead introduced by an extra
related talks
15mLightweight On-Stack Replacement in Languages with Unstructured Loops
25mAn Empirical Study of the Effect of Source-level Loop Transformations on Compiler Stability
15mCopy-and-Patch Compilation
33mImproving the Effectiveness and Generality of GCC Auto-Vectorization
52mUnderstanding Compiler Optimization
15mNot So Fast: Understanding and Mitigating Negative Impacts of Compiler Optimizations on Code Reuse G
34mWhat happens to your code when you don't look?
54mGCC/Clang Optimizations for Embedded Linux
