Merge pull request #3328 from BrzVlad/finalizer-thread-exited2
authorVlad Brezae <brezaevlad@gmail.com>
Wed, 27 Jul 2016 19:59:27 +0000 (22:59 +0300)
committerGitHub <noreply@github.com>
Wed, 27 Jul 2016 19:59:27 +0000 (22:59 +0300)
[sgen] Avoid popping the entire finalizer queues if finalizers are su…

93 files changed:
Makefile.am
acceptance-tests/roslyn.mk
configure.ac
man/mono.1
mcs/class/Facades/System.IO.Compression/AssemblyInfo.cs [deleted file]
mcs/class/Facades/System.IO.Compression/Makefile [deleted file]
mcs/class/Facades/System.IO.Compression/Missing.cs [deleted file]
mcs/class/Facades/System.IO.Compression/System.IO.Compression.dll.sources [deleted file]
mcs/class/Facades/System.IO.Compression/TypeForwarders.cs [deleted file]
mcs/class/Facades/System.Text.Encoding.CodePages/CodePagesEncodingProvider.cs
mcs/class/Facades/subdirs.make
mcs/class/Mono.CSharp/Mono.CSharp_test.dll.sources
mcs/class/Mono.CSharp/Test/Visit/ASTVisitorTest.cs
mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources
mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources
mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources
mcs/class/Mono.Debugger.Soft/Makefile
mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mcs/class/Mono.Tasklets/Test/Mono.Tasklets/ContinuationsTest.cs
mcs/class/System.Core/common_System.Core.dll.sources
mcs/class/System.Data/Microsoft.SqlServer.Server/SqlDataRecord.cs
mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs
mcs/class/System/Mono.Net.Security/SystemCertificateValidator.cs
mcs/class/System/System.Diagnostics/ProcessModuleCollection.cs
mcs/class/System/System.Diagnostics/ProcessThreadCollection.cs
mcs/class/System/Test/System.Net.Mail/SmtpClientTest.cs
mcs/class/System/Test/System.Net.Security/SslStreamTest.cs
mcs/class/System/Test/System.Net.Sockets/NetworkStreamTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketAcceptAsyncTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs
mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
mcs/class/System/Test/System.Net.Sockets/TcpClientTest.cs
mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs
mcs/class/System/Test/System.Net.Sockets/UdpClientTest.cs
mcs/class/System/Test/System.Net/CookieParserTest.cs
mcs/class/System/Test/System.Net/DnsTest.cs
mcs/class/System/Test/System.Net/FileWebRequestTest.cs
mcs/class/System/Test/System.Net/FtpWebRequestTest.cs
mcs/class/System/Test/System.Net/HttpListener2Test.cs
mcs/class/System/Test/System.Net/HttpListenerPrefixCollectionTest.cs
mcs/class/System/Test/System.Net/HttpListenerRequestTest.cs
mcs/class/System/Test/System.Net/HttpListenerTest.cs
mcs/class/System/Test/System.Net/HttpWebRequestTest.cs
mcs/class/System/Test/System.Net/HttpWebResponseTest.cs
mcs/class/System/Test/System.Net/WebClientTest.cs
mcs/class/System/Test/System.Net/WebRequestTest.cs
mcs/class/corlib/System.IO/File.cs
mcs/class/corlib/System.Runtime.CompilerServices/ConditionalWeakTable.cs
mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs
mcs/errors/cs0163-2.cs [new file with mode: 0644]
mcs/errors/cs1644-50.cs [new file with mode: 0644]
mcs/mcs/cs-parser.jay
mcs/mcs/statement.cs
mcs/tools/corcompare/mono-api-info.cs
mcs/tools/linker/Descriptors/mscorlib.xml
mcs/tools/mono-api-html/MemberComparer.cs
mono/io-layer/io.c
mono/io-layer/processes.c
mono/io-layer/shared.c
mono/metadata/assembly.c
mono/metadata/gc.c
mono/metadata/mono-debug.c
mono/metadata/mono-debug.h
mono/metadata/object-internals.h
mono/metadata/object.c
mono/metadata/remoting.c
mono/metadata/remoting.h
mono/metadata/threadpool-ms.c
mono/metadata/threads.c
mono/metadata/wrapper-types.h
mono/mini/Makefile.am.in
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/debug-mini.c
mono/mini/debugger-agent.c
mono/mini/mini-runtime.c
mono/mini/mini-trampolines.c
mono/mini/mini.h
mono/mini/tasklets.c
mono/tests/Makefile.am
mono/utils/mono-coop-mutex.h
mono/utils/mono-coop-semaphore.h
mono/utils/mono-os-mutex.h
mono/utils/mono-os-semaphore.h
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows.c
mono/utils/mono-threads.c
mono/utils/w32handle.c
scripts/ci/run-jenkins.sh
scripts/ci/run-test-acceptance-tests.sh [new file with mode: 0755]
scripts/ci/run-test-default.sh
tools/offsets-tool/MonoAotOffsetsDumper.cs

index 9c6dc7e971457668dc80b31fa3d5d152d9b3f363..aaffb9842ba9dbe36090cead00afe0d1ebe1232d 100644 (file)
@@ -67,9 +67,13 @@ get-monolite-latest:
        cd $(mcslib) && { (wget -O- $(monolite_url) || curl $(monolite_url)) | gzip -d | tar xf - ; }
        cd $(mcslib) && mv -f monolite-* monolite
 
+if BITCODE
+BITCODE_CHECK=yes
+endif
+
 .PHONY: check-ci
 check-ci:
-       MONO_LLVMONLY=$(MONO_LLVMONLY) $(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
+       MONO_LLVMONLY=$(BITCODE_CHECK) $(srcdir)/scripts/ci/run-test-$(TEST_PROFILE).sh
 
 .PHONY: validate do-build-mono-mcs mcs-do-clean mcs-do-tests
 validate: do-build-mono-mcs
index fbfa2760ec2744588adbfb251e67a2a4adf3ae23..a91c68d986b5a97720963c05258a82354cc7efa8 100644 (file)
@@ -4,17 +4,11 @@ check-roslyn:
        sed -i -e 's/\\4.5-api"/\\4.5"/g' $$PREFIX/lib/mono/xbuild-frameworks/.NETFramework/v4.5/RedistList/FrameworkList.xml; \
        export MSBuildExtensionsPath=$$PREFIX/lib/mono/xbuild; \
        MONO_DOTNET_PORTABLE_DIR=$$PREFIX/lib/mono/xbuild-frameworks/.NETPortable/; \
-       MONO_NUGET_TARGETS_DIR=$$PREFIX/lib/mono/xbuild/Microsoft/NuGet/; \
-       MONO_PORTABLE_TARGETS_DIR=$$PREFIX/lib/mono/xbuild/Microsoft/Portable/v5.0; \
-       if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v5.0" ]; then \
+       if [ ! -d "$$MONO_DOTNET_PORTABLE_DIR/v4.6" ]; then \
                mkdir -p $$MONO_DOTNET_PORTABLE_DIR; \
-               mkdir -p $$MONO_NUGET_TARGETS_DIR; \
-               mkdir -p $$MONO_PORTABLE_TARGETS_DIR; \
                curl -SL "http://download.mono-project.com/third-party/RoslynBuildDependencies.zip" > /tmp/RoslynBuildDependencies.zip; \
                unzip -o /tmp/RoslynBuildDependencies.zip -d /tmp/RoslynBuildDependencies; \
                cp -r /tmp/RoslynBuildDependencies/PortableReferenceAssemblies/* $$MONO_DOTNET_PORTABLE_DIR; \
-               cp /tmp/RoslynBuildDependencies/NuGetTargets/* $$MONO_NUGET_TARGETS_DIR; \
-               cp /tmp/RoslynBuildDependencies/PortableTargets/* $$MONO_PORTABLE_TARGETS_DIR; \
        fi; \
        cd $(ROSLYN_PATH); \
        sed -i -e 'N; s/bootstrapArg=".*\n.*"/bootstrapArg=""/g' cibuild.sh; \
index f2ac137b67f46b2067829fdf1f1af9d31a3abd59..b4ac2f5f28b3e79174cd26fd626ab7a0b63d89ba 100644 (file)
@@ -2,7 +2,7 @@
 #AC_PREREQ([2.62])
 
 # when bumping version number below, keep it in sync with man/mono.1 too
-AC_INIT(mono, [4.5.2],
+AC_INIT(mono, [4.7.0],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README.md])
@@ -892,8 +892,6 @@ AM_CONDITIONAL(INSTALL_MOBILE_STATIC, [test "x$with_mobile_static" != "xno"])
 
 AC_SUBST(INSTALL_MOBILE_STATIC)
 
-AC_SUBST(BITCODE)
-
 default_profile=net_4_x
 if test -z "$INSTALL_MONODROID_TRUE"; then :
    default_profile=monodroid
index 81f5ae9838987a1805e1d9bcb175bc758af330e0..0cc2e0097a1e6d7266f9f642d15060fff1af43ff 100644 (file)
@@ -7,7 +7,7 @@
 .\" Author:
 .\"   Miguel de Icaza (miguel@gnu.org)
 .\"
-.TH Mono "Mono 4.5.2"
+.TH Mono "Mono 4.7.0"
 .SH NAME
 mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
 .SH SYNOPSIS
diff --git a/mcs/class/Facades/System.IO.Compression/AssemblyInfo.cs b/mcs/class/Facades/System.IO.Compression/AssemblyInfo.cs
deleted file mode 100644 (file)
index 08e157f..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 
-// Copyright (c) 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.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle ("System.IO.Compression.dll")]
-[assembly: AssemblyDescription ("System.IO.Compression.dll")]
-[assembly: AssemblyDefaultAlias ("System.IO.Compression.dll")]
-[assembly: AssemblyCompany ("Xamarin, Inc.")]
-[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
-[assembly: AssemblyCopyright ("Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.com)")]
-[assembly: AssemblyVersion ("4.0.0.0")]
-[assembly: AssemblyInformationalVersion ("4.0.0.0")]
-[assembly: AssemblyFileVersion ("4.0.0.0")]
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
-
-
diff --git a/mcs/class/Facades/System.IO.Compression/Makefile b/mcs/class/Facades/System.IO.Compression/Makefile
deleted file mode 100644 (file)
index 4fbfc56..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-MCS_BUILD_DIR = ../../../build
-
-thisdir = class/Facades/System.IO.Compression
-SUBDIRS = 
-include $(MCS_BUILD_DIR)/rules.make
-
-LIBRARY_SUBDIR = Facades
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.IO.Compression.dll
-
-KEY_FILE = ../../msfinal.pub
-SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699
-LIB_REFS = System
-LIB_MCS_FLAGS = $(SIGN_FLAGS)
-
-PLATFORM_DEBUG_FLAGS =
-
-NO_TEST = yes
-
-include $(MCS_BUILD_DIR)/library.make
-
-
diff --git a/mcs/class/Facades/System.IO.Compression/Missing.cs b/mcs/class/Facades/System.IO.Compression/Missing.cs
deleted file mode 100644 (file)
index cd06b1c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// This is stub only. The implementation should come from https://github.com/dotnet/corefx/tree/master/src/System.IO.Compression/src/System/IO/Compression
-
-namespace System.IO.Compression
-{
-       public class ZipArchive : System.IDisposable
-       {
-               public ZipArchive(System.IO.Stream stream) { }
-               public ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode) { }
-               public ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen) { }
-               public ZipArchive(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding entryNameEncoding) { }
-               public System.Collections.ObjectModel.ReadOnlyCollection<System.IO.Compression.ZipArchiveEntry> Entries { get { return default(System.Collections.ObjectModel.ReadOnlyCollection<System.IO.Compression.ZipArchiveEntry>); } }
-               public System.IO.Compression.ZipArchiveMode Mode { get { return default(System.IO.Compression.ZipArchiveMode); } }
-               public System.IO.Compression.ZipArchiveEntry CreateEntry(string entryName) { return default(System.IO.Compression.ZipArchiveEntry); }
-               public System.IO.Compression.ZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel) { return default(System.IO.Compression.ZipArchiveEntry); }
-               public void Dispose() { }
-               protected virtual void Dispose(bool disposing) { }
-               public System.IO.Compression.ZipArchiveEntry GetEntry(string entryName) { return default(System.IO.Compression.ZipArchiveEntry); }
-       }
-
-       public partial class ZipArchiveEntry
-       {
-               internal ZipArchiveEntry() { }
-               public System.IO.Compression.ZipArchive Archive { get { return default(System.IO.Compression.ZipArchive); } }
-               public long CompressedLength { get { return default(long); } }
-               public string FullName { get { return default(string); } }
-               public System.DateTimeOffset LastWriteTime { get { return default(System.DateTimeOffset); } set { } }
-               public long Length { get { return default(long); } }
-               public string Name { get { return default(string); } }
-               public void Delete() { }
-               public System.IO.Stream Open() { return default(System.IO.Stream); }
-               public override string ToString() { return default(string); }
-       }
-
-       public enum ZipArchiveMode
-       {
-               Create = 1,
-               Read = 0,
-               Update = 2,
-       }
-}
\ No newline at end of file
diff --git a/mcs/class/Facades/System.IO.Compression/System.IO.Compression.dll.sources b/mcs/class/Facades/System.IO.Compression/System.IO.Compression.dll.sources
deleted file mode 100644 (file)
index 402d066..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-TypeForwarders.cs
-AssemblyInfo.cs
-Missing.cs
diff --git a/mcs/class/Facades/System.IO.Compression/TypeForwarders.cs b/mcs/class/Facades/System.IO.Compression/TypeForwarders.cs
deleted file mode 100644 (file)
index 5eaf037..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-// 
-// Copyright (c) 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.
-// 
-
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.CompressionLevel))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.CompressionMode))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.DeflateStream))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.IO.Compression.GZipStream))]
-
-
index d97ad54eb89f246a0302e5b6234e5a3356dd65c7..0933eeef41282d83d6e96fc24774e38d511a0d14 100644 (file)
 
 namespace System.Text
 {
-       public sealed partial class CodePagesEncodingProvider
+       public sealed class CodePagesEncodingProvider : EncodingProvider
        {
+               static readonly CodePagesEncodingProvider instance = new CodePagesEncodingProvider ();
+
                private CodePagesEncodingProvider ()
                {
                }
                
-               public static System.Text.EncodingProvider Instance { 
+               public static EncodingProvider Instance {
                        get {
-                               throw new NotImplementedException ();
+                               return instance;
                        }
                }
+
+               public override Encoding GetEncoding (string name)
+               {
+                       // MSDN: "if name is not the name of an encoding that you support, the method should return null."
+                       // We do this here since all our encodings are already supported by the main Encoding class
+                       return null;
+               }
+
+               public override Encoding GetEncoding (int codepage)
+               {
+                       // MSDN: "if codepage is not the code page identifier of an encoding that you support, the method should return null."
+                       // We do this here since all our encodings are already supported by the main Encoding class
+                       return null;
+               }
        }
 }
\ No newline at end of file
index 8a525e19ab2627e5416715a932fc6e5c98998334..65b30b9e8ec3af755be515c4e2e5d8bd4c1259db 100644 (file)
@@ -25,7 +25,7 @@ System.Security.Cryptography.Hashing.Algorithms System.Security.Cryptography.RSA
 System.Security.Principal.Windows System.Threading.Thread System.Threading.ThreadPool \
 System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win32.Registry.AccessControl System.Diagnostics.StackTrace System.Globalization.Extensions \
 System.IO.FileSystem.AccessControl System.Private.CoreLib.InteropServices System.Reflection.TypeExtensions \
-System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument System.IO.Compression \
+System.Security.SecureString System.Threading.AccessControl System.Threading.Overlapped System.Xml.XPath.XDocument \
 System.Security.Cryptography.Algorithms System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
 System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
 
index f38a41c7f57690dbcf5c984eecd337ee1fc8c45d..4fbea10f4f9c5badc48dfb1f3b6f2e291f68d497 100644 (file)
@@ -5,3 +5,4 @@ Evaluator/EvaluatorFixture.cs
 Evaluator/EvaluatorTest.cs
 Evaluator/ExpressionsTest.cs
 Evaluator/TypesTest.cs
+Visit/ASTVisitorTest.cs
index 81d42f93f183268f36c5b500d9bca8dc8909f5ea..ea15e44a74f3a21ab24cca0e6b1d5ec90d961a4c 100644 (file)
@@ -38,24 +38,21 @@ completionList.Add (""delegate"" + sb, ""md-keyword"", GettextCatalog.GetString
 
                        var stream = new MemoryStream (Encoding.UTF8.GetBytes (content));
 
-                       var ctx = new CompilerContext (new CompilerSettings (), new Report (new AssertReportPrinter ()));
+                       var ctx = new CompilerContext (new CompilerSettings (), new AssertReportPrinter ());
 
                        ModuleContainer module = new ModuleContainer (ctx);
+                       var file = new SourceFile ("test", "asdfas", 0);
                        CSharpParser parser = new CSharpParser (
                                new SeekableStreamReader (stream, Encoding.UTF8),
-                               new CompilationUnit ("name", "path", 0),
-                               module);
+                               new CompilationSourceFile (module, file),
+                               ctx.Report,
+                               new ParserSession ());
 
                        RootContext.ToplevelTypes = module;
-                       Location.AddFile (ctx.Report, "asdfas");
-                       Location.Initialize ();
-                       parser.LocationsBag = new LocationsBag ();
+                       Location.Initialize (new List<SourceFile> { file });
                        parser.parse ();
 
-                       var m = module.Types[0].Methods[0] as Method;
-                       var s = m.Block.FirstStatement;
-                       var o = s.loc.Column;
-                       
+                       Assert.AreEqual (0, ctx.Report.Errors);
 
                        module.Accept (new TestVisitor ());
                }
index 6a71501e34c7b5bdb833a64e5e5c5f71d406c512..ec641ef2b6f617a373525b9489b8e1663cb47d89 100644 (file)
@@ -1,2 +1 @@
 #include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
index 6a71501e34c7b5bdb833a64e5e5c5f71d406c512..ec641ef2b6f617a373525b9489b8e1663cb47d89 100644 (file)
@@ -1,2 +1 @@
 #include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
index 6a71501e34c7b5bdb833a64e5e5c5f71d406c512..ec641ef2b6f617a373525b9489b8e1663cb47d89 100644 (file)
@@ -1,2 +1 @@
 #include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
index d92fb61f8a9b42622bb75b7adf1437104e2833da..1f20c1f89c63b6dceeb793a7241f8a2d4a6d34c2 100644 (file)
@@ -15,10 +15,13 @@ VALID_TEST_PROFILE := $(filter net_4_x, $(PROFILE))
 # The test exe is not profile specific, and compiling a 2.0 will make the 4.5 tests fail
 ifdef VALID_TEST_PROFILE
 
+TEST_HELPERS_SOURCES = \
+       ../test-helpers/NetworkHelpers.cs
+
 test-local: dtest-app.exe dtest-excfilter.exe
 
-dtest-app.exe: Test/dtest-app.cs
-       $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs
+dtest-app.exe: Test/dtest-app.cs $(TEST_HELPERS_SOURCES)
+       $(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/System.Core.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -out:$@ -unsafe $(PLATFORM_DEBUG_FLAGS) -optimize- Test/dtest-app.cs $(TEST_HELPERS_SOURCES)
 
 dtest-excfilter.exe: Test/dtest-excfilter.il
        MONO_PATH=$(topdir)/class/lib/$(PROFILE) $(INTERNAL_ILASM) -out:$@ /exe /debug Test/dtest-excfilter.il
index 4b9d569b1ad941d860ff1c0f95482b1c823e2b2d..6587c37c0b5fc0aea66cbf2af2f2b3f8586b88ff 100644 (file)
@@ -9,8 +9,11 @@ using System.Reflection;
 using System.Reflection.Emit;
 using System.Diagnostics;
 using System.Threading;
+using System.Threading.Tasks;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net.Sockets;
+using MonoTests.Helpers;
 
 public class TestsBase
 {
@@ -311,6 +314,10 @@ public class Tests : TestsBase, ITest2
                        wait_one ();
                        return 0;
                }
+               if (args.Length >0 && args [0] == "threadpool-io") {
+                       threadpool_io ();
+                       return 0;
+               }
                breakpoints ();
                single_stepping ();
                arguments ();
@@ -1541,6 +1548,46 @@ public class Tests : TestsBase, ITest2
        public override string virtual_method () {
                return "V2";
        }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void threadpool_bp () { }
+
+       [MethodImplAttribute (MethodImplOptions.NoInlining)]
+       public static void threadpool_io () {
+               // Start a threadpool task that blocks on I/O.
+               // Regression test for #42625
+               const int nbytes = 16;
+               var bsOut = new byte[nbytes];
+               for (int i = 0; i < nbytes; i++) {
+                       bsOut[i] = (byte)i;
+               }
+               var endPoint = NetworkHelpers.LocalEphemeralEndPoint ();
+               var l = new TcpListener (endPoint);
+               l.Start ();
+               Task<byte[]> t = Task.Run (async () => {
+                       var c = new TcpClient ();
+                       await c.ConnectAsync (endPoint.Address, endPoint.Port);
+                       var streamIn = c.GetStream ();
+                       var bs = new byte[nbytes];
+                       int nread = 0;
+                       while (nread < nbytes) {
+                               nread += await streamIn.ReadAsync (bs, nread, nbytes);
+                       }
+                       streamIn.Close ();
+                       return bs;
+                       });
+               var s = l.AcceptTcpClient ();
+               l.Stop ();
+               // write bytes in two groups so that the task blocks on the ReadAsync
+               var streamOut = s.GetStream ();
+               var nbytesFirst = nbytes / 2;
+               var nbytesRest = nbytes - nbytesFirst;
+               streamOut.Write (bsOut, 0, nbytesFirst);
+               threadpool_bp ();
+               streamOut.Write (bsOut, nbytesFirst, nbytesRest);
+               streamOut.Close ();
+               var bsIn = t.Result;
+       }
 }
 
 class TypeLoadClass {
index c0af12cb38ac15d9f023d11cfffa62408e2fb559..88ed411da35bcabcf36968da7de70dcaa9fc7d16 100644 (file)
@@ -4035,6 +4035,22 @@ public class DebuggerTests
                // Make sure we are still in the cctor
                Assert.AreEqual (".cctor", e.Thread.GetFrames ()[0].Location.Method.Name);
        }
+
+       [Test]
+       public void ThreadpoolIOsinglestep () {
+               TearDown ();
+               Start ("dtest-app.exe", "threadpool-io");
+               // This is a regression test for #42625.  It tests the
+               // interaction (particularly in coop GC) of the
+               // threadpool I/O mechanism and the soft debugger.
+               Event e = run_until ("threadpool_io");
+               // run until we sent the task half the bytes it
+               // expects, so that it blocks waiting for the rest.
+               e = run_until ("threadpool_bp");
+               var req = create_step (e);
+               e = step_out (); // leave threadpool_bp
+               e = step_out (); // leave threadpool_io
+       }
 }
 
 }
index d0b2de6542978b53e0914d753b927fddb64a709d..6fa67a901d58dc20d88736050363c29295368765 100644 (file)
@@ -6,170 +6,184 @@ using Mono.Tasklets;
 namespace MonoTests.System
 {
     [TestFixture]
-       public class ContinuationsTest {
-
-               private Continuation _contA = new Continuation();
-
-               private int total = 0;
-
-               [Test]
-               public void TestContinuationsLoop() {
-                       _contA.Mark();
-                       int value = 0;
-                       int ret = _contA.Store(0);
-                       for(int i = ret; i < 10; i++) {
-                               value += i;
-                       }
-
-                       if(value > 0) {
-                               total += value;
-                               _contA.Restore(ret + 1);
-                       }
-
-                       Assert.AreEqual(total,330);
-               }
-
-               private int yields = 0;
-
-               [Test]
-               public void Yielding() {
-                       Continuation baseCont = new Continuation();
-                       Continuation taskCont = new Continuation();
-                       
-                       baseCont.Mark();
-                       taskCont.Mark();
-                       
-                       // Store the base continuation to start the task
-                       if (baseCont.Store(0) == 0) {
-                               bool done = false;
-                               int count = 0;
-
-                               while (!done) {
-                                       // Do stuff for the task.
-                                       ++count;
-                                       
-                                       // This task is counting to 100.
-                                       if (count == 100) {
-                                               done = true;
-                                       }
-
-                                       // Yield every 10 loops
-                                       else if (count % 10 == 0) {
-
-                                               // To yield, store the task continuation then restore
-                                               // the base continuation.
-                                               if (taskCont.Store(0) == 0) {
-                                                       baseCont.Restore(1);
-                                               }
-                                       }
-                               }
-                       }
-                       // When restored, 'Store' will return what was passed to Restore, in this case 1 so fall here.
-                       else {
-                               // Count the yields, then go back to the task.
-                               ++yields;
-                               taskCont.Restore(1);
-                       }
-
-                       Assert.AreEqual(9, yields);
-               }
-
-
-               public class MicroThread {
-                       
-                       public void Yield() {
-                               if (MyThread.Store(0) == 0) {
-                                       MainThread.Restore(1);
-                               }
-                       }
-
-                       public void Resume() {
-                               if (MainThread.Store(0) == 0) {
-                                       MyThread.Restore(1);
-                               }
-                       }
-
-                       public void DoWork(Action action) {
-                               if (MainThread.Store(0) == 0) {
-                                       action();
-                                       Done = true;
-                                       MainThread.Restore(1);
-                               }
-                       }
-
-                       public bool Done = false;
-                       public Continuation MainThread = new Continuation();
-                       public Continuation MyThread = new Continuation();
-               }
-               
-               public class MicroBJob {
-                       private int _Count = 0;
-                       public int Count { 
-                               get { return _Count; }
-                               set { _Count = value;}
-                       }
-
-                       public MicroThread MicroThread;
-                       public void Work() {
-                               while (Count < 100) {
-                                       ++Count;
-                                       if (Count % 10 == 0) {
-                                               MicroThread.Yield();
-                                       }
-                               }
-                       }
-               }
-
-               [Test]
-               public void MicroThreadTest() {
-                       MicroThread microA = new MicroThread();
-                       MicroThread microB = new MicroThread();
-
-                       microA.MainThread.Mark();
-                       microA.MyThread.Mark();
-                       microB.MainThread.Mark();
-                       microB.MyThread.Mark();
-
-                       Assert.AreEqual(false,microA.Done);
-                       Assert.AreEqual(false,microB.Done);
-                       
-                       microA.DoWork( () => {
-                               int count = 0;
-                               while (count < 100) {
-                                       ++count;
-                                       if (count % 10 == 0) {
-                                               microA.Yield();
-                                       }
-                               }
-                       });
-               
-                       MicroBJob jobB = new MicroBJob();
-                       jobB.MicroThread = microB;
-
-                       microB.DoWork(jobB.Work);
-
-                       Assert.AreEqual(false,microA.Done);
-                       Assert.AreEqual(false,microB.Done);
-
-                       int yields = 0;
-                       while (yields < 20) {
-                               if (!microA.Done) microA.Resume();
-                               if (!microB.Done) microB.Resume();
-                               if (microA.Done && microB.Done) break;
-                               ++yields;
-                       }
-
-                       Assert.AreEqual(true,microA.Done);
-                       Assert.AreEqual(true,microB.Done);
-                       Assert.AreEqual(100,jobB.Count);
-                       Assert.AreEqual(9,yields);
-               }
-       }
+    public class ContinuationsTest
+    {
+        [TestFixtureSetUp]
+        public void FixtureSetUp ()
+        {
+            try {
+                var temp = new Continuation ();
+            } catch (NotImplementedException) {
+                Assert.Ignore ("This platform doesn't support Tasklets.");
+            }
+        }
+
+        int total = 0;
+
+        [Test]
+        public void TestContinuationsLoop()
+        {
+            Continuation _contA = new Continuation();
+
+            _contA.Mark();
+            int value = 0;
+            int ret = _contA.Store(0);
+            for (int i = ret; i < 10; i++) {
+                value += i;
+            }
+
+            if (value > 0) {
+                total += value;
+                _contA.Restore(ret + 1);
+            }
+
+            Assert.AreEqual(total, 330);
+        }
+
+        private int yields = 0;
+
+        [Test]
+        public void Yielding()
+        {
+            Continuation baseCont = new Continuation();
+            Continuation taskCont = new Continuation();
+
+            baseCont.Mark();
+            taskCont.Mark();
+
+            // Store the base continuation to start the task
+            if (baseCont.Store(0) == 0) {
+                bool done = false;
+                int count = 0;
+
+                while (!done) {
+                    // Do stuff for the task.
+                    ++count;
+
+                    // This task is counting to 100.
+                    if (count == 100) {
+                        done = true;
+                    }
+
+                    // Yield every 10 loops
+                    else if (count % 10 == 0) {
+
+                        // To yield, store the task continuation then restore
+                        // the base continuation.
+                        if (taskCont.Store(0) == 0) {
+                            baseCont.Restore(1);
+                        }
+                    }
+                }
+            }
+            // When restored, 'Store' will return what was passed to Restore, in this case 1 so fall here.
+            else {
+                // Count the yields, then go back to the task.
+                ++yields;
+                taskCont.Restore(1);
+            }
+
+            Assert.AreEqual(9, yields);
+        }
+
+
+        public class MicroThread
+        {
+
+            public void Yield()
+            {
+                if (MyThread.Store(0) == 0) {
+                    MainThread.Restore(1);
+                }
+            }
+
+            public void Resume()
+            {
+                if (MainThread.Store(0) == 0) {
+                    MyThread.Restore(1);
+                }
+            }
+
+            public void DoWork(Action action)
+            {
+                if (MainThread.Store(0) == 0) {
+                    action();
+                    Done = true;
+                    MainThread.Restore(1);
+                }
+            }
+
+            public bool Done = false;
+            public Continuation MainThread = new Continuation();
+            public Continuation MyThread = new Continuation();
+        }
+
+        public class MicroBJob
+        {
+            private int _Count = 0;
+            public int Count
+            {
+                get { return _Count; }
+                set { _Count = value; }
+            }
+
+            public MicroThread MicroThread;
+            public void Work()
+            {
+                while (Count < 100) {
+                    ++Count;
+                    if (Count % 10 == 0) {
+                        MicroThread.Yield();
+                    }
+                }
+            }
+        }
+
+        [Test]
+        public void MicroThreadTest()
+        {
+            MicroThread microA = new MicroThread();
+            MicroThread microB = new MicroThread();
+
+            microA.MainThread.Mark();
+            microA.MyThread.Mark();
+            microB.MainThread.Mark();
+            microB.MyThread.Mark();
+
+            Assert.AreEqual(false, microA.Done);
+            Assert.AreEqual(false, microB.Done);
+
+            microA.DoWork(() =>
+            {
+                int count = 0;
+                while (count < 100) {
+                    ++count;
+                    if (count % 10 == 0) {
+                        microA.Yield();
+                    }
+                }
+            });
+
+            MicroBJob jobB = new MicroBJob();
+            jobB.MicroThread = microB;
+
+            microB.DoWork(jobB.Work);
+
+            Assert.AreEqual(false, microA.Done);
+            Assert.AreEqual(false, microB.Done);
+
+            int yields = 0;
+            while (yields < 20) {
+                if (!microA.Done) microA.Resume();
+                if (!microB.Done) microB.Resume();
+                if (microA.Done && microB.Done) break;
+                ++yields;
+            }
+
+            Assert.AreEqual(true, microA.Done);
+            Assert.AreEqual(true, microB.Done);
+            Assert.AreEqual(100, jobB.Count);
+            Assert.AreEqual(9, yields);
+        }
+    }
 }
-
-// vim: noexpandtab
-// Local Variables:
-// tab-width: 4
-// c-basic-offset: 4
-// indent-tabs-mode: t
-// End:
index 4489cceea185442afc7b62e8476f80ee2436ab13..30969ddee01b4bd65e7f9bf96225cc8369779b8e 100644 (file)
@@ -1,4 +1,5 @@
 ../../build/common/SR.cs
+../../build/common/MonoTODOAttribute.cs
 
 Assembly/AssemblyInfo.cs
 System/Util.cs
index 04a93d20c2dfb28f6caf3366b63edf152ecf6de8..0362d94774ad4b90d592729c79112b48e5b4b8d3 100644 (file)
@@ -33,131 +33,135 @@ using System.Data.SqlTypes;
 
 namespace Microsoft.SqlServer.Server 
 {
-       public sealed class SqlDataRecord : IDataRecord
+       public class SqlDataRecord : IDataRecord
        {
-               public bool GetBoolean (int ordinal)
+               public SqlDataRecord (params SqlMetaData[] metaData)
+               {
+               }
+
+               public virtual bool GetBoolean (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public byte GetByte (int ordinal)
+               public virtual byte GetByte (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public long GetBytes (int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length)
+               public virtual long GetBytes (int ordinal, long fieldOffset, byte[] buffer, int bufferOffset, int length)
                {
                        throw new NotImplementedException ();
                }
 
-               public char GetChar (int ordinal)
+               public virtual char GetChar (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public long GetChars (int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length)
+               public virtual long GetChars (int ordinal, long fieldOffset, char[] buffer, int bufferOffset, int length)
                {
                        throw new NotImplementedException ();
                }
 
-               public IDataReader GetData (int ordinal)
+               public virtual IDataReader GetData (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public string GetDataTypeName (int ordinal)
+               public virtual string GetDataTypeName (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public DateTime GetDateTime (int ordinal)
+               public virtual DateTime GetDateTime (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public decimal GetDecimal (int ordinal)
+               public virtual decimal GetDecimal (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public double GetDouble (int ordinal)
+               public virtual double GetDouble (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public System.Type GetFieldType (int ordinal)
+               public virtual System.Type GetFieldType (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public float GetFloat (int ordinal)
+               public virtual float GetFloat (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public Guid GetGuid (int ordinal)
+               public virtual Guid GetGuid (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public short GetInt16 (int ordinal)
+               public virtual short GetInt16 (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int GetInt32 (int ordinal)
+               public virtual int GetInt32 (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public long GetInt64 (int ordinal)
+               public virtual long GetInt64 (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public string GetName (int ordinal)
+               public virtual string GetName (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int GetOrdinal (string name)
+               public virtual int GetOrdinal (string name)
                {
                        throw new NotImplementedException ();
                }
 
-               public string GetString (int ordinal)
+               public virtual string GetString (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public object GetValue (int ordinal)
+               public virtual object GetValue (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int GetValues (object[] values)
+               public virtual int GetValues (object[] values)
                {
                        throw new NotImplementedException ();
                }
 
-               public bool IsDBNull (int ordinal)
+               public virtual bool IsDBNull (int ordinal)
                {
                        throw new NotImplementedException ();
                }
 
-               public int FieldCount {
+               public virtual int FieldCount {
                        get {
                                throw new NotImplementedException ();
                        }
                }
 
-               public object this [string name] {
+               public virtual object this [string name] {
                        get {
                                throw new NotImplementedException ();
                        }
                }
 
-               public object this [int ordinal] {
+               public virtual object this [int ordinal] {
                        get {
                                throw new NotImplementedException ();
                        }
index aa678a036e6d2f8219e3d89a55695dba90dfdffa..f1af864e214943a61321e2cf20cf93ff4a215cc7 100644 (file)
@@ -321,6 +321,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Proxy_Disabled ()
                {
                        var pp = WebRequest.DefaultWebProxy;
@@ -397,6 +398,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Default ()
                {
                        bool? failed = null;
@@ -441,6 +443,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Version_1_0 ()
                {
                        bool? failed = null;
@@ -488,6 +491,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_ClientHandlerSettings ()
                {
                        bool? failed = null;
@@ -552,6 +556,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_CustomHeaders ()
                {
                        bool? failed = null;
@@ -616,6 +621,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_CustomHeaders_SpecialSeparators ()
                {
                        bool? failed = null;
@@ -650,6 +656,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_CustomHeaders_Host ()
                {
                        bool? failed = null;
@@ -683,6 +690,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Transfer_Encoding_Chunked ()
                {
                        bool? failed = null;
@@ -712,6 +720,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Transfer_Encoding_Custom ()
                {
                        bool? failed = null;
@@ -740,6 +749,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Content ()
                {
                        var listener = CreateListener (l => {
@@ -767,6 +777,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Content_MaxResponseContentBufferSize ()
                {
                        var listener = CreateListener (l => {
@@ -789,6 +800,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Content_MaxResponseContentBufferSize_Error ()
                {
                        var listener = CreateListener (l => {
@@ -815,6 +827,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_NoContent ()
                {
                        foreach (var method in new HttpMethod[] { HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete }) {
@@ -847,6 +860,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Complete_Error ()
                {
                        var listener = CreateListener (l => {
@@ -867,6 +881,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_Get ()
                {
                        var listener = CreateListener (l => {
@@ -886,6 +901,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_BomEncoding ()
                {
                        var listener = CreateListener (l => {
@@ -910,6 +926,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_Put ()
                {
                        bool passed = false;
@@ -935,6 +952,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Send_Content_Put_CustomStream ()
                {
                        bool passed = false;
@@ -1037,6 +1055,7 @@ namespace MonoTests.System.Net.Http
 
                [Test]
                [Category ("MobileNotWorking")] // Missing encoding
+               [Category ("RequiresBSDSockets")]
                public void GetString_Many ()
                {
                        Action<HttpListenerContext> context = (HttpListenerContext l) => {
@@ -1066,6 +1085,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void GetByteArray_ServerError ()
                {
                        var listener = CreateListener (l => {
@@ -1088,6 +1108,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void DisallowAutoRedirect ()
                {
                        var listener = CreateListener (l => {
@@ -1116,6 +1137,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void RequestUriAfterRedirect ()
                {
                        var listener = CreateListener (l => {
@@ -1156,6 +1178,7 @@ namespace MonoTests.System.Net.Http
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                /*
                 * Properties may only be modified before sending the first request.
                 */
index 14f7d1a586d2c3520881ab576cda88b3cb97e37b..e900c22bfeaab4f99b6b5b94728eb66d166b1a8a 100644 (file)
@@ -136,13 +136,25 @@ namespace Mono.Net.Security
                        bool result;
 
 #if MONODROID
-                       result = AndroidPlatform.TrustEvaluateSsl (certs);
-                       if (result) {
-                               // chain.Build() + GetErrorsFromChain() (above) will ALWAYS fail on
-                               // Android (there are no mozroots or preinstalled root certificates),
-                               // thus `errors` will ALWAYS have RemoteCertificateChainErrors.
-                               // Android just verified the chain; clear RemoteCertificateChainErrors.
-                               errors  &= ~SslPolicyErrors.RemoteCertificateChainErrors;
+                       try {
+                               result = AndroidPlatform.TrustEvaluateSsl (certs);
+                               if (result) {
+                                       // FIXME: check whether this is still correct.
+                                       //
+                                       // chain.Build() + GetErrorsFromChain() (above) will ALWAYS fail on
+                                       // Android (there are no mozroots or preinstalled root certificates),
+                                       // thus `errors` will ALWAYS have RemoteCertificateChainErrors.
+                                       // Android just verified the chain; clear RemoteCertificateChainErrors.
+                                       errors  &= ~SslPolicyErrors.RemoteCertificateChainErrors;
+                               } else {
+                                       errors |= SslPolicyErrors.RemoteCertificateChainErrors;
+                                       status11 = unchecked((int)0x800B010B);
+                               }
+                       } catch {
+                               result = false;
+                               errors |= SslPolicyErrors.RemoteCertificateChainErrors;
+                               status11 = unchecked((int)0x800B010B);
+                               // Ignore
                        }
 #else
                        if (is_macosx) {
index f9183a51ef75135948c47ab0e234cf338e58fb62..7a29e8f83e3241b6d242f88239a5ca806f30fa87 100644 (file)
@@ -58,7 +58,6 @@ namespace System.Diagnostics
                        InnerList.AddRange (processModules);
                }
                
-#if !NET_2_1           
                public ProcessModule this[int index] {
                        get {
                                return (ProcessModule)InnerList[index];
@@ -79,6 +78,5 @@ namespace System.Diagnostics
                {
                        return InnerList.IndexOf (module);
                }
-#endif
        }
 }
index 19cd965cd20ba055b565ad88c241cfafa3af1719..ffa9b9899dd399ce9bed25c34e97f77166edbb13 100644 (file)
@@ -69,7 +69,6 @@ namespace System.Diagnostics
                        InnerList.AddRange (processThreads);
                }
 
-#if !NET_2_1           
                public ProcessThread this[int index] {
                        get {
                                return (ProcessThread)InnerList[index];
@@ -105,6 +104,5 @@ namespace System.Diagnostics
                {
                        InnerList.Remove (thread);
                }
-#endif
        }
 }
index 8fa752a4476c8981af260df18a15091fbe5bef54..909beb4988c8873dc7a6cd85d2b383443f1b290a 100644 (file)
@@ -16,6 +16,7 @@ using System.Threading;
 namespace MonoTests.System.Net.Mail
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SmtpClientTest
        {
                SmtpClient smtp;
index 68118776fbefcff773d1c199d356a57b86f6c5b1..e5c70feab2c16b07d69d2a241697eea1f0d06220 100644 (file)
@@ -45,6 +45,7 @@ namespace MonoTests.System.Net.Security
 {
 
 [TestFixture]
+[Category ("RequiresBSDSockets")]
 public class SslStreamTest {
 
        byte[] m_serverCertRaw = { 48, 130, 5, 165, 2, 1, 3, 48, 130, 5, 95, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 5, 80, 4, 130, 5, 76, 48, 130, 5, 72, 48, 130, 2, 87, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 6, 160, 130, 2, 72, 48, 130, 2, 68, 2, 1, 0, 48, 130, 2, 61, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 211, 176, 234, 3, 252, 26, 32, 15, 2, 2, 7, 208, 128, 130, 2, 16, 183, 149, 35, 180, 127, 95, 163, 122, 138, 244, 29, 177, 220, 173, 46, 73, 208, 217, 211, 190, 164, 183, 21, 110, 33, 122, 98, 163, 251, 16, 23, 106, 154, 14, 52, 177, 3, 12, 248, 226, 48, 123, 211, 6, 216, 6, 192, 175, 203, 142, 141, 143, 252, 178, 7, 162, 81, 232, 159, 42, 56, 177, 191, 53, 7, 146, 189, 236, 75, 140, 210, 143, 11, 103, 64, 58, 10, 73, 123, 39, 97, 119, 166, 114, 123, 65, 68, 214, 42, 17, 156, 122, 8, 58, 184, 134, 255, 48, 64, 20, 229, 247, 196, 12, 130, 56, 176, 69, 179, 254, 216, 45, 25, 244, 240, 116, 88, 137, 66, 13, 18, 202, 199, 59, 200, 245, 19, 175, 232, 217, 211, 12, 191, 222, 26, 162, 253, 73, 201, 48, 61, 3, 248, 117, 16, 71, 233, 183, 90, 110, 91, 116, 56, 133, 223, 148, 19, 78, 140, 123, 159, 203, 78, 15, 172, 39, 190, 39, 71, 180, 155, 48, 156, 116, 212, 52, 1, 231, 201, 196, 73, 87, 68, 104, 208, 40, 104, 32, 218, 235, 245, 84, 136, 168, 51, 9, 93, 126, 46, 80, 180, 240, 144, 79, 88, 87, 159, 24, 108, 186, 9, 20, 48, 100, 148, 250, 4, 163, 115, 131, 44, 13, 38, 222, 117, 196, 196, 128, 114, 149, 97, 93, 37, 191, 3, 192, 231, 88, 80, 218, 147, 8, 192, 165, 27, 206, 56, 42, 157, 230, 223, 130, 253, 169, 182, 245, 192, 181, 18, 212, 133, 168, 73, 92, 66, 197, 117, 245, 107, 127, 23, 146, 249, 41, 66, 219, 210, 207, 221, 205, 205, 15, 110, 92, 12, 207, 76, 239, 4, 13, 129, 127, 170, 205, 253, 148, 208, 24, 129, 24, 210, 220, 85, 45, 179, 137, 66, 134, 142, 22, 112, 48, 160, 236, 232, 38, 83, 101, 55, 51, 18, 110, 99, 69, 41, 173, 107, 233, 11, 199, 23, 61, 135, 222, 94, 74, 29, 219, 80, 128, 167, 186, 254, 235, 42, 96, 134, 5, 13, 90, 59, 231, 137, 195, 207, 28, 165, 12, 218, 5, 72, 102, 61, 135, 198, 73, 250, 97, 89, 214, 179, 244, 194, 23, 142, 157, 4, 243, 90, 69, 54, 10, 139, 76, 95, 40, 225, 219, 59, 15, 54, 182, 206, 142, 228, 248, 79, 156, 129, 246, 63, 6, 6, 236, 44, 67, 116, 213, 170, 47, 193, 186, 139, 25, 80, 166, 57, 99, 231, 156, 191, 117, 65, 76, 7, 243, 244, 127, 225, 210, 190, 164, 141, 46, 36, 99, 111, 203, 133, 127, 80, 28, 61, 160, 36, 132, 182, 16, 41, 39, 185, 232, 123, 32, 57, 189, 100, 152, 38, 205, 5, 189, 240, 65, 3, 191, 73, 85, 12, 209, 180, 1, 194, 70, 124, 57, 71, 48, 230, 235, 122, 175, 157, 35, 233, 83, 40, 20, 169, 224, 14, 11, 216, 48, 194, 105, 25, 187, 210, 182, 6, 184, 73, 95, 85, 210, 227, 113, 58, 10, 186, 175, 254, 25, 102, 39, 3, 2, 200, 194, 197, 200, 224, 77, 164, 8, 36, 114, 48, 130, 2, 233, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 130, 2, 218, 4, 130, 2, 214, 48, 130, 2, 210, 48, 130, 2, 206, 6, 11, 42, 134, 72, 134, 247, 13, 1, 12, 10, 1, 2, 160, 130, 2, 166, 48, 130, 2, 162, 48, 28, 6, 10, 42, 134, 72, 134, 247, 13, 1, 12, 1, 3, 48, 14, 4, 8, 178, 13, 52, 135, 85, 49, 79, 105, 2, 2, 7, 208, 4, 130, 2, 128, 21, 84, 227, 109, 230, 144, 140, 170, 117, 250, 179, 207, 129, 100, 126, 126, 29, 231, 94, 140, 45, 26, 168, 45, 240, 4, 170, 73, 98, 115, 109, 96, 177, 206, 6, 80, 170, 22, 237, 144, 58, 95, 59, 26, 85, 135, 178, 69, 184, 44, 122, 81, 213, 135, 149, 198, 246, 83, 68, 129, 2, 186, 118, 33, 44, 214, 227, 240, 220, 51, 175, 220, 220, 180, 113, 216, 101, 138, 81, 54, 38, 0, 216, 30, 29, 187, 213, 230, 12, 181, 130, 21, 241, 98, 120, 41, 150, 176, 69, 37, 169, 249, 123, 212, 254, 135, 154, 214, 127, 39, 105, 149, 180, 218, 41, 207, 75, 70, 105, 169, 185, 169, 132, 173, 188, 82, 251, 71, 234, 136, 5, 254, 110, 223, 34, 4, 145, 7, 19, 51, 123, 140, 75, 226, 0, 21, 220, 228, 223, 218, 8, 169, 210, 194, 139, 93, 218, 55, 40, 174, 50, 238, 38, 166, 222, 103, 0, 209, 88, 131, 51, 222, 154, 217, 18, 172, 73, 17, 133, 54, 173, 208, 118, 104, 167, 113, 153, 223, 251, 154, 120, 176, 18, 127, 51, 206, 164, 77, 86, 9, 82, 212, 86, 162, 206, 230, 79, 217, 178, 42, 217, 162, 152, 188, 217, 59, 212, 117, 200, 135, 75, 74, 43, 1, 42, 79, 180, 164, 250, 122, 103, 103, 157, 11, 14, 33, 48, 8, 108, 155, 46, 124, 223, 204, 169, 124, 104, 11, 246, 213, 226, 16, 125, 17, 228, 15, 178, 141, 79, 78, 115, 76, 131, 122, 166, 124, 154, 1, 174, 178, 176, 213, 208, 188, 71, 118, 220, 168, 64, 218, 176, 134, 38, 229, 14, 109, 162, 125, 16, 57, 249, 201, 180, 17, 182, 143, 184, 12, 248, 113, 65, 70, 109, 79, 249, 34, 170, 35, 228, 219, 121, 202, 228, 121, 127, 255, 22, 173, 202, 171, 33, 232, 4, 240, 142, 216, 80, 56, 177, 83, 93, 123, 217, 213, 157, 99, 34, 194, 61, 228, 239, 194, 20, 27, 9, 53, 132, 79, 19, 97, 107, 31, 51, 39, 176, 223, 90, 88, 67, 138, 194, 169, 176, 144, 202, 119, 146, 74, 27, 118, 63, 129, 230, 101, 104, 75, 116, 49, 223, 254, 225, 70, 206, 183, 11, 134, 148, 10, 55, 57, 50, 178, 144, 164, 139, 233, 169, 109, 186, 211, 95, 123, 75, 111, 192, 187, 127, 240, 45, 226, 194, 240, 128, 10, 79, 178, 192, 66, 21, 197, 24, 171, 141, 255, 185, 230, 84, 206, 151, 9, 93, 115, 162, 12, 115, 129, 218, 103, 219, 183, 142, 123, 3, 110, 139, 208, 4, 146, 76, 99, 246, 240, 32, 169, 148, 16, 146, 172, 230, 36, 56, 145, 23, 94, 209, 92, 38, 244, 127, 70, 121, 253, 66, 55, 36, 140, 98, 105, 233, 112, 24, 23, 230, 112, 62, 244, 12, 48, 30, 51, 0, 18, 244, 139, 66, 245, 234, 203, 195, 52, 119, 255, 84, 82, 204, 100, 176, 167, 24, 224, 8, 127, 214, 148, 115, 242, 56, 190, 72, 221, 68, 252, 36, 74, 254, 57, 52, 96, 20, 173, 32, 236, 87, 15, 16, 76, 9, 48, 3, 61, 2, 137, 137, 9, 68, 213, 99, 163, 63, 201, 83, 241, 98, 7, 117, 108, 4, 123, 170, 18, 10, 19, 198, 31, 170, 15, 247, 216, 145, 172, 239, 137, 181, 80, 160, 24, 11, 35, 131, 58, 218, 22, 250, 215, 52, 160, 246, 197, 183, 92, 137, 0, 245, 63, 49, 183, 246, 195, 58, 63, 4, 75, 10, 92, 131, 181, 59, 78, 247, 44, 150, 49, 49, 107, 211, 62, 71, 62, 222, 159, 161, 118, 236, 55, 219, 49, 0, 3, 82, 236, 96, 20, 83, 39, 245, 208, 240, 245, 174, 218, 49, 21, 48, 19, 6, 9, 42, 134, 72, 134, 247, 13, 1, 9, 21, 49, 6, 4, 4, 1, 0, 0, 0, 48, 61, 48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20, 30, 154, 48, 126, 198, 239, 114, 62, 12, 58, 129, 172, 67, 156, 76, 214, 62, 205, 89, 28, 4, 20, 135, 177, 105, 83, 79, 93, 181, 149, 169, 49, 112, 201, 70, 212, 153, 79, 198, 163, 137, 90, 2, 2, 7, 208 };
index 9c3765e2d5b7ea95c8a4902f26075af16f0e5c76..e51f2d9b7d526e14185622f3337904180ebd89a9 100644 (file)
@@ -16,6 +16,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class NetworkStreamTest
        {
                [Test]
index 3815b623c39f53085f8670e788952f2ffcf89077..28bc6bb81745f29059c186633126c3addaabfa9a 100644 (file)
@@ -6,6 +6,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SocketAcceptAsyncTest
        {
                [Test]
index d59d39fad89d232798a341ce06bdd238b3da044f..d286668707e437635c1bc4e3920b45b4d2fa7072 100644 (file)
@@ -8,6 +8,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SocketAsyncTest
        {
                Socket serverSocket;
index f4586a253f8ce09c2b2178d6f5e08ad53b55445a..9551c1e6027131d4217bd59a13d986438873d5e2 100755 (executable)
@@ -28,6 +28,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class SocketTest
        {
                // note: also used in SocketCas tests
index 91b461487eb0cc38526671ac56a1ca34797fc8fa..4d3b8325048d9038ebfcaf8210960ebc71562f1a 100644 (file)
@@ -21,6 +21,7 @@ namespace MonoTests.System.Net.Sockets
        /// Tests System.Net.Sockets.TcpClient
        /// </summary>
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class TcpClientTest
        {
                
index b8594b8f11e7e489de6a1834bcb4dda1c1d7f655..1e211cf524920b999f0f090353814030a6dff829 100644 (file)
@@ -20,6 +20,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net.Sockets
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class TcpListenerTest
        {
                [Test]
index b7a537f662be204c61ffb1f6b1c9b6e0911d06cf..66b15308d1f84cb08efaae91d0bbe5b8e3acc62d 100644 (file)
@@ -15,6 +15,7 @@ using NUnit.Framework;
 
 namespace MonoTests.System.Net.Sockets {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class UdpClientTest {
                [Test] // .ctor ()
                public void Constructor1 ()
index da02abdd54747221770c7dc9692e6bf794a03c1c..37c40d7445e070cd8d5021dc238253b6bdac5db5 100644 (file)
@@ -9,6 +9,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class CookieParserTest
        {
                public const string A = "Foo=Bar, expires=World; expires=Sat, 11-Oct-14 22:45:19 GMT, A=B";
index a1b5f51cdd2ec37df3ae8037cfc242a9986c4ecb..dcc82f61678777cc202e1b94417d4b7a82c0d114 100644 (file)
@@ -19,6 +19,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net\r
 {\r
        [TestFixture]\r
+       [Category ("RequiresBSDSockets")]\r
        public class DnsTest\r
        {\r
                private String site1Name = "google-public-dns-a.google.com",\r
@@ -55,7 +56,7 @@ namespace MonoTests.System.Net
 \r
                        IAsyncResult async = Dns.BeginResolve (site1Dot, null, null);\r
                        IPHostEntry entry = Dns.EndResolve (async);\r
-                       SubTestValidIPHostEntry (entry);
+                       SubTestValidIPHostEntry (entry);\r
                        var ip = GetIPv4Address (entry);\r
                        Assert.AreEqual (site1Dot, ip.ToString ());\r
                }\r
@@ -306,7 +307,7 @@ namespace MonoTests.System.Net
                {\r
                        IPAddress addr = new IPAddress (IPAddress.NetworkToHostOrder ((int) site2IP));\r
                        IPHostEntry h = Dns.GetHostByAddress (addr);\r
-                       SubTestValidIPHostEntry (h);
+                       SubTestValidIPHostEntry (h);\r
                        var ip = GetIPv4Address (h);\r
                        Assert.AreEqual (addr.ToString (), ip.ToString ());\r
                }\r
index 6793d2a48fdeffefa3c47d532c664f915bcc4330..5f4166eecf855549bfd4ea8a51d9ffa556b14cb1 100644 (file)
@@ -25,6 +25,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class FileWebRequestTest
        {
                private string _tempDirectory;
index e740e1c67a5370f5aaf0caa2358c611a641f6336..93697cd29294145f8c1466224e44eacb5b210667 100644 (file)
@@ -19,6 +19,7 @@ using System.Threading;
 namespace MonoTests.System.Net 
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class FtpWebRequestTest
        {
                FtpWebRequest defaultRequest;
index 3afff1226ae85d5d8207c551ca5a2dac459f6cec..b0cedc555a4e8b34674790e2d6744c1a0e269b53 100644 (file)
@@ -47,6 +47,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net {
        
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListener2Test {
                
                private HttpListener _listener = null;
@@ -645,6 +646,7 @@ namespace MonoTests.System.Net {
        }
 
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListenerBugs {
                [Test]
                public void TestNonChunkedAsync ()
index 873481cbc5a44440c3343e13da21031d611f20bf..21589dc6c30914ebe227c22b04a99143a720457e 100644 (file)
@@ -57,6 +57,7 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void AddOne ()
                {
                        HttpListener listener = new HttpListener ();
@@ -70,6 +71,7 @@ namespace MonoTests.System.Net {
                }
 
                [Test]
+               [Category ("RequiresBSDSockets")]
                public void Duplicate ()
                {
                        HttpListener listener = new HttpListener ();
index 6ff1b33260ed2ab7e82883d4f600a12e89136888..c9227fd5b39dc09c6ce53f618c084c05d56b6b7f 100644 (file)
@@ -42,6 +42,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListenerRequestTest
        {
                [Test]
index f2ae436d29f8c9d2672b46f54cf960c1be3f893f..8620d1ce32a9b34bd6b98f40ea9ac0805791250a 100644 (file)
@@ -37,6 +37,7 @@ using MonoTests.Helpers;
 
 namespace MonoTests.System.Net {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpListenerTest {
 
                int port;
index ee6c82895e3e7ae5914ca2ffb463a39cc7fdb9d8..b7097b5db56a7e930149f96f641b3df8997559a1 100644 (file)
@@ -36,6 +36,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpWebRequestTest
        {
                private Random rand = new Random ();
@@ -2762,6 +2763,7 @@ namespace MonoTests.System.Net
        }
 
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpRequestStreamTest
        {
                [Test]
index 580c548890771190f6d5c2ef14e440e8b44fd53a..10d7d807444ce7527e56c73b601788be68f08664 100644 (file)
@@ -21,6 +21,7 @@ using NUnit.Framework;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpWebResponseTest
        {
                [Test]
@@ -476,6 +477,7 @@ namespace MonoTests.System.Net
        }
 
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class HttpResponseStreamTest
        {
                [Test]
index b671e9e92358dec824ecbdf2a6f615640cfd056e..9eb5877052ea3430303a703c1219ad5f73f81d1e 100644 (file)
@@ -21,6 +21,7 @@ using MonoTests.Helpers;
 namespace MonoTests.System.Net
 {
        [TestFixture]
+       [Category ("RequiresBSDSockets")]
        public class WebClientTest
        {
                private string _tempFolder;
index a3ddb3af8438429c7edd7c0809135dd4a0ba0402..34ce1a370a1d4ed737bfe721ce2d4e03104c27b0 100644 (file)
@@ -414,6 +414,7 @@ namespace MonoTests.System.Net {
        }\r
 
        [Test] // Covers #41477
+       [Category ("RequiresBSDSockets")]
        public void TestReceiveCancelation ()
        {
                var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
index c6c32095cbf9aa19e422c014d1bcf41e32e43901..92389257c5c788f84d7050c696d81075ff9109ee 100644 (file)
@@ -139,14 +139,15 @@ namespace System.IO
                                FileShare.None, bufferSize);
                }
 
-#if !NET_2_1
                [MonoLimitation ("FileOptions are ignored")]
                public static FileStream Create (string path, int bufferSize,
                                                 FileOptions options)
                {
-                       return Create (path, bufferSize, options, null);
+                       return new FileStream (path, FileMode.Create, FileAccess.ReadWrite,
+                               FileShare.None, bufferSize, options);
                }
-               
+
+#if !NET_2_1
                [MonoLimitation ("FileOptions and FileSecurity are ignored")]
                public static FileStream Create (string path, int bufferSize,
                                                 FileOptions options,
index 3507b2d46371500d8667a0920af9069da2ae9340..a55f093678f618f00cb384f8fbd809f16264a1cd 100644 (file)
@@ -66,6 +66,10 @@ namespace System.Runtime.CompilerServices
                        GC.register_ephemeron_array (data);
                }
 
+               ~ConditionalWeakTable ()
+               {
+               }
+
                /*LOCKING: _lock must be held*/
                void Rehash () {
                        uint newSize = (uint)HashHelpers.GetPrime ((data.Length << 1) | 1);
index 74bc4764adcc0f09bae453359ac832b31b46f715..74b8b65b3f17afe89deeb11ffaf5cbe1a9883452 100644 (file)
@@ -81,8 +81,10 @@ namespace System.Runtime.Remoting.Proxies
                                return field.GetValue(o);
                        }
 
-                       object[] inArgs = new object[] { Type.GetTypeFromHandle(typeHandle).FullName,
-                                                         field.Name };
+                       string typeName = Type.GetTypeFromHandle(typeHandle).FullName;
+                       string fieldName = field.Name;
+                       object[] inArgs = new object[] { typeName,
+                                                         fieldName };
                        object[] outArgsMsg = new object[1];
                        MethodInfo minfo = typeof(object).GetMethod("FieldGetter", BindingFlags.NonPublic | BindingFlags.Instance);
                        if (minfo == null)
@@ -95,6 +97,36 @@ namespace System.Runtime.Remoting.Proxies
                                throw exc;
                        return outArgs[0];
                }
+
+               internal void StoreRemoteField (IntPtr classPtr, IntPtr fieldPtr, object arg) {
+                       Mono.RuntimeClassHandle classHandle = new Mono.RuntimeClassHandle (classPtr);
+                       RuntimeFieldHandle fieldHandle = new RuntimeFieldHandle (fieldPtr);
+                       RuntimeTypeHandle typeHandle = classHandle.GetTypeHandle ();
+                       FieldInfo field = FieldInfo.GetFieldFromHandle (fieldHandle);
+
+                       if (InCurrentContext ()) {
+                               object o = _rp._server;
+                               field.SetValue (o, arg);
+                               return;
+                       }
+
+                       string typeName = Type.GetTypeFromHandle (typeHandle).FullName;
+                       string fieldName = field.Name;
+                       object [] inArgs = new object[] { typeName,
+                                                         fieldName,
+                                                         arg };
+                       MethodInfo minfo = typeof(object).GetMethod ("FieldSetter", BindingFlags.NonPublic | BindingFlags.Instance);
+                       if (minfo == null)
+                               throw new MissingMethodException ("System.Object", "FieldSetter");
+
+                       MonoMethodMessage msg = new MonoMethodMessage (minfo, inArgs, null);
+                       object [] outArgs;
+                       Exception exc;
+                       RealProxy.PrivateInvoke (_rp, msg, out exc, out outArgs);
+                       if (exc != null)
+                               throw exc;
+               }
+
        }
 #pragma warning restore 169, 649
        
diff --git a/mcs/errors/cs0163-2.cs b/mcs/errors/cs0163-2.cs
new file mode 100644 (file)
index 0000000..945ae8a
--- /dev/null
@@ -0,0 +1,13 @@
+// CS0163: Control cannot fall through from one case label `case 1:' to another
+// Line: 9
+
+public class Program
+{
+       public static void Main ()
+       {
+               switch (1) {
+                       case 1: {}
+                       default: {}
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1644-50.cs b/mcs/errors/cs1644-50.cs
new file mode 100644 (file)
index 0000000..10817d7
--- /dev/null
@@ -0,0 +1,11 @@
+// CS1644: Feature `interpolated strings' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 9
+// Compiler options: -langversion:5
+
+public class Program
+{
+       public static void Main()
+       {
+               var x = $"I should not compile";
+       }
+}
index 6783a7edbb672ef70e00d3684e3f35427ea12eab..bb2bd6e19718cad38c3cf37e8eb131b1b6581685 100644 (file)
@@ -3351,10 +3351,16 @@ boolean_literal
 interpolated_string
        : INTERPOLATED_STRING interpolations INTERPOLATED_STRING_END
          {
+               if (lang_version < LanguageVersion.V_6)
+                       FeatureIsNotAvailable (GetLocation ($1), "interpolated strings");
+
                $$ = new InterpolatedString ((StringLiteral) $1, (List<Expression>) $2, (StringLiteral) $3);
          }
        | INTERPOLATED_STRING_END
          {
+               if (lang_version < LanguageVersion.V_6)
+                       FeatureIsNotAvailable (GetLocation ($1), "interpolated strings");
+
                $$ = new InterpolatedString ((StringLiteral) $1, null, null);
          }
        ;
index d0341cb3b633045c48889bfa3a3f31789df36ff0..703e7ba497fef805446a5df389a8fa4f81258816 100644 (file)
@@ -5378,18 +5378,30 @@ namespace Mono.CSharp {
                                                continue;
                                        }
 
-                                       if (constant_label != null && constant_label != sl)
+                                       if (section_rc.IsUnreachable) {
+                                               //
+                                               // Common case. Previous label section end is unreachable as
+                                               // it ends with break, return, etc. For next section revert
+                                               // to reachable again unless we have constant switch block
+                                               //
+                                               section_rc = constant_label != null && constant_label != sl ?
+                                                       Reachability.CreateUnreachable () :
+                                                       new Reachability ();
+                                       } else if (prev_label != null) {
+                                               //
+                                               // Error case as control cannot fall through from one case label
+                                               //
+                                               sl.SectionStart = false;
+                                               s = new MissingBreak (prev_label);
+                                               s.MarkReachable (rc);
+                                               block.Statements.Insert (i - 1, s);
+                                               ++i;
+                                       } else if (constant_label != null && constant_label != sl) {
+                                               //
+                                               // Special case for the first unreachable label in constant
+                                               // switch block
+                                               //
                                                section_rc = Reachability.CreateUnreachable ();
-                                       else if (section_rc.IsUnreachable) {
-                                               section_rc = new Reachability ();
-                                       } else {
-                                               if (prev_label != null) {
-                                                       sl.SectionStart = false;
-                                                       s = new MissingBreak (prev_label);
-                                                       s.MarkReachable (rc);
-                                                       block.Statements.Insert (i - 1, s);
-                                                       ++i;
-                                               }
                                        }
 
                                        prev_label = sl;
index 55c2aeb4283b7e621624cbb808044cac3accf1ab..dd48a6f05b183ab8ea2f547135d76393ebaf9a95 100644 (file)
@@ -59,6 +59,9 @@ namespace CorCompare
                                { "h|?|help",
                                        "Show this message and exit.",
                                        v => showHelp = v != null },
+                               { "contract-api",
+                                       "Produces contract API with all members at each level of inheritance hierarchy",
+                                       v => FullAPISet = v != null },
                        };
 
                        var asms = options.Parse (args);
@@ -116,6 +119,7 @@ namespace CorCompare
 
                internal static bool AbiMode { get; private set; }
                internal static bool FollowForwarders { get; private set; }
+               internal static bool FullAPISet { get; set; }
        }
 
        public class Utils {
@@ -538,7 +542,7 @@ namespace CorCompare
                                        members.Add (new ConstructorData (writer, ctors));
                                }
 
-                               PropertyDefinition[] properties = GetProperties (type);
+                               PropertyDefinition[] properties = GetProperties (type, Driver.FullAPISet);
                                if (properties.Length > 0) {
                                        Array.Sort (properties, PropertyDefinitionComparer.Default);
                                        members.Add (new PropertyData (writer, properties));
@@ -550,7 +554,7 @@ namespace CorCompare
                                        members.Add (new EventData (writer, events));
                                }
 
-                               MethodDefinition [] methods = GetMethods (type);
+                               MethodDefinition [] methods = GetMethods (type, Driver.FullAPISet);
                                if (methods.Length > 0) {
                                        Array.Sort (methods, MethodDefinitionComparer.Default);
                                        members.Add (new MethodData (writer, methods));
@@ -693,53 +697,91 @@ namespace CorCompare
                }
 
 
-               internal static PropertyDefinition [] GetProperties (TypeDefinition type) {
-                       ArrayList list = new ArrayList ();
+               internal static PropertyDefinition [] GetProperties (TypeDefinition type, bool fullAPI) {
+                       var list = new List<PropertyDefinition> ();
+
+                       var t = type;
+                       do {
+                               var properties = t.Properties;//type.GetProperties (flags);
+                               foreach (PropertyDefinition property in properties) {
+                                       MethodDefinition getMethod = property.GetMethod;
+                                       MethodDefinition setMethod = property.SetMethod;
 
-                       var properties = type.Properties;//type.GetProperties (flags);
-                       foreach (PropertyDefinition property in properties) {
-                               MethodDefinition getMethod = property.GetMethod;
-                               MethodDefinition setMethod = property.SetMethod;
+                                       bool hasGetter = (getMethod != null) && MustDocumentMethod (getMethod);
+                                       bool hasSetter = (setMethod != null) && MustDocumentMethod (setMethod);
 
-                               bool hasGetter = (getMethod != null) && MustDocumentMethod (getMethod);
-                               bool hasSetter = (setMethod != null) && MustDocumentMethod (setMethod);
+                                       // if neither the getter or setter should be documented, then
+                                       // skip the property
+                                       if (hasGetter || hasSetter) {
+
+                                               if (t != type && list.Any (l => l.Name == property.Name))
+                                                       continue;
 
-                               // if neither the getter or setter should be documented, then
-                               // skip the property
-                               if (hasGetter || hasSetter) {
-                                       list.Add (property);
+                                               list.Add (property);
+                                       }
                                }
-                       }
 
-                       return (PropertyDefinition []) list.ToArray (typeof (PropertyDefinition));
+                               if (!fullAPI)
+                                       break;
+
+                               if (t.IsInterface || t.IsEnum)
+                                       break;
+
+                               if (t.BaseType == null || t.BaseType.FullName == "System.Object")
+                                       t = null;
+                               else
+                                       t = t.BaseType.Resolve ();
+
+                       } while (t != null);
+
+                       return list.ToArray ();
                }
 
-               private MethodDefinition[] GetMethods (TypeDefinition type)
+               private MethodDefinition[] GetMethods (TypeDefinition type, bool fullAPI)
                {
-                       ArrayList list = new ArrayList ();
+                       var list = new List<MethodDefinition> ();
 
-                       var methods = type.Methods;//type.GetMethods (flags);
-                       foreach (MethodDefinition method in methods) {
-                               if (method.IsSpecialName && !method.Name.StartsWith ("op_", StringComparison.Ordinal))
-                                       continue;
+                       var t = type;
+                       do {
+                               var methods = t.Methods;//type.GetMethods (flags);
+                               foreach (MethodDefinition method in methods) {
+                                       if (method.IsSpecialName && !method.Name.StartsWith ("op_", StringComparison.Ordinal))
+                                               continue;
 
-                               // we're only interested in public or protected members
-                               if (!MustDocumentMethod(method))
-                                       continue;
+                                       // we're only interested in public or protected members
+                                       if (!MustDocumentMethod (method))
+                                               continue;
+
+                                       if (t == type && IsFinalizer (method)) {
+                                               string name = method.DeclaringType.Name;
+                                               int arity = name.IndexOf ('`');
+                                               if (arity > 0)
+                                                       name = name.Substring (0, arity);
 
-                               if (IsFinalizer (method)) {
-                                       string name = method.DeclaringType.Name;
-                                       int arity = name.IndexOf ('`');
-                                       if (arity > 0)
-                                               name = name.Substring (0, arity);
+                                               method.Name = "~" + name;
+                                       }
+
+                                       // TODO: Better check
+                                       if (t != type && list.Any (l => l.DeclaringType != method.DeclaringType && l.Name == method.Name && l.Parameters.Count == method.Parameters.Count))
+                                               continue;
 
-                                       method.Name = "~" + name;
+                                       list.Add (method);
                                }
 
-                               list.Add (method);
-                       }
+                               if (!fullAPI)
+                                       break;
 
-                       return (MethodDefinition []) list.ToArray (typeof (MethodDefinition));
+                               if (!t.IsInterface || t.IsEnum)
+                                       break;
+
+                               if (t.BaseType == null || t.BaseType.FullName == "System.Object")
+                                       t = null;
+                               else
+                                       t = t.BaseType.Resolve ();
+
+                       } while (t != null);
+
+                       return list.ToArray ();
                }
 
                static bool IsFinalizer (MethodDefinition method)
index bc8fddc327d675bd2ce58402e644d0ee8cbde774..28279d9322a8a3e593b40857f7b9758bfcfa72ce 100644 (file)
                </type>
                <type fullname="System.Runtime.Remoting.Proxies.TransparentProxy" preserve="fields">
                        <method name="LoadRemoteFieldNew" />
+                       <method name="StoreRemoteField" />
                </type>
                <type fullname="System.Runtime.Remoting.RemotingServices">
                        <method name="SerializeCallData" />
index 9da6edc106d5e91eedaef5e5c4c59e295d8ef8cc..e99f07415765bc21b618798f6d7c132a22d0a1e1 100644 (file)
@@ -424,8 +424,13 @@ namespace Xamarin.ApiDiff {
                                if (tgtAbstract) {
                                        change.AppendAdded ("abstract", true).Append (" ");
                                } else if (srcWord != tgtWord) {
-                                       if (!tgtFinal)
-                                               change.AppendModified (srcWord, tgtWord, breaking).Append (" ");
+                                       if (!tgtFinal) {
+                                               if (State.IgnoreVirtualChanges) {
+                                                       change.HasIgnoredChanges = true;
+                                               } else {
+                                                       change.AppendModified (srcWord, tgtWord, breaking).Append (" ");
+                                               }
+                                       }
                                } else if (tgtWord.Length > 0) {
                                        change.Append (tgtWord).Append (" ");
                                } else if (srcWord.Length > 0) {
@@ -437,7 +442,11 @@ namespace Xamarin.ApiDiff {
                                if (tgtFinal) {
                                        change.Append ("final ");
                                } else {
-                                       change.AppendRemoved ("final", false).Append (" "); // removing 'final' is not a breaking change.
+                                       if (srcVirtual && !tgtVirtual && State.IgnoreVirtualChanges) {
+                                               change.HasIgnoredChanges = true;
+                                       } else {
+                                               change.AppendRemoved ("final", false).Append (" "); // removing 'final' is not a breaking change.
+                                       }
                                }
                        } else {
                                if (tgtFinal && srcVirtual) {
index 8ec7c50ae58ac61949a50fe4b3d51f45278dff33..50ed3496b0c2a2a142d16aa6579e217e86d6081b 100644 (file)
@@ -2298,7 +2298,7 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
 {
        struct _WapiHandle_file *file_handle;
        gpointer handle;
-       int thr_ret, fd;
+       int fd;
        const gchar *name;
        gboolean ok;
        
@@ -2327,8 +2327,7 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
 
        handle = GINT_TO_POINTER (fd);
 
-       thr_ret = mono_os_mutex_lock (&stdhandle_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&stdhandle_mutex);
 
        ok = mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
                                  (gpointer *)&file_handle);
@@ -2346,8 +2345,7 @@ gpointer GetStdHandle(WapiStdHandle stdhandle)
        }
        
   done:
-       thr_ret = mono_os_mutex_unlock (&stdhandle_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&stdhandle_mutex);
        
        return(handle);
 }
index 20ad800c0485190fef7af966b92544b107ff14d9..40ab66c77b43b28e06421f62e3d547249230daf9 100644 (file)
@@ -1043,25 +1043,19 @@ gboolean CreateProcess (const gunichar2 *appname, const gunichar2 *cmdline,
                        mono_process = (struct MonoProcess *) g_malloc0 (sizeof (struct MonoProcess));
                        mono_process->pid = pid;
                        mono_process->handle_count = 1;
-                       if (mono_os_sem_init (&mono_process->exit_sem, 0) != 0) {
-                               /* If we can't create the exit semaphore, we just don't add anything
-                                * to our list of mono processes. Waiting on the process will return 
-                                * immediately. */
-                               g_warning ("%s: could not create exit semaphore for process.", strerror (errno));
-                               g_free (mono_process);
-                       } else {
-                               /* Keep the process handle artificially alive until the process
-                                * exits so that the information in the handle isn't lost. */
-                               mono_w32handle_ref (handle);
-                               mono_process->handle = handle;
+                       mono_os_sem_init (&mono_process->exit_sem, 0);
 
-                               process_handle_data->mono_process = mono_process;
+                       /* Keep the process handle artificially alive until the process
+                        * exits so that the information in the handle isn't lost. */
+                       mono_w32handle_ref (handle);
+                       mono_process->handle = handle;
 
-                               mono_os_mutex_lock (&mono_processes_mutex);
-                               mono_process->next = mono_processes;
-                               mono_processes = mono_process;
-                               mono_os_mutex_unlock (&mono_processes_mutex);
-                       }
+                       process_handle_data->mono_process = mono_process;
+
+                       mono_os_mutex_lock (&mono_processes_mutex);
+                       mono_process->next = mono_processes;
+                       mono_processes = mono_process;
+                       mono_os_mutex_unlock (&mono_processes_mutex);
 
                        if (process_info != NULL) {
                                process_info->hProcess = handle;
@@ -2815,19 +2809,13 @@ process_wait (gpointer handle, guint32 timeout, gboolean alertable)
                        ret = mono_os_sem_wait (&mp->exit_sem, alertable ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE);
                }
 
-               if (ret == -1 && errno != EINTR && errno != ETIMEDOUT) {
-                       MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): sem_timedwait failure: %s", 
-                                  __func__, handle, timeout, g_strerror (errno));
-                       /* Should we return a failure here? */
-               }
-
-               if (ret == 0) {
+               if (ret == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                        /* Success, process has exited */
                        mono_os_sem_post (&mp->exit_sem);
                        break;
                }
 
-               if (timeout == 0) {
+               if (ret == MONO_SEM_TIMEDWAIT_RET_TIMEDOUT) {
                        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): WAIT_TIMEOUT (timeout = 0)", __func__, handle, timeout);
                        return WAIT_TIMEOUT;
                }
@@ -2838,7 +2826,7 @@ process_wait (gpointer handle, guint32 timeout, gboolean alertable)
                        return WAIT_TIMEOUT;
                }
                
-               if (alertable && _wapi_thread_cur_apc_pending ()) {
+               if (alertable && ret == MONO_SEM_TIMEDWAIT_RET_ALERTED) {
                        MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): WAIT_IO_COMPLETION", __func__, handle, timeout);
                        return WAIT_IO_COMPLETION;
                }
index b1d9c1ba509b45542d88ca895c3b937ec344c32f..8fb0e2703bd21386f9991b1ae18333a7c390abed 100644 (file)
@@ -31,7 +31,8 @@ int
 _wapi_shm_sem_lock (int sem)
 {
        DEBUGLOG ("%s: locking nosem %d", __func__, sem);
-       return mono_os_mutex_lock (&noshm_sems[sem]);
+       mono_os_mutex_lock (&noshm_sems[sem]);
+       return 0;
 }
 
 int
@@ -45,5 +46,6 @@ int
 _wapi_shm_sem_unlock (int sem)
 {
        DEBUGLOG ("%s: unlocking nosem %d", __func__, sem);
-       return mono_os_mutex_unlock (&noshm_sems[sem]);
+       mono_os_mutex_unlock (&noshm_sems[sem]);
+       return 0;
 }
index 9c435d27b50df9b3775470b1137c1f087b7b74cd..d59d688c9aef2e19d3488905b241e225f2fdb8a1 100644 (file)
@@ -921,6 +921,7 @@ mono_assembly_addref (MonoAssembly *assembly)
 #define WINFX_KEY "31bf3856ad364e35"
 #define ECMA_KEY "b77a5c561934e089"
 #define MSFINAL_KEY "b03f5f7f11d50a3a"
+#define COMPACTFRAMEWORK_KEY "969db8053d3322ac"
 
 typedef struct {
        const char *name;
@@ -929,20 +930,34 @@ typedef struct {
 } KeyRemapEntry;
 
 static KeyRemapEntry key_remap_table[] = {
+       { "CustomMarshalers", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        { "Microsoft.CSharp", WINFX_KEY, MSFINAL_KEY },
+       { "Microsoft.VisualBasic", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        { "System", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.ComponentModel.Composition", WINFX_KEY, ECMA_KEY },
        { "System.ComponentModel.DataAnnotations", "ddd0da4d3e678217", WINFX_KEY },
        { "System.Core", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System.Core", COMPACTFRAMEWORK_KEY, ECMA_KEY },
+       { "System.Data", COMPACTFRAMEWORK_KEY, ECMA_KEY },
+       { "System.Data.DataSetExtensions", COMPACTFRAMEWORK_KEY, ECMA_KEY },
+       { "System.Drawing", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
+       { "System.Messaging", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        // FIXME: MS uses MSFINAL_KEY for .NET 4.5
        { "System.Net", SILVERLIGHT_KEY, MSFINAL_KEY },
        { "System.Numerics", WINFX_KEY, ECMA_KEY },
        { "System.Runtime.Serialization", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System.Runtime.Serialization", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.ServiceModel", WINFX_KEY, ECMA_KEY },
+       { "System.ServiceModel", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.ServiceModel.Web", SILVERLIGHT_KEY, WINFX_KEY },
+       { "System.Web.Services", COMPACTFRAMEWORK_KEY, MSFINAL_KEY },
        { "System.Windows", SILVERLIGHT_KEY, MSFINAL_KEY },
+       { "System.Windows.Forms", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.Xml", SILVERLIGHT_KEY, ECMA_KEY },
+       { "System.Xml", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.Xml.Linq", WINFX_KEY, ECMA_KEY },
+       { "System.Xml.Linq", COMPACTFRAMEWORK_KEY, ECMA_KEY },
        { "System.Xml.Serialization", WINFX_KEY, ECMA_KEY }
 };
 
index c3d240c0d77a0a841a75b450af4a153b54e532b7..a7230d05a3e97dc7e1f4e8ade74618ef0f828fe7 100644 (file)
 
 typedef struct DomainFinalizationReq {
        MonoDomain *domain;
+#ifdef TARGET_WIN32
        HANDLE done_event;
+#else
+       gboolean done;
+       MonoCoopCond cond;
+       MonoCoopMutex mutex;
+#endif
 } DomainFinalizationReq;
 
 static gboolean gc_disabled = FALSE;
@@ -94,6 +100,51 @@ guarded_wait (HANDLE handle, guint32 timeout, gboolean alertable)
        return result;
 }
 
+typedef struct {
+       MonoCoopCond *cond;
+       MonoCoopMutex *mutex;
+} BreakCoopAlertableWaitUD;
+
+static inline void
+break_coop_alertable_wait (gpointer user_data)
+{
+       BreakCoopAlertableWaitUD *ud = (BreakCoopAlertableWaitUD*)user_data;
+
+       mono_coop_mutex_lock (ud->mutex);
+       mono_coop_cond_signal (ud->cond);
+       mono_coop_mutex_unlock (ud->mutex);
+}
+
+/*
+ * coop_cond_timedwait_alertable:
+ *
+ *   Wait on COND/MUTEX. If ALERTABLE is non-null, the wait can be interrupted.
+ * In that case, *ALERTABLE will be set to TRUE, and 0 is returned.
+ */
+static inline gint
+coop_cond_timedwait_alertable (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 timeout_ms, gboolean *alertable)
+{
+       int res;
+
+       if (alertable) {
+               BreakCoopAlertableWaitUD ud;
+
+               *alertable = FALSE;
+               ud.cond = cond;
+               ud.mutex = mutex;
+               mono_thread_info_install_interrupt (break_coop_alertable_wait, &ud, alertable);
+               if (*alertable)
+                       return 0;
+       }
+       res = mono_coop_cond_timedwait (cond, mutex, timeout_ms);
+       if (alertable) {
+               mono_thread_info_uninstall_interrupt (alertable);
+               if (*alertable)
+                       return 0;
+       }
+       return res;
+}
+
 static gboolean
 add_thread_to_finalize (MonoInternalThread *thread, MonoError *error)
 {
@@ -382,8 +433,6 @@ gboolean
 mono_domain_finalize (MonoDomain *domain, guint32 timeout) 
 {
        DomainFinalizationReq *req;
-       guint32 res;
-       HANDLE done_event;
        MonoInternalThread *thread = mono_thread_internal_current ();
 
 #if defined(__native_client__)
@@ -408,14 +457,19 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
 
        mono_gc_collect (mono_gc_max_generation ());
 
-       done_event = CreateEvent (NULL, TRUE, FALSE, NULL);
-       if (done_event == NULL) {
-               return FALSE;
-       }
-
        req = g_new0 (DomainFinalizationReq, 1);
        req->domain = domain;
-       req->done_event = done_event;
+
+#ifdef TARGET_WIN32
+       req->done_event = CreateEvent (NULL, TRUE, FALSE, NULL);
+       if (req->done_event == NULL) {
+               g_free (req);
+               return FALSE;
+       }
+#else
+       mono_coop_cond_init (&req->cond);
+       mono_coop_mutex_init (&req->mutex);
+#endif
 
        if (domain == mono_get_root_domain ())
                finalizing_root_domain = TRUE;
@@ -432,8 +486,9 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
        if (timeout == -1)
                timeout = INFINITE;
 
+#if TARGET_WIN32
        while (TRUE) {
-               res = guarded_wait (done_event, timeout, TRUE);
+               guint32 res = guarded_wait (req->done_event, timeout, TRUE);
                /* printf ("WAIT RES: %d.\n", res); */
 
                if (res == WAIT_IO_COMPLETION) {
@@ -447,7 +502,32 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
                }
        }
 
-       CloseHandle (done_event);
+       CloseHandle (req->done_event);
+#else
+       mono_coop_mutex_lock (&req->mutex);
+       while (!req->done) {
+               gboolean alerted;
+               int res = coop_cond_timedwait_alertable (&req->cond, &req->mutex, timeout, &alerted);
+               if (alerted) {
+                       if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0) {
+                               mono_coop_mutex_unlock (&req->mutex);
+                               return FALSE;
+                       }
+               } else if (res == ETIMEDOUT) {
+                       /* We leak the cond/mutex here */
+                       mono_coop_mutex_unlock (&req->mutex);
+                       return FALSE;
+               } else {
+                       break;
+               }
+       }
+       mono_coop_mutex_unlock (&req->mutex);
+
+       /* When we reach here, the other thread has already exited the critical section, so this is safe to free */
+       mono_coop_cond_destroy (&req->cond);
+       mono_coop_mutex_destroy (&req->mutex);
+       g_free (req);
+#endif
 
        if (domain == mono_get_root_domain ()) {
                mono_threadpool_ms_cleanup ();
@@ -726,10 +806,17 @@ finalize_domain_objects (DomainFinalizationReq *req)
        reference_queue_clear_for_domain (domain);
        
        /* printf ("DONE.\n"); */
+#if TARGET_WIN32
        SetEvent (req->done_event);
 
        /* The event is closed in mono_domain_finalize if we get here */
        g_free (req);
+#else
+       mono_coop_mutex_lock (&req->mutex);
+       req->done = TRUE;
+       mono_coop_cond_signal (&req->cond);
+       mono_coop_mutex_unlock (&req->mutex);
+#endif
 }
 
 static guint32
@@ -791,7 +878,7 @@ finalizer_thread (gpointer unused)
                hazard_free_queue_pump ();
 
                /* Avoid posting the pending done event until there are pending finalizers */
-               if (mono_coop_sem_timedwait (&finalizer_sem, 0, MONO_SEM_FLAGS_NONE) == 0) {
+               if (mono_coop_sem_timedwait (&finalizer_sem, 0, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_SUCCESS) {
                        /* Don't wait again at the start of the loop */
                        wait = FALSE;
                } else {
index b88b20e03819cb0383c8b5af48622205cd8f7524..b139ce9f3e6ef944249972c2acff47bc8d3bf4c7 100644 (file)
@@ -459,23 +459,25 @@ mono_debug_add_method (MonoMethod *method, MonoDebugMethodJitInfo *jit, MonoDoma
                write_sleb128 (lne->il_offset, ptr, &ptr);
                write_sleb128 (lne->native_offset, ptr, &ptr);
        }
-
-       *ptr++ = jit->this_var ? 1 : 0;
-       if (jit->this_var)
-               write_variable (jit->this_var, ptr, &ptr);
-
-       write_leb128 (jit->num_params, ptr, &ptr);
-       for (i = 0; i < jit->num_params; i++)
-               write_variable (&jit->params [i], ptr, &ptr);
-
-       write_leb128 (jit->num_locals, ptr, &ptr);
-       for (i = 0; i < jit->num_locals; i++)
-               write_variable (&jit->locals [i], ptr, &ptr);
-
-       *ptr++ = jit->gsharedvt_info_var ? 1 : 0;
-       if (jit->gsharedvt_info_var) {
-               write_variable (jit->gsharedvt_info_var, ptr, &ptr);
-               write_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+       write_leb128 (jit->has_var_info, ptr, &ptr);
+       if (jit->has_var_info) {
+               *ptr++ = jit->this_var ? 1 : 0;
+               if (jit->this_var)
+                       write_variable (jit->this_var, ptr, &ptr);
+
+               write_leb128 (jit->num_params, ptr, &ptr);
+               for (i = 0; i < jit->num_params; i++)
+                       write_variable (&jit->params [i], ptr, &ptr);
+
+               write_leb128 (jit->num_locals, ptr, &ptr);
+               for (i = 0; i < jit->num_locals; i++)
+                       write_variable (&jit->locals [i], ptr, &ptr);
+
+               *ptr++ = jit->gsharedvt_info_var ? 1 : 0;
+               if (jit->gsharedvt_info_var) {
+                       write_variable (jit->gsharedvt_info_var, ptr, &ptr);
+                       write_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+               }
        }
 
        size = ptr - oldptr;
@@ -623,27 +625,29 @@ mono_debug_read_method (MonoDebugMethodAddress *address)
                lne->il_offset = read_sleb128 (ptr, &ptr);
                lne->native_offset = read_sleb128 (ptr, &ptr);
        }
+       jit->has_var_info = read_leb128 (ptr, &ptr);
+       if (jit->has_var_info) {
+               if (*ptr++) {
+                       jit->this_var = g_new0 (MonoDebugVarInfo, 1);
+                       read_variable (jit->this_var, ptr, &ptr);
+               }
 
-       if (*ptr++) {
-               jit->this_var = g_new0 (MonoDebugVarInfo, 1);
-               read_variable (jit->this_var, ptr, &ptr);
-       }
-
-       jit->num_params = read_leb128 (ptr, &ptr);
-       jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
-       for (i = 0; i < jit->num_params; i++)
-               read_variable (&jit->params [i], ptr, &ptr);
-
-       jit->num_locals = read_leb128 (ptr, &ptr);
-       jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
-       for (i = 0; i < jit->num_locals; i++)
-               read_variable (&jit->locals [i], ptr, &ptr);
-
-       if (*ptr++) {
-               jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
-               jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
-               read_variable (jit->gsharedvt_info_var, ptr, &ptr);
-               read_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+               jit->num_params = read_leb128 (ptr, &ptr);
+               jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
+               for (i = 0; i < jit->num_params; i++)
+                       read_variable (&jit->params [i], ptr, &ptr);
+
+               jit->num_locals = read_leb128 (ptr, &ptr);
+               jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
+               for (i = 0; i < jit->num_locals; i++)
+                       read_variable (&jit->locals [i], ptr, &ptr);
+
+               if (*ptr++) {
+                       jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+                       jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+                       read_variable (jit->gsharedvt_info_var, ptr, &ptr);
+                       read_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+               }
        }
 
        return jit;
index 8885e521bad3c652038b49d6492af7fa42f8f9f4..c9350a7023aa2beeb12ea22ff32d4a6501c23c98 100644 (file)
@@ -86,6 +86,7 @@ struct _MonoDebugMethodJitInfo {
        const mono_byte *wrapper_addr;
        uint32_t num_line_numbers;
        MonoDebugLineNumberEntry *line_numbers;
+       uint32_t has_var_info;
        uint32_t num_params;
        MonoDebugVarInfo *this_var;
        MonoDebugVarInfo *params;
index a6e5ab526995458a00bcb978b4ec7f08543b4431..9ce52a3515ab6bb6e9e700d24a8f6fa70b31642c 100644 (file)
@@ -1462,9 +1462,6 @@ mono_load_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, Mono
 gboolean
 mono_store_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, void* val, MonoError *error);
 
-void
-mono_store_remote_field_new_icall (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg);
-
 gboolean
 mono_store_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg, MonoError *error);
 
index 5abeed72821c95d91b536b504d0dab39dad94c8f..7bb2b43beaf795a85ecf1bcd9c94fb7804a30c98 100644 (file)
@@ -8288,65 +8288,24 @@ mono_store_remote_field_checked (MonoObject *this_obj, MonoClass *klass, MonoCla
        
        MONO_REQ_GC_UNSAFE_MODE;
 
-       static MonoMethod *setter = NULL;
+       mono_error_init (error);
 
        MonoDomain *domain = mono_domain_get ();
-       MonoTransparentProxy *tp = (MonoTransparentProxy *) this_obj;
        MonoClass *field_class;
-       MonoMethodMessage *msg;
-       MonoArray *out_args;
-       MonoObject *exc;
        MonoObject *arg;
-       char* full_name;
-
-       mono_error_init (error);
 
        g_assert (mono_object_is_transparent_proxy (this_obj));
 
        field_class = mono_class_from_mono_type (field->type);
 
-       if (mono_class_is_contextbound (tp->remote_class->proxy_class) && tp->rp->context == (MonoObject *) mono_context_get ()) {
-               if (field_class->valuetype) mono_field_set_value (tp->rp->unwrapped_server, field, val);
-               else mono_field_set_value (tp->rp->unwrapped_server, field, *((MonoObject **)val));
-               return TRUE;
-       }
-
-       if (!setter) {
-               setter = mono_class_get_method_from_name (mono_defaults.object_class, "FieldSetter", -1);
-               if (!setter) {
-                       mono_error_set_not_supported (error, "Linked away.");
-                       return FALSE;
-               }
-       }
-
        if (field_class->valuetype) {
                arg = mono_value_box_checked (domain, field_class, val, error);
                return_val_if_nok (error, FALSE);
-       } else 
-               arg = *((MonoObject **)val);
-               
-
-       msg = (MonoMethodMessage *)mono_object_new_checked (domain, mono_defaults.mono_method_message_class, error);
-       return_val_if_nok (error, FALSE);
-       MonoReflectionMethod *rm = mono_method_get_object_checked (domain, setter, NULL, error);
-       return_val_if_nok (error, FALSE);
-       mono_message_init (domain, msg, rm, NULL, error);
-       return_val_if_nok (error, FALSE);
-
-       full_name = mono_type_get_full_name (klass);
-       mono_array_setref (msg->args, 0, mono_string_new (domain, full_name));
-       mono_array_setref (msg->args, 1, mono_string_new (domain, mono_field_get_name (field)));
-       mono_array_setref (msg->args, 2, arg);
-       g_free (full_name);
-
-       mono_remoting_invoke ((MonoObject *)(tp->rp), msg, &exc, &out_args, error);
-       return_val_if_nok (error, FALSE);
-
-       if (exc) {
-               mono_error_set_exception_instance (error, (MonoException *)exc);
-               return FALSE;
+       } else {
+               arg = *((MonoObject**)val);
        }
-       return TRUE;
+
+       return mono_store_remote_field_new_checked (this_obj, klass, field, arg, error);
 }
 
 /**
@@ -8366,23 +8325,6 @@ mono_store_remote_field_new (MonoObject *this_obj, MonoClass *klass, MonoClassFi
        mono_error_cleanup (&error);
 }
 
-/**
- * mono_store_remote_field_new_icall:
- * @this_obj:
- * @klass:
- * @field:
- * @arg:
- *
- * Missing documentation
- */
-void
-mono_store_remote_field_new_icall (MonoObject *this_obj, MonoClass *klass, MonoClassField *field, MonoObject *arg)
-{
-       MonoError error;
-       (void) mono_store_remote_field_new_checked (this_obj, klass, field, arg, &error);
-       mono_error_set_pending_exception (&error);
-}
-
 /**
  * mono_store_remote_field_new_checked:
  * @this_obj:
@@ -8398,56 +8340,27 @@ mono_store_remote_field_new_checked (MonoObject *this_obj, MonoClass *klass, Mon
 {
        MONO_REQ_GC_UNSAFE_MODE;
 
-       static MonoMethod *setter = NULL;
-       MonoDomain *domain = mono_domain_get ();
-       MonoTransparentProxy *tp = (MonoTransparentProxy *) this_obj;
-       MonoClass *field_class;
-       MonoMethodMessage *msg;
-       MonoArray *out_args;
-       MonoObject *exc;
-       char* full_name;
+       static MonoMethod *tp_store = NULL;
 
        mono_error_init (error);
 
        g_assert (mono_object_is_transparent_proxy (this_obj));
 
-       field_class = mono_class_from_mono_type (field->type);
-
-       if (mono_class_is_contextbound (tp->remote_class->proxy_class) && tp->rp->context == (MonoObject *) mono_context_get ()) {
-               if (field_class->valuetype) mono_field_set_value (tp->rp->unwrapped_server, field, ((gchar *) arg) + sizeof (MonoObject));
-               else mono_field_set_value (tp->rp->unwrapped_server, field, arg);
-               return TRUE;
-       }
-
-       if (!setter) {
-               setter = mono_class_get_method_from_name (mono_defaults.object_class, "FieldSetter", -1);
-               if (!setter) {
+       if (!tp_store) {
+               tp_store = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1);
+               if (!tp_store) {
                        mono_error_set_not_supported (error, "Linked away.");
                        return FALSE;
                }
        }
 
-       msg = (MonoMethodMessage *)mono_object_new_checked (domain, mono_defaults.mono_method_message_class, error);
-       return_val_if_nok (error, FALSE);
-       MonoReflectionMethod *rm = mono_method_get_object_checked (domain, setter, NULL, error);
-       return_val_if_nok (error, FALSE);
-       mono_message_init (domain, msg, rm, NULL, error);
-       return_val_if_nok (error, FALSE);
-
-       full_name = mono_type_get_full_name (klass);
-       mono_array_setref (msg->args, 0, mono_string_new (domain, full_name));
-       mono_array_setref (msg->args, 1, mono_string_new (domain, mono_field_get_name (field)));
-       mono_array_setref (msg->args, 2, arg);
-       g_free (full_name);
-
-       mono_remoting_invoke ((MonoObject *)(tp->rp), msg, &exc, &out_args, error);
-       return_val_if_nok (error, FALSE);
+       gpointer args[3];
+       args [0] = &klass;
+       args [1] = &field;
+       args [2] = arg;
 
-       if (exc) {
-               mono_error_set_exception_instance (error, (MonoException *)exc);
-               return FALSE;
-       }
-       return TRUE;
+       mono_runtime_invoke_checked (tp_store, this_obj, args, error);
+       return is_ok (error);
 }
 #endif
 
index 62379f245e97f296a16b4a72a252c86bf7d79a84..30595ee5410e1a43cf886966b5e7175899ccf2ff 100644 (file)
@@ -198,7 +198,6 @@ mono_remoting_marshal_init (void)
                register_icall (mono_remoting_wrapper, "mono_remoting_wrapper", "object ptr ptr", FALSE);
                register_icall (mono_upgrade_remote_class_wrapper, "mono_upgrade_remote_class_wrapper", "void object object", FALSE);
                register_icall (mono_compile_method_icall, "mono_compile_method_icall", "ptr ptr", FALSE);
-               /* mono_store_remote_field_new_icall registered  by mini-runtime.c */
 
        }
 
@@ -1619,73 +1618,6 @@ mono_marshal_get_ldflda_wrapper (MonoType *type)
        return res;
 }
 
-/*
- * mono_marshal_get_stfld_remote_wrapper:
- * klass: The type of the field
- *
- *  This function generates a wrapper for calling mono_store_remote_field_new
- * with the appropriate signature.
- * Similarly to mono_marshal_get_ldfld_remote_wrapper () this doesn't depend on the
- * klass argument anymore.
- */
-MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass)
-{
-       MonoMethodSignature *sig;
-       MonoMethodBuilder *mb;
-       MonoMethod *res;
-       static MonoMethod *cached = NULL;
-
-       mono_marshal_lock_internal ();
-       if (cached) {
-               mono_marshal_unlock_internal ();
-               return cached;
-       }
-       mono_marshal_unlock_internal ();
-
-       mb = mono_mb_new_no_dup_name (mono_defaults.object_class, "__mono_store_remote_field_new_wrapper", MONO_WRAPPER_STFLD_REMOTE);
-
-       mb->method->save_lmf = 1;
-
-       sig = mono_metadata_signature_alloc (mono_defaults.corlib, 4);
-       sig->params [0] = &mono_defaults.object_class->byval_arg;
-       sig->params [1] = &mono_defaults.int_class->byval_arg;
-       sig->params [2] = &mono_defaults.int_class->byval_arg;
-       sig->params [3] = &mono_defaults.object_class->byval_arg;
-       sig->ret = &mono_defaults.void_class->byval_arg;
-
-#ifndef DISABLE_JIT
-       mono_mb_emit_ldarg (mb, 0);
-       mono_mb_emit_ldarg (mb, 1);
-       mono_mb_emit_ldarg (mb, 2);
-       mono_mb_emit_ldarg (mb, 3);
-
-       mono_mb_emit_icall (mb, mono_store_remote_field_new_icall);
-
-       mono_mb_emit_byte (mb, CEE_RET);
-#endif
-
-       mono_marshal_lock_internal ();
-       res = cached;
-       mono_marshal_unlock_internal ();
-       if (!res) {
-               MonoMethod *newm;
-               newm = mono_mb_create (mb, sig, 6, NULL);
-               mono_marshal_lock_internal ();
-               res = cached;
-               if (!res) {
-                       res = newm;
-                       cached = res;
-                       mono_marshal_unlock_internal ();
-               } else {
-                       mono_marshal_unlock_internal ();
-                       mono_free_method (newm);
-               }
-       }
-       mono_mb_free (mb);
-       
-       return res;
-}
 
 /*
  * mono_marshal_get_stfld_wrapper:
@@ -1706,6 +1638,7 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        WrapperInfo *info;
        char *name;
        int t, pos;
+       static MonoMethod *tp_store = NULL;
 
        type = mono_type_get_underlying_type (type);
        t = type->type;
@@ -1735,6 +1668,13 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        if ((res = mono_marshal_find_in_cache (cache, klass)))
                return res;
 
+#ifndef DISABLE_REMOTING
+       if (!tp_store) {
+               tp_store = mono_class_get_method_from_name (mono_defaults.transparent_proxy_class, "StoreRemoteField", -1);
+               g_assert (tp_store != NULL);
+       }
+#endif
+
        /* we add the %p pointer value of klass because class names are not unique */
        name = g_strdup_printf ("__stfld_wrapper_%p_%s.%s", klass, klass->name_space, klass->name); 
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_STFLD);
@@ -1752,6 +1692,7 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        mono_mb_emit_ldarg (mb, 0);
        pos = mono_mb_emit_proxy_check (mb, CEE_BNE_UN);
 
+#ifndef DISABLE_REMOTING
        mono_mb_emit_ldarg (mb, 0);
        mono_mb_emit_ldarg (mb, 1);
        mono_mb_emit_ldarg (mb, 2);
@@ -1759,9 +1700,10 @@ mono_marshal_get_stfld_wrapper (MonoType *type)
        if (klass->valuetype)
                mono_mb_emit_op (mb, CEE_BOX, klass);
 
-       mono_mb_emit_managed_call (mb, mono_marshal_get_stfld_remote_wrapper (klass), NULL);
+       mono_mb_emit_managed_call (mb, tp_store, NULL);
 
        mono_mb_emit_byte (mb, CEE_RET);
+#endif
 
        mono_mb_patch_branch (mb, pos);
 
index 9b495b2fb59f87be44d473aad0f80691a09af3ad..b0307aed93dfe044247ac64fee04393385b97eca 100644 (file)
@@ -38,12 +38,6 @@ mono_marshal_get_ldfld_wrapper (MonoType *type);
 MonoMethod *
 mono_marshal_get_ldflda_wrapper (MonoType *type);
 
-MonoMethod *
-mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass);
-
-MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass);
-
 MonoMethod *
 mono_marshal_get_proxy_cancast (MonoClass *klass);
 
index 87c976b48739179b813cc7a1364e23d7745df73e..c15d5be8ad134fdac250e1280362368eb263f58e 100644 (file)
@@ -635,6 +635,9 @@ worker_thread (gpointer data)
                        if (retire)
                                retire = FALSE;
 
+                       /* The tpdomain->domain might have unloaded, while this thread was parked */
+                       previous_tpdomain = NULL;
+
                        continue;
                }
 
index 50a4329603c88dd60e2ad06a1e78e1a2334ad7f4..523b5188cc5a5edb22fae1514edec68a6a49b79d 100644 (file)
@@ -745,7 +745,14 @@ static guint32 WINAPI start_wrapper_internal(void *data)
                args [0] = start_arg;
                /* we may want to handle the exception here. See comment below on unhandled exceptions */
                mono_runtime_delegate_invoke_checked (start_delegate, args, &error);
-               mono_error_raise_exception (&error); /* OK, triggers unhandled exn handler */
+
+               if (!mono_error_ok (&error)) {
+                       MonoException *ex = mono_error_convert_to_exception (&error);
+                       if (ex)
+                               mono_unhandled_exception (&ex->object);
+               } else {
+                       mono_error_cleanup (&error);
+               }
        }
 
        /* If the thread calls ExitThread at all, this remaining code
@@ -3157,7 +3164,7 @@ remove_and_abort_threads (gpointer key, gpointer value, gpointer user)
                wait->num++;
 
                THREAD_DEBUG (g_print ("%s: Aborting id: %"G_GSIZE_FORMAT"\n", __func__, (gsize)thread->tid));
-               mono_thread_internal_stop (thread);
+               mono_thread_internal_abort (thread);
                return TRUE;
        }
 
index 909113cae8e97077451a2dedf70dea6fbf87b99f..fc2c8954426a32bdba980bdc7f203c66bb8bc205 100644 (file)
@@ -17,7 +17,6 @@ WRAPPER(XDOMAIN_INVOKE, "xdomain-invoke")
 WRAPPER(XDOMAIN_DISPATCH, "xdomain-dispatch")
 WRAPPER(LDFLD, "ldfld")
 WRAPPER(STFLD, "stfld")
-WRAPPER(STFLD_REMOTE, "stfld-remote")
 WRAPPER(SYNCHRONIZED, "synchronized")
 WRAPPER(DYNAMIC_METHOD, "dynamic-method")
 WRAPPER(ISINST, "isinst")
index 0145a955d42e90c429645a6e9f675fe73a4edc33..98777069c04b49ddc7c2cbcd2e01a06759c7addb 100755 (executable)
@@ -695,15 +695,11 @@ testi: mono test.exe
 checktests: $(regtests)
        for i in $(regtests); do $(MINI_RUNTIME) $$i; done
 
-rcheck-ci: mono $(regtests)
-if NACL_CODEGEN
-       for i in $(regtests); do echo "running test $$i"; $(MINI_RUNTIME) $$i --exclude 'NaClDisable' || exit 1; done
-else
+rcheck-nunit: mono $(regtests)
        -($(MINI_RUNTIME) --regression $(regtests); echo $$? > regressionexitcode.out) | $(srcdir)/emitnunit.pl
        exit $$(cat regressionexitcode.out)
-endif
 
-rcheck-normal: mono $(regtests)
+rcheck: mono $(regtests)
        $(MINI_RUNTIME) --regression $(regtests)
 
 if ARM
@@ -821,12 +817,8 @@ stat3: mono bench.exe
 docu: mini.sgm
        docbook2txt mini.sgm
 
-# CI - Wrench
-# BUILD_URL = Jenkins
-RUNNING_ON_CI = $(CI)$(BUILD_URL)
-
 # We need these because automake can't process normal make conditionals
-check_local_targets = $(if $(RUNNING_ON_CI), rcheck-ci check-seq-points, rcheck-normal)
+check_local_targets = $(if $(EMIT_NUNIT), rcheck-nunit, rcheck)
 
 check-local: $(check_local_targets)
 
index 7791ec26d0b55fbff726f895120fea3eb16e118b..5719f5f1207d158d57f30b258e1595631142d73d 100644 (file)
@@ -3104,8 +3104,6 @@ encode_method_ref (MonoAotCompile *acfg, MonoMethod *method, guint8 *buf, guint8
                        encode_klass_ref (acfg, info->d.proxy.klass, p, &p);
                        break;
                }
-               case MONO_WRAPPER_STFLD_REMOTE:
-                       break;
                case MONO_WRAPPER_ALLOC: {
                        /* The GC name is saved once in MonoAotFileInfo */
                        g_assert (info->d.alloc.alloc_type != -1);
@@ -7209,7 +7207,6 @@ can_encode_method (MonoAotCompile *acfg, MonoMethod *method)
                        case MONO_WRAPPER_STFLD:
                        case MONO_WRAPPER_LDFLD:
                        case MONO_WRAPPER_LDFLDA:
-                       case MONO_WRAPPER_STFLD_REMOTE:
                        case MONO_WRAPPER_STELEMREF:
                        case MONO_WRAPPER_ISINST:
                        case MONO_WRAPPER_PROXY_ISINST:
index 14fcfbabc056fbde074805348a4d92c75fdb1133..2f818c6821cef511e12f349739f013f8de8e7116 100644 (file)
@@ -922,9 +922,6 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                        }
                        break;
                }
-               case MONO_WRAPPER_STFLD_REMOTE:
-                       ref->method = mono_marshal_get_stfld_remote_wrapper (NULL);
-                       break;
 #endif
                case MONO_WRAPPER_ALLOC: {
                        int atype = decode_value (p, &p);
index 2ef1c93fd5622f3d085f4457decf9523038b0664..41e241a33a8bf1a14ee1b64f4f07f5773fac4a0e 100644 (file)
@@ -240,29 +240,32 @@ mono_debug_close_method (MonoCompile *cfg)
        jit->code_start = cfg->native_code;
        jit->epilogue_begin = cfg->epilog_begin;
        jit->code_size = cfg->code_len;
+       jit->has_var_info = debug_options.mdb_optimizations != 0;
 
        if (jit->epilogue_begin)
                   record_line_number (info, jit->epilogue_begin, header->code_size);
 
-       jit->num_params = sig->param_count;
-       jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
+       if (jit->has_var_info) {
+               jit->num_params = sig->param_count;
+               jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
 
-       for (i = 0; i < jit->num_locals; i++)
-               write_variable (cfg->locals [i], &jit->locals [i]);
+               for (i = 0; i < jit->num_locals; i++)
+                       write_variable (cfg->locals [i], &jit->locals [i]);
 
-       if (sig->hasthis) {
-               jit->this_var = g_new0 (MonoDebugVarInfo, 1);
-               write_variable (cfg->args [0], jit->this_var);
-       }
+               if (sig->hasthis) {
+                       jit->this_var = g_new0 (MonoDebugVarInfo, 1);
+                       write_variable (cfg->args [0], jit->this_var);
+               }
 
-       for (i = 0; i < jit->num_params; i++)
-               write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
+               for (i = 0; i < jit->num_params; i++)
+                       write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
 
-       if (cfg->gsharedvt_info_var) {
-               jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
-               jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
-               write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
-               write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
+               if (cfg->gsharedvt_info_var) {
+                       jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+                       jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+                       write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
+                       write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
+               }
        }
 
        jit->num_line_numbers = info->line_numbers->len;
@@ -457,22 +460,25 @@ mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *bu
        encode_value (jit->epilogue_begin, p, &p);
        encode_value (jit->prologue_end, p, &p);
        encode_value (jit->code_size, p, &p);
+       encode_value (jit->has_var_info, p, &p);
 
-       for (i = 0; i < jit->num_params; ++i)
-               serialize_variable (&jit->params [i], p, &p);
+       if (jit->has_var_info) {
+               for (i = 0; i < jit->num_params; ++i)
+                       serialize_variable (&jit->params [i], p, &p);
 
-       if (mono_method_signature (cfg->method)->hasthis)
-               serialize_variable (jit->this_var, p, &p);
+               if (jit->this_var)
+                       serialize_variable (jit->this_var, p, &p);
 
-       for (i = 0; i < jit->num_locals; i++)
-               serialize_variable (&jit->locals [i], p, &p);
+               for (i = 0; i < jit->num_locals; i++)
+                       serialize_variable (&jit->locals [i], p, &p);
 
-       if (jit->gsharedvt_info_var) {
-               encode_value (1, p, &p);
-               serialize_variable (jit->gsharedvt_info_var, p, &p);
-               serialize_variable (jit->gsharedvt_locals_var, p, &p);
-       } else {
-               encode_value (0, p, &p);
+               if (jit->gsharedvt_info_var) {
+                       encode_value (1, p, &p);
+                       serialize_variable (jit->gsharedvt_info_var, p, &p);
+                       serialize_variable (jit->gsharedvt_locals_var, p, &p);
+               } else {
+                       encode_value (0, p, &p);
+               }
        }
 
        encode_value (jit->num_line_numbers, p, &p);
@@ -535,32 +541,36 @@ deserialize_debug_info (MonoMethod *method, guint8 *code_start, guint8 *buf, gui
 
        jit = g_new0 (MonoDebugMethodJitInfo, 1);
        jit->code_start = code_start;
-       jit->num_locals = header->num_locals;
-       jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
-       jit->num_params = mono_method_signature (method)->param_count;
-       jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
 
        p = buf;
        jit->epilogue_begin = decode_value (p, &p);
        jit->prologue_end = decode_value (p, &p);
        jit->code_size = decode_value (p, &p);
+       jit->has_var_info = decode_value (p, &p);
 
-       for (i = 0; i < jit->num_params; ++i)
-               deserialize_variable (&jit->params [i], p, &p);
+       if (jit->has_var_info) {
+               jit->num_locals = header->num_locals;
+               jit->num_params = mono_method_signature (method)->param_count;
+               jit->params = g_new0 (MonoDebugVarInfo, jit->num_params);
+               jit->locals = g_new0 (MonoDebugVarInfo, jit->num_locals);
 
-       if (mono_method_signature (method)->hasthis) {
-               jit->this_var = g_new0 (MonoDebugVarInfo, 1);
-               deserialize_variable (jit->this_var, p, &p);
-       }
+               for (i = 0; i < jit->num_params; ++i)
+                       deserialize_variable (&jit->params [i], p, &p);
 
-       for (i = 0; i < jit->num_locals; i++)
-               deserialize_variable (&jit->locals [i], p, &p);
+               if (mono_method_signature (method)->hasthis) {
+                       jit->this_var = g_new0 (MonoDebugVarInfo, 1);
+                       deserialize_variable (jit->this_var, p, &p);
+               }
+
+               for (i = 0; i < jit->num_locals; i++)
+                       deserialize_variable (&jit->locals [i], p, &p);
 
-       if (decode_value (p, &p)) {
-               jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
-               jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
-               deserialize_variable (jit->gsharedvt_info_var, p, &p);
-               deserialize_variable (jit->gsharedvt_locals_var, p, &p);
+               if (decode_value (p, &p)) {
+                       jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+                       jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+                       deserialize_variable (jit->gsharedvt_info_var, p, &p);
+                       deserialize_variable (jit->gsharedvt_locals_var, p, &p);
+               }
        }
 
        jit->num_line_numbers = decode_value (p, &p);
index 9b569ffc9c72fa8ca23ff029f10199efeb9745cd..09faef99896bc0d3e56cd6f64ed73786a8612069 100644 (file)
@@ -2790,8 +2790,6 @@ suspend_vm (void)
 static void
 resume_vm (void)
 {
-       int err;
-
        g_assert (is_debugger_thread ());
 
        mono_loader_lock ();
@@ -2810,8 +2808,7 @@ resume_vm (void)
        }
 
        /* Signal this even when suspend_count > 0, since some threads might have resume_count > 0 */
-       err = mono_coop_cond_broadcast (&suspend_cond);
-       g_assert (err == 0);
+       mono_coop_cond_broadcast (&suspend_cond);
 
        mono_coop_mutex_unlock (&suspend_mutex);
        //g_assert (err == 0);
@@ -2830,7 +2827,6 @@ resume_vm (void)
 static void
 resume_thread (MonoInternalThread *thread)
 {
-       int err;
        DebuggerTlsData *tls;
 
        g_assert (is_debugger_thread ());
@@ -2852,8 +2848,7 @@ resume_thread (MonoInternalThread *thread)
         * Signal suspend_count without decreasing suspend_count, the threads will wake up
         * but only the one whose resume_count field is > 0 will be resumed.
         */
-       err = mono_coop_cond_broadcast (&suspend_cond);
-       g_assert (err == 0);
+       mono_coop_cond_broadcast (&suspend_cond);
 
        mono_coop_mutex_unlock (&suspend_mutex);
        //g_assert (err == 0);
@@ -2900,7 +2895,6 @@ static void
 suspend_current (void)
 {
        DebuggerTlsData *tls;
-       int err;
 
        g_assert (!is_debugger_thread ());
 
@@ -2928,8 +2922,7 @@ suspend_current (void)
        DEBUG_PRINTF (1, "[%p] Suspended.\n", (gpointer) (gsize) mono_native_thread_id_get ());
 
        while (suspend_count - tls->resume_count > 0) {
-               err = mono_coop_cond_wait (&suspend_cond, &suspend_mutex);
-               g_assert (err == 0);
+               mono_coop_cond_wait (&suspend_cond, &suspend_mutex);
        }
 
        tls->suspended = FALSE;
@@ -9149,7 +9142,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
 
        sig = mono_method_signature (frame->actual_method);
 
-       if (!mono_get_seq_points (frame->domain, frame->actual_method))
+       if (!jit->has_var_info || !mono_get_seq_points (frame->domain, frame->actual_method))
                /*
                 * The method is probably from an aot image compiled without soft-debug, variables might be dead, etc.
                 */
@@ -9467,10 +9460,10 @@ object_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
                                g_free (val);
                        } else {
                                guint8 *field_value = NULL;
-                               void *field_storage = NULL;
 
                                if (remote_obj) {
 #ifndef DISABLE_REMOTING
+                                       void *field_storage = NULL;
                                        field_value = mono_load_remote_field_checked(obj, obj_type, f, &field_storage, &error);
                                        if (!is_ok (&error)) {
                                                mono_error_cleanup (&error); /* FIXME report the error */
index 36225e43a5fd315cbc9d7f6aa151ae45bc26e7f1..e1918076a8a97099a952d461b43b0d7e6f9fdfad 100644 (file)
@@ -3695,9 +3695,7 @@ mini_init (const char *filename, const char *runtime_version)
        mono_simd_intrinsics_init ();
 #endif
 
-#if MONO_SUPPORT_TASKLETS
        mono_tasklets_init ();
-#endif
 
        register_trampolines (domain);
 
@@ -3778,9 +3776,6 @@ register_icalls (void)
        register_icall (mono_thread_get_undeniable_exception, "mono_thread_get_undeniable_exception", "object", FALSE);
        register_icall (mono_thread_interruption_checkpoint, "mono_thread_interruption_checkpoint", "object", FALSE);
        register_icall (mono_thread_force_interruption_checkpoint_noraise, "mono_thread_force_interruption_checkpoint_noraise", "object", FALSE);
-#ifndef DISABLE_REMOTING
-       register_icall (mono_store_remote_field_new_icall, "mono_store_remote_field_new_icall", "void object ptr ptr object", FALSE);
-#endif
 
 #if defined(__native_client__) || defined(__native_client_codegen__)
        register_icall (mono_nacl_gc, "mono_nacl_gc", "void", FALSE);
index 12be87a1fab52deee3d143b7202cbf665e572f47..8c1fe23297bffd8ba8b6ce8c9a6f43e62fff2b78 100644 (file)
@@ -1522,8 +1522,7 @@ mono_create_jit_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *e
                if (code)
                        return code;
                if (mono_llvm_only) {
-                       if (method->wrapper_type == MONO_WRAPPER_PROXY_ISINST ||
-                               method->wrapper_type == MONO_WRAPPER_STFLD_REMOTE)
+                       if (method->wrapper_type == MONO_WRAPPER_PROXY_ISINST)
                                /* These wrappers are not generated */
                                return method_not_found;
                        /* Methods are lazily initialized on first call, so this can't lead recursion */
index 92671537280fefbc287bde55e987e6aa7468de70..21e8e62ad3793b8cd67db09a88a89d20f81c403a 100644 (file)
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 135
+#define MONO_AOT_FILE_VERSION 136
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
index 08deb0c00f2913bf8c8fdccf4173ec7d5e8d768f..7d035aa3b2cef9707ee18b92ba25ae687d511de8 100644 (file)
@@ -150,6 +150,57 @@ void
 mono_tasklets_cleanup (void)
 {
 }
+#else
 
+static
+void continuations_not_supported (void)
+{
+       mono_set_pending_exception (mono_get_exception_not_implemented ("Tasklets are not implemented on this platform."));
+}
+
+static void*
+continuation_alloc (void)
+{
+       continuations_not_supported ();
+       return NULL;
+}
+
+static void
+continuation_free (MonoContinuation *cont)
+{
+       continuations_not_supported ();
+}
+
+static MonoException*
+continuation_mark_frame (MonoContinuation *cont)
+{
+       continuations_not_supported ();
+       return NULL;
+}
+
+static int
+continuation_store (MonoContinuation *cont, int state, MonoException **e)
+{
+       continuations_not_supported ();
+       return 0;
+}
+
+static MonoException*
+continuation_restore (MonoContinuation *cont, int state)
+{
+       continuations_not_supported ();
+       return NULL;
+}
+
+void
+mono_tasklets_init(void)
+{
+       mono_add_internal_call ("Mono.Tasklets.Continuation::alloc", continuation_alloc);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::free", continuation_free);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::mark", continuation_mark_frame);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::store", continuation_store);
+       mono_add_internal_call ("Mono.Tasklets.Continuation::restore", continuation_restore);
+
+}
 #endif
 
index 3f225f93cde330f8ed3b73251abc83a08e55b3be..f8e557492a5fdda0111d1232ad11cdced805d78d 100644 (file)
@@ -19,13 +19,6 @@ test-wrench: check-parallel
 
 aotcheck: testaot gshared-aot
 
-# Whenever running under CI
-# Can't use make conditionals since
-# automake doesn't support them
-# CI - Wrench
-# BUILD_URL = Jenkins
-RUNNING_ON_CI = $(CI)$(BUILD_URL)
-
 TEST_PROG = ../interpreter/mint
 
 JITTEST_PROG = $(if $(VALGRIND), valgrind $(VALGRIND_ARGS),) $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/mono/mini/mono)
@@ -41,7 +34,6 @@ else
 TEST_RUNNER_ARGS=--config tests-config --runtime $(if $(MONO_EXECUTABLE),$(MONO_EXECUTABLE),mono)
 endif
 
-TEST_RUNNER_ARGS += $(if $(RUNNING_ON_CI), --verbose,)
 TEST_RUNNER_ARGS += $(if $(V), --verbose,)
 
 CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE)
index 92ae719d7ba653080ecada657c71f3263678dba8..1bd0a646054f2e7e7586ad1e8b46b4ce2c215969 100644 (file)
@@ -23,16 +23,16 @@ struct _MonoCoopCond {
        mono_cond_t c;
 };
 
-static inline gint
+static inline void
 mono_coop_mutex_init (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_init (&mutex->m);
+       mono_os_mutex_init (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_init_recursive (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_init_recursive (&mutex->m);
+       mono_os_mutex_init_recursive (&mutex->m);
 }
 
 static inline gint
@@ -41,22 +41,18 @@ mono_coop_mutex_destroy (MonoCoopMutex *mutex)
        return mono_os_mutex_destroy (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_lock (MonoCoopMutex *mutex)
 {
-       gint res;
-
        /* Avoid thread state switch if lock is not contended */
        if (mono_os_mutex_trylock (&mutex->m) == 0)
-               return 0;
+               return;
 
        MONO_ENTER_GC_SAFE;
 
-       res = mono_os_mutex_lock (&mutex->m);
+       mono_os_mutex_lock (&mutex->m);
 
        MONO_EXIT_GC_SAFE;
-
-       return res;
 }
 
 static inline gint
@@ -65,16 +61,16 @@ mono_coop_mutex_trylock (MonoCoopMutex *mutex)
        return mono_os_mutex_trylock (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_mutex_unlock (MonoCoopMutex *mutex)
 {
-       return mono_os_mutex_unlock (&mutex->m);
+       mono_os_mutex_unlock (&mutex->m);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_init (MonoCoopCond *cond)
 {
-       return mono_os_cond_init (&cond->c);
+       mono_os_cond_init (&cond->c);
 }
 
 static inline gint
@@ -83,18 +79,14 @@ mono_coop_cond_destroy (MonoCoopCond *cond)
        return mono_os_cond_destroy (&cond->c);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_wait (MonoCoopCond *cond, MonoCoopMutex *mutex)
 {
-       gint res;
-
        MONO_ENTER_GC_SAFE;
 
-       res = mono_os_cond_wait (&cond->c, &mutex->m);
+       mono_os_cond_wait (&cond->c, &mutex->m);
 
        MONO_EXIT_GC_SAFE;
-
-       return res;
 }
 
 static inline gint
@@ -111,16 +103,16 @@ mono_coop_cond_timedwait (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 time
        return res;
 }
 
-static inline gint
+static inline void
 mono_coop_cond_signal (MonoCoopCond *cond)
 {
-       return mono_os_cond_signal (&cond->c);
+       mono_os_cond_signal (&cond->c);
 }
 
-static inline gint
+static inline void
 mono_coop_cond_broadcast (MonoCoopCond *cond)
 {
-       return mono_os_cond_broadcast (&cond->c);
+       mono_os_cond_broadcast (&cond->c);
 }
 
 G_END_DECLS
index 81c987ed74070107a4400e07f8fabf28b6cf865a..29937c5b73877e18c63ae2b49365bb6bf328de6f 100644 (file)
@@ -18,16 +18,16 @@ struct _MonoCoopSem {
        MonoSemType s;
 };
 
-static inline gint
+static inline void
 mono_coop_sem_init (MonoCoopSem *sem, int value)
 {
-       return mono_os_sem_init (&sem->s, value);
+       mono_os_sem_init (&sem->s, value);
 }
 
-static inline gint
+static inline void
 mono_coop_sem_destroy (MonoCoopSem *sem)
 {
-       return mono_os_sem_destroy (&sem->s);
+       mono_os_sem_destroy (&sem->s);
 }
 
 static inline gint
@@ -44,10 +44,10 @@ mono_coop_sem_wait (MonoCoopSem *sem, MonoSemFlags flags)
        return res;
 }
 
-static inline gint
+static inline MonoSemTimedwaitRet
 mono_coop_sem_timedwait (MonoCoopSem *sem, guint timeout_ms, MonoSemFlags flags)
 {
-       gint res;
+       MonoSemTimedwaitRet res;
 
        MONO_ENTER_GC_SAFE;
 
@@ -58,10 +58,10 @@ mono_coop_sem_timedwait (MonoCoopSem *sem, guint timeout_ms, MonoSemFlags flags)
        return res;
 }
 
-static inline gint
+static inline void
 mono_coop_sem_post (MonoCoopSem *sem)
 {
-       return mono_os_sem_post (&sem->s);
+       mono_os_sem_post (&sem->s);
 }
 
 G_END_DECLS
index b82b968a0262f1fe8b9791aa4c204cf6ceb80fc6..ece9bd410f6142aa38b59773fbdd144ed1d60c07 100644 (file)
@@ -43,76 +43,113 @@ G_BEGIN_DECLS
 typedef pthread_mutex_t mono_mutex_t;
 typedef pthread_cond_t mono_cond_t;
 
-static inline int
+static inline void
 mono_os_mutex_init (mono_mutex_t *mutex)
 {
-       return pthread_mutex_init (mutex, NULL);
+       int res;
+
+       res = pthread_mutex_init (mutex, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_mutex_init_recursive (mono_mutex_t *mutex)
 {
        int res;
        pthread_mutexattr_t attr;
 
-       pthread_mutexattr_init (&attr);
-       pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+       res = pthread_mutexattr_init (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutexattr_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       res = pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutexattr_settype failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
        res = pthread_mutex_init (mutex, &attr);
-       pthread_mutexattr_destroy (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 
-       return res;
+       res = pthread_mutexattr_destroy (&attr);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutexattr_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
 mono_os_mutex_destroy (mono_mutex_t *mutex)
 {
-       return pthread_mutex_destroy (mutex);
+       int res;
+
+       res = pthread_mutex_destroy (mutex);
+       if (G_UNLIKELY (res != 0 && res != EBUSY))
+               g_error ("%s: pthread_mutex_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_lock (mono_mutex_t *mutex)
 {
        int res;
 
        res = pthread_mutex_lock (mutex);
-       g_assert (res != EINVAL);
-
-       return res;
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_lock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
 mono_os_mutex_trylock (mono_mutex_t *mutex)
 {
-       return pthread_mutex_trylock (mutex);
+       int res;
+
+       res = pthread_mutex_trylock (mutex);
+       if (G_UNLIKELY (res != 0 && res != EBUSY))
+               g_error ("%s: pthread_mutex_trylock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_unlock (mono_mutex_t *mutex)
 {
-       return pthread_mutex_unlock (mutex);
+       int res;
+
+       res = pthread_mutex_unlock (mutex);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_mutex_unlock failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_cond_init (mono_cond_t *cond)
 {
-       return pthread_cond_init (cond, NULL);
+       int res;
+
+       res = pthread_cond_init (cond, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_init failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
 mono_os_cond_destroy (mono_cond_t *cond)
 {
-       return pthread_cond_destroy (cond);
+       int res;
+
+       res = pthread_cond_destroy (cond);
+       if (G_UNLIKELY (res != 0 && res != EBUSY))
+               g_error ("%s: pthread_cond_destroy failed with \"%s\" (%d)", __func__, g_strerror (res), res);
+
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
 {
        int res;
 
        res = pthread_cond_wait (cond, mutex);
-       g_assert (res != EINVAL);
-
-       return res;
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_wait failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 static inline int
@@ -123,12 +160,17 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
        gint64 usecs;
        int res;
 
-       if (timeout_ms == MONO_INFINITE_WAIT)
-               return mono_os_cond_wait (cond, mutex);
+       if (timeout_ms == MONO_INFINITE_WAIT) {
+               mono_os_cond_wait (cond, mutex);
+               return 0;
+       }
 
        /* ms = 10^-3, us = 10^-6, ns = 10^-9 */
 
-       gettimeofday (&tv, NULL);
+       res = gettimeofday (&tv, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+
        tv.tv_sec += timeout_ms / 1000;
        usecs = tv.tv_usec + ((timeout_ms % 1000) * 1000);
        if (usecs >= 1000000) {
@@ -139,21 +181,30 @@ mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_
        ts.tv_nsec = usecs * 1000;
 
        res = pthread_cond_timedwait (cond, mutex, &ts);
-       g_assert (res != EINVAL);
+       if (G_UNLIKELY (res != 0 && res != ETIMEDOUT))
+               g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 
-       return res;
+       return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_signal (mono_cond_t *cond)
 {
-       return pthread_cond_signal (cond);
+       int res;
+
+       res = pthread_cond_signal (cond);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_signal failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
-static inline int
+static inline void
 mono_os_cond_broadcast (mono_cond_t *cond)
 {
-       return pthread_cond_broadcast (cond);
+       int res;
+
+       res = pthread_cond_broadcast (cond);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: pthread_cond_broadcast failed with \"%s\" (%d)", __func__, g_strerror (res), res);
 }
 
 #else
@@ -225,18 +276,24 @@ WINBASEAPI BOOL WINAPI InitializeCriticalSectionEx(LPCRITICAL_SECTION lpCritical
 typedef CRITICAL_SECTION mono_mutex_t;
 typedef CONDITION_VARIABLE mono_cond_t;
 
-static inline int
+static inline void
 mono_os_mutex_init (mono_mutex_t *mutex)
 {
-       InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
-       return 0;
+       BOOL res;
+
+       res = InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: InitializeCriticalSectionEx failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline void
 mono_os_mutex_init_recursive (mono_mutex_t *mutex)
 {
-       InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
-       return 0;
+       BOOL res;
+
+       res = InitializeCriticalSectionEx (mutex, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: InitializeCriticalSectionEx failed with error %d", __func__, GetLastError ());
 }
 
 static inline int
@@ -246,31 +303,28 @@ mono_os_mutex_destroy (mono_mutex_t *mutex)
        return 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_lock (mono_mutex_t *mutex)
 {
        EnterCriticalSection (mutex);
-       return 0;
 }
 
 static inline int
 mono_os_mutex_trylock (mono_mutex_t *mutex)
 {
-       return TryEnterCriticalSection (mutex) != 0 ? 0 : 1;
+       return TryEnterCriticalSection (mutex) == 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_mutex_unlock (mono_mutex_t *mutex)
 {
        LeaveCriticalSection (mutex);
-       return 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_init (mono_cond_t *cond)
 {
        InitializeConditionVariable (cond);
-       return 0;
 }
 
 static inline int
@@ -280,30 +334,38 @@ mono_os_cond_destroy (mono_cond_t *cond)
        return 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
 {
-       return SleepConditionVariableCS (cond, mutex, INFINITE) ? 0 : 1;
+       BOOL res;
+
+       res = SleepConditionVariableCS (cond, mutex, INFINITE);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: SleepConditionVariableCS failed with error %d", __func__, GetLastError ());
 }
 
 static inline int
 mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms)
 {
-       return SleepConditionVariableCS (cond, mutex, timeout_ms) ? 0 : 1;
+       BOOL res;
+
+       res = SleepConditionVariableCS (cond, mutex, timeout_ms);
+       if (G_UNLIKELY (res == 0 && GetLastError () != ERROR_TIMEOUT))
+               g_error ("%s: SleepConditionVariableCS failed with error %d", __func__, GetLastError ());
+
+       return res == 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_signal (mono_cond_t *cond)
 {
        WakeConditionVariable (cond);
-       return 0;
 }
 
-static inline int
+static inline void
 mono_os_cond_broadcast (mono_cond_t *cond)
 {
        WakeAllConditionVariable (cond);
-       return 0;
 }
 
 #endif
index 6282457e13e87fe673753909f197c1d6118eb102..9f59ce1ea821df2fa3dd849edd89d8e3a8b8aee7 100644 (file)
@@ -51,30 +51,45 @@ typedef enum {
        MONO_SEM_FLAGS_ALERTABLE = 1 << 0,
 } MonoSemFlags;
 
+typedef enum {
+       MONO_SEM_TIMEDWAIT_RET_SUCCESS  =  0,
+       MONO_SEM_TIMEDWAIT_RET_ALERTED  = -1,
+       MONO_SEM_TIMEDWAIT_RET_TIMEDOUT = -2,
+} MonoSemTimedwaitRet;
+
 #if defined(USE_MACH_SEMA)
 
 typedef semaphore_t MonoSemType;
 
-static inline int
+static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
-       return semaphore_create (current_task (), sem, SYNC_POLICY_FIFO, value) != KERN_SUCCESS ? -1 : 0;
+       kern_return_t res;
+
+       res = semaphore_create (current_task (), sem, SYNC_POLICY_FIFO, value);
+       if (G_UNLIKELY (res != KERN_SUCCESS))
+               g_error ("%s: semaphore_create failed with error %d", __func__, res);
 }
 
-static inline int
+static inline void
 mono_os_sem_destroy (MonoSemType *sem)
 {
-       return semaphore_destroy (current_task (), *sem) != KERN_SUCCESS ? -1 : 0;
+       kern_return_t res;
+
+       res = semaphore_destroy (current_task (), *sem);
+       if (G_UNLIKELY (res != KERN_SUCCESS))
+               g_error ("%s: semaphore_destroy failed with error %d", __func__, res);
 }
 
 static inline int
 mono_os_sem_wait (MonoSemType *sem, MonoSemFlags flags)
 {
-       int res;
+       kern_return_t res;
 
 retry:
        res = semaphore_wait (*sem);
-       g_assert (res != KERN_INVALID_ARGUMENT);
+       if (G_UNLIKELY (res != KERN_SUCCESS && res != KERN_ABORTED))
+               g_error ("%s: semaphore_wait failed with error %d", __func__, res);
 
        if (res == KERN_ABORTED && !(flags & MONO_SEM_FLAGS_ALERTABLE))
                goto retry;
@@ -82,15 +97,16 @@ retry:
        return res != KERN_SUCCESS ? -1 : 0;
 }
 
-static inline int
+static inline MonoSemTimedwaitRet
 mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
 {
+       kern_return_t res;
+       int resint;
        mach_timespec_t ts, copy;
        struct timeval start, current;
-       int res = 0;
 
        if (timeout_ms == MONO_INFINITE_WAIT)
-               return mono_os_sem_wait (sem, flags);
+               return (MonoSemTimedwaitRet) mono_os_sem_wait (sem, flags);
 
        ts.tv_sec = timeout_ms / 1000;
        ts.tv_nsec = (timeout_ms % 1000) * 1000000;
@@ -100,16 +116,22 @@ mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
        }
 
        copy = ts;
-       gettimeofday (&start, NULL);
+       resint = gettimeofday (&start, NULL);
+       if (G_UNLIKELY (resint != 0))
+               g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
 retry:
        res = semaphore_timedwait (*sem, ts);
-       g_assert (res != KERN_INVALID_ARGUMENT);
+       if (G_UNLIKELY (res != KERN_SUCCESS && res != KERN_ABORTED && res != KERN_OPERATION_TIMED_OUT))
+               g_error ("%s: semaphore_timedwait failed with error %d", __func__, res);
 
        if (res == KERN_ABORTED && !(flags & MONO_SEM_FLAGS_ALERTABLE)) {
                ts = copy;
 
-               gettimeofday (&current, NULL);
+               resint = gettimeofday (&current, NULL);
+               if (G_UNLIKELY (resint != 0))
+                       g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+
                ts.tv_sec -= (current.tv_sec - start.tv_sec);
                ts.tv_nsec -= (current.tv_usec - start.tv_usec) * 1000;
                if (ts.tv_nsec < 0) {
@@ -128,37 +150,54 @@ retry:
                goto retry;
        }
 
-       return res != KERN_SUCCESS ? -1 : 0;
+       switch (res) {
+       case KERN_SUCCESS:
+               return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+       case KERN_ABORTED:
+               return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+       case KERN_OPERATION_TIMED_OUT:
+               return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+       default:
+               g_assert_not_reached ();
+       }
 }
 
-static inline int
+static inline void
 mono_os_sem_post (MonoSemType *sem)
 {
-       int res;
+       kern_return_t res;
+
 retry:
        res = semaphore_signal (*sem);
-       g_assert (res != KERN_INVALID_ARGUMENT);
+       if (G_UNLIKELY (res != KERN_SUCCESS && res != KERN_ABORTED))
+               g_error ("%s: semaphore_signal failed with error %d", __func__, res);
 
        if (res == KERN_ABORTED)
                goto retry;
-
-       return res != KERN_SUCCESS ? -1 : 0;
 }
 
 #elif !defined(HOST_WIN32) && defined(HAVE_SEMAPHORE_H)
 
 typedef sem_t MonoSemType;
 
-static inline int
+static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
-       return sem_init (sem, 0, value);
+       int res;
+
+       res = sem_init (sem, 0, value);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: sem_init failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 }
 
-static inline int
+static inline void
 mono_os_sem_destroy (MonoSemType *sem)
 {
-       return sem_destroy (sem);
+       int res;
+
+       res = sem_destroy (sem);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: sem_destroy failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 }
 
 static inline int
@@ -168,34 +207,44 @@ mono_os_sem_wait (MonoSemType *sem, MonoSemFlags flags)
 
 retry:
        res = sem_wait (sem);
-       if (res == -1)
-               g_assert (errno != EINVAL);
+       if (G_UNLIKELY (res != 0 && errno != EINTR))
+               g_error ("%s: sem_wait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       if (res == -1 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE))
+       if (res != 0 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE))
                goto retry;
 
        return res != 0 ? -1 : 0;
 }
 
-static inline int
+static inline MonoSemTimedwaitRet
 mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
 {
        struct timespec ts, copy;
        struct timeval t;
-       int res = 0;
+       int res;
 
        if (timeout_ms == 0) {
-               res = sem_trywait (sem) != 0 ? -1 : 0;
-               if (res == -1)
-                       g_assert (errno != EINVAL);
-
-               return res != 0 ? -1 : 0;
+               res = sem_trywait (sem);
+               if (G_UNLIKELY (res != 0 && errno != EINTR && errno != EAGAIN))
+                       g_error ("%s: sem_trywait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
+
+               if (res == 0)
+                       return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+               else if (errno == EINTR)
+                       return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+               else if (errno == EAGAIN)
+                       return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+               else
+                       g_assert_not_reached ();
        }
 
        if (timeout_ms == MONO_INFINITE_WAIT)
-               return mono_os_sem_wait (sem, flags);
+               return (MonoSemTimedwaitRet) mono_os_sem_wait (sem, flags);
+
+       res = gettimeofday (&t, NULL);
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       gettimeofday (&t, NULL);
        ts.tv_sec = timeout_ms / 1000 + t.tv_sec;
        ts.tv_nsec = (timeout_ms % 1000) * 1000000 + t.tv_usec * 1000;
        while (ts.tv_nsec >= NSEC_PER_SEC) {
@@ -206,75 +255,96 @@ mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
        copy = ts;
 
 retry:
-#if defined(__native_client__) && defined(USE_NEWLIB)
-       res = sem_trywait (sem);
-#else
        res = sem_timedwait (sem, &ts);
-#endif
-       if (res == -1)
-               g_assert (errno != EINVAL);
+       if (G_UNLIKELY (res != 0 && errno != EINTR && errno != ETIMEDOUT))
+               g_error ("%s: sem_timedwait failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 
-       if (res == -1 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE)) {
+       if (res != 0 && errno == EINTR && !(flags & MONO_SEM_FLAGS_ALERTABLE)) {
                ts = copy;
                goto retry;
        }
 
-       return res != 0 ? -1 : 0;
+       if (res == 0)
+               return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+       else if (errno == EINTR)
+               return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+       else if (errno == ETIMEDOUT)
+               return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+       else
+               g_assert_not_reached ();
 }
 
-static inline int
+static inline void
 mono_os_sem_post (MonoSemType *sem)
 {
        int res;
 
        res = sem_post (sem);
-       if (res == -1)
-               g_assert (errno != EINVAL);
-
-       return res;
+       if (G_UNLIKELY (res != 0))
+               g_error ("%s: sem_post failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
 }
 
 #else
 
 typedef HANDLE MonoSemType;
 
-static inline int
+static inline void
 mono_os_sem_init (MonoSemType *sem, int value)
 {
        *sem = CreateSemaphore (NULL, value, 0x7FFFFFFF, NULL);
-       return *sem == NULL ? -1 : 0;
+       if (G_UNLIKELY (*sem == NULL))
+               g_error ("%s: CreateSemaphore failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline void
 mono_os_sem_destroy (MonoSemType *sem)
 {
-       return !CloseHandle (*sem) ? -1 : 0;
+       BOOL res;
+
+       res = CloseHandle (*sem);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: CloseHandle failed with error %d", __func__, GetLastError ());
 }
 
-static inline int
+static inline MonoSemTimedwaitRet
 mono_os_sem_timedwait (MonoSemType *sem, guint32 timeout_ms, MonoSemFlags flags)
 {
-       gboolean res;
+       BOOL res;
 
 retry:
        res = WaitForSingleObjectEx (*sem, timeout_ms, flags & MONO_SEM_FLAGS_ALERTABLE);
+       if (G_UNLIKELY (res != WAIT_OBJECT_0 && res != WAIT_IO_COMPLETION && res != WAIT_TIMEOUT))
+               g_error ("%s: WaitForSingleObjectEx failed with error %d", __func__, GetLastError ());
 
        if (res == WAIT_IO_COMPLETION && !(flags & MONO_SEM_FLAGS_ALERTABLE))
                goto retry;
 
-       return res != WAIT_OBJECT_0 ? -1 : 0;
+       switch (res) {
+       case WAIT_OBJECT_0:
+               return MONO_SEM_TIMEDWAIT_RET_SUCCESS;
+       case WAIT_IO_COMPLETION:
+               return MONO_SEM_TIMEDWAIT_RET_ALERTED;
+       case WAIT_TIMEOUT:
+               return MONO_SEM_TIMEDWAIT_RET_TIMEDOUT;
+       default:
+               g_assert_not_reached ();
+       }
 }
 
 static inline int
 mono_os_sem_wait (MonoSemType *sem, MonoSemFlags flags)
 {
-       return mono_os_sem_timedwait (sem, INFINITE, flags);
+       return mono_os_sem_timedwait (sem, INFINITE, flags) != 0 ? -1 : 0;
 }
 
-static inline int
+static inline void
 mono_os_sem_post (MonoSemType *sem)
 {
-       return !ReleaseSemaphore (*sem, 1, NULL) ? -1 : 0;
+       BOOL res;
+
+       res = ReleaseSemaphore (*sem, 1, NULL);
+       if (G_UNLIKELY (res == 0))
+               g_error ("%s: ReleaseSemaphore failed with error %d", __func__, GetLastError ());
 }
 
 #endif
index adf14f22eaf802f541bcabef1e24cba8fb8f1d99..cb218f5c14d3d3e88957435fb7c5b6d1c5aea175 100644 (file)
@@ -61,8 +61,7 @@ inner_start_thread (void *arg)
        /* Register the thread with the io-layer */
        handle = wapi_create_thread_handle ();
        if (!handle) {
-               res = mono_coop_sem_post (&(start_info->registered));
-               g_assert (!res);
+               mono_coop_sem_post (&(start_info->registered));
                return NULL;
        }
        start_info->handle = handle;
@@ -80,8 +79,7 @@ inner_start_thread (void *arg)
        }
 
        /* start_info is not valid after this */
-       res = mono_coop_sem_post (&(start_info->registered));
-       g_assert (!res);
+       mono_coop_sem_post (&(start_info->registered));
        start_info = NULL;
 
        if (flags & CREATE_SUSPENDED) {
index 1b9dd43daf1f9350fc5aac916c862b8ae42c7451..c824cf314d03419a83d1041fef4a3e24a91b5ab8 100644 (file)
@@ -156,8 +156,7 @@ inner_start_thread (LPVOID arg)
        info->runtime_thread = TRUE;
        info->create_suspended = suspend;
 
-       post_result = mono_coop_sem_post (&(start_info->registered));
-       g_assert (!post_result);
+       mono_coop_sem_post (&(start_info->registered));
 
        if (suspend) {
                WaitForSingleObject (suspend_event, INFINITE); /* caller will suspend the thread before setting the event. */
index 07d7b26ce0185b966074e577a5810dd4d4143fd2..d9791d0764b48f78100f799c7a802c422df7a29e 100644 (file)
@@ -238,7 +238,7 @@ mono_threads_wait_pending_operations (void)
                for (i = 0; i < pending_suspends; ++i) {
                        THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-WAITING]\n");
                        InterlockedIncrement (&waits_done);
-                       if (!mono_os_sem_timedwait (&suspend_semaphore, sleepAbortDuration, MONO_SEM_FLAGS_NONE))
+                       if (mono_os_sem_timedwait (&suspend_semaphore, sleepAbortDuration, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_SUCCESS)
                                continue;
                        mono_stopwatch_stop (&suspension_time);
 
index d8a34dc426964cf0c15526f7597c4c1058cf392c..eb0c22ed323f9372692a686347f75d42514880b2 100644 (file)
@@ -142,7 +142,6 @@ void
 mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast)
 {
        MonoW32HandleBase *handle_data;
-       int thr_ret;
 
        if (!mono_w32handle_lookup_data (handle, &handle_data)) {
                return;
@@ -159,10 +158,7 @@ mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broad
                /* The condition the global signal cond is waiting on is the signalling of
                 * _any_ handle. So lock it before setting the signalled state.
                 */
-               thr_ret = mono_os_mutex_lock (&global_signal_mutex);
-               if (thr_ret != 0)
-                       g_warning ("Bad call to mono_os_mutex_lock result %d for global signal mutex", thr_ret);
-               g_assert (thr_ret == 0);
+               mono_os_mutex_lock (&global_signal_mutex);
 
                /* This function _must_ be called with
                 * handle->signal_mutex locked
@@ -170,29 +166,17 @@ mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broad
                handle_data->signalled=state;
 
                if (broadcast == TRUE) {
-                       thr_ret = mono_os_cond_broadcast (&handle_data->signal_cond);
-                       if (thr_ret != 0)
-                               g_warning ("Bad call to mono_os_cond_broadcast result %d for handle %p", thr_ret, handle);
-                       g_assert (thr_ret == 0);
+                       mono_os_cond_broadcast (&handle_data->signal_cond);
                } else {
-                       thr_ret = mono_os_cond_signal (&handle_data->signal_cond);
-                       if (thr_ret != 0)
-                               g_warning ("Bad call to mono_os_cond_signal result %d for handle %p", thr_ret, handle);
-                       g_assert (thr_ret == 0);
+                       mono_os_cond_signal (&handle_data->signal_cond);
                }
 
                /* Tell everyone blocking on multiple handles that something
                 * was signalled
                 */
-               thr_ret = mono_os_cond_broadcast (&global_signal_cond);
-               if (thr_ret != 0)
-                       g_warning ("Bad call to mono_os_cond_broadcast result %d for handle %p", thr_ret, handle);
-               g_assert (thr_ret == 0);
+               mono_os_cond_broadcast (&global_signal_cond);
 
-               thr_ret = mono_os_mutex_unlock (&global_signal_mutex);
-               if (thr_ret != 0)
-                       g_warning ("Bad call to mono_os_mutex_unlock result %d for global signal mutex", thr_ret);
-               g_assert (thr_ret == 0);
+               mono_os_mutex_unlock (&global_signal_mutex);
        } else {
                handle_data->signalled=state;
        }
@@ -217,7 +201,9 @@ mono_w32handle_lock_signal_mutex (void)
        g_message ("%s: lock global signal mutex", __func__);
 #endif
 
-       return(mono_os_mutex_lock (&global_signal_mutex));
+       mono_os_mutex_lock (&global_signal_mutex);
+
+       return 0;
 }
 
 int
@@ -227,7 +213,9 @@ mono_w32handle_unlock_signal_mutex (void)
        g_message ("%s: unlock global signal mutex", __func__);
 #endif
 
-       return(mono_os_mutex_unlock (&global_signal_mutex));
+       mono_os_mutex_unlock (&global_signal_mutex);
+
+       return 0;
 }
 
 int
@@ -245,7 +233,9 @@ mono_w32handle_lock_handle (gpointer handle)
 
        mono_w32handle_ref (handle);
 
-       return(mono_os_mutex_lock (&handle_data->signal_mutex));
+       mono_os_mutex_lock (&handle_data->signal_mutex);
+
+       return 0;
 }
 
 int
@@ -276,7 +266,6 @@ int
 mono_w32handle_unlock_handle (gpointer handle)
 {
        MonoW32HandleBase *handle_data;
-       int ret;
 
 #ifdef DEBUG
        g_message ("%s: unlocking handle %p", __func__, handle);
@@ -286,11 +275,11 @@ mono_w32handle_unlock_handle (gpointer handle)
                return(0);
        }
 
-       ret = mono_os_mutex_unlock (&handle_data->signal_mutex);
+       mono_os_mutex_unlock (&handle_data->signal_mutex);
 
        mono_w32handle_unref (handle);
 
-       return(ret);
+       return 0;
 }
 
 /*
@@ -358,19 +347,14 @@ mono_w32handle_cleanup (void)
 static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
                               MonoW32HandleType type, gpointer handle_specific)
 {
-       int thr_ret;
-       
        g_assert (!shutting_down);
        
        handle->type = type;
        handle->signalled = FALSE;
        handle->ref = 1;
 
-       thr_ret = mono_os_cond_init (&handle->signal_cond);
-       g_assert (thr_ret == 0);
-
-       thr_ret = mono_os_mutex_init (&handle->signal_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_cond_init (&handle->signal_cond);
+       mono_os_mutex_init (&handle->signal_mutex);
 
        if (handle_specific)
                handle->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type));
@@ -439,7 +423,6 @@ mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific)
 {
        guint32 handle_idx = 0;
        gpointer handle;
-       int thr_ret;
 
        g_assert (!shutting_down);
 
@@ -448,8 +431,7 @@ mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific)
 
        g_assert(!type_is_fd(type));
 
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&scan_mutex);
 
        while ((handle_idx = mono_w32handle_new_internal (type, handle_specific)) == 0) {
                /* Try and expand the array, and have another go */
@@ -464,8 +446,7 @@ mono_w32handle_new (MonoW32HandleType type, gpointer handle_specific)
                private_handles_slots_count ++;
        }
 
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&scan_mutex);
 
        if (handle_idx == 0) {
                /* We ran out of slots */
@@ -489,7 +470,6 @@ gpointer mono_w32handle_new_fd (MonoW32HandleType type, int fd,
 {
        MonoW32HandleBase *handle_data;
        int fd_index, fd_offset;
-       int thr_ret;
 
        g_assert (!shutting_down);
 
@@ -509,14 +489,12 @@ gpointer mono_w32handle_new_fd (MonoW32HandleType type, int fd,
 
        /* Initialize the array entries on demand */
        if (!private_handles [fd_index]) {
-               thr_ret = mono_os_mutex_lock (&scan_mutex);
-               g_assert (thr_ret == 0);
+               mono_os_mutex_lock (&scan_mutex);
 
                if (!private_handles [fd_index])
                        private_handles [fd_index] = g_new0 (MonoW32HandleBase, HANDLE_PER_SLOT);
 
-               thr_ret = mono_os_mutex_unlock (&scan_mutex);
-               g_assert (thr_ret == 0);
+               mono_os_mutex_unlock (&scan_mutex);
        }
 
        handle_data = &private_handles [fd_index][fd_offset];
@@ -562,10 +540,8 @@ mono_w32handle_foreach (gboolean (*on_each)(gpointer handle, gpointer data, gpoi
        MonoW32HandleBase *handle_data = NULL;
        gpointer handle;
        guint32 i, k;
-       int thr_ret;
 
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&scan_mutex);
 
        for (i = SLOT_INDEX (0); i < private_handles_slots_count; i++) {
                if (private_handles [i]) {
@@ -581,8 +557,7 @@ mono_w32handle_foreach (gboolean (*on_each)(gpointer handle, gpointer data, gpoi
        }
 
 done:
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&scan_mutex);
 }
 
 /* This might list some shared handles twice if they are already
@@ -603,10 +578,8 @@ gpointer mono_w32handle_search (MonoW32HandleType type,
        gpointer ret = NULL;
        guint32 i, k;
        gboolean found = FALSE;
-       int thr_ret;
 
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&scan_mutex);
 
        for (i = SLOT_INDEX (0); !found && i < private_handles_slots_count; i++) {
                if (private_handles [i]) {
@@ -625,8 +598,7 @@ gpointer mono_w32handle_search (MonoW32HandleType type,
                }
        }
 
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&scan_mutex);
 
        if (!found) {
                ret = NULL;
@@ -699,8 +671,7 @@ static void mono_w32handle_unref_full (gpointer handle, gboolean ignore_private_
                type = handle_data->type;
                handle_specific = handle_data->specific;
 
-               thr_ret = mono_os_mutex_lock (&scan_mutex);
-               g_assert (thr_ret == 0);
+               mono_os_mutex_lock (&scan_mutex);
 
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_W32HANDLE, "%s: Destroying handle %p", __func__, handle);
 
@@ -726,8 +697,7 @@ static void mono_w32handle_unref_full (gpointer handle, gboolean ignore_private_
 
                memset (handle_data, 0, sizeof (MonoW32HandleBase));
 
-               thr_ret = mono_os_mutex_unlock (&scan_mutex);
-               g_assert (thr_ret == 0);
+               mono_os_mutex_unlock (&scan_mutex);
 
                if (early_exit)
                        return;
@@ -1166,10 +1136,8 @@ void mono_w32handle_dump (void)
 {
        MonoW32HandleBase *handle_data;
        guint32 i, k;
-       int thr_ret;
 
-       thr_ret = mono_os_mutex_lock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_lock (&scan_mutex);
 
        for(i = SLOT_INDEX (0); i < private_handles_slots_count; i++) {
                if (private_handles [i]) {
@@ -1191,8 +1159,7 @@ void mono_w32handle_dump (void)
                }
        }
 
-       thr_ret = mono_os_mutex_unlock (&scan_mutex);
-       g_assert (thr_ret == 0);
+       mono_os_mutex_unlock (&scan_mutex);
 }
 
 #endif /* !defined(HOST_WIN32) */
index ad2fe82914140b24f6daa4d5025b2f5b7bd995c5..17656e390a572516baf18e227d260af94c972691 100755 (executable)
@@ -20,6 +20,9 @@ if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="${EXTRA_CONF_FL
 if [[ ${CI_TAGS} == 'mobile_static' ]];
     then
     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=mobile_static";
+elif [[ ${CI_TAGS} == 'acceptance-tests' ]];
+    then
+    EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --prefix=${WORKSPACE}/tmp/mono-acceptance-tests --with-sgen-default-concurrent=yes";
 elif [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]];
     then
     # Override the defaults to skip profiles
@@ -52,4 +55,7 @@ if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]];
     # we don't run the test suite on Windows PRs, we just ensure the build succeeds, so end here
 fi
 
-make check-ci
+if [[ ${CI_TAGS} == 'acceptance-tests' ]];
+then $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
+else make check-ci
+fi
\ No newline at end of file
diff --git a/scripts/ci/run-test-acceptance-tests.sh b/scripts/ci/run-test-acceptance-tests.sh
new file mode 100755 (executable)
index 0000000..0e5fe78
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+
+export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
+
+make install  # Roslyn tests need a Mono installation
+
+LANG=en_US.UTF-8 ${TESTCMD} --label=check-ms-test-suite --timeout=30m make -C acceptance-tests check-ms-test-suite
+
+total_tests=$(find acceptance-tests/ -name TestResult*xml | xargs cat | grep -c "<test-case")
+if [ "$total_tests" -lt "1600" ]
+       then echo "*** NOT ENOUGH TEST RESULTS RECORDED, MARKING FAILURE ***"
+       exit 1
+fi
+
+${TESTCMD} --label=check-roslyn --timeout=30m make -C acceptance-tests check-roslyn PREFIX=${WORKSPACE}/tmp/mono-acceptance-tests
+rm -rf ${WORKSPACE}/tmp/mono-acceptance-tests  # cleanup the Mono installation used for Roslyn tests
+
+${TESTCMD} --label=coreclr-compile-tests --timeout=80m --fatal make -C acceptance-tests coreclr-compile-tests
+${TESTCMD} --label=coreclr-runtest-basic --timeout=10m make -C acceptance-tests coreclr-runtest-basic
+${TESTCMD} --label=coreclr-runtest-coremanglib --timeout=10m make -C acceptance-tests coreclr-runtest-coremanglib
+${TESTCMD} --label=coreclr-gcstress --timeout=1200m make -C acceptance-tests coreclr-gcstress
index bcce919fa7d309f85d52a9e2d2be7eddbd889679..bffda6b73f7191f1673b4e3123ca9c18b95589ea 100755 (executable)
@@ -2,7 +2,7 @@
 
 export TESTCMD=`dirname "${BASH_SOURCE[0]}"`/run-step.sh
 
-${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k check
+${TESTCMD} --label=mini --timeout=5m make -w -C mono/mini -k check check-seq-points EMIT_NUNIT=1
 ${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1
 ${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test
 ${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall
@@ -38,6 +38,7 @@ ${TESTCMD} --label=Microsoft.Build.Framework --timeout=5m make -w -C mcs/class/M
 ${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test
 ${TESTCMD} --label=Microsoft.Build.Utilities --timeout=5m make -w -C mcs/class/Microsoft.Build.Utilities run-test
 ${TESTCMD} --label=Mono.C5 --timeout=5m make -w -C mcs/class/Mono.C5 run-test
+${TESTCMD} --label=Mono.Tasklets --timeout=5m make -w -C mcs/class/Mono.Tasklets run-test
 ${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System.Configuration run-test
 ${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
 ${TESTCMD} --label=System.Web.Extensions --timeout=5m make -w -C mcs/class/System.Web.Extensions run-test
index e83ea3e561c2945c7a7b3e08e3b13a5097870eeb..5d9eb574eb28201bb5aa78ca9bb9bb22be6a29f4 100644 (file)
@@ -24,7 +24,9 @@ namespace CppSharp
         static List<string> Abis = new List<string> ();
         static string OutputDir;
 
+        static bool XamarinAndroid;
         static string MonodroidDir = @"";
+        static string AndroidNdkPath = @"";
         static string MaccoreDir = @"";
 
         public enum TargetPlatform
@@ -87,28 +89,28 @@ namespace CppSharp
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "i686-none-linux-android",
-                Build = "mono-x86",
+                Build = XamarinAndroid ? "x86" : "mono-x86",
                 Defines = { "TARGET_X86" }
             });
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "x86_64-none-linux-android",
-                Build = "mono-x86_64",
+                Build = XamarinAndroid ? "x86_64" : "mono-x86_64",
                 Defines = { "TARGET_AMD64" }
             });            
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "armv5-none-linux-androideabi",
-                Build = "mono-armv6",
+                Build = XamarinAndroid ? "armeabi" : "mono-armv6",
                 Defines = { "TARGET_ARM", "ARM_FPU_VFP", "HAVE_ARMV5" }
             });
 
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "armv7-none-linux-androideabi",
-                Build = "mono-armv7",                    
+                Build = XamarinAndroid ? "armeabi-v7a" : "mono-armv7",
                 Defines = { "TARGET_ARM", "ARM_FPU_VFP", "HAVE_ARMV5", "HAVE_ARMV6",
                     "HAVE_ARMV7"
                 }
@@ -117,7 +119,7 @@ namespace CppSharp
             Targets.Add (new Target {
                 Platform = TargetPlatform.Android,
                 Triple = "aarch64-v8a-linux-android",
-                Build = "mono-aarch64",                    
+                Build = XamarinAndroid ? "arm64-v8a" : "mono-aarch64",
                 Defines = { "TARGET_ARM64" }
             });            
 
@@ -254,6 +256,9 @@ namespace CppSharp
 
         static string GetAndroidNdkPath()
         {
+            if (!String.IsNullOrEmpty (AndroidNdkPath))
+                return AndroidNdkPath;
+
             // Find the Android NDK's path from Monodroid's config.
             var configFile = Path.Combine(MonodroidDir, "env.config");
             if (!File.Exists(configFile))
@@ -272,7 +277,9 @@ namespace CppSharp
                 { "abi=", "ABI triple to generate", v => Abis.Add(v) },
                 { "o|out=", "output directory", v => OutputDir = v },
                 { "maccore=", "include directory", v => MaccoreDir = v },
-                { "monodroid=", "include directory", v => MonodroidDir = v },
+                { "monodroid=", "top monodroid directory", v => MonodroidDir = v },
+                { "android-ndk=", "Path to Android NDK", v => AndroidNdkPath = v },
+                { "xamarin-android", "Generate for Xamarin.Android instead of monodroid", v => XamarinAndroid = true },
                 { "mono=", "include directory", v => MonoDir = v },
                 { "h|help",  "show this message and exit",  v => showHelp = v != null },
             };
@@ -319,7 +326,7 @@ namespace CppSharp
             string targetPath;
             switch (target.Platform) {
             case TargetPlatform.Android:
-                targetPath = Path.Combine (MonodroidDir, "builds");
+                targetPath = Path.Combine (MonodroidDir, XamarinAndroid ? "build-tools/mono-runtimes/obj/Debug" : "builds");
                 break;
             case TargetPlatform.WatchOS:
             case TargetPlatform.iOS: