Articles on Compiler
Last updated: 2023/01/18
Top deep-dives on Compiler
Notes About Compilers
Maybe a lot of you have computer science degrees, and covered topics like compilers in classes. Personally, I don't, and never really spent time learning the basics or diving into the details. If you're in a similar position, or just slept through your compilers 101 class, this article is for you. Patrick Louis goes over some notes and interesting points he jotted down in regards to compilers. Patrick describes the general structure of a compiler and then focuses on explaining all of the key definitions, with code and textbook examples to bring the point across.
Why does Go not need a fancy expensive garbage collector like Java and C#?
Java is notorious for its bulky garbage collector, but a lot of effort has gone into making it more and more efficient. Erik Engheim's extensive article starts off with explaining memory management in Java, then goes on to explore how the Java garbage collector compares to Go's, and all of the factors that go into making Go's better(?).
defragmentation
Andy Wingo discusses the fundamentals of writing a garbage collector.
How to Think About Compiling
Nicholas Yang presents some of the difficulties and concepts of designing and implementing a compiler.
Some highlights:
- A lot of compilation is combining concepts
- If you're implementing a compiler, start with the simplest examples
- Desurgaring is the process of breaking down more complicated syntax into simpler forms
Generating relocatable code for ARM processors
The ARM Cortex-M is a group of 32-bit RISC ARM processor cores optimized for low-cost and energy-efficient operation. One of their drawbacks is that unlike other processors, Cortex-M doesn't allow for Position Independent Code to be generated, a huge limitation when it comes to firmware updates. In this article, Pavel Loktev explains why this issue exists and how the LLVM compiler was modified to resolve it.
Building the fastest Lua interpreter.. automatically
Haoran Xu discusses their research project to make writing VMs easier, using Lua as the language of choice for compilation.
Some highlights:
- The project's goal is to create a multi-tier method-based JIT compiler for Lua that is automatically generated at build time
- The project is still in its early stages, but the author has already achieved some impressive results
- The generated interpreter is the world's fastest Lua interpreter to date, outperforming LuaJIT's interpreter by 28% and the official Lua interpreter by 171% on average on a variety of tasks
Branch/cmove and compiler optimizations
Krister Walfridsson demonstrates how and why compilers might choose to use cmove or branch.
Compilers and IRs: LLVM IR, SPIR-V, and MLIR
Compilers are a type of program that translates code written in one language into another language. Lei Zhang discusses the importance of compilers and how they are structured. He also talks about intermediate representations (IR), which are critical to compilers.
Some highlights:
- The top concern from compilers is correctness; optimization is always second to that
- IRs are designed to make transformations easier
- LLVM decoupled and modularized compilers with LLVM IR and libraries
Ezno: a JavaScript compiler featuring checking, correctness and performance
Ezno is a JavaScript compiler featuring type checking, correctness, and performance for building full-stack websites. In this article, Ben presents the compiler, explains that it is still in its infancy, but has the potential to be very useful for preventing errors in JavaScript code. The compiler is compatible with TypeScript type annotations and can work without any type annotations at all.
Some highlights:
- Ezno's type checker is built from scratch and is somewhat of an extension of the TypeScript compiler
- Ezno has support for JSX syntax
- No VDOM
Exploring Shaders with Compiler Explorer
Jeremy Ong compiles shaders in Compile Explorer and peruses the output.
More Evidence for Problems in VM Warmup
Laurence Tratt discusses a paper on the subject of how programming language VMs (Virtual Machines) warm-up, or often don't. The author describes how
Some highlights:
- VMs are meant to run programs in an interpreter, observe which portions run frequently, then compile those portions into machine code which can be used instead of the interpreter
- Research shows that the above doesn't really happen
- According to the data, only 1/10th of the process executions on the JVM reach steady state
Trade-offs of Using Compilers for Java
Mark Stoodley is the project lead for the open source Java Virtual Machine project called Eclipse OpenJ9 and he gave a talk at a conference on the trade-offs of using different types of compilers for Java applications.
Some highlights:
- JIT: good steady state performance, adaptable, and easy to use, but issues with start-up performance and with ramp-up performance
- AOT: inverse of JIT in terms of what it's good and bad at
- AOT/JIT < JIT + Caching < JIT Server
Interface method calls with the Go register ABI
Eli Bendersky "takes a deeper look into how Go compiles method invocations; specifically, how it compiles interface method invocations".
Memory Safety in a Modern Systems Programming Language Part 1
In this first article of the series, Ate Eskola discusses how memory safety can be achieved in D using scoped pointers.
Some highlights:
- DIP1000 is a set of enhancements to the language rules regarding pointers, slices, and other references
- DIP1000 is an attempt to solve reference lifetime problem by extending implementation of `scope` keyword
- "there is no need for scope and return scope for function attributes if they receive only static or GC-allocated data"