From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: Problem with dynamic modules Date: Sun, 19 May 2024 16:21:03 +0300 Message-ID: <868r06aqf4.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12470"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, emacs-devel@gnu.org To: Gerd =?iso-8859-1?Q?M=F6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun May 19 15:21:57 2024 Return-path: Envelope-to: ged-emacs-devel@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 1s8gU8-000309-Mx for ged-emacs-devel@m.gmane-mx.org; Sun, 19 May 2024 15:21:56 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s8gTQ-0006kD-EF; Sun, 19 May 2024 09:21:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8gTL-0006is-Dq for emacs-devel@gnu.org; Sun, 19 May 2024 09:21:07 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s8gTK-0003Ru-DC; Sun, 19 May 2024 09:21:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=O2Zq8IFqAvAo9zE+XTrqQVRjtt93n+oomLgjgrLnU+8=; b=ZwOgWoZrlBLt62AbZ+1i h1S76alrg/oTMaUifbJZHVIDai+ch9OUte4jS/TVYW/Pr4SLXVB9XJKZA2AC+5LxoJO5LhhfDAxs7 aQeoxAsQmZvPWTniWTTKFFWMER/wmmeodDr7NzbeLsJcktdrYw3xn11+R0wb/4nYpRjFG3QmwMwVb VYFhG0r8NVOI5K560VG32SHo+rW4HvvhYzf3C02qR+jTV1uMq5zLUU0mj+IppEXsDyUIZCjgTEVsd /C1kjxIgFriCJE+9SLlmzVLs5pe+toZmO3Mr1qZlIR+Uaalpv4O/MMEfpI1iBfQCU80c1rbQHz/6l OCaFg0tRiHjRSQ==; In-Reply-To: (message from Gerd =?iso-8859-1?Q?M=F6llmann?= on Sun, 19 May 2024 15:01:35 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319374 Archived-At: > From: Gerd Möllmann > Cc: Emacs Devel > Date: Sun, 19 May 2024 15:01:35 +0200 > > I think I've found a problem with modules, which I currently don't have > a plan how to fix it or work around it. > > Example: vterm. > > Its emacs_module_init uses module_make_global_ref to get handles to > functions in Emacs that it can call, among other things. One example > > emacs_value Fapply; > > int emacs_module_init(struct emacs_runtime *ert) { > emacs_env *env = ert->get_environment(ert); > { > Fapply = env->make_global_ref(env, env->intern(env, "apply")); > } > > Note that Fapply here is a variable in the shared lib for vterm. > > module_make_global_ref creates a module_global_reference in Emacs, say > R, a pseudo-vector, and remembers it in a global hash table. Its return > value is &R->value, > > As a pseudo-vector, R moves, and &R->value changes when it does. And so, > Fapply in the vterm modules becomes invalid. Can we prevent the pseudo-vector R from moving?