[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Optimizing interpreters (was Re: LuaJIT with vectors)
- From: Mike Pall <mikelu-1011@...>
- Date: Fri, 19 Nov 2010 11:49:42 +0100
Mark Hamburg wrote:
> Is the NaN-based representation portable back to the stock Lua
> distribution particularly if one restricts the target to 32-bit
> machines? The memory bandwidth win seems like a fairly
> straightforward performance gain if the representation doesn't
> pose too many other challenges.
I'm not sure you'd be able to see much of a difference, except for
big arrays. The dispatch/decode overhead in the Lua interpreter
might shadow the effects.
But AFAIR it's not that much code that needs to be changed. Split
the internal and external tag representation and adjust the macros
that deal with tagged values. You'll need to add explicit tests
for numbers in a couple places, instead of a switch () on the tag.
And, most importantly, canonicalize all NaNs at the ingress points
to the VM! For Lua that's only lua_pushnumber, string-to-number
conversions and maybe the bytecode loader. Although I've mentioned
this important measure before, WebKit apparently omitted it and
that was the key ingredient of the iPhone jailbreak.
--Mike
- References:
- LuaJIT with vectors, Petri Häkkinen
- Re: LuaJIT with vectors, Mike Pall
- Re: LuaJIT with vectors, Alex Queiroz
- Re: LuaJIT with vectors, David Kastrup
- Re: LuaJIT with vectors, Alex Queiroz
- Re: LuaJIT with vectors, David Kastrup
- Re: LuaJIT with vectors, Mike Pall
- Re: LuaJIT with vectors, David Given
- Re: LuaJIT with vectors, Mike Pall
- Optimizing interpreters (was Re: LuaJIT with vectors), Mark Hamburg