Merge pull request #2890 from mono/alexischr/remove-managed-alloc-string-zeroing
authorAlexis Christoforides <alexis@thenull.net>
Sat, 16 Apr 2016 10:24:17 +0000 (06:24 -0400)
committerAlexis Christoforides <alexis@thenull.net>
Sat, 16 Apr 2016 10:24:17 +0000 (06:24 -0400)
[sgen] Remove unnecessary and wrong IL code on string managed allocators

58 files changed:
external/referencesource
mcs/class/Makefile
mcs/class/System/Makefile
mcs/class/System/Mono.Net.Security/CallbackHelpers.cs
mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs
mcs/class/System/Mono.Net.Security/IMonoSslStream.cs
mcs/class/System/Mono.Net.Security/IMonoTlsProvider.cs
mcs/class/System/Mono.Net.Security/LegacySslStream.cs
mcs/class/System/Mono.Net.Security/MonoDefaultTlsProvider.cs
mcs/class/System/Mono.Net.Security/MonoSslStreamImpl.cs
mcs/class/System/Mono.Net.Security/MonoSslStreamWrapper.cs
mcs/class/System/Mono.Net.Security/MonoTlsProviderImpl.cs
mcs/class/System/Mono.Net.Security/MonoTlsProviderWrapper.cs
mcs/class/System/Mono.Net.Security/MonoTlsStream.cs
mcs/class/System/Mono.Net.Security/SystemCertificateValidator.cs
mcs/class/System/ReferenceSources/SSPIWrapper.cs
mcs/class/System/System.CodeDom.Compiler/Compiler.cs
mcs/class/System/System.Configuration/AppSettingsReader.cs
mcs/class/System/System.Configuration/ApplicationSettingsBase.cs
mcs/class/System/System.Configuration/ConfigurationSettings.cs
mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs
mcs/class/System/System.Configuration/LocalFileSettingsProvider.cs
mcs/class/System/System.IO/KeventWatcher.cs
mcs/class/System/System.Net.Mail/SmtpClient.cs
mcs/class/System/System.Net.Security/LocalCertificateSelectionCallback.cs
mcs/class/System/System.Net.Security/RemoteCertificateValidationCallback.cs
mcs/class/System/System.Net.Security/SslStream.cs
mcs/class/System/System.Net/HttpConnection.cs
mcs/class/System/System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/OSX509Certificates.cs
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs
mcs/class/corlib/Test/System.Security.Cryptography/CspParametersTest.cs
mcs/errors/cs0029-26.cs
mcs/mcs/ecore.cs
mcs/mcs/typespec.cs
mcs/tests/gtest-optional-37.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/compiler-tester/compiler-tester.cs
mcs/tools/mono-api-html/mono-api-html.csproj
mono/metadata/class.c
mono/metadata/mono-perfcounters.c
mono/metadata/sgen-mono.c
mono/metadata/sgen-os-mach.c
mono/metadata/threads.c
mono/mini/aot-runtime.c
mono/mini/driver.c
mono/mini/method-to-ir.c
mono/mini/mini-darwin.c
mono/mini/mini-posix.c
mono/mini/mini-runtime.c
mono/mini/test_op_il_seq_point.sh
mono/tests/Makefile.am
mono/tests/bug-29585.cs [new file with mode: 0644]
mono/utils/mach-support.c
mono/utils/mono-os-semaphore.h
mono/utils/mono-proclib.c
mono/utils/mono-threads-mach-abort-syscall.c
mono/utils/mono-threads-mach.c

index 8c7937a9e7cc3f61f9ceb6a9d6f19fefdf1672b0..836ed963de7fc898e60062175babeca17e67520b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 8c7937a9e7cc3f61f9ceb6a9d6f19fefdf1672b0
+Subproject commit 836ed963de7fc898e60062175babeca17e67520b
index 6bf570842e7757c2ba86d3e6c1a7bbe7b90ba30d..28ca14e770e9695ca2bb8ef167532d01de8f0a4c 100644 (file)
@@ -1,8 +1,6 @@
 thisdir = class
 
-# Note that Mono.Security and System.Security aren't listed.
-# We may have to add those if 'mcs' starts using them.
-basic_SUBDIRS := corlib System System.XML System Mono.Security System.Core 
+basic_SUBDIRS := corlib Mono.Security System System.XML System.Core 
 
 # resgen is corlib specific so we need to wait until corlib is build
 # and build it just a step before first dll needs it
@@ -10,9 +8,9 @@ resgen_dir = ../tools/resgen
 
 build_SUBDIRS :=  \
        corlib \
+       Mono.Security \
        System \
        System.XML \
-       System Mono.Security \
        Mono.Posix \
        System.Core \
        Mono.Cecil \
@@ -22,11 +20,10 @@ pcl_facade_dirs := Facades
 
 mobile_common_dirs := \
        corlib  \
+       Mono.Security \
        System  \
        System.Core     \
        System.XML      \
-       Mono.Security   \
-       System  \
        I18N            \
        System.ServiceModel.Internals   \
        SMDiagnostics   \
@@ -82,6 +79,7 @@ monotouch_tv_dirs   := $(monotouch_dirs)
 
 monotouch_runtime_dirs := \
        corlib \
+       Mono.Security \
        System \
        System.Core \
        System.XML \
@@ -92,12 +90,11 @@ monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs)
 
 xammac_4_5_dirs := \
        corlib  \
+       Mono.Security \
        System  \
        Mono.Posix                      \
        System.Core     \
        System.XML      \
-       Mono.Security   \
-       System  \
        I18N            \
        System.ServiceModel.Internals   \
        SMDiagnostics   \
@@ -140,12 +137,12 @@ xammac_4_5_dirs := \
 
 net_4_x_dirs := \
        corlib                          \
+       Mono.Security \
        System                          \
        System.XML                      \
        Mono.CompilerServices.SymbolWriter \
        Mono.Posix                      \
        System.Core                     \
-       Mono.Security                   \
        System.Security                 \
        System.Configuration    \
        $(resgen_dir)                   \
index 74ff995dd868b5cd03e87657edcd24cd7ae4b03b..3adbdbf3917b8b3ab8e8be7411a7b8b0dd40c82c 100644 (file)
@@ -50,7 +50,7 @@ TXT_RESOURCE_STRINGS = ../../../external/referencesource/System/System.txt
 ifdef MOBILE_PROFILE
 LIB_MCS_FLAGS += -d:INSIDE_SYSTEM -d:SECURITY_DEP
 else
-EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS -d:MONO_X509_ALIAS
+EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS
 endif
 
 #
@@ -59,7 +59,7 @@ endif
 ifeq (secxml/, $(intermediate))
 LOCAL_MCS_FLAGS =
 LIB_REFS += bare/System.Xml MonoSecurity=Mono.Security
-LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(bare_libdir)/System.dll $(EXTERN_ALIAS_FLAGS)
+LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP $(EXTERN_ALIAS_FLAGS)
 endif
 
 #
@@ -67,7 +67,7 @@ endif
 #
 ifndef intermediate
 LIB_REFS += System.Xml MonoSecurity=Mono.Security
-LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP -r:PrebuiltSystem=$(secxml_libdir)/System.dll $(EXTERN_ALIAS_FLAGS)
+LIB_MCS_FLAGS += -d:SECURITY_DEP -d:XML_DEP $(EXTERN_ALIAS_FLAGS)
 
 ifndef MOBILE_PROFILE
 LIB_REFS += System.Configuration
index 6ae2b9f3ca8d7d2ef1cc06fc06d4ab80a73f3fda..e79c167c01ecec86236184b3a72cbe33d752d8a7 100644 (file)
@@ -26,9 +26,6 @@
 
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -38,13 +35,6 @@ using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-using XX509Chain = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509Chain;
-#else
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-using XX509Chain = System.Security.Cryptography.X509Certificates.X509Chain;
-#endif
 
 using System;
 using System.IO;
@@ -64,7 +54,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (h, c, ch, e) => callback (h, c, (X509Chain)(object)ch, (SslPolicyErrors)e);
+                       return (h, c, ch, e) => callback (h, c, ch, (SslPolicyErrors)e);
                }
 
                internal static MSI.MonoLocalCertificateSelectionCallback PublicToMono (LocalCertificateSelectionCallback callback)
@@ -72,7 +62,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (t, lc, rc, ai) => callback (null, t, (XX509CertificateCollection)(object)lc, rc, ai);
+                       return (t, lc, rc, ai) => callback (null, t, lc, rc, ai);
                }
 
                internal static MSI.MonoRemoteCertificateValidationCallback InternalToMono (RemoteCertValidationCallback callback)
@@ -80,7 +70,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (h, c, ch, e) => callback (h, c, (X509Chain)(object)ch, (SslPolicyErrors)e);
+                       return (h, c, ch, e) => callback (h, c, ch, (SslPolicyErrors)e);
                }
 
                internal static RemoteCertificateValidationCallback InternalToPublic (string hostname, RemoteCertValidationCallback callback)
@@ -96,7 +86,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (t, lc, rc, ai) => callback (t, (XX509CertificateCollection)(object)lc, rc, ai);
+                       return (t, lc, rc, ai) => callback (t, lc, rc, ai);
                }
 
                internal static RemoteCertificateValidationCallback MonoToPublic (MSI.MonoRemoteCertificateValidationCallback callback)
@@ -104,7 +94,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (t, c, ch, e) => callback (null, c, (XX509Chain)(object)ch, (MSI.MonoSslPolicyErrors)e);
+                       return (t, c, ch, e) => callback (null, c, ch, (MSI.MonoSslPolicyErrors)e);
                }
 
                internal static LocalCertificateSelectionCallback MonoToPublic (MSI.MonoLocalCertificateSelectionCallback callback)
@@ -112,7 +102,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (s, t, lc, rc, ai) => callback (t, (XX509CertificateCollection)(object)lc, rc, ai);
+                       return (s, t, lc, rc, ai) => callback (t, lc, rc, ai);
                }
 
                internal static RemoteCertValidationCallback MonoToInternal (MSI.MonoRemoteCertificateValidationCallback callback)
@@ -120,7 +110,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (h, c, ch, e) => callback (h, c, (XX509Chain)(object)ch, (MSI.MonoSslPolicyErrors)e);
+                       return (h, c, ch, e) => callback (h, c, ch, (MSI.MonoSslPolicyErrors)e);
                }
 
                internal static LocalCertSelectionCallback MonoToInternal (MSI.MonoLocalCertificateSelectionCallback callback)
@@ -128,7 +118,7 @@ namespace Mono.Net.Security.Private
                        if (callback == null)
                                return null;
 
-                       return (t, lc, rc, ai) => callback (t, (XX509CertificateCollection)(object)lc, rc, ai);
+                       return (t, lc, rc, ai) => callback (t, lc, rc, ai);
                }
 
        }
index 9a5eab25ce6f4aee6f104fb0eb41ef4479c53c2c..5d2812d2738e4c51c72af55564a3e3c95356e0c4 100644 (file)
@@ -34,9 +34,6 @@
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
@@ -47,13 +44,8 @@ using Mono.Security.Interface;
 using MSX = Mono.Security.X509;
 using Mono.Security.X509.Extensions;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-using XX509Chain = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509Chain;
-#else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
 using XX509Chain = System.Security.Cryptography.X509Certificates.X509Chain;
-#endif
 
 using System;
 using System.Net;
@@ -257,7 +249,7 @@ namespace Mono.Net.Security
                public ValidationResult ValidateCertificate (string host, bool serverMode, X509Certificate leaf, XX509Chain xchain)
                {
                        try {
-                               var chain = (X509Chain)(object)xchain;
+                               var chain = xchain;
                                var result = ValidateChain (host, serverMode, leaf, chain, null, 0);
                                if (tlsStream != null)
                                        tlsStream.CertificateValidationFailed = result == null || !result.Trusted || result.UserDenied;
@@ -326,9 +318,9 @@ namespace Mono.Net.Security
                        bool providerValidated = false;
                        if (provider != null && provider.HasCustomSystemCertificateValidator) {
                                var xerrors = (MonoSslPolicyErrors)errors;
-                               var xchain = (XX509Chain)(object)chain;
+                               var xchain = chain;
                                providerValidated = provider.InvokeSystemCertificateValidator (this, host, server, certs, wantsChain, ref xchain, out result, ref xerrors, ref status11);
-                               chain = (X509Chain)(object)xchain;
+                               chain = xchain;
                                errors = (SslPolicyErrors)xerrors;
                        } else if (wantsChain) {
                                chain = SystemCertificateValidator.CreateX509Chain (certs);
@@ -363,7 +355,7 @@ namespace Mono.Net.Security
 
                public bool InvokeSystemValidator (string targetHost, bool serverMode, XX509CertificateCollection certificates, XX509Chain xchain, ref MonoSslPolicyErrors xerrors, ref int status11)
                {
-                       X509Chain chain = (X509Chain)(object)xchain;
+                       X509Chain chain = xchain;
                        var errors = (SslPolicyErrors)xerrors;
                        var result = SystemCertificateValidator.Evaluate (settings, targetHost, certificates, chain, ref errors, ref status11);
                        xerrors = (MonoSslPolicyErrors)errors;
index 50193cc2ec19c6461764e14b83677de04c00ad1f..69daf52111386fec045981afd515d03864d37d0c 100644 (file)
 // THE SOFTWARE.
 
 #if SECURITY_DEP
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
 
-#if MONO_X509_ALIAS
-using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 #if MONO_SECURITY_ALIAS
 using MSI = MonoSecurity::Mono.Security.Interface;
 #else
index 478ed585b59c2956d8c6d0aa0fd2c115cb3405f0..50b4cd9c8c460de1aee7dd57382fe1eb0b204326 100644 (file)
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
 #else
 using Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
 #endif
-#endif
 
 using System;
 using System.IO;
index ab0bc51897425ca78a33ef4061ab0ffb0d78b5ad..1a6672f6c5c36f634b575715a611d14148e86c0a 100644 (file)
@@ -34,9 +34,6 @@
 
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -56,9 +53,6 @@ using MonoSecurityProtocolType = Mono.Security.Protocol.Tls.SecurityProtocolType
 using Mono.Security.Protocol.Tls;
 using Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
 using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
index d6f6e5296f454a65ac7ca9f27b6d3e001087e539..7ea40e1940172a2d422936d04fe51d0431956a69 100644 (file)
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 #if SECURITY_DEP
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
 
-#if MONO_X509_ALIAS
-using XHttpWebRequest = PrebuiltSystem::System.Net.HttpWebRequest;
-using XSslProtocols = PrebuiltSystem::System.Security.Authentication.SslProtocols;
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
 using XHttpWebRequest = System.Net.HttpWebRequest;
 using XSslProtocols = System.Security.Authentication.SslProtocols;
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
index dfb5c8c450ac60d1be017d770bff0d34748956da..776751537bdae8df69c5134c20ade5c097c65eb5 100644 (file)
@@ -26,9 +26,6 @@
 
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -38,27 +35,6 @@ using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-
-using XTransportContext = PrebuiltSystem::System.Net.TransportContext;
-using XAuthenticatedStream = PrebuiltSystem::System.Net.Security.AuthenticatedStream;
-
-using XCipherAlgorithmType = PrebuiltSystem::System.Security.Authentication.CipherAlgorithmType;
-using XHashAlgorithmType = PrebuiltSystem::System.Security.Authentication.HashAlgorithmType;
-using XExchangeAlgorithmType = PrebuiltSystem::System.Security.Authentication.ExchangeAlgorithmType;
-using XSslProtocols = PrebuiltSystem::System.Security.Authentication.SslProtocols;
-#else
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-
-using XTransportContext = System.Net.TransportContext;
-using XAuthenticatedStream = System.Net.Security.AuthenticatedStream;
-
-using XCipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
-using XHashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
-using XExchangeAlgorithmType = System.Security.Authentication.ExchangeAlgorithmType;
-using XSslProtocols = System.Security.Authentication.SslProtocols;
-#endif
 
 using System;
 using System.IO;
@@ -96,9 +72,9 @@ namespace Mono.Net.Security.Private
                        Impl.AuthenticateAsClient (targetHost);
                }
 
-               public void AuthenticateAsClient (string targetHost, XX509CertificateCollection clientCertificates, XSslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       Impl.AuthenticateAsClient (targetHost, clientCertificates, (SslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
@@ -106,9 +82,9 @@ namespace Mono.Net.Security.Private
                        return Impl.BeginAuthenticateAsClient (targetHost, asyncCallback, asyncState);
                }
 
-               public IAsyncResult BeginAuthenticateAsClient (string targetHost, XX509CertificateCollection clientCertificates, XSslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
+               public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, (SslProtocols)enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
+                       return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
                }
 
                public void EndAuthenticateAsClient (IAsyncResult asyncResult)
@@ -121,9 +97,9 @@ namespace Mono.Net.Security.Private
                        Impl.AuthenticateAsServer (serverCertificate);
                }
 
-               public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, XSslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, (SslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
@@ -131,9 +107,9 @@ namespace Mono.Net.Security.Private
                        return Impl.BeginAuthenticateAsServer (serverCertificate, asyncCallback, asyncState);
                }
 
-               public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, XSslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
+               public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, (SslProtocols)enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
+                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
                }
 
                public void EndAuthenticateAsServer (IAsyncResult asyncResult)
@@ -146,9 +122,9 @@ namespace Mono.Net.Security.Private
                        return Impl.AuthenticateAsClientAsync (targetHost);
                }
 
-               public Task AuthenticateAsClientAsync (string targetHost, XX509CertificateCollection clientCertificates, XSslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, (SslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
@@ -156,9 +132,9 @@ namespace Mono.Net.Security.Private
                        return Impl.AuthenticateAsServerAsync (serverCertificate);
                }
 
-               public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, XSslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, (SslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public void Flush ()
@@ -201,8 +177,8 @@ namespace Mono.Net.Security.Private
                        Impl.EndWrite (asyncResult);
                }
 
-               public XTransportContext TransportContext {
-                       get { return (XTransportContext)(object)Impl.TransportContext; }
+               public TransportContext TransportContext {
+                       get { return Impl.TransportContext; }
                }
 
                public bool IsAuthenticated {
@@ -225,24 +201,24 @@ namespace Mono.Net.Security.Private
                        get { return Impl.IsServer; }
                }
 
-               public XCipherAlgorithmType CipherAlgorithm {
-                       get { return (XCipherAlgorithmType)Impl.CipherAlgorithm; }
+               public CipherAlgorithmType CipherAlgorithm {
+                       get { return Impl.CipherAlgorithm; }
                }
 
                public int CipherStrength {
                        get { return Impl.CipherStrength; }
                }
 
-               public XHashAlgorithmType HashAlgorithm {
-                       get { return (XHashAlgorithmType)Impl.HashAlgorithm; }
+               public HashAlgorithmType HashAlgorithm {
+                       get { return Impl.HashAlgorithm; }
                }
 
                public int HashStrength {
                        get { return Impl.HashStrength; }
                }
 
-               public XExchangeAlgorithmType KeyExchangeAlgorithm {
-                       get { return (XExchangeAlgorithmType)Impl.KeyExchangeAlgorithm; }
+               public ExchangeAlgorithmType KeyExchangeAlgorithm {
+                       get { return Impl.KeyExchangeAlgorithm; }
                }
 
                public int KeyExchangeStrength {
@@ -274,8 +250,8 @@ namespace Mono.Net.Security.Private
                        Impl.SetLength (value);
                }
 
-               public XAuthenticatedStream AuthenticatedStream {
-                       get { return (XAuthenticatedStream)(Stream)Impl.AuthenticatedStream; }
+               public AuthenticatedStream AuthenticatedStream {
+                       get { return Impl.AuthenticatedStream; }
                }
 
                public int ReadTimeout {
@@ -304,8 +280,8 @@ namespace Mono.Net.Security.Private
                        get { return Impl.RemoteCertificate; }
                }
 
-               public XSslProtocols SslProtocol {
-                       get { return (XSslProtocols)Impl.SslProtocol; }
+               public SslProtocols SslProtocol {
+                       get { return Impl.SslProtocol; }
                }
 
                public MSI.MonoTlsProvider Provider {
index 92f88fe1e0559344bd8ad7bfa0c5d4ebb28c87af..0cf6d394bb7da92c8b500c4c13e2a17db3511f09 100644 (file)
@@ -26,9 +26,6 @@
 
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -38,17 +35,6 @@ using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XSslProtocols = PrebuiltSystem::System.Security.Authentication.SslProtocols;
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using XSslProtocols = System.Security.Authentication.SslProtocols;
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
-
-using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
-using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
-using ExchangeAlgorithmType = System.Security.Authentication.ExchangeAlgorithmType;
 
 using System;
 using System.IO;
@@ -84,9 +70,9 @@ namespace Mono.Net.Security.Private
                        Impl.AuthenticateAsClient (targetHost);
                }
 
-               public void AuthenticateAsClient (string targetHost, XX509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       Impl.AuthenticateAsClient (targetHost, (XX509CertificateCollection)(object)clientCertificates, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
@@ -94,9 +80,9 @@ namespace Mono.Net.Security.Private
                        return Impl.BeginAuthenticateAsClient (targetHost, asyncCallback, asyncState);
                }
 
-               public IAsyncResult BeginAuthenticateAsClient (string targetHost, XX509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
+               public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       return Impl.BeginAuthenticateAsClient (targetHost, (XX509CertificateCollection)(object)clientCertificates, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
+                       return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
                }
 
                public void EndAuthenticateAsClient (IAsyncResult asyncResult)
@@ -111,7 +97,7 @@ namespace Mono.Net.Security.Private
 
                public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
@@ -121,7 +107,7 @@ namespace Mono.Net.Security.Private
 
                public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
+                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
                }
 
                public void EndAuthenticateAsServer (IAsyncResult asyncResult)
@@ -134,9 +120,9 @@ namespace Mono.Net.Security.Private
                        return Impl.AuthenticateAsClientAsync (targetHost);
                }
 
-               public Task AuthenticateAsClientAsync (string targetHost, XX509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
@@ -146,7 +132,7 @@ namespace Mono.Net.Security.Private
 
                public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public void Flush ()
@@ -190,7 +176,7 @@ namespace Mono.Net.Security.Private
                }
 
                public TransportContext TransportContext {
-                       get { return (TransportContext)(object)Impl.TransportContext; }
+                       get { return Impl.TransportContext; }
                }
 
                public bool IsAuthenticated {
@@ -263,7 +249,7 @@ namespace Mono.Net.Security.Private
                }
 
                public AuthenticatedStream AuthenticatedStream {
-                       get { return (AuthenticatedStream)(object)Impl.AuthenticatedStream; }
+                       get { return Impl.AuthenticatedStream; }
                }
 
                public int ReadTimeout {
index b0ae5d82c724627ca2360a856b159af606f23104..94f86ca7e747ce244abda4cc8846ce821256270b 100644 (file)
@@ -26,9 +26,6 @@
 
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -38,13 +35,6 @@ using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XHttpWebRequest = PrebuiltSystem::System.Net.HttpWebRequest;
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using XHttpWebRequest = System.Net.HttpWebRequest;
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System;
 using System.IO;
@@ -84,13 +74,13 @@ namespace Mono.Net.Security.Private
 
                MSI.IMonoTlsContext IMonoTlsProvider.CreateTlsContext (
                        string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, XX509CertificateCollection clientCertificates,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
                        bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus,
                        MSI.MonoEncryptionPolicy encryptionPolicy, MSI.MonoTlsSettings settings)
                {
                        return CreateTlsContextImpl (
                                hostname, serverMode, protocolFlags,
-                               serverCertificate, (X509CertificateCollection)(object)clientCertificates,
+                               serverCertificate, clientCertificates,
                                remoteCertRequired, encryptionPolicy, settings);
                }
 
@@ -102,13 +92,13 @@ namespace Mono.Net.Security.Private
 
                internal override MSI.IMonoTlsContext CreateTlsContext (
                        string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, XX509CertificateCollection clientCertificates,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
                        bool remoteCertRequired, MSI.MonoEncryptionPolicy encryptionPolicy,
                        MSI.MonoTlsSettings settings)
                {
                        return CreateTlsContextImpl (
                                hostname, serverMode, (MSI.TlsProtocols)protocolFlags,
-                               serverCertificate, (X509CertificateCollection)(object)clientCertificates,
+                               serverCertificate, clientCertificates,
                                remoteCertRequired, (MSI.MonoEncryptionPolicy)encryptionPolicy,
                                settings);
                }
index e2ec0f5a01318b9fefbdfafab0df60f45450c8a3..15283200590899b85f606eb3a2acfc9a08c6a9bb 100644 (file)
@@ -26,9 +26,6 @@
 
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -38,13 +35,6 @@ using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XHttpWebRequest = PrebuiltSystem::System.Net.HttpWebRequest;
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using XHttpWebRequest = System.Net.HttpWebRequest;
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System;
 using System.IO;
@@ -86,13 +76,13 @@ namespace Mono.Net.Security.Private
 
                public MSI.IMonoTlsContext CreateTlsContext (
                        string hostname, bool serverMode, MSI.TlsProtocols protocolFlags,
-                       X509Certificate serverCertificate, XX509CertificateCollection clientCertificates,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
                        bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus,
                        MSI.MonoEncryptionPolicy encryptionPolicy, MSI.MonoTlsSettings settings)
                {
                        return provider.CreateTlsContext (
                                hostname, serverMode, protocolFlags,
-                               serverCertificate, (XX509CertificateCollection)(object)clientCertificates,
+                               serverCertificate, clientCertificates,
                                remoteCertRequired, (MSI.MonoEncryptionPolicy)encryptionPolicy,
                                settings);
                }
index 96f5933dfb7ba0608ad4f5827671eb23bb390d37..58479df9fba6942c75eff0c548ec913f95f84cc0 100644 (file)
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
 #else
 using Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
 #endif
-#endif
 
 using System;
 using System.IO;
@@ -104,7 +97,7 @@ namespace Mono.Net.Security
 
                        try {
                                sslStream.AuthenticateAsClient (
-                                       request.Address.Host, (XX509CertificateCollection)(object)request.ClientCertificates,
+                                       request.Address.Host, request.ClientCertificates,
                                        (SslProtocols)ServicePointManager.SecurityProtocol,
                                        ServicePointManager.CheckCertificateRevocationList);
 
index 8cd1ca0b6fac8de068150a1b0e18f3342ce8a7c0..55969818a8b5d4299725c0e5f81129020d1f9366 100644 (file)
@@ -3,9 +3,6 @@
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
@@ -16,13 +13,8 @@ using Mono.Security.Interface;
 using MSX = Mono.Security.X509;
 using Mono.Security.X509.Extensions;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-using XX509Chain = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509Chain;
-#else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
 using XX509Chain = System.Security.Cryptography.X509Certificates.X509Chain;
-#endif
 
 using System;
 using System.Net;
index 629617f60312967c794b5f3a526de8eed72ed531..a0cb8d5019380a67cb9c638fcb083bcdf085cf87 100644 (file)
@@ -28,9 +28,6 @@
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MX = MonoSecurity::Mono.Security.X509;
@@ -39,11 +36,6 @@ using MonoSecurity::Mono.Security.Interface;
 using MX = Mono.Security.X509;
 using Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System.Runtime.InteropServices;
 using System.Security.Authentication.ExtendedProtection;
@@ -73,7 +65,7 @@ namespace System.Net.Security
 
        internal static class GlobalSSPI
        {
-               internal static SSPIInterface Create (string hostname, bool serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, XX509CertificateCollection clientCertificates,
+               internal static SSPIInterface Create (string hostname, bool serverMode, SchProtocols protocolFlags, X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
                                                           bool remoteCertRequired, bool checkCertName, bool checkCertRevocationStatus, EncryptionPolicy encryptionPolicy,
                                                           LocalCertSelectionCallback certSelectionDelegate, RemoteCertValidationCallback remoteValidationCallback, SSPIConfiguration userConfig)
                {
@@ -226,7 +218,7 @@ namespace System.Net.Security
 
                internal static X509Certificate2 GetRemoteCertificate (SafeDeleteContext safeContext, out X509Certificate2Collection remoteCertificateStore)
                {
-                       XX509CertificateCollection monoCollection;
+                       X509CertificateCollection monoCollection;
                        if (safeContext == null || safeContext.IsInvalid) {
                                remoteCertificateStore = null;
                                return null;
index 2e739291d3412dce486ffaa9063cfa6711afdfd4..2abea7293f9ecff95358518babcdca29382258f9 100644 (file)
@@ -29,9 +29,6 @@
 //
 
 #if CONFIGURATION_DEP
-extern alias PrebuiltSystem;
-using TypeDescriptor = PrebuiltSystem.System.ComponentModel.TypeDescriptor;
-
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
index 57aa6b19880683f76b923e984e4d92e4fc3d81eb..7a0bd6ef5dff7a556ba5159e668a4887b9b1acb6 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if CONFIGURATION_DEP
-extern alias PrebuiltSystem;
-using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
-#endif
-
 using System.Reflection;
 using System.Collections.Specialized;
 
index 58ebcd7a5f73ee56af0dc156aee11fcd6c1df9f1..6b12f95425b8433a45d4def40764bc34067ccb2d 100644 (file)
 // Copyright (C) 2005, 2006 Novell, Inc (http://www.novell.com)
 //
 
-#if CONFIGURATION_DEP
-extern alias PrebuiltSystem;
-using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
-#endif
 #if CONFIGURATION_DEP
 using System.IO;
 using System.Xml.Serialization;
index 968532966e3d13de35882a06802f6fbbe507413c..9b2f8e9986b8768ff7ae95a95620bbb19cb9d7a1 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if CONFIGURATION_DEP
-extern alias PrebuiltSystem;
-using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
-#endif
-
 using System;
 using System.Collections;
 using System.Collections.Specialized;
index 31d56ce09eb38acf77a1e3a2a9ab1466b66b1266..d74a226f1e77042ed2668b56212b96a03e6a22b8 100644 (file)
 
 #if CONFIGURATION_DEP
 
-extern alias PrebuiltSystem;
-
 using System;
 using System.Collections;
 using System.Collections.Generic;
+using System.Collections.Specialized;
 using System.Configuration;
 using System.Globalization;
 using System.IO;
@@ -42,8 +41,6 @@ using System.Security.Cryptography;
 using System.Text;
 using System.Xml;
 
-using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
-
 namespace System.Configuration
 {
        // location to store user configuration settings.
index d0ca5ab0a48b838a95eb18378f4e3209b4f89859..10664ca266bc2aef89b312b67d4e00fb82edb00e 100644 (file)
 //
 
 #if CONFIGURATION_DEP
-#if CONFIGURATION_DEP
-extern alias PrebuiltSystem;
-using NameValueCollection = PrebuiltSystem.System.Collections.Specialized.NameValueCollection;
-#endif
 
 using System;
 using System.Collections.Specialized;
index 7570bd68915a6bae106f07711448e995918d1d32..778671764ea91a8f8b9bcc563e60b0b68d9d0fdd 100644 (file)
@@ -617,14 +617,14 @@ namespace System.IO {
                                return;
 
                        // e.Name
-                       string name = path.Substring (fullPathNoLastSlash.Length + 1); 
+                       string name = (path.Length > fullPathNoLastSlash.Length) ? path.Substring (fullPathNoLastSlash.Length + 1) : String.Empty;
 
                        // only post events that match filter pattern. check both old and new paths for renames
                        if (!fsw.Pattern.IsMatch (path) && (newPath == null || !fsw.Pattern.IsMatch (newPath)))
                                return;
                                
                        if (action == FileAction.RenamedNewName) {
-                               string newName = newPath.Substring (fullPathNoLastSlash.Length + 1);
+                               string newName = (newPath.Length > fullPathNoLastSlash.Length) ? newPath.Substring (fullPathNoLastSlash.Length + 1) : String.Empty;
                                renamed = new RenamedEventArgs (WatcherChangeTypes.Renamed, fsw.Path, newName, name);
                        }
                                
index 0e89b187d1a97a216d0677c1cfb612e88cfb97eb..ff881b00bcc9a6df8a457c16e23d134a2ebcef16 100644 (file)
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using X509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 using System.Security.Cryptography.X509Certificates;
 #endif
 
index 5d0d9b75471a55d28cf32dbf9157559087bae2c9..9b77646d7b1502b669d501fcd04bd3e9197c687c 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 #if SECURITY_DEP && !MONO_FEATURE_NEW_TLS
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System.Security.Cryptography.X509Certificates;
 
index 652c91e143fc6d4e18463b192fcfae99c4f9d07b..9238428b1f3841de180dc5f09f3944336a9d82d1 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 #if !MONO_FEATURE_NEW_TLS
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System.Security.Cryptography.X509Certificates;
 
index 53e6d2918577369637da3f522ced844a316bb82a..59e741722b67b820861fb63af0005b004087397c 100644 (file)
@@ -27,9 +27,6 @@
 #if !MONO_FEATURE_NEW_TLS
 #if SECURITY_DEP
 
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
@@ -39,13 +36,6 @@ using MonoSecurity::Mono.Security.Interface;
 #else
 using Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XSslProtocols = PrebuiltSystem::System.Security.Authentication.SslProtocols;
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using XSslProtocols = System.Security.Authentication.SslProtocols;
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using CipherAlgorithmType = System.Security.Authentication.CipherAlgorithmType;
 using HashAlgorithmType = System.Security.Authentication.HashAlgorithmType;
@@ -80,7 +70,7 @@ namespace System.Net.Security
 
        internal delegate X509Certificate LocalCertSelectionCallback (
                string targetHost,
-               XX509CertificateCollection localCertificates,
+               X509CertificateCollection localCertificates,
                X509Certificate remoteCertificate,
                string[] acceptableIssuers);
 
@@ -146,9 +136,9 @@ namespace System.Net.Security
                        Impl.AuthenticateAsClient (targetHost);
                }
 
-               public virtual void AuthenticateAsClient (string targetHost, XX509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public virtual void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       Impl.AuthenticateAsClient (targetHost, (XX509CertificateCollection)(object)clientCertificates, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       Impl.AuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
                }
 
                // [HostProtection (ExternalThreading=true)]
@@ -158,9 +148,9 @@ namespace System.Net.Security
                }
 
                // [HostProtection (ExternalThreading=true)]
-               public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, XX509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
+               public virtual IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       return Impl.BeginAuthenticateAsClient (targetHost, (XX509CertificateCollection)(object)clientCertificates, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
+                       return Impl.BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
                }
 
                public virtual void EndAuthenticateAsClient (IAsyncResult asyncResult)
@@ -175,7 +165,7 @@ namespace System.Net.Security
 
                public virtual void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       Impl.AuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
                // [HostProtection (ExternalThreading=true)]
@@ -186,7 +176,7 @@ namespace System.Net.Security
 
                public virtual IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
+                       return Impl.BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, asyncCallback, asyncState);
                }
 
                public virtual void EndAuthenticateAsServer (IAsyncResult asyncResult)
@@ -206,9 +196,9 @@ namespace System.Net.Security
                        return Impl.AuthenticateAsClientAsync (targetHost);
                }
 
-               public virtual Task AuthenticateAsClientAsync (string targetHost, XX509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
+               public virtual Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       return Impl.AuthenticateAsClientAsync (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
@@ -218,7 +208,7 @@ namespace System.Net.Security
 
                public virtual Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, (XSslProtocols)enabledSslProtocols, checkCertificateRevocation);
+                       return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
                public override bool IsAuthenticated {
index 885eaf3ea3df14566dcf0a32bf21e653d1314be9..b9940eb07d89585b683f2904aa1b0fb49aa84157 100644 (file)
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MSI = MonoSecurity::Mono.Security.Interface;
 #else
 using MSI = Mono.Security.Interface;
 #endif
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
-using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System.IO;
 using System.Net.Sockets;
index 71eb71e31062c3b5704713a2573ef4caf2fda9c3..e0c3ed84318073bd271c8ffa07f2e9b7566554a9 100644 (file)
@@ -27,8 +27,6 @@
 //
 #if CONFIGURATION_DEP
 
-extern alias PrebuiltSystem;
-
 using System;
 using System.Collections;
 using System.Collections.Generic;
@@ -42,8 +40,6 @@ using System.Runtime.Serialization;
 using System.Text;
 using System.Xml;
 
-using TypeConverter = PrebuiltSystem::System.ComponentModel.TypeConverter;
-
 namespace System.Security.Authentication.ExtendedProtection.Configuration
 {
        internal static class ConfigUtil
index 00384f45901270d01bb3ee3898854634e834e3b5..695f5e822209a0964b0c604cdca50c421e48c52c 100644 (file)
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 #if SECURITY_DEP
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
-#if MONO_X509_ALIAS
-using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
-#endif
 
 using System;
 using System.Runtime.InteropServices;
index ffd54a737b9a8e95eb15d6b52ee7fca891f5e2da..2a9163a346f89ae143e7477b9215c67659f5e875 100644 (file)
@@ -30,9 +30,6 @@
 #if MONO_SECURITY_ALIAS
 extern alias MonoSecurity;
 #endif
-#if MONO_X509_ALIAS
-extern alias PrebuiltSystem;
-#endif
 
 #if MONO_SECURITY_ALIAS
 using MonoSecurity::Mono.Security.Interface;
@@ -59,7 +56,7 @@ namespace System.Security.Cryptography.X509Certificates
                        var provider = MonoTlsProviderFactory.GetProvider ();
                        if (provider.HasNativeCertificates) {
                                var impl = provider.GetNativeCertificate (rawData, password, keyStorageFlags);
-                               return (X509Certificate2Impl)(object)impl;
+                               return impl;
                        } else {
                                var impl = new X509Certificate2ImplMono ();
                                impl.Import (rawData, password, keyStorageFlags);
@@ -72,7 +69,7 @@ namespace System.Security.Cryptography.X509Certificates
                        var provider = MonoTlsProviderFactory.GetProvider ();
                        if (provider.HasNativeCertificates) {
                                var impl = provider.GetNativeCertificate (cert);
-                               return (X509Certificate2Impl)(object)impl;
+                               return impl;
                        }
                        var impl2 = cert.Impl as X509Certificate2Impl;
                        if (impl2 != null)
index 11e81774310f6912bbf366272d4a7334cd2db67a..6cdc052f4fb97f8b2d630733e32e5a69a9b814bc 100644 (file)
@@ -39,7 +39,7 @@ namespace MonoTests.System.Security.Cryptography {
                public void Ctor () 
                {
                        var cp = new CspParameters ();
-                       Assert.AreEqual (24, cp.ProviderType);
+                       Assert.AreEqual (1, cp.ProviderType);
                }
        }
 }
index 723b603c5f26ed85bd85dcfc73f9826ccc440817..9fb47abf6d486d9ba4d78811a9d0e68f420f3d13 100644 (file)
@@ -1,4 +1,4 @@
-// CS0029: Cannot implicitly convert type `B [cs0029-26, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]' to `B [CS0029-26-lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=36f3ae7e947792e3]'
+// CS0029: Cannot implicitly convert type `B [cs0029-26, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -- *PATH*/cs0029-26.cs]' to `B [CS0029-26-lib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=36f3ae7e947792e3 -- *PATH*/CS0029-26-lib.dll]'
 // Line: 16
 // Compiler options: -r:R1=CS0029-26-lib.dll
 
index 145f222bdcd39d2f100c230845024b4881b99258..be79b14e86fc012de410ccd9af58bed2de6727f2 100644 (file)
@@ -4647,7 +4647,7 @@ namespace Mono.CSharp {
                ///     false if candidate ain't better
                ///     true  if candidate is better than the current best match
                /// </remarks>
-               static bool BetterFunction (ResolveContext ec, Arguments args, MemberSpec candidate, AParametersCollection cparam, bool candidate_params,
+               bool BetterFunction (ResolveContext ec, Arguments args, MemberSpec candidate, AParametersCollection cparam, bool candidate_params,
                        MemberSpec best, AParametersCollection bparam, bool best_params)
                {
                        AParametersCollection candidate_pd = ((IParametersMember) candidate).Parameters;
@@ -4705,6 +4705,12 @@ namespace Mono.CSharp {
                                // for each argument, the conversion to 'ct' should be no worse than 
                                // the conversion to 'bt'.
                                if (result == 2) {
+                                       //
+                                       // No optional parameters tie breaking rules for delegates overload resolution
+                                       //
+                                       if ((this.restrictions & Restrictions.CovariantDelegate) != 0)
+                                               return false;
+
                                        better_at_least_one = false;
 
                                        ++j;
index 81894f06c762ea1d6146e2e9d99905b2d3a7f4e1..fb02370dbb32cd2317827d323637b370d01e0048 100644 (file)
@@ -547,7 +547,15 @@ namespace Mono.CSharp
 
                public string GetSignatureForErrorIncludingAssemblyName ()
                {
-                       return string.Format ("{0} [{1}]", GetSignatureForError (), MemberDefinition.DeclaringAssembly.FullName);
+                       var imported = MemberDefinition.DeclaringAssembly as ImportedAssemblyDefinition;
+
+                       var location = imported != null ?
+                               System.IO.Path.GetFullPath (imported.Location) :
+                           ((MemberCore)MemberDefinition).Location.NameFullPath;
+
+                       return string.Format ("{0} [{1} -- {2}]", GetSignatureForError (),
+                                                                 MemberDefinition.DeclaringAssembly.FullName,
+                                                                 location);
                }
 
                protected virtual string GetTypeNameSignature ()
diff --git a/mcs/tests/gtest-optional-37.cs b/mcs/tests/gtest-optional-37.cs
new file mode 100644 (file)
index 0000000..f322ff6
--- /dev/null
@@ -0,0 +1,19 @@
+using System;
+
+class Test1
+{
+       static object Foo (int arg = 1, int arg2 = 2)
+       {
+               return null;
+       }
+
+       static object Foo (object arg, object arg2)
+       {
+               return null;
+       }
+
+       public static void Main ()
+       {
+               Func<int, int, object> o = Foo;
+       }
+}
\ No newline at end of file
index 12fdee1863bbe80ec80daecb95ac2060d531a884..30bf5ea7293b468b679e96149f4c48a38bb0529b 100644 (file)
       </method>
     </type>
   </test>
+  <test name="gtest-optional-37.cs">
+    <type name="Test1">
+      <method name="System.Object Foo(Int32, Int32)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="System.Object Foo(System.Object, System.Object)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>32</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="gtest-partial-01.cs">
     <type name="B`1[U]">
       <method name="Void .ctor()" attrs="6278">
index beafdfa555778472afda9b56e0d11d2fd3d52845..677403c049258a084fb8bfca2ebcbee87201c0cb 100644 (file)
@@ -1440,20 +1440,16 @@ namespace TestRunner {
                static bool TryToMatchErrorMessage (string actual, string expected)
                {
                        actual = actual.Replace ("\\", "/");
-                       var path_mask_start = expected.IndexOf ("*PATH*");
+                       var path_mask_start = expected.IndexOf ("*PATH*", StringComparison.Ordinal);
                        if (path_mask_start > 0 && actual.Length > path_mask_start) {
-                               var path_mask_continue = expected.Substring (path_mask_start + 6);
-                               var expected_continue = actual.IndexOf (path_mask_continue, path_mask_start);
-                               if (expected_continue > 0) {
-                                       var path = actual.Substring (path_mask_start, expected_continue - path_mask_start);
-                                       if (actual == expected.Replace ("*PATH*", path))
-                                               return true;
-
-                                       throw new ApplicationException (expected.Replace ("*PATH*", path));
+                               var parts = expected.Split (new [] { "*PATH*" }, StringSplitOptions.None);
+                               foreach (var part in parts) {
+                                       if (!actual.Contains (part))
+                                               return false;
                                }
                        }
 
-                       return false;
+                       return true;
                }
 
                bool HandleFailure (string file, CompilerError status)
index 6ac0f241ade40505cf481beed3438df489100aa6..103d817f180c918f639172c7a7afb2ea49f99c23 100644 (file)
@@ -48,7 +48,7 @@
     <Compile Include="AssemblyComparer.cs" />
     <Compile Include="ClassComparer.cs" />
     <Compile Include="ApiDiff.cs" />
-    <Compile Include="..\..\..\class\Mono.Options\Mono.Options\Options.cs">
+    <Compile Include="..\..\class\Mono.Options\Mono.Options\Options.cs">
       <Link>Options.cs</Link>
     </Compile>
     <Compile Include="ApiChange.cs" />
index 355d09916f80dd226ad46e488f59c7a1d8e956ef..17da478b5e9c1f089d76de0bc275da6ab5e21077 100644 (file)
@@ -1130,11 +1130,11 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
        result->sre_method = FALSE;
        result->signature = NULL;
 
-       if (!context->method_inst) {
+       if (iresult->context.method_inst) {
                /* Set the generic_container of the result to the generic_container of method */
                MonoGenericContainer *generic_container = mono_method_get_generic_container (method);
 
-               if (generic_container) {
+               if (generic_container && iresult->context.method_inst == generic_container->context.method_inst) {
                        result->is_generic = 1;
                        mono_method_set_generic_container (result, generic_container);
                }
index 445df5c8334ef7931c3c373c82a5168d71d8842b..e7148a823f68f457bcaebb95496b4d1114a35f7c 100644 (file)
@@ -502,7 +502,12 @@ mono_determine_physical_ram_available_size (void)
        mach_port_t host = mach_host_self();
        vm_size_t page_size;
        vm_statistics_data_t vmstat;
-       if (KERN_SUCCESS != host_statistics(host, HOST_VM_INFO, (host_info_t)&vmstat, &count)) {
+       kern_return_t ret;
+       do {
+               ret = host_statistics(host, HOST_VM_INFO, (host_info_t)&vmstat, &count);
+       } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS) {
                g_warning ("Mono was unable to retrieve memory usage!");
                return 0;
        }
index 4cbb36780a9efde8e17be894486b6d4763b370bc..bbd97e955df2a69003dafb75b8333c0bb505859b 100644 (file)
@@ -1242,16 +1242,14 @@ create_allocator (int atype, gboolean slowpath)
                g_assert_not_reached ();
        }
 
-       if (atype != ATYPE_SMALL) {
-               /* size += ALLOC_ALIGN - 1; */
-               mono_mb_emit_ldloc (mb, size_var);
-               mono_mb_emit_icon (mb, SGEN_ALLOC_ALIGN - 1);
-               mono_mb_emit_byte (mb, CEE_ADD);
-               /* size &= ~(ALLOC_ALIGN - 1); */
-               mono_mb_emit_icon (mb, ~(SGEN_ALLOC_ALIGN - 1));
-               mono_mb_emit_byte (mb, CEE_AND);
-               mono_mb_emit_stloc (mb, size_var);
-       }
+       /* size += ALLOC_ALIGN - 1; */
+       mono_mb_emit_ldloc (mb, size_var);
+       mono_mb_emit_icon (mb, SGEN_ALLOC_ALIGN - 1);
+       mono_mb_emit_byte (mb, CEE_ADD);
+       /* size &= ~(ALLOC_ALIGN - 1); */
+       mono_mb_emit_icon (mb, ~(SGEN_ALLOC_ALIGN - 1));
+       mono_mb_emit_byte (mb, CEE_AND);
+       mono_mb_emit_stloc (mb, size_var);
 
        /* if (size > MAX_SMALL_OBJ_SIZE) goto slowpath */
        if (atype != ATYPE_SMALL) {
index 10ac567111ec81b022d058662e3dbde0ec612375..1c45e375af5dffb372cc6b0338189ecee7e96d82 100644 (file)
 gboolean
 sgen_resume_thread (SgenThreadInfo *info)
 {
-       return thread_resume (info->client_info.info.native_handle) == KERN_SUCCESS;
+       kern_return_t ret;
+       do {
+               ret = thread_resume (info->client_info.info.native_handle);
+       } while (ret == KERN_ABORTED);
+       return ret == KERN_SUCCESS;
 }
 
 gboolean
@@ -51,11 +55,15 @@ sgen_suspend_thread (SgenThreadInfo *info)
        state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
        mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
 
-       ret = thread_suspend (info->client_info.info.native_handle);
+       do {
+               ret = thread_suspend (info->client_info.info.native_handle);
+       } while (ret == KERN_ABORTED);
        if (ret != KERN_SUCCESS)
                return FALSE;
 
-       ret = mono_mach_arch_get_thread_state (info->client_info.info.native_handle, state, &num_state);
+       do {
+               ret = mono_mach_arch_get_thread_state (info->client_info.info.native_handle, state, &num_state);
+       } while (ret == KERN_ABORTED);
        if (ret != KERN_SUCCESS)
                return FALSE;
 
@@ -117,7 +125,9 @@ sgen_thread_handshake (BOOL suspend)
                        if (!sgen_suspend_thread (info))
                                continue;
                } else {
-                       ret = thread_resume (info->client_info.info.native_handle);
+                       do {
+                               ret = thread_resume (info->client_info.info.native_handle);
+                       } while (ret == KERN_ABORTED);
                        if (ret != KERN_SUCCESS)
                                continue;
                }
index 856f0abf8797153ac0049e640442c89ba8097713..5b287062804ecc9f419b2b82186d9ce2ab9c4c96 100644 (file)
@@ -455,7 +455,7 @@ static void thread_cleanup (MonoInternalThread *thread)
        mono_release_type_locks (thread);
 
        /* Can happen when we attach the profiler helper thread in order to heapshot. */
-       if (!mono_thread_info_lookup (thread->tid)->tools_thread)
+       if (!mono_thread_info_lookup (MONO_UINT_TO_NATIVE_THREAD_ID (thread->tid))->tools_thread)
                mono_profiler_thread_end (thread->tid);
 
        if (thread == mono_thread_internal_current ()) {
@@ -730,7 +730,7 @@ static guint32 WINAPI start_wrapper_internal(void *data)
        if (internal->name && (internal->flags & MONO_THREAD_FLAG_NAME_SET)) {
                char *tname = g_utf16_to_utf8 (internal->name, internal->name_len, NULL, NULL, NULL);
                mono_profiler_thread_name (internal->tid, tname);
-               mono_thread_info_set_name (internal->tid, tname);
+               mono_thread_info_set_name (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid), tname);
                g_free (tname);
        }
        /* start_func is set only for unmanaged start functions */
index 2d789a2f1767d43ecfcbce86822b9ad78132ea56..d3f3cf2e952c82b946e69b7a834082609d318d2e 100644 (file)
@@ -5222,7 +5222,9 @@ get_new_trampoline_from_page (int tramp_type)
                /* allocate two contiguous pages of memory: the first page will contain the data (like a local constant pool)
                 * while the second will contain the trampolines.
                 */
-               ret = vm_allocate (mach_task_self (), &addr, psize * 2, VM_FLAGS_ANYWHERE);
+               do {
+                       ret = vm_allocate (mach_task_self (), &addr, psize * 2, VM_FLAGS_ANYWHERE);
+               } while (ret == KERN_ABORTED);
                if (ret != KERN_SUCCESS) {
                        g_error ("Cannot allocate memory for trampolines: %d", ret);
                        break;
index dd5800be728affba67579b0669a00558cdf9e00f..2bbd9f48dd4d50b49a9a29d939bda2fb2c849b3b 100644 (file)
@@ -1982,7 +1982,7 @@ mono_main (int argc, char* argv[])
 
        if (enable_profile) {
                mono_profiler_load (profile_options);
-               mono_profiler_thread_name (mono_native_thread_id_get (), "Main");
+               mono_profiler_thread_name (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()), "Main");
        }
 
        mono_attach_parse_options (attach_options);
index 587d08254e5f2143e2555a1d3bc579ddb2bb42e5..8bf63dcfbfe1b221dbc800d6924d91ea3a40e20e 100644 (file)
@@ -4230,7 +4230,7 @@ handle_alloc (MonoCompile *cfg, MonoClass *klass, gboolean for_box, int context_
                                if (size < sizeof (MonoObject))
                                        g_error ("Invalid size %d for class %s", size, mono_type_get_full_name (klass));
 
-                               EMIT_NEW_ICONST (cfg, iargs [1], mono_gc_get_aligned_size_for_allocator (size));
+                               EMIT_NEW_ICONST (cfg, iargs [1], size);
                        }
                        return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
                }
@@ -4267,7 +4267,7 @@ handle_alloc (MonoCompile *cfg, MonoClass *klass, gboolean for_box, int context_
                                g_error ("Invalid size %d for class %s", size, mono_type_get_full_name (klass));
 
                        EMIT_NEW_VTABLECONST (cfg, iargs [0], vtable);
-                       EMIT_NEW_ICONST (cfg, iargs [1], mono_gc_get_aligned_size_for_allocator (size));
+                       EMIT_NEW_ICONST (cfg, iargs [1], size);
                        return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
                }
                alloc_ftn = mono_class_get_allocation_ftn (vtable, for_box, &pass_lw);
index 4f8fbcf65853f668acdb0cc1be9140ae552f395a..a52f5eb80d06aef3137d018ac67b0940961f8460 100644 (file)
 #include <dlfcn.h>
 #include <AvailabilityMacros.h>
 
-#if defined (TARGET_OSX) && (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5)
-#define NEEDS_EXCEPTION_THREAD
-#endif
-
-#ifdef NEEDS_EXCEPTION_THREAD
-
-/*
- * This code disables the CrashReporter of MacOS X by installing
- * a dummy Mach exception handler.
- */
-
-/*
- * http://darwinsource.opendarwin.org/10.4.3/xnu-792.6.22/osfmk/man/exc_server.html
- */
-extern boolean_t exc_server (mach_msg_header_t *request_msg, mach_msg_header_t *reply_msg);
-
-/*
- * The exception message
- */
-typedef struct {
-       mach_msg_base_t msg;  /* common mach message header */
-       char payload [1024];  /* opaque */
-} mach_exception_msg_t;
-
-/* The exception port */
-static mach_port_t mach_exception_port = VM_MAP_NULL;
-
-kern_return_t
-catch_exception_raise (
-       mach_port_t exception_port,
-       mach_port_t thread,
-       mach_port_t task,
-       exception_type_t exception,
-       exception_data_t code,
-       mach_msg_type_number_t code_count);
-
-/*
- * Implicitly called by exc_server. Must be public.
- *
- * http://darwinsource.opendarwin.org/10.4.3/xnu-792.6.22/osfmk/man/catch_exception_raise.html
- */
-kern_return_t
-catch_exception_raise (
-       mach_port_t exception_port,
-       mach_port_t thread,
-       mach_port_t task,
-       exception_type_t exception,
-       exception_data_t code,
-       mach_msg_type_number_t code_count)
-{
-       /* consume the exception */
-       return KERN_FAILURE;
-}
-
-/*
- * Exception thread handler.
- */
-static
-void *
-mach_exception_thread (void *arg)
-{
-       for (;;) {
-               mach_exception_msg_t request;
-               mach_exception_msg_t reply;
-               mach_msg_return_t result;
-
-               /* receive from "mach_exception_port" */
-               result = mach_msg (&request.msg.header,
-                                  MACH_RCV_MSG | MACH_RCV_LARGE,
-                                  0,
-                                  sizeof (request),
-                                  mach_exception_port,
-                                  MACH_MSG_TIMEOUT_NONE,
-                                  MACH_PORT_NULL);
-
-               g_assert (result == MACH_MSG_SUCCESS);
-
-               /* dispatch to catch_exception_raise () */
-               exc_server (&request.msg.header, &reply.msg.header);
-
-               /* send back to sender */
-               result = mach_msg (&reply.msg.header,
-                                  MACH_SEND_MSG,
-                                  reply.msg.header.msgh_size,
-                                  0,
-                                  MACH_PORT_NULL,
-                                  MACH_MSG_TIMEOUT_NONE,
-                                  MACH_PORT_NULL);
-
-               /*
-               If we try to abort the thread while delivering an exception. The port will be gone since the kernel
-               setup a send once port to deliver the resume message and thread_abort will consume it.
-               */
-               g_assert (result == MACH_MSG_SUCCESS || result == MACH_SEND_INVALID_DEST);
-       }
-       return NULL;
-}
-
-static void
-macosx_register_exception_handler (void)
-{
-       mach_port_t task;
-       pthread_attr_t attr;
-       pthread_t thread;
-
-       if (mach_exception_port != VM_MAP_NULL)
-               return;
-
-       task = mach_task_self ();
-
-       /* create the "mach_exception_port" with send & receive rights */
-       g_assert (mach_port_allocate (task, MACH_PORT_RIGHT_RECEIVE,
-                                     &mach_exception_port) == KERN_SUCCESS);
-       g_assert (mach_port_insert_right (task, mach_exception_port, mach_exception_port,
-                                         MACH_MSG_TYPE_MAKE_SEND) == KERN_SUCCESS);
-
-       /* create the exception handler thread */
-       g_assert (!pthread_attr_init (&attr));
-       g_assert (!pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED));
-       g_assert (!pthread_create (&thread, &attr, mach_exception_thread, NULL));
-       pthread_attr_destroy (&attr);
-
-       /*
-        * register "mach_exception_port" as a receiver for the
-        * EXC_BAD_ACCESS exception
-        *
-        * http://darwinsource.opendarwin.org/10.4.3/xnu-792.6.22/osfmk/man/task_set_exception_ports.html
-        */
-       g_assert (task_set_exception_ports (task, EXC_MASK_BAD_ACCESS,
-                                           mach_exception_port,
-                                           EXCEPTION_DEFAULT,
-                                           MACHINE_THREAD_STATE) == KERN_SUCCESS);
-
-       mono_gc_register_mach_exception_thread (thread);
-}
-
-#endif
-
 /* This is #define'd by Boehm GC to _GC_dlopen. */
 #undef dlopen
 
@@ -215,9 +77,6 @@ void* dlopen(const char* path, int mode);
 void
 mono_runtime_install_handlers (void)
 {
-#ifdef NEEDS_EXCEPTION_THREAD
-       macosx_register_exception_handler ();
-#endif
        mono_runtime_posix_install_handlers ();
 
        /* Snow Leopard has a horrible bug: http://openradar.appspot.com/7209349
@@ -326,7 +185,9 @@ mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo
        state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
        mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
 
-       ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
+       do {
+               ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
+       } while (ret == KERN_ABORTED);
        if (ret != KERN_SUCCESS)
                return FALSE;
 
index d5787acf13b6dff1e2468d5002302a1aca978a16..8e6646cc77c99efc1c45680045bef393c5bbc337 100644 (file)
@@ -517,7 +517,11 @@ clock_init (void)
 {
        kern_return_t ret;
 
-       if ((ret = host_get_clock_service (mach_host_self (), SYSTEM_CLOCK, &sampling_clock_service)) != KERN_SUCCESS)
+       do {
+               ret = host_get_clock_service (mach_host_self (), SYSTEM_CLOCK, &sampling_clock_service);
+       } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS)
                g_error ("%s: host_get_clock_service () returned %d", __func__, ret);
 }
 
@@ -526,7 +530,11 @@ clock_cleanup (void)
 {
        kern_return_t ret;
 
-       if ((ret = mach_port_deallocate (mach_task_self (), sampling_clock_service)) != KERN_SUCCESS)
+       do {
+               ret = mach_port_deallocate (mach_task_self (), sampling_clock_service);
+       } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS)
                g_error ("%s: mach_port_deallocate () returned %d", __func__, ret);
 }
 
@@ -536,7 +544,11 @@ clock_get_time_ns (void)
        kern_return_t ret;
        mach_timespec_t mach_ts;
 
-       if ((ret = clock_get_time (sampling_clock_service, &mach_ts)) != KERN_SUCCESS)
+       do {
+               ret = clock_get_time (sampling_clock_service, &mach_ts);
+       } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS)
                g_error ("%s: clock_get_time () returned %d", __func__, ret);
 
        return ((guint64) mach_ts.tv_sec * 1000000000) + (guint64) mach_ts.tv_nsec;
@@ -553,10 +565,11 @@ clock_sleep_ns_abs (guint64 ns_abs)
 
        do {
                ret = clock_sleep (sampling_clock_service, TIME_ABSOLUTE, then, &remain_unused);
-
-               if (ret != KERN_SUCCESS && ret != KERN_ABORTED)
-                       g_error ("%s: clock_sleep () returned %d", __func__, ret);
        } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS)
+               g_error ("%s: clock_sleep () returned %d", __func__, ret);
+
 }
 
 #else
index 795bab9e41d319ebb23ec690c14ee6cf6c288980..2aba264d1f0747a3bf419415731ebe775a94bc61 100644 (file)
@@ -3397,7 +3397,7 @@ register_jit_stats (void)
        mono_counters_register ("Methods from AOT", MONO_COUNTER_JIT | MONO_COUNTER_INT, &mono_jit_stats.methods_aot);
        mono_counters_register ("Methods JITted using mono JIT", MONO_COUNTER_JIT | MONO_COUNTER_INT, &mono_jit_stats.methods_without_llvm);
        mono_counters_register ("Methods JITted using LLVM", MONO_COUNTER_JIT | MONO_COUNTER_INT, &mono_jit_stats.methods_with_llvm);
-       mono_counters_register ("JIT/method-to-IR (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_method_to_ir);
+       mono_counters_register ("JIT/method_to_ir (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_method_to_ir);
        mono_counters_register ("JIT/liveness_handle_exception_clauses (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_liveness_handle_exception_clauses);
        mono_counters_register ("JIT/handle_out_of_line_bblock (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_handle_out_of_line_bblock);
        mono_counters_register ("JIT/decompose_long_opts (sec)", MONO_COUNTER_JIT | MONO_COUNTER_DOUBLE, &mono_jit_stats.jit_decompose_long_opts);
index eb42a0279c1faf464a2b0840c7a8b611d95a4a2b..45d32b99c05e54b64969afac9b9c51d6047a07b8 100755 (executable)
@@ -6,7 +6,12 @@ USE_AOT=$2
 TMP_FILE_PREFIX=$(basename $0).tmp
 BASEDIR=$(dirname $0)
 
-MONO_PATH=$BASEDIR/../../mcs/class/lib/net_4_x:$BASEDIR
+case "$(uname -s)" in
+       CYGWIN*) PLATFORM_PATH_SEPARATOR=';';;
+       *) PLATFORM_PATH_SEPARATOR=':';;
+esac
+
+MONO_PATH=$BASEDIR/../../mcs/class/lib/net_4_x$PLATFORM_PATH_SEPARATOR$BASEDIR
 RUNTIME=$BASEDIR/../../runtime/mono-wrapper
 
 trap "rm -rf ${TMP_FILE_PREFIX}*" EXIT
@@ -16,7 +21,7 @@ tmp_file () {
 }
 
 clean_aot () {
-       rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM
+       rm -rf *.exe.so *.exe.dylib *.exe.dylib.dSYM *.exe.dll
 }
 
 # The test compares the generated native code size between a compilation with and without seq points.
@@ -42,15 +47,19 @@ get_method () {
 }
 
 diff_methods () {
-       TMP_FILE=$(tmp_file)
-       echo "$(MONO_DEBUG=single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE
-       diff <(cat $TMP_FILE) <(echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_methods $1 $2 $3 $4)")
+       TMP_FILE1=$(tmp_file)
+       TMP_FILE2=$(tmp_file)
+       echo "$(MONO_DEBUG=single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE1
+       echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_methods $1 $2 $3 $4)" >$TMP_FILE2
+       diff $TMP_FILE1 $TMP_FILE2
 }
 
 diff_method () {
-       TMP_FILE=$(tmp_file)
-       echo "$(MONO_DEBUG=single-imm-size get_method $1 $2 $3 $4 $5)" >$TMP_FILE
-       sdiff -w 150 <(cat $TMP_FILE) <(echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_method $1 $2 $3 $4 $5 | grep -Ev il_seq_point)")
+       TMP_FILE1=$(tmp_file)
+       TMP_FILE2=$(tmp_file)
+       echo "$(MONO_DEBUG=single-imm-size get_method $1 $2 $3 $4 $5)" >$TMP_FILE1
+       echo "$(MONO_DEBUG=gen-compact-seq-points,single-imm-size get_method $1 $2 $3 $4 $5 | grep -Ev il_seq_point)" >$TMP_FILE2
+       sdiff -w 150 $TMP_FILE1 $TMP_FILE2
 }
 
 get_method_name () {
index 965b148ec74a6989ce25b6817e334af0b3f0f36a..03bae54e17a22799cc20b98346b97d18dac1af84 100644 (file)
@@ -435,7 +435,8 @@ BASE_TEST_CS_SRC=           \
        pinvoke_ppcs.cs \
        pinvoke_ppci.cs \
        pinvoke_ppcf.cs \
-       pinvoke_ppcd.cs
+       pinvoke_ppcd.cs \
+       bug-29585.cs
 
 TEST_CS_SRC_DIST=      \
        $(BASE_TEST_CS_SRC)     \
diff --git a/mono/tests/bug-29585.cs b/mono/tests/bug-29585.cs
new file mode 100644 (file)
index 0000000..a1289fa
--- /dev/null
@@ -0,0 +1,54 @@
+namespace TestCase
+{
+    using System;
+    using System.Linq;
+    using System.Reflection;
+
+
+    public class MainClass
+    {
+        public static int Main()
+        {
+            return new GenericDerived<Param>().FindMethod();
+        }
+    }
+
+
+    interface Param
+    {
+    }
+
+
+    class GenericDerived<T> :
+        Abstract<GenericDerived<T>>
+    {
+        public int FindMethod()
+        {
+            return FindGenericMethod<T>();
+        }
+    }
+
+
+    abstract class Abstract<TDerived>
+        where TDerived : Abstract<TDerived>
+    {
+        protected virtual int FindGenericMethod<T>()
+        {
+            var method = typeof(TDerived)
+                .GetMethods(BindingFlags.Instance | BindingFlags.NonPublic)
+                .FirstOrDefault(x => x.Name == "FindGenericMethod" && x.IsGenericMethod);
+
+            Console.WriteLine("TDerived = {0}", typeof(TDerived));
+            Console.WriteLine("method = {0}", method);
+            Console.WriteLine("method.DeclaringType = {0}", method.DeclaringType);
+            Console.WriteLine("method.IsGenericMethod = {0}", method.IsGenericMethod);
+            Console.WriteLine("method.IsGenericMethodDefinition = {0}", method.IsGenericMethodDefinition);
+                       
+                       if (!method.IsGenericMethod)
+                               return 1;
+                       if (!method.IsGenericMethodDefinition)
+                               return 2;
+                       return 0;
+        }
+    }
+}
\ No newline at end of file
index 19e745f630c0c54eb46f030dfb5c3e62e7b7de20..314b30d972c2b18c065f33f6978a050b64bb10f0 100644 (file)
@@ -27,7 +27,7 @@ mono_mach_get_threads (thread_act_array_t *threads, guint32 *count)
 
        do {
                ret = task_threads (current_task (), threads, count);
-       } while (ret != KERN_SUCCESS);
+       } while (ret == KERN_ABORTED);
 
        return ret;
 }
index 7ab1b9df7876d24e2bf88fe0858c177491512bcf..16e3d463b8b7377ab0dfb6ec22b8adcc15b76f66 100644 (file)
@@ -131,10 +131,13 @@ static inline int
 mono_os_sem_post (MonoSemType *sem)
 {
        int res;
-
+retry:
        res = semaphore_signal (*sem);
        g_assert (res != KERN_INVALID_ARGUMENT);
 
+       if (res == KERN_ABORTED)
+               goto retry;
+
        return res != KERN_SUCCESS ? -1 : 0;
 }
 
index c53af96454a79e84a98239ad450d0e9f8658154d..479655189b519be4c51a7b7c274679e8111970f5 100644 (file)
@@ -355,22 +355,35 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
        mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT, th_count;
        thread_array_t th_array;
        size_t i;
+       kern_return_t ret;
 
        if (pid == getpid ()) {
                /* task_for_pid () doesn't work on ios, even for the current process */
                task = mach_task_self ();
        } else {
-               if (task_for_pid (mach_task_self (), pid, &task) != KERN_SUCCESS)
+               do {
+                       ret = task_for_pid (mach_task_self (), pid, &task);
+               } while (ret == KERN_ABORTED);
+
+               if (ret != KERN_SUCCESS)
                        RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
        }
 
-       if (task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count) != KERN_SUCCESS) {
+       do {
+               ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
+       } while (ret == KERN_ABORTED);
+
+       if (ret != KERN_SUCCESS) {
                if (pid != getpid ())
                        mach_port_deallocate (mach_task_self (), task);
                RET_ERROR (MONO_PROCESS_ERROR_OTHER);
        }
+
+       do {
+               ret = task_threads (task, &th_array, &th_count);
+       } while (ret == KERN_ABORTED);
        
-       if (task_threads(task, &th_array, &th_count) != KERN_SUCCESS) {
+       if (ret  != KERN_SUCCESS) {
                if (pid != getpid ())
                        mach_port_deallocate (mach_task_self (), task);
                RET_ERROR (MONO_PROCESS_ERROR_OTHER);
@@ -381,7 +394,11 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
                
                struct thread_basic_info th_info;
                mach_msg_type_number_t th_info_count = THREAD_BASIC_INFO_COUNT;
-               if (thread_info(th_array[i], THREAD_BASIC_INFO, (thread_info_t)&th_info, &th_info_count) == KERN_SUCCESS) {
+               do {
+                       ret = thread_info(th_array[i], THREAD_BASIC_INFO, (thread_info_t)&th_info, &th_info_count);
+               } while (ret == KERN_ABORTED);
+
+               if (ret == KERN_SUCCESS) {
                        thread_user_time = th_info.user_time.seconds + th_info.user_time.microseconds / 1e6;
                        thread_system_time = th_info.system_time.seconds + th_info.system_time.microseconds / 1e6;
                        //thread_percent = (double)th_info.cpu_usage / TH_USAGE_SCALE;
@@ -494,16 +511,25 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul
        task_t task;
        struct task_basic_info t_info;
        mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT;
+       kern_return_t mach_ret;
 
        if (pid == getpid ()) {
                /* task_for_pid () doesn't work on ios, even for the current process */
                task = mach_task_self ();
        } else {
-               if (task_for_pid (mach_task_self (), pid, &task) != KERN_SUCCESS)
+               do {
+                       mach_ret = task_for_pid (mach_task_self (), pid, &task);
+               } while (mach_ret == KERN_ABORTED);
+
+               if (mach_ret != KERN_SUCCESS)
                        RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
        }
-       
-       if (task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count) != KERN_SUCCESS) {
+
+       do {
+               mach_ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count);
+       } while (mach_ret == KERN_ABORTED);
+
+       if (mach_ret != KERN_SUCCESS) {
                if (pid != getpid ())
                        mach_port_deallocate (mach_task_self (), task);
                RET_ERROR (MONO_PROCESS_ERROR_OTHER);
index 056a88f150a1cd72b8b5a1fb9d771ae8495c8845..559d2fa63c94525e4c36384bb02213e3ac3155a4 100644 (file)
@@ -49,11 +49,16 @@ mono_threads_core_abort_syscall (MonoThreadInfo *info)
 {
        kern_return_t ret;
 
-       ret = thread_suspend (info->native_handle);
+       do {
+               ret = thread_suspend (info->native_handle);
+       } while (ret == KERN_ABORTED);
+
        if (ret != KERN_SUCCESS)
                return;
 
-       ret = thread_abort_safely (info->native_handle);
+       do {
+               ret = thread_abort_safely (info->native_handle);
+       } while (ret == KERN_ABORTED);
 
        /*
         * We are doing thread_abort when thread_abort_safely returns KERN_SUCCESS because
@@ -66,7 +71,11 @@ mono_threads_core_abort_syscall (MonoThreadInfo *info)
        if (ret == KERN_SUCCESS)
                ret = thread_abort (info->native_handle);
 
-       g_assert (thread_resume (info->native_handle) == KERN_SUCCESS);
+       do {
+               ret = thread_resume (info->native_handle);
+       } while (ret == KERN_ABORTED);
+
+       g_assert (ret == KERN_SUCCESS);
 }
 
 gboolean
index 6f2ddfa78af52357be210b50a2a43c3a73526b52..6c2b07e468f5686872fb4a9db872be7f30dacdd2 100644 (file)
@@ -60,7 +60,11 @@ mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_
 
        g_assert (info);
 
-       ret = thread_suspend (info->native_handle);
+
+       do {
+               ret = thread_suspend (info->native_handle);
+       } while (ret == KERN_ABORTED);
+
        THREADS_SUSPEND_DEBUG ("SUSPEND %p -> %d\n", (void*)info->native_handle, ret);
        if (ret != KERN_SUCCESS)
                return FALSE;
@@ -68,7 +72,10 @@ mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_
        /* We're in the middle of a self-suspend, resume and register */
        if (!mono_threads_transition_finish_async_suspend (info)) {
                mono_threads_add_to_pending_operation_set (info);
-               g_assert (thread_resume (info->native_handle) == KERN_SUCCESS);
+               do {
+                       ret = thread_resume (info->native_handle);
+               } while (ret == KERN_ABORTED);
+               g_assert (ret == KERN_SUCCESS);
                THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/1 %p -> %d\n", (void*)info->native_handle, 0);
                //XXX interrupt_kernel doesn't make sense in this case as the target is not in a syscall
                return TRUE;
@@ -81,7 +88,10 @@ mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_
                        thread_abort (info->native_handle);
        } else {
                mono_threads_transition_async_suspend_compensation (info);
-               g_assert (thread_resume (info->native_handle) == KERN_SUCCESS);
+               do {
+                       ret = thread_resume (info->native_handle);
+               } while (ret == KERN_ABORTED);
+               g_assert (ret == KERN_SUCCESS);
                THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/2 %p -> %d\n", (void*)info->native_handle, 0);
        }
        return res;
@@ -112,7 +122,10 @@ mono_threads_core_begin_async_resume (MonoThreadInfo *info)
                state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
                mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
 
-               ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
+               do {
+                       ret = mono_mach_arch_get_thread_state (info->native_handle, state, &num_state);
+               } while (ret == KERN_ABORTED);
+
                if (ret != KERN_SUCCESS)
                        return FALSE;
 
@@ -122,12 +135,17 @@ mono_threads_core_begin_async_resume (MonoThreadInfo *info)
 
                mono_mach_arch_mcontext_to_thread_state (mctx, state);
 
-               ret = mono_mach_arch_set_thread_state (info->native_handle, state, num_state);
+               do {
+                       ret = mono_mach_arch_set_thread_state (info->native_handle, state, num_state);
+               } while (ret == KERN_ABORTED);
+
                if (ret != KERN_SUCCESS)
                        return FALSE;
        }
 
-       ret = thread_resume (info->native_handle);
+       do {
+               ret = thread_resume (info->native_handle);
+       } while (ret == KERN_ABORTED);
        THREADS_SUSPEND_DEBUG ("RESUME %p -> %d\n", (void*)info->native_handle, ret);
 
        return ret == KERN_SUCCESS;