Settings

Theme

Experiments in NES JIT Compilation

bheisler.github.io

71 points by david_parrott 9 years ago · 10 comments

Reader

gravypod 9 years ago

For anyone who hasn't written a JIT I'd recommend writing a Brainfuck runtime one day. It's a tractable and strait forward project that will teach you how to do all of this. Start with implementing a direct interpreter and think of ways to make it faster.

emerged 9 years ago

I've been meaning to do something similar, except by generating C code which is compiled JIT. This way the compiler can optimize blocks of 6502 in more efficient ways than just a direct mapping between opcodes and registers. Of course there's no real purpose to doing this, but it's on my backlog of "projects to do if I'm ever really bored" - one of my first ever C++ projects was writing a dynamic recompiler for 6502, nearly 20 years ago.

  • Gaelan 9 years ago

    I think the common way to do something like this these days would be to generate LLVM IR.

smegel 9 years ago

> Broadly speaking, a JIT (or just-in-time) compiler is a piece of code that translates some kind of program code into machine instructions for the host CPU.

No, that's a compiler.

  • taneq 9 years ago

    It's almost like JIT is short for "just-in-time compiler" or something.

  • SmellyGeekBoy 9 years ago

    The author goes on to clarify right in the next sentence...

    • adwhit 9 years ago

      I love the idea that someone got this far into the article, then stopped in a furious rage to fire off a missive to the HN collective. If only they had read on just One. More. Line!

  • rjblackman 9 years ago

    compilers can be used to make machine instructions for a none host CPU. he just missed out the runtime part for a jit.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection