From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Sat, 14 Feb 2015 19:02:48 -0600 Message-ID: <85egpsgf5z.fsf@stephe-leake.org> References: <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> <54DA8539.1020905@cs.ucla.edu> <87zj8ktq8f.fsf@lifelogs.com> <54DD6413.1000403@cs.ucla.edu> <83wq3m436s.fsf@gnu.org> <834mqowbnh.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1423962219 14631 80.91.229.3 (15 Feb 2015 01:03:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 15 Feb 2015 01:03:39 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 15 02:03:28 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 1YMncN-0001jq-F3 for ged-emacs-devel@m.gmane.org; Sun, 15 Feb 2015 02:03:27 +0100 Original-Received: from localhost ([::1]:33214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMncM-0001Rd-UX for ged-emacs-devel@m.gmane.org; Sat, 14 Feb 2015 20:03:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YMnc3-0001Qh-Rz for emacs-devel@gnu.org; Sat, 14 Feb 2015 20:03:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YMnby-00023a-JQ for emacs-devel@gnu.org; Sat, 14 Feb 2015 20:03:07 -0500 Original-Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:47471) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1YMnby-00023L-55 for emacs-devel@gnu.org; Sat, 14 Feb 2015 20:03:02 -0500 Original-Received: (qmail 7033 invoked by uid 0); 15 Feb 2015 01:03:00 -0000 Original-Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy2.mail.unifiedlayer.com with SMTP; 15 Feb 2015 01:03:00 -0000 Original-Received: from host114.hostmonster.com ([74.220.207.114]) by CMOut01 with id sR2w1p0012UdiVW01R2zba; Sat, 14 Feb 2015 18:02:59 -0700 X-Authority-Analysis: v=2.1 cv=J8Y5smXS c=1 sm=1 tr=0 a=CQdxDb2CKd3SRg4I0/XZPQ==:117 a=CQdxDb2CKd3SRg4I0/XZPQ==:17 a=DsvgjBjRAAAA:8 a=f5113yIGAAAA:8 a=TeMFXEv2S7AA:10 a=9i_RQKNPAAAA:8 a=hEr_IkYJT6EA:10 a=jrwKn-8xaegA:10 a=0HtSIViG9nkA:10 a=mDV3o1hIAAAA:8 a=faWzCFWyMSmJZ24cfI8A:9 a=TLmCa_VYgqsvCjuJeNcA:9 Original-Received: from [70.94.38.149] (port=51334 helo=takver) by host114.hostmonster.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.82) (envelope-from ) id 1YMnbr-0002r8-Nr for emacs-devel@gnu.org; Sat, 14 Feb 2015 18:02:56 -0700 In-Reply-To: <834mqowbnh.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Feb 2015 21:12:02 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (windows-nt) X-Identified-User: {2442:host114.hostmonster.com:stephele:stephe-leake.org} {sentby:smtp auth 70.94.38.149 authed with stephen_leake@stephe-leake.org} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 69.89.18.3 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:183077 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Stefan Monnier >> Date: Fri, 13 Feb 2015 14:11:33 -0500 >> Cc: Paul Eggert , emacs-devel@gnu.org >> >> > I would start by coming up with the minimum set of requirements a >> > module needs to be able to communicate with Emacs. >> >> Easy: take the existing sample modules and see what they need. > > No one seems to care, so I will bite the bullet. I took a stab at creating emacs_module_api.h; attached. To do this, I replaced "#include " in modules/curl/curl.c with "#include ", and copied stuff from lisp.h and other headers to emacs_module_api.h until it compiled. Note the FIXMEs; I could not figure out what was going on in some places, so I just kludged it for now. I don't know if this is useful, but it is my interpretation of what Stefan proposed; lisp.h would "#include emacs_modules_api.h". (He called it "emacs.h", but I think including 'modules' in the name is better). > The below is based > on looking at the modules branch. > > It looks like modules need: > > . A function to replace the DEFUN macro and the related defsubr call. > > . Some definition of Lisp_Object > > This already presents at least 2 problems. The first is 32- vs > 64-bit issues. We need some way of checking that a 32-bit module > isn't loaded by a 64-bit Emacs, and vice versa. Good point. That's a special case of "don't load a module compiled for processor X in an Emacs compiled for processor Y". gnu binutils has facilities for that. > The other problem is more serious: Emacs can be built with or > without --check-lisp-object-type, and with or without --wide-int; > how will the module know which implementation to use? Similar check when the module is loaded. Which means we need some metainfo for each module, and a standard function to retrieve it. > . Functions to access values of Lisp objects. We shouldn't rely on C > macros like XINT and XWINDOW for that, because macros track too > closely the internals of each object. So I propose to use > functions that will be exposed via the API. If we follow Stefan's suggestion, then either this function approach is not viable, or we need another #ifdef for module vs emacs. > The above means that most of the C source files under modules/ should > be thoroughly rewritten. Yes. > They are currently written as if the code were an integral part of > Emacs on one of the Emacs C files. Going that way means that modules > will have to be recompiled from sources for each Emacs version, and > practically will have to live in the Emacs tree. Maybe this is what we > want, I don't know. This is the model I had in mind. Since I need max speed with mixed Ada/lisp code, I need tight integration with the core. The people who need that speed for Ada mode will simply have to recompile the module for each Emacs release; they are coders, so that's not a problem. On the other hand, modules for other use cases (I have in mind a spam filter for Gnus) would not need to be nearly so tightly bound, so a more limited/safe API would be appropriate. Rather than splitting out emacs_module_api.h from lisp.h, we could add __declspec(dllexport) to a subset of the functions in lisp.h; I suspect that will be a small number. I'll give that a try next. Is there an equivalent on Linux (I don't recall ever seeing one)? -- -- Stephe --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=emacs_modules_api.h Content-Transfer-Encoding: base64 LyogRW1hY3MgbW9kdWxlcyBBUEkgKi8KCi8qIEZJWE1FOiBmb3IgV2luZG93cywgYWRkIF9fZGVj bHNwZWMoZGxsZXhwb3J0KSB0byBhbGwgKHNvbWU/KSBvZiB0aGVzZSAqLwogIC8qICNpZmRlZiBX SU5ET1dTICovCiAgLyogIyBpZmRlZiBlbWFjcyAqLwogIC8qICMgIGRlZmluZSBFTUFDU19FWFBP UlQgIF9fZGVjbHNwZWMoZGxsZXhwb3J0KSAqLwogIC8qICMgZWxzZSAqLwogIC8qICMgIGRlZmlu ZSBFTUFDU19FWFBPUlQgIF9fZGVjbHNwZWMoZGxsaW1wb3J0KSAqLwogIC8qICMgZW5kaWYgKi8K ICAvKiAjIGVsc2UgKi8KICAvKiAjICBkZWZpbmUgRU1BQ1NfRVhQT1JUICovCiAgLyogI2VuZGlm ICovCgovKiBGSVhNRTogPHN0ZGludC5oPiB2cyAuLi9udC9pbmMvc3RkaW50Lmg6MzcgKi8KI2lu Y2x1ZGUgPHN0ZGludC5oPgoKLyogY29uZl9wb3N0Lmg6MzUgKi8KI2luY2x1ZGUgPHN0ZGJvb2wu aD4KCi8qIFRoZSB0eXBlIG9mIGJvb2wg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xFX18sIF9fTElORV9fKSkKIyBkZWZpbmUgZWFzc3VtZShj b25kKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgKHN1cHBy ZXNzX2NoZWNraW5nICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwK ICAgID8gYXNzdW1lIChjb25kKSAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIFwKICAgIDogKGNvbmQpICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIFwKICAgID8gKHZvaWQpIDAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgIDogZGllICgjIGNvbmQsIF9fRklMRV9fLCBf X0xJTkVfXykpCiNlbmRpZiAvKiBFTkFCTEVfQ0hFQ0tJTkcgKi8KCi8qIGxpc3AuaDoyMzkgKi8K ZW51bSBMaXNwX0JpdHMKICB7CiAgICAvKiAyKipHQ1RZUEVCSVRTLiAgVGhpcyBtdXN0IGJlIGEg bWFjcm8gdGhhdCBleHBhbmRzIHRvIGEgbGl0ZXJhbAogICAgICAgaW50ZWdlciBjb25zdGFudCwg Zm9yIE1TVkMuICAqLwojZGVmaW5lIEdDQUxJR05NRU5UIDgKCiAgICAvKiBOdW1iZXIgb2YgYml0 cyBpbiBhIExpc3BfT2JqZWN0IHZhbHVlLCBub3QgY291bnRpbmcgdGhlIHRhZy4gICovCiAgICBW QUxCSVRTID0gQklUU19QRVJfRU1BQ1NfSU5UIC0gR0NUWVBFQklUUywKCiAgICAvKiBOdW1iZXIg b2YgYml0cyBpbiBhIExpc3AgZml4bnVtIHRhZy4gICovCiAgICBJTlRUWVBFQklUUyA9IEdDVFlQ RUJJVFMgLSAxLAoKICAgIC8qIE51bWJlciBvZiBiaXRzIGluIGEgTGlzcCBmaXhudW0gdmFsdWUs IG5vdCBjb3VudGluZyB0aGUgdGFnLiAgKi8KICA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3ltYm9sICpuZXh0Owp9OwoKLyogbGlzcC5oOjcxMCAq LwojZGVmaW5lIEVYRlVOKGZubmFtZSwgbWF4YXJncykgXAogIGV4dGVybiBMaXNwX09iamVjdCBm bm5hbWUgREVGVU5fQVJHU18gIyMgbWF4YXJncwoKLyogTm90ZSB0aGF0IHRoZSB3ZWlyZCB0b2tl bi1zdWJzdGl0dXRpb24gc2VtYW50aWNzIG9mIEFOU0kgQyBtYWtlcwogICB0aGlzIHdvcmsgZm9y IE1BTlkgYW5kIFVORVZBTExFRC4gICovCiNkZWZpbmUgREVGVU5fQVJHU19NQU5ZICAgICAgICAg KHB0cmRpZmZfdCwgTGlzcF9PYmplY3QgKikKI2RlZmluZSBERUZVTl9BUkdTX1VORVZBTExFRCAg ICAoTGlzcF9PYmplY3QpCiNkZWZpbmUgREVGVU5fQVJHU18wICAgICh2b2lkKQojZGVmaW5lIERF RlVOX0FSR1NfMSAgICAoTGlzcF9PYmplY3QpCiNkZWZpbmUgREVGVU5fQVJHU18yICAgIChMaXNw X09iamVjdCwgTGlzcF9PYmplY3QpCiNkZWZpbmUgREVGVU5fQVJHU18zICAgIChMaXNwX09iamVj dCwgTGlzcF9PYmplY3QsIExpc3BfT2JqZWN0KQojZGVmaW5lIERFRlVOX0FSR1NfNCAgICAoTGlz cF9PYmplY3QsIExpc3BfT2JqZWN0LCBMaXNwX09iamVjdCwgTGlzcF9PYmplY3QpCiNkZWZpbmUg REVGVU5fQVJHU181ICAgIChMaXNwX09iamVjdCwgTGlzcF9PYmplY3QsIExpc3BfT2JqZWN0LCBM aXNwX09iamVjdCwgXAogICAgICAgICAgICAgICAgICAgICAgICAgTGlzcF9PYmplY3QpCiNkZWZp bmUgREVGVU5fQVJHU182ICAgIChMaXNwX09iamVjdCwgTGlzcF9PYmplY3QsIExpc3BfT2JqZWN0 LCBMaXNwX09iamVjdCwgXAogICAgICAgICAgICAgICAgICAgICAgICAgTGlzcF9PYmplY3QsIExp c3BfT2JqZWN0KQojZGVmaW5lIERFRlVOX0FSR1NfNyAgICAoTGlzcF9PYmplY3QsIExpc3BfT2Jq ZWN0LCBMaXNwX09iamVjdCwgTGlzcF9PYmplY3QsIFwKICAgICAgICAgICAgICAgICAgICAgICAg IExpc3BfT2JqZWN0LCBMaXNwX09iamVjdCwgTGlzcF9PYmplY3QpCiNkZWZpbmUgREVGVU5fQVJH U184ICAgIChMaXNwX09iamVjdCwgTGlzcF9PYmplY3QsIExpc3BfT2JqZWN0LCBMaXNwX09iamVj dCwgXAogICAgICAgICAgICAgICAgICAgICAgICAgTGlzcF9PYmplY3QsIExpc3BfT2JqZWN0LCBM aXNwX09iamVjdCwgTGlzcF9PYmplY3QpCgovKiBZaWVsZCBhbiBpbnRlZ2VyIHRoYXQgY29udGFp bnMgVEFHIGFsb25nIHdpdGggUFRSLiAgKi8KI2RlZmluZSBUQUdfUFRSKHRhZywgcHRyKSBcCiAg KChVU0VfTFNCX1RBRyA/ICh0YWcpIDogKEVNQUNTX1VJTlQpICh0YWcpIDw8IFZBTEJJVFMpICsg KHVpbnRwdHJfdCkgKHB0cikpCgovKiBZaWVsZCBhbiBpbnRlZ2VyIHRoYXQgY29udGFpbnMgYSBz eW1ib2wgdGFnIGFsb25nIHdpdGggT0ZGU0VULgogICBPRkZTRVQgc2hvdWxkIGJlIHRoZSBvZmZz ZXQgaW4gYnl0ZXMgZnJvbSAnbGlzcHN5bScgdG8gdGhlIHN5bWJvbC4gICovCi8qIGxpc3AuaDo3 MzcgKi8KI2RlZmluZSBUQUdfU1lNT0ZGU0VUKG9mZnNldCkgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgXAogIFRBR19QVFIgKExpc3BfU3ltYm9sLCAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBcCiAgICAgICAgICAgKCh1aW50cHRyX3QpIChvZmZzZXQpID4+IChVU0Vf TFNCX1RBRyA/IDAgOiBHQ1RZUEVCSVRTKSkpCgoKLyogbGlzcC5oOjc1NCAqLwovKiBGSV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tZSwgbWluYXJncywgbWF4YXJncywgaW50c3BlYywgZG9jKSAgICAgXAog ICBMaXNwX09iamVjdCBmbm5hbWUgREVGVU5fQVJHU18gIyMgbWF4YXJncyA7ICAgICAgICAgICAg ICAgICAgICAgICAgICBcCiAgIHN0YXRpYyBzdHJ1Y3QgTGlzcF9TdWJyIGFsaWduYXMgKEdDQUxJ R05NRU5UKSBzbmFtZSA9ICAgICAgICAgICAgICAgIFwKICAgeyB7IChQVkVDX1NVQlIgPDwgUFNF VURPVkVDVE9SX0FSRUFfQklUUykgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAg fCAoc2l6ZW9mIChzdHJ1Y3QgTGlzcF9TdWJyKSAvIHNpemVvZiAoRU1BQ1NfSU5UKSkgfSwgICAg ICAgICAgICBcCiAgICAgIHsgKExpc3BfT2JqZWN0IChfX2NkZWNsICopKHZvaWQpKWZubmFtZSB9 LCAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAgIG1pbmFyZ3MsIG1heGFyZ3MsIGxuYW1l LCBpbnRzcGVjLCAwfTsgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICBMaXNwX09iamVj dCBmbm5hbWUKI2Vsc2UgIC8qIG5vdCBfTVNDX1ZFUiAqLwojZGVmaW5lIERFRlVOKGxuYW1lLCBm bm5hbWUsIHNuYW1lLCBtaW5hcmdzLCBtYXhhcmdzLCBpbnRzcGVjLCBkb2MpICAgICBcCiAgIHN0 YXRpYyBzdHJ1Y3QgTGlzcF9TdWJyIGFsaWduYXMgKEdDQUxJR05NRU5UKSBzbmFtZSA9ICAgICAg ICAgICAgICAgIFwKICAgICB7IHsgUFZFQ19TVUJSIDw8IFBTRVVET1ZFQ1RPUl9BUkVBX0JJVFMg fSwgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgeyAuYSAjIyBtYXhhcmdzID0gZm5u YW1lIH0sICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICBtaW5h cmd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