[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: luac [GS]ETTABUP "anomoly"
- From: Patrick Donnelly <batrick@...>
- Date: Mon, 2 Apr 2012 00:20:44 -0400
Hi list,
I'm writing a code analysis program for Lua 5.2 that needs to know
global variable gets/sets. Apparently when you exceed 256 constants,
lua needs to begin using 3 op codes:
513 [257] LOADK 0 -257 ; "foo256"
514 [257] CLOSURE 1 256 ; 0xc1a3a0
515 [257] SETTABUP 0 0 1 ; _ENV
versus 2 when you use constants in the constant table below 256.
511 [256] CLOSURE 0 255 ; 0xc27730
512 [256] SETTABUP 0 -256 0 ; _ENV "foo255"
[To generate a simple example, run this:
$ for ((i = 0; i <= 256; i++)); do echo "function foo$i() end "; done
| luac -l -p - | less
]
The "anomaly" is that the listing output no longer says what key is
being set (I imagine it's the same GETTABUP) on the SETTABUP line.
This is mildly annoying as now I have to keep track of what constants
are loaded into registers to naively keep track of what SETTABUP is
referring to. Is it possible a future bug fix release could correct
this easily?
--
- Patrick Donnelly