From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Windows 64 port Date: Mon, 20 Feb 2012 12:43:34 -0800 Organization: UCLA Computer Science Department Message-ID: <4F42B076.4030702@cs.ucla.edu> References: <20120219211800.0000558f@unknown> <834numv7js.fsf@gnu.org> <4F428780.8070902@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1329770607 2802 80.91.229.3 (20 Feb 2012 20:43:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 20 Feb 2012 20:43:27 +0000 (UTC) Cc: Eli Zaretskii , AJMR , emacs-devel@gnu.org To: Fabrice Popineau Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 20 21:43:25 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 1Rza4w-0007Lt-Ak for ged-emacs-devel@m.gmane.org; Mon, 20 Feb 2012 21:43:22 +0100 Original-Received: from localhost ([::1]:44997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rza4v-00037x-Sc for ged-emacs-devel@m.gmane.org; Mon, 20 Feb 2012 15:43:21 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:40961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rza4t-00037s-8Z for emacs-devel@gnu.org; Mon, 20 Feb 2012 15:43:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rza4s-0007C2-7q for emacs-devel@gnu.org; Mon, 20 Feb 2012 15:43:19 -0500 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:56727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rza4q-0007BH-JW; Mon, 20 Feb 2012 15:43:16 -0500 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id ECD6339E800A; Mon, 20 Feb 2012 12:43:13 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hUofj1xXlvaT; Mon, 20 Feb 2012 12:43:13 -0800 (PST) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 6147239E8006; Mon, 20 Feb 2012 12:43:13 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 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:148683 Archived-At: On 02/20/2012 11:20 AM, Fabrice Popineau wrote: > Windows and Linux does not follow the same 64 bits rules (LLP64 vs LP64). Yes, and that was why I suggested the heuristic that I suggested. The Emacs code is currently quite portable to standard GNU hosts, which are LP64 or ILP32 or ILP32LL64. If code portable to these hosts uses 'int', there should be no need to change the 'int' to 'intptr_t', because such a change would already be needed for the LP64 port. Most of your patch's changes to the mainline sources were of this nature, and should therefore be omitted. The only changes actually needed for porting to an IL32LLP64 host should be the relatively small number of changes that I mentioned in my previous message. > - int i = 0, aligned = (intptr_t) ABLOCKS_BUSY (abase); > + int i = 0; > + intptr_t aligned = (intptr_t) ABLOCKS_BUSY (abase); > > Here, the value of 'aligned' is either 0 or 1, so there's > no need to change its type. > > It is kind of strange to cast to intptr_t to store the result > in a variable of different type ? The cast to intptr_t (instead of to int) is to avoid GCC warnings about casting a pointer to an integer of a different size. Using intptr_t is helpful, because these warnings are typically useful and in the rare cases where they're not (such as here) it's helpful to insert a cast so that GCC does not cry wolf. In contrast, there is no need to declare 'aligned' to be wider than 'int'. Generally the Emacs source code uses 'int' for random integers that are guaranteed to fit in int range, which is the case here, so we should leave the 'int' alone. This is just one example, but I hope you get the general idea: please minimize the changes made to the mainline source code. Ideally any changes for Windows 64 would be only to the Windows-specific part of the code, so that we don't need to worry about its effect on GNU hosts. In practice we can't always achieve this ideal, but nevertheless it's important to minimize the changes to mainline code, as this saves everybody's time.