From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id ECB5768F44; Tue, 23 Mar 2021 12:52:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ECB5768F44 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1616493139; bh=Ve5MXaEGPVSYF/nFVxyuBsESS3/Zx21fWAKEHtL2A8c=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xlqm/5VnI8llQ3EAlL8zUnmvnnBgY5ffGp1D+dQ2q0bNl8YTEqpunbtfP9MtTUvT7 FoJy6GSrq6aIVA/Sw2E1TC4fvf+k1B/qQh47xFENoo2jHuAUUDQWMmHXDc7VmrPNs+ /Suh59h//ryqqbd6sAFcA5+7gSJ37Uo/TDle4I24= Received: from smtp30.i.mail.ru (smtp30.i.mail.ru [94.100.177.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 8062368F58 for ; Tue, 23 Mar 2021 12:36:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8062368F58 Received: by smtp30.i.mail.ru with esmtpa (envelope-from ) id 1lOdSL-0001D3-T6; Tue, 23 Mar 2021 12:36:10 +0300 To: v.shpilevoy@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Tue, 23 Mar 2021 12:36:09 +0300 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95D6E7CC48CB1F5F111116110879554077ED795A4341E98F3182A05F538085040531DB30A6B087797BA76D40F8FED5749AC4784F2CA508FE46BAA408FBB764D4F X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7012137A818DEC7F7EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006373ABD2822AD894AA78638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95C686AF563A045C75E65E77ADC7B5BFE9FEB6EB8C64ECFB635A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE73AFA331E307B52169FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C3543F342AA183667F117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFF1165EFABA1780A676E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8B91567F0C33893BD73AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B091A620F70A64A45A99449624AB7ADAF3735872C767BF85DA29E625A9149C048EE0A3850AC1BE2E73557739F23D657EF2BC8A9BA7A39EFB7666BA297DBC24807EA089D37D7C0E48F6C8AA50765F7900637C3090DF2C0002BD1EFF80C71ABB335746BA297DBC24807EA27F269C8F02392CDC58410348177836E285124B2A10EEC6C00306258E7E6ABB4E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46D61478E5271AB1F0B355D89D7DBCDD132 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C686AF563A045C75E65E77ADC7B5BFE9FEB6EB8C64ECFB6359C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3475FE4AA98865E2359CFFAE13162174FC1C42EE0D22B7E7F39DD93DBB260C45E319841F966A1B4D961D7E09C32AA3244C404168A192FE80F72DDB8A3A47FA00E4CE0B41342B755BCDFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWJZv20R+6UgXt0co0PztQw== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED8367B24637FB79F8BA76D40F8FED574981AE5054A97140B95105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: [Tarantool-patches] [PATCH v4 35/53] sql: introduce mem_set_undefined() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This patch introduces mem_set_undefined() function. Function mem_set_undefined() invalidates MEM. It does not clears MEM prior to invalidating it. Part of #5818 --- src/box/sql/mem.c | 7 +++++++ src/box/sql/mem.h | 3 +++ src/box/sql/vdbe.c | 8 ++++---- src/box/sql/vdbeaux.c | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index 583de00a2..fd2710478 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -588,6 +588,13 @@ mem_set_allocated_array(struct Mem *mem, char *value, uint32_t size) mem->field_type = FIELD_TYPE_ARRAY; } +void +mem_set_undefined(struct Mem *mem) +{ + mem->flags = MEM_Undefined; + mem->field_type = field_type_MAX; +} + int mem_copy(struct Mem *to, const struct Mem *from) { diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h index b94495f89..75486ba3a 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -262,6 +262,9 @@ mem_set_dynamic_array(struct Mem *mem, char *value, uint32_t size); void mem_set_allocated_array(struct Mem *mem, char *value, uint32_t size); +void +mem_set_undefined(struct Mem *mem); + int mem_copy(struct Mem *to, const struct Mem *from); diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index c91aeede3..f899dfe7a 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -597,7 +597,7 @@ case OP_Return: { /* in1 */ pIn1 = &aMem[pOp->p1]; assert(mem_is_unsigned(pIn1)); pOp = &aOp[pIn1->u.u]; - pIn1->flags = MEM_Undefined; + mem_set_undefined(pIn1); break; } @@ -640,7 +640,7 @@ case OP_EndCoroutine: { /* in1 */ assert(pCaller->opcode==OP_Yield); assert(pCaller->p2>=0 && pCaller->p2nOp); pOp = &aOp[pCaller->p2 - 1]; - pIn1->flags = MEM_Undefined; + mem_set_undefined(pIn1); break; } @@ -4091,8 +4091,8 @@ case OP_Program: { /* jump */ pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem]; for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++) { - pMem->flags = MEM_Undefined; - pMem->db = db; + mem_create(pMem); + mem_set_undefined(pMem); } } else { pFrame = pRt->u.pFrame; diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index 2e8669138..ccabf6035 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -1568,7 +1568,7 @@ sqlVdbeMakeReady(Vdbe * p, /* The VDBE */ p->nMem = nMem; for (int i = 0; i < nMem; ++i) { mem_create(&p->aMem[i]); - p->aMem[i].flags = MEM_Undefined; + mem_set_undefined(&p->aMem[i]); } memset(p->apCsr, 0, nCursor * sizeof(VdbeCursor *)); } -- 2.25.1