Hacker News new | past | comments | ask | show | jobs | submit login
Mir: A lightweight JIT compiler project (2020) (redhat.com)
60 points by mpweiher on July 2, 2023 | hide | past | favorite | 19 comments



> Simplicity is usually achieved by dividing tasks into small, manageable subtasks. There is even an extreme nanopass compiler design used for studying compiler topics in education.

...and production compilers: https://andykeep.com/pubs/dissertation.pdf Definitely Chez 9 is based on it -- not sure about Chez 8.


I like how the page rescrolls to the top as I approach the middle. Very efficient means to generate tons of content.


I noticed that they use JavaScript to modify the hash string in the URL. Here is the probably root cause:

There is an H2 heading between "Lightweight JIT compiler project goals" and "The current state of the MIR project". That h2 contains the Hoover Dams image and has an id generated from empty content because the content is just image: <h2 id="-h2"></h2>. When you scroll near that image, the javascript tries to update the url but that broken ID caused it to set the empty ID ("#"), thus jumping to top.

You can verify this by open the table of contents bar and see an untitled section. Whatever CMS they are using, it didn't handle the empty H2 correctly. Few additional considerations:

1. The article author should never produce an H2 with only an image in it.

2. The image should have an `alt` label to be accessible.

3. CMS should use `alt` label or file name to generate the ID when the H2 has no other textual content.


The w3c spec says valid hash fragment must starts with [a-zA-Z], so "-h2" is considered invalid. Ref: https://www.w3.org/TR/xhtml1/#C_8


Don't know if it's worth pointing out, but Mir is Canonical's competitor to Wayland for Ubuntu's display server.


MIR for Ruby is in no way related to Canonical Mir.


It's just weird to me, "Mir" is a pretty unique name, and there's two softwares out there using it.


Considering it was first the name of a space station, and before that a Russian word, it's not such a unique name.


also a german word


Wait till you hear that Rust and Zig's compilers both have their own "MIR".


Additionally, LLVM has MIR (Machine IR), which is what Zig's also stands for. There's a lot of M-starting compiler intermediate representations. This Ruby MIR is Medium Internal Representation. Rust's is Mid-level IR. Similarly, there's MLIR, which is usually expanded to Multi-Level Intermediate Representation.


Just learned that there was a language called DART in 1959. https://en.wikipedia.org/wiki/Dartmouth_BASIC


There aren't that many three letter words


CMU's Common Lisp compiler is called Python.


Thanks for this.

I started a basic toy JIT compiler for a language that looks similar to JavaScript. It is incomplete. (jitcompiler.c)

https://github.com/samsquire/compiler

With these kinds of projects there is a lot of work to be done and I feel it's difficult to get started reading a codebase for a JIT compiler or gcc or LLVM.


> "The implementation should be simple too at less than 10K C lines, because I want wider adoption of this tool. Simple code is easier to learn and maintain. I'd like also to avoid any external dependencies for this project. At the end of the article, you can see the actual results I have now. (...) As for the generated code performance, I decided that it should be at least 70% of GCC -O2 performance. The implementation should be simple too at less than 10K C lines, because I want wider adoption of this tool. Simple code is easier to learn and maintain. (...) The biggest cons of the existing projects were their size, the fact that it would be hard for me to achieve my goals using them, and that I can not control the projects. Also, the smaller source size of the MIR project makes studying the code easier for other people and reduces the effort required to maintain it."

I can understand the point for LLVM, but I don't fully understand why QBE (https://c9x.me/compile/doc/llvm.html, which is part of his assessment) didn't fit in what he is looking for.



This page is taking me back to the top when I scroll to the bottom. It's infuriating.


Does it work like Graal or is it more of a classic JIT?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: