Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-04-14 11:50:12


Peter Dimov wrote:

I have good news, bad news, and worse news..

> Assuming CodeWarrior returns in eax, try:

I was in the middle of looking at the disassembly, when I got your
reply, and realizing that CW is too smart. It was removing the based
addressing :-(

> inline int atomic_conditional_increment( int * pw )
> {
> // int rv = *pw;
> // if( rv != 0 ) ++*pw;
> // return rv;
>
> asm
> {
> mov esi, [pw]
> mov eax, [esi]
> L0:
> test eax, eax
> je L1
> mov ebx, eax
> inc ebx
> lock cmpxchg [esi], ebx
> jne L0
> L1:
> }
> }
>
> // esi == pw, eax == *pw

Good news..

After doing that, and applying the equivalent transformation to the
other functions it works much better.

Bad news..

The results of the timing test are, from slow to fast:

sp_counted_base_w32.hpp...

debug: 5.058 - release: 1.902

sp_counted_base_cw_x86.hpp...

debug: 4.997 - release: 1.743

sp_counted_base_nt.hpp...

debug: 4.847 - release: 1.432

So some improvement, but I'm not sure if it's worth the extra
complication. Unless there are people out there doing massive, >10Meg,
shared_ptr manipulations.

Worse news..

Not all tests pass! The shared_ptr_mt_test.cpp test fail in the rather
spectacular illegal memory access exception. And to top it off it causes
the MSVC JIT debugger to crash if one attempts to debug.. Oh fun!

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk