Imported Upstream version 5.10.1.25

Former-commit-id: 14ef8af3b54f8c453b5049813edca31fa68f672b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-03-30 08:46:39 +00:00
parent fa33682fe9
commit f31f5cf987
64 changed files with 112 additions and 59 deletions

View File

@ -1 +1 @@
4f949ee4d3493ae84799bc004909d8c02cd95387 4f583806bb8c4568601605309293ef257e338bf6

View File

@ -1 +1 @@
5bc587207ca36625c9e0ef11bedf144610db22df 7f5772066f164630cebec71d176804ed59bd8c71

View File

@ -1 +1 @@
6ee3ca8968f7c2c5a13fde0d89329b4efbbd7f4f b7c15b7b9fa8148f527c4a789c88891b3083d91e

View File

@ -1 +1 @@
e2fe033997a386b136170ffee03d043df47c88df 0b5f3952cc382be37d272154abe74be5a66a17ec

View File

@ -1 +1 @@
0aabd5e9b1f4b5f354b3f274cad6983bfa8434e8 e666675a5e7c7a12e9a991ff5c40ea2427b626d2

View File

@ -1 +1 @@
caea80eb9a8aeae8d816300ba49e3e58a189a287 1f3ffce45e728f3afdbcc4f62441ec66b01d28b9

View File

@ -1 +1 @@
f41727750b395e4019243785bcefced55377f2f3 7f3bafeaee74306109dc28c841c32bf76b62e0a2

View File

@ -1 +1 @@
9a68bbd21ee9196ff71f50bc108c1324eae4f4f9 4aceab7b6bffa92aab373aabde9c34d48d497e91

View File

@ -10,7 +10,7 @@ namespace System.Buffers
/// <summary> /// <summary>
/// Provides a mechanism for manual lifetime management. /// Provides a mechanism for manual lifetime management.
/// </summary> /// </summary>
public interface IRetainable interface IRetainable
{ {
/// <summary> /// <summary>
/// Call this method to indicate that the IRetainable object is in use. /// Call this method to indicate that the IRetainable object is in use.

View File

@ -10,7 +10,7 @@ namespace System.Buffers
/// <summary> /// <summary>
/// A handle for the memory. /// A handle for the memory.
/// </summary> /// </summary>
public unsafe struct MemoryHandle : IDisposable unsafe struct MemoryHandle : IDisposable
{ {
private IRetainable _retainable; private IRetainable _retainable;
private void* _pointer; private void* _pointer;

View File

@ -10,7 +10,7 @@ namespace System.Buffers
/// <summary> /// <summary>
/// Owner of Memory<typeparamref name="T"/> that provides appropriate lifetime management mechanisms for it. /// Owner of Memory<typeparamref name="T"/> that provides appropriate lifetime management mechanisms for it.
/// </summary> /// </summary>
public abstract class OwnedMemory<T> : IDisposable, IRetainable abstract class OwnedMemory<T> : IDisposable, IRetainable
{ {
/// <summary> /// <summary>
/// The number of items in the Memory<typeparamref name="T"/>. /// The number of items in the Memory<typeparamref name="T"/>.

View File

@ -239,7 +239,7 @@ namespace System
/// Returns a handle for the array. /// Returns a handle for the array.
/// <param name="pin">If pin is true, the GC will not move the array and hence its address can be taken</param> /// <param name="pin">If pin is true, the GC will not move the array and hence its address can be taken</param>
/// </summary> /// </summary>
public unsafe MemoryHandle Retain(bool pin = false) unsafe MemoryHandle Retain(bool pin = false)
{ {
MemoryHandle memoryHandle = default; MemoryHandle memoryHandle = default;
if (pin) if (pin)

View File

@ -217,7 +217,7 @@ namespace System
/// If pin is true, the GC will not move the array until the returned <see cref="MemoryHandle"/> /// If pin is true, the GC will not move the array until the returned <see cref="MemoryHandle"/>
/// is disposed, enabling the memory's address can be taken and used. /// is disposed, enabling the memory's address can be taken and used.
/// </param> /// </param>
public unsafe MemoryHandle Retain(bool pin = false) unsafe MemoryHandle Retain(bool pin = false)
{ {
MemoryHandle memoryHandle = default; MemoryHandle memoryHandle = default;
if (pin) if (pin)

View File

@ -14,7 +14,7 @@ namespace System.Runtime.InteropServices
/// Provides a collection of methods for interoperating with <see cref="Memory{T}"/>, <see cref="ReadOnlyMemory{T}"/>, /// Provides a collection of methods for interoperating with <see cref="Memory{T}"/>, <see cref="ReadOnlyMemory{T}"/>,
/// <see cref="Span{T}"/>, and <see cref="ReadOnlySpan{T}"/>. /// <see cref="Span{T}"/>, and <see cref="ReadOnlySpan{T}"/>.
/// </summary> /// </summary>
public static class MemoryMarshal static class MemoryMarshal
{ {
/// <summary>Creates a <see cref="Memory{T}"/> from a <see cref="ReadOnlyMemory{T}"/>.</summary> /// <summary>Creates a <see cref="Memory{T}"/> from a <see cref="ReadOnlyMemory{T}"/>.</summary>
/// <param name="readOnlyMemory">The <see cref="ReadOnlyMemory{T}"/>.</param> /// <param name="readOnlyMemory">The <see cref="ReadOnlyMemory{T}"/>.</param>

View File

@ -19,6 +19,9 @@ using System.Diagnostics.Private;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
#if MONO
using System.Runtime.Serialization;
#endif
namespace System.Collections.Concurrent namespace System.Collections.Concurrent
{ {
@ -56,11 +59,20 @@ namespace System.Collections.Concurrent
} }
} }
[NonSerialized]
private volatile Tables _tables; // Internal tables of the dictionary private volatile Tables _tables; // Internal tables of the dictionary
private IEqualityComparer<TKey> _comparer; // Key equality comparer private IEqualityComparer<TKey> _comparer; // Key equality comparer
[NonSerialized]
private readonly bool _growLockArray; // Whether to dynamically increase the size of the striped lock private readonly bool _growLockArray; // Whether to dynamically increase the size of the striped lock
[NonSerialized]
private int _budget; // The maximum number of elements per lock before a resize operation is triggered private int _budget; // The maximum number of elements per lock before a resize operation is triggered
#if MONO
private KeyValuePair<TKey, TValue>[] _serializationArray; // Used for custom serialization
private int _serializationConcurrencyLevel; // used to save the concurrency level in serialization
private int _serializationCapacity; // used to save the capacity in serialization
#endif
// The default capacity, i.e. the initial # of buckets. When choosing this value, we are making // The default capacity, i.e. the initial # of buckets. When choosing this value, we are making
// a trade-off between the size of a very small dictionary, and the number of resizes when // a trade-off between the size of a very small dictionary, and the number of resizes when
// constructing a large dictionary. Also, the capacity should not be divisible by a small prime. // constructing a large dictionary. Also, the capacity should not be divisible by a small prime.
@ -2053,6 +2065,46 @@ namespace System.Collections.Concurrent
_enumerator.Reset(); _enumerator.Reset();
} }
} }
#if MONO
/// <summary>Get the data array to be serialized.</summary>
[OnSerializing]
private void OnSerializing(StreamingContext context)
{
Tables tables = _tables;
// save the data into the serialization array to be saved
_serializationArray = ToArray();
_serializationConcurrencyLevel = tables._locks.Length;
_serializationCapacity = tables._buckets.Length;
}
/// <summary>Clear the serialized state.</summary>
[OnSerialized]
private void OnSerialized(StreamingContext context)
{
_serializationArray = null;
}
/// <summary>Construct the dictionary from a previously serialized one</summary>
[OnDeserialized]
private void OnDeserialized(StreamingContext context)
{
KeyValuePair<TKey, TValue>[] array = _serializationArray;
var buckets = new Node[_serializationCapacity];
var countPerLock = new int[_serializationConcurrencyLevel];
var locks = new object[_serializationConcurrencyLevel];
for (int i = 0; i < locks.Length; i++)
{
locks[i] = new object();
}
_tables = new Tables(buckets, locks, countPerLock);
InitializeFromCollection(array);
_serializationArray = null;
}
#endif
} }
internal sealed class IDictionaryDebugView<K, V> internal sealed class IDictionaryDebugView<K, V>

View File

@ -180,7 +180,7 @@ namespace System.IO.Compression
return _deflateStream.WriteAsync(array, offset, count, cancellationToken); return _deflateStream.WriteAsync(array, offset, count, cancellationToken);
} }
public override Task WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken)) internal override Task WriteAsync(ReadOnlyMemory<byte> source, CancellationToken cancellationToken = default(CancellationToken))
{ {
if (GetType() != typeof(GZipStream)) if (GetType() != typeof(GZipStream))
{ {

View File

@ -18,7 +18,7 @@ namespace System.Buffers.Binary
/// For native formats, MemoryExtensions.Read{T}; should be used. /// For native formats, MemoryExtensions.Read{T}; should be used.
/// Use these helpers when you need to read specific endinanness. /// Use these helpers when you need to read specific endinanness.
/// </remarks> /// </remarks>
public static partial class BinaryPrimitives static partial class BinaryPrimitives
{ {
/// <summary> /// <summary>
/// This is a no-op and added only for consistency. /// This is a no-op and added only for consistency.

View File

@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
namespace System.Buffers.Binary namespace System.Buffers.Binary
{ {
public static partial class BinaryPrimitives static partial class BinaryPrimitives
{ {
/// <summary> /// <summary>
/// Reads an Int16 out of a read-only span of bytes as big endian. /// Reads an Int16 out of a read-only span of bytes as big endian.

View File

@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
namespace System.Buffers.Binary namespace System.Buffers.Binary
{ {
public static partial class BinaryPrimitives static partial class BinaryPrimitives
{ {
/// <summary> /// <summary>
/// Reads an Int16 out of a read-only span of bytes as little endian. /// Reads an Int16 out of a read-only span of bytes as little endian.

View File

@ -11,7 +11,7 @@ using Internal.Runtime.CompilerServices;
namespace System.Buffers.Binary namespace System.Buffers.Binary
{ {
public static partial class BinaryPrimitives static partial class BinaryPrimitives
{ {
/// <summary> /// <summary>
/// Writes a structure of type T into a span of bytes. /// Writes a structure of type T into a span of bytes.

Some files were not shown because too many files have changed in this diff Show More