From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.help Subject: Re: dynamic reload of dynamic module not dynamic? Date: Tue, 19 Apr 2022 14:46:52 +0200 Message-ID: References: <87o810mic0.fsf@zoho.eu> <22BE2D29-B50B-4164-B0AC-4BDFA62A20EC@gmail.com> <87lew3lb94.fsf@zoho.eu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16803"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 19 14:47:40 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ngnGb-00046C-V8 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Apr 2022 14:47:37 +0200 Original-Received: from localhost ([::1]:43896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngnGa-0001No-EX for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 19 Apr 2022 08:47:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngnG7-0001Ng-B9 for help-gnu-emacs@gnu.org; Tue, 19 Apr 2022 08:47:07 -0400 Original-Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:34587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngnG5-00015A-Nv for help-gnu-emacs@gnu.org; Tue, 19 Apr 2022 08:47:07 -0400 Original-Received: by mail-ot1-x32d.google.com with SMTP id s21-20020a0568301e1500b006054da8e72dso3519083otr.1 for ; Tue, 19 Apr 2022 05:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=v/EZ8bxHWXQ4OthiZQX2D1B0Il3gn2uiUFAyXFFc6qY=; b=WyERXRF5HMzYXYOgI5CF68V67Xo5+aYnZO2n50FZEx6cjlI2okrNXWgaHUbUI6/VsY DYQ/2ru+mTbNJ2N1SoTn3SwrN6/ifdie6KkTOI6iVHdpwDewMf2mlYhs98wCskbksj62 86Tu/18MH0w+IMB0r5wmPzTZpxrB+Z5xeqKzXCk3YA1cvBJE84BG2XrnDFo8UaSZeo6W Gj+tRUpylbooUQ5xSwCRmISe2u5gMwfHLm0sWNzG1nYsDrYCyM/8+5u5Q72nMqtJz/p7 1kcjxBzqnZySOHFb0s9wo2PoLqm2L+XNmquvD+2GKyufb/iESd2heqEoyVJIa8yAFjDu JemA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=v/EZ8bxHWXQ4OthiZQX2D1B0Il3gn2uiUFAyXFFc6qY=; b=azwHLBnFMrwobUFmsLfAPD6BHAuAlmpRtCssVbe5dm8ADjgpauo3mDuH9X6nX901Nv 6f0m1xjSO/GeFf0ovXSBflngfNDVa3neeO+1ufnUJoU2Md0SlObiIWUNopTBkzGRBZzO IhQ67hT96Pgik4sB02/DOj97QvLIHTovFAHqv2oVJmTcPZmWWLhOZClR8BE04jYPK3d4 uu+2j9dvj0ZCtHeCeIpgGN7nj7IbdadK0u29/selqwxXGuGirJKQPg6i8r1VX0fQud3B NFWUeOjyt+vI7LJQGOnGURdxkOLfyuVIr2+wkXnS45kDB3jmPQruWAThWxTZJ2RLLIJl ddBg== X-Gm-Message-State: AOAM530oC3LK3Sy5Oi51BNZ3mg9hvmrKhX8xs5bkOvvIKdSlA7N8KqtC 2R1I1brrUaLJVSwJ0jrhP8GH5vmKKue+k8Ql6/U= X-Google-Smtp-Source: ABdhPJx2awOqLpqjhzFN/g9or+tNpeJ23LdqQtOPYGiVs5cIGvvdrL6UzHKwi8Lb+1tpO/D0/GZPjGlzZXPm+oCebAM= X-Received: by 2002:a9d:518b:0:b0:605:4768:18e3 with SMTP id y11-20020a9d518b000000b00605476818e3mr4707866otg.264.1650372422860; Tue, 19 Apr 2022 05:47:02 -0700 (PDT) In-Reply-To: <87lew3lb94.fsf@zoho.eu> Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=p.stephani2@gmail.com; helo=mail-ot1-x32d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136958 Archived-At: Am Mo., 18. Apr. 2022 um 23:07 Uhr schrieb Emanuel Berg via Users list for the GNU Emacs text editor : > > Philipp Stephani wrote: > > >> It seems recompiling the C for an Emacs dynamic module and > >> then loading the new SO file from the same Emacs instance > >> that loaded the old doesn't get you the new stuff? > > > > Yeah, we never call dlclose on the returned shared object > > handle, so reloading a module will only increment the > > handle's reference count. It might make sense to support > > reloading in some way (by having unload-feature eventually > > call dlclose), but it's not trivial: we need to be careful > > to invalidate all references to affected module functions > > before calling dlclose. > > Okay, where are they stored then so one can apply invalidate > to all members and then call dlclose and `load' again? I don't think we have a single exhaustive location, but at the very least we'd need to invalidate all corresponding module functions before unloading a module, probably repointing them to some function that always signals an error. There is no mapping from module handles to corresponding module functions yet, but it shouldn't be terribly hard to add one (but I think first we should discuss whether the FR is important enough for that). Another category would be user pointers, since they are likely to point nowhere once a module gets unloaded.