lua-users home
lua-l archive

Comment of OP_CLOSE in lua 5.2 is wrong

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I'm working on a lua disassembler. I think I have found 2 mistake in comments of OpCode.


In 5.2 OP_JMP be used instead of OP_CLOSE. But the comment says in line 199 of lua-5.2.3/src/lopcodes.h:
    OP_JMP,/*A sBxpc+=sBx; if (A) close all upvalues >= R(A) + 1*/
I think it is wrong, it should be:
    OP_JMP,/*A sBxpc+=sBx; if (A) close all upvalues >= R(A - 1)*/
See lua-5.2/src/lvm.c line 504:
    if (a > 0) luaF_close(L, ci->u.l.base + a - 1);


And the comment says in line 207 of lua-5.1.5/src/lopcodes.h:
    OP_VARARG/*A BR(A), R(A+1), ..., R(A+B-1) = vararg*/
That should be:
    OP_VARARG/*A BR(A), R(A+1), ..., R(A+B-2) = vararg*/ 
That has been corrected in lua-5.2



AltStyle によって変換されたページ (->オリジナル) /