What are the advantages or disadvantages of compiling to VM Bytecode vs native machine code?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/ProgrammingLanguages

Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
  • Oberon

    Oberon parser, code model & browser, compiler and IDE with debugger

    Compiling to native machine code has many disadvantages such as platform dependency (i.e. you need a backend per platform), much more work (you need e.g. to write the optimizer yourself, likely with different features for each platform, you have to take care of the C ABI yourself in case you need an FFI, you might require a GC, etc.) and it's more difficult to test and debug. If you on the other hand generate e.g. LuaJIT or CIL (ECMA-335) or Java bytecode, all these things are already done for you and the runtime is usually available and optimized for different platforms. If you compile to CIL you can even profit from the AOT compiler features of Mono (or the forthcoming CoreCLR). Some of the mentioned advantages are also available when you e.g. compile to LLVM IR, but the size and complexity is larger and you still have to take care of a lot of things yourself (like GC, C ABI and the like). My early compilers (see https://github.com/rochus-keller/Oberon/) generated LuaJIT bytecode, but then I switched to CIL because of the benefits and instead of an LLVM AOT compiler it write a C transpiler which was a good decision.

  • wabt

    The WebAssembly Binary Toolkit

    I think a good target would be to generate WebAssembly text format and use WABT.

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

  • wasmtime

    A standalone runtime for WebAssembly

    With this you can run your language in the browser and on the desktop using wasmtime.

  • binaryen

    Compiler infrastructure and toolchain library for WebAssembly

    You can also use binaryen to optimize your wasm output

  • langs

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts