this repo has no description
Rust 87.7%
Python 0.3%
C 0.1%
Shell 0.1%
Makefile 0.1%
Other 11.7%
152 1 0

Clone this repository

https://tangled.org/bernsteinbear.com/the-whole-bagel https://tangled.org/did:plc:fmlri4btc7kco6w4xi3g3cwk/the-whole-bagel
git@tangled.org:bernsteinbear.com/the-whole-bagel git@tangled.org:did:plc:fmlri4btc7kco6w4xi3g3cwk/the-whole-bagel

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

A little compiler project#

Goals#

  • AOT compiler that bundles IR so code can also be specialized at run-time (JIT)
  • Little target language with enough features to be interesting
  • Good test infrastructure

Non-goals#

  • Massive existing language

Thoughts#

  • Source language
    • Lox
  • Desired language features
    • Structs
    • Static typing
    • Monomorphization of functions by type
    • Garbage collection
    • Userland annotations for specialization based on parameter values
  • Use Chris Fallin's register allocator verifier
  • Run the program until some userland freeze call and then AOT?
    • Kind of like JIT, but only once, more time to optimize
    • Kind of like wizer
  • Add weval so that people can write interpreters and get method JITs "for free"

Plan#

  • Create an AOT compiler that gives no thought to performance of generated code
    • Parser
    • IR
    • Register allocation
    • Code generation
    • Make all calls indirect, kind of like the PLT. This will allow us to swap out the code at run-time.
    • Optional interprocedural SCCP like in Loupe
  • Add runtime support for profiling execution
    • Number of times a function is called
    • Branch prediction
    • Find monomorphic attribute lookups
    • Find monomorphic call sites
    • Find monomorphic parameter values
  • Use existing AOT compiler for JIT
    • Enable inlining
    • Think about how to do deopt into AOT code
  • Rewrite register allocator