[Mono-devel-list] [PATCH] .Net 2.0 System.Threading.Interlocked, tests and internal improvements

Dick Porter dick at ximian.com
Tue Oct 12 07:22:23 EDT 2004


On Sun, 2004-10-10 at 00:43 +0200, Luca Barbieri wrote:
> This patch implements several new Interlocked* wapi functions and takes 
> advantage of them to implement the new .Net 2.0 methods in 
> System.Threading.Interlocked.
> 
> Changes:
> - .Net 2.0 System.Threading.Interlocked
> - Unit tests for existing and new methods of System.Threading.Interlocked

This is very useful.  Thanks.

> - A significantly expanded set of Interlocked* functions, with every 
> function available for both 32-bit and 64-bit operands

Here we run into problems with the patch.  io-layer has to follow the
Windows API, because it's used as a replacement for the native Windows
functions on non-Windows builds.  Your patch will cause the Windows
build of mono to break.

You can see the Interlocked API list here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/synchronization_functions.asp


> - A fast i386 and amd64 (amd64 untested) implementation of the 
> functions, with several code paths based on CPU features
> - i386 CPU identification support added to arch.h/arch.c, new io-layer 
> files for generic architecture-specific code; identification support in 
> the JITs removed

Same problem here.

There already is an arch layer in the JIT; why don't you put your
cpuid() code in there?

> Issues:
> - On amd64, I believe that cmov/fcmov JIT optimizations were disabled 
> due to a coding mistake, so I enabled them while moving the cpuid code 
> to a central place. This may not be the case.

Be aware that some 686s don't have cmov, it's an optional instruction.
For example, the VIA C3:

vendor_id       : CentaurHauls
cpu family      : 6
model           : 7
model name      : VIA Ezra
flags           : fpu de tsc msr cx8 mtrr pge mmx 3dnow


Linux ceasterware 2.6.5-7.108-default #1 Wed Aug 25 13:34:40 UTC 2004
i686 i686 i386 GNU/Linux


Hopefully we can rearrange your patch to fit the particular requirements
of the io-layer.

- Dick




More information about the Mono-devel-list mailing list