From owner-freebsd-ports@FreeBSD.ORG Thu Nov 12 14:55:13 2009 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB5B71065693 for ; Thu, 12 Nov 2009 14:55:12 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 86CCF8FC0C for ; Thu, 12 Nov 2009 14:55:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codelabs.ru; s=two; h=Date:From:To:Cc:Subject:Message-ID: Reply-To:References:MIME-Version:Content-Type:In-Reply-To: Sender; bh=/Lp/6qeTQxYmaHdgRWrFEsgkDFw/dQxrm/kWGR1+XrM=; b=eK0pp QHG3tyyDvwm8inUNMNn20v7d0PqEogSci59PPB3Ie4KDgL4XMkzyfVl7worQaz8X CjHnQ/8lhR5ZBuvvZWaUoUX7wjJwzip2/N8jvVo/Bl9ehT+K0nFSxR2QPV5KRp03 v3NbIJTPGBGvD6wk+eQhDo0+w1lGHBmYvc1+dmFZxiv42AFpkrUqnTGkMD4p6MCv /rx9cbMo4BRkWZKoS9wvnIqzAdNqwb+zSQ6twAsTWir8WH16cC+JLupMWPHCUddX osQsGXmnYOL8W2bPDl5Gp0WWZyQZrJTnoPqLSjNUrRLXp6UBlusLfjEPukHXwY9T SL3HdeYZCIQJfx6ng== Received: from shadow.codelabs.ru (cdma-92-36-112-204.msk.skylink.ru [92.36.112.204]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1N8b4l-000IJA-U5; Thu, 12 Nov 2009 17:55:10 +0300 Date: Thu, 12 Nov 2009 17:55:05 +0300 From: Eygene Ryabinkin To: Alexander Churanov Message-ID: References: <3cb459ed0911071747y11e5ace3gca92c9814a11d139@mail.gmail.com> <4AF628EC.3030404@acm.poly.edu> <3cb459ed0911091628k499507ffl13a1970d270c921d@mail.gmail.com> <3cb459ed0911091634g1fe5792bu5f41960bbe344999@mail.gmail.com> <3cb459ed0911111204n4579090fif954f59305e07457@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Pd0ReVV5GZGQvF3a" Content-Disposition: inline In-Reply-To: <3cb459ed0911111204n4579090fif954f59305e07457@mail.gmail.com> Sender: rea-fbsd@codelabs.ru Cc: ports@freebsd.org, Mark Linimon , Boris Kochergin Subject: Re: Issues with devel/boost-* on Sparc64 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rea-fbsd@codelabs.ru List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2009 14:55:13 -0000 --Pd0ReVV5GZGQvF3a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Alexander, good day. Wed, Nov 11, 2009 at 11:04:59PM +0300, Alexander Churanov wrote: > It seems that I have found a workaround. It is to store the address of > the variable in a register and then issue the "CAS" instruction, which > only accepts register for an address. I am currently testing it. I hadn't seen the code you're testing, but it seems to me that the attached patch should automatically take care of making the address to be in some register (if it isn't already in the register). It compiles well, and even works as a stand-alone function, but I hadn't yet tested if boost built with such a atomic primitive really works fine. Have some $JOB to do prior to the testing. If you're storing the address in the register manually -- there is no need for it: you can use assembly constraints; this also makes less headache, because compiler decides what register should be allocated by its own and typically it is doing this job well. Anyway, I hadn't seen your patch, so may be you already doing this. -- Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook {_.-``-' {_/ # --Pd0ReVV5GZGQvF3a Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="boost-cas.diff" --- boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp.orig 2009-03-02 11:22:16.000000000 -0500 +++ boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp 2009-11-12 09:51:25.000000000 -0500 @@ -30,10 +30,10 @@ inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ ) { - __asm__ __volatile__( "cas %0, %2, %1" - : "+m" (*dest_), "+r" (swap_) - : "r" (compare_) - : "memory" ); + __asm__ __volatile__( "casa [%3] 0x80, %2, %1" + : "=m" (*dest_), "=r" (swap_) + : "r" (compare_), "r" (dest_), "1" (swap_), "m" (*dest_) + : "memory" ); return swap_; } --Pd0ReVV5GZGQvF3a--