HolyJit: A New Hope

bpierre | 627 points

For those wondering, it's a specializer, applied to an interpreter, to specialize the interpreter into a jit.

This is a pretty well explored technique, it's rarely done these days because historically, people could not get good enough performance.

(I am not trying to knock them, just put it in context)

For more context on how you'd do something like this, read this:

https://en.wikipedia.org/wiki/Partial_evaluation#Futamura_pr... and http://blog.sigfpe.com/2009/05/three-projections-of-doctor-f...

DannyBee | 6 years ago

No offense, but the blog post is seriously missing a better (or any?) explanation of what's the new JIT all about. At first I even thought my browser loaded only half the page...

readittwice | 6 years ago

For what it's worth, the name is obviously a pun and a small wink to the Graal VM [1]. Not sure there's any intention to reference TempleOS's HolyC.

[1] https://github.com/graalvm/

bnjbvr | 6 years ago

On a similar note, I have been watching this[0] project which provides an IR to target and optional optimizations. But I like the idea that the only difference between a JIT and an AOT compiler is optimization choice (assuming we don't include tracing as part of the JIT features).

Also, this[1] blog series is a must-read for interested beginners.

0 - https://github.com/stoklund/cretonne/ 1 - https://eli.thegreenplace.net/2017/adventures-in-jit-compila...

kodablah | 6 years ago

"This means more time to implement JavaScript features" - yes, because JavaScript isn't getting enough features fast enough :-p

Jokes aside, I love this kind of work from the Mozilla team. This and the bits going into Quantum are really amazing pieces of software engineering in my opinion.

jarym | 6 years ago

I'm not sure as to what is fundamentally different about this JIT-compiler (except for the awesome name of course)

Is it basically just a Rust rewrite which also tries to reduce the complexity of their current just-in-time compiler?

Edit: By calling it "just" a Rust rewrite, I'm not implying that's a simple undertaking, even moreso considering the complexity of modern JS engines.

bananicorn | 6 years ago

This is amazing! Write a regular old interpreter in a fully featured language, then just wrap it in a macro and poof you magically have a jit that will compile and execute your interpreted code on the fly.

Seriously. Look at the example for brainfuck [0], it's less than 70 lines of completely normal interpreter loop, including a one-line macro on the top. What the heck.

[0]: https://github.com/nbp/holyjit/blob/master/examples/brainfuc...

infogulch | 6 years ago

36000 lines of handwritten assembler in v8? Not since the transition to ignition and turbofan...

$ git clone https://github.com/v8/v8.git $ cd v8 $ find . -name '*.S'

There's still some macro assembler in the built-in's but it's emitted rather than being assembler.

MrZipf | 6 years ago

This seems really cool! I know it's been mentioned before that there are no plans to rewrite SpiderMonkey in Rust, but this sort of feels like a tiny first step in that direction?

Almost reminds me of early on in Servo's history: https://news.ycombinator.com/item?id=6268521

(Although I may just be projecting what I want to hear :) it's exciting hearing about new Rust projects, especially new stuff going into Firefox.)

nathcd | 6 years ago

How is this different from Pypy, other than the fact that ones uses RPython and the other uses Rust?

jkabrg | 6 years ago

Is this basically the same transition as V8 did with crankshaft to ignition+turbofan?

immutable_ai | 6 years ago

Smells like Graal/Truffle

nimish | 6 years ago

When I first saw the name "HolyJit" On Reddit I thought it was going to be something new from the TempleOS guy.

unkown-unknowns | 6 years ago

By my understanding

HolyJit:Rust::Rpython (toolkit):Rpython (language)

Rpython being the language and toolkit that is used to create pypy.

XR0CSWV3h3kZWg | 6 years ago

Gotta say... this is pretty badass.

benjismith | 6 years ago

What is a jit?

Why would you want one?

Can it help you write in a jot?

Can it help you write in a dot?

Why do I feel like I’m trapped in The Land of Doctor Seuss?

bradknowles | 6 years ago

I was expecting TempleOS getting a new jit

beached_whale | 6 years ago
[deleted]
| 6 years ago

Kinda reminds me of holyC ;)

explodingcamera | 6 years ago

First thought was: "Is this another Terry Davis language/framework?"[1]

No, no it is not.

I would suggest changing the name from HolyJit to anything else.

[1] https://en.m.wikipedia.org/wiki/TempleOS

lettergram | 6 years ago

So Mozilla continues the tradition of terrible names in software engineering - HolySh*t is just wonderful. At least if they were as autistic as Terry and were inspired by HolyC...

bitL | 6 years ago

haxord hcked winning

CryptoFascist | 6 years ago

stupid dumb oink oink oink

CryptoFascist | 6 years ago

ha ha ha hahahahahahhahah ahha hah

CryptoFascist | 6 years ago

What?! Does Terry finally decide to use Rust for his browser development?

TheSpecialist | 6 years ago

Whatever Mozilla. I'll care what you have to say in 10 years when I eventually get over how badly you are screwing me over by disabling all of the extensions that I rely on on a daily basis.

jrcii | 6 years ago

nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger nigger

CryptoFascist | 6 years ago

nigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger niggernigger nigger nigger nigger nigger nigger

CryptoFascist | 6 years ago

I admire how mozilla is so passionate about what they develop but still, in 2017, firefox needs restart every couple of hours for performance reasons. I kinda of feel like they have the proof of concept working but its never good enough for the wider audience.

agounaris | 6 years ago

In the mean time, the performance for Firefox' Tree Style Tabs plugin have gone downhill. I'd be interested to know more about new browsers that put tabs on the side by default.

baby | 6 years ago

For a moment I hoped this had something to do with HolyC

TomMarius | 6 years ago

Can we just drop the JS VM and embed some nicer VM (JVM, DartVM) instead?

skocznymroczny | 6 years ago

It's fun to mock God ... until he judges you for it.

Daniel 5

pcunite | 6 years ago

Why does the Cargo.toml[1] file in the source repo for HolyJit have the word "brainfuck"[2] in it?

Does that have some significance to Rust or Mozilla? Or is this a case of copy pasta?

[1]: https://github.com/nbp/holyjit/blob/master/Cargo.toml

[2]: Permanent link to line: https://github.com/nbp/holyjit/blob/1f20eb41de2dae14179815c7...

koolba | 6 years ago