From 693afccc61fff4d86293341e1bd19a1c7fdfbd5d Mon Sep 17 00:00:00 2001 From: "Xamarin Public Jenkins (auto-signing)" Date: Tue, 3 Jan 2017 15:17:25 +0000 Subject: [PATCH] Imported Upstream version 4.8.0.395 Former-commit-id: bc4eb15577ba347ac08038f1ebaa41e253f5b948 --- .../v5.0/Microsoft.Portable.Common.targets | 2 +- .../DynamicContext.cs | 3 +- .../ExpressionTest_Call.cs | 31 ++++++++++++++++++ .../System/Mono.Net.Security/MonoTlsStream.cs | 9 ++++- .../System.Reflection.Emit/DynamicMethod.cs | 26 ++++++++++----- .../DynamicMethodTest.cs | 26 +++++++++++++++ .../lib/monolite/System.dll.REMOVED.git-id | 2 +- .../lib/monolite/mscorlib.dll.REMOVED.git-id | 2 +- mcs/mcs/reflection.cs | 2 ++ .../linker/Mono.Linker.Steps/MarkStep.cs | 2 +- mono/metadata/monitor.c | 19 +++++++---- mono/mini/Makefile.am | 2 +- mono/mini/Makefile.am.in | 2 +- mono/mini/Makefile.in.REMOVED.git-id | 2 +- mono/mini/aot-compiler.c.REMOVED.git-id | 2 +- mono/mini/mini-arm-tls.h | 23 ------------- mono/mini/mini-arm.c.REMOVED.git-id | 2 +- mono/mini/version.h | 2 +- mono/utils/mono-context.c | 14 +++++--- po/mcs/de.gmo | Bin 5406 -> 5406 bytes po/mcs/de.po.REMOVED.git-id | 2 +- po/mcs/es.gmo | Bin 16329 -> 16329 bytes po/mcs/es.po.REMOVED.git-id | 2 +- po/mcs/ja.gmo | Bin 20863 -> 20863 bytes po/mcs/ja.po.REMOVED.git-id | 2 +- po/mcs/mcs.pot | 2 +- po/mcs/pt_BR.gmo | Bin 73161 -> 73161 bytes po/mcs/pt_BR.po.REMOVED.git-id | 2 +- 28 files changed, 123 insertions(+), 60 deletions(-) diff --git a/external/buildtools/src/Portable/Targets/v5.0/Microsoft.Portable.Common.targets b/external/buildtools/src/Portable/Targets/v5.0/Microsoft.Portable.Common.targets index 0cdc0c05bc..7fbad28110 100644 --- a/external/buildtools/src/Portable/Targets/v5.0/Microsoft.Portable.Common.targets +++ b/external/buildtools/src/Portable/Targets/v5.0/Microsoft.Portable.Common.targets @@ -17,7 +17,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and true - .NETPlatform,Version=v5.0;.NETStandard,Version=v1.0;.NETStandard,Version=v1.1;.NETStandard,Version=v1.2;.NETStandard,Version=v1.3;.NETStandard,Version=v1.4;.NETStandard,Version=v1.5 + .NETPlatform,Version=v5.0;.NETStandard,Version=v1.0;.NETStandard,Version=v1.1;.NETStandard,Version=v1.2;.NETStandard,Version=v1.3;.NETStandard,Version=v1.4;.NETStandard,Version=v1.5;.NETStandard,Version=v1.6 diff --git a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs index d03145e0df..9c466c5ed9 100644 --- a/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs +++ b/mcs/class/Microsoft.CSharp/Microsoft.CSharp.RuntimeBinder/DynamicContext.cs @@ -93,8 +93,7 @@ namespace Microsoft.CSharp.RuntimeBinder module.SetDeclaringAssembly (temp); var importer = new Compiler.ReflectionImporter (module, cc.BuiltinTypes) { - IgnorePrivateMembers = false, - IgnoreCompilerGeneratedField = false + IgnorePrivateMembers = false }; // Import all currently loaded assemblies diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs index 976b50109d..85e011bc27 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs @@ -29,6 +29,7 @@ using System; using System.Reflection; +using System.Reflection.Emit; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; @@ -295,6 +296,36 @@ namespace MonoTests.System.Linq.Expressions { Assert.AreEqual ("foo42", lamda (42, "foo")); } + [Test] + public void CallDynamicMethod_ToString () + { + // Regression test for #49686 + var m = new DynamicMethod ("intIntId", typeof (int), new Type [] { typeof (int) }); + var ilg = m.GetILGenerator (); + ilg.Emit (OpCodes.Ldarg_0); + ilg.Emit (OpCodes.Ret); + + var i = Expression.Parameter (typeof (int), "i"); + var e = Expression.Call (m, i); + + Assert.IsNotNull (e.ToString ()); + } + + [Test] + public void CallDynamicMethod_CompileInvoke () + { + var m = new DynamicMethod ("intIntId", typeof (int), new Type [] { typeof (int) }); + var ilg = m.GetILGenerator (); + ilg.Emit (OpCodes.Ldarg_0); + ilg.Emit (OpCodes.Ret); + + var i = Expression.Parameter (typeof (int), "i"); + var e = Expression.Call (m, i); + + var lambda = Expression.Lambda> (e, i).Compile (); + Assert.AreEqual (42, lambda (42)); + } + public static int Bang (Expression i) { return (int) (i as ConstantExpression).Value; diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs index 4e76cad89f..82339f34b5 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs @@ -95,8 +95,15 @@ namespace Mono.Net.Security sslStream = provider.CreateSslStream (networkStream, false, settings); try { + var host = request.Host; + if (!string.IsNullOrEmpty (host)) { + var pos = host.IndexOf (':'); + if (pos > 0) + host = host.Substring (0, pos); + } + sslStream.AuthenticateAsClient ( - request.Host, request.ClientCertificates, + host, request.ClientCertificates, (SslProtocols)ServicePointManager.SecurityProtocol, ServicePointManager.CheckCertificateRevocationList); diff --git a/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs b/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs index e3c30a4e4b..24e02528ce 100644 --- a/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs +++ b/mcs/class/corlib/System.Reflection.Emit/DynamicMethod.cs @@ -210,15 +210,20 @@ namespace System.Reflection.Emit { return this; } - [MonoTODO("Not implemented")] public override object[] GetCustomAttributes (bool inherit) { - throw new NotImplementedException (); + // support for MethodImplAttribute PCA + return new Object[] { new MethodImplAttribute(GetMethodImplementationFlags()) }; } - [MonoTODO("Not implemented")] public override object[] GetCustomAttributes (Type attributeType, - bool inherit) { - throw new NotImplementedException (); + bool inherit) { + if (attributeType == null) + throw new ArgumentNullException ("attributeType"); + + if (attributeType.IsAssignableFrom (typeof (MethodImplAttribute))) + return new Object[] { new MethodImplAttribute (GetMethodImplementationFlags()) }; + else + return EmptyArray.Value; } public DynamicILInfo GetDynamicILInfo () { @@ -244,7 +249,7 @@ namespace System.Reflection.Emit { } public override MethodImplAttributes GetMethodImplementationFlags () { - return MethodImplAttributes.IL | MethodImplAttributes.Managed; + return MethodImplAttributes.IL | MethodImplAttributes.Managed | MethodImplAttributes.NoInlining; } public override ParameterInfo[] GetParameters () @@ -298,9 +303,14 @@ namespace System.Reflection.Emit { } } - [MonoTODO("Not implemented")] public override bool IsDefined (Type attributeType, bool inherit) { - throw new NotImplementedException (); + if (attributeType == null) + throw new ArgumentNullException ("attributeType"); + + if (attributeType.IsAssignableFrom (typeof (MethodImplAttribute))) + return true; + else + return false; } public override string ToString () { diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs index df214d97b2..fcf6284a00 100644 --- a/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs +++ b/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs @@ -11,6 +11,7 @@ using System; using System.Reflection; using System.Reflection.Emit; using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; using System.Text; using System.Diagnostics; using System.Runtime.ExceptionServices; @@ -442,6 +443,31 @@ namespace MonoTests.System.Reflection.Emit f.Method.GetMethodBody (); } + [Test] + public void GetCustomAttributes () + { + var method = new DynamicMethod ("method", typeof (void), new Type [] { }); + + var methodImplAttrType = typeof (MethodImplAttribute); + Assert.IsTrue (method.IsDefined (methodImplAttrType, true), "MethodImplAttribute is defined"); + + // According to the spec, MethodImplAttribute is the + // only custom attr that's present on a DynamicMethod. + // And it's always a managed method with no inlining. + var a1 = method.GetCustomAttributes (true); + Assert.AreEqual (a1.Length, 1, "a1.Length == 1"); + Assert.AreEqual (a1[0].GetType (), methodImplAttrType, "a1[0] is a MethodImplAttribute"); + var options = (a1[0] as MethodImplAttribute).Value; + Assert.IsTrue ((options & MethodImplOptions.NoInlining) != 0, "NoInlining is set"); + Assert.IsTrue ((options & MethodImplOptions.Unmanaged) == 0, "Unmanaged isn't set"); + + + // any other custom attribute type + var extensionAttrType = typeof (ExtensionAttribute); + Assert.IsFalse (method.IsDefined (extensionAttrType, true)); + Assert.AreEqual (Array.Empty(), method.GetCustomAttributes (extensionAttrType, true)); + } + public delegate object RetObj(); [Test] //#640702 public void GetCurrentMethodWorksWithDynamicMethods () diff --git a/mcs/class/lib/monolite/System.dll.REMOVED.git-id b/mcs/class/lib/monolite/System.dll.REMOVED.git-id index 6973b03cea..6d0674d220 100644 --- a/mcs/class/lib/monolite/System.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/System.dll.REMOVED.git-id @@ -1 +1 @@ -230b2c651b79678ba74491306ffda95a019edf9b \ No newline at end of file +b3586ea6fa1c0ea2a774b82321dc5ea824f48240 \ No newline at end of file diff --git a/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id index 529d86e691..aecda34795 100644 --- a/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id +++ b/mcs/class/lib/monolite/mscorlib.dll.REMOVED.git-id @@ -1 +1 @@ -ac6dbc56417da4b2adacbcc7012d2ddad9b7fe18 \ No newline at end of file +8ae0a08f19dd0b517b5c8c706e3f11044ba7440c \ No newline at end of file diff --git a/mcs/mcs/reflection.cs b/mcs/mcs/reflection.cs index c7bcb479db..24f25951d5 100644 --- a/mcs/mcs/reflection.cs +++ b/mcs/mcs/reflection.cs @@ -48,6 +48,8 @@ namespace Mono.CSharp public ReflectionImporter (ModuleContainer module, BuiltinTypes builtin) : base (module) { + IgnoreCompilerGeneratedField = false; + Initialize (builtin); } diff --git a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs index 9bf293d7f1..5c205f3791 100644 --- a/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs +++ b/mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs @@ -372,7 +372,7 @@ namespace Mono.Linker.Steps { // e.g. System.String[] -> System.String var ts = (type as TypeSpecification); if (ts != null) { - MarkWithResolvedScope (ts.GetElementType ()); + MarkWithResolvedScope (ts.ElementType); return; } diff --git a/mono/metadata/monitor.c b/mono/metadata/monitor.c index ef01f3d530..85d37b2edf 100644 --- a/mono/metadata/monitor.c +++ b/mono/metadata/monitor.c @@ -630,18 +630,19 @@ mono_object_hash (MonoObject* obj) #endif } -static void +static gboolean mono_monitor_ensure_owned (LockWord lw, guint32 id) { if (lock_word_is_flat (lw)) { if (lock_word_get_owner (lw) == id) - return; + return TRUE; } else if (lock_word_is_inflated (lw)) { if (mon_status_get_owner (lock_word_get_inflated_lock (lw)->status) == id) - return; + return TRUE; } mono_set_pending_exception (mono_get_exception_synchronization_lock ("Object synchronization method was called from an unsynchronized block of code.")); + return FALSE; } /* @@ -1038,7 +1039,8 @@ mono_monitor_exit (MonoObject *obj) lw.sync = obj->synchronisation; - mono_monitor_ensure_owned (lw, mono_thread_info_get_small_id ()); + if (!mono_monitor_ensure_owned (lw, mono_thread_info_get_small_id ())) + return; if (G_UNLIKELY (lock_word_is_inflated (lw))) mono_monitor_exit_inflated (obj); @@ -1185,7 +1187,8 @@ ves_icall_System_Threading_Monitor_Monitor_pulse (MonoObject *obj) id = mono_thread_info_get_small_id (); lw.sync = obj->synchronisation; - mono_monitor_ensure_owned (lw, id); + if (!mono_monitor_ensure_owned (lw, id)) + return; if (!lock_word_is_inflated (lw)) { /* No threads waiting. A wait would have inflated the lock */ @@ -1216,7 +1219,8 @@ ves_icall_System_Threading_Monitor_Monitor_pulse_all (MonoObject *obj) id = mono_thread_info_get_small_id (); lw.sync = obj->synchronisation; - mono_monitor_ensure_owned (lw, id); + if (!mono_monitor_ensure_owned (lw, id)) + return; if (!lock_word_is_inflated (lw)) { /* No threads waiting. A wait would have inflated the lock */ @@ -1252,7 +1256,8 @@ ves_icall_System_Threading_Monitor_Monitor_wait (MonoObject *obj, guint32 ms) lw.sync = obj->synchronisation; - mono_monitor_ensure_owned (lw, id); + if (!mono_monitor_ensure_owned (lw, id)) + return FALSE; if (!lock_word_is_inflated (lw)) { mono_monitor_inflate_owned (obj, id); diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am index f3cb47c226..6de9f385f6 100644 --- a/mono/mini/Makefile.am +++ b/mono/mini/Makefile.am @@ -860,7 +860,7 @@ EXTRA_DIST = TestDriver.cs \ Makefile.am.in version.h: Makefile - echo "#define FULL_VERSION \"Stable 4.8.0.382/aca1492\"" > version.h + echo "#define FULL_VERSION \"Stable 4.8.0.395/df81fe4\"" > version.h # Utility target for patching libtool to speed up linking patch-libtool: diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index f3cb47c226..6de9f385f6 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -860,7 +860,7 @@ EXTRA_DIST = TestDriver.cs \ Makefile.am.in version.h: Makefile - echo "#define FULL_VERSION \"Stable 4.8.0.382/aca1492\"" > version.h + echo "#define FULL_VERSION \"Stable 4.8.0.395/df81fe4\"" > version.h # Utility target for patching libtool to speed up linking patch-libtool: diff --git a/mono/mini/Makefile.in.REMOVED.git-id b/mono/mini/Makefile.in.REMOVED.git-id index 66a1094c9d..4b1d33f864 100644 --- a/mono/mini/Makefile.in.REMOVED.git-id +++ b/mono/mini/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -de8ec0d53c8240e10d3267814eb8ab2f2114e5db \ No newline at end of file +2128ee71f4bedcfbe65320e1befa9d3044dd5a0b \ No newline at end of file diff --git a/mono/mini/aot-compiler.c.REMOVED.git-id b/mono/mini/aot-compiler.c.REMOVED.git-id index a539eda7b0..c1d4f41b29 100644 --- a/mono/mini/aot-compiler.c.REMOVED.git-id +++ b/mono/mini/aot-compiler.c.REMOVED.git-id @@ -1 +1 @@ -a1c359f96a9f1549227cba4f1d82f9b535458f19 \ No newline at end of file +14bc01ca5a1c785611092113ce9726193bb24fd9 \ No newline at end of file diff --git a/mono/mini/mini-arm-tls.h b/mono/mini/mini-arm-tls.h index 3fa4bef206..1a68d1783a 100644 --- a/mono/mini/mini-arm-tls.h +++ b/mono/mini/mini-arm-tls.h @@ -66,26 +66,6 @@ known_kernel_helper (void) #endif } -static void -dump_code (guint32 *ptr) -{ - char current_impl [256]; - char hex [16]; - int i; - guint32 page_mask = ~((guint32)mono_pagesize () - 1); - - current_impl [0] = 0; - for (i = 0; i < 16; i++) { - /* Don't risk page fault since we don't know where the code ends */ - if (((guint32)&ptr [i] & page_mask) != ((guint32)ptr & page_mask)) - break; - sprintf (hex, "0x%x ", ptr [i]); - strcat (current_impl, hex); - } - - g_warning (current_impl); -} - static MonoTlsImplementation mono_arm_get_tls_implementation (void) { @@ -110,9 +90,6 @@ mono_arm_get_tls_implementation (void) } } - g_warning ("No fast tls on device. Using fallbacks. Current implementation : "); - dump_code (check_addr); - return (MonoTlsImplementation) { NULL, 0, FALSE, mono_fallback_get_tls_key, NULL, mono_fallback_set_tls_key, NULL }; #endif } diff --git a/mono/mini/mini-arm.c.REMOVED.git-id b/mono/mini/mini-arm.c.REMOVED.git-id index 4089c73503..91e2188cc5 100644 --- a/mono/mini/mini-arm.c.REMOVED.git-id +++ b/mono/mini/mini-arm.c.REMOVED.git-id @@ -1 +1 @@ -e249d1215b974ea22b97135efc8865641fd6e064 \ No newline at end of file +135519aac6d9aac84c8ac83259d5bb8ea8cc9c61 \ No newline at end of file diff --git a/mono/mini/version.h b/mono/mini/version.h index db614e72f4..dcc12485b7 100644 --- a/mono/mini/version.h +++ b/mono/mini/version.h @@ -1 +1 @@ -#define FULL_VERSION "Stable 4.8.0.382/aca1492" +#define FULL_VERSION "Stable 4.8.0.395/df81fe4" diff --git a/mono/utils/mono-context.c b/mono/utils/mono-context.c index 632513d874..8551d94733 100644 --- a/mono/utils/mono-context.c +++ b/mono/utils/mono-context.c @@ -346,10 +346,16 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx) memcpy (mctx->regs, UCONTEXT_GREGS (sigctx), sizeof (mgreg_t) * 31); mctx->pc = UCONTEXT_REG_PC (sigctx); mctx->regs [ARMREG_SP] = UCONTEXT_REG_SP (sigctx); - /* - * We don't handle fp regs, this is not currrently a - * problem, since we don't allocate them globally. - */ +#ifdef __linux__ + struct fpsimd_context *fpctx = (struct fpsimd_context*)&((ucontext_t*)sigctx)->uc_mcontext.__reserved; + int i; + + g_assert (fpctx->head.magic == FPSIMD_MAGIC); + for (i = 0; i < 32; ++i) + /* Only store the bottom 8 bytes for now */ + *(guint64*)&(mctx->fregs [i]) = fpctx->vregs [i]; +#endif + /* FIXME: apple */ #endif } diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo index 047e830c66370ac6168aa1f40f3e921cc6a7451f..f2b005d8fbc7271f3d56c2f897bd1b4f133bca88 100644 GIT binary patch delta 26 hcmbQIHBW29eJ);eT?0d117ih46Dw1L&2PAjxBzcJ2bBN- delta 26 hcmbQIHBW29eJ)-zT|*;XLsJDqBP&Dm&2PAjxBzc%2bur? diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id index fc9e06a902..24729594de 100644 --- a/po/mcs/de.po.REMOVED.git-id +++ b/po/mcs/de.po.REMOVED.git-id @@ -1 +1 @@ -470d10a95e73968e4ca69002f84128ce73370042 \ No newline at end of file +d610898725042926616eda830bc1fe06716fddf4 \ No newline at end of file diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo index b3b92acea66e33e16ae03441fcac96fab28559ae..eb71f492a77b0841e907926d0d1d1dce6d0a450e 100644 GIT binary patch delta 26 hcmX?Ef3kjqh9a-Iu7RPhfw6+2iIu6rW>du}asYUs2g?8e delta 26 hcmX?Ef3kjqh9a+-uAz~xp{atQk(HtOW>du}asYVF2hacj diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id index 19ca9049b7..f515796466 100644 --- a/po/mcs/es.po.REMOVED.git-id +++ b/po/mcs/es.po.REMOVED.git-id @@ -1 +1 @@ -87ec20f13077d1f449ce5298d25c43f68f5bfbe1 \ No newline at end of file +00b28cb6852ac9514efee13af376b134bb9217cc \ No newline at end of file diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo index ea35e82454a1d886f37aba324bc41ddfbde0a2bb..471553221a3d36dabb76b1b3cdb8a4aae5d56d27 100644 GIT binary patch delta 28 jcmeyri1Gg-#tlsByym(FhPnpE3Wg?DrUsk&)eE!$i)sib delta 28 jcmeyri1Gg-#tlsByk@$FM!JTk3Wi2jhUT03)eE!$i\n" "Language-Team: LANGUAGE \n" diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo index 28f476d192a2d7c0853fef91c3d87bf158844d0a..aef7924c1b905552d129837af852753475e19ba2 100644 GIT binary patch delta 28 kcmX@Po8{zgmJK4)c+GVU40R2R6%0+RObs?GPFv9q0FqJ(iU0rr delta 28 kcmX@Po8{zgmJK4)c+GSTjdTr76%38649zzyPFv9q0Fr