lua-users home
lua-l archive

Re: LuaJIT 2 clone-on-write for tables

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


On 2011年1月19日, Alexander Gladysh wrote:
>
> Another silly question, while we're on it: is it possible, in theory,
> to create some magical "jit.tclone()" builtin, that would make such
> clone-on-write optimization possible?
You can do that with a proxy table. Point __index at the table to be
cloned, and when __newindex is called, copy everything to the proxy.
Tony.
-- 
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
HUMBER THAMES DOVER WIGHT PORTLAND: NORTH BACKING WEST OR NORTHWEST, 5 TO 7,
DECREASING 4 OR 5, OCCASIONALLY 6 LATER IN HUMBER AND THAMES. MODERATE OR
ROUGH. RAIN THEN FAIR. GOOD.

AltStyle によって変換されたページ (->オリジナル) /