From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r107377: * src/lisp.h: Improve comment about USE_LSB_TAG. Date: Thu, 23 Feb 2012 02:42:39 -0500 Message-ID: References: <4F459455.8070206@verizon.net> <4F45DD5B.3010801@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1329982971 24407 80.91.229.3 (23 Feb 2012 07:42:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Feb 2012 07:42:51 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 23 08:42:50 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S0TK9-000286-Ic for ged-emacs-devel@m.gmane.org; Thu, 23 Feb 2012 08:42:45 +0100 Original-Received: from localhost ([::1]:34421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0TK9-0006lk-4E for ged-emacs-devel@m.gmane.org; Thu, 23 Feb 2012 02:42:45 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:50065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0TK6-0006lf-NZ for emacs-devel@gnu.org; Thu, 23 Feb 2012 02:42:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0TK5-0004fy-Ek for emacs-devel@gnu.org; Thu, 23 Feb 2012 02:42:42 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:10686) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0TK5-0004fl-B6 for emacs-devel@gnu.org; Thu, 23 Feb 2012 02:42:41 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EADjtRU9Ld/XJ/2dsb2JhbABEDrJMgQiBcwEBBAFWIwULCzQSFBgNJIgUuDeNBAECEhFBFwYIAoUXCoQbBIhPliOEdoQGVQ X-IronPort-AV: E=Sophos;i="4.73,469,1325480400"; d="scan'208";a="164263359" Original-Received: from 75-119-245-201.dsl.teksavvy.com (HELO pastel.home) ([75.119.245.201]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 23 Feb 2012 02:42:40 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id C3FA15205F; Thu, 23 Feb 2012 02:42:39 -0500 (EST) In-Reply-To: <4F45DD5B.3010801@cs.ucla.edu> (Paul Eggert's message of "Wed, 22 Feb 2012 22:31:55 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.183 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:148721 Archived-At: >>> > That patch would be more intrusive. >> Arguably, yes, but it would have the advantage to attack more precisely >> the actual core of the problem, so it "reifies" in the code our >> deeper understanding of the problem. > I don't know what you mean by "actual core". As I > understand it the change you're proposing would require an > O(N**2) pass through a stack with N 32-bit words (assuming > 32-bit registers and 64-bit EMACS_INT). No, that would be a "real fix". What I suggest is just to take the O(N) pointer-sized entities on the stack, cast them to EMACS_INT, and pass them to mark_maybe_object. >> As for that change, the reasoning for why it's correct doesn't seem >> obvious to me (I understand why it's correct in the current >> WIDE_EMACS_INT case, but generalizing from that to the case >> "UINTPTR_MAX >> VALBITS != 0" seems risky). > I don't understand what you mean by "generalizing"; can you give > an example of the more-general situation you're worried about? No, the problem is theoretical: what is the logical justification? > Are you worried that pointers might be aligned more-strictly > than EMACS_INT values? Not really. I'm just trying to construct a proof in my head that your optimization is correct, and I can't seem to connect your hypothesis "UINTPTR_MAX >> VALBITS != 0" with the conclusion. Your additional alignment hypothesis might be the key, but I'm still struggling to see how the proof would work. > + /* The mark_maybe_pointer loop will suffice, since it will recognize > + the bottom bits of any Lisp_Object containing a pointer, if we > + can assume that Lisp_Object values are aligned at least as > + strictly as pointers. Although this assumption is true on all > + practical Emacs porting targets, check it anyway, to be safer. */ > + { verify (GC_LISP_OBJECT_ALIGNMENT % GC_POINTER_ALIGNMENT == 0); } I really don't think such complexity is warranted for such a minor optimization of a compilation option which is currently not enabled by default. If/when we enable it by default, we may revisit this choice, but for now, I'd rather not go there. Stefan