From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Emacs Lisp JIT Compiler Date: Mon, 13 Aug 2018 18:15:36 +0300 Message-ID: <83lg9ajo13.fsf@gnu.org> References: <87va8ej4o1.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1534173259 7885 195.159.176.226 (13 Aug 2018 15:14:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Aug 2018 15:14:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 13 17:14:15 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 1fpEXu-0001xl-R9 for ged-emacs-devel@m.gmane.org; Mon, 13 Aug 2018 17:14:14 +0200 Original-Received: from localhost ([::1]:39990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpEa1-0007k0-86 for ged-emacs-devel@m.gmane.org; Mon, 13 Aug 2018 11:16:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpEZB-0007jh-L5 for emacs-devel@gnu.org; Mon, 13 Aug 2018 11:15:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpEZ7-0006x3-Lf for emacs-devel@gnu.org; Mon, 13 Aug 2018 11:15:33 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpEZ7-0006wz-HP; Mon, 13 Aug 2018 11:15:29 -0400 Original-Received: from [176.228.60.248] (port=4070 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fpEZ6-0007c8-Um; Mon, 13 Aug 2018 11:15:29 -0400 In-reply-to: <87va8ej4o1.fsf@tromey.com> (message from Tom Tromey on Sun, 12 Aug 2018 22:01:34 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:228485 Archived-At: > From: Tom Tromey > Date: Sun, 12 Aug 2018 22:01:34 -0600 > > Hi. I've written a JIT compiler for Emacs Lisp, and I'd like to check > it in. Thanks. > I have only tested this on x86-64. Whether or not the JIT works on a > given platform is primarily up to libjit. (I suspect the JIT won't work > on x86 with --with-wide-int; but that is something I could fix.) > > I currently have the JIT set up to always compile all eligible functions > (that is, just byte-compiled, lexically-bound functions). It's robust > enough that, as far as I can tell, everything works fine in this mode. > It would be possible to have it be a bit lazier, say only compile after > 100 invocations, or something like that. > > Aside from the possible --with-wide-int thing, there are two bugs I know > of. > > First, libjit never frees functions. So, if a function is JIT-compiled > and then redefined, the old JIT code will linger. It's possible to fix > this with a custom allocator and a libjit patch (that I sent but that > hasn't been checked in yet). > > Second, I haven't gotten around to emulating the "quitcounter" behavior > in the bytecode interpreter. This seems straightforward. I think, given the importance of byte compilation, this feature should become more mature than it evidently is now, before we install it on master. The issues you mention are pretty basic, IMO. So perhaps a feature branch where people could try JIT, and these issues can be worked on would be the best course of action. We could then merge later when the issues are resolved. Like Paul, I'm somewhat bothered by the relatively slow development of libjit (its current version is just 0.1.2) and its small development team. Thanks.