NTmatter / LLBoy

Rudimentary GameBoy emulator utilizing LLVM for incremental translation of bytecode to native or LLVM JIT.
http://www.axante.net/projects/llboy
20 stars 0 forks source link

Consider using dispatch tables for memory reading and writing #3

Open ghost opened 12 years ago

ghost commented 12 years ago

Essentially you can make a table that holds pointers to handling sub-routines for addresses being requested. The GameBoy/GameBoy Color memory map is only 16-bit (albeit with ROM and RAM banking), so it can easily be mapped. This is faster than if/else'ing like a mad-man for address decoding.

NTmatter commented 12 years ago

Looks like a good idea. I'll give it a try further down the line.

ghost commented 12 years ago

Also the games can execute instructions from the their RAM, and often do for waiting out OAM DMA, so make sure you can successfully cover invalidation of the code cache.

NTmatter commented 12 years ago

That's a definite chunk of complexity right there. Odds are that I'll just avoid caching any executable instructions in RAM. The real focus of this project is fiddling around with LLVM to produce a mostly native binary of the ROM. It might be worth using the JIT to handle "live" code, though :)

ghost commented 12 years ago

Yeah, still might be worth it to JIT the busy-wait loops that are often found in RAM in many games.

NTmatter commented 12 years ago

It'll be interesting to do some profiling on the effects of JIT with cache invalidation compared to interpreted execution.

ghost commented 12 years ago

The cases of busy-wait are busy enough to hard-code optimizations upon.