diff options
Diffstat (limited to 'lcode.c')
-rw-r--r-- | lcode.c | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.c,v 2.144 2017/12/14 14:24:02 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 2.145 2017/12/15 18:53:48 roberto Exp roberto $ |
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 | */ |
@@ -260,18 +260,6 @@ void luaK_patchtohere (FuncState *fs, int list) { | |||
260 | 260 | ||
261 | 261 | ||
262 | /* | 262 | /* |
263 | ** Check whether some jump in given list needs a close instruction. | ||
264 | */ | ||
265 | int luaK_needclose (FuncState *fs, int list) { | ||
266 | for (; list != NO_JUMP; list = getjump(fs, list)) { | ||
267 | if (GETARG_A(fs->f->code[list])) /* needs close? */ | ||
268 | return 1; | ||
269 | } | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | |||
274 | /* | ||
275 | ** 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, |
276 | ** 'target' contains an OP_CLOSE instruction (see first assert). | 264 | ** 'target' contains an OP_CLOSE instruction (see first assert). |
277 | ** Only jumps with the 'k' arg true need that close; other jumps | 265 | ** Only jumps with the 'k' arg true need that close; other jumps |
@@ -1090,14 +1078,20 @@ static int isKstr (FuncState *fs, expdesc *e) { | |||
1090 | ttisshrstring(&fs->f->k[e->u.info])); | 1078 | ttisshrstring(&fs->f->k[e->u.info])); |
1091 | } | 1079 | } |
1092 | 1080 | ||
1081 | /* | ||
1082 | ** Check whether expression 'e' is a literal integer. | ||
1083 | */ | ||
1084 | int luaK_isKint (expdesc *e) { | ||
1085 | return (e->k == VKINT && !hasjumps(e)); | ||
1086 | } | ||
1087 | |||
1093 | 1088 | ||
1094 | /* | 1089 | /* |
1095 | ** Check whether expression 'e' is a literal integer in | 1090 | ** Check whether expression 'e' is a literal integer in |
1096 | ** proper range to fit in register C | 1091 | ** proper range to fit in register C |
1097 | */ | 1092 | */ |
1098 | static int isCint (expdesc *e) { | 1093 | static int isCint (expdesc *e) { |
1099 | return (e->k == VKINT && !hasjumps(e) && | 1094 | return luaK_isKint(e) && (l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C)); |
1100 | l_castS2U(e->u.ival) <= l_castS2U(MAXARG_C)); | ||
1101 | } | 1095 | } |
1102 | 1096 | ||
1103 | 1097 | ||
@@ -1106,7 +1100,7 @@ static int isCint (expdesc *e) { | |||
1106 | ** proper range to fit in register sC | 1100 | ** proper range to fit in register sC |
1107 | */ | 1101 | */ |
1108 | static int isSCint (expdesc *e) { | 1102 | static int isSCint (expdesc *e) { |
1109 | return (e->k == VKINT && !hasjumps(e) && fitsC(e->u.ival)); | 1103 | return luaK_isKint(e) && fitsC(e->u.ival); |
1110 | } | 1104 | } |
1111 | 1105 | ||
1112 | 1106 | ||