[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Alignment and the Lua VM
- From: Peter Cawley <lua@...>
- Date: Thu, 24 Sep 2009 11:43:20 +0100
As far as I can tell, the prototype code array (where VM instructions
are stored) is allocated at whatever alignment the underlying memory
allocator gives it. Can you not just pass an allocator to lua_newstate
(or lua_setallocf) which returns blocks which are word aligned?
On Thu, Sep 24, 2009 at 11:34 AM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> Although the Lua VM instruction codes are 32-bit, they are not
> word-aligned. On ARM architectures this is regrettable, because
> VMs with word-aligned 32-bit instructions can be implemented
> much more efficiently, with one fetch per instruction. I suspect
> that amending the Lua VM to ensure that the VM instructions are
> aligned to word boundaries would be a simple matter. Is there any
> likelihood of such an amendment being incorporated into a future
> version of Lua? It would be no skin off the noses of other CPU
> architectures, and it would be nice to think of Lua being yet
> more efficient on all those embedded devices that use ARM chips.
>
> --
> Gavin Wraith (gavin@wra1th.plus.com)
> Home page: http://www.wra1th.plus.com/
>