From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Preview: portable dumper Date: Mon, 28 Nov 2016 13:14:38 -0800 Organization: UCLA Computer Science Department Message-ID: References: <047a67ec-9e29-7e4e-0fb0-24c3e59b5886@dancol.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1480367743 2378 195.159.176.226 (28 Nov 2016 21:15:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 28 Nov 2016 21:15:43 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 To: Daniel Colascione , Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 28 22:15:40 2016 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 1cBTH1-0008Ix-7w for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2016 22:15:39 +0100 Original-Received: from localhost ([::1]:33061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBTH5-0006v1-1x for ged-emacs-devel@m.gmane.org; Mon, 28 Nov 2016 16:15:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBTGC-0006tX-4S for emacs-devel@gnu.org; Mon, 28 Nov 2016 16:14:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBTG7-0008O7-7m for emacs-devel@gnu.org; Mon, 28 Nov 2016 16:14:48 -0500 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50710) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cBTG7-0008NW-1k for emacs-devel@gnu.org; Mon, 28 Nov 2016 16:14:43 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B47EF1600C4; Mon, 28 Nov 2016 13:14:39 -0800 (PST) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id tQmviq1DvkFE; Mon, 28 Nov 2016 13:14:39 -0800 (PST) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EE9EE1600C6; Mon, 28 Nov 2016 13:14:38 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id ptfbEmG3n2x8; Mon, 28 Nov 2016 13:14:38 -0800 (PST) Original-Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id D5AEC1600C4; Mon, 28 Nov 2016 13:14:38 -0800 (PST) In-Reply-To: <047a67ec-9e29-7e4e-0fb0-24c3e59b5886@dancol.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 131.179.128.68 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:209701 Archived-At: Thanks for working on this. Although it's not the approach I would have taken, there is a real advantage to having running code. A few points: * The portable dumper doesn't work with modules. Although this should be OK for Emacs builds since they don't use modules either, what is your thought about this? Will the module API need to change to support dumping? * I am working on getting Emacs to work with gcc -fcheck-pointer-bounds, and will boost the priority of that task and CC: you when I have something ready. The portable dumper should work in such an environment. I don't see any fundamental problems with this; just giving you a heads-up. * Functions like do_dump_relocation should use intptr_t or uintptr_t, not ptrdiff_t, to access pointers as integers (whether relocated or not). In theory this would support architectures where intptr_t and ptrdiff_t have different widths. Although Emacs doesn't run on such architectures now, conceivably it could and in the meantime the code might as well be clear about the distinction between pointers and offsets. * pdumper_load should check that S_ISREG (stat.st_mode) (I suppose this won't be needed if we load from the emacs executable....). * I suggest using the type bits_word (defined in lisp.h) rather than unsigned. This should work better on 64-bit machines (plus, on weird platforms). * For pdumper_read a more-portable limit is MAX_RW_COUNT (see sysdep.c) instead of SSIZE_MAX. Maybe that value needs to move into a .h file. * A nit: pdumper_marked_p relies on implicit conversion to bool, a style I find confusing for bool values. In a bool function it's clearer to write 'return E != 0;' instead of 'return E;' when E might have values other than 0 or 1. * I haven't thought through all the implications of this and may have more comments later.