From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Antipov Newsgroups: gmane.emacs.devel Subject: Re: Dumper problems and a possible solutions Date: Wed, 25 Jun 2014 22:03:36 +0400 Message-ID: <53AB0EF8.4090608@yandex.ru> References: <20140624171955.GS179@brightrain.aerifal.cx> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1403719456 3534 80.91.229.3 (25 Jun 2014 18:04:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Jun 2014 18:04:16 +0000 (UTC) Cc: emacs-devel@gnu.org To: Rich Felker Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 25 20:04:10 2014 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 1WzrY7-0004GE-Ny for ged-emacs-devel@m.gmane.org; Wed, 25 Jun 2014 20:03:59 +0200 Original-Received: from localhost ([::1]:40233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzrY7-0003X7-9B for ged-emacs-devel@m.gmane.org; Wed, 25 Jun 2014 14:03:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzrXx-0003Wq-0p for emacs-devel@gnu.org; Wed, 25 Jun 2014 14:03:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzrXp-0006ZB-Cq for emacs-devel@gnu.org; Wed, 25 Jun 2014 14:03:48 -0400 Original-Received: from forward10l.mail.yandex.net ([84.201.143.143]:50477) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzrXp-0006Z2-4y for emacs-devel@gnu.org; Wed, 25 Jun 2014 14:03:41 -0400 Original-Received: from smtp12.mail.yandex.net (smtp12.mail.yandex.net [95.108.131.191]) by forward10l.mail.yandex.net (Yandex) with ESMTP id EEE49BA10BD; Wed, 25 Jun 2014 22:03:37 +0400 (MSK) Original-Received: from smtp12.mail.yandex.net (localhost [127.0.0.1]) by smtp12.mail.yandex.net (Yandex) with ESMTP id 9A65116A0198; Wed, 25 Jun 2014 22:03:37 +0400 (MSK) Original-Received: from unknown (unknown [37.139.80.10]) by smtp12.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Jb9NqQQrzr-3bg4UeBt; Wed, 25 Jun 2014 22:03:37 +0400 (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client certificate not present) X-Yandex-Uniq: 83642b92-c101-44cb-af4e-3c1bebcc8442 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1403719417; bh=mWK2Sp88Nz2qXzM8f75/tMd3OP9libL1cCobZnGPVBc=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Pas+1TxEiu6oRfaghA9oyVVHo1HY2Oojc78T3ESAodR8Yi+RO1qV56Ok6hYH9iI4y b1+LugIjf7s4Yt0+mPutzxv7pW6dP1LmivEcHN8QANXN7QWI7DQMTumPLpCxNeg8uL 4/sZX6aybuWiImxzsPpl0uP9WD/FkL5e69FtmY+8= Authentication-Results: smtp12.mail.yandex.net; dkim=pass header.i=@yandex.ru User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <20140624171955.GS179@brightrain.aerifal.cx> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 84.201.143.143 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:172711 Archived-At: On 06/24/2014 09:19 PM, Rich Felker wrote: > To solve ALL of the problems with the dumper (which seems to be a > recurring theme), I have a proposed design to make it fully portable > -- even moreso than xemacs "portable dumper" which is still an ugly > hack. The idea is simple: after loading all of the lisp objects that > need dumping, walk the lisp heap and output a representation for each > object as a giant static array in C source format, then compile and > link this new translation unit with the rest of the emacs .o files to > produce a final emacs binary. What about non-Lisp objects? It's not too hard to walk through live (reachable) Lisp objects - this is exactly what GC mark phase does. It's not too hard to walk through all allocated Lisp objects - this is exactly what GC sweep phase does. But what about lower-level stuff allocated with malloc at invisible from Lisp? Of course, you can do your own serialization for these objects as well - but only if you know about their internal structure. What about stuff allocated by some external library? In general, you can't parse heap (i.e. looking at object, you can't say where the next object is, what is the type of next object, etc.). IIUC, "totally portable" heap dumper is impossible without having a description of each possible heap object and ability to distinguish between different types of objects. Dmitry