diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-03-22 13:37:17 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-03-22 13:37:17 -0300 |
| commit | 23e6bac8a0bbb9e5df43cbc0b7634b6d1395b0ff (patch) | |
| tree | b8f01be3b195252ecb414092dce98299fc325a54 /lopcodes.h | |
| parent | 682054920ddc434fd4a7f8cc78027dbb03f47f00 (diff) | |
| download | lua-23e6bac8a0bbb9e5df43cbc0b7634b6d1395b0ff.tar.gz lua-23e6bac8a0bbb9e5df43cbc0b7634b6d1395b0ff.tar.bz2 lua-23e6bac8a0bbb9e5df43cbc0b7634b6d1395b0ff.zip | |
Keep correct type for immediate operands in comparisons
When calling metamethods for things like 'a < 3.0', which generates
the opcode OP_LTI, the C register tells that the operand was
converted to an integer, so that it can be corrected to float when
calling a metamethod.
This commit also includes some other stuff:
- file 'onelua.c' added to the project
- opcode OP_PREPVARARG renamed to OP_VARARGPREP
- comparison opcodes rewritten through macros
Diffstat (limited to 'lopcodes.h')
| -rw-r--r-- | lopcodes.h | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -294,7 +294,7 @@ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ | |||
| 294 | 294 | ||
| 295 | OP_VARARG,/* A C R(A), R(A+1), ..., R(A+C-2) = vararg */ | 295 | OP_VARARG,/* A C R(A), R(A+1), ..., R(A+C-2) = vararg */ |
| 296 | 296 | ||
| 297 | OP_PREPVARARG,/*A (adjust vararg parameters) */ | 297 | OP_VARARGPREP,/*A (adjust vararg parameters) */ |
| 298 | 298 | ||
| 299 | OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | 299 | OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ |
| 300 | } OpCode; | 300 | } OpCode; |
| @@ -331,6 +331,9 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
| 331 | C > 0 means the function is vararg and (C - 1) is its number of | 331 | C > 0 means the function is vararg and (C - 1) is its number of |
| 332 | fixed parameters. | 332 | fixed parameters. |
| 333 | 333 | ||
| 334 | (*) In comparisons with an immediate operand, C signals whether the | ||
| 335 | original operand was a float. | ||
| 336 | |||
| 334 | ===========================================================================*/ | 337 | ===========================================================================*/ |
| 335 | 338 | ||
| 336 | 339 | ||
