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 AD3A38205E; Sun, 24 Jan 2021 19:27:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AD3A38205E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1611505625; bh=w1VE2fYIs0Y9MUS3+b0B/HiCEwaF+amvJz36w/hmFqM=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=iPYq3XgrsyD0157wk9eoW1AAUCkSs0DuJ82D/+9d7XGJ74QnSFYTBwi21qMPnsh4o Rl9nJ1FQane9OkcnC11GdI0mUbkCa5irW2ilQrxcip4wyiyW4M1U6Y6v5N9w0JNb4h IlLBU/QOzg83fO3zpQ4wPh21ewlJTdIg3Nq+tjeo= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 22F558205E for ; Sun, 24 Jan 2021 19:26:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 22F558205E Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1l3iDx-0002RY-G4; Sun, 24 Jan 2021 19:26:49 +0300 To: Cyrill Gorcunov , tml References: <20210118203556.281700-1-gorcunov@gmail.com> <20210118203556.281700-3-gorcunov@gmail.com> Message-ID: <136716fc-7e19-6515-d18c-c0d3d0576a96@tarantool.org> Date: Sun, 24 Jan 2021 17:26:48 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210118203556.281700-3-gorcunov@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9F0E84CC1954AA438E508474D5268E5E89C7ADEF93A4D062700894C459B0CD1B924FC24D7BD8C7C6D8C6273E8F4C8D629E677AB1C9F20D3C85118E5AA908773F9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A8325FA649D0A450EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D24CDE3D695BBBC6EA1F7E6F0F101C674E70A05D1297E1BBC6CDE5D1141D2B1C0B1F46A4AF37D13B884015E014DC97FEF363D3A223F587839FA2833FD35BB23D9E625A9149C048EE33AC447995A7AD18618001F51B5FD3F9D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BAA867293B0326636D2E47CDBA5A96583BA9C0B312567BB23089D37D7C0E48F6CA18204E546F3947C890A246B268E114E57739F23D657EF2BC8A9BA7A39EFB7666BA297DBC24807EA089D37D7C0E48F6C8AA50765F79006378534F7D0DA3B5694EFF80C71ABB335746BA297DBC24807EA27F269C8F02392CD4DF8A859A081327B27F269C8F02392CD5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A533E880DA3A65D5368F90A6BB21731B4F23B9CF4CD1FC747AD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA758F9E841AEAEC4F2C410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345DE7771146E56B08EA8207AE53049793504F6D3BD40105EF62B3EFF934A4E4691110564C126B9F701D7E09C32AA3244C237466F8AA84AF722253544610D6486B7101BF96129E4011729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojEcKN7r9rK/1slciSpXvQKw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A06382215FA4A62FF407C33D7DCF21D459A96943841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v12 2/8] module_cache: move module handling into own subsystem 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! See 4 comments below. On 18.01.2021 21:35, Cyrill Gorcunov wrote: > The module handling should not be bound to particular > function implementation (we will have two users: already > existing functions for "_func" space, and a new upcoming > one which will be serving cbox submodule in next patch). 1. It is now cmod, not cbox. > For this sake all module related code is moved to > module_cache file where we do symbol resolving, calling > and tracking of symbol usage. > > Part-of #4642 > > Signed-off-by: Cyrill Gorcunov > --- > diff --git a/src/box/module_cache.c b/src/box/module_cache.c > new file mode 100644 > index 000000000..9fe316807 > --- /dev/null > +++ b/src/box/module_cache.c > @@ -0,0 +1,513 @@ > +/* > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright 2010-2021, Tarantool AUTHORS, please see AUTHORS file. > + */ > + > +#include > +#include > +#include > +#include > + > +#include "assoc.h" > +#include "diag.h" > +#include "error.h" > +#include "errinj.h" > +#include "fiber.h" > +#include "port.h" > + > +#include "box/error.h" 2. #include "error.h" and #include "box/error.h" are the same files. Because you are in box/ folder. > +#include "lua/utils.h" > +#include "libeio/eio.h" > + > +#include "module_cache.h" > + > +/** Modules name to descriptor hash. */ > +static struct mh_strnptr_t *mod_hash = NULL; > + > +int > +module_sym_load(struct module_sym *mod_sym) > +{ > + assert(mod_sym->addr == NULL); > + > + struct func_name name; > + func_split_name(mod_sym->name, &name); > + > + struct module *module = module_cache_find(name.package, name.package_end); > + if (module == NULL) { > + module = module_load(name.package, name.package_end); > + if (module == NULL) > + return -1; > + if (module_cache_add(module) != 0) { > + module_delete(module); > + return -1; > + } > + } > + > + mod_sym->addr = module_sym(module, name.sym); > + if (mod_sym->addr == NULL) > + return -1; 3. Is it correct, that you second time has deleted the bugfix which you did about module not being unloaded when first symbol load fails? > + > + mod_sym->module = module; > + rlist_add(&module->funcs_list, &mod_sym->item); > + return 0; > +} > diff --git a/src/box/module_cache.h b/src/box/module_cache.h > new file mode 100644 > index 000000000..fd789f603 > --- /dev/null > +++ b/src/box/module_cache.h > @@ -0,0 +1,139 @@ > +/* > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright 2010-2021, Tarantool AUTHORS, please see AUTHORS file. > + */ > + > +#pragma once > + > +#include 4. Please, use "" instead of <> for non-system headers.