From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: Re: Emacs Lisp JIT Compiler Date: Wed, 22 Aug 2018 18:47:23 -0600 Message-ID: <87in413o4k.fsf@tromey.com> References: <87va8ej4o1.fsf@tromey.com> <87mutpiyz6.fsf@tromey.com> <701cd05f423e0c46595a3010f45414d0.squirrel@dancol.org> <520f536b5a603831c9a57a5f6f0978a2.squirrel@dancol.org> <83va8binu8.fsf@gnu.org> <87bma3i26m.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1534985194 19012 195.159.176.226 (23 Aug 2018 00:46:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Aug 2018 00:46:34 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) Cc: Eli Zaretskii , Paul Eggert , dancol@dancol.org, emacs-devel@gnu.org To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 23 02:46:30 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fsdld-0004pw-Nn for ged-emacs-devel@m.gmane.org; Thu, 23 Aug 2018 02:46:30 +0200 Original-Received: from localhost ([::1]:33367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsdnj-0001T5-OP for ged-emacs-devel@m.gmane.org; Wed, 22 Aug 2018 20:48:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsdn2-0001So-L8 for emacs-devel@gnu.org; Wed, 22 Aug 2018 20:47:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsdmz-0000mx-Cm for emacs-devel@gnu.org; Wed, 22 Aug 2018 20:47:56 -0400 Original-Received: from gateway30.websitewelcome.com ([192.185.168.15]:28404) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsdmz-0000lg-05 for emacs-devel@gnu.org; Wed, 22 Aug 2018 20:47:53 -0400 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway30.websitewelcome.com (Postfix) with ESMTP id F239D4321 for ; Wed, 22 Aug 2018 19:47:51 -0500 (CDT) Original-Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id sdmYfUsyFPvAdsdmmfTQ6D; Wed, 22 Aug 2018 19:47:51 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BKK5YaNMESHGRV9rc+s9CnuCRy7+iVAJfh8YjIY+0J8=; b=L6x7p01y9kuB7p/2Q+JulVwiuK wkhhXJZ83g3OrG8PkPSGqB55n8OXxv7uYm10qlIpC2mkLVea88D65tQOeV9b4H2Fbbtd9PHogUHeN 4/ZXqhI/DoEeXmEVkNDKI6lSf; Original-Received: from 75-166-85-72.hlrn.qwest.net ([75.166.85.72]:41470 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1fsdmX-0030dl-Sl; Wed, 22 Aug 2018 19:47:26 -0500 X-Attribution: Tom In-Reply-To: <87bma3i26m.fsf@tromey.com> (Tom Tromey's message of "Wed, 15 Aug 2018 18:29:37 -0600") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.85.72 X-Source-L: No X-Exim-ID: 1fsdmX-0030dl-Sl X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-85-72.hlrn.qwest.net (bapiya) [75.166.85.72]:41470 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 192.185.168.15 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:228838 Archived-At: >>>>> "Tom" == Tom Tromey writes: Tom> Now, one thing that is portable is compiling Emacs Lisp code to C. For Tom> example, it would be easy to compile all the bytecode that is dumped Tom> into Emacs. The drawback is that this is just a fraction of what users Tom> use; and would probably not show major benefits. But, maybe it would Tom> help some. And, it would certainly allow some existing C code (looking Tom> at you, widget-put) to be moved to Lisp, which seems worthwhile to me. I wrote a bytecode->C compiler to see what this would look like. It is set up to walk the obarray and compile every lexically-bound bytecode function that it finds there. The resulting .o files are roughly the same size as the rest of the Emacs .o files. So, maybe that's a bit too big. One idea would be to segregate the code that is to be compiled. This would allow rewriting some of the C code into Lisp at least. Another issue is that runtime linking -- that is, associating the compiled code with the bytecode -- is hard. My current approach (which isn't fully hooked up yet) is to use the doc string index as a key. However, this is not fantastic because it means that undocumented functions can't be compiled. Runtime linking is needed because of two issues; otherwise the compiler could just emit DEFUNs. One, I didn't want to deal with compiling complex lisp constants to C. Doing this properly would mean introducing initialization code. Two, I think the DEFUN approach wouldn't work for closures. Perhaps if the segregation approach were taken, there could just be some rules against closures and complex constants, and the compiler could error if they were introduced. Tom