From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#11935: XINT etc. should be functions Date: Tue, 24 Jul 2012 21:07:28 -0700 Organization: UCLA Computer Science Department Message-ID: <500F7100.9080407@cs.ucla.edu> References: <500039B7.8050106@cs.ucla.edu> <5002C895.4080400@cs.ucla.edu> <500499C7.20902@cs.ucla.edu> <83txx79jgx.fsf@gnu.org> <500E0657.4050604@cs.ucla.edu> <500EA6F7.6080609@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 1343189304 5537 80.91.229.3 (25 Jul 2012 04:08:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 25 Jul 2012 04:08:24 +0000 (UTC) Cc: 11935@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 25 06:08:24 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1Ststb-00089Y-Mu for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jul 2012 06:08:23 +0200 Original-Received: from localhost ([::1]:35549 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ststa-0000mN-T5 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jul 2012 00:08:22 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StstY-0000mI-V2 for bug-gnu-emacs@gnu.org; Wed, 25 Jul 2012 00:08:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StstX-00075f-Qt for bug-gnu-emacs@gnu.org; Wed, 25 Jul 2012 00:08:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56565) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StstX-00075b-Nk for bug-gnu-emacs@gnu.org; Wed, 25 Jul 2012 00:08:19 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Stt02-0006kN-HU for bug-gnu-emacs@gnu.org; Wed, 25 Jul 2012 00:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jul 2012 04:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11935 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 11935-submit@debbugs.gnu.org id=B11935.134318964625859 (code B ref 11935); Wed, 25 Jul 2012 04:15:02 +0000 Original-Received: (at 11935) by debbugs.gnu.org; 25 Jul 2012 04:14:06 +0000 Original-Received: from localhost ([127.0.0.1]:37876 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Stsz7-0006j0-SI for submit@debbugs.gnu.org; Wed, 25 Jul 2012 00:14:06 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:50927) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Stsz5-0006it-Po for 11935@debbugs.gnu.org; Wed, 25 Jul 2012 00:14:05 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 1197F39E8014; Tue, 24 Jul 2012 21:07:20 -0700 (PDT) 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 MyEgp-j+d+MS; Tue, 24 Jul 2012 21:07:19 -0700 (PDT) Original-Received: from [192.168.1.4] (pool-108-23-119-2.lsanca.fios.verizon.net [108.23.119.2]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 87A4639E8013; Tue, 24 Jul 2012 21:07:19 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120714 Thunderbird/14.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62358 Archived-At: On 07/24/2012 02:57 PM, Stefan Monnier wrote: > It seems to define XLI first as > a macro then as a function. Is that right? Yes. The macro is purely for performance with -O0. The function is for all other purposes, including having XLI work in expressions given to GDB. > why is it any better than using only the macro form? Mostly for debuggability, though there's also a small performance win when compiling with default (-O2) optimization. Having the functions makes GDB more useful when printing expressions. Here's a trivial example: (gdb) p SYMBOLP (Qnil) $3 = 1 With the patch, this works if one compiles with -g -O0, regardless of whether -DINLINING=0 is also specified. This is because SYMBOLP is defined as a function, regardless of whether it is also defined as a macro. Also, having the functions makes backtraces work better, even when compiling with default optimization. For example, here's the start of a GDB backtrace of a patched Emacs compiled with default optimization: (gdb) where #0 XTYPE (a=0) at lisp.h:461 #1 VECTORLIKEP (x=0) at lisp.h:2018 #2 PSEUDOVECTORP (code=2, a=0) at lisp.h:2080 #3 PROCESSP (a=0) at lisp.h:2102 #4 Fget_process (name=0) at process.c:680 #5 0x0000000000573e87 in eval_sub (form=form@entry=16514534) at eval.c:2146 ... When the macro forms are used, levels #0 through #3 are lost, which makes things harder to follow, particularly when one is not expert in the code. This debuggability win is partly lost when compiling with plain -O0, because then some functions turn into macros. But that's OK, since one can compile with -O0 -DINLINING=0 to get nicer debugging.