Blue Moon

Community Forums/Showcase/Blue Moon

Yasha(Posted 2015) [#1]
Something slightly closer to useful than usual... announcing Blue Moon:

GitHub project

(OK, still not actually useful, but getting closer)

Blue Moon aims to be a Lua 5.3 implementation in pure BlitzMax. It's a hybrid JIT/interpreter (jitterer?) using an innovative control system (actually it's a repurposed black-hat technique). The goal is to layer over this engine a seamless Lua-BlitzMax API layer, that eats BlitzMax objects and spits out Lua tables without needing to get one's hands dirty with argument pushing and popping. The code is completely original and uses nothing from the PUC-Rio version.

At the moment early tests indicate that it's somewhat slower than the PUC-Rio interpreter (...oh), but I'm hoping to be able to change that later, once everything actually works correctly: the existing JIT framework should make it easy to dynamically swap in more efficient versions of the interpreter operations (and "inline" others to pure machine code), making it a system with a lot of potential for optimization. There's also a relatively ambitious plan for a faster GC. (comparing performance against stock Lua is kinda meaningless, but Blue Moon is obviously never going to compete with or even come close to LuaJIT, so pick your battles)

Blue Moon is currently very unfinished. There's no implemented GC, quite a low limit on the amount of machine code it can generate, many operations (everything to do with varargs and metamethods) don't exist yet, and the standard library is extremely limited (print, tostring, rawset/get, ...uh). I haven't bothered to even try the test suite yet. However, the bytecode compiler is fairly solid (it successfully reads most things, if you like viewing VM assembly). It also uses a relatively innovative - for BlitzMax - compilation technique, which I call FOLD (and will post a separate example about 'cause it's really cool and powerful). That said Blue Moon can run some very simple programs: see test1.lua for the kind of thing it can handle at present.


Normally I wouldn't announce something so early, but I want to work on something else for a bit, so I'll complete the missing features in a couple of weeks. (the parts that are left to do are actually the easy but tedious stuff; e.g. hordes of standard library functions, bugfixes)


Who was John Galt?(Posted 2015) [#2]
Very cool... thanks for sharing. This should be bundled with Brucey's version of Max, assuming the pair of you are ok with that.