Skip to content

Draft: compile to machine code instead of byte code

Yorick Peterse requested to merge native-compiler into master

This changes the compiler and VM to compile to machine code, making the VM a runtime library bound to the machine code. Thus the runtime is essentially the libc of Inko.

TODO

  • Port all instructions to runtime functions
  • Port all built-in functions to runtime functions
  • Re-enable the various commented-out tests
  • Implement the new backend using LLVM
    • We'll likely stick with the current memory layout, i.e. floats are always boxed and integers use tagging. This is something I want to change, but it's probably too much work to also combine in this MR. The only viable alternative is fat pointers, and I'm not ready to commit to 128 bits pointers everywhere just yet.
    • Integer and float arithmetic is to be implemented using LLVM, not runtime functions (i.e. a + b translates to similar native code, taking into account tagged pointers)
  • Change the various _INKO intrinsics to use the appropriate native functions
  • Figure out what to do (if anything) with #295 as part of this work
  • Fix the assembly on Windows, as it currently crashes with an access violation
  • Remove Pointer in favour of typed *const / *mut pointers
  • When producing an increment on a statically known Int or Float, emit a clone instead
Edited by Yorick Peterse

Merge request reports