From 23e6bac8a0bbb9e5df43cbc0b7634b6d1395b0ff Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 22 Mar 2019 13:37:17 -0300 Subject: 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 --- lopcodes.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index f867a01b..bbdd6897 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -294,7 +294,7 @@ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ OP_VARARG,/* A C R(A), R(A+1), ..., R(A+C-2) = vararg */ -OP_PREPVARARG,/*A (adjust vararg parameters) */ +OP_VARARGPREP,/*A (adjust vararg parameters) */ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ } OpCode; @@ -331,6 +331,9 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ C > 0 means the function is vararg and (C - 1) is its number of fixed parameters. + (*) In comparisons with an immediate operand, C signals whether the + original operand was a float. + ===========================================================================*/ -- cgit v1.2.3-55-g6feb