[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT 2 clone-on-write for tables
- From: David Manura <dm.lua@...>
- Date: Wed, 19 Jan 2011 13:11:47 -0500
On Wed, Jan 19, 2011 at 12:04 PM, Alexander Gladysh <firstname.lastname@example.org> wrote:
> ..somehow automagically optimize out tclone() calls for
> the nodes that are never changed? [clone-on-write]
Do you mean, for example, if you have code like this:
local t2 = tclone(t1)
to optimize away the `tclone(t1)` as just `t1` if the code in "[...]"
never writes to t2 and never exposes t2 outside of the block?
Careful: tables have unique identity (t2 ~= t1). Even if you don't
write to t2, the code in "[...]" might (although unlikely) still
expect that t2 ~= t1.