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

Luca Barbieri luca.barbieri at gmail.com
Sat Oct 9 18:43:57 EDT 2004


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
- A significantly expanded set of Interlocked* functions, with every 
function available for both 32-bit and 64-bit operands
- 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

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.
- Not tested on amd64, and thus may contain bugs
- All architectures except i386 and amd64 reverted to use C atomic 
functions until suitably knowledgeable people implement the new 
Interlocked* APIs

Diffstat:
  mono/mono/io-layer/atomic.h                               |  449 
+++++++++++---
  mcs/class/corlib/Test/System.Threading/InterlockedTest.cs |  253 +++++++
  mono/mono/io-layer/atomic.c                               |  209 +-----
  mono/mono/metadata/threads.c                              |  105 ++-
  mono/mono/io-layer/atomic-locked.h                        |  102 +++
  mono/mono/io-layer/arch.c                                 |   91 ++
  mono/mono/mini/mini-x86.c                                 |   78 --
  mono/mono/io-layer/arch.h                                 |   72 ++
  mono/mono/jit/emit-x86.c                                  |   53 -
  mcs/class/corlib/System.Threading/Interlocked.cs          |   29
  mono/mono/mini/mini-amd64.c                               |   25
  mono/mono/metadata/threads-types.h                        |   15
  mono/mono/metadata/icall.c                                |   11
  mono/mono/io-layer/Makefile.am                            |    2
  mono/mono/io-layer/wapi.h                                 |    1
  15 files changed, 1068 insertions(+), 427 deletions(-)
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: atomic.patch
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041010/1071bbf4/attachment.pl 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20041010/1071bbf4/attachment.bin 


More information about the Mono-devel-list mailing list