Merge branch 'upstream'

Former-commit-id: 531e984735351a052b4fc0149db7852704755830
This commit is contained in:
Xamarin Public Jenkins (auto-signing) 2017-05-03 16:33:39 +00:00
commit d25068440b
30 changed files with 191 additions and 38 deletions

View File

@ -0,0 +1,28 @@
using System;
namespace System
{
internal static class AppContextDefaultValues
{
internal const string SwitchNoAsyncCurrentCulture = "Switch.System.Globalization.NoAsyncCurrentCulture";
internal const string SwitchThrowExceptionIfDisposedCancellationTokenSource = "Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource";
internal const string SwitchPreserveEventListnerObjectIdentity = "Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity";
internal const string SwitchUseLegacyPathHandling = "Switch.System.IO.UseLegacyPathHandling";
internal const string SwitchBlockLongPaths = "Switch.System.IO.BlockLongPaths";
internal const string SwitchDoNotAddrOfCspParentWindowHandle = "Switch.System.Security.Cryptography.DoNotAddrOfCspParentWindowHandle";
internal const string SwitchSetActorAsReferenceWhenCopyingClaimsIdentity = "Switch.System.Security.ClaimsIdentity.SetActorAsReferenceWhenCopyingClaimsIdentity";
public static void PopulateDefaultValues () {
}
//TODO Use the values in app.config
public static bool TryGetSwitchOverride (string switchName, out bool overrideValue)
{
// The default value for a switch is 'false'
overrideValue = false;
return false;
}
}
}

View File

@ -1,7 +0,0 @@
namespace System {
static class AppContextSwitches {
public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = true;
public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
public static readonly bool NoAsyncCurrentCulture = false;
}
}

View File

@ -790,6 +790,61 @@ namespace MonoTests.System.Reflection.Emit
Assert.IsInstanceOfType (typeof (PublicVisibleCustomAttribute), attrs[1]); Assert.IsInstanceOfType (typeof (PublicVisibleCustomAttribute), attrs[1]);
Assert.IsInstanceOfType (typeof (PublicVisibleCustomAttribute), attrs[2]); Assert.IsInstanceOfType (typeof (PublicVisibleCustomAttribute), attrs[2]);
} }
[Test]
public void CustomAttributeSameAssembly () {
// Regression test for 55681
//
// We build:
// class MyAttr : Attr { public MyAttr () { } }
// [assembly:MyAttr()]
//
// the important bit is that we pass the ConstructorBuilder to the CustomAttributeBuilder
var assemblyName = new AssemblyName ("Repro55681");
var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.Save, tempDir);
var moduleBuilder = assemblyBuilder.DefineDynamicModule ("Repro55681", "Repro55681.dll");
var typeBuilder = moduleBuilder.DefineType ("MyAttr", TypeAttributes.Public, typeof (Attribute));
ConstructorBuilder ctor = typeBuilder.DefineDefaultConstructor (MethodAttributes.Public);
typeBuilder.CreateType ();
assemblyBuilder.SetCustomAttribute (new CustomAttributeBuilder (ctor, new object [] { }));
assemblyBuilder.Save ("Repro55681.dll");
}
[Test]
public void CustomAttributeAcrossAssemblies () {
// Regression test for 55681
//
// We build:
// assembly1:
// class MyAttr : Attr { public MyAttr () { } }
// assembly2:
// class Dummy { }
// [assembly:MyAttr()]
//
// the important bit is that we pass the ConstructorBuilder to the CustomAttributeBuilder
var assemblyName1 = new AssemblyName ("Repro55681-2a");
var assemblyBuilder1 = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName1, AssemblyBuilderAccess.Save, tempDir);
var moduleBuilder1 = assemblyBuilder1.DefineDynamicModule ("Repro55681-2a", "Repro55681-2a.dll");
var typeBuilder1 = moduleBuilder1.DefineType ("MyAttr", TypeAttributes.Public, typeof (Attribute));
ConstructorBuilder ctor = typeBuilder1.DefineDefaultConstructor (MethodAttributes.Public);
typeBuilder1.CreateType ();
var assemblyName2 = new AssemblyName ("Repro55681-2b");
var assemblyBuilder2 = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName2, AssemblyBuilderAccess.Save, tempDir);
var moduleBuilder2 = assemblyBuilder2.DefineDynamicModule ("Repro55681-2b", "Repro55681-2b.dll");
var typeBuilder2 = moduleBuilder2.DefineType ("Dummy", TypeAttributes.Public);
typeBuilder2.DefineDefaultConstructor (MethodAttributes.Public);
typeBuilder2.CreateType ();
assemblyBuilder2.SetCustomAttribute (new CustomAttributeBuilder (ctor, new object [] { }));
assemblyBuilder2.Save ("Repro55681-2b.dll");
assemblyBuilder1.Save ("Repro55681-2a.dll");
}
} }
} }

View File

@ -325,10 +325,14 @@ namespace MonoTests.System.Threading
} catch (ObjectDisposedException) { } catch (ObjectDisposedException) {
} }
try { bool throwOnDispose = false;
token.Register (() => { }); AppContext.TryGetSwitch ("Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource", out throwOnDispose);
Assert.Fail ("#3"); if (throwOnDispose) {
} catch (ObjectDisposedException) { try {
token.Register (() => { });
Assert.Fail ("#3");
} catch (ObjectDisposedException) {
}
} }
try { try {
@ -337,10 +341,12 @@ namespace MonoTests.System.Threading
} catch (ObjectDisposedException) { } catch (ObjectDisposedException) {
} }
try { if (throwOnDispose) {
CancellationTokenSource.CreateLinkedTokenSource (token); try {
Assert.Fail ("#5"); CancellationTokenSource.CreateLinkedTokenSource (token);
} catch (ObjectDisposedException) { Assert.Fail ("#5");
} catch (ObjectDisposedException) {
}
} }
try { try {

View File

@ -870,7 +870,6 @@ System.Threading.Tasks/DecoupledTask.cs
../Mono.Parallel/Mono.Threading/AtomicBoolean.cs ../Mono.Parallel/Mono.Threading/AtomicBoolean.cs
ReferenceSources/__ConsoleStream.cs ReferenceSources/__ConsoleStream.cs
ReferenceSources/AppContextSwitches.cs
ReferenceSources/Array.cs ReferenceSources/Array.cs
ReferenceSources/BCLDebug.cs ReferenceSources/BCLDebug.cs
ReferenceSources/CalendarData.cs ReferenceSources/CalendarData.cs
@ -1053,6 +1052,8 @@ ReferenceSources/Type.cs
../referencesource/mscorlib/system/version.cs ../referencesource/mscorlib/system/version.cs
../referencesource/mscorlib/system/AppContext/AppContext.cs ../referencesource/mscorlib/system/AppContext/AppContext.cs
../referencesource/mscorlib/system/AppContext/AppContextSwitches.cs
ReferenceSources/AppContextDefaultValues.cs
../referencesource/mscorlib/system/collections/arraylist.cs ../referencesource/mscorlib/system/collections/arraylist.cs
../referencesource/mscorlib/system/collections/bitarray.cs ../referencesource/mscorlib/system/collections/bitarray.cs

View File

@ -1 +1 @@
7994e5dac7692b46aba8982a568232486c9ab689 320d4a5e541cb9f48bd256bfb8f3f98ddbcbc1d6

View File

@ -49,13 +49,13 @@ namespace System
#endif #endif
#region Switch APIs #region Switch APIs
#if !MONO
static AppContext() static AppContext()
{ {
// populate the AppContext with the default set of values // populate the AppContext with the default set of values
AppContextDefaultValues.PopulateDefaultValues(); AppContextDefaultValues.PopulateDefaultValues();
} }
#endif
/// <summary> /// <summary>
/// Try to get the value of the switch. /// Try to get the value of the switch.
/// </summary> /// </summary>
@ -102,7 +102,6 @@ namespace System
{ {
return true; return true;
} }
#if !MONO
// 3. The switch has a valid value, but we need to check for overrides. // 3. The switch has a valid value, but we need to check for overrides.
// Regardless of whether or not the switch has an override, we need to update the value to reflect // Regardless of whether or not the switch has an override, we need to update the value to reflect
// the fact that we checked for overrides. // the fact that we checked for overrides.
@ -112,7 +111,6 @@ namespace System
// we found an override! // we found an override!
isEnabled = overrideValue; isEnabled = overrideValue;
} }
#endif
// Update the switch in the dictionary to mark it as 'checked for override' // Update the switch in the dictionary to mark it as 'checked for override'
s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue) s_switchMap[switchName] = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
| SwitchValueState.HasLookedForOverride; | SwitchValueState.HasLookedForOverride;
@ -132,7 +130,6 @@ namespace System
// In this case, we want to capture the fact that we looked for a value and found nothing by adding // In this case, we want to capture the fact that we looked for a value and found nothing by adding
// an entry in the dictionary with the 'sentinel' value of 'SwitchValueState.UnknownValue'. // an entry in the dictionary with the 'sentinel' value of 'SwitchValueState.UnknownValue'.
// Example: This will prevent us from trying to find overrides for values that we don't have in the dictionary // Example: This will prevent us from trying to find overrides for values that we don't have in the dictionary
#if !MONO
// 1. The value has an override specified. // 1. The value has an override specified.
bool overrideValue; bool overrideValue;
if (AppContextDefaultValues.TryGetSwitchOverride(switchName, out overrideValue)) if (AppContextDefaultValues.TryGetSwitchOverride(switchName, out overrideValue))
@ -145,7 +142,6 @@ namespace System
return true; return true;
} }
#endif
// 2. The value does not have an override. // 2. The value does not have an override.
s_switchMap[switchName] = SwitchValueState.UnknownValue; s_switchMap[switchName] = SwitchValueState.UnknownValue;
} }

View File

@ -11,6 +11,11 @@ namespace System
internal static class AppContextSwitches internal static class AppContextSwitches
{ {
#if MOBILE
public static readonly bool ThrowExceptionIfDisposedCancellationTokenSource = false;
public static readonly bool SetActorAsReferenceWhenCopyingClaimsIdentity = false;
public static readonly bool NoAsyncCurrentCulture = false;
#else
private static int _noAsyncCurrentCulture; private static int _noAsyncCurrentCulture;
public static bool NoAsyncCurrentCulture public static bool NoAsyncCurrentCulture
{ {
@ -120,5 +125,6 @@ namespace System
switchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/; switchValue = isSwitchEnabled ? 1 /*true*/ : -1 /*false*/;
return isSwitchEnabled; return isSwitchEnabled;
} }
#endif
} }
} }

View File

@ -147,6 +147,8 @@ namespace Mono.CilStripper {
for (int i = 0; i < methodTable.Rows.Count; i++) { for (int i = 0; i < methodTable.Rows.Count; i++) {
MethodRow methodRow = methodTable[i]; MethodRow methodRow = methodTable[i];
methodRow.ImplFlags |= MethodImplAttributes.NoInlining;
MetadataToken methodToken = MetadataToken.FromMetadataRow (TokenType.Method, i); MetadataToken methodToken = MetadataToken.FromMetadataRow (TokenType.Method, i);
MethodDefinition method = (MethodDefinition) assembly.MainModule.LookupByToken (methodToken); MethodDefinition method = (MethodDefinition) assembly.MainModule.LookupByToken (methodToken);

View File

@ -137,5 +137,8 @@ mono_dynimage_save_encode_marshal_blob (MonoDynamicImage *assembly, MonoReflecti
guint32 guint32
mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error); mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error);
guint32
mono_image_get_methodref_token (MonoDynamicImage *assembly, MonoMethod *method, gboolean create_typespec);
#endif /* __MONO_METADATA_SRE_INTERNALS_H__ */ #endif /* __MONO_METADATA_SRE_INTERNALS_H__ */

View File

@ -1 +1 @@
20d9e47a4a3945453e3fdd0d96653f273a3722c2 f430028e861594daad59c28c417cdc6ecc937005

View File

@ -1 +1 @@
276dd704cf9028688997bee53c1446b26dacbe41 7811483ae97cbb92b3dd2d062ba511dee9a0248c

View File

@ -878,7 +878,7 @@ EXTRA_DIST = TestDriver.cs \
Makefile.am.in Makefile.am.in
version.h: Makefile version.h: Makefile
echo "#define FULL_VERSION \"Stable 5.0.0.78/ba317ed\"" > version.h echo "#define FULL_VERSION \"Stable 5.0.0.94/1d0445b\"" > version.h
# Utility target for patching libtool to speed up linking # Utility target for patching libtool to speed up linking
patch-libtool: patch-libtool:

View File

@ -878,7 +878,7 @@ EXTRA_DIST = TestDriver.cs \
Makefile.am.in Makefile.am.in
version.h: Makefile version.h: Makefile
echo "#define FULL_VERSION \"Stable 5.0.0.78/ba317ed\"" > version.h echo "#define FULL_VERSION \"Stable 5.0.0.94/1d0445b\"" > version.h
# Utility target for patching libtool to speed up linking # Utility target for patching libtool to speed up linking
patch-libtool: patch-libtool:

View File

@ -1 +1 @@
43f05751d1510288b0377dca9681ef0ce35220e4 c56a1bc4df9e6127aab55d56ef2a1e6f03caccc9

View File

@ -887,11 +887,16 @@ mono_class_static_field_address (MonoDomain *domain, MonoClassField *field)
//printf ("SFLDA1 %p\n", (char*)vtable->data + field->offset); //printf ("SFLDA1 %p\n", (char*)vtable->data + field->offset);
if (domain->special_static_fields && (addr = g_hash_table_lookup (domain->special_static_fields, field))) if (field->offset == -1) {
/* Special static */
g_assert (domain->special_static_fields);
mono_domain_lock (domain);
addr = g_hash_table_lookup (domain->special_static_fields, field);
mono_domain_unlock (domain);
addr = mono_get_special_static_data (GPOINTER_TO_UINT (addr)); addr = mono_get_special_static_data (GPOINTER_TO_UINT (addr));
else } else {
addr = (char*)mono_vtable_get_static_field_data (vtable) + field->offset; addr = (char*)mono_vtable_get_static_field_data (vtable) + field->offset;
}
return addr; return addr;
} }

View File

@ -1 +1 @@
58964502b7fcbb47b0a892f7fc74319537b605ff 341b4b589b8237f2ce8bae1faf0d58cf3c93ae3c

View File

@ -1 +1 @@
#define FULL_VERSION "Stable 5.0.0.78/ba317ed" #define FULL_VERSION "Stable 5.0.0.94/1d0445b"

View File

@ -320,6 +320,7 @@ BASE_TEST_CS_SRC= \
generic-static-methods.2.cs \ generic-static-methods.2.cs \
generic-null-call.2.cs \ generic-null-call.2.cs \
generic-special.2.cs \ generic-special.2.cs \
generic-special2.2.cs \
generic-exceptions.2.cs \ generic-exceptions.2.cs \
generic-virtual2.2.cs \ generic-virtual2.2.cs \
generic-valuetype-interface.2.cs \ generic-valuetype-interface.2.cs \
@ -1645,6 +1646,7 @@ GSHARED_TESTS_SRC = \
generic-tailcall2.2.cs \ generic-tailcall2.2.cs \
generic-array-exc.2.cs \ generic-array-exc.2.cs \
generic-special.2.cs \ generic-special.2.cs \
generic-special2.2.cs \
generic-exceptions.2.cs \ generic-exceptions.2.cs \
generic-delegate2.2.cs \ generic-delegate2.2.cs \
generic-virtual2.2.cs \ generic-virtual2.2.cs \

View File

@ -820,6 +820,7 @@ BASE_TEST_CS_SRC = \
generic-static-methods.2.cs \ generic-static-methods.2.cs \
generic-null-call.2.cs \ generic-null-call.2.cs \
generic-special.2.cs \ generic-special.2.cs \
generic-special2.2.cs \
generic-exceptions.2.cs \ generic-exceptions.2.cs \
generic-virtual2.2.cs \ generic-virtual2.2.cs \
generic-valuetype-interface.2.cs \ generic-valuetype-interface.2.cs \
@ -1358,6 +1359,7 @@ GSHARED_TESTS_SRC = \
generic-tailcall2.2.cs \ generic-tailcall2.2.cs \
generic-array-exc.2.cs \ generic-array-exc.2.cs \
generic-special.2.cs \ generic-special.2.cs \
generic-special2.2.cs \
generic-exceptions.2.cs \ generic-exceptions.2.cs \
generic-delegate2.2.cs \ generic-delegate2.2.cs \
generic-virtual2.2.cs \ generic-virtual2.2.cs \

View File

@ -0,0 +1,54 @@
using System;
using System.Reflection;
using System.IO;
using System.Collections.Generic;
using System.Threading;
internal class GenericType<T> {
[ThreadStatic]
internal static object static_var;
public static void AccessStaticVar ()
{
if (static_var != null && static_var.GetType () != typeof (List<T>))
throw new Exception ("Corrupted static var");
GenericType<T>.static_var = new List<T> ();
}
}
public static class Program {
private static bool stress;
/* Create a lot of static vars */
private static void CreateVTables ()
{
Type[] nullArgs = new Type[0];
Assembly ass = Assembly.GetAssembly (typeof (int));
foreach (Type type in ass.GetTypes ()) {
try {
Type inst = typeof (GenericType<>).MakeGenericType (type);
Activator.CreateInstance (inst);
} catch {
}
}
}
private static void StressStaticFieldAddr ()
{
while (stress) {
GenericType<object>.AccessStaticVar ();
}
}
public static void Main (string[] args)
{
Thread thread = new Thread (StressStaticFieldAddr);
stress = true;
thread.Start ();
CreateVTables ();
stress = false;
thread.Join ();
}
}

Binary file not shown.

View File

@ -1 +1 @@
e24d53b5deb30e0255f8f5d1457e99298016ed65 fe984f75d8f3e8554069906e2f9ed049b94107f2

Binary file not shown.

View File

@ -1 +1 @@
9ad00c7bcea194d143236d71d8eca42f1d5bde49 5be88f319e820f726cfdfb5bb4ec2d9b7de97482

Binary file not shown.

View File

@ -1 +1 @@
8622211a0047f49ef23940df6e000e29f029a615 a659efad418c9664b8ee5d9b91f7903fc54fd732

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: mono 5.0.0\n" "Project-Id-Version: mono 5.0.0\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n" "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
"POT-Creation-Date: 2017-04-26 09:54+0000\n" "POT-Creation-Date: 2017-05-03 16:15+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

Binary file not shown.

View File

@ -1 +1 @@
255e57977118fef3187ede3a0ff62dd3a09ca217 f08602364bd40e296101f38b07540e1c9b41c7a2