Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 3/4] sql: got rid of redundant MASKBIT32 definition
Date: Fri, 15 Feb 2019 20:05:08 +0300	[thread overview]
Message-ID: <82b74351-95c9-9ad3-7371-4c796eac1a58@tarantool.org> (raw)
In-Reply-To: <4330bedcb868e7f44185f1179bb5e9c2e46a78c5.1549629707.git.kshcherbatov@tarantool.org>

Thanks for the patch! See 4 comments below.

1. We do not use the past in commit titles. Please, use 'get',
not 'got'. In the next commit too.

On 08/02/2019 13:52, Kirill Shcherbatov wrote:
> MASK BIT 32 macro is now redundant, so we got rid of it.
> Also refactored related code to use core bitmasks helpers
> 
> Part of #3571
> ---
>   src/box/sql/expr.c      | 22 ++++++++++++----------
>   src/box/sql/sqliteInt.h |  1 -
>   src/box/sql/vdbeaux.c   |  7 +++----
>   3 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> index d83be5101..cf82bd366 100644
> --- a/src/box/sql/expr.c
> +++ b/src/box/sql/expr.c
> @@ -3963,7 +3963,11 @@ sqlite3ExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
>   			int nFarg;	/* Number of function arguments */
>   			FuncDef *pDef;	/* The function definition object */
>   			const char *zId;	/* The function name */
> -			u32 constMask = 0;	/* Mask of function arguments that are constant */
> +			/*
> +			 * Mask of function arguments that are
> +			 * constant.
> +			 */
> +			uint32_t const_mask = 0;


2. In the previous commit you said, that 32bit mask is already
replaced with 64bit one where possible. But why was not it
possible to replace this one?

>   			int i;	/* Loop counter */
>   			sqlite3 *db = pParse->db;	/* The database connection */
>   			struct coll *coll = NULL;
> @@ -4038,11 +4042,10 @@ sqlite3ExprCodeTarget(Parse * pParse, Expr * pExpr, int target)
>   			}
>   
>   			for (i = 0; i < nFarg; i++) {
> -				if (i < 32
> -				    && sqlite3ExprIsConstant(pFarg->a[i].
> -							     pExpr)) {
> -					testcase(i == 31);
> -					constMask |= MASKBIT32(i);
> +				if (i < 32 &&

3. Why 32? The column mask is smart, it has no size restrictions.

> +				    sqlite3ExprIsConstant(pFarg->a[i].pExpr)) {
> +					column_mask_set_fieldno((uint64_t *)
> +								&const_mask, i);

4. column_mask_set_fieldo does *mask = ... . It means, that it rewrites 8 bytes
from the specified address. But you passed a value of only 4 bytes, so the next
4 bytes of foreign memory are polluted.

>   				}
>   				if ((pDef->funcFlags & SQLITE_FUNC_NEEDCOLL) !=
>   				    0 && coll == NULL) {

  reply	other threads:[~2019-02-15 17:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 12:52 [tarantool-patches] [PATCH v1 0/4] sql: replace 32 bit column mask Kirill Shcherbatov
2019-02-08 12:52 ` [tarantool-patches] [PATCH v1 1/4] box: introduce new helpers in column_mask.h Kirill Shcherbatov
2019-02-15 17:05   ` [tarantool-patches] " Vladislav Shpilevoy
2019-02-20 13:42     ` Kirill Shcherbatov
2019-02-22 17:51       ` Vladislav Shpilevoy
2019-02-22 18:01   ` Konstantin Osipov
2019-02-22 18:22     ` Konstantin Osipov
2019-02-08 12:52 ` [tarantool-patches] [PATCH v1 2/4] sql: use 64b bitmasks instead of 32b where possible Kirill Shcherbatov
2019-02-15 17:05   ` [tarantool-patches] " Vladislav Shpilevoy
2019-02-20 13:42     ` Kirill Shcherbatov
2019-02-08 12:52 ` [tarantool-patches] [PATCH v1 3/4] sql: got rid of redundant MASKBIT32 definition Kirill Shcherbatov
2019-02-15 17:05   ` Vladislav Shpilevoy [this message]
2019-02-20 13:42     ` [tarantool-patches] " Kirill Shcherbatov
2019-02-08 12:52 ` [tarantool-patches] [PATCH v1 4/4] sql: got rid of redundant bitmask helpers Kirill Shcherbatov
2019-02-15 17:05   ` [tarantool-patches] " Vladislav Shpilevoy
2019-02-20 13:42     ` Kirill Shcherbatov
2019-02-22 17:52       ` Vladislav Shpilevoy

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=82b74351-95c9-9ad3-7371-4c796eac1a58@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 3/4] sql: got rid of redundant MASKBIT32 definition' \
    /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