diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-25 13:55:29 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-25 13:55:29 -0300 |
commit | 9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a (patch) | |
tree | 32d5d49d87ea9124c8209803d1ac78c94ec7a881 /lparser.c | |
parent | 0eb6aa4013051c8c0148c09d8c85ee7cbdc96f42 (diff) | |
download | lua-9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a.tar.gz lua-9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a.tar.bz2 lua-9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a.zip |
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.
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -694,9 +694,10 @@ static Proto *addprototype (LexState *ls) { | |||
694 | 694 | ||
695 | /* | 695 | /* |
696 | ** codes instruction to create new closure in parent function. | 696 | ** codes instruction to create new closure in parent function. |
697 | ** The OP_CLOSURE instruction must use the last available register, | 697 | ** The OP_CLOSURE instruction uses the last available register, |
698 | ** so that, if it invokes the GC, the GC knows which registers | 698 | ** so that, if it invokes the GC, the GC knows which registers |
699 | ** are in use at that time. | 699 | ** are in use at that time. |
700 | |||
700 | */ | 701 | */ |
701 | static void codeclosure (LexState *ls, expdesc *v) { | 702 | static void codeclosure (LexState *ls, expdesc *v) { |
702 | FuncState *fs = ls->fs->prev; | 703 | FuncState *fs = ls->fs->prev; |