Merge pull request #2885 from ntherning/fix_test_op_il_seq_point_sh_on_cygwin_2_4_1
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 15 Apr 2016 11:49:53 +0000 (13:49 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 15 Apr 2016 11:49:53 +0000 (13:49 +0200)
Fixes for  'make check-seq-points' on Cygwin

30 files changed:
external/referencesource
mcs/class/System.Runtime.Serialization/System.Runtime.Serialization_test.dll.sources
mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Exceptions.cs [new file with mode: 0644]
mcs/class/corlib/System.IO/Path.cs
mcs/class/corlib/System.Reflection/MonoMethod.cs
mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs
mcs/class/corlib/System/Environment.cs
mcs/class/corlib/System/Exception.cs [deleted file]
mcs/class/corlib/Test/System.Security.Cryptography/CspParametersTest.cs
mcs/class/corlib/corlib.dll.sources
mcs/mcs/ecore.cs
mcs/tests/gtest-optional-37.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mono/metadata/appdomain.c
mono/metadata/icall-def.h
mono/metadata/mono-perfcounters.c
mono/metadata/object-internals.h
mono/metadata/sgen-os-mach.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/mini-darwin.c
mono/mini/mini-posix.c
mono/sgen/sgen-gc.c
mono/sgen/sgen-pinning.c
mono/sgen/sgen-pinning.h
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 0ffb5c87150819946858f452367c72ca89634ac1..8c7937a9e7cc3f61f9ceb6a9d6f19fefdf1672b0 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0ffb5c87150819946858f452367c72ca89634ac1
+Subproject commit 8c7937a9e7cc3f61f9ceb6a9d6f19fefdf1672b0
index b0c9706a1dbdd42ab798bdfcf4cfebe807e8ef57..547733453e01d33328e916ef748bc572767657f9 100644 (file)
@@ -15,6 +15,7 @@ System.Runtime.Serialization/DataContractSerializerTest_NullableWithDictionary.c
 System.Runtime.Serialization/DataContractSerializerTest_InvalidCharacters.cs
 System.Runtime.Serialization/DataContractSerializerTest_ISerializable.cs
 System.Runtime.Serialization/DataContractSerializerTest.cs
+System.Runtime.Serialization/Exceptions.cs
 System.Runtime.Serialization/KnownTypeAttributeTest.cs
 System.Runtime.Serialization/XmlObjectSerializerTest.cs
 System.Runtime.Serialization/XsdDataContractExporterTest.cs
diff --git a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Exceptions.cs b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/Exceptions.cs
new file mode 100644 (file)
index 0000000..4303c6c
--- /dev/null
@@ -0,0 +1,95 @@
+//
+// Exceptions
+//
+// Authors:
+//      Andi McClure (andi.mcclure@xamarin.com)
+//
+// Copyright 2016 Xamarin Inc. (http://www.xamarin.com)
+//
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Serialization
+{
+       [TestFixture]
+       public class Exceptions
+       {
+               [Serializable]
+               public class SerializableException : Exception
+               {
+                       public string Data;
+
+                       public SerializableException (string data) {
+                               Data = data;
+
+                               SerializeObjectState += HandleSerialization;
+                       }
+
+                       private static void HandleSerialization (object exception, SafeSerializationEventArgs eventArgs) {
+                               eventArgs.AddSerializedState (new SerializableExceptionState (exception));
+                       }
+
+                       [Serializable]
+                       private class SerializableExceptionState : ISafeSerializationData {
+                               private string Data;
+
+                               public SerializableExceptionState (object _exception) {
+                                       SerializableException exception = (SerializableException)_exception;
+
+                                       Data = exception.Data;
+                               }
+
+                               public void CompleteDeserialization (object _exception) {
+                                       SerializableException exception = (SerializableException)_exception;
+                                       exception.SerializeObjectState += HandleSerialization;
+
+                                       exception.Data = Data;
+                               }
+                       }
+               }
+
+               // Effectively tests SerializeObjectState handler support on System.Exception
+               [Test]
+               public void Exception_SerializeObjectState () {
+                       SerializableException exception = new SerializableException ("success");
+                       SerializableException deserializedException;
+                       BinaryFormatter binaryFormatter = new BinaryFormatter ();
+
+                       using (MemoryStream memoryStream = new MemoryStream ())
+                       {
+                               binaryFormatter.Serialize (memoryStream, exception);
+                               memoryStream.Flush ();
+
+                               memoryStream.Seek (0, SeekOrigin.Begin);
+
+                               deserializedException = (SerializableException)binaryFormatter.Deserialize (memoryStream);
+                       }
+
+                       Assert.AreEqual ("success", deserializedException.Data);
+               }
+       }
+}
\ No newline at end of file
index 9ac0e97545427ada48cdaaadfddd1f60b0eef086..f053d51225e6e8a1db5babe82cd6507e70394c01 100644 (file)
@@ -488,7 +488,7 @@ namespace System.IO {
                                        f = new FileStream (path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read,
                                                            8192, false, (FileOptions) 1);
                                } catch (IOException ex){
-                                       if (ex.hresult != MonoIO.FileAlreadyExistsHResult || count ++ > 65536)
+                                       if (ex._HResult != MonoIO.FileAlreadyExistsHResult || count ++ > 65536)
                                                throw;
                                } catch (UnauthorizedAccessException ex) {
                                        if (count ++ > 65536)
index 544774d1786061abd71dcd490fc36a4c8e4dbf4b..1c0e73c485f4aee2d3f7e35a2b67a4d6737f5d0f 100644 (file)
@@ -751,5 +751,20 @@ namespace System.Reflection {
                public override IList<CustomAttributeData> GetCustomAttributesData () {
                        return CustomAttributeData.GetCustomAttributes (this);
                }
+
+               [MethodImplAttribute(MethodImplOptions.InternalCall)]
+               public extern int get_core_clr_security_level ();
+
+               public override bool IsSecurityTransparent {
+                       get { return get_core_clr_security_level () == 0; }
+               }
+
+               public override bool IsSecurityCritical {
+                       get { return get_core_clr_security_level () > 0; }
+               }
+
+               public override bool IsSecuritySafeCritical {
+                       get { return get_core_clr_security_level () == 1; }
+               }
        }
 }
index 8bed0815d260a9d15a98da78b35cdbbe2a62f6ba..24f15e3f980437e7877e372bf84a63afb6220ffb 100644 (file)
@@ -412,7 +412,7 @@ namespace System.Runtime.InteropServices
                        var errorInfo = new ManagedErrorInfo(e);
                        SetErrorInfo (0, errorInfo);
 
-                       return e.hresult;
+                       return e._HResult;
 #else                  
                        return -1;
 #endif
@@ -1591,7 +1591,7 @@ namespace System.Runtime.InteropServices
                                }
                        }
 
-                       if (info is ManagedErrorInfo && ((ManagedErrorInfo) info).Exception.hresult == errorCode) {
+                       if (info is ManagedErrorInfo && ((ManagedErrorInfo) info).Exception._HResult == errorCode) {
                                return ((ManagedErrorInfo) info).Exception;
                        }
 
index 1c17f0b76c0716362c35daf33e64de290a310b24..88a0a1baea92e501087f9f81a7c40bf428a3bef8 100644 (file)
@@ -57,7 +57,7 @@ namespace System {
                 * of icalls, do not require an increment.
                 */
 #pragma warning disable 169
-               private const int mono_corlib_version = 144;
+               private const int mono_corlib_version = 145;
 #pragma warning restore 169
 
                [ComVisible (true)]
@@ -985,6 +985,19 @@ namespace System {
                {
 
                }
+
+               // Copied from referencesource Environment
+               internal static String GetStackTrace(Exception e, bool needFileInfo)
+               {
+                       System.Diagnostics.StackTrace st;
+                       if (e == null)
+                               st = new System.Diagnostics.StackTrace(needFileInfo);
+                       else
+                               st = new System.Diagnostics.StackTrace(e, needFileInfo);
+
+                       // Do not include a trailing newline for backwards compatibility
+                       return st.ToString( System.Diagnostics.StackTrace.TraceFormat.Normal );
+               }
        }
 }
 
diff --git a/mcs/class/corlib/System/Exception.cs b/mcs/class/corlib/System/Exception.cs
deleted file mode 100644 (file)
index 7b6b492..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
-//
-// System.Exception.cs
-//
-// Author:
-//   Miguel de Icaza (miguel@ximian.com)
-//   Patrik Torstensson
-//
-// (C) Ximian, Inc.  http://www.ximian.com
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Reflection;
-using System.Text;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-
-namespace System
-{
-       [Serializable]
-       [ComVisible(true)]
-       [ComDefaultInterface (typeof (_Exception))]
-       [ClassInterface (ClassInterfaceType.None)]
-       [StructLayout (LayoutKind.Sequential)]
-#if MOBILE
-       public class Exception : ISerializable
-#else
-       public class Exception : ISerializable, _Exception
-#endif
-       {
-#pragma warning disable 169, 649
-               #region Sync with object-internals.h
-               /* Stores the IPs and the generic sharing infos
-                  (vtable/MRGCTX) of the frames. */
-               IntPtr [] trace_ips;
-               Exception inner_exception;
-               internal string _message;
-               string help_link;
-               string class_name;
-               string stack_trace;
-               // formerly known as remote_stack_trace (see #425512):
-               string _remoteStackTraceString;
-               int remote_stack_index;
-               internal int hresult = -2146233088;
-               string source;
-               IDictionary _data;
-               internal StackTrace[] captured_traces;
-               IntPtr[] native_trace_ips;
-               object dynamic_methods;
-               #endregion
-#pragma warning restore 169, 649
-
-               /* Don't add fields here, the runtime depends on the layout of subclasses */
-
-               public Exception ()
-               {
-               }
-
-               public Exception (string message)
-               {
-                       this._message = message;
-               }
-
-               protected Exception (SerializationInfo info, StreamingContext context)
-               {
-                       if (info == null)
-                               throw new ArgumentNullException ("info");
-
-                       class_name          = info.GetString ("ClassName");
-                       _message             = info.GetString ("Message");
-                       help_link           = info.GetString ("HelpURL");
-                       stack_trace         = info.GetString ("StackTraceString");
-                       _remoteStackTraceString  = info.GetString ("RemoteStackTraceString");
-                       remote_stack_index  = info.GetInt32  ("RemoteStackIndex");
-                       hresult             = info.GetInt32  ("HResult");
-                       source              = info.GetString ("Source");
-                       inner_exception     = (Exception) info.GetValue ("InnerException", typeof (Exception));
-
-                       try {
-                               _data = (IDictionary) info.GetValue ("Data", typeof (IDictionary));
-                       } catch (SerializationException) {
-                               // member did not exist in .NET 1.x
-                       }
-               }
-
-               public Exception (string message, Exception innerException)
-               {
-                       inner_exception = innerException;
-                       this._message = message;
-               }
-
-               public Exception InnerException {
-                       get { return inner_exception; }
-               }
-
-               public virtual string HelpLink {
-                       get { return help_link; }
-                       set { help_link = value; }
-               }
-
-               public int HResult {
-                       get { return hresult; }
-                       protected set { hresult = value; }
-               }
-               
-               internal void SetErrorCode(int hr)
-               {
-                       HResult = hr;
-               }
-
-               internal void SetMessage (string s)
-               {
-                       _message = s;
-               }
-
-               internal void SetStackTrace (string s)
-               {
-                       stack_trace = s;
-               }
-
-               string ClassName {
-                       get {
-                               if (class_name == null)
-                                       class_name = GetType ().ToString ();
-                               return class_name;
-                       }
-               }
-
-               public virtual string Message {
-                       get {
-                               if (_message == null)
-                                       _message = string.Format (Locale.GetText ("Exception of type '{0}' was thrown."),
-                                               ClassName);
-
-                               return _message;
-                       }
-               }
-               
-               [MonoTODO]
-               protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState {
-                       add {
-                       }
-                       remove {
-                       }
-               }
-
-               public virtual string Source {
-                       get {
-                               if (source == null) {
-                                       StackTrace st = new StackTrace (this, true);
-                                       if (st.FrameCount > 0) {
-                                               StackFrame sf = st.GetFrame (0);
-                                               if (st != null) {
-                                                       MethodBase method = sf.GetMethod ();
-                                                       if (method != null) {
-                                                               source = method.DeclaringType.Assembly.UnprotectedGetName ().Name;
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               // source can be null
-                               return source;
-                       }
-
-                       set {
-                               source = value;
-                       }
-               }
-
-               public virtual string StackTrace {
-                       get {
-                               if (stack_trace != null)
-                                       return stack_trace;
-
-                               if (trace_ips == null)
-                                       /* Not thrown yet */
-                                       return null;
-
-                               StackTrace st = new StackTrace (this, 0, true);
-                               return stack_trace = st.ToString ();
-                       }
-               }
-
-               public MethodBase TargetSite {
-                       get {
-                               StackTrace st = new StackTrace (this, true);
-                               if (st.FrameCount > 0)
-                                       return st.GetFrame (0).GetMethod ();
-                               
-                               return null;
-                       }
-               }
-
-               public virtual IDictionary Data {
-                       get {
-                               if (_data == null) {
-                                       // default to empty dictionary
-                                       _data = new Dictionary<object, object> ();
-                               }
-                               return _data;
-                       }
-               }
-
-               public virtual Exception GetBaseException ()
-               {
-                       Exception inner = inner_exception;
-                               
-                       while (inner != null)
-                       {
-                               if (inner.InnerException != null)
-                                       inner = inner.InnerException;
-                               else
-                                       return inner;
-                       }
-
-                       return this;
-               }
-
-               [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
-               public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
-               {
-                       if (info == null)
-                               throw new ArgumentNullException ("info");
-
-                       info.AddValue ("ClassName", ClassName);
-                       info.AddValue ("Message", _message);
-                       info.AddValue ("InnerException", inner_exception, typeof (Exception));
-                       info.AddValue ("HelpURL", help_link);
-                       info.AddValue ("StackTraceString", StackTrace);
-                       info.AddValue ("RemoteStackTraceString", _remoteStackTraceString);
-                       info.AddValue ("RemoteStackIndex", remote_stack_index);
-                       info.AddValue ("HResult", hresult);
-                       info.AddValue ("Source", Source);
-                       info.AddValue ("ExceptionMethod", null);
-                       info.AddValue ("Data", _data, typeof (IDictionary));
-               }
-
-               public override string ToString ()
-               {
-                       System.Text.StringBuilder result = new System.Text.StringBuilder (ClassName);
-                       result.Append (": ").Append (Message);
-
-                       if (null != _remoteStackTraceString)
-                               result.Append (_remoteStackTraceString);
-                               
-                       if (inner_exception != null) 
-                       {
-                               result.Append (" ---> ").Append (inner_exception.ToString ());
-                               result.Append (Environment.NewLine);
-                               result.Append (Locale.GetText ("  --- End of inner exception stack trace ---"));
-                       }
-
-                       if (StackTrace != null)
-                               result.Append (Environment.NewLine).Append (StackTrace);
-                       return result.ToString();
-               }
-
-               internal Exception FixRemotingException ()
-               {
-                       string message = (0 == remote_stack_index) ?
-                               Locale.GetText ("{0}{0}Server stack trace: {0}{1}{0}{0}Exception rethrown at [{2}]: {0}") :
-                               Locale.GetText ("{1}{0}{0}Exception rethrown at [{2}]: {0}");
-                       string tmp = String.Format (message, Environment.NewLine, StackTrace, remote_stack_index);
-
-                       _remoteStackTraceString = tmp;
-                       remote_stack_index++;
-
-                       stack_trace = null;
-
-                       return this;
-               }
-
-               // For ExceptionDispatchInfo
-               internal void RestoreExceptionDispatchInfo (System.Runtime.ExceptionServices.ExceptionDispatchInfo exceptionDispatchInfo)
-               {
-                       captured_traces = (StackTrace[]) exceptionDispatchInfo.BinaryStackTraceArray;
-                       trace_ips = null;
-                       stack_trace = null;
-               }
-
-               //
-               // The documentation states that this is available in 1.x,
-               // but it was not available (MemberRefing this would fail)
-               // and it states the signature is `override sealed', but the
-               // correct value is `newslot' 
-               //
-               public new Type GetType ()
-               {
-                       return base.GetType ();
-               }
-
-               internal enum ExceptionMessageKind
-               {
-                       ThreadAbort = 1,
-                       ThreadInterrupted = 2,
-                       OutOfMemory = 3
-               }
-
-               internal static String GetMessageFromNativeResources (ExceptionMessageKind kind)
-               {
-                       switch (kind) {
-                       case ExceptionMessageKind.ThreadAbort:
-                               return "";
-                       case ExceptionMessageKind.ThreadInterrupted:
-                               return "";
-                       case ExceptionMessageKind.OutOfMemory:
-                               return "Out of memory";
-                       }
-                       return "";
-               }
-       }
-}
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 c7f01bc6eb20ca1461ada0ce0b8511f5f1a637f4..fdca704f281fbf12cbce3fd54da84e1b067b445a 100644 (file)
@@ -100,7 +100,6 @@ System/DomainManagerInitializationFlags.cs
 System/EmptyArray.cs
 System/Environment.cs
 System/EnvironmentVariableTarget.cs
-System/Exception.cs
 System/GC.cs
 System/GCCollectionMode.cs
 System/GCNotificationStatus.cs
@@ -974,6 +973,7 @@ ReferenceSources/SecurityContext.cs
 ../../../external/referencesource/mscorlib/system/entrypointnotfoundexception.cs
 ../../../external/referencesource/mscorlib/system/eventargs.cs
 ../../../external/referencesource/mscorlib/system/eventhandler.cs
+../../../external/referencesource/mscorlib/system/exception.cs
 ../../../external/referencesource/mscorlib/system/executionengineexception.cs
 ../../../external/referencesource/mscorlib/system/fieldaccessexception.cs
 ../../../external/referencesource/mscorlib/system/flagsattribute.cs
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;
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 bdc03728a98a095fd2183fec8aa251364d681839..768daf639bc8887e334fc4a8d45b743e271266f3 100644 (file)
@@ -81,7 +81,7 @@
  * Changes which are already detected at runtime, like the addition
  * of icalls, do not require an increment.
  */
-#define MONO_CORLIB_VERSION 144
+#define MONO_CORLIB_VERSION 145
 
 typedef struct
 {
index 44a1320f4d11176b36a263ae427d1846aa044305..60be82c6c144e9daf281083d09020dea81612acc 100644 (file)
@@ -578,6 +578,7 @@ ICALL(MODULE_13, "get_MetadataToken", ves_icall_reflection_get_token)
 ICALL_TYPE(MCMETH, "System.Reflection.MonoCMethod", MCMETH_1)
 ICALL(MCMETH_1, "GetGenericMethodDefinition_impl", ves_icall_MonoMethod_GetGenericMethodDefinition)
 ICALL(MCMETH_2, "InternalInvoke", ves_icall_InternalInvoke)
+ICALL(MCMETH_3, "get_core_clr_security_level", ves_icall_MonoMethod_get_core_clr_security_level)
 
 ICALL_TYPE(MEVIN, "System.Reflection.MonoEventInfo", MEVIN_1)
 ICALL(MEVIN_1, "get_event_info", ves_icall_MonoEventInfo_get_event_info)
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 691d4374674c269d090daa093cc12a1770cc425e..17d5eea26ef0a572d6a7ff0ad8c2676f88629860 100644 (file)
@@ -201,23 +201,24 @@ typedef struct {
 
 struct _MonoException {
        MonoObject object;
+       MonoString *class_name;
+       MonoString *message;
+       MonoObject *_data;
+       MonoObject *inner_ex;
+       MonoString *help_link;
        /* Stores the IPs and the generic sharing infos
           (vtable/MRGCTX) of the frames. */
        MonoArray  *trace_ips;
-       MonoObject *inner_ex;
-       MonoString *message;
-       MonoString *help_link;
-       MonoString *class_name;
        MonoString *stack_trace;
        MonoString *remote_stack_trace;
        gint32      remote_stack_index;
+       /* Dynamic methods referenced by the stack trace */
+       MonoObject *dynamic_methods;
        gint32      hresult;
        MonoString *source;
-       MonoObject *_data;
+       MonoObject *serialization_manager;
        MonoObject *captured_traces;
        MonoArray  *native_trace_ips;
-       /* Dynamic methods referenced by the stack trace */
-       MonoObject *dynamic_methods;
 };
 
 typedef struct {
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 f65b3a6ee68a58a0b22aae2c31695b1d46471843..0217ba5b29cc92e9e8c223b86a9a72570a0c850f 100644 (file)
@@ -10463,8 +10463,10 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
        }
 
 #if defined(MONO_ARCH_GSHAREDVT_SUPPORTED)
-       acfg->opts |= MONO_OPT_GSHAREDVT;
-       opts |= MONO_OPT_GSHAREDVT;
+       if (acfg->aot_opts.llvm_only || mono_aot_mode_is_full (&acfg->aot_opts)) {
+               acfg->opts |= MONO_OPT_GSHAREDVT;
+               opts |= MONO_OPT_GSHAREDVT;
+       }
 #endif
 
        if (opts & MONO_OPT_GSHAREDVT)
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 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 e6b8d672dce53fbb73037cc2c4dbfe39bca1a9a7..5ec907371f38451a493b5de735ff26c44620c6cf 100644 (file)
@@ -696,6 +696,8 @@ pin_objects_from_nursery_pin_queue (gboolean do_scan_objects, ScanCopyContext ct
                        definitely_pinned [count] = obj_to_pin;
                        count++;
                }
+               if (concurrent_collection_in_progress)
+                       sgen_pinning_register_pinned_in_nursery (obj_to_pin);
 
        next_pin_queue_entry:
                last = addr;
@@ -1411,6 +1413,8 @@ job_mod_union_preclean (void *worker_data_untyped, SgenThreadPoolJob *job)
 
        major_collector.scan_card_table (CARDTABLE_SCAN_MOD_UNION_PRECLEAN, ctx);
        sgen_los_scan_card_table (CARDTABLE_SCAN_MOD_UNION_PRECLEAN, ctx);
+
+       sgen_scan_pin_queue_objects (ctx);
 }
 
 static void
@@ -3008,6 +3012,7 @@ sgen_gc_init (void)
 
        alloc_nursery ();
 
+       sgen_pinning_init ();
        sgen_cement_init (cement_enabled);
 
        if ((env = g_getenv (MONO_GC_DEBUG_NAME))) {
index eedd1f0343a93e720cac0838ec29ff70e8bd773e..cfe3db1acd0167bd08d1c7e285b6313736460ec3 100644 (file)
 
 static SgenPointerQueue pin_queue;
 static size_t last_num_pinned = 0;
+/*
+ * While we hold the pin_queue_mutex, all objects in pin_queue_objs will
+ * stay pinned, which means they can't move, therefore they can be scanned.
+ */
+static SgenPointerQueue pin_queue_objs;
+static MonoCoopMutex pin_queue_mutex;
 
 #define PIN_HASH_SIZE 1024
 static void *pin_hash_filter [PIN_HASH_SIZE];
 
+void
+sgen_pinning_init (void)
+{
+       mono_coop_mutex_init (&pin_queue_mutex);
+}
+
 void
 sgen_init_pinning (void)
 {
+       mono_coop_mutex_lock (&pin_queue_mutex);
        memset (pin_hash_filter, 0, sizeof (pin_hash_filter));
        pin_queue.mem_type = INTERNAL_MEM_PIN_QUEUE;
+       sgen_pointer_queue_clear (&pin_queue_objs);
 }
 
 void
@@ -37,6 +51,27 @@ sgen_finish_pinning (void)
 {
        last_num_pinned = pin_queue.next_slot;
        sgen_pointer_queue_clear (&pin_queue);
+       mono_coop_mutex_unlock (&pin_queue_mutex);
+}
+
+void
+sgen_pinning_register_pinned_in_nursery (GCObject *obj)
+{
+       sgen_pointer_queue_add (&pin_queue_objs, obj);
+}
+
+void
+sgen_scan_pin_queue_objects (ScanCopyContext ctx)
+{
+       int i;
+       ScanObjectFunc scan_func = ctx.ops->scan_object;
+
+       mono_coop_mutex_lock (&pin_queue_mutex);
+       for (i = 0; i < pin_queue_objs.next_slot; ++i) {
+               GCObject *obj = (GCObject *)pin_queue_objs.data [i];
+               scan_func (obj, sgen_obj_get_descriptor_safe (obj), ctx.queue);
+       }
+       mono_coop_mutex_unlock (&pin_queue_mutex);
 }
 
 void
index 00eb20dd819830f40a45a620981e812426673df2..2ae2594fa85e1c762898e60d43e6caafaf0ed40a 100644 (file)
@@ -18,10 +18,13 @@ enum {
        PIN_TYPE_MAX
 };
 
+void sgen_pinning_init (void);
 void sgen_pin_stage_ptr (void *ptr);
 void sgen_optimize_pin_queue (void);
 void sgen_init_pinning (void);
 void sgen_finish_pinning (void);
+void sgen_pinning_register_pinned_in_nursery (GCObject *obj);
+void sgen_scan_pin_queue_objects (ScanCopyContext ctx);
 void sgen_pin_queue_clear_discarded_entries (GCMemSection *section, size_t max_pin_slot);
 size_t sgen_get_pinned_count (void);
 void sgen_pinning_setup_section (GCMemSection *section);
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;