Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Nikita Pettik <korablev@tarantool.org>
Subject: [tarantool-patches] [PATCH 1/3] sql: remove redundant conversion from OP_AddImm
Date: Tue, 21 May 2019 13:34:54 +0300	[thread overview]
Message-ID: <ee931aebd203af542bfdeac0442f2fcff5f55615.1558378847.git.korablev@tarantool.org> (raw)
In-Reply-To: <cover.1558378847.git.korablev@tarantool.org>
In-Reply-To: <cover.1558378847.git.korablev@tarantool.org>

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

  reply	other threads:[~2019-05-21 10:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 10:34 [tarantool-patches] [PATCH 0/3] Fix CAST operation Nikita Pettik
2019-05-21 10:34 ` Nikita Pettik [this message]
2019-05-21 10:34 ` [tarantool-patches] [PATCH 2/3] sql: allow CAST operation from REAL to BOOLEAN Nikita Pettik
2019-05-21 10:34 ` [tarantool-patches] [PATCH 3/3] sql: allow CAST operation from quoted float to int Nikita Pettik
2019-05-27 20:43 ` [tarantool-patches] Re: [PATCH 0/3] Fix CAST operation Vladislav Shpilevoy
2019-05-28  1:39 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee931aebd203af542bfdeac0442f2fcff5f55615.1558378847.git.korablev@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/3] sql: remove redundant conversion from OP_AddImm' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox