[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: block-scope finalization
- From: Coda Highland <chighland@...>
- Date: Tue, 24 Nov 2015 12:12:31 -0800
On Tue, Nov 24, 2015 at 10:48 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
> Am 24.11.2015 um 18:51 schröbte Viacheslav Usov:
>>
>> On Tue, Nov 24, 2015 at 6:34 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
>>
>>> `lua_replace` overwrites a stack slot. If that stack slot contained the
>>
>> last reference to a value, that value has to be finalized. The same
>> applies
>> to `lua_pop`, `lua_remove`, `lua_copy`, `lua_xmove`, `lua_rawget`,
>> `lua_next`, etc.
>>
>> It is not the slots that should have ref counts. Slots stay what they are.
>> It is the objects (userdata and tables) that should have ref counts
>
>
> I'm not sure I can follow. When would you update the reference counts?
When the object is assigned to a stack slot, when it's removed from a
stack slot, when it's assigned to a table field, when it's removed
from a table field, when it's assigned to a table key, when it's used
as a key to store nil into a table, when a table that contains it is
destroyed. The exceptions are weak tables, where being assigned as a
weak key/value does not modify the refcount (but has to track a
backpointer to clean it up).
/s/ Adam
- References:
- block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Coda Highland
- Re: block-scope finalization, Javier Guerra Giraldez
- Re: block-scope finalization, Coda Highland
- Re: block-scope finalization, Patrick Donnelly
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Patrick Donnelly
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Patrick Donnelly
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Philipp Janda
- Re: block-scope finalization, Viacheslav Usov
- Re: block-scope finalization, Philipp Janda