Small corrections when setting 'L->top'
- OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top);
- OP_CLOSE doesn't need to set top ('Protect' already does that);
- OP_TFORCALL must use 'ProtectNT', to preserve the top already set.
(That was a small bug, because iterators could be called with
extra parameters besides the state and the control variable.)
- Comments and an extra test for the bug in previous item.
This commit is contained in:
@@ -694,9 +694,10 @@ static Proto *addprototype (LexState *ls) {
|
||||
|
||||
/*
|
||||
** codes instruction to create new closure in parent function.
|
||||
** The OP_CLOSURE instruction must use the last available register,
|
||||
** The OP_CLOSURE instruction uses the last available register,
|
||||
** so that, if it invokes the GC, the GC knows which registers
|
||||
** are in use at that time.
|
||||
|
||||
*/
|
||||
static void codeclosure (LexState *ls, expdesc *v) {
|
||||
FuncState *fs = ls->fs->prev;
|
||||
|
||||
Reference in New Issue
Block a user