From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Inlining `scm_is_pair ()' Date: Tue, 24 Jan 2006 09:37:06 +0100 Organization: LAAS-CNRS Message-ID: <87slrednt9.fsf_-_@laas.fr> References: <87wti7pwie.fsf@laas.fr> <87ek4ftgge.fsf@zagadka.de> <87fyouitqo.fsf@laas.fr> <87psnxxswj.fsf@laas.fr> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1138091954 7963 80.91.229.2 (24 Jan 2006 08:39:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Jan 2006 08:39:14 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jan 24 09:39:11 2006 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F1Jhj-0001cJ-RT for guile-devel@m.gmane.org; Tue, 24 Jan 2006 09:39:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1JkP-0005wK-BU for guile-devel@m.gmane.org; Tue, 24 Jan 2006 03:41:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F1Jiw-0005ZC-BG for guile-devel@gnu.org; Tue, 24 Jan 2006 03:40:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F1Jik-0005Sq-5V for guile-devel@gnu.org; Tue, 24 Jan 2006 03:40:11 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1Jih-0005SR-9m for guile-devel@gnu.org; Tue, 24 Jan 2006 03:40:07 -0500 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1F1JnZ-0001CY-1C for guile-devel@gnu.org; Tue, 24 Jan 2006 03:45:09 -0500 Original-Received: by laas.laas.fr (8.13.1/8.13.4) with SMTP id k0O8bGFU029745; Tue, 24 Jan 2006 09:37:17 +0100 (CET) Original-To: hanwen@xs4all.nl X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 5 =?iso-8859-1?Q?Pluvi=F4se?= an 214 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: hanwen@xs4all.nl, guile-devel@gnu.org In-Reply-To: <87psnxxswj.fsf@laas.fr> (Ludovic =?iso-8859-1?Q?Court=E8s's?= message of "Fri, 16 Dec 2005 11:01:16 +0100") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-MIME-Autoconverted: from 8bit to quoted-printable by laas.laas.fr id k0O8bGFU029745 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5611 Archived-At: Hi, ludovic.courtes@laas.fr (Ludovic Court=E8s) writes: > Since, I consider compilers that don't support inlining unimportant, I'= d > happily live without the `inline.c' stuff. I.e., I'd put this in > `pairs.h': > > static SCM_C_INLINE int > scm_is_pair (...) > > With compilers not supporting inlining, this would lead to the creation > of several instances of the function. But who cares? The following patch makes `scm_is_pair ()' an inline --- the macro was indeed a bad idea because there are places (e.g., async.c:208) where its argument is an assignment. I'm not sure that's the only reason, but I'm now unable to compile Guile with `-O0': when doing so, I get a "stack overflow" error when trying to run the REPL. Perhaps we should also declare the function with `__attribute__ ((always_inline))'? What about non-inlining compilers, are there still a lot of them? I'd suspect GCC is now used 40% of the time on proprietary Unices; hopefully, the proprietary compilers used the rest of the time do support the `inline' keyword [0], some of them even support C99 [1]. OTOH, it seems that Compaq's only supports `inline' as a pragma [2]. How about MSVC? Thanks, Ludovic. [0] http://docs.hp.com/en/5990-8153/ch10s05.html [1] http://developers.sun.com/prodtech/cc/documentation/ss9_docs/mr/READM= Es/c.html [2] http://h30097.www3.hp.com/dtk/Compaq_C_Compiler/doc/lrm/DOCU0030.HTM 2006-01-24 Ludovic Court=E8s * pairs.c (scm_is_pair): Removed. * pairs.h (scm_is_pair): Defined as `static inline'. * socket.c: Include "pairs.h". --- orig/libguile/pairs.c +++ mod/libguile/pairs.c @@ -78,11 +78,6 @@ } #undef FUNC_NAME =20 -int -scm_is_pair (SCM x) -{ - return SCM_I_CONSP (x); -} =20 SCM scm_car (SCM pair) --- orig/libguile/pairs.h +++ mod/libguile/pairs.h @@ -23,6 +23,7 @@ =0C =20 #include "libguile/__scm.h" +#include "libguile/gc.h" /* SCM_CELL_TYPE */ =20 =0C =20 @@ -78,7 +79,12 @@ SCM_API void scm_error_pair_access (SCM); #endif =20 -SCM_API int scm_is_pair (SCM x); +static SCM_C_INLINE int +scm_is_pair (SCM obj) +{ + return (SCM_I_CONSP (obj)); +} + =20 SCM_API SCM scm_cons (SCM x, SCM y); SCM_API SCM scm_cons2 (SCM w, SCM x, SCM y); --- orig/libguile/socket.c +++ mod/libguile/socket.c @@ -35,6 +35,7 @@ =20 #include "libguile/validate.h" #include "libguile/socket.h" +#include "libguile/pairs.h" =20 #ifdef __MINGW32__ #include "win32-socket.h" _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel