[tarantool-patches] [PATCH 1/3] sql: remove redundant conversion from OP_AddImm

Nikita Pettik korablev at tarantool.org
Tue May 21 13:34:54 MSK 2019


OP_AddImm adds constant defined by P2 argument to memory cell P1. Before
addition, content of memory cell is converted to MEM_Int. However,
according to the usages of this opcode in source code, memory cell
always initially contains integer value. Hence, conversion to integer
can be replaced with simple assertion.
---
 src/box/sql/vdbe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index a34395cdf..d083d3709 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -1929,7 +1929,7 @@ case OP_ShiftRight: {           /* same as TK_RSHIFT, in1, in2, out3 */
 case OP_AddImm: {            /* in1 */
 	pIn1 = &aMem[pOp->p1];
 	memAboutToChange(p, pIn1);
-	sqlVdbeMemIntegerify(pIn1, false);
+	assert((pIn1->flags & MEM_Int) != 0);
 	pIn1->u.i += pOp->p2;
 	break;
 }
-- 
2.15.1





More information about the Tarantool-patches mailing list