diff --git a/.gitmodules b/.gitmodules
index f79c408ab4b0..ad2d8352452d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -12,7 +12,7 @@
[submodule "external/mono"]
path = external/mono
url = ../../mono/mono.git
- branch = 2018-04
+ branch = 2018-06
[submodule "external/opentk"]
path = external/opentk
url = ../../mono/opentk.git
diff --git a/Make.config b/Make.config
index 1f68f28743d3..4301b9ea563c 100644
--- a/Make.config
+++ b/Make.config
@@ -47,18 +47,18 @@ XCODE94_URL=http://xamarin-storage/bot-provisioning/xcodes/Xcode_9.4.xip
XCODE94_DEVELOPER_ROOT=/Applications/Xcode94.app/Contents/Developer
# Minimum Mono version
-MIN_MONO_VERSION=5.14.0.136
-MAX_MONO_VERSION=5.14.99
-MIN_MONO_URL=https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2018-04/111/07c8f25fe536dbb7e244f965aa3f9a871f41e953/MonoFramework-MDK-5.14.0.136.macos10.xamarin.universal.pkg
+MIN_MONO_VERSION=5.16.0.5
+MAX_MONO_VERSION=5.16.99
+MIN_MONO_URL=https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2018-06/7/7627a5f9eeba0fd846731ad0c498556f55be1a34/MonoFramework-MDK-5.16.0.5.macos10.xamarin.universal.pkg
# Minimum Mono version for Xamarin.Mac apps using the system mono
MIN_XM_MONO_VERSION=5.14.0.136
MIN_XM_MONO_URL=https://xamjenkinsartifact.azureedge.net/build-package-osx-mono/2018-04/111/07c8f25fe536dbb7e244f965aa3f9a871f41e953/MonoFramework-MDK-5.14.0.136.macos10.xamarin.universal.pkg
# Minimum Visual Studio version
-MIN_VISUAL_STUDIO_URL=https://download.visualstudio.microsoft.com/download/pr/11550896/783d2219a348f93b6988fb415951788a/VisualStudioForMac-Preview-7.4.0.985.dmg
-MIN_VISUAL_STUDIO_VERSION=7.4.0.985
-MAX_VISUAL_STUDIO_VERSION=7.7.99
+MIN_VISUAL_STUDIO_URL=https://bosstoragemirror.azureedge.net/vsmac/7a/7aff2dc1f28d711d11d63d79b2a4c49cda217189/VisualStudioForMac-Preview-7.7.0.1470.dmg
+MIN_VISUAL_STUDIO_VERSION=7.7.0.1470
+MAX_VISUAL_STUDIO_VERSION=7.8.99
# Minimum CMake version
MIN_CMAKE_URL=https://cmake.org/files/v3.6/cmake-3.6.2-Darwin-x86_64.dmg
diff --git a/builds/Makefile b/builds/Makefile
index 3e7259669640..7e6d01fefd0a 100644
--- a/builds/Makefile
+++ b/builds/Makefile
@@ -90,10 +90,10 @@ CCACHE_CXXFLAGS=-Qunused-arguments
# Configuration for the mono sdk makefiles
#
SDK_CONFIG=$(MONO_PATH)/sdks/Make.config
-SDK_ARGS=XCODE_DIR=$(XCODE_DEVELOPER_ROOT) IOS_VERSION=$(IOS_SDK_VERSION) IOS_VERSION_MIN=$(MIN_IOS_SDK_VERSION) TVOS_VERSION=$(TVOS_SDK_VERSION) TVOS_VERSION_MIN=$(MIN_TVOS_SDK_VERSION) WATCHOS_VERSION=$(WATCH_SDK_VERSION) WATCHOS_VERSION_MIN=$(MIN_WATCHOS_SDK_VERSION)
+SDK_ARGS=XCODE_DIR=$(XCODE_DEVELOPER_ROOT) IOS_VERSION=$(IOS_SDK_VERSION) IOS_VERSION_MIN=$(MIN_IOS_SDK_VERSION) TVOS_VERSION=$(TVOS_SDK_VERSION) TVOS_VERSION_MIN=$(MIN_TVOS_SDK_VERSION) WATCHOS_VERSION=$(WATCH_SDK_VERSION) WATCHOS_VERSION_MIN=$(MIN_WATCHOS_SDK_VERSION) IGNORE_PROVISION_LLVM=1
-ifdef IGNORE_PACKAGE_LLVM
-SDK_ARGS += IGNORE_PACKAGE_LLVM=1
+ifdef DISABLE_DOWNLOAD_LLVM
+SDK_ARGS += DISABLE_DOWNLOAD_LLVM=1
endif
SDK_BUILDDIR = $(MONO_PATH)/sdks/builds
@@ -199,6 +199,7 @@ MAC_BCL_TARGETS = \
MAC_TARGETS = \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-profiler-log.a \
+ $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-system-native.a \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-2.0.dylib \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/libmono-2.0.a \
$(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)/lib/pkgconfig/mono-2.pc \
@@ -315,6 +316,7 @@ endef
$(eval $(call lipo_template_static,libmono-profiler-log.a,mono/profiler))
$(eval $(call lipo_template_static,libmonosgen-2.0.a,mono/mini))
+$(eval $(call lipo_template_static,libmono-system-native.a,mono/metadata))
$(eval $(call lipo_template_dynamic,libmonosgen-2.0.dylib,mono/mini))
$(eval $(call lipo_template_dynamic,libMonoPosixHelper.dylib,support))
@@ -1500,11 +1502,11 @@ build-llvm32: .stamp-build-llvm
build-llvm64: .stamp-build-llvm
.stamp-build-llvm: $(SDK_CONFIG)
- $(MAKE) -C $(SDK_BUILDDIR) build-ios-llvm $(SDK_ARGS)
+ $(MAKE) -C $(SDK_BUILDDIR) provision-llvm36-llvm32 provision-llvm-llvm64 $(SDK_ARGS)
$(Q) touch $@
clean-llvm: $(SDK_CONFIG)
- $(MAKE) -C $(SDK_BUILDDIR) clean-ios-llvm $(SDK_ARGS)
+ $(MAKE) -C $(SDK_BUILDDIR) clean-llvm36-llvm32 clean-llvm-llvm64 $(SDK_ARGS)
$(RM) .stamp-*-llvm*
.PHONY: install-llvm64 llvm llvm64
@@ -1514,13 +1516,21 @@ install-llvm: install-llvm32 install-llvm64
LLVM_TARGETS = \
$(PREFIX)/LLVM/bin/opt \
$(PREFIX)/LLVM/bin/llc \
+ $(PREFIX)/LLVM36/bin/opt \
+ $(PREFIX)/LLVM36/bin/llc
-$(PREFIX)/LLVM/bin/%: $(SDK_DESTDIR)/ios-llvm64/bin/% | $(PREFIX)/LLVM/bin
+$(PREFIX)/LLVM/bin/%: $(SDK_DESTDIR)/llvm-llvm64/bin/% | $(PREFIX)/LLVM/bin
+ $(call Q_2,INSTALL ,[LLVM64]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@
+
+$(PREFIX)/LLVM36/bin/%: $(SDK_DESTDIR)/llvm36-llvm32/bin/% | $(PREFIX)/LLVM36/bin
$(call Q_2,INSTALL ,[LLVM64]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@
$(PREFIX)/LLVM/bin:
$(Q) mkdir -p $@
+$(PREFIX)/LLVM36/bin:
+ $(Q) mkdir -p $@
+
install-llvm32:.stamp-build-llvm $(LLVM_TARGETS)
install-llvm64: .stamp-build-llvm $(LLVM_TARGETS)
diff --git a/configure b/configure
index a5a53a72e602..611226256305 100755
--- a/configure
+++ b/configure
@@ -85,7 +85,7 @@ while test x$1 != x; do
shift
;;
--disable-packaged-llvm)
- echo "IGNORE_PACKAGE_LLVM=1" >> $CONFIGURED_FILE
+ echo "DISABLE_DOWNLOAD_LLVM=1" >> $CONFIGURED_FILE
shift
;;
--help|-h)
diff --git a/external/mono b/external/mono
index 46ff31252daa..1b18f39e46ea 160000
--- a/external/mono
+++ b/external/mono
@@ -1 +1 @@
-Subproject commit 46ff31252daa7e594600ad39fac195d971ee27d1
+Subproject commit 1b18f39e46eac0c38438bc8cfdaef8a4bc8afc18
diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs
index c0f80b2c5524..40db30af347f 100644
--- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs
+++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs
@@ -390,12 +390,15 @@ public override bool Execute ()
int line = 0, column = 0;
int index, endIndex;
- if ((index = ex.Message.IndexOf ("At line ", StringComparison.Ordinal)) != -1) {
+ var message = ex.Message;
+ if (message.EndsWith (".", StringComparison.Ordinal))
+ message = message.Substring (0, message.Length - 1);
+ if ((index = message.IndexOf ("At line ", StringComparison.Ordinal)) != -1) {
index += "At line ".Length;
- if ((endIndex = ex.Message.IndexOf (", column ", index, StringComparison.Ordinal)) != -1) {
- var columnBuf = ex.Message.Substring (endIndex + ", column ".Length);
- var lineBuf = ex.Message.Substring (index, endIndex - index);
+ if ((endIndex = message.IndexOf (", column ", index, StringComparison.Ordinal)) != -1) {
+ var columnBuf = message.Substring (endIndex + ", column ".Length);
+ var lineBuf = message.Substring (index, endIndex - index);
int.TryParse (columnBuf, out column);
int.TryParse (lineBuf, out line);
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
index c0159bc5bc34..7d58d6e37591 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
@@ -106,8 +106,7 @@ public GccOptions ()
[Required]
public bool EnableSGenConc { get; set; }
- [Required]
- public bool UseInterpreter { get; set; }
+ public string Interpreter { get; set; }
[Required]
public bool LinkerDumpDependencies { get; set; }
@@ -405,8 +404,8 @@ protected override string GenerateCommandLineCommands ()
if (EnableSGenConc)
args.AddLine ("--sgen-conc");
- if (UseInterpreter)
- args.Add ("--interpreter");
+ if (!string.IsNullOrEmpty (Interpreter))
+ args.Add ($"--interpreter={Interpreter}");
switch (LinkMode.ToLowerInvariant ()) {
case "sdkonly": args.AddLine ("--linksdkonly"); break;
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.TVOS-FrameworkList.xml.in b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.TVOS-FrameworkList.xml.in
index 6028d69d6556..2d579a291a41 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.TVOS-FrameworkList.xml.in
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.TVOS-FrameworkList.xml.in
@@ -1,2 +1,5 @@
-
+
+
+
+
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS-FrameworkList.xml.in b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS-FrameworkList.xml.in
index 2e7e853b8398..2936eefda152 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS-FrameworkList.xml.in
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.WatchOS-FrameworkList.xml.in
@@ -1,2 +1,5 @@
-
+
+
+
+
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS-FrameworkList.xml.in b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS-FrameworkList.xml.in
index b5b1541c468b..00ca97959d49 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS-FrameworkList.xml.in
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS-FrameworkList.xml.in
@@ -1,2 +1,5 @@
-
+
+
+
+
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.props b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.props
index de1f2acdf112..a29b7e7a18e5 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.props
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.props
@@ -51,7 +51,6 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
False
$(MSBuildProjectDirectory)
False
- False
2
true
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
index e58390bdcc6a..28407847a1ad 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
@@ -831,7 +831,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
UseThumb="$(MtouchUseThumb)"
EnableBitcode="$(MtouchEnableBitcode)"
EnableSGenConc="$(MtouchEnableSGenConc)"
- UseInterpreter="$(MtouchUseInterpreter)"
+ Interpreter="$(MtouchInterpreter)"
AppExtensionReferences="@(_ResolvedAppExtensionReferences)"
ArchiveSymbols="$(MonoSymbolArchive)"
Verbosity="$(MtouchVerbosity)"
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs
index 4d3cecea167d..2feaea790b00 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/Bug60536.cs
@@ -71,7 +71,7 @@ public void TestACToolTaskCatchesJsonException ()
Assert.AreEqual (2, Engine.Logger.ErrorEvents[0].ColumnNumber, "ColumnNumber");
Assert.AreEqual (197, Engine.Logger.ErrorEvents[0].EndLineNumber, "EndLineNumber");
Assert.AreEqual (2, Engine.Logger.ErrorEvents[0].EndColumnNumber, "EndColumnNumber");
- Assert.AreEqual ("Unexpected character ']'. At line 197, column 2", Engine.Logger.ErrorEvents[0].Message, "Message");
+ Assert.AreEqual ("Unexpected character ']'. At line 197, column 2.", Engine.Logger.ErrorEvents[0].Message, "Message");
}
}
}
diff --git a/runtime/exports.t4 b/runtime/exports.t4
index d145a311b82a..17a89b57f63d 100644
--- a/runtime/exports.t4
+++ b/runtime/exports.t4
@@ -537,10 +537,6 @@
"char**", "argv"
),
- new Export ("void", "mono_jit_set_aot_only",
- "mono_bool", "aot_only"
- ),
-
new Export ("void", "mono_jit_set_aot_mode",
"MonoAotMode", "mode"
),
diff --git a/runtime/monotouch-main.m b/runtime/monotouch-main.m
index 555181123696..76c068529ac2 100644
--- a/runtime/monotouch-main.m
+++ b/runtime/monotouch-main.m
@@ -393,7 +393,6 @@ - (void) memoryWarning: (NSNotification *) sender
#if defined (__arm__) || defined(__aarch64__)
xamarin_register_modules ();
- mono_jit_set_aot_only (TRUE);
#endif
DEBUG_LAUNCH_TIME_PRINT ("\tAOT register time");
diff --git a/src/Compression/Compression.cs b/src/Compression/Compression.cs
index 0631c34fb4a4..52f307bb35f2 100644
--- a/src/Compression/Compression.cs
+++ b/src/Compression/Compression.cs
@@ -558,14 +558,14 @@ public override Task WriteAsync (byte[] array, int offset, int count, Cancellati
return WriteAsyncMemory (new ReadOnlyMemory (array, offset, count), cancellationToken);
}
- public override Task WriteAsync (ReadOnlyMemory source, CancellationToken cancellationToken)
+ public override ValueTask WriteAsync (ReadOnlyMemory source, CancellationToken cancellationToken)
{
if (GetType () != typeof (CompressionStream)) {
// Ensure that existing streams derived from DeflateStream and that override WriteAsync(byte[],...)
// get their existing behaviors when the newer Memory-based overload is used.
return base.WriteAsync (source, cancellationToken);
} else {
- return WriteAsyncMemory (source, cancellationToken);
+ return new ValueTask(WriteAsyncMemory (source, cancellationToken));
}
}
@@ -576,7 +576,7 @@ internal Task WriteAsyncMemory (ReadOnlyMemory source, CancellationToken c
EnsureNotDisposed ();
return cancellationToken.IsCancellationRequested ?
- Task.FromCanceled (cancellationToken) :
+ Task.FromCanceled(cancellationToken) :
WriteAsyncMemoryCore (source, cancellationToken);
}
diff --git a/src/Compression/Deflater.cs b/src/Compression/Deflater.cs
index ee6e327327f7..081eecf28adf 100644
--- a/src/Compression/Deflater.cs
+++ b/src/Compression/Deflater.cs
@@ -63,7 +63,7 @@ internal unsafe void SetInput (ReadOnlyMemory inputBuffer)
{
if (!NeedsInput ())
throw new InvalidOperationException ("We have something left in previous input!");
- if (_inputBufferHandle.HasPointer)
+ if (_inputBufferHandle.Pointer != null)
throw new InvalidOperationException ("Unexpected input buffer handler found.");
if (0 == inputBuffer.Length) {
@@ -71,7 +71,7 @@ internal unsafe void SetInput (ReadOnlyMemory inputBuffer)
}
lock (SyncLock) {
- _inputBufferHandle = inputBuffer.Retain (pin: true);
+ _inputBufferHandle = inputBuffer.Pin ();
_compression_struct.Source = (IntPtr)_inputBufferHandle.Pointer;
_compression_struct.SourceSize = inputBuffer.Length;
@@ -84,7 +84,7 @@ internal unsafe void SetInput (byte* inputBufferPtr, int count)
throw new InvalidOperationException ("We have something left in previous input!");
if (inputBufferPtr == null)
throw new ArgumentNullException ( nameof (inputBufferPtr));
- if (_inputBufferHandle.HasPointer)
+ if (_inputBufferHandle.Pointer != null)
throw new InvalidOperationException ("Unexpected input buffer handler found.");
if (count == 0) {
@@ -155,7 +155,7 @@ internal bool Finish (byte[] outputBuffer, out int bytesRead)
///
/// Returns true if there was something to flush. Otherwise False.
///
- internal bool Flush (byte[] outputBuffer, out int bytesRead)
+ internal unsafe bool Flush (byte[] outputBuffer, out int bytesRead)
{
if (outputBuffer == null)
throw new ArgumentNullException (nameof (outputBuffer));
@@ -163,7 +163,7 @@ internal bool Flush (byte[] outputBuffer, out int bytesRead)
throw new ArgumentException ("Can't pass in an empty output buffer!");
if (!NeedsInput ())
throw new InvalidOperationException ("We have something left in previous input!");
- if (_inputBufferHandle.HasPointer)
+ if (_inputBufferHandle.Pointer != null)
throw new InvalidOperationException ("InputHandler should not be set");
// Note: we require that NeedsInput() == true, i.e. that 0 == _zlibStream.AvailIn.
diff --git a/tests/common/BundlerTool.cs b/tests/common/BundlerTool.cs
index 498c95d6076e..65fba9979882 100644
--- a/tests/common/BundlerTool.cs
+++ b/tests/common/BundlerTool.cs
@@ -74,6 +74,7 @@ abstract class BundlerTool : Tool
public int Verbosity;
public int [] WarnAsError; // null array: nothing passed to mtouch/mmp. empty array: pass --warnaserror (which means makes all warnings errors).
public string [] XmlDefinitions;
+ public string Interpreter;
// These are a bit smarter
public bool NoPlatformAssemblyReference;
@@ -291,7 +292,12 @@ protected virtual void BuildArguments (StringBuilder sb)
sb.Append (" --xml:").Append (StringUtils.Quote (xd));
}
-
+ if (Interpreter != null) {
+ if (Interpreter.Length == 0)
+ sb.Append (" --interpreter");
+ else
+ sb.Append (" --interpreter=").Append (Interpreter);
+ }
}
public string CreateTemporaryDirectory ()
diff --git a/tests/linker/ios/link all/LinkAllTest.cs b/tests/linker/ios/link all/LinkAllTest.cs
index 95c677ca8813..6369fa62b861 100644
--- a/tests/linker/ios/link all/LinkAllTest.cs
+++ b/tests/linker/ios/link all/LinkAllTest.cs
@@ -270,7 +270,7 @@ string FindAssemblyPath ()
public void Assembly_LoadFile ()
{
string filename = FindAssemblyPath ();
- Assert.NotNull (Assembly.LoadFile (filename), "1");
+ Assert.NotNull (Assembly.LoadFile (Path.GetFullPath (filename)), "1");
}
[Test]
diff --git a/tests/mmptest/src/LinkerTests.cs b/tests/mmptest/src/LinkerTests.cs
index 85e9a1b4dbef..6f018289372e 100644
--- a/tests/mmptest/src/LinkerTests.cs
+++ b/tests/mmptest/src/LinkerTests.cs
@@ -86,19 +86,23 @@ public void DynamicSymbolMode (string mode)
CSProjConfig = $"--dynamic-symbol-mode={mode}\n",
};
var output = TI.TestUnifiedExecutable (config);
+ string build_output;
switch (mode) {
case "linker":
case "default":
- Assert.That (output.BuildOutput, Does.Contain ("-u "), "reference.m");
- Assert.That (output.BuildOutput, Does.Not.Contain ("reference.m"), "reference.m");
+ build_output = output.BuildOutput;
+ Assert.That (build_output, Does.Contain ("-u "), "reference.m");
+ Assert.That (build_output, Does.Not.Contain ("reference.m"), "reference.m");
break;
case "code":
- Assert.That (output.BuildOutput, Does.Not.Contain ("-u "), "reference.m");
- Assert.That (output.BuildOutput, Does.Contain ("reference.m"), "reference.m");
+ build_output = output.BuildOutput.Replace ("-u _SystemNative_RealPath", String.Empty);
+ Assert.That (build_output, Does.Not.Contain ("-u "), "reference.m");
+ Assert.That (build_output, Does.Contain ("reference.m"), "reference.m");
break;
case "ignore":
- Assert.That (output.BuildOutput, Does.Not.Contain ("-u "), "reference.m");
- Assert.That (output.BuildOutput, Does.Not.Contain ("reference.m"), "reference.m");
+ build_output = output.BuildOutput.Replace ("-u _SystemNative_RealPath", String.Empty);
+ Assert.That (build_output, Does.Not.Contain ("-u "), "reference.m");
+ Assert.That (build_output, Does.Not.Contain ("reference.m"), "reference.m");
break;
default:
throw new NotImplementedException ();
diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs
index ffb93970ef5e..1421d526c503 100644
--- a/tests/mtouch/MTouch.cs
+++ b/tests/mtouch/MTouch.cs
@@ -1783,10 +1783,32 @@ public class B
mtouch.Linker = MTouchLinker.DontLink;
File.Delete (dllPath);
mtouch.AlwaysShowOutput = true;
- mtouch.AssertExecute (MTouchAction.BuildSim, "build");
+ mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
+ mtouch.AssertWarningPattern (136, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' referenced from '.*/testApp.exe'.");
mtouch.AssertWarning (137, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', referenced by a MyCustomAttribute attribute in 'testApp.exe'.");
mtouch.AssertWarning (137, "Cannot find the assembly 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null', referenced by a System.Diagnostics.DebuggerTypeProxyAttribute attribute in 'testApp.exe'.");
- mtouch.AssertWarningCount (2);
+ mtouch.AssertWarningCount (3);
+ mtouch.AssertError (2002, "Failed to resolve assembly: 'A, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'");
+ mtouch.AssertErrorCount (1);
+ }
+ }
+
+ [Test]
+ public void MT0138 ()
+ {
+ using (var mtouch = new MTouchTool ()) {
+ var tmpdir = mtouch.CreateTemporaryDirectory ();
+ mtouch.CreateTemporaryCacheDirectory ();
+
+ mtouch.CreateTemporaryApp ();
+ mtouch.WarnAsError = new int [] { 138 }; // This is just to make mtouch bail out early instead of spending time building the app when that's not what we're interested in.
+ mtouch.Interpreter = "all,-all,foo,-bar,mscorlib.dll,mscorlib";
+ mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
+ mtouch.AssertError (138, "Cannot find the assembly 'foo', passed as an argument to --interpreter.");
+ mtouch.AssertError (138, "Cannot find the assembly 'bar', passed as an argument to --interpreter.");
+ mtouch.AssertError (138, "Cannot find the assembly 'mscorlib.dll', passed as an argument to --interpreter.");
+ // just the name, without the extension, is the right way.
+ mtouch.AssertErrorCount (3);
}
}
diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs
index 2ecda60f5097..61a05dc08fde 100644
--- a/tests/xharness/Jenkins.cs
+++ b/tests/xharness/Jenkins.cs
@@ -184,12 +184,15 @@ IEnumerable GetTestData (RunTestTask test)
yield return new TestData { Variation = "Release (all optimizations)", MTouchExtraArgs = "--registrar:static --optimize:all", Debug = false, Profiling = false, Defines = "OPTIMIZEALL" };
yield return new TestData { Variation = "Debug (all optimizations)", MTouchExtraArgs = "--registrar:static --optimize:all", Debug = true, Profiling = false, Defines = "OPTIMIZEALL" };
yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Ignored = true, };
+ yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Ignored = true, };
break;
case "mscorlib":
yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Ignored = true, Undefines = "FULL_AOT_RUNTIME" };
+ yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Ignored = true, Undefines = "FULL_AOT_RUNTIME" };
break;
case "mini":
yield return new TestData { Variation = "Debug (interpreter)", MTouchExtraArgs = "--interpreter", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" };
+ yield return new TestData { Variation = "Debug (interpreter -mscorlib)", MTouchExtraArgs = "--interpreter=-mscorlib", Debug = true, Profiling = false, Undefines = "FULL_AOT_RUNTIME" };
break;
}
break;
diff --git a/tools/common/Application.cs b/tools/common/Application.cs
index 6253ab87f901..3450ce8dc11e 100644
--- a/tools/common/Application.cs
+++ b/tools/common/Application.cs
@@ -63,7 +63,6 @@ public partial class Application
public bool? EnableCoopGC;
public bool EnableSGenConc;
- public bool UseInterpreter;
public MarshalObjectiveCExceptionMode MarshalObjectiveCExceptions;
public MarshalManagedExceptionMode MarshalManagedExceptions;
diff --git a/tools/linker/MobileProfile.cs b/tools/linker/MobileProfile.cs
index d16616930a94..4e4de790b1df 100644
--- a/tools/linker/MobileProfile.cs
+++ b/tools/linker/MobileProfile.cs
@@ -48,6 +48,7 @@ public abstract class MobileProfile : BaseProfile {
"Microsoft.Win32.Registry.AccessControl",
"Microsoft.Win32.Registry",
"System.AppContext",
+ "System.Buffers",
"System.Collections.Concurrent",
"System.Collections.NonGeneric",
"System.Collections.Specialized",
@@ -172,6 +173,7 @@ public abstract class MobileProfile : BaseProfile {
"System.Threading.Overlapped",
"System.Threading.Tasks.Parallel",
"System.Threading.Tasks",
+ "System.Threading.Tasks.Extensions",
"System.Threading.Thread",
"System.Threading.ThreadPool",
"System.Threading.Timer",
diff --git a/tools/mmp/driver.cs b/tools/mmp/driver.cs
index bd7f82759679..f5b54509183e 100644
--- a/tools/mmp/driver.cs
+++ b/tools/mmp/driver.cs
@@ -1,4 +1,3 @@
-
/*
* Copyright 2011-2014 Xamarin Inc. All rights reserved.
* Copyright 2010 Novell Inc.
@@ -1358,6 +1357,10 @@ static int Compile ()
args.Append (StringUtils.Quote (lib)).Append (' ');
+ var libsystem_native_path = Path.Combine (libdir, "libmono-system-native.a");
+ args.Append (StringUtils.Quote (libsystem_native_path)).Append (' ');
+ args.Append ("-u ").Append ("_SystemNative_RealPath").Append (' '); // This keeps libmono_system_native_la-pal_io.o symbols
+
if (profiling.HasValue && profiling.Value) {
args.Append (StringUtils.Quote (Path.Combine (libdir, "libmono-profiler-log.a"))).Append (' ');
args.Append ("-u _mono_profiler_init_log -lz ");
diff --git a/tools/mtouch/Application.cs b/tools/mtouch/Application.cs
index 48106ab5b4cf..413fb0354423 100644
--- a/tools/mtouch/Application.cs
+++ b/tools/mtouch/Application.cs
@@ -116,6 +116,8 @@ public bool EnableMSym {
public string AotOtherArguments = string.Empty;
public bool? LLVMAsmWriter;
public Dictionary LLVMOptimizations = new Dictionary ();
+ public bool UseInterpreter;
+ public List InterpretedAssemblies = new List ();
public Dictionary EnvironmentVariables = new Dictionary ();
@@ -129,6 +131,44 @@ public bool EnableMSym {
public bool? BuildDSym;
+ public bool IsInterpreted (string assembly)
+ {
+ // IsAOTCompiled and IsInterpreted are not opposites: mscorlib.dll can be both.
+ if (!UseInterpreter)
+ return false;
+
+ // Go through the list of assemblies to interpret in reverse order,
+ // so that the last option passed to mtouch takes precedence.
+ for (int i = InterpretedAssemblies.Count - 1; i >= 0; i--) {
+ var opt = InterpretedAssemblies [i];
+ if (opt == "all")
+ return true;
+ else if (opt == "-all")
+ return false;
+ else if (opt == assembly)
+ return true;
+ else if (opt [0] == '-' && opt.Substring (1) == assembly)
+ return false;
+ }
+
+ // There's an implicit 'all' at the start of the list.
+ return true;
+ }
+
+ public bool IsAOTCompiled (string assembly)
+ {
+ if (!UseInterpreter)
+ return true;
+
+ // IsAOTCompiled and IsInterpreted are not opposites: mscorlib.dll can be both:
+ // - mscorlib will always be processed by the AOT compiler to generate required wrapper functions for the interpreter to work
+ // - mscorlib might also be fully AOT-compiled (both when the interpreter is enabled and when it's not)
+ if (assembly == "mscorlib")
+ return true;
+
+ return !IsInterpreted (assembly);
+ }
+
// If we're targetting a 32 bit arch.
bool? is32bits;
public bool Is32Build {
@@ -462,7 +502,7 @@ public bool UseDlsym (string assembly)
if (EnableLLVMOnlyBitCode)
return false;
- if (UseInterpreter)
+ if (IsInterpreted (Assembly.GetIdentity (assembly)))
return true;
switch (Platform) {
@@ -2119,7 +2159,20 @@ public void StripNativeCode ()
public void BundleAssemblies ()
{
- var strip = !UseInterpreter && ManagedStrip && IsDeviceBuild && !EnableDebug && !PackageManagedDebugSymbols;
+ Assembly.StripAssembly strip = ((path) =>
+ {
+ if (!ManagedStrip)
+ return false;
+ if (!IsDeviceBuild)
+ return false;
+ if (EnableDebug)
+ return false;
+ if (PackageManagedDebugSymbols)
+ return false;
+ if (IsInterpreted (Assembly.GetIdentity (path)))
+ return false;
+ return true;
+ });
var grouped = Targets.SelectMany ((Target t) => t.Assemblies).GroupBy ((Assembly asm) => asm.Identity);
foreach (var @group in grouped) {
diff --git a/tools/mtouch/Assembly.cs b/tools/mtouch/Assembly.cs
index e7618983ada0..ac37322c80c3 100644
--- a/tools/mtouch/Assembly.cs
+++ b/tools/mtouch/Assembly.cs
@@ -54,11 +54,7 @@ public HashSet DependencyMap {
public bool IsAOTCompiled {
get {
- if (App.UseInterpreter)
- /* interpreter only requires a few stubs that are attached
- * to mscorlib.dll, other assemblies won't be AOT compiled */
- return FileName == "mscorlib.dll";
- return true;
+ return App.IsAOTCompiled (Identity);
}
}
@@ -108,15 +104,18 @@ public void ComputeDependencyMap (List exceptions)
ComputeDependencies (exceptions);
}
+ public delegate bool StripAssembly (string path);
+
// returns false if the assembly was not copied (because it was already up-to-date).
- public bool CopyAssembly (string source, string target, bool copy_debug_symbols = true, bool strip = false)
+ public bool CopyAssembly (string source, string target, bool copy_debug_symbols = true, StripAssembly strip = null)
{
var copied = false;
try {
- if (!Application.IsUptodate (source, target) && (strip || !Cache.CompareAssemblies (source, target))) {
+ var strip_assembly = strip != null && strip (source);
+ if (!Application.IsUptodate (source, target) && (strip_assembly || !Cache.CompareAssemblies (source, target))) {
copied = true;
- if (strip) {
+ if (strip_assembly) {
Driver.FileDelete (target);
Directory.CreateDirectory (Path.GetDirectoryName (target));
MonoTouch.Tuner.Stripper.Process (source, target);
@@ -195,7 +194,7 @@ public void CopyConfigToDirectory (string directory)
// Aot data is copied separately, because we might want to copy aot data
// even if we don't want to copy the assembly (if 32/64-bit assemblies are identical,
// only one is copied, but we still want the aotdata for both).
- public void CopyToDirectory (string directory, bool reload = true, bool check_case = false, bool only_copy = false, bool copy_debug_symbols = true, bool strip = false)
+ public void CopyToDirectory (string directory, bool reload = true, bool check_case = false, bool only_copy = false, bool copy_debug_symbols = true, StripAssembly strip = null)
{
var target = Path.Combine (directory, FileName);
diff --git a/tools/mtouch/Target.cs b/tools/mtouch/Target.cs
index 28b1aef8d77a..b75576201a23 100644
--- a/tools/mtouch/Target.cs
+++ b/tools/mtouch/Target.cs
@@ -283,6 +283,29 @@ public void Initialize (bool show_warnings)
}
linker_flags = new CompilerFlags (this);
+
+ // Verify that there are no entries in our list of intepreted assemblies that doesn't match
+ // any of the assemblies we know about.
+ if (App.UseInterpreter) {
+ var exceptions = new List ();
+ foreach (var entry in App.InterpretedAssemblies) {
+ var assembly = entry;
+ if (string.IsNullOrEmpty (assembly))
+ continue;
+
+ if (assembly [0] == '-')
+ assembly = assembly.Substring (1);
+
+ if (assembly == "all")
+ continue;
+
+ if (Assemblies.ContainsKey (assembly))
+ continue;
+
+ exceptions.Add (ErrorHelper.CreateWarning (138, $"Cannot find the assembly '{assembly}', passed as an argument to --interpreter."));
+ }
+ ErrorHelper.ThrowIfErrors (exceptions);
+ }
}
// This is to load the symbols for all assemblies, so that we can give better error messages
@@ -1135,6 +1158,8 @@ void AOTCompile ()
}
if (App.UseInterpreter)
+ /* TODO: not sure? we might have to continue here, depending on
+ * the set of assemblies are AOT'd? */
return;
// Code in one assembly (either in a P/Invoke or a third-party library) can depend on a third-party library in another assembly.
diff --git a/tools/mtouch/mtouch.cs b/tools/mtouch/mtouch.cs
index b3be565e3948..12790a34dbb8 100644
--- a/tools/mtouch/mtouch.cs
+++ b/tools/mtouch/mtouch.cs
@@ -456,7 +456,9 @@ public static string GetAotArguments (Application app, string filename, Abi abi,
bool enable_debug = app.EnableDebug;
bool enable_debug_symbols = app.PackageManagedDebugSymbols;
bool llvm_only = app.EnableLLVMOnlyBitCode;
- bool interp = app.UseInterpreter;
+ bool interp = app.IsInterpreted (Assembly.GetIdentity (filename));
+ bool interp_full = !interp && app.UseInterpreter && fname == "mscorlib.dll";
+ bool is32bit = (abi & Abi.Arch32Mask) > 0;
string arch = abi.AsArchString ();
args.Append ("--debug ");
@@ -474,9 +476,15 @@ public static string GetAotArguments (Application app, string filename, Abi abi,
args.Append (app.AotArguments);
if (llvm_only)
args.Append ("llvmonly,");
- else if (interp)
+ else if (interp) {
+ if (fname != "mscorlib.dll")
+ throw ErrorHelper.CreateError (99, $"Internal error: can only enable the interpreter for mscorlib.dll when AOT-compiling assemblies (tried to interpret {fname}). Please file an issue at https://github.com/xamarin/xamarin-macios/issues/new.");
args.Append ("interp,");
- else
+ } else if (interp_full) {
+ if (fname != "mscorlib.dll")
+ throw ErrorHelper.CreateError (99, $"Internal error: can only enable the interpreter for mscorlib.dll when AOT-compiling assemblies (tried to interpret {fname}). Please file an issue at https://github.com/xamarin/xamarin-macios/issues/new.");
+ args.Append ("interp,full,");
+ } else
args.Append ("full,");
var aname = Path.GetFileNameWithoutExtension (fname);
@@ -504,7 +512,7 @@ public static string GetAotArguments (Application app, string filename, Abi abi,
}
if (enable_llvm)
- args.Append ("llvm-path=").Append (MonoTouchDirectory).Append ("/LLVM/bin/,");
+ args.Append ("llvm-path=").Append (MonoTouchDirectory).Append (is32bit ? "/LLVM36/bin/," : "/LLVM/bin/,");
if (!llvm_only)
args.Append ("outfile=").Append (StringUtils.Quote (outputFile));
@@ -664,7 +672,8 @@ public static string GenerateMain (Application app, IEnumerable assemb
sw.WriteLine ("\tmono_sgen_mono_ilgen_init ();");
sw.WriteLine ("\tmono_ee_interp_init (NULL);");
sw.WriteLine ("\tmono_jit_set_aot_mode (MONO_AOT_MODE_INTERP);");
- }
+ } else if (app.IsDeviceBuild)
+ sw.WriteLine ("\tmono_jit_set_aot_mode (MONO_AOT_MODE_FULL);");
if (assembly_location.Length > 0)
sw.WriteLine ("\txamarin_set_assembly_directories (&assembly_locations);");
@@ -1246,7 +1255,14 @@ static Application ParseArguments (string [] args, out Action a)
app.LLVMOptimizations [asm] = opt;
}
},
- { "interpreter", "Enable the *experimental* interpreter.", v => { app.UseInterpreter = true; }},
+ { "interpreter:", "Enable the *experimental* interpreter. Optionally takes a comma-separated list of assemblies to interpret (if prefixed with a minus sign, the assembly will be AOT-compiled instead). 'all' can be used to specify all assemblies. This argument can be specified multiple times.", v =>
+ {
+ app.UseInterpreter = true;
+ if (!string.IsNullOrEmpty (v)) {
+ app.InterpretedAssemblies.AddRange (v.Split (new char [] { ',' }, StringSplitOptions.RemoveEmptyEntries));
+ }
+ }
+ },
{ "http-message-handler=", "Specify the default HTTP message handler for HttpClient", v => { http_message_handler = v; }},
{ "output-format=", "Specify the output format for some commands. Possible values: Default, XML", v =>
{