Merge branch 'upstream'

Former-commit-id: 60f180c7ad2b5f4fef33e50fc7a51ef7b4f339a1
This commit is contained in:
Xamarin Public Jenkins (auto-signing) 2018-06-30 08:27:32 +00:00
commit 0b5e035096
45 changed files with 271 additions and 59 deletions

View File

@ -1 +1 @@
e789bf066e17b66380a6d80f845e05195c813c63
e94257dd53848925d89adc796d930eb14b964280

View File

@ -1 +1 @@
af067b29dfbfeb81540f1127a7bd9613dd7b0bfa
e3c358a667ccdb5f92cd6fd71f750b3abb8359c5

View File

@ -253,6 +253,10 @@ namespace Mono.Linker.Steps {
Tracer.Push (provider);
try {
foreach (CustomAttribute ca in provider.CustomAttributes) {
if (IsUserDependencyMarker (ca.AttributeType)) {
MarkUserDependency (provider as MethodReference, ca);
continue;
}
if (_context.KeepUsedAttributeTypesOnly) {
_lateMarkedAttributes.Enqueue (new AttributeProviderPair (ca, provider));
@ -268,6 +272,151 @@ namespace Mono.Linker.Steps {
}
}
protected virtual bool IsUserDependencyMarker (TypeReference type)
{
return type.Name == "PreserveDependencyAttribute" &&
type.Namespace == "System.Runtime.CompilerServices";
}
protected virtual void MarkUserDependency (MethodReference context, CustomAttribute ca)
{
var args = ca.ConstructorArguments;
if (args.Count == 2 && args[1].Value is string condition) {
switch (condition) {
case "":
case null:
break;
case "DEBUG":
if (!_context.KeepMembersForDebugger)
return;
break;
default:
// Don't have yet a way to match the general condition so everything is excluded
return;
}
}
if (args.Count >= 1 && args[0].Value is string dependency) {
string member = null;
string type = null;
string[] signature = null;
TypeDefinition td = null;
var sign_start = dependency.IndexOf ('(');
var sign_end = dependency.LastIndexOf (')');
if (sign_start > 0 && sign_end > sign_start) {
var parameters = dependency.Substring (sign_start + 1, sign_end - sign_start - 1).Replace (" ", "");
signature = string.IsNullOrEmpty (parameters) ? Array.Empty<string> () : parameters.Split (',');
var idx = dependency.LastIndexOf ('.', sign_start);
if (idx > 0) {
member = dependency.Substring (idx + 1, sign_start - idx - 1).TrimEnd ();
type = dependency.Substring (0, idx);
} else {
member = dependency.Substring (0, sign_start - 1);
td = context.DeclaringType.Resolve ();
}
} else if (sign_start < 0) {
var idx = dependency.LastIndexOf ('.');
if (idx > 0) {
member = dependency.Substring (idx + 1);
type = dependency.Substring (0, idx);
} else {
member = dependency;
td = context.DeclaringType.Resolve ();
}
}
if (td == null) {
if (type == null) {
_context.Logger.LogMessage (MessageImportance.Low, $"Could not resolve '{dependency}' dependency");
return;
}
td = FindType (context.Module.Assembly, type);
if (td == null) {
_context.Logger.LogMessage (MessageImportance.Low, $"Could not find '{dependency}' dependency");
return;
}
}
if (MarkDependencyMethod (td, member, signature))
return;
if (MarkDependencyField (td, member))
return;
_context.Logger.LogMessage (MessageImportance.High, $"Could not resolve dependency member '{member}' declared in type '{dependency}'");
}
}
static TypeDefinition FindType (AssemblyDefinition assembly, string fullName)
{
fullName = fullName.ToCecilName ();
var type = assembly.MainModule.GetType (fullName);
return type?.Resolve ();
}
bool MarkDependencyMethod (TypeDefinition type, string name, string[] signature)
{
bool marked = false;
int arity;
int arity_marker = name.IndexOf ('`');
if (arity_marker < 1 || !int.TryParse (name.Substring (arity_marker + 1), out arity)) {
arity = 0;
} else {
name = name.Substring (0, arity_marker);
}
foreach (var m in type.Methods) {
if (m.Name != name)
continue;
if (m.GenericParameters.Count != arity)
continue;
if (signature == null) {
MarkMethod (m);
marked = true;
continue;
}
var mp = m.Parameters;
if (mp.Count != signature.Length)
continue;
int i = 0;
for (; i < signature.Length; ++i) {
if (mp [i].ParameterType.FullName != signature [i].Trim ().ToCecilName ()) {
i = -1;
break;
}
}
if (i < 0)
continue;
MarkMethod (m);
marked = true;
}
return marked;
}
bool MarkDependencyField (TypeDefinition type, string name)
{
foreach (var f in type.Fields) {
if (f.Name == name) {
MarkField (f);
return true;
}
}
return false;
}
void LazyMarkCustomAttributes (ICustomAttributeProvider provider, AssemblyDefinition assembly)
{
if (!provider.HasCustomAttributes)
@ -303,15 +452,17 @@ namespace Mono.Linker.Steps {
protected virtual bool ShouldMarkCustomAttribute (CustomAttribute ca, ICustomAttributeProvider provider)
{
var attr_type = ca.AttributeType;
if (_context.KeepUsedAttributeTypesOnly) {
switch (ca.AttributeType.FullName) {
switch (attr_type.FullName) {
// [ThreadStatic] and [ContextStatic] are required by the runtime
case "System.ThreadStaticAttribute":
case "System.ContextStaticAttribute":
return true;
}
if (!Annotations.IsMarked (ca.AttributeType.Resolve ()))
if (!Annotations.IsMarked (attr_type.Resolve ()))
return false;
}
@ -872,7 +1023,7 @@ namespace Mono.Linker.Steps {
void MarkTypeWithDebuggerDisplayAttribute (TypeDefinition type, CustomAttribute attribute)
{
if (_context.KeepMembersForDebuggerAttributes) {
if (_context.KeepMembersForDebugger) {
string displayString = (string) attribute.ConstructorArguments[0].Value;
@ -926,7 +1077,7 @@ namespace Mono.Linker.Steps {
void MarkTypeWithDebuggerTypeProxyAttribute (TypeDefinition type, CustomAttribute attribute)
{
if (_context.KeepMembersForDebuggerAttributes) {
if (_context.KeepMembersForDebugger) {
object constructorArgument = attribute.ConstructorArguments[0].Value;
TypeReference proxyTypeReference = constructorArgument as TypeReference;
if (proxyTypeReference == null) {

View File

@ -154,6 +154,11 @@ namespace Mono.Linker.Steps {
{
while (iterator.MoveNext ()) {
XPathNavigator nav = iterator.Current;
var feature = GetAttribute (nav, "feature");
if (Context.IsFeatureExcluded (feature))
continue;
string fullname = GetFullName (nav);
if (IsTypePattern (fullname)) {

View File

@ -178,8 +178,9 @@ namespace Mono.Linker.Steps {
if (!AreSameReference (r.Name, target.Name))
continue;
ReferenceRemoved (assembly, references [i]);
references.RemoveAt (i);
ReferenceRemoved (assembly, reference);
// removal from `references` requires an adjustment to `i`
references.RemoveAt (i--);
// Removing the reference does not mean it will be saved back to disk!
// That depends on the AssemblyAction set for the `assembly`
switch (Annotations.GetAction (assembly)) {
@ -208,7 +209,6 @@ namespace Mono.Linker.Steps {
}
break;
}
return;
}
}

View File

@ -89,6 +89,7 @@ namespace Mono.Linker {
I18nAssemblies assemblies = I18nAssemblies.All;
var custom_steps = new List<string> ();
var excluded_features = new HashSet<string> ();
bool dumpDependencies = false;
bool resolver = false;
@ -136,7 +137,7 @@ namespace Mono.Linker {
context.KeepUsedAttributeTypesOnly = bool.Parse (GetParam ());
continue;
}
if (token == "--strip-security") {
if (bool.Parse (GetParam ()))
p.AddStepBefore (typeof (MarkStep), new RemoveSecurityStep ());
@ -148,6 +149,13 @@ namespace Mono.Linker {
continue;
}
if (token == "--exclude-feature") {
var name = GetParam ();
if (!excluded_features.Contains (name))
excluded_features.Add (name);
continue;
}
switch (token [2]) {
case 'v':
Version ();
@ -162,11 +170,10 @@ namespace Mono.Linker {
}
switch (token [1]) {
case 'd': {
case 'd':
DirectoryInfo info = new DirectoryInfo (GetParam ());
context.Resolver.AddSearchDirectory (info.FullName);
break;
}
break;
case 'o':
context.OutputDirectory = GetParam ();
break;
@ -219,11 +226,11 @@ namespace Mono.Linker {
p.RemoveStep (typeof (RegenerateGuidStep));
break;
case 'z':
if (!bool.Parse (GetParam ()))
p.RemoveStep (typeof (BlacklistStep));
break;
if (!bool.Parse (GetParam ()))
p.RemoveStep (typeof (BlacklistStep));
break;
case 'v':
context.KeepMembersForDebuggerAttributes = bool.Parse (GetParam ());
context.KeepMembersForDebugger = bool.Parse (GetParam ());
break;
default:
Usage ("Unknown option: `" + token [1] + "'");
@ -246,6 +253,12 @@ namespace Mono.Linker {
p.AddStepAfter (typeof (SweepStep), new AddBypassNGenStep ());
}
if (excluded_features.Count > 0) {
var excluded = new string [excluded_features.Count];
excluded_features.CopyTo (excluded);
context.ExcludedFeatures = excluded;
}
try {
p.Process (context);
}
@ -375,6 +388,7 @@ namespace Mono.Linker {
Console.WriteLine (" --used-attrs-only Attributes on types, methods, etc will be removed if the attribute type is not used");
Console.WriteLine (" --strip-security In linked assemblies, attributes on assemblies, types, and methods related to security will be removed");
Console.WriteLine (" --strip-resources Remove link xml resources that were processed (true or false), default to true");
Console.WriteLine (" --exclude-feature Any code which has feature-name dependency will be removed");
Console.WriteLine (" -out Specify the output directory, default to `output'");
Console.WriteLine (" -c Action on the core assemblies, skip, copy, copyused, addbypassngen, addbypassngenused or link, default to skip");
Console.WriteLine (" -u Action on the user assemblies, skip, copy, copyused, addbypassngen, addbypassngenused or link, default to link");
@ -384,7 +398,7 @@ namespace Mono.Linker {
Console.WriteLine (" -d Add a directory where the linker will look for assemblies");
Console.WriteLine (" -b Generate debug symbols for each linked module (true or false)");
Console.WriteLine (" -g Generate a new unique guid for each linked module (true or false)");
Console.WriteLine (" -v Keep memebers needed by debugger attributes (true or false)");
Console.WriteLine (" -v Keep members needed by debugger (true or false)");
Console.WriteLine (" -l List of i18n assemblies to copy to the output directory");
Console.WriteLine (" separated with a comma: none,all,cjk,mideast,other,rare,west");
Console.WriteLine (" default is all");

View File

@ -50,7 +50,7 @@ namespace Mono.Linker {
readonly Dictionary<string, string> _parameters;
bool _linkSymbols;
bool _keepTypeForwarderOnlyAssemblies;
bool _keepMembersForDebuggerAttributes;
bool _keepMembersForDebugger;
bool _ignoreUnresolved;
AssemblyResolver _resolver;
@ -95,10 +95,10 @@ namespace Mono.Linker {
set { _keepTypeForwarderOnlyAssemblies = value; }
}
public bool KeepMembersForDebuggerAttributes
public bool KeepMembersForDebugger
{
get { return _keepMembersForDebuggerAttributes; }
set { _keepMembersForDebuggerAttributes = value; }
get { return _keepMembersForDebugger; }
set { _keepMembersForDebugger = value; }
}
public bool IgnoreUnresolved
@ -135,7 +135,7 @@ namespace Mono.Linker {
set { _symbolWriterProvider = value; }
}
public bool LogMessages { get; set; } = false;
public bool LogMessages { get; set; }
public ILogger Logger { get; set; } = new ConsoleLogger ();
@ -143,6 +143,8 @@ namespace Mono.Linker {
public Tracer Tracer { get; private set; }
public string[] ExcludedFeatures { get; set; }
public LinkContext (Pipeline pipeline)
: this (pipeline, new AssemblyResolver ())
{
@ -179,7 +181,7 @@ namespace Mono.Linker {
public TypeDefinition GetType (string fullName)
{
int pos = fullName.IndexOf (",");
fullName = fullName.Replace ("+", "/");
fullName = TypeReferenceExtensions.ToCecilName (fullName);
if (pos == -1) {
foreach (AssemblyDefinition asm in GetAssemblies ()) {
var type = asm.MainModule.GetType (fullName);
@ -353,6 +355,11 @@ namespace Mono.Linker {
_resolver.Dispose ();
}
public bool IsFeatureExcluded (string featureName)
{
return ExcludedFeatures != null && Array.IndexOf (ExcludedFeatures, featureName) >= 0;
}
public void LogMessage (string message, params object[] values)
{
LogMessage (MessageImportance.Normal, message, values);

View File

@ -195,5 +195,10 @@ namespace Mono.Linker
return method;
}
public static string ToCecilName (this string fullTypeName)
{
return fullTypeName.Replace ('+', '/');
}
}
}

View File

@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "5.14.0.148";
public const string MonoVersion = "5.14.0.156";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@ -27,11 +27,16 @@ xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttri
ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES)
XTEST_REMOTE_EXECUTOR = $(topdir)/class/lib/$(PROFILE)/RemoteExecutorConsoleApp.exe
xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \
$(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \
$(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs
ifeq ($(PROFILE),monodroid)
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mobile.cs
else
xunit_src += $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs
endif
endif
xunit_class_deps :=

View File

@ -1 +1 @@
b81e5105b4a226b866e9d4b525c04d6024ed558b
6196c069b0580d9adc346e2dffa9e1fbc0b6e4f6

View File

@ -1 +1 @@
d562da103406d82c4e5700336bbb136672c0b595
7cd4ce8794c209e26f59d0c354d93fb9ae1f95db

View File

@ -1 +1 @@
8e12b0c40d4b90a82ade721f380a924720127548
40ab52f347643403188c38498f42091ef9f00d9c

View File

@ -1 +1 @@
1f42617e7b8e00a04125fc85967729855b0bbd3c
14839a10498c41b5b2bc637ff264e816bd2d87d0

View File

@ -1 +1 @@
fda09093e5973afedf30878b4b04bcdb9ce7302f
79b791d700de0970735b209e0d091d1a21787896

View File

@ -1 +1 @@
6cd85b1ade15d3d15c5d45f15729344bfc58f191
03f9e0b46c10b5712398a929c279cd9654a0393d

View File

@ -1 +1 @@
9aca22f64e9b0800a2247930d7d53ddb4570059f
9a030f23563302ff603ffee74a0dd6f89a4f8b15

View File

@ -1 +1 @@
b81e5105b4a226b866e9d4b525c04d6024ed558b
6196c069b0580d9adc346e2dffa9e1fbc0b6e4f6

View File

@ -1 +1 @@
d562da103406d82c4e5700336bbb136672c0b595
7cd4ce8794c209e26f59d0c354d93fb9ae1f95db

View File

@ -1 +1 @@
8e12b0c40d4b90a82ade721f380a924720127548
40ab52f347643403188c38498f42091ef9f00d9c

View File

@ -1 +1 @@
1f42617e7b8e00a04125fc85967729855b0bbd3c
14839a10498c41b5b2bc637ff264e816bd2d87d0

View File

@ -1 +1 @@
fda09093e5973afedf30878b4b04bcdb9ce7302f
79b791d700de0970735b209e0d091d1a21787896

View File

@ -1 +1 @@
6cd85b1ade15d3d15c5d45f15729344bfc58f191
03f9e0b46c10b5712398a929c279cd9654a0393d

View File

@ -1 +1 @@
9aca22f64e9b0800a2247930d7d53ddb4570059f
9a030f23563302ff603ffee74a0dd6f89a4f8b15

View File

@ -1 +1 @@
b81e5105b4a226b866e9d4b525c04d6024ed558b
6196c069b0580d9adc346e2dffa9e1fbc0b6e4f6

View File

@ -1 +1 @@
d562da103406d82c4e5700336bbb136672c0b595
7cd4ce8794c209e26f59d0c354d93fb9ae1f95db

View File

@ -1 +1 @@
8e12b0c40d4b90a82ade721f380a924720127548
40ab52f347643403188c38498f42091ef9f00d9c

View File

@ -1 +1 @@
1f42617e7b8e00a04125fc85967729855b0bbd3c
14839a10498c41b5b2bc637ff264e816bd2d87d0

View File

@ -1 +1 @@
fda09093e5973afedf30878b4b04bcdb9ce7302f
79b791d700de0970735b209e0d091d1a21787896

View File

@ -1 +1 @@
6cd85b1ade15d3d15c5d45f15729344bfc58f191
03f9e0b46c10b5712398a929c279cd9654a0393d

View File

@ -1 +1 @@
9aca22f64e9b0800a2247930d7d53ddb4570059f
9a030f23563302ff603ffee74a0dd6f89a4f8b15

View File

@ -1 +1 @@
9a373e74e3e122d1bcbac0be019806e52aac57b2
ebf1987abc74203d6caadcbc3789e810e096cc07

View File

@ -1 +1 @@
597d734e479aed50e4f157f42882c34019c3b62c
29fd7afd5944eff3d752cc8fbd292cedd4744fd0

View File

@ -1907,6 +1907,22 @@ ncells ) {
return dataPtr [0] == 1.0f ? 0 : 1;
}
class SimpleContainer {
public Simple simple1;
public Simple simple2;
public static Simple constsimple;
public int SetFields () {
constsimple.a = 0x1337;
simple1 = simple2 = constsimple;
return simple1.a - simple2.a;
}
}
public static int test_0_dup_vtype () {
return new SimpleContainer ().SetFields ();
}
}
#if __MOBILE__

View File

@ -1 +1 @@
#define FULL_VERSION "explicit/d0bb0ce"
#define FULL_VERSION "explicit/5a3352a"

View File

@ -99,6 +99,8 @@ typedef struct {
const char systemModel [100];
const char *systemManufacturer;
const char *eventType;
MonoStackHash hashes;
} MERPStruct;
@ -225,6 +227,7 @@ mono_encode_merp_params (MERPStruct *merp)
g_string_append_printf (output, "LanguageID: 0x%x\n", merp->uiLidArg);
g_string_append_printf (output, "SystemManufacturer: %s\n", merp->systemManufacturer);
g_string_append_printf (output, "SystemModel: %s\n", merp->systemModel);
g_string_append_printf (output, "EventType: %s\n", merp->eventType);
return g_string_free (output, FALSE);
}
@ -266,7 +269,7 @@ mono_merp_send (const char *merpFile, const char *crashLog, const char *werXml)
write_file (crashLog, crashLogPath);
g_free (crashLogPath);
char *werXmlPath = g_strdup_printf ("%s/Library/Group Containers/UBF8T346G9.ms/WERInternalMetadata.txt", home);
char *werXmlPath = g_strdup_printf ("%s/Library/Group Containers/UBF8T346G9.ms/CustomLogsMetadata.xml", home);
write_file (werXml, werXmlPath);
g_free (werXmlPath);
@ -339,6 +342,8 @@ mono_init_merp (const intptr_t crashed_pid, const char *signal, MonoStackHash *h
merp->systemManufacturer = "apple";
get_apple_model ((char *) merp->systemModel, sizeof (merp->systemModel));
merp->eventType = "MonoAppCrash";
merp->hashes = *hashes;
}
@ -415,6 +420,10 @@ mono_merp_fingerprint_payload (const char *non_param_data, const MERPStruct *mer
mono_json_writer_object_key(&writer, "SystemModel:");
mono_json_writer_printf (&writer, "\"%s\"\n", merp->systemModel);
mono_json_writer_indent (&writer);
mono_json_writer_object_key(&writer, "EventType:");
mono_json_writer_printf (&writer, "\"%s\"\n", merp->eventType);
// End of payload
mono_json_writer_indent (&writer);
mono_json_writer_object_end (&writer);
@ -444,7 +453,7 @@ mono_wer_template (MERPStruct *merp)
g_string_append_printf (output, "<?xml version=\"1.0\" encoding=\"UTF-16\"?>\n");
g_string_append_printf (output, "<WERReportMetadata>\n");
g_string_append_printf (output, "<ProblemSignatures>\n");
g_string_append_printf (output, "<EventType>MonoAppCrash</EventType>\n");
g_string_append_printf (output, "<EventType>%s</EventType>\n", merp->eventType);
int i=0;

Binary file not shown.

View File

@ -1 +1 @@
cf13e946b0ca24c9f81b985f48bfb79ad4be4145
89149d8dba318f0c744dbc08dceae0c7d65bcc34

Binary file not shown.

View File

@ -1 +1 @@
fd513a0cf57ccca8719e734438ca1c504ef26132
61f8dcbd5fbac920ac25a5b524d039a8099fa638

Binary file not shown.

View File

@ -1 +1 @@
3607588cbe016ea6780d62dbb000dd8f275929d2
999726fdcea18744c7110fc65c2296b4a1fcbff1

View File

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: mono 5.14.0.148\n"
"Project-Id-Version: mono 5.14.0.156\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
"POT-Creation-Date: 2018-06-28 08:03+0000\n"
"POT-Creation-Date: 2018-06-30 08:08+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

Binary file not shown.

View File

@ -1 +1 @@
aa5447eefa7b1263ac6fbfcf00dcda715382050d
89e3c11456d80d5823c9384bd77869e429171158