Re: [ANN] LuaJIT Roadmap 2012/2013

  • From: Henk Boom <henk@xxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 12 Jun 2012 16:01:49 -0400

On 12 June 2012 09:53, Mike Pall <mike-1206@xxxxxxxxxx> wrote:
> Robert G. Jakabosky wrote:
>> On Monday 11, Mike Pall wrote:
>> > Adam Strzelecki wrote:
>> > > for i = 0, 1000 -- some tight loop
>> > >   local value = model[i] * view
>> > >   gl.UniformMatrix4fv(location, 1, gl.TRUE, value.gl)
>> > > end
>> >
>> > Well, no, because 'value' *does* escape. There's no way for the
>> > compiler to know that gl.UniformMatrix4fv() doesn't store the
>> > 'value' pointer somewhere else.
>>
>> If gl.UniformMatrix4fv() did store the value and the value wasn't also stored
>> somewhere on the Lua side, then there is already a bug since the GC would 
>> free
>> the value which might still be in use by the C code.
>
> No, there's a guarantee that arguments to a C function call are
> not collected before the C call returns.

I think the idea is that if the value doesn't escape on the lua side,
then having it escape on the C side would be unsafe either way, so you
might as well assume it doesn't. Does this make sense?

    henk

Other related posts: