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 7D4586EC5E; Fri, 9 Apr 2021 23:07:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7D4586EC5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617998851; bh=2LzDevwccJ19A/RKTidIsF+iUgSmfVjHYQyTV2G+8UU=; 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=wiO+z7aiDzTLTTNoE51kgMwoh/DqXpf04DOySalohd3A9l7XClCuoOxGPd8Krxfd5 999RoiGcHEzbzn3tkohku7uRYM/hKuxhb7K0SdSJD06RdNClQzDzJq6t9nRDRajth7 dOtyUyj6u5PY9X1d0UN4/R0Q4OFECcbmuKJDk23A= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 B7BE66EC5E for ; Fri, 9 Apr 2021 23:05:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B7BE66EC5E Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lUxNn-0005sb-3b; Fri, 09 Apr 2021 23:05:35 +0300 To: v.shpilevoy@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Fri, 9 Apr 2021 23:05:34 +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: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480B1C8842CE613979723F2FB4628545A35182A05F538085040F83FF8D61C95CC57EB85E9E9607A8931957229D26FEF6606CF6454C7E6FE2DE8 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CE4525FFB91B9BBCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637E565730CA785C4918638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2326E32CB0AA8A4CA2CD08AA83CBEA2DCA2BB4B7391E66DBBD2E47CDBA5A96583C09775C1D3CA48CF2609375A3A81E2DD117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE7437303CEBCE4AF319FA2833FD35BB23DF004C906525384302BEBFE083D3B9BA73A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735E4A630A5B664A4FFC4224003CC83647689D4C264860C145E X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CD0035DD76F8A8A4F44B54245C2A8B97AA26B0EE213B8AF939C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3444047AE358B4075476FC5645966D4A3162FD7F8DE11A74AD17A5FF959AC0C6339A3D20EA553B4F671D7E09C32AA3244CB89F1BE76E74E9488DD261574803118E5A1673A01BA68E40FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojyO2lHpuZu4S9ZUCiNASBmg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638226275C64730921142180D4E65D3DBE9AD83D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [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: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thank you for the review! My answer and new patch below. On 30.03.2021 02:06, Vladislav Shpilevoy wrote: > Thanks for the patch! > >> diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c >> index 3701741ef..078de0e62 100644 >> --- a/src/box/sql/mem.c >> +++ b/src/box/sql/mem.c >> @@ -604,6 +604,15 @@ mem_set_pointer(struct Mem *mem, void *ptr) >> mem->field_type = field_type_MAX; >> } >> >> +void >> +mem_set_frame(struct Mem *mem, struct VdbeFrame *frame) >> +{ >> + mem_clear(mem); >> + mem->flags = MEM_Frame; >> + mem->u.pFrame = frame; >> + mem->field_type = field_type_MAX; > > The type is already installed by mem_clear(). Fixed. New patch: commit e88babfbe7dc13059b3bfe4d2d721f5a37f8fb7c 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 4091161ce..b2598816d 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -604,6 +604,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 ae5d78ecb..ffab0d616 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -360,6 +360,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 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); - pRt->flags = MEM_Frame; - pRt->u.pFrame = pFrame; + mem_set_frame(pRt, pFrame); pFrame->v = p; pFrame->nChildMem = nMem;