From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Wed, 11 Feb 2015 10:43:01 +0100 Message-ID: References: <87y4t9m76w.fsf@lifelogs.com> <85k31coixa.fsf@stephe-leake.org> <85oapy5kt6.fsf@stephe-leake.org> <83y4oiiw81.fsf@gnu.org> <838ugdf251.fsf@gnu.org> <54D80098.3020209@cs.ucla.edu> <54D85304.1030600@cs.ucla.edu> <54D9AC29.2020603@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1423647814 19298 80.91.229.3 (11 Feb 2015 09:43:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Feb 2015 09:43:34 +0000 (UTC) Cc: Stephen Leake , Emacs development discussions To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 11 10:43:18 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YLTp8-0001O8-Uy for ged-emacs-devel@m.gmane.org; Wed, 11 Feb 2015 10:43:11 +0100 Original-Received: from localhost ([::1]:43818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTp8-0002ik-8j for ged-emacs-devel@m.gmane.org; Wed, 11 Feb 2015 04:43:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTp4-0002hc-DE for emacs-devel@gnu.org; Wed, 11 Feb 2015 04:43:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLTp0-0000rZ-CW for emacs-devel@gnu.org; Wed, 11 Feb 2015 04:43:06 -0500 Original-Received: from mail-ie0-f177.google.com ([209.85.223.177]:38649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLTp0-0000rT-8H for emacs-devel@gnu.org; Wed, 11 Feb 2015 04:43:02 -0500 Original-Received: by iecrd18 with SMTP id rd18so2653740iec.5 for ; Wed, 11 Feb 2015 01:43:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=IJJI0HftdF3rTdztPGiBx8+OQhW4p9jf6qSYT+GBE3A=; b=JP/Xg4tAJ09JTs3Pu/lRGZcmRqVd+S4lBiz0kdnb9MI+orbrWI6QQZQ2N9D2a5SN7n kzEdbWPPz0B0KwnXO1qx8WDrLo77DMCSwEjsT7T9bnFuEKjRGsffysvX6KB9Q8nGrmYK raESeWcHl+nQMKhJ0L2yf7iUg//1IgzJlY8L9agMU+c8Wo29z1fqpSatYXdRpO5EwoWB +KWgxIR1Iizr+zMGFbE26t+2Y6C/rYNqobG25CBwDvXseFxLaBaj7oxe5ji15WZMwxTY UH8kzTxarSim4S2J9Ozq/VMejQjDNMntnEV9/YvLrix32yIqgIFNv7CUC35UAze+rTHH yA/w== X-Received: by 10.107.164.221 with SMTP id d90mr4060519ioj.13.1423647781712; Wed, 11 Feb 2015 01:43:01 -0800 (PST) Original-Received: by 10.36.19.71 with HTTP; Wed, 11 Feb 2015 01:43:01 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: G7ZzxTSFgggHoF_W-IdJooNImB0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.223.177 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182868 Archived-At: In other news, I stayed up waaay too late yesterday but I got the destructor thing working! It's pushed on my branch. I added a new Lisp_Misc subtype called Lisp_Module which stores: - a module id - a void* user pointer - a function pointer to a destructor to release the resources of the user pointer There's a module_make_id() function that module can used to get a new unique id and a module_make_object(id, dtor, userp) that allocates a new module Lisp_Object. The destructor is called in by the GC in sweep_misc(), which sweeps the marker list (all misc subtypes use the marker list, maybe this should be documented somewhere). I've added a new source file for module functions in src/module.c. I've tried to ifdef'd everything properly: --without-ltdl has no runtime cost, as it should be. I have made an example module that uses this new lisp type in modules/memtest along with a ERT test. You can browse the commit here [1], it's relatively easy to follow. One thing I haven't checked is whether adding the Lisp_Module to the Lisp_Misc union changes its size (the existing comments say this is important). 1: https://github.com/aaptel/emacs-dynamic-module/commit/c59f2deaae99ca85b0a4fcdd53a3d8ed41d995cd