From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 14D5D2EFA1 for ; Tue, 21 May 2019 06:35:02 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7dx65QkCNy_A for ; Tue, 21 May 2019 06:35:01 -0400 (EDT) Received: from smtp61.i.mail.ru (smtp61.i.mail.ru [217.69.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 4FEDD2EDA4 for ; Tue, 21 May 2019 06:35:01 -0400 (EDT) From: Nikita Pettik Subject: [tarantool-patches] [PATCH 1/3] sql: remove redundant conversion from OP_AddImm Date: Tue, 21 May 2019 13:34:54 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Nikita Pettik 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