From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id C71B92256E for ; Tue, 10 Jul 2018 16:23:54 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OYIB-y7Kdjcp for ; Tue, 10 Jul 2018 16:23:54 -0400 (EDT) Received: from smtp37.i.mail.ru (smtp37.i.mail.ru [94.100.177.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 1A14A2229D for ; Tue, 10 Jul 2018 16:23:54 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 4/4] sql: remove OP_LoadPtr References: <8e1537ec82992142f31fe561102fdbce690d1754.1531242355.git.kshcherbatov@tarantool.org> <450C4EA0-0803-4298-A3D4-D80A97145B66@tarantool.org> From: Vladislav Shpilevoy Message-ID: Date: Tue, 10 Jul 2018 23:23:51 +0300 MIME-Version: 1.0 In-Reply-To: <450C4EA0-0803-4298-A3D4-D80A97145B66@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: "n.pettik" , tarantool-patches@freelists.org On 10/07/2018 21:34, n.pettik wrote: > >> @@ -2969,12 +2964,9 @@ sql_create_index(struct Parse *parse, struct Token *token, >> goto exit_create_index; >> >> sql_set_multi_write(parse, true); >> - >> - >> - sqlite3VdbeAddOp2(v, OP_SIDtoPtr, BOX_INDEX_ID, >> - index_space_ptr_reg); >> - sqlite3VdbeAddOp4Int(v, OP_OpenWrite, iCursor, 0, >> - index_space_ptr_reg, 6); >> + sqlite3VdbeAddOp4(v, OP_OpenWrite, iCursor, 0, 0, >> + (void *)space_by_id(BOX_INDEX_ID), >> + P4_SPACEPTR); >> sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ); > > Wait, AFAIK SIDtoPtr was used deliberately taking into consideration > the fact that DDL may change ptr to space. So conversion id -> space ptr > is delayed until vdbe execution (right before cursor opening). Am I wrong? Yes, you are wrong here, because it was used to restore pointer to struct space "_index", but "_index" is a system space, and it is never altered. So pointer to "_index" is always valid, and it makes no sense to restore it on runtime. >