diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.147 2017/12/22 14:16:46 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.149 2018/01/09 11:21:41 roberto Exp $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -262,16 +262,16 @@ void luaK_patchtohere (FuncState *fs, int list) { | |||
262 | /* | 262 | /* |
263 | ** Correct a jump list to jump to 'target'. If 'hasclose' is true, | 263 | ** Correct a jump list to jump to 'target'. If 'hasclose' is true, |
264 | ** 'target' contains an OP_CLOSE instruction (see first assert). | 264 | ** 'target' contains an OP_CLOSE instruction (see first assert). |
265 | ** Only jumps with the 'k' arg true need that close; other jumps | 265 | ** Only the jumps with ('m' == true) need that close; other jumps |
266 | ** avoid it jumping to the next instruction. | 266 | ** avoid it jumping to the next instruction. |
267 | */ | 267 | */ |
268 | void luaK_patchgoto (FuncState *fs, int list, int target, int hasclose) { | 268 | void luaK_patchgoto (FuncState *fs, int list, int target, int hasclose) { |
269 | lua_assert(!hasclose || GET_OPCODE(fs->f->code[target]) == OP_CLOSE); | 269 | lua_assert(!hasclose || GET_OPCODE(fs->f->code[target]) == OP_CLOSE); |
270 | while (list != NO_JUMP) { | 270 | while (list != NO_JUMP) { |
271 | int next = getjump(fs, list); | 271 | int next = getjump(fs, list); |
272 | lua_assert(!GETARG_k(fs->f->code[list]) || hasclose); | 272 | lua_assert(!GETARG_m(fs->f->code[list]) || hasclose); |
273 | patchtestreg(fs, list, NO_REG); /* do not generate values */ | 273 | patchtestreg(fs, list, NO_REG); /* do not generate values */ |
274 | if (!hasclose || GETARG_k(fs->f->code[list])) | 274 | if (!hasclose || GETARG_m(fs->f->code[list])) |
275 | fixjump(fs, list, target); | 275 | fixjump(fs, list, target); |
276 | else /* there is a CLOSE instruction but jump does not need it */ | 276 | else /* there is a CLOSE instruction but jump does not need it */ |
277 | fixjump(fs, list, target + 1); /* avoid CLOSE instruction */ | 277 | fixjump(fs, list, target + 1); /* avoid CLOSE instruction */ |
@@ -281,14 +281,14 @@ void luaK_patchgoto (FuncState *fs, int list, int target, int hasclose) { | |||
281 | 281 | ||
282 | 282 | ||
283 | /* | 283 | /* |
284 | ** Mark (using the 'k' arg) all jumps in 'list' to close upvalues. Mark | 284 | ** Mark (using the 'm' arg) all jumps in 'list' to close upvalues. Mark |
285 | ** will instruct 'luaK_patchgoto' to make these jumps go to OP_CLOSE | 285 | ** will instruct 'luaK_patchgoto' to make these jumps go to OP_CLOSE |
286 | ** instructions. | 286 | ** instructions. |
287 | */ | 287 | */ |
288 | void luaK_patchclose (FuncState *fs, int list) { | 288 | void luaK_patchclose (FuncState *fs, int list) { |
289 | for (; list != NO_JUMP; list = getjump(fs, list)) { | 289 | for (; list != NO_JUMP; list = getjump(fs, list)) { |
290 | lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP); | 290 | lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP); |
291 | SETARG_k(fs->f->code[list], 1); | 291 | SETARG_m(fs->f->code[list], 1); |
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||