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 671ED6EC5B; Wed, 14 Apr 2021 01:19:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 671ED6EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618352346; bh=ofnST/sYQr1HAHcOrbkdG05l2PrUMj5hGkEamr2EGvU=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=CbrT12nddkhFHopUWZxQ7hrVQT7rfjljXKa/mBNjH6ra6FY24M9krqWvp/3OCjT5o aDkHrFZM9p+WTN5CkTbYZ3Pn1DPQ1+MCXFN1gSNYhJ1g2JxRBpgdECJECm75F1nzPQ X8HvYd7FglNQNtp9q53H0vejx/LQa1KpRON3hOSQ= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [94.100.177.91]) (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 971436EC5B for ; Wed, 14 Apr 2021 01:19:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 971436EC5B Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1lWRN9-0005x8-KN; Wed, 14 Apr 2021 01:19:03 +0300 Date: Wed, 14 Apr 2021 01:19:02 +0300 To: Vladislav Shpilevoy Message-ID: <20210413221902.GA46475@tarantool.org> References: <152c58c6-460b-64ad-bbd9-2c9deea2c92d@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <152c58c6-460b-64ad-bbd9-2c9deea2c92d@tarantool.org> X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74809299FB6B3996B874F289A033C44AD400182A05F53808504014740AF6EE4684F7200CA5CA7AFDDD451C16438BE2460C0FCC4187D27F1EEF84 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE745C0EDBD94D46193EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637457C2806CBF873EDEA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA658C286BBA2BAE74618B21A8F5688875967F6B57BC7E64490618DEB871D839B73339E8FC8737B5C224952D31B9D28593E51CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0998E19D2343267C68941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD26923F8577A6DFFEA7C44DC14CD4868D85D7B076A6E789B0E97A8DF7F3B2552694A1E7802607F20496D49FD398EE364050F0AC5B80A05675ACD1133410A2FE6C23AB3661434B16C20AC78D18283394535A9E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B62CFFCC7B69C47339089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4ADD69086D7A80F17D3EE3F258F996CEABB X-C1DE0DAB: 0D63561A33F958A5A30BA55CF1C14C006F2522A8E70B18E7D2BD01540319AFB0D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D343D1F112031EF3D62427891E0C3756AA7B07E127C88FF4D0CCEFE9C939F6AB295B1CEBD627DA181071D7E09C32AA3244CEBBC0D7EFD68F823201DEE54B861A73F69B6CAE0477E908DFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXGQnwxgUZQprw== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED36B7EFEA8B265C6D200CA5CA7AFDDD45B9A8FEFFB5F7F2D55105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 35/52] sql: introduce mem_set_frame() 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: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thank you for the review! My answer, diff and new patch below. On Tue, Apr 13, 2021 at 01:37:08AM +0200, Vladislav Shpilevoy wrote: > Good job on the patch! > > > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > > index c21a6576f..7f1e0bcbe 100644 > > --- a/src/box/sql/vdbe.c > > +++ b/src/box/sql/vdbe.c > > @@ -4163,8 +4163,7 @@ case OP_Program: { /* jump */ > > goto no_mem; > > } > > mem_destroy(pRt); > > You can remove this destroy call. > Fixed. > > - pRt->flags = MEM_Frame; > > - pRt->u.pFrame = pFrame; > > + mem_set_frame(pRt, pFrame); > > > > pFrame->v = p; > > pFrame->nChildMem = nMem; > > Diff: diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 7a3170614..d5b8033a4 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -4206,7 +4206,6 @@ case OP_Program: { /* jump */ if (!pFrame) { goto no_mem; } - mem_destroy(pRt); mem_set_frame(pRt, pFrame); pFrame->v = p; New patch: commit 24a0ee0f12e15b8504c04ea34d973bcfc6a922a1 Author: Mergen Imeev Date: Tue Mar 16 14:40:37 2021 +0300 sql: introduce mem_set_frame() This patch introduces mem_set_frame() function. This function clears the MEM and sets a frame to MEM. Frames used for internal VDBE operations. Part of #5818 diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index 6c5c4f391..8e13131f1 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -461,6 +461,14 @@ mem_set_ptr(struct Mem *mem, void *ptr) mem->u.p = ptr; } +void +mem_set_frame(struct Mem *mem, struct VdbeFrame *frame) +{ + mem_clear(mem); + mem->flags = MEM_Frame; + mem->u.pFrame = frame; +} + 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 f4cdbafd2..36b7d3eca 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -542,6 +542,10 @@ mem_set_invalid(struct Mem *mem); void mem_set_ptr(struct Mem *mem, void *ptr); +/** Clear MEM and set frame to be its value. */ +void +mem_set_frame(struct Mem *mem, struct VdbeFrame *frame); + /** * Copy content of MEM from one MEM to another. In case source MEM contains * string or binary and allocation type is not STATIC, this value is copied to diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index e3d7456f3..d5b8033a4 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -4206,9 +4206,7 @@ case OP_Program: { /* jump */ if (!pFrame) { goto no_mem; } - mem_destroy(pRt); - pRt->flags = MEM_Frame; - pRt->u.pFrame = pFrame; + mem_set_frame(pRt, pFrame); pFrame->v = p; pFrame->nChildMem = nMem;