diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-12 16:13:50 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-12 16:13:50 -0300 |
commit | 1fb4d539254b67e7e35ed698250c66d1edff0e08 (patch) | |
tree | 8f48b7ca736a7fb02834bcfac1415cd43307f529 /lopcodes.h | |
parent | f6aab3ec1f111cd8d968bdcb7ca800e93b819d24 (diff) | |
download | lua-1fb4d539254b67e7e35ed698250c66d1edff0e08.tar.gz lua-1fb4d539254b67e7e35ed698250c66d1edff0e08.tar.bz2 lua-1fb4d539254b67e7e35ed698250c66d1edff0e08.zip |
OP_NEWTABLE keeps exact size of arrays
OP_NEWTABLE is followed by an OP_EXTRAARG, so that it can keep
the exact size of the array part of the table to be created.
(Functions 'luaO_int2fb'/'luaO_fb2int' were removed.)
Diffstat (limited to 'lopcodes.h')
-rw-r--r-- | lopcodes.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -324,7 +324,8 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
324 | (*) In OP_SETLIST, if (B == 0) then real B = 'top'; if (C == 0) then | 324 | (*) In OP_SETLIST, if (B == 0) then real B = 'top'; if (C == 0) then |
325 | next 'instruction' is EXTRAARG(real C). | 325 | next 'instruction' is EXTRAARG(real C). |
326 | 326 | ||
327 | (*) In OP_LOADKX, the next 'instruction' is always EXTRAARG. | 327 | (*) In OP_LOADKX and OP_NEWTABLE, the next 'instruction' is always |
328 | EXTRAARG. | ||
328 | 329 | ||
329 | (*) For comparisons, k specifies what condition the test should accept | 330 | (*) For comparisons, k specifies what condition the test should accept |
330 | (true or false). | 331 | (true or false). |
@@ -375,4 +376,11 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) | |||
375 | #define LFIELDS_PER_FLUSH 50 | 376 | #define LFIELDS_PER_FLUSH 50 |
376 | 377 | ||
377 | 378 | ||
379 | /* | ||
380 | ** In OP_NEWTABLE, array sizes smaller than LIMTABSZ are represented | ||
381 | ** directly in R(B). Otherwise, array size is given by | ||
382 | ** (R(B) - LIMTABSZ) + EXTRAARG * LFIELDS_PER_FLUSH | ||
383 | */ | ||
384 | #define LIMTABSZ (MAXARG_B - LFIELDS_PER_FLUSH) | ||
385 | |||
378 | #endif | 386 | #endif |