[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] LuaJIT 1.0.3
- From: Mike Pall <mikelu-0509@...>
- Date: Fri, 9 Sep 2005 02:04:05 +0200
David Given wrote:
> Incidentally, looking through the LuaJIT code I couldn't find the bit where
> you're flushing the processor cache --- we have to do this a lot in our OS,
> and was wondering how you did it. On some platforms this can be a major
> performance hit; there are some processors that can't flush sections of the
> cache, only all of it, and if you do this frequently it can have ghastly
> performance issues. A JIT compiler could hit this a lot...
Sure. But only when memory that has once been executed
is _reused_ for other code. Which doesn't happen too often
with a JIT compiler. Most apps usually converge quickly to
a stable set -- and I'm not doing dynamic recompilation (yet).
Anyway, this is a non-issue for x86. It has coherent I/D-caches.
And a branch was enough to flush the prefetch queue on older
CPUs (up to 80486). Newer x86 CPUs don't require this anymore.
But I have to flush the code translation cache for valgrind.
See ljit_mem.c, LUAJIT_USE_VALGRIND. Right now this flushes
the cache on free (and not on reuse). But since this is
only for debugging ...