From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Ken Raeburn Newsgroups: gmane.emacs.devel Subject: Re: Skipping unexec via a big .elc file Date: Mon, 13 Mar 2017 04:25:19 -0400 Message-ID: References: <9463F91F-DB82-48E1-BE01-1E2BC8DA0766@raeburn.org> <831swxzbw8.fsf@gnu.org> <83y3z2wphb.fsf@gnu.org> <83tw9bb42m.fsf@gnu.org> <349ED8B9-C34B-495B-9FB5-E72CE6EFCA38@raeburn.org> <87inpni6xa.fsf@linux-m68k.org> <8360lmesso.fsf@gnu.org> <3B044D64-7C94-42D7-BE1B-7A9CA76C5A67@raeburn.org> <83k29xc49v.fsf@gnu.org> <2C5C5C6E-9D73-4613-948B-C15B93968717@raeburn.org> <83poiy8cnv.fsf@gnu.org> <83r32mqq5f.fsf@gnu.org> <83zih1jf37.fsf@gnu.org> <8A8DA980-13A7-4F8B-9D07-391728C673C9@raeburn.org> <831su4dmn4.fsf@gnu.org> <87h9300x5n.fsf@linux-m68k.org> <734D2132-71FD-414D-B091-629189742DB4@raeburn.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_7441D027-3278-4160-A63C-A1467F39298C" X-Trace: blaine.gmane.org 1489393536 28746 195.159.176.226 (13 Mar 2017 08:25:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Mar 2017 08:25:36 +0000 (UTC) Cc: Emacs developers To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 13 09:25:33 2017 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 1cnLIJ-0006nD-9P for ged-emacs-devel@m.gmane.org; Mon, 13 Mar 2017 09:25:31 +0100 Original-Received: from localhost ([::1]:50826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnLIN-0006uJ-Su for ged-emacs-devel@m.gmane.org; Mon, 13 Mar 2017 04:25:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnLIH-0006uE-TM for emacs-devel@gnu.org; Mon, 13 Mar 2017 04:25:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnLID-0005an-T9 for emacs-devel@gnu.org; Mon, 13 Mar 2017 04:25:29 -0400 Original-Received: from mail-qk0-x22f.google.com ([2607:f8b0:400d:c09::22f]:34248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnLID-0005aS-OA for emacs-devel@gnu.org; Mon, 13 Mar 2017 04:25:25 -0400 Original-Received: by mail-qk0-x22f.google.com with SMTP id p64so216996034qke.1 for ; Mon, 13 Mar 2017 01:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raeburn-org.20150623.gappssmtp.com; s=20150623; h=subject:mime-version:from:in-reply-to:date:cc:message-id:references :to; bh=y88xvGef9mQJsu3ZKODu5iTwiy0/sX1mMwv0WrgvWF4=; b=Y9AdOYYlaC5sw+wFIch/tdw42jIhjyY6QUmlSGENmSGmKLlnO3hbOtGDpI7yVVvr8Y IVcQGSK3S1VHuv8b6OIIkxa0cvBIudUZxXP7ejdaW/32slgtGK/CXF3z1N/A00WvRZeZ /YdJTNOyQejjeuslU9ldmDdlStTkS0+kp9HLiSpe0tFVDTtExk7X/NsgEKWs+1QKtEHa FUAuSen44OUvBsi8CtIRCiXg9PpZLAsb57P+KFP6osRp4+WYWzneau5z27jI5ABWtNKh +ywsJurMk2zEuCid8ZgIBVeVPglJSH0vOI5fb8dbGMni5hwliyr0hSnrpHqljT926PIw OLzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:mime-version:from:in-reply-to:date:cc :message-id:references:to; bh=y88xvGef9mQJsu3ZKODu5iTwiy0/sX1mMwv0WrgvWF4=; b=ctlXJ7bbDRggGKof/p/kkWAsahah2Cx0og9eqHJHA5t5mGq4VIb6XEkczvtDXjo+FO nK3SZ8eui0LyhR5mlXQLb5iSzpgyk2natGGTJHdTVxhOOGd+80lK63A5JF3lwQGcG5gA qoDw3Vgiga4T8RfXhbruzM5VfIf6+oxfy4QJB8Ks2Ck63U6GyJ8NovNguYPxs53kOq6H 8wTNK3AdLLH2KLDs5EwOiY9pd4QgL8Acm09jM7QeBTOhdd+0Sllz9VdpEld4QegqEYsp nNA9KVmOb/5Vg8/995LLTWec5qbcCEgHlEOBOodYVpyXwHwHlJK4USVvgxi983IkzhA/ VUeQ== X-Gm-Message-State: AFeK/H1dykWHDa1/T4foFhdyqasWGmZPV7h10m3pjNWN8trlFJDjQAstPKj6apnHTTvLKA== X-Received: by 10.55.220.131 with SMTP id v125mr33722758qki.93.1489393523206; Mon, 13 Mar 2017 01:25:23 -0700 (PDT) Original-Received: from [192.168.23.52] (c-50-138-183-136.hsd1.ma.comcast.net. [50.138.183.136]) by smtp.gmail.com with ESMTPSA id 30sm11742077qtr.38.2017.03.13.01.25.21 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Mar 2017 01:25:22 -0700 (PDT) In-Reply-To: <734D2132-71FD-414D-B091-629189742DB4@raeburn.org> X-Mailer: Apple Mail (2.3124) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::22f 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:212980 Archived-At: --Apple-Mail=_7441D027-3278-4160-A63C-A1467F39298C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I have a patch which seems to recreate all the abbrev tables that were = in the initial Emacs process, including the sharing = (lisp-mode-abbrev-table being a parent of emacs-lisp-mode-abbrev-table; = local-abbrev-table set to the fundamental mode table). Please let me = know if it fixes your problem. It depends on a couple key things: (1) The abbrev tables are empty at = that point, so we don=E2=80=99t have to worry about reconstructing all = the abbrevs in a table; this can be fixed, it=E2=80=99s just tedious. = (2) Abbrev-table values are only used as symbol values, or parents of = other abbrev tables. This is much harder. Stefan=E2=80=99s printable = replacement for obarrays would probably be a better solution. Though, = normally I=E2=80=99d expect people to want printing of an obarray to = show symbol names, and for this use case we need the function, value, = and plist data as well. Ken --Apple-Mail=_7441D027-3278-4160-A63C-A1467F39298C Content-Disposition: attachment; filename=abbrev-table-patch Content-Type: application/octet-stream; name="abbrev-table-patch" Content-Transfer-Encoding: 7bit commit dd4d7941a3915d16a0f78ab547e3656ec95f4f29 Author: Ken Raeburn Date: Mon Mar 13 03:21:53 2017 -0400 Dump and restore empty abbrev tables. Abbrev tables are obarrays and thus don't print out in a useful form. They need to be assembled at load time. Fortunately, loadup.el only gives us empty abbrev tables, so we don't have to actually restore any abbrevs, only the tables. * lisp/loadup.el: When variable values are abbrev tables, emit a "make-abbrev-table" initialization with the appropriate property lists. Check abbrev tables and their parents for instances of sharing. Reject any abbrev tables that are not empty. diff --git a/lisp/loadup.el b/lisp/loadup.el index cc9ed7be1a..48a1208ed7 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -484,6 +484,10 @@ (coding-systems '()) (coding-system-aliases '()) (charsets '()) (charset-aliases '()) (unified-charsets '()) + (abbrev-tables (make-hash-table :test 'eq)) + (abbrev-assign-cmds '()) + (abbrev-make-cmds '()) + (abbrev-counter 0) (cmds '())) (setcdr global-buffers-menu-map nil) ;; Get rid of buffer objects! (push `(internal--set-standard-syntax-table @@ -539,6 +543,42 @@ '(let ((ol (make-overlay (point-min) (point-min)))) (delete-overlay ol) ol)) + ;; abbrev-table-p isn't very defensive + ((condition-case nil + (abbrev-table-p v) + (error nil)) + (cl-labels ((replace-abbrevs-for-dump + (table) + (or (abbrev-table-empty-p table) + (error "Non-empty abbrev tables not handled")) + (let ((newval (gethash table abbrev-tables))) + (if newval + `(aref scratch-abbrev-tables ,newval) + (let* ((props (symbol-plist (obarray-get table "")))) + (cond ((plist-get props :parents) + (setq props (copy-sequence props)) + (plist-put props + :parents + (mapcar (lambda (value) + (replace-abbrevs-for-dump value)) + (plist-get props :parents)))) + ((eq (length props) 2) + ;; Only :abbrev-table-modiff, which gets added at creation anyway. + (setq props nil))) + (push `(aset scratch-abbrev-tables + ,abbrev-counter + (make-abbrev-table ',props)) + abbrev-make-cmds) + (puthash table abbrev-counter abbrev-tables) + (prog1 + `(aref scratch-abbrev-tables ,abbrev-counter) + (setq abbrev-counter (1+ abbrev-counter)))))))) + (push `(set-default ',s + ,(replace-abbrevs-for-dump v)) + abbrev-assign-cmds)) + ;; Placeholder to be used before we know + ;; we've defined make-abbrev-table. + 0) (v (macroexp-quote v)))) cmds) ;; Local variables: make-variable-buffer-local, @@ -591,6 +631,10 @@ (print '(get-buffer-create "*Messages*")) (print `(progn . ,cmds)) (terpri) + ;; Now that make-abbrev-table is defined, use it. + (print `(let ((scratch-abbrev-tables (make-vector ,abbrev-counter 0))) + ,@(nreverse abbrev-make-cmds) + ,@abbrev-assign-cmds)) (print `(let ((css ',charsets)) (dotimes (i 3) (dolist (cs (prog1 css (setq css nil))) --Apple-Mail=_7441D027-3278-4160-A63C-A1467F39298C--