[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: How to make ROMable Lua data
- From: "Juris Kalnins" <juris@...>
- Date: Mon, 12 Jan 2009 16:34:57 +0200
I'm thinking how to change Lua to allow part of state to be
stored in a read only region of memory that has a fixed address
(this can be, for example, data from a read-only memory mapped file),
and I'd like to ask for advice and ideas.
One goal is to make code that accesses Lua values should work both
with values from the heap and immutable values.
The necessary exception is the garbage collector code, but
adding conditional checks throughout the whole Lua is not an
option (will make it too big and too slow).
Are there any existing modifications that achieve this?
Problem with this idea is that Lua changes values in very subtle and
obscure ways, especially the "GCObject *next" field, that is used
to chain strings in global hash table, chain in-stack upvalues
and probably a lot more.
Will Lua work if there will be more than one instance of the same string,
(i.e. one in read-only memory, and another one in the heap)?