What does HackerNews think of mir?

A lightweight JIT compiler based on MIR (Medium Internal Representation) and C11 JIT compiler and interpreter based on MIR

Language: C

#13 in C
#12 in Compiler
#22 in Linux
#20 in macOS
I came here to say exactly the same thing. There are also a couple of other options: the MIR project from RedHat [1], libjit [2], lightning [3] and Dynasm [4] 1. https://github.com/vnmakarov/mir 2. https://www.gnu.org/software/libjit/ 3. https://www.gnu.org/software/lightning/manual/lightning.html 4. https://corsix.github.io/dynasm-doc/tutorial.html

But in general it seems to be very hard to beat the bang for buck from generating C and compiling that - even with something simple like tcc

Author is Vladimir Makarov creator of MIR: "a universal lightweight Just-in-Time (JIT) compiler known as MIR. The cornerstone of the project is a machine-independent medium-level intermediate representation (MIR)."

https://github.com/vnmakarov/mir

https://en.wikipedia.org/wiki/Intermediate_representation

> I wish C was scriptable

C kinda can be used as scripting language with MIR project https://github.com/vnmakarov/mir

It released version 0.1 just a few days ago, and I've successfully used it as an alternative and fast C compiler with Nelua.

> I think that future compiler and VM writers and FPGA soft-CPU authors -- should target this "abstracted instruction set"!

GNU lightning succeeds in what it sets out to do, which is to offer a simple and minimal JIT code-generator. It offers nothing in the way of optimisation, by design. Most projects looking for a code-generator are looking for something with great optimisation built-in, so they're not wrong to go with LLVM or the JVM rather than GNU lightning (or something similar like Mir [0][1]). I don't think the average compiler would gain much by targeting GNU lightning.

With all that said, GNU Guile, a Scheme interpreter, uses a fork of GNU lightning, insufferably named lightening. [3]

[0] https://github.com/vnmakarov/mir

[1] https://lists.gnu.org/archive/html/lightning/2020-02/msg0001...

[2] https://wingolog.org/archives/2019/05/24/lightening-run-time...

Seeing that PostgreSQL has pluggable JIT backends, maybe using MIR would be a faster and more lightweight alternative to LLVM.

https://github.com/vnmakarov/mir

From GitHub [1]:

  "Plans to try MIR light-weight JIT first for CRuby or/and MRuby implementation"
  "MIR is strongly typed"
Is there an explanation of how the project bridges the gap between dynamically-typed Ruby and statically-typed MIR?

More generally, I'd love to see something like MRuby+MIR be successful. It would be great to see an alternative to the aging LuaJIT.

[1] https://github.com/vnmakarov/mir