From owner-freebsd-current Mon Jul 12 22:40:36 1999 Delivered-To: freebsd-current@freebsd.org Received: from m4.c2.telstra-mm.net.au (m4.c2.telstra-mm.net.au [24.192.3.19]) by hub.freebsd.org (Postfix) with ESMTP id 79C0714F66 for ; Mon, 12 Jul 1999 22:40:29 -0700 (PDT) (envelope-from a.reilly@lake.com.au) Received: from m5.c2.telstra-mm.net.au (m5.c2.telstra-mm.net.au [24.192.3.20]) by m4.c2.telstra-mm.net.au (8.8.6 (PHNE_14041)/8.8.6) with ESMTP id PAA26898 for ; Tue, 13 Jul 1999 15:37:28 +1000 (EST) X-BPC-Relay-Envelope-From: a.reilly@lake.com.au X-BPC-Relay-Envelope-To: X-BPC-Relay-Sender-Host: m5.c2.telstra-mm.net.au [24.192.3.20] X-BPC-Relay-Info: Message delivered directly. Received: from areilly.bpc-users.org (CPE-24-192-48-172.nsw.bigpond.net.au [24.192.48.172]) by m5.c2.telstra-mm.net.au (8.8.6 (PHNE_14041)/8.8.6) with SMTP id PAA20358 for ; Tue, 13 Jul 1999 15:37:22 +1000 (EST) Received: (qmail 94535 invoked by uid 1000); 13 Jul 1999 05:37:16 -0000 From: "Andrew Reilly" Date: Tue, 13 Jul 1999 15:37:16 +1000 To: Mike Smith Cc: Mike Haertel , Matthew Dillon , Luoqi Chen , dfr@nlsystems.com, jeremyp@gsmx07.alcatel.com.au, freebsd-current@FreeBSD.ORG Subject: Re: "objtrm" problem probably found (was Re: Stuck in "objtrm") Message-ID: <19990713153716.A94421@gurney.reilly.home> References: <199907121741.KAA17837@ducky.net> <199907130209.TAA03301@dingo.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <199907130209.TAA03301@dingo.cdrom.com>; from Mike Smith on Mon, Jul 12, 1999 at 07:09:58PM -0700 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Jul 12, 1999 at 07:09:58PM -0700, Mike Smith wrote: > > Although function calls are more expensive than inline code, > > they aren't necessarily a lot more so, and function calls to > > non-locked RMW operations are certainly much cheaper than > > inline locked RMW operations. > > This is a fairly key statement in context, and an opinion here would > count for a lot; are function calls likely to become more or less > expensive in time? Others have answered this question, but I thought I'd point out that there is another alternative that is likely to be faster than indirect function calls on some architectures: inline branched code. So you still have a global variable selecting locked/non-locked, but it's a boolean, rather than a pointer. Your atomic macros are then { if (atomic_lock) asm("lock;foo"); else asm ("foo"); } You might be interested in the paper: "Efficient Dynamic Dispatch without Virtual Function Tables. The SmallEiffel Compiler." Olivier ZENDRA, Dominique COLNET, Suzanne COLLIN. 12th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'97), Volume 32, Issue 10 - Atlanta, GA, USA, October 1997, pages 125-141. http://SmallEiffel.loria.fr/papers/papers.html#OOPSLA97 as a justification for that approach. -- Andrew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message