Questions tagged [code-generation]
For questions related to the generation of code, especially lower level or intermediary code.
5 questions
5
votes
1
answer
394
views
How to compile Discriminated Union types to Webassembly?
Assume that I have a simple language with the types I32 and F32, but also composite types like Tuples. I want to add Discriminated Union types, but I find it difficult to generate the wasm code in a ...
5
votes
1
answer
728
views
How does link-time function inlining work?
I am familiar with traditional linking concepts (static and dynamic linking, relocation, PIE) and with traditional compiler optimizations (such as static expression evaluation, loop unrolling and ...
3
votes
1
answer
517
views
X86-64 Assembly for Recursive Functions
A compiler I'm writing generates the following x86-64 assembly (AT&T syntax) for a recursive factorial function. I convert the assembly into an ELF executable using ...
5
votes
1
answer
270
views
Modifying call stack locations for C++ exceptions
Having done my type checker, I'm thinking on targetting C++. How can I efficiently add debugging information to thrown exceptions?
Similiar to JavaScript, you can throw anything. ...
9
votes
4
answers
598
views
How can we backpatch differently-sized jump instructions?
Consider a compiler whose target language is some virtual machine bytecode. The jump instructions have to encode the size of their jumps. For example, in JVM bytecode the ...