Re: Question about SETFIELD nil emission in table constructor codegen

Błażej Roszkowski <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <CAOc0etEJH04MKYDtouoL_6EQQA7p+w=XiPRbwWTU_3zD2zWu6g@mail.gmail.com>
Complexity, I guess. LuaJIT does both optimizations you describe,
you can try reading bytecode at luajit dot me (not my website).

On Sat, 28 Feb 2026 at 18:12, 'Bernard L'île' via lua-l <
[email protected]> wrote:

> Concerning literal tables, I've always asked myself why the compiler does
> not build table literals with only constant members at compile time and
> stores them in a constant pool, as it already does for strings and scalars.
>
> As a further optimizations, table literals with variable components
> *could* (but need not) be built at compile time and then augmented with
> setfield opcodes to fill in the variable parts.
>
> bil til schrieb am Samstag, 28. Februar 2026 um 09:44:50 UTC+1:
>
>> Am Sa., 28. Feb. 2026 um 03:24 Uhr schrieb 重归混沌 <[email protected]>:
>> >
>> > for constructor fields that are statically unique and explicitly nil,
>> is there any specific semantic reason these SETFIELD instructions must
>> still be emitted? Or is this mainly a
>>
>> Lua compiler generally is NOT optimizing in any way... .
>>
>> ... the code is in full programmer control (and responsibility :) ).
>>
> --
> You received this message because you are subscribed to the Google Groups
> "lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/lua-l/52ddf9da-3cbe-4319-a5ee-13a7ae11290en%40googlegroups.com
> <https://groups.google.com/d/msgid/lua-l/52ddf9da-3cbe-4319-a5ee-13a7ae11290en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAOc0etEJH04MKYDtouoL_6EQQA7p%2Bw%3DXiPRbwWTU_3zD2zWu6g%40mail.gmail.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.