lua-users home
lua-l archive

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


On Mon, Apr 18, 2011 at 7:48 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> - ,opmode(0, 1, OpArgR, OpArgN, iABC)         /* OP_LOADNIL */
>> + ,opmode(0, 1, OpArgU, OpArgN, iABC)         /* OP_LOADNIL */
>
> There seems to be a problem here. OP_LOADNIL uses the macro RB like
> any other instruction that uses B as a register, and this macro
> asserts that the instruction has OpArgR for B. (I would prefer
> to leave this OpArgR as it is...)

OP_LOADNIL does make use the RB macro. From my point of view, it uses
it in a rather different way: OP_LOADNIL assigns to the register
specified in B, whereas every other user of RB reads from the register
(so from a register safety point of view, OP_LOADNIL makes the
register safe, whereas every other user of RB needs the register to be
safe as a prerequisite). Hence for me, it is convenient to be able to
treat all bmode==OpArgR in a consistent manner, rather than having to
check bmode==OpArgR&&op!=OP_LOADNIL. As an side, OP_LOADNIL is the
only instruction to assign to a range of registers and use A and B as
registers rather than A as register and B as count.