lua-users home
lua-l archive

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


Hi!
 
This is "Nitpicking on Wednesdays".
 
 
1)
A "for"-loop consisted of FORPREP1 + FORLOOP1 needs only two internal variables.
But three registers are used, and R(A+2) is never read.

 
2)
The file lopcodes.h from Lua@Github (as of Jan 30 2019) contains descriptions of VM instructions in comments.
Some descriptions don't agree with the implementation of these instructions.
 
(first line is "currently is:", second line is "should be:")
 
OP_SHRI,/* A B C   R(A) := R(B) >> C */
OP_SHRI,/* A B sC  R(A) := R(B) >> C */
 
OP_SHLI,/* A B C   R(A) := C << R(B) */
OP_SHLI,/* A B sC  R(A) := C << R(B) */
 
OP_TESTSET,/* A B   if (not R(B) == k) then R(A) := R(B) else pc++ */
OP_TESTSET,/* A B   if (not R(B) ~= k) then R(A) := R(B) else pc++ */