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
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; \
#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])
AC_SUBST(INSTALL_MOBILE_STATIC)
-AC_SUBST(BITCODE)
-
default_profile=net_4_x
if test -z "$INSTALL_MONODROID_TRUE"; then :
default_profile=monodroid
.\" 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
+++ /dev/null
-//
-// 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]
-
-
+++ /dev/null
-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
-
-
+++ /dev/null
-// 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
+++ /dev/null
-TypeForwarders.cs
-AssemblyInfo.cs
-Missing.cs
+++ /dev/null
-//
-// 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))]
-
-
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
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
Evaluator/EvaluatorTest.cs
Evaluator/ExpressionsTest.cs
Evaluator/TypesTest.cs
+Visit/ASTVisitorTest.cs
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 ());
}
#include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
#include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
#include mobile_static_Mono.CSharp.dll.sources
-monotouch.cs
# 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
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
{
wait_one ();
return 0;
}
+ if (args.Length >0 && args [0] == "threadpool-io") {
+ threadpool_io ();
+ return 0;
+ }
breakpoints ();
single_stepping ();
arguments ();
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 {
// 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
+ }
}
}
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:
../../build/common/SR.cs
+../../build/common/MonoTODOAttribute.cs
Assembly/AssemblyInfo.cs
System/Util.cs
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 ();
}
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Proxy_Disabled ()
{
var pp = WebRequest.DefaultWebProxy;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_Default ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_Version_1_0 ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_ClientHandlerSettings ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_CustomHeaders ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_CustomHeaders_SpecialSeparators ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_CustomHeaders_Host ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Transfer_Encoding_Chunked ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Transfer_Encoding_Custom ()
{
bool? failed = null;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_Content ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_Content_MaxResponseContentBufferSize ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_Content_MaxResponseContentBufferSize_Error ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_NoContent ()
{
foreach (var method in new HttpMethod[] { HttpMethod.Post, HttpMethod.Put, HttpMethod.Delete }) {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Complete_Error ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Content_Get ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Content_BomEncoding ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Content_Put ()
{
bool passed = false;
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Send_Content_Put_CustomStream ()
{
bool passed = false;
[Test]
[Category ("MobileNotWorking")] // Missing encoding
+ [Category ("RequiresBSDSockets")]
public void GetString_Many ()
{
Action<HttpListenerContext> context = (HttpListenerContext l) => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void GetByteArray_ServerError ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void DisallowAutoRedirect ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void RequestUriAfterRedirect ()
{
var listener = CreateListener (l => {
}
[Test]
+ [Category ("RequiresBSDSockets")]
/*
* Properties may only be modified before sending the first request.
*/
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) {
InnerList.AddRange (processModules);
}
-#if !NET_2_1
public ProcessModule this[int index] {
get {
return (ProcessModule)InnerList[index];
{
return InnerList.IndexOf (module);
}
-#endif
}
}
InnerList.AddRange (processThreads);
}
-#if !NET_2_1
public ProcessThread this[int index] {
get {
return (ProcessThread)InnerList[index];
{
InnerList.Remove (thread);
}
-#endif
}
}
namespace MonoTests.System.Net.Mail
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class SmtpClientTest
{
SmtpClient smtp;
{
[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 };
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class NetworkStreamTest
{
[Test]
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class SocketAcceptAsyncTest
{
[Test]
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class SocketAsyncTest
{
Socket serverSocket;
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class SocketTest
{
// note: also used in SocketCas tests
/// Tests System.Net.Sockets.TcpClient
/// </summary>
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class TcpClientTest
{
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class TcpListenerTest
{
[Test]
namespace MonoTests.System.Net.Sockets {
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class UdpClientTest {
[Test] // .ctor ()
public void Constructor1 ()
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";
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
\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
{\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
namespace MonoTests.System.Net
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class FileWebRequestTest
{
private string _tempDirectory;
namespace MonoTests.System.Net
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class FtpWebRequestTest
{
FtpWebRequest defaultRequest;
namespace MonoTests.System.Net {
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpListener2Test {
private HttpListener _listener = null;
}
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpListenerBugs {
[Test]
public void TestNonChunkedAsync ()
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void AddOne ()
{
HttpListener listener = new HttpListener ();
}
[Test]
+ [Category ("RequiresBSDSockets")]
public void Duplicate ()
{
HttpListener listener = new HttpListener ();
namespace MonoTests.System.Net
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpListenerRequestTest
{
[Test]
namespace MonoTests.System.Net {
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpListenerTest {
int port;
namespace MonoTests.System.Net
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpWebRequestTest
{
private Random rand = new Random ();
}
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpRequestStreamTest
{
[Test]
namespace MonoTests.System.Net
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpWebResponseTest
{
[Test]
}
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class HttpResponseStreamTest
{
[Test]
namespace MonoTests.System.Net
{
[TestFixture]
+ [Category ("RequiresBSDSockets")]
public class WebClientTest
{
private string _tempFolder;
}\r
[Test] // Covers #41477
+ [Category ("RequiresBSDSockets")]
public void TestReceiveCancelation ()
{
var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
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,
GC.register_ephemeron_array (data);
}
+ ~ConditionalWeakTable ()
+ {
+ }
+
/*LOCKING: _lock must be held*/
void Rehash () {
uint newSize = (uint)HashHelpers.GetPrime ((data.Length << 1) | 1);
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)
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
--- /dev/null
+// 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
--- /dev/null
+// 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";
+ }
+}
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);
}
;
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;
{ "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);
internal static bool AbiMode { get; private set; }
internal static bool FollowForwarders { get; private set; }
+ internal static bool FullAPISet { get; set; }
}
public class Utils {
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));
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));
}
- 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)
</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" />
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) {
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) {
{
struct _WapiHandle_file *file_handle;
gpointer handle;
- int thr_ret, fd;
+ int fd;
const gchar *name;
gboolean ok;
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);
}
done:
- thr_ret = mono_os_mutex_unlock (&stdhandle_mutex);
- g_assert (thr_ret == 0);
+ mono_os_mutex_unlock (&stdhandle_mutex);
return(handle);
}
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;
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;
}
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;
}
_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
_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;
}
#define WINFX_KEY "31bf3856ad364e35"
#define ECMA_KEY "b77a5c561934e089"
#define MSFINAL_KEY "b03f5f7f11d50a3a"
+#define COMPACTFRAMEWORK_KEY "969db8053d3322ac"
typedef struct {
const char *name;
} 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 }
};
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;
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)
{
mono_domain_finalize (MonoDomain *domain, guint32 timeout)
{
DomainFinalizationReq *req;
- guint32 res;
- HANDLE done_event;
MonoInternalThread *thread = mono_thread_internal_current ();
#if defined(__native_client__)
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;
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) {
}
}
- 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 ();
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
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 {
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;
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;
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;
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);
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);
}
/**
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:
{
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
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 */
}
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:
WrapperInfo *info;
char *name;
int t, pos;
+ static MonoMethod *tp_store = NULL;
type = mono_type_get_underlying_type (type);
t = type->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);
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);
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);
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);
if (retire)
retire = FALSE;
+ /* The tpdomain->domain might have unloaded, while this thread was parked */
+ previous_tpdomain = NULL;
+
continue;
}
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
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;
}
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")
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
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)
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);
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:
}
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);
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;
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);
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);
static void
resume_vm (void)
{
- int err;
-
g_assert (is_debugger_thread ());
mono_loader_lock ();
}
/* 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);
static void
resume_thread (MonoInternalThread *thread)
{
- int err;
DebuggerTlsData *tls;
g_assert (is_debugger_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);
suspend_current (void)
{
DebuggerTlsData *tls;
- int err;
g_assert (!is_debugger_thread ());
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;
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.
*/
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 */
mono_simd_intrinsics_init ();
#endif
-#if MONO_SUPPORT_TASKLETS
mono_tasklets_init ();
-#endif
register_trampolines (domain);
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);
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 */
#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))
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
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)
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)
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
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
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
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
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
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
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;
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
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
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) {
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
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
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
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
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;
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;
}
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 (¤t, NULL);
+ resint = gettimeofday (¤t, 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) {
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
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) {
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
/* 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;
}
/* 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) {
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. */
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);
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;
/* 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
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;
}
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
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
mono_w32handle_ref (handle);
- return(mono_os_mutex_lock (&handle_data->signal_mutex));
+ mono_os_mutex_lock (&handle_data->signal_mutex);
+
+ return 0;
}
int
mono_w32handle_unlock_handle (gpointer handle)
{
MonoW32HandleBase *handle_data;
- int ret;
#ifdef DEBUG
g_message ("%s: unlocking handle %p", __func__, 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;
}
/*
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));
{
guint32 handle_idx = 0;
gpointer handle;
- int thr_ret;
g_assert (!shutting_down);
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 */
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 */
{
MonoW32HandleBase *handle_data;
int fd_index, fd_offset;
- int thr_ret;
g_assert (!shutting_down);
/* 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];
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]) {
}
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
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]) {
}
}
- thr_ret = mono_os_mutex_unlock (&scan_mutex);
- g_assert (thr_ret == 0);
+ mono_os_mutex_unlock (&scan_mutex);
if (!found) {
ret = NULL;
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);
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;
{
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]) {
}
}
- thr_ret = mono_os_mutex_unlock (&scan_mutex);
- g_assert (thr_ret == 0);
+ mono_os_mutex_unlock (&scan_mutex);
}
#endif /* !defined(HOST_WIN32) */
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
# 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
--- /dev/null
+#!/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
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
${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
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
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"
}
Targets.Add (new Target {
Platform = TargetPlatform.Android,
Triple = "aarch64-v8a-linux-android",
- Build = "mono-aarch64",
+ Build = XamarinAndroid ? "arm64-v8a" : "mono-aarch64",
Defines = { "TARGET_ARM64" }
});
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))
{ "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 },
};
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: