Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/mono-2018-06' into mono-2018-08
Browse files Browse the repository at this point in the history
  • Loading branch information
BrzVlad committed Aug 21, 2018
2 parents 204e5fc + 3901d8e commit 8076525
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 29 deletions.
10 changes: 10 additions & 0 deletions builds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -314,6 +315,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))

Expand Down Expand Up @@ -1510,13 +1512,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
$(call Q_2,INSTALL ,[LLVM64]) install -c -m 0755 $(INSTALL_STRIP_FLAG) $^ $@

$(PREFIX)/LLVM36/bin/%: $(SDK_DESTDIR)/ios-llvm36-32/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)

Expand Down
11 changes: 7 additions & 4 deletions msbuild/Xamarin.MacDev.Tasks.Core/Tasks/ACToolTaskBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
4 changes: 0 additions & 4 deletions runtime/exports.t4
Original file line number Diff line number Diff line change
Expand Up @@ -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"
),
Expand Down
1 change: 0 additions & 1 deletion runtime/monotouch-main.m
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
6 changes: 3 additions & 3 deletions src/Compression/Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,14 @@ public override Task WriteAsync (byte[] array, int offset, int count, Cancellati
return WriteAsyncMemory (new ReadOnlyMemory<byte> (array, offset, count), cancellationToken);
}

public override Task WriteAsync (ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
public override ValueTask WriteAsync (ReadOnlyMemory<byte> 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));
}
}

Expand All @@ -576,7 +576,7 @@ internal Task WriteAsyncMemory (ReadOnlyMemory<byte> source, CancellationToken c
EnsureNotDisposed ();

return cancellationToken.IsCancellationRequested ?
Task.FromCanceled<int> (cancellationToken) :
Task.FromCanceled<int>(cancellationToken) :
WriteAsyncMemoryCore (source, cancellationToken);
}

Expand Down
10 changes: 5 additions & 5 deletions src/Compression/Deflater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ internal unsafe void SetInput (ReadOnlyMemory<byte> 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) {
return;
}

lock (SyncLock) {
_inputBufferHandle = inputBuffer.Retain (pin: true);
_inputBufferHandle = inputBuffer.Pin ();

_compression_struct.Source = (IntPtr)_inputBufferHandle.Pointer;
_compression_struct.SourceSize = inputBuffer.Length;
Expand All @@ -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) {
Expand Down Expand Up @@ -155,15 +155,15 @@ internal bool Finish (byte[] outputBuffer, out int bytesRead)
/// <summary>
/// Returns true if there was something to flush. Otherwise False.
/// </summary>
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));
if (outputBuffer.Length < 0)
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.
Expand Down
16 changes: 10 additions & 6 deletions tests/mmptest/src/LinkerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,23 @@ public void DynamicSymbolMode (string mode)
CSProjConfig = $"<MonoBundlingExtraArgs>--dynamic-symbol-mode={mode}</MonoBundlingExtraArgs>\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 ();
Expand Down
7 changes: 5 additions & 2 deletions tests/mtouch/MTouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1770,10 +1770,13 @@ 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);
}
}

Expand Down
5 changes: 4 additions & 1 deletion tools/mmp/driver.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* Copyright 2011-2014 Xamarin Inc. All rights reserved.
* Copyright 2010 Novell Inc.
Expand Down Expand Up @@ -1340,6 +1339,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 ");
Expand Down
6 changes: 4 additions & 2 deletions tools/mtouch/mtouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ public static string GetAotArguments (Application app, string filename, Abi abi,
bool enable_debug_symbols = app.PackageManagedDebugSymbols;
bool llvm_only = app.EnableLLVMOnlyBitCode;
bool interp = app.UseInterpreter;
bool is32bit = (abi & Abi.Arch32Mask) > 0;
string arch = abi.AsArchString ();

args.Append ("--debug ");
Expand Down Expand Up @@ -503,7 +504,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));
Expand Down Expand Up @@ -663,7 +664,8 @@ public static string GenerateMain (Application app, IEnumerable<Assembly> 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);");
Expand Down

0 comments on commit 8076525

Please sign in to comment.