From owner-freebsd-stable Wed Oct 7 08:28:10 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA10798 for freebsd-stable-outgoing; Wed, 7 Oct 1998 08:28:10 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from dingo.cdrom.com (dingo.cdrom.com [204.216.28.145]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA10721 for ; Wed, 7 Oct 1998 08:28:02 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost.cdrom.com [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id IAA00355; Wed, 7 Oct 1998 08:31:57 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Message-Id: <199810071531.IAA00355@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: marko@cs.uni-frankfurt.de cc: freebsd-stable@FreeBSD.ORG Subject: Re: Global register variables in gcc and stdio.h?!? In-reply-to: Your message of "Wed, 07 Oct 1998 15:30:38 +0200." <199810071330.PAA22126@king.ki.informatik.uni-frankfurt.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 07 Oct 1998 08:31:57 -0700 From: Mike Smith Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > An application I want to compile runs much faster if it can use global > register variables. > > Trying to compile it I get > > [...] > gmake[1]: Entering directory `/usr/home/marko/src/mercury-0.7.3.orig/runtime' > MERCURY_C_INCL_DIR=. ../scripts/mgnuc --grade asm_fast.gc --no-ansi -I../runtime -I../boehm_gc -g -c label.c -o label.o > In file included from regs.h:67, > from imp.h:36, > from label.c:19: > machdeps/i386_regs.h:61: global register variable follows a function definition > machdeps/i386_regs.h:62: global register variable follows a function definition > machdeps/i386_regs.h:67: global register variable follows a function definition > gmake[1]: *** [label.o] Error 1 > gmake[1]: Leaving directory `/usr/home/marko/src/mercury-0.7.3.orig/runtime' > gmake: *** [runtime] Error 2 > > I checked the preprocessor output and found that there is only the > function definition for `static __inline int __sputc(int _c, FILE > *_p)` which is included from stdio.h. Depending on an #ifdef that > version of __sputc or an alternative as a macro is used. > > I would suggest adding something like > !defined(__USE_GLOBAL_REGISTER_VARIABLES__) to the condition for using > the inline function. > > Doing that allows at least mercury to compile using global register > variables. > > Please comment. 1) Any application which depends on global register variables for performance needs to be fixed. The concept of a "global register variable" on the x86 is a bit of a joke anyway. 2) Declare your global register variables before including header files. -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message