Imported Upstream version 5.14.0.78

Former-commit-id: 3494343bcc9ddb42b36b82dd9ae7b69e85e0229f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-05-10 08:37:03 +00:00
parent 74b74abd9f
commit 19234507ba
1776 changed files with 67755 additions and 31107 deletions

View File

@@ -184,9 +184,14 @@ namespace System {
null,
ref stackMark);
}
public static object CreateInstance(Type type, bool nonPublic)
{
return CreateInstance(type, nonPublic, wrapExceptions: true);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
static public Object CreateInstance(Type type, bool nonPublic)
internal static object CreateInstance(Type type, bool nonPublic, bool wrapExceptions)
{
if ((object)type == null)
throw new ArgumentNullException("type");
@@ -198,7 +203,7 @@ namespace System {
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), "type");
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return rt.CreateInstanceDefaultCtor(!nonPublic, false, true, ref stackMark);
return rt.CreateInstanceDefaultCtor(!nonPublic, false, true, wrapExceptions, ref stackMark);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
@@ -228,7 +233,7 @@ namespace System {
return (T)rt.CreateInstanceSlow(true /*publicOnly*/, true /*skipCheckThis*/, false /*fillCache*/, ref stackMark);
else
#endif // FEATURE_CORECLR
return (T)rt.CreateInstanceDefaultCtor(true /*publicOnly*/, true /*skipCheckThis*/, true /*fillCache*/, ref stackMark);
return (T)rt.CreateInstanceDefaultCtor(true /*publicOnly*/, true /*skipCheckThis*/, true /*fillCache*/, true /*wrapExceptions*/, ref stackMark);
}
[ResourceExposure(ResourceScope.Machine)]

View File

@@ -617,7 +617,7 @@ namespace System.Globalization {
#endif
}
static private Char ToUpperAsciiInvariant(Char c)
static internal Char ToUpperAsciiInvariant(Char c)
{
if ('a' <= c && c <= 'z')
{

View File

@@ -518,14 +518,14 @@ namespace System.IO {
// If the wait has already complete, run the task.
if (asyncWaiter.IsCompleted)
{
Contract.Assert(asyncWaiter.IsRanToCompletion, "The semaphore wait should always complete successfully.");
Contract.Assert(asyncWaiter.IsCompletedSuccessfully, "The semaphore wait should always complete successfully.");
RunReadWriteTask(readWriteTask);
}
else // Otherwise, wait for our turn, and then run the task.
{
asyncWaiter.ContinueWith((t, state) =>
{
Contract.Assert(t.IsRanToCompletion, "The semaphore wait should always complete successfully.");
Contract.Assert(t.IsCompletedSuccessfully, "The semaphore wait should always complete successfully.");
var tuple = (Tuple<Stream,ReadWriteTask>)state;
tuple.Item1.RunReadWriteTask(tuple.Item2); // RunReadWriteTask(readWriteTask);
}, Tuple.Create<Stream,ReadWriteTask>(this, readWriteTask),
@@ -699,6 +699,8 @@ namespace System.IO {
using(context) ExecutionContext.Run(context, invokeAsyncCallback, this, true);
}
}
public bool InvokeMayRunArbitraryCode => true;
}
#endif

View File

@@ -61,11 +61,12 @@ namespace System {
}
}
}
#if MONO
internal static String FormatSignature(byte [] signature) {
throw new NotImplementedException ();
}
internal static string FormatSignature(byte[] signature)
{
return "";
}
#else
// Called to format signature
[System.Security.SecurityCritical] // auto-generated

View File

@@ -48,19 +48,10 @@ namespace System {
if (ClassName == null) {
return base.Message;
} else {
#if MONO
string res = ClassName + "." + MemberName;
if (!string.IsNullOrEmpty(signature))
res = string.Format (CultureInfo.InvariantCulture, signature, res);
if (!string.IsNullOrEmpty(_message))
res += " Due to: " + _message;
return res;
#else
// do any desired fixups to classname here.
return Environment.GetResourceString("MissingMethod_Name",
ClassName + "." + MemberName +
(Signature != null ? " " + FormatSignature(Signature) : ""));
#endif
}
}
}
@@ -82,17 +73,5 @@ namespace System {
// If ClassName != null, Message will construct on the fly using it
// and the other variables. This allows customization of the
// format depending on the language environment.
#if MONO
// Called from the EE
private MissingMethodException(String className, String methodName, String signature, String message) : base (message)
{
ClassName = className;
MemberName = methodName;
this.signature = signature;
}
[NonSerialized]
string signature;
#endif
}
}

View File

@@ -1 +1 @@
61b46433b342f6950ce1bad97f235b6a47259f76
dc706570b91f215615b17e9753d2eb67144fe265

View File

@@ -25,10 +25,21 @@ namespace System.Runtime {
using System.Runtime.Versioning;
using System.Runtime.CompilerServices;
#if FEATURE_MULTICOREJIT
#if FEATURE_MULTICOREJIT || MONO
public static class ProfileOptimization
{
#if MONO
internal static void InternalSetProfileRoot(string directoryPath)
{
// ignore
}
internal static void InternalStartProfile(string profile, IntPtr ptrNativeAssemblyLoadContext)
{
// ignore
}
#else
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SecurityCritical]
[ResourceExposure(ResourceScope.None)]
@@ -40,6 +51,7 @@ namespace System.Runtime {
[ResourceExposure(ResourceScope.None)]
[SuppressUnmanagedCodeSecurity]
internal static extern void InternalStartProfile(string profile, IntPtr ptrNativeAssemblyLoadContext);
#endif
[SecurityCritical]
public static void SetProfileRoot(string directoryPath)

View File

@@ -245,7 +245,7 @@ namespace System.Runtime.CompilerServices
}
// This property lazily instantiates the Task in a non-thread-safe manner.
private Task Task
internal Task Task
{
get
{

View File

@@ -153,7 +153,7 @@ namespace System.Runtime.CompilerServices
task.NotifyDebuggerOfWaitCompletionIfNecessary();
// And throw an exception if the task is faulted or canceled.
if (!task.IsRanToCompletion) ThrowForNonSuccess(task);
if (!task.IsCompletedSuccessfully) ThrowForNonSuccess(task);
}
/// <summary>Throws an exception to handle a task that completed in a state other than RanToCompletion.</summary>
@@ -209,18 +209,18 @@ namespace System.Runtime.CompilerServices
internal static void OnCompletedInternal(Task task, Action continuation, bool continueOnCapturedContext, bool flowExecutionContext)
{
if (continuation == null) throw new ArgumentNullException("continuation");
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
#if !MONO
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
// If TaskWait* ETW events are enabled, trace a beginning event for this await
// and set up an ending event to be traced when the asynchronous await completes.
if ( TplEtwProvider.Log.IsEnabled() || Task.s_asyncDebuggingEnabled)
{
continuation = OutputWaitEtwEvents(task, continuation);
}
#endif
// Set the continuation onto the awaited task.
task.SetContinuationForAwait(continuation, continueOnCapturedContext, flowExecutionContext, ref stackMark);
#else
task.SetContinuationForAwait(continuation, continueOnCapturedContext, flowExecutionContext);
#endif
}
/// <summary>

View File

@@ -125,6 +125,30 @@ namespace System {
public abstract int Compare(String x, String y);
public abstract bool Equals(String x, String y);
public abstract int GetHashCode(string obj);
#if MONO
// Convert a StringComparison to a StringComparer
public static StringComparer FromComparison(StringComparison comparisonType)
{
switch (comparisonType)
{
case StringComparison.CurrentCulture:
return CurrentCulture;
case StringComparison.CurrentCultureIgnoreCase:
return CurrentCultureIgnoreCase;
case StringComparison.InvariantCulture:
return InvariantCulture;
case StringComparison.InvariantCultureIgnoreCase:
return InvariantCultureIgnoreCase;
case StringComparison.Ordinal:
return Ordinal;
case StringComparison.OrdinalIgnoreCase:
return OrdinalIgnoreCase;
default:
throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
#endif
}
[Serializable]

View File

@@ -156,6 +156,40 @@ namespace System.Threading
return target;
}
#if MONO
public static T EnsureInitialized<T>(ref T target, ref object syncLock, System.Func<T> valueFactory) where T : class
=> Volatile.Read(ref target) ?? EnsureInitializedCore(ref target, ref syncLock, valueFactory);
private static T EnsureInitializedCore<T>(ref T target, ref object syncLock, Func<T> valueFactory) where T : class
{
// Lazily initialize the lock if necessary and then double check if initialization is still required.
lock (EnsureLockInitialized(ref syncLock))
{
if (Volatile.Read(ref target) == null)
{
Volatile.Write(ref target, valueFactory());
if (target == null)
{
throw new InvalidOperationException(SR.Lazy_StaticInit_InvalidOperation);
}
}
}
return target;
}
/// <summary>
/// Ensure the lock object is initialized.
/// </summary>
/// <param name="syncLock">A reference to a location containing a mutual exclusive lock. If <paramref name="syncLock"/> is null,
/// a new object will be instantiated.</param>
/// <returns>Initialized lock object.</returns>
private static object EnsureLockInitialized(ref object syncLock) =>
syncLock ??
Interlocked.CompareExchange(ref syncLock, new object(), null) ??
syncLock;
#endif
/// <summary>
/// Initializes a target reference or value type with its default constructor if it has not already

View File

@@ -576,6 +576,10 @@ namespace System.Threading
}
}
#if MONO
internal static readonly ExecutionContext Default = new ExecutionContext();
#endif
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal ExecutionContext()
{

View File

@@ -60,7 +60,7 @@ namespace System.Threading
#if !FEATURE_CORECLR
[SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags =SecurityPermissionFlag.ControlPolicy|SecurityPermissionFlag.ControlEvidence)]
#endif
public class SynchronizationContext
public partial class SynchronizationContext
{
#if FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
SynchronizationContextProperties _props = SynchronizationContextProperties.None;

View File

@@ -1382,7 +1382,7 @@ namespace System.Threading
}
[HostProtection(Synchronization=true, ExternalThreading=true)]
public static class ThreadPool
public static partial class ThreadPool
{
#if FEATURE_CORECLR
[System.Security.SecurityCritical] // auto-generated

View File

@@ -307,6 +307,23 @@ namespace System {
return argumentName;
}
private static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
{
return new ArgumentOutOfRangeException(GetArgumentName(argument), resource.ToString());
}
internal static void ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index()
{
throw GetArgumentOutOfRangeException(ExceptionArgument.startIndex,
ExceptionResource.ArgumentOutOfRange_Index);
}
internal static void ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count()
{
throw GetArgumentOutOfRangeException(ExceptionArgument.count,
ExceptionResource.ArgumentOutOfRange_Count);
}
//
// This function will convert an ExceptionResource enum value to the resource string.
//
@@ -545,7 +562,11 @@ namespace System {
text,
length,
comparer,
comparable
comparable,
exceptions,
exception,
action,
comparison
#endif
}
@@ -600,7 +621,10 @@ namespace System {
ObjectDisposed_RegKeyClosed,
NotSupported_InComparableType,
Argument_InvalidRegistryOptionsCheck,
Argument_InvalidRegistryViewCheck
Argument_InvalidRegistryViewCheck,
TaskT_TransitionToFinal_AlreadyCompleted,
TaskCompletionSourceT_TrySetException_NullException,
TaskCompletionSourceT_TrySetException_NoExceptions,
}
}