From dc50008e1624c0756726dee72e453d825d173553 Mon Sep 17 00:00:00 2001 From: "Xamarin Public Jenkins (auto-signing)" Date: Wed, 15 Mar 2017 10:36:24 +0000 Subject: [PATCH] Imported Upstream version 4.8.0.520 Former-commit-id: b616177084b79e9a11491af6b1ad88f2f73a6093 --- mcs/class/Mono.CSharp/monotouch.cs | 752 +----------------- .../Mono.Data.Sqlite_2.0/SQLiteConvert.cs | 2 +- .../corlib/Test/System.Threading/TimerTest.cs | 93 +-- mcs/class/corlib/Test/System/GCTest.cs | 6 +- mcs/tools/mkbundle/Makefile | 5 +- mcs/tools/mkbundle/mkbundle.cs | 14 +- mono/metadata/appdomain.c | 2 +- mono/metadata/assembly.c.REMOVED.git-id | 2 +- mono/metadata/image-internals.h | 9 + mono/metadata/image.c | 27 +- mono/metadata/marshal.c.REMOVED.git-id | 2 +- mono/metadata/marshal.h | 2 +- mono/metadata/metadata-internals.h | 6 + mono/metadata/sgen-mono.c | 9 +- mono/metadata/sgen-stw.c | 2 +- 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/aot-runtime.c.REMOVED.git-id | 2 +- mono/mini/unwind.c | 4 +- mono/mini/version.h | 2 +- po/mcs/LINGUAS | 5 +- 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 +- 32 files changed, 143 insertions(+), 821 deletions(-) diff --git a/mcs/class/Mono.CSharp/monotouch.cs b/mcs/class/Mono.CSharp/monotouch.cs index 06feb3cc39..ecede71ac3 100644 --- a/mcs/class/Mono.CSharp/monotouch.cs +++ b/mcs/class/Mono.CSharp/monotouch.cs @@ -28,797 +28,83 @@ namespace System.Reflection.Emit { - public class TypeBuilder : Type + static class AssemblyBuilderExtensions { - #region implemented abstract members of MemberInfo - - public override bool IsDefined (Type attributeType, bool inherit) + public static void AddResourceFile (this AssemblyBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override object[] GetCustomAttributes (bool inherit) + public static ModuleBuilder DefineDynamicModule (this AssemblyBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override object[] GetCustomAttributes (Type attributeType, bool inherit) + public static void DefineVersionInfoResource (this AssemblyBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override string Name { - get { - throw new NotSupportedException (); - } - } - - #endregion - - #region implemented abstract members of Type - - public override Type GetInterface (string name, bool ignoreCase) + public static void DefineUnmanagedResource (this AssemblyBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override Type[] GetInterfaces () + public static void Save (this AssemblyBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override Type GetElementType () - { - throw new NotSupportedException (); - } - - public override EventInfo GetEvent (string name, BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override EventInfo[] GetEvents (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override FieldInfo GetField (string name, BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override FieldInfo[] GetFields (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override MemberInfo[] GetMembers (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) - { - throw new NotSupportedException (); - } - - public override MethodInfo[] GetMethods (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override Type GetNestedType (string name, BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override Type[] GetNestedTypes (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override PropertyInfo[] GetProperties (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) - { - throw new NotSupportedException (); - } - - protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) - { - throw new NotSupportedException (); - } - - protected override TypeAttributes GetAttributeFlagsImpl () - { - throw new NotSupportedException (); - } - - protected override bool HasElementTypeImpl () - { - throw new NotSupportedException (); - } - - protected override bool IsArrayImpl () - { - throw new NotSupportedException (); - } - - protected override bool IsByRefImpl () - { - throw new NotSupportedException (); - } - - protected override bool IsCOMObjectImpl () - { - throw new NotSupportedException (); - } - - protected override bool IsPointerImpl () - { - throw new NotSupportedException (); - } - - protected override bool IsPrimitiveImpl () - { - throw new NotSupportedException (); - } - - public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr) - { - throw new NotSupportedException (); - } - - public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) - { - throw new NotSupportedException (); - } - - public override Assembly Assembly { - get { - throw new NotSupportedException (); - } - } - - public override string AssemblyQualifiedName { - get { - throw new NotSupportedException (); - } - } - - public override Type BaseType { - get { - throw new NotSupportedException (); - } - } - - public override string FullName { - get { - throw new NotSupportedException (); - } - } - - public override Guid GUID { - get { - throw new NotSupportedException (); - } - } - - public override Module Module { - get { - throw new NotSupportedException (); - } - } - - public override string Namespace { - get { - throw new NotSupportedException (); - } - } - - public override Type UnderlyingSystemType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - public void AddInterfaceImplementation (Type interfaceType) - { - throw new NotSupportedException (); - } - - public void AddDeclarativeSecurity (params object[] args) - { - throw new NotSupportedException (); - } - - public void SetParent (object arg) - { - throw new NotSupportedException (); - } - - public Type CreateType() - { - throw new NotSupportedException (); - } - - public ConstructorBuilder DefineConstructor (params object[] args) - { - throw new NotSupportedException (); - } - - public MethodBuilder DefineMethod (params object[] args) - { - throw new NotSupportedException (); - } - - public TypeBuilder DefineNestedType (params object[] args) - { - throw new NotSupportedException (); - } - - public PropertyBuilder DefineProperty (params object[] args) - { - throw new NotSupportedException (); - } - - public EventBuilder DefineEvent (params object[] args) - { - throw new NotSupportedException (); - } - - public FieldBuilder DefineField (params object[] args) - { - throw new NotSupportedException (); - } - - public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names) - { - throw new NotSupportedException (); - } - - public MethodBuilder DefineMethodOverride (params object[] args) - { - throw new NotSupportedException (); - } - - public static ConstructorInfo GetConstructor (Type type, ConstructorInfo constructor) - { - throw new NotSupportedException (); - } - - public static FieldInfo GetField (Type type, FieldInfo field) - { - throw new NotSupportedException (); - } - - public static MethodInfo GetMethod (Type type, MethodInfo method) - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) + public static void SetEntryPoint (this AssemblyBuilder builder, params object[] args) { throw new NotSupportedException (); } } - public class MethodBuilder : MethodBase + static class ConstructorBuilderExtensions { - #region implemented abstract members of MemberInfo - - public override bool IsDefined (Type attributeType, bool inherit) + public static void AddDeclarativeSecurity (this ConstructorBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override object[] GetCustomAttributes (bool inherit) - { - throw new NotSupportedException (); - } - - public override object[] GetCustomAttributes (Type attributeType, bool inherit) - { - throw new NotSupportedException (); - } - - public override Type DeclaringType { - get { - throw new NotSupportedException (); - } - } - - public override MemberTypes MemberType { - get { - throw new NotSupportedException (); - } - } - - public override string Name { - get { - throw new NotSupportedException (); - } - } - - public override Type ReflectedType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - #region implemented abstract members of MethodBase - - public override MethodImplAttributes GetMethodImplementationFlags () - { - throw new NotSupportedException (); - } - - public override ParameterInfo[] GetParameters () - { - throw new NotSupportedException (); - } - - public override object Invoke (object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, System.Globalization.CultureInfo culture) - { - throw new NotSupportedException (); - } - - public override RuntimeMethodHandle MethodHandle { - get { - throw new NotSupportedException (); - } - } - - public override MethodAttributes Attributes { - get { - throw new NotSupportedException (); - } - } - - #endregion - - public void AddDeclarativeSecurity (params object[] args) - { - throw new NotSupportedException (); - } - - public ParameterBuilder DefineParameter (params object[] args) - { - throw new NotSupportedException (); - } - - public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names) - { - throw new NotSupportedException (); - } - - public MethodToken GetToken() - { - throw new NotSupportedException (); - } - - public ILGenerator GetILGenerator () - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) - { - throw new NotSupportedException (); - } - - public void SetImplementationFlags (MethodImplAttributes attributes) - { - throw new NotSupportedException (); - } - - public void SetParameters (params Type[] parameterTypes) - { - throw new NotSupportedException (); - } - - public void SetReturnType (object arg) + public static MethodToken GetToken (this ConstructorBuilder builder) { throw new NotSupportedException (); } } - public class AssemblyBuilder : Assembly + static class MethodBuilderExtensions { - public void AddResourceFile (params object[] args) + public static void AddDeclarativeSecurity (this MethodBuilder builder, params object[] args) { throw new NotSupportedException (); } - public void DefineVersionInfoResource (params object[] args) - { - throw new NotSupportedException (); - } - - public ModuleBuilder DefineDynamicModule (params object[] args) - { - throw new NotSupportedException (); - } - - public void DefineUnmanagedResource (params object[] args) - { - throw new NotSupportedException (); - } - - public void Save (params object[] args) - { - throw new NotSupportedException (); - } - - public void SetEntryPoint (params object[] args) - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) + public static MethodToken GetToken (this MethodBuilder builder) { throw new NotSupportedException (); } } - public class ConstructorBuilder : MethodBase + static class ModuleBuilderExtensions { - #region implemented abstract members of MemberInfo - - public override bool IsDefined (Type attributeType, bool inherit) - { - throw new NotSupportedException (); - } - - public override object[] GetCustomAttributes (bool inherit) - { - throw new NotSupportedException (); - } - - public override object[] GetCustomAttributes (Type attributeType, bool inherit) - { - throw new NotSupportedException (); - } - - public override Type DeclaringType { - get { - throw new NotSupportedException (); - } - } - - public override MemberTypes MemberType { - get { - throw new NotSupportedException (); - } - } - - public override string Name { - get { - throw new NotSupportedException (); - } - } - - public override Type ReflectedType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - #region implemented abstract members of MethodBase - - public override MethodImplAttributes GetMethodImplementationFlags () - { - throw new NotSupportedException (); - } - - public override ParameterInfo[] GetParameters () - { - throw new NotSupportedException (); - } - - public override object Invoke (object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, System.Globalization.CultureInfo culture) - { - throw new NotSupportedException (); - } - - public override RuntimeMethodHandle MethodHandle { - get { - throw new NotSupportedException (); - } - } - - public override MethodAttributes Attributes { - get { - throw new NotSupportedException (); - } - } - - #endregion - - public void AddDeclarativeSecurity (params object[] args) - { - throw new NotSupportedException (); - } - - public ParameterBuilder DefineParameter (params object[] args) - { - throw new NotSupportedException (); - } - - public MethodToken GetToken() - { - throw new NotSupportedException (); - } - - public ILGenerator GetILGenerator () - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) - { - throw new NotSupportedException (); - } - - public void SetImplementationFlags (MethodImplAttributes attributes) - { - throw new NotSupportedException (); - } - } - - public class ModuleBuilder : Module - { - public void DefineManifestResource (params object[] args) - { - throw new NotSupportedException (); - } - - public TypeBuilder DefineType (params object[] args) - { - throw new NotSupportedException (); - } - - public MethodToken GetToken() - { - throw new NotSupportedException (); - } - - public MethodInfo GetArrayMethod (params object[] args) - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) + public static void DefineManifestResource (this ModuleBuilder builder, params object[] args) { throw new NotSupportedException (); } } - public class PropertyBuilder : PropertyInfo + static class TypeBuilderExtensions { - #region implemented abstract members of MemberInfo - - public override bool IsDefined (Type attributeType, bool inherit) + public static void AddDeclarativeSecurity (this TypeBuilder builder, params object[] args) { throw new NotSupportedException (); } - public override object[] GetCustomAttributes (bool inherit) - { - throw new NotSupportedException (); - } - - public override object[] GetCustomAttributes (Type attributeType, bool inherit) - { - throw new NotSupportedException (); - } - - public override Type DeclaringType { - get { - throw new NotSupportedException (); - } - } - - public override string Name { - get { - throw new NotSupportedException (); - } - } - - public override Type ReflectedType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - #region implemented abstract members of PropertyInfo - - public override MethodInfo[] GetAccessors (bool nonPublic) - { - throw new NotSupportedException (); - } - - public override MethodInfo GetGetMethod (bool nonPublic) - { - throw new NotSupportedException (); - } - - public override ParameterInfo[] GetIndexParameters () - { - throw new NotSupportedException (); - } - - public override MethodInfo GetSetMethod (bool nonPublic) - { - throw new NotSupportedException (); - } - - public override object GetValue (object obj, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture) - { - throw new NotSupportedException (); - } - - public override void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture) - { - throw new NotSupportedException (); - } - - public override PropertyAttributes Attributes { - get { - throw new NotSupportedException (); - } - } - - public override bool CanRead { - get { - throw new NotSupportedException (); - } - } - - public override bool CanWrite { - get { - throw new NotSupportedException (); - } - } - - public override Type PropertyType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - public MethodToken GetToken() - { - throw new NotSupportedException (); - } - - public void SetGetMethod (object arg) - { - throw new NotSupportedException (); - } - - public void SetSetMethod (object arg) - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) + public static Type CreateType (this TypeBuilder builder) { throw new NotSupportedException (); } } - - public class FieldBuilder : FieldInfo - { - #region implemented abstract members of MemberInfo - - public override bool IsDefined (Type attributeType, bool inherit) - { - throw new NotSupportedException (); - } - - public override object[] GetCustomAttributes (bool inherit) - { - throw new NotSupportedException (); - } - - public override object[] GetCustomAttributes (Type attributeType, bool inherit) - { - throw new NotSupportedException (); - } - - public override Type DeclaringType { - get { - throw new NotSupportedException (); - } - } - - public override string Name { - get { - throw new NotSupportedException (); - } - } - - public override Type ReflectedType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - #region implemented abstract members of FieldInfo - - public override object GetValue (object obj) - { - throw new NotSupportedException (); - } - - public override void SetValue (object obj, object value, BindingFlags invokeAttr, Binder binder, System.Globalization.CultureInfo culture) - { - throw new NotSupportedException (); - } - - public override FieldAttributes Attributes { - get { - throw new NotSupportedException (); - } - } - - public override RuntimeFieldHandle FieldHandle { - get { - throw new NotSupportedException (); - } - } - - public override Type FieldType { - get { - throw new NotSupportedException (); - } - } - - #endregion - - public void SetConstant (object arg) - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) - { - throw new NotSupportedException (); - } - } - - public class EventBuilder - { - public void SetAddOnMethod (MethodBuilder mdBuilder) - { - throw new NotSupportedException (); - } - - public void SetRemoveOnMethod (MethodBuilder mdBuilder) - { - throw new NotSupportedException (); - } - - public void SetCustomAttribute (params object[] args) - { - throw new NotSupportedException (); - } - } - -} \ No newline at end of file +} diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConvert.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConvert.cs index 45b2db1768..cff394bbcf 100644 --- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConvert.cs +++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteConvert.cs @@ -221,7 +221,7 @@ namespace Mono.Data.Sqlite case SQLiteDateFormats.UnixEpoch: return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString(); default: - return dateValue.ToString(_datetimeFormats[5], CultureInfo.InvariantCulture); + return dateValue.ToString(_datetimeFormats[19], CultureInfo.InvariantCulture); } } diff --git a/mcs/class/corlib/Test/System.Threading/TimerTest.cs b/mcs/class/corlib/Test/System.Threading/TimerTest.cs index ce1c9793fc..b9ae6d1709 100644 --- a/mcs/class/corlib/Test/System.Threading/TimerTest.cs +++ b/mcs/class/corlib/Test/System.Threading/TimerTest.cs @@ -19,6 +19,7 @@ namespace MonoTests.System.Threading { // this bucket is used to avoid non-theadlocal issues class Bucket { public int count; + public ManualResetEventSlim mre = new ManualResetEventSlim (false); } [SetUp] @@ -36,51 +37,22 @@ namespace MonoTests.System.Threading { { } + private void Callback2 (object foo) + { + Bucket b = foo as Bucket; + Interlocked.Increment (ref b.count); + b.mre.Set (); + } + + [Test] public void TestDueTime () { Bucket bucket = new Bucket(); - using (Timer t = new Timer (o => Callback (o), bucket, 200, Timeout.Infinite)) { - Thread.Sleep (50); - Assert.AreEqual (0, bucket.count, "#1"); - Thread.Sleep (200); - Assert.AreEqual (1, bucket.count, "#2"); - Thread.Sleep (500); - Assert.AreEqual (1, bucket.count, "#3"); - t.Change (10, 10); - Thread.Sleep (1000); - Assert.IsTrue(bucket.count > 20, "#4"); - } - } - - [Test] - public void TestChange () - { - Bucket bucket = new Bucket(); - - using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) { - Thread.Sleep (500); - int c = bucket.count; - Assert.IsTrue (c > 20, "#1 " + c.ToString ()); - t.Change (100, 100); - c = bucket.count; - Thread.Sleep (500); - Assert.IsTrue (bucket.count <= c + 20, "#2 " + c.ToString ()); - } - } - - [Test] - public void TestZeroDueTime () - { - Bucket bucket = new Bucket(); - - using (Timer t = new Timer (o => Callback (o), bucket, 0, Timeout.Infinite)) { - Thread.Sleep (100); + using (Timer t = new Timer (o => Callback2 (o), bucket, 200, Timeout.Infinite)) { + Assert.IsTrue (bucket.mre.Wait (5000), "#-1"); Assert.AreEqual (1, bucket.count, "#1"); - t.Change (0, Timeout.Infinite); - Thread.Sleep (100); - Assert.AreEqual (2, bucket.count, "#2"); } } @@ -89,15 +61,44 @@ namespace MonoTests.System.Threading { { Bucket bucket = new Bucket(); - using (Timer t = new Timer (o => Callback (o), bucket, 10, 10)) { - Thread.Sleep (200); + using (Timer t = new Timer (o => Callback2 (o), bucket, 10, 10)) { + Assert.IsTrue (bucket.mre.Wait (5000), "#-1"); } - - Thread.Sleep (20); + //If the callback is called after dispose, it will NRE and be reported + bucket.mre = null; int c = bucket.count; - Assert.IsTrue (bucket.count > 5, "#1"); - Thread.Sleep (200); - Assert.AreEqual (c, bucket.count, "#2"); + Assert.IsTrue (c > 0, "#1"); + } + + [Test] + public void TestChange () + { + Bucket bucket = new Bucket(); + + using (Timer t = new Timer (o => Callback2 (o), bucket, 10, 10)) { + Assert.IsTrue (bucket.mre.Wait (5000), "#-1"); + int c = bucket.count; + Assert.IsTrue (c > 0, "#1 " + c); + t.Change (100000, 1000000); + c = bucket.count; + Thread.Sleep (500); + Assert.IsTrue (bucket.count <= c + 1, "#2 " + c); + } + } + + [Test] + public void TestZeroDueTime () + { + Bucket bucket = new Bucket(); + + using (Timer t = new Timer (o => Callback2 (o), bucket, 0, Timeout.Infinite)) { + Assert.IsTrue (bucket.mre.Wait (5000), "#-1"); + bucket.mre.Reset (); + Assert.AreEqual (1, bucket.count, "#1"); + t.Change (0, Timeout.Infinite); + Assert.IsTrue (bucket.mre.Wait (5000), "#1.5"); + Assert.AreEqual (2, bucket.count, "#2"); + } } [Test] // bug #320950 diff --git a/mcs/class/corlib/Test/System/GCTest.cs b/mcs/class/corlib/Test/System/GCTest.cs index 6ce65b4b43..59d50b9284 100644 --- a/mcs/class/corlib/Test/System/GCTest.cs +++ b/mcs/class/corlib/Test/System/GCTest.cs @@ -27,6 +27,7 @@ // using System; +using System.Threading; using System.Threading.Tasks; using NUnit.Framework; @@ -57,7 +58,10 @@ namespace MonoTests.System { [Test] public void ReRegisterForFinalizeTest () { - Run_ReRegisterForFinalizeTest (); + var thread = new Thread (Run_ReRegisterForFinalizeTest); + thread.Start (); + thread.Join (); + var t = Task.Factory.StartNew (() => { do { GC.Collect (); diff --git a/mcs/tools/mkbundle/Makefile b/mcs/tools/mkbundle/Makefile index 64a1b9cbf9..886fc46533 100644 --- a/mcs/tools/mkbundle/Makefile +++ b/mcs/tools/mkbundle/Makefile @@ -24,10 +24,11 @@ test-simple: simple.exe mono --debug $(the_lib) --cross default simple.exe -o foo && ./foo mono --debug $(the_lib) --sdk `dirname \`which mono\``/.. simple.exe -o foo && ./foo -rm DEMO.zip - mono-package-runtime `dirname \`which mono\``/.. DEMO + $(topdir)/../scripts/mono-package-runtime `dirname \`which mono\``/.. DEMO mkdir -p ~/.mono/targets/DEMO unzip -d ~/.mono/targets/DEMO DEMO.zip - mono --debug $(the_lib) --cross DEMO simple.exe -o foo && ./foo + mono --debug $(the_lib) --cross DEMO simple.exe -o foo | grep "Assembly.*mscorlib.dll" + ./foo simple.exe: Makefile echo 'class X { static void Main () { System.Console.WriteLine ("OK");}}' > simple.cs && mcs simple.cs diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index 603af9458a..8be07f281f 100755 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -1082,14 +1082,14 @@ void mono_register_config_for_assembly (const char* assembly_name, cons static void LoadLocalizedAssemblies (List assemblies) { var other = i18n.Select (x => "I18N." + x + (x.Length > 0 ? "." : "") + "dll"); - bool error = false; + string error = null; foreach (string name in other) { try { Assembly a = LoadAssembly (name); if (a == null) { - error = true; + error = "Failed to load " + name; continue; } @@ -1105,8 +1105,8 @@ void mono_register_config_for_assembly (const char* assembly_name, cons } } - if (error) { - Error ("Couldn't load one or more of the i18n assemblies."); + if (error != null) { + Error ("Couldn't load one or more of the i18n assemblies: " + error); Environment.Exit (1); } } @@ -1114,6 +1114,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons static readonly Universe universe = new Universe (); static readonly Dictionary loaded_assemblies = new Dictionary (); + static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}"; public static string GetAssemblyName (string path) { @@ -1126,7 +1127,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons string dir = Path.GetDirectoryName (path); int idx = dir.LastIndexOf (Path.DirectorySeparatorChar); if (idx >= 0) { - name = dir.Substring (idx + 1) + Path.DirectorySeparatorChar + name; + name = dir.Substring (idx + 1) + resourcePathSeparator + name; Console.WriteLine ($"Storing satellite assembly '{path}' with name '{name}'"); } else if (!quiet) Console.WriteLine ($"Warning: satellite assembly {path} doesn't have locale path prefix, name conflicts possible"); @@ -1158,7 +1159,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons Assembly a = universe.LoadFile (path); foreach (AssemblyName an in a.GetReferencedAssemblies ()) { - LoadAssembly (an.FullName); + a = universe.Load (an.FullName); if (!QueueAssembly (files, a.CodeBase)) return false; } @@ -1220,7 +1221,6 @@ void mono_register_config_for_assembly (const char* assembly_name, cons static void Error (string msg, params object [] args) { Console.Error.WriteLine ("ERROR: {0}", string.Format (msg, args)); - throw new Exception (); Environment.Exit (1); } diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 70b32da680..2606d6f073 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -1970,7 +1970,7 @@ ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname, MonoBoolean re if (!is_ok (&error)) goto leave; - ass = mono_assembly_open_full (filename, &status, refOnly); + ass = mono_assembly_open_a_lot (filename, &status, refOnly, TRUE); if (!ass) { if (status == MONO_IMAGE_IMAGE_INVALID) diff --git a/mono/metadata/assembly.c.REMOVED.git-id b/mono/metadata/assembly.c.REMOVED.git-id index f2d0f970b4..1f87525730 100644 --- a/mono/metadata/assembly.c.REMOVED.git-id +++ b/mono/metadata/assembly.c.REMOVED.git-id @@ -1 +1 @@ -6319d6539ae88d35e1b1c3ac49c5be5c39e309a0 \ No newline at end of file +b304894d059baf706e16a1cf96e1fab367d91a79 \ No newline at end of file diff --git a/mono/metadata/image-internals.h b/mono/metadata/image-internals.h index 959575f6a0..e6868daee9 100644 --- a/mono/metadata/image-internals.h +++ b/mono/metadata/image-internals.h @@ -10,4 +10,13 @@ MonoImage * mono_find_image_owner (void *ptr); +MonoImage* +mono_image_load_file_for_image_checked (MonoImage *image, int fileidx, MonoError *error); + +MonoImage* +mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error); + +MonoImage * +mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context); + #endif /* __MONO_METADATA_IMAGE_INTERNALS_H__ */ diff --git a/mono/metadata/image.c b/mono/metadata/image.c index 0539b3c17d..a24e0809c7 100644 --- a/mono/metadata/image.c +++ b/mono/metadata/image.c @@ -1188,9 +1188,13 @@ do_mono_image_load (MonoImage *image, MonoImageOpenStatus *status, goto invalid_image; if (!image->ref_only && is_problematic_image (image)) { - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Denying load of problematic image %s", image->name); - *status = MONO_IMAGE_IMAGE_INVALID; - goto invalid_image; + if (image->load_from_context) { + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Loading problematic image %s", image->name); + } else { + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Denying load of problematic image %s", image->name); + *status = MONO_IMAGE_IMAGE_INVALID; + goto invalid_image; + } } if (image->loader == &pe_loader && !image->metadata_only && !mono_verifier_verify_table_data (image, &errors)) @@ -1220,7 +1224,7 @@ invalid_image: static MonoImage * do_mono_image_open (const char *fname, MonoImageOpenStatus *status, - gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly, gboolean metadata_only) + gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly, gboolean metadata_only, gboolean load_from_context) { MonoCLIImageInfo *iinfo; MonoImage *image; @@ -1264,6 +1268,7 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status, image->name = mono_path_resolve_symlinks (fname); image->ref_only = refonly; image->metadata_only = metadata_only; + image->load_from_context = load_from_context; image->ref_count = 1; /* if MONO_SECURITY_MODE_CORE_CLR is set then determine if this image is platform code */ image->core_clr_platform_code = mono_security_core_clr_determine_platform_image (image); @@ -1460,6 +1465,12 @@ mono_image_open_from_module_handle (HMODULE module_handle, char* fname, gboolean MonoImage * mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean refonly) +{ + return mono_image_open_a_lot (fname, status, refonly, FALSE); +} + +MonoImage * +mono_image_open_a_lot (const char *fname, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context) { MonoImage *image; GHashTable *loaded_images = get_loaded_images_hash (refonly); @@ -1559,7 +1570,7 @@ mono_image_open_full (const char *fname, MonoImageOpenStatus *status, gboolean r mono_images_unlock (); // Image not loaded, load it now - image = do_mono_image_open (fname, status, TRUE, TRUE, refonly, FALSE); + image = do_mono_image_open (fname, status, TRUE, TRUE, refonly, FALSE, load_from_context); if (image == NULL) return NULL; @@ -1598,7 +1609,7 @@ mono_pe_file_open (const char *fname, MonoImageOpenStatus *status) { g_return_val_if_fail (fname != NULL, NULL); - return do_mono_image_open (fname, status, FALSE, TRUE, FALSE, FALSE); + return do_mono_image_open (fname, status, FALSE, TRUE, FALSE, FALSE, FALSE); } /** @@ -1615,7 +1626,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status) { g_return_val_if_fail (fname != NULL, NULL); - return do_mono_image_open (fname, status, FALSE, FALSE, FALSE, FALSE); + return do_mono_image_open (fname, status, FALSE, FALSE, FALSE, FALSE, FALSE); } /* @@ -1626,7 +1637,7 @@ mono_image_open_raw (const char *fname, MonoImageOpenStatus *status) MonoImage * mono_image_open_metadata_only (const char *fname, MonoImageOpenStatus *status) { - return do_mono_image_open (fname, status, TRUE, TRUE, FALSE, TRUE); + return do_mono_image_open (fname, status, TRUE, TRUE, FALSE, TRUE, FALSE); } void diff --git a/mono/metadata/marshal.c.REMOVED.git-id b/mono/metadata/marshal.c.REMOVED.git-id index 9fd7bc85e8..5e51af33da 100644 --- a/mono/metadata/marshal.c.REMOVED.git-id +++ b/mono/metadata/marshal.c.REMOVED.git-id @@ -1 +1 @@ -7b980453c593408f829e7098dc333ad5087a8865 \ No newline at end of file +aec93dfd6da7c7fdca217573f4c4110135f3d6e6 \ No newline at end of file diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h index 166db1478c..bd5d4a4fc3 100644 --- a/mono/metadata/marshal.h +++ b/mono/metadata/marshal.h @@ -330,7 +330,7 @@ MonoMethodSignature* mono_marshal_get_string_ctor_signature (MonoMethod *method); MonoMethod * -mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc); +mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc, MonoError *exernal_error); gpointer mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type); diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index 8ae692d470..985704fc29 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -210,6 +210,9 @@ struct _MonoImage { /* Whenever this image contains metadata only without PE data */ guint8 metadata_only : 1; + /* Whether this image belongs to load-from context */ + guint8 load_from_context: 1; + guint8 checked_module_cctor : 1; guint8 has_module_cctor : 1; @@ -913,5 +916,8 @@ mono_find_image_set_owner (void *ptr); void mono_loader_register_module (const char *name, MonoDl *module); +MonoAssembly * +mono_assembly_open_a_lot (const char *filename, MonoImageOpenStatus *status, gboolean refonly, gboolean load_from_context); + #endif /* __MONO_METADATA_INTERNALS_H__ */ diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index 6b53cc35f2..ab2e057078 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -1041,7 +1041,7 @@ create_allocator (int atype, ManagedAllocatorVariant variant) { int p_var, size_var, thread_var G_GNUC_UNUSED; gboolean slowpath = variant == MANAGED_ALLOCATOR_SLOW_PATH; - guint32 slowpath_branch, max_size_branch; + guint32 slowpath_branch, max_size_branch, no_oom_branch; MonoMethodBuilder *mb; MonoMethod *res; MonoMethodSignature *csig; @@ -1330,6 +1330,13 @@ create_allocator (int atype, ManagedAllocatorVariant variant) } else { g_assert_not_reached (); } + + /* if (ret == NULL) throw OOM; */ + mono_mb_emit_byte (mb, CEE_DUP); + no_oom_branch = mono_mb_emit_branch (mb, CEE_BRTRUE); + mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); + + mono_mb_patch_branch (mb, no_oom_branch); mono_mb_emit_byte (mb, CEE_RET); /* Fastpath */ diff --git a/mono/metadata/sgen-stw.c b/mono/metadata/sgen-stw.c index 60e5933450..f58f2f1419 100644 --- a/mono/metadata/sgen-stw.c +++ b/mono/metadata/sgen-stw.c @@ -117,7 +117,7 @@ restart_threads_until_none_in_managed_allocator (void) if (info->client_info.skip || info->client_info.gc_disabled || info->client_info.suspend_done) continue; if (mono_thread_info_is_live (info) && - (!info->client_info.stack_start || info->client_info.in_critical_region || info->client_info.info.inside_critical_region || + (info->client_info.in_critical_region || info->client_info.info.inside_critical_region || is_ip_in_managed_allocator (info->client_info.stopped_domain, info->client_info.stopped_ip))) { binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info)); SGEN_LOG (3, "thread %p resumed.", (void*) (size_t) info->client_info.info.native_handle); diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am index f35b67c801..b0f0a524cd 100644 --- a/mono/mini/Makefile.am +++ b/mono/mini/Makefile.am @@ -861,7 +861,7 @@ EXTRA_DIST = TestDriver.cs \ Makefile.am.in version.h: Makefile - echo "#define FULL_VERSION \"Stable 4.8.0.495/e4a3cf3\"" > version.h + echo "#define FULL_VERSION \"Stable 4.8.0.520/8f6d0f6\"" > 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 f35b67c801..b0f0a524cd 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -861,7 +861,7 @@ EXTRA_DIST = TestDriver.cs \ Makefile.am.in version.h: Makefile - echo "#define FULL_VERSION \"Stable 4.8.0.495/e4a3cf3\"" > version.h + echo "#define FULL_VERSION \"Stable 4.8.0.520/8f6d0f6\"" > 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 c20749e0c9..713bc98983 100644 --- a/mono/mini/Makefile.in.REMOVED.git-id +++ b/mono/mini/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -1d2d50a79752da03d88b373dcfa4536e767c289d \ No newline at end of file +0dc0111f92ce7928cc8fae909326c9c778d14418 \ 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 3d7cae4fb4..bb9870f63b 100644 --- a/mono/mini/aot-compiler.c.REMOVED.git-id +++ b/mono/mini/aot-compiler.c.REMOVED.git-id @@ -1 +1 @@ -c4f44c2ecbc5dc6f0532c59ad55c2f46f1ed7f73 \ No newline at end of file +12111cac30226110a818b7d30ed37495129ceefa \ No newline at end of file diff --git a/mono/mini/aot-runtime.c.REMOVED.git-id b/mono/mini/aot-runtime.c.REMOVED.git-id index cf22d3bc34..0662bc147c 100644 --- a/mono/mini/aot-runtime.c.REMOVED.git-id +++ b/mono/mini/aot-runtime.c.REMOVED.git-id @@ -1 +1 @@ -2fd57cf8561234d38c90801e15fa271c5a719a82 \ No newline at end of file +c9cf297db00016d19274c670f130a224b78f28e0 \ No newline at end of file diff --git a/mono/mini/unwind.c b/mono/mini/unwind.c index 6d60f79e77..3f8a2bdfcd 100644 --- a/mono/mini/unwind.c +++ b/mono/mini/unwind.c @@ -382,14 +382,14 @@ mono_unwind_ops_encode_full (GSList *unwind_ops, guint32 *out_len, gboolean enab /* Emit an advance_loc if neccesary */ while (op->when > loc) { - if (op->when - loc > 65536) { + if (op->when - loc >= 65536) { *p ++ = DW_CFA_advance_loc4; guint32 v = (guint32)(op->when - loc); memcpy (p, &v, 4); g_assert (read32 (p) == (guint32)(op->when - loc)); p += 4; loc = op->when; - } else if (op->when - loc > 256) { + } else if (op->when - loc >= 256) { *p ++ = DW_CFA_advance_loc2; guint16 v = (guint16)(op->when - loc); memcpy (p, &v, 2); diff --git a/mono/mini/version.h b/mono/mini/version.h index a6daccadf0..5b9f7df8f0 100644 --- a/mono/mini/version.h +++ b/mono/mini/version.h @@ -1 +1 @@ -#define FULL_VERSION "Stable 4.8.0.495/e4a3cf3" +#define FULL_VERSION "Stable 4.8.0.520/8f6d0f6" diff --git a/po/mcs/LINGUAS b/po/mcs/LINGUAS index 5751de4be9..2f03aa0e2e 100644 --- a/po/mcs/LINGUAS +++ b/po/mcs/LINGUAS @@ -1,4 +1 @@ -es -ja -de -pt_BR \ No newline at end of file +es ja de pt_BR \ No newline at end of file diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo index 9a852c3e801b87d342eee338f79e7997856e536e..c36482755c411f2fa1f68a2fd149aa4969bd16c8 100644 GIT binary patch delta 23 ecmbQIHBW29BQ7puT|-j^Ljx;Av(0a~jJN<>?FR$^ delta 23 ecmbQIHBW29BQ7o@T_Ym}Lvt%bgUxTajJN<>;s*i% diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id index d59dbc2fd9..cfe60e3a84 100644 --- a/po/mcs/de.po.REMOVED.git-id +++ b/po/mcs/de.po.REMOVED.git-id @@ -1 +1 @@ -24891e68bb877147f45264905411a3d29b9697a2 \ No newline at end of file +24b8d7013337ff47aac017d32f2a8894282ecf16 \ No newline at end of file diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo index 2a1afab371e8fd9b79a0defe4ed2005d7f22b899..eef9d6643520c3db1da486f59a1abebf10a1233c 100644 GIT binary patch delta 23 ecmX?Ef3kjqwj!6YuA!-dp@Eg5*=AG4DRKa0EeARP delta 23 ecmX?Ef3kjqwj!62u91;~p}Ccz!Dds%DRKa0A_q7C diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id index 3e210cacf7..fe4ea733e3 100644 --- a/po/mcs/es.po.REMOVED.git-id +++ b/po/mcs/es.po.REMOVED.git-id @@ -1 +1 @@ -9a0004e54942d65f96b8db4923ab25ae00b98111 \ No newline at end of file +5b0191f6046441a044d9c113716369b913a1ca05 \ No newline at end of file diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo index 174de281e7a4f6ff71dc8ea1cc54e2c2ede0042d..cc7fb543c56499ddeb99924c347026eb1deb40f1 100644 GIT binary patch delta 25 gcmeyri1Gg-#tp3MT*kVFrV54zR)%Jq`PB=w0ChVDmH+?% delta 25 gcmeyri1Gg-#tp3MTt>P^Mhb@JR)z+f`PB=w0Cg}2lmGw# diff --git a/po/mcs/ja.po.REMOVED.git-id b/po/mcs/ja.po.REMOVED.git-id index c42cb3c3d2..1dd3b4de0b 100644 --- a/po/mcs/ja.po.REMOVED.git-id +++ b/po/mcs/ja.po.REMOVED.git-id @@ -1 +1 @@ -23ce3caec9ef14b46dd2699cb25dc0b6ba1e24b2 \ No newline at end of file +fe426ecab7608b26c99f42691e81fc635addb99f \ No newline at end of file diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot index a66306f857..55fb3d3329 100644 --- a/po/mcs/mcs.pot +++ b/po/mcs/mcs.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: mono 4.8.0\n" "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n" -"POT-Creation-Date: 2017-02-22 17:10+0000\n" +"POT-Creation-Date: 2017-03-15 10:16+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo index b091dfd1e1188a3687fe794062a8abf2040983fd..cf493bc784087f78985e694057fb159e0217e6ac 100644 GIT binary patch delta 25 hcmX@Po8{zgmJQ<5xQulTO%)6ctPIUID^6R{4gh;R2>Ad2 delta 25 hcmX@Po8{zgmJQ<5xQuj-j1&ybtqct|D^6R{4gh;G2=@R0 diff --git a/po/mcs/pt_BR.po.REMOVED.git-id b/po/mcs/pt_BR.po.REMOVED.git-id index 7140b8a6c2..ab9f86e681 100644 --- a/po/mcs/pt_BR.po.REMOVED.git-id +++ b/po/mcs/pt_BR.po.REMOVED.git-id @@ -1 +1 @@ -d89d14404907c8feee684d37888501a226d846e8 \ No newline at end of file +9f431fd588278451bee3612d0d6090248da2a85f \ No newline at end of file