'A' : 8 bits
'B' : 9 bits
'C' : 9 bits
'Ax' : 26 bits ('A', 'B', and 'C' together)
'Bx' : 18 bits ('B' and 'C' together)
'sBx' : signed Bx
比如这段:
function y(...) print(...) end
1 [1] GETTABUP 0 0 -1 ; _ENV "print"
2 [1] VARARG 1 0 ; VARARG will set L->top
3 [1] CALL 0 0 1 ; B=0 so L->top set by previous instruction
4 [1] RETURN 0 1
每条指令后面的数字(2个或者3个)表示什么意思?
E:\Project\ZhScheme\lua>luac -l luac.out
main <0> (6 instructions, 24 bytes at 004784F8)0>
0+ params, 2 slots, 0 upvalues, 0 locals, 4 constants, 0 functions
1 [1] LOADK 0 -2 ; 18
2 [1] SETGLOBAL 0 -1 ; a
3 [2] GETGLOBAL 0 -3 ; print
4 [2] LOADK 1 -4 ; "hello world"
5 [2] CALL 0 2 1
6 [2] RETURN 0 1