lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto Ierusalimschy wrote:
> The VM code now uses macros for the cases in the switch, so it
> is not difficult to make it use the labeled goto extension of
> GCC. Unfortunately, GCC "optimizations" killed any possible gain. Each
> case ends with the same code, which jumps to the next instruction. Even
> with -O0, GCC optimized all those repeated fragments to use a single
> copy of a "jmp *%eax" instruction...

Check -fno-crossjumping in the GCC manual. But I think there are
quite a few rants from Anton Ertl about how every new GCC release
messed up the code of his carefully crafted interpreters ...

[
I guess it's a losing proposition to fight the C compiler. Ertl's
experience and my own fruitless experiments trying to speed up the
C code in the plain Lua interpreter are what has driven me to write
my interpreter in pure assembler.

I think overall that was still a net win (counting my time spent
working on this). Obviously this logic doesn't apply if one has
different portability goals. But a JIT compiler has plenty of
machine-specific code, anyway.
]

--Mike