Imported Upstream version 5.14.0.103
Former-commit-id: 486bd2a74e710211687006431be86dd9c935761f
This commit is contained in:
parent
c30f196079
commit
c34b058d3e
@ -1 +1 @@
|
||||
8dde0017e6f63b3054466a77bab8ef5722a54870
|
||||
a716110cdcded6f6c9a459907b56b1f4d6eeadbe
|
@ -1 +1 @@
|
||||
43264e0ee4e38c606242bd6d2a3541ca4b06049f
|
||||
1b47868002d8f5b8e4c85708dc50e855d259353b
|
2
external/linker/.gitignore
vendored
2
external/linker/.gitignore
vendored
@ -34,3 +34,5 @@ corebuild/global.json
|
||||
corebuild/**/bin
|
||||
corebuild/**/obj
|
||||
corebuild/testbin
|
||||
|
||||
monobuild/TestResults.xml
|
||||
|
@ -12,6 +12,7 @@ namespace Microsoft.NET.Build.Tasks
|
||||
internal class LockFileCache
|
||||
{
|
||||
private IBuildEngine4 _buildEngine;
|
||||
private static string s_taskObjectPrefix = null;
|
||||
|
||||
public LockFileCache(IBuildEngine4 buildEngine)
|
||||
{
|
||||
@ -45,7 +46,11 @@ namespace Microsoft.NET.Build.Tasks
|
||||
|
||||
private static string GetTaskObjectKey(string lockFilePath)
|
||||
{
|
||||
return $"{nameof(LockFileCache)}:{lockFilePath}";
|
||||
if (s_taskObjectPrefix == null)
|
||||
{
|
||||
s_taskObjectPrefix = typeof(LockFile).AssemblyQualifiedName;
|
||||
}
|
||||
return $"{s_taskObjectPrefix}:{lockFilePath}";
|
||||
}
|
||||
|
||||
private LockFile LoadLockFile(string path)
|
||||
|
@ -47,7 +47,7 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
try {
|
||||
Context.LogMessage ("Processing resource linker descriptor: {0}", name);
|
||||
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetResolveStep (name));
|
||||
AddToPipeline (GetResolveStep (name));
|
||||
} catch (XmlException ex) {
|
||||
/* This could happen if some broken XML file is included. */
|
||||
Context.LogMessage ("Error processing {0}: {1}", name, ex);
|
||||
@ -64,7 +64,7 @@ namespace Mono.Linker.Steps {
|
||||
try {
|
||||
Context.LogMessage ("Processing embedded resource linker descriptor: {0}", rsc.Name);
|
||||
|
||||
Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc, asm));
|
||||
AddToPipeline (GetExternalResolveStep (rsc, asm));
|
||||
} catch (XmlException ex) {
|
||||
/* This could happen if some broken XML file is embedded. */
|
||||
Context.LogMessage ("Error processing {0}: {1}", rsc.Name, ex);
|
||||
@ -108,6 +108,11 @@ namespace Mono.Linker.Steps {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected virtual void AddToPipeline (IStep resolveStep)
|
||||
{
|
||||
Context.Pipeline.AddStepAfter (typeof (BlacklistStep), resolveStep);
|
||||
}
|
||||
|
||||
protected virtual IStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
|
||||
{
|
||||
return new ResolveFromXmlStep (GetExternalDescriptor (resource), resource.Name, assembly, "resource " + resource.Name + " in " + assembly.FullName);
|
||||
|
@ -27,7 +27,7 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
using System.Linq;
|
||||
using Mono.Cecil;
|
||||
|
||||
namespace Mono.Linker.Steps {
|
||||
@ -46,7 +46,7 @@ namespace Mono.Linker.Steps {
|
||||
protected override bool ConditionToProcess ()
|
||||
{
|
||||
return _assemblies != I18nAssemblies.None &&
|
||||
Type.GetType ("System.MonoType") != null;
|
||||
Context.GetAssemblies ().FirstOrDefault (a => a.Name.Name == "mscorlib")?.MainModule.GetType ("System.MonoType") != null;
|
||||
}
|
||||
|
||||
protected override void Process()
|
||||
|
@ -49,6 +49,8 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
_references.Add (assembly.Name, assembly);
|
||||
|
||||
Context.RegisterAssembly (assembly);
|
||||
|
||||
foreach (AssemblyDefinition referenceDefinition in Context.ResolveReferences (assembly)) {
|
||||
try {
|
||||
ProcessReferences (referenceDefinition);
|
||||
|
208
external/linker/linker/Linker.Steps/MarkStep.cs
vendored
208
external/linker/linker/Linker.Steps/MarkStep.cs
vendored
@ -43,10 +43,8 @@ namespace Mono.Linker.Steps {
|
||||
protected LinkContext _context;
|
||||
protected Queue<MethodDefinition> _methods;
|
||||
protected List<MethodDefinition> _virtual_methods;
|
||||
protected Dictionary<TypeDefinition, CustomAttribute> _assemblyDebuggerDisplayAttributes;
|
||||
protected Dictionary<TypeDefinition, CustomAttribute> _assemblyDebuggerTypeProxyAttributes;
|
||||
protected Queue<CustomAttribute> _topLevelAttributes;
|
||||
protected Queue<CustomAttribute> _lateMarkedAttributes;
|
||||
protected Queue<AttributeProviderPair> _assemblyLevelAttributes;
|
||||
protected Queue<AttributeProviderPair> _lateMarkedAttributes;
|
||||
|
||||
public AnnotationStore Annotations {
|
||||
get { return _context.Annotations; }
|
||||
@ -62,11 +60,8 @@ namespace Mono.Linker.Steps {
|
||||
{
|
||||
_methods = new Queue<MethodDefinition> ();
|
||||
_virtual_methods = new List<MethodDefinition> ();
|
||||
_topLevelAttributes = new Queue<CustomAttribute> ();
|
||||
_lateMarkedAttributes = new Queue<CustomAttribute> ();
|
||||
|
||||
_assemblyDebuggerDisplayAttributes = new Dictionary<TypeDefinition, CustomAttribute> ();
|
||||
_assemblyDebuggerTypeProxyAttributes = new Dictionary<TypeDefinition, CustomAttribute> ();
|
||||
_assemblyLevelAttributes = new Queue<AttributeProviderPair> ();
|
||||
_lateMarkedAttributes = new Queue<AttributeProviderPair> ();
|
||||
}
|
||||
|
||||
public virtual void Process (LinkContext context)
|
||||
@ -260,9 +255,9 @@ namespace Mono.Linker.Steps {
|
||||
foreach (CustomAttribute ca in provider.CustomAttributes) {
|
||||
|
||||
if (_context.KeepUsedAttributeTypesOnly) {
|
||||
_lateMarkedAttributes.Enqueue (ca);
|
||||
_lateMarkedAttributes.Enqueue (new AttributeProviderPair (ca, provider));
|
||||
} else {
|
||||
if (!ShouldMarkCustomAttribute (ca))
|
||||
if (!ShouldMarkCustomAttribute (ca, provider))
|
||||
continue;
|
||||
|
||||
MarkCustomAttribute (ca);
|
||||
@ -273,13 +268,13 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
}
|
||||
|
||||
void LazyMarkCustomAttributes (ICustomAttributeProvider provider)
|
||||
void LazyMarkCustomAttributes (ICustomAttributeProvider provider, AssemblyDefinition assembly)
|
||||
{
|
||||
if (!provider.HasCustomAttributes)
|
||||
return;
|
||||
|
||||
foreach (CustomAttribute ca in provider.CustomAttributes)
|
||||
_topLevelAttributes.Enqueue (ca);
|
||||
_assemblyLevelAttributes.Enqueue (new AttributeProviderPair (ca, assembly));
|
||||
}
|
||||
|
||||
protected virtual void MarkCustomAttribute (CustomAttribute ca)
|
||||
@ -306,7 +301,7 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool ShouldMarkCustomAttribute (CustomAttribute ca)
|
||||
protected virtual bool ShouldMarkCustomAttribute (CustomAttribute ca, ICustomAttributeProvider provider)
|
||||
{
|
||||
if (_context.KeepUsedAttributeTypesOnly) {
|
||||
switch (ca.AttributeType.FullName) {
|
||||
@ -323,16 +318,27 @@ namespace Mono.Linker.Steps {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool ShouldMarkTopLevelCustomAttribute (CustomAttribute ca, MethodDefinition resolvedConstructor)
|
||||
protected virtual bool ShouldMarkTopLevelCustomAttribute (AttributeProviderPair app, MethodDefinition resolvedConstructor)
|
||||
{
|
||||
if (!ShouldMarkCustomAttribute (ca))
|
||||
var ca = app.Attribute;
|
||||
|
||||
if (!ShouldMarkCustomAttribute (app.Attribute, app.Provider))
|
||||
return false;
|
||||
|
||||
// If an attribute's module has not been marked after processing all types in all assemblies and the attribute itself has not been marked,
|
||||
// then surely nothing is using this attribute and there is no need to mark it
|
||||
if (!Annotations.IsMarked (resolvedConstructor.Module) && !Annotations.IsMarked (ca.AttributeType))
|
||||
return false;
|
||||
|
||||
|
||||
if (ca.Constructor.DeclaringType.Namespace == "System.Diagnostics") {
|
||||
string attributeName = ca.Constructor.DeclaringType.Name;
|
||||
if (attributeName == "DebuggerDisplayAttribute" || attributeName == "DebuggerTypeProxyAttribute") {
|
||||
var displayTargetType = GetDebuggerAttributeTargetType (app.Attribute, (AssemblyDefinition) app.Provider);
|
||||
if (displayTargetType == null || !Annotations.IsMarked (displayTargetType))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -541,7 +547,7 @@ namespace Mono.Linker.Steps {
|
||||
MarkSecurityDeclarations (assembly);
|
||||
|
||||
foreach (ModuleDefinition module in assembly.Modules)
|
||||
LazyMarkCustomAttributes (module);
|
||||
LazyMarkCustomAttributes (module, assembly);
|
||||
}
|
||||
|
||||
void ProcessModule (AssemblyDefinition assembly)
|
||||
@ -560,15 +566,16 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
bool ProcessLazyAttributes ()
|
||||
{
|
||||
var startingQueueCount = _topLevelAttributes.Count;
|
||||
var startingQueueCount = _assemblyLevelAttributes.Count;
|
||||
if (startingQueueCount == 0)
|
||||
return false;
|
||||
|
||||
var skippedItems = new List<CustomAttribute> ();
|
||||
var skippedItems = new List<AttributeProviderPair> ();
|
||||
var markOccurred = false;
|
||||
|
||||
while (_topLevelAttributes.Count != 0) {
|
||||
var customAttribute = _topLevelAttributes.Dequeue ();
|
||||
while (_assemblyLevelAttributes.Count != 0) {
|
||||
var assemblyLevelAttribute = _assemblyLevelAttributes.Dequeue ();
|
||||
var customAttribute = assemblyLevelAttribute.Attribute;
|
||||
|
||||
var resolved = customAttribute.Constructor.Resolve ();
|
||||
if (resolved == null) {
|
||||
@ -576,18 +583,28 @@ namespace Mono.Linker.Steps {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ShouldMarkTopLevelCustomAttribute (customAttribute, resolved)) {
|
||||
skippedItems.Add (customAttribute);
|
||||
if (!ShouldMarkTopLevelCustomAttribute (assemblyLevelAttribute, resolved)) {
|
||||
skippedItems.Add (assemblyLevelAttribute);
|
||||
continue;
|
||||
}
|
||||
|
||||
string attributeFullName = customAttribute.Constructor.DeclaringType.FullName;
|
||||
switch (attributeFullName) {
|
||||
case "System.Diagnostics.DebuggerDisplayAttribute":
|
||||
MarkTypeWithDebuggerDisplayAttribute (GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider), customAttribute);
|
||||
break;
|
||||
case "System.Diagnostics.DebuggerTypeProxyAttribute":
|
||||
MarkTypeWithDebuggerTypeProxyAttribute (GetDebuggerAttributeTargetType (assemblyLevelAttribute.Attribute, (AssemblyDefinition) assemblyLevelAttribute.Provider), customAttribute);
|
||||
break;
|
||||
}
|
||||
|
||||
markOccurred = true;
|
||||
MarkCustomAttribute (customAttribute);
|
||||
}
|
||||
|
||||
// requeue the items we skipped in case we need to make another pass
|
||||
foreach (var item in skippedItems)
|
||||
_topLevelAttributes.Enqueue (item);
|
||||
_assemblyLevelAttributes.Enqueue (item);
|
||||
|
||||
return markOccurred;
|
||||
}
|
||||
@ -598,11 +615,12 @@ namespace Mono.Linker.Steps {
|
||||
if (startingQueueCount == 0)
|
||||
return false;
|
||||
|
||||
var skippedItems = new List<CustomAttribute> ();
|
||||
var skippedItems = new List<AttributeProviderPair> ();
|
||||
var markOccurred = false;
|
||||
|
||||
while (_lateMarkedAttributes.Count != 0) {
|
||||
var customAttribute = _lateMarkedAttributes.Dequeue ();
|
||||
var attributeProviderPair = _lateMarkedAttributes.Dequeue ();
|
||||
var customAttribute = attributeProviderPair.Attribute;
|
||||
|
||||
var resolved = customAttribute.Constructor.Resolve ();
|
||||
if (resolved == null) {
|
||||
@ -610,8 +628,8 @@ namespace Mono.Linker.Steps {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ShouldMarkCustomAttribute (customAttribute)) {
|
||||
skippedItems.Add (customAttribute);
|
||||
if (!ShouldMarkCustomAttribute (customAttribute, attributeProviderPair.Provider)) {
|
||||
skippedItems.Add (attributeProviderPair);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -771,59 +789,38 @@ namespace Mono.Linker.Steps {
|
||||
if (!assembly.HasCustomAttributes)
|
||||
return;
|
||||
|
||||
foreach (CustomAttribute attribute in assembly.CustomAttributes) {
|
||||
string attributeFullName = attribute.Constructor.DeclaringType.FullName;
|
||||
switch (attributeFullName) {
|
||||
case "System.Diagnostics.DebuggerDisplayAttribute":
|
||||
StoreDebuggerTypeTarget (assembly, attribute, _assemblyDebuggerDisplayAttributes);
|
||||
break;
|
||||
case "System.Diagnostics.DebuggerTypeProxyAttribute":
|
||||
StoreDebuggerTypeTarget (assembly, attribute, _assemblyDebuggerTypeProxyAttributes);
|
||||
break;
|
||||
default:
|
||||
_topLevelAttributes.Enqueue (attribute);
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (CustomAttribute attribute in assembly.CustomAttributes)
|
||||
_assemblyLevelAttributes.Enqueue (new AttributeProviderPair (attribute, assembly));
|
||||
}
|
||||
|
||||
void StoreDebuggerTypeTarget (AssemblyDefinition assembly, CustomAttribute attribute, Dictionary<TypeDefinition, CustomAttribute> dictionary)
|
||||
TypeDefinition GetDebuggerAttributeTargetType (CustomAttribute ca, AssemblyDefinition asm)
|
||||
{
|
||||
if (_context.KeepMembersForDebuggerAttributes) {
|
||||
TypeReference targetTypeReference = null;
|
||||
TypeDefinition targetTypeDefinition = null;
|
||||
foreach (var property in attribute.Properties) {
|
||||
if (property.Name == "Target") {
|
||||
targetTypeReference = (TypeReference) property.Argument.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (property.Name == "TargetTypeName") {
|
||||
targetTypeReference = assembly.MainModule.GetType ((string) property.Argument.Value);
|
||||
break;
|
||||
}
|
||||
TypeReference targetTypeReference = null;
|
||||
foreach (var property in ca.Properties) {
|
||||
if (property.Name == "Target") {
|
||||
targetTypeReference = (TypeReference) property.Argument.Value;
|
||||
break;
|
||||
}
|
||||
|
||||
if (targetTypeReference != null) {
|
||||
targetTypeDefinition = ResolveTypeDefinition (targetTypeReference);
|
||||
if (targetTypeDefinition != null) {
|
||||
dictionary[targetTypeDefinition] = attribute;
|
||||
if (property.Name == "TargetTypeName") {
|
||||
if (TypeNameParser.TryParseTypeAssemblyQualifiedName ((string) property.Argument.Value, out string typeName, out string assemblyName)) {
|
||||
if (string.IsNullOrEmpty (assemblyName))
|
||||
targetTypeReference = asm.MainModule.GetType (typeName);
|
||||
else
|
||||
targetTypeReference = _context.GetAssemblies ().FirstOrDefault (a => a.Name.Name == assemblyName)?.MainModule.GetType (typeName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (targetTypeReference != null)
|
||||
return ResolveTypeDefinition (targetTypeReference);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
void MarkTypeSpecialCustomAttributes (TypeDefinition type)
|
||||
{
|
||||
CustomAttribute debuggerAttribute;
|
||||
if (_assemblyDebuggerDisplayAttributes.TryGetValue (type, out debuggerAttribute)) {
|
||||
MarkTypeWithDebuggerDisplayAttribute (type, debuggerAttribute);
|
||||
}
|
||||
|
||||
if (_assemblyDebuggerTypeProxyAttributes.TryGetValue (type, out debuggerAttribute)) {
|
||||
MarkTypeWithDebuggerTypeProxyAttribute (type, debuggerAttribute);
|
||||
}
|
||||
|
||||
if (!type.HasCustomAttributes)
|
||||
return;
|
||||
|
||||
@ -1161,7 +1158,7 @@ namespace Mono.Linker.Steps {
|
||||
MarkMethodCollection (type.Methods);
|
||||
}
|
||||
|
||||
protected TypeDefinition ResolveTypeDefinition (TypeReference type)
|
||||
protected static TypeDefinition ResolveTypeDefinition (TypeReference type)
|
||||
{
|
||||
TypeDefinition td = type as TypeDefinition;
|
||||
if (td == null)
|
||||
@ -1636,6 +1633,7 @@ namespace Mono.Linker.Steps {
|
||||
MarkSomethingUsedViaReflection ("GetProperty", MarkPropertyUsedViaReflection, body.Instructions);
|
||||
MarkSomethingUsedViaReflection ("GetField", MarkFieldUsedViaReflection, body.Instructions);
|
||||
MarkSomethingUsedViaReflection ("GetEvent", MarkEventUsedViaReflection, body.Instructions);
|
||||
MarkTypeUsedViaReflection (body.Instructions);
|
||||
}
|
||||
|
||||
protected virtual void MarkInstruction (Instruction instruction)
|
||||
@ -1684,22 +1682,30 @@ namespace Mono.Linker.Steps {
|
||||
MarkType (iface.InterfaceType);
|
||||
}
|
||||
|
||||
bool CheckReflectionMethod (Instruction instruction, string reflectionMethod)
|
||||
{
|
||||
if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt)
|
||||
return false;
|
||||
|
||||
var methodBeingCalled = instruction.Operand as MethodReference;
|
||||
if (methodBeingCalled == null || methodBeingCalled.DeclaringType.Name != "Type" || methodBeingCalled.DeclaringType.Namespace != "System")
|
||||
return false;
|
||||
|
||||
if (methodBeingCalled.Name != reflectionMethod)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MarkSomethingUsedViaReflection (string reflectionMethod, Action<Collection<Instruction>, string, TypeDefinition, BindingFlags> markMethod, Collection<Instruction> instructions)
|
||||
{
|
||||
for (var i = 0; i < instructions.Count; i++) {
|
||||
var instruction = instructions [i];
|
||||
if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt)
|
||||
|
||||
if (!CheckReflectionMethod (instruction, reflectionMethod))
|
||||
continue;
|
||||
|
||||
var methodBeingCalled = instruction.Operand as MethodReference;
|
||||
if (methodBeingCalled == null || methodBeingCalled.DeclaringType.Name != "Type" || methodBeingCalled.DeclaringType.Namespace != "System")
|
||||
continue;
|
||||
|
||||
if (methodBeingCalled.Name != reflectionMethod)
|
||||
continue;
|
||||
|
||||
_context.Tracer.Push ($"Reflection-{methodBeingCalled}");
|
||||
_context.Tracer.Push ($"Reflection-{instruction.Operand as MethodReference}");
|
||||
var nameOfThingUsedViaReflection = OperandOfNearestInstructionBefore<string> (i, OpCodes.Ldstr, instructions);
|
||||
var bindingFlags = (BindingFlags) OperandOfNearestInstructionBefore<sbyte> (i, OpCodes.Ldc_I4_S, instructions);
|
||||
|
||||
@ -1715,6 +1721,35 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
}
|
||||
|
||||
void MarkTypeUsedViaReflection (Collection<Instruction> instructions)
|
||||
{
|
||||
for (var i = 0; i < instructions.Count; i++) {
|
||||
var instruction = instructions [i];
|
||||
|
||||
if (!CheckReflectionMethod (instruction, "GetType"))
|
||||
continue;
|
||||
|
||||
_context.Tracer.Push ($"Reflection-{instruction.Operand as MethodReference}");
|
||||
var typeAssemblyQualifiedName = OperandOfNearestInstructionBefore<string> (i, OpCodes.Ldstr, instructions);
|
||||
|
||||
if (!TypeNameParser.TryParseTypeAssemblyQualifiedName (typeAssemblyQualifiedName, out string typeName, out string assemblyName))
|
||||
continue;
|
||||
|
||||
foreach (var assemblyDefinition in _context.GetAssemblies ()) {
|
||||
if (assemblyName != null && assemblyDefinition.Name.Name != assemblyName)
|
||||
continue;
|
||||
|
||||
var type = assemblyDefinition.MainModule.GetType (typeName);
|
||||
if (type != null)
|
||||
{
|
||||
MarkType(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_context.Tracer.Pop ();
|
||||
}
|
||||
}
|
||||
|
||||
void MarkConstructorsUsedViaReflection (Collection<Instruction> instructions, string unused, TypeDefinition declaringType, BindingFlags bindingFlags)
|
||||
{
|
||||
foreach (var method in declaringType.Methods) {
|
||||
@ -1796,6 +1831,17 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
return operands;
|
||||
}
|
||||
|
||||
protected class AttributeProviderPair {
|
||||
public AttributeProviderPair (CustomAttribute attribute, ICustomAttributeProvider provider)
|
||||
{
|
||||
Attribute = attribute;
|
||||
Provider = provider;
|
||||
}
|
||||
|
||||
public CustomAttribute Attribute { get; private set; }
|
||||
public ICustomAttributeProvider Provider { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
// Make our own copy of the BindingFlags enum, so that we don't depend on System.Reflection.
|
||||
|
@ -245,6 +245,12 @@ namespace Mono.Linker.Steps {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Annotations.IsMarked (type)) {
|
||||
var existingLevel = Annotations.IsPreserved (type) ? Annotations.GetPreserve (type) : TypePreserve.Nothing;
|
||||
var duplicateLevel = preserve != TypePreserve.Nothing ? preserve : nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All;
|
||||
Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {type.FullName} ({existingLevel}). Duplicate uses ({duplicateLevel})");
|
||||
}
|
||||
|
||||
Annotations.MarkAndPush (type);
|
||||
Tracer.AddDirectDependency (this, type);
|
||||
|
||||
@ -341,10 +347,14 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
void MarkField (TypeDefinition type, FieldDefinition field, string signature)
|
||||
{
|
||||
if (field != null)
|
||||
if (field != null) {
|
||||
if (Annotations.IsMarked (field))
|
||||
Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {field.FullName}");
|
||||
|
||||
Annotations.Mark (field);
|
||||
else
|
||||
} else {
|
||||
AddUnresolveMarker (string.Format ("T: {0}; F: {1}", type, signature));
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessFieldName (TypeDefinition type, string name)
|
||||
@ -357,7 +367,7 @@ namespace Mono.Linker.Steps {
|
||||
MarkField (type, field, name);
|
||||
}
|
||||
|
||||
static FieldDefinition GetField (TypeDefinition type, string signature)
|
||||
protected static FieldDefinition GetField (TypeDefinition type, string signature)
|
||||
{
|
||||
if (!type.HasFields)
|
||||
return null;
|
||||
@ -407,6 +417,9 @@ namespace Mono.Linker.Steps {
|
||||
|
||||
void MarkMethod (MethodDefinition method)
|
||||
{
|
||||
if (Annotations.IsMarked (method))
|
||||
Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {method.FullName}");
|
||||
|
||||
Annotations.Mark (method);
|
||||
Tracer.AddDirectDependency (this, method);
|
||||
Annotations.SetAction (method, MethodAction.Parse);
|
||||
@ -485,6 +498,9 @@ namespace Mono.Linker.Steps {
|
||||
void MarkEvent (TypeDefinition type, EventDefinition @event, string signature)
|
||||
{
|
||||
if (@event != null) {
|
||||
if (Annotations.IsMarked (@event))
|
||||
Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {@event.FullName}");
|
||||
|
||||
Annotations.Mark (@event);
|
||||
|
||||
MarkMethod (@event.AddMethod);
|
||||
@ -504,7 +520,7 @@ namespace Mono.Linker.Steps {
|
||||
MarkEvent (type, @event, name);
|
||||
}
|
||||
|
||||
static EventDefinition GetEvent (TypeDefinition type, string signature)
|
||||
protected static EventDefinition GetEvent (TypeDefinition type, string signature)
|
||||
{
|
||||
if (!type.HasEvents)
|
||||
return null;
|
||||
@ -547,6 +563,9 @@ namespace Mono.Linker.Steps {
|
||||
void MarkProperty (TypeDefinition type, PropertyDefinition property, string signature, string[] accessors)
|
||||
{
|
||||
if (property != null) {
|
||||
if (Annotations.IsMarked (property))
|
||||
Context.LogMessage ($"Duplicate preserve in {_xmlDocumentLocation} of {property.FullName}");
|
||||
|
||||
Annotations.Mark (property);
|
||||
|
||||
MarkPropertyAccessors (type, property, accessors);
|
||||
@ -585,7 +604,7 @@ namespace Mono.Linker.Steps {
|
||||
MarkProperty (type, property, name, accessors);
|
||||
}
|
||||
|
||||
static PropertyDefinition GetProperty (TypeDefinition type, string signature)
|
||||
protected static PropertyDefinition GetProperty (TypeDefinition type, string signature)
|
||||
{
|
||||
if (!type.HasProperties)
|
||||
return null;
|
||||
@ -641,7 +660,7 @@ namespace Mono.Linker.Steps {
|
||||
return GetAttribute (nav, _fullname);
|
||||
}
|
||||
|
||||
static string[] GetAccessors (XPathNavigator nav)
|
||||
protected static string[] GetAccessors (XPathNavigator nav)
|
||||
{
|
||||
string accessorsValue = GetAttribute (nav, _accessors);
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace Mono.Linker.Steps {
|
||||
}
|
||||
}
|
||||
|
||||
void SweepAssembly (AssemblyDefinition assembly)
|
||||
protected virtual void SweepAssembly (AssemblyDefinition assembly)
|
||||
{
|
||||
switch (Annotations.GetAction (assembly)) {
|
||||
case AssemblyAction.Link:
|
||||
|
8
external/linker/linker/Linker/Driver.cs
vendored
8
external/linker/linker/Linker/Driver.cs
vendored
@ -246,7 +246,13 @@ namespace Mono.Linker {
|
||||
p.AddStepAfter (typeof (SweepStep), new AddBypassNGenStep ());
|
||||
}
|
||||
|
||||
p.Process (context);
|
||||
try {
|
||||
p.Process (context);
|
||||
}
|
||||
finally {
|
||||
if (dumpDependencies)
|
||||
context.Tracer.Finish ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
25
external/linker/linker/Linker/LinkContext.cs
vendored
25
external/linker/linker/Linker/LinkContext.cs
vendored
@ -212,10 +212,8 @@ namespace Mono.Linker {
|
||||
try {
|
||||
AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters);
|
||||
|
||||
if (assembly != null && SeenFirstTime (assembly)) {
|
||||
SafeReadSymbols (assembly);
|
||||
SetAction (assembly);
|
||||
}
|
||||
if (assembly != null)
|
||||
RegisterAssembly (assembly);
|
||||
|
||||
return assembly;
|
||||
}
|
||||
@ -224,6 +222,14 @@ namespace Mono.Linker {
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterAssembly (AssemblyDefinition assembly)
|
||||
{
|
||||
if (SeenFirstTime (assembly)) {
|
||||
SafeReadSymbols (assembly);
|
||||
SetAction (assembly);
|
||||
}
|
||||
}
|
||||
|
||||
protected bool SeenFirstTime (AssemblyDefinition assembly)
|
||||
{
|
||||
return !_annotations.HasAction (assembly);
|
||||
@ -245,8 +251,15 @@ namespace Mono.Linker {
|
||||
if (symbolReader == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
assembly.MainModule.ReadSymbols (symbolReader);
|
||||
} catch {
|
||||
symbolReader.Dispose ();
|
||||
return;
|
||||
}
|
||||
|
||||
// Add symbol reader to annotations only if we have successfully read it
|
||||
_annotations.AddSymbolReader (assembly, symbolReader);
|
||||
assembly.MainModule.ReadSymbols (symbolReader);
|
||||
} catch { }
|
||||
}
|
||||
|
||||
@ -289,7 +302,7 @@ namespace Mono.Linker {
|
||||
_annotations.SetAction (assembly, action);
|
||||
}
|
||||
|
||||
static bool IsCore (AssemblyNameReference name)
|
||||
public static bool IsCore (AssemblyNameReference name)
|
||||
{
|
||||
switch (name.Name) {
|
||||
case "mscorlib":
|
||||
|
1
external/linker/linker/Linker/Tracer.cs
vendored
1
external/linker/linker/Linker/Tracer.cs
vendored
@ -58,6 +58,7 @@ namespace Mono.Linker
|
||||
|
||||
if (string.IsNullOrEmpty (Path.GetDirectoryName (DependenciesFileName)) && !string.IsNullOrEmpty (context.OutputDirectory)) {
|
||||
DependenciesFileName = Path.Combine (context.OutputDirectory, DependenciesFileName);
|
||||
Directory.CreateDirectory (context.OutputDirectory);
|
||||
}
|
||||
|
||||
var depsFile = File.OpenWrite (DependenciesFileName);
|
||||
|
48
external/linker/linker/Linker/TypeNameParser.cs
vendored
Normal file
48
external/linker/linker/Linker/TypeNameParser.cs
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
|
||||
namespace Mono.Linker {
|
||||
public static class TypeNameParser {
|
||||
public static bool TryParseTypeAssemblyQualifiedName (string value, out string typeName, out string assemblyName) {
|
||||
if (string.IsNullOrEmpty (value)) {
|
||||
typeName = null;
|
||||
assemblyName = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
//Filter the assembly qualified name down to the basic type by removing pointer, reference, and array markers on the type
|
||||
//We must also convert nested types from + to / to match cecil's formatting
|
||||
value = value
|
||||
.Replace ('+', '/')
|
||||
.Replace ("*", string.Empty)
|
||||
.Replace ("&", string.Empty);
|
||||
|
||||
while (value.IndexOf ('[') > 0) {
|
||||
var openidx = value.IndexOf ('[');
|
||||
var closeidx = value.IndexOf (']');
|
||||
|
||||
// No matching close ] or out of order
|
||||
if (closeidx < 0 || closeidx < openidx) {
|
||||
typeName = null;
|
||||
assemblyName = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
value = value.Remove (openidx, closeidx + 1 - openidx);
|
||||
}
|
||||
|
||||
var tokens = value.Split (',');
|
||||
typeName = tokens [0].Trim ();
|
||||
assemblyName = null;
|
||||
if (tokens.Length > 1)
|
||||
assemblyName = tokens [1].Trim ();
|
||||
|
||||
if (string.IsNullOrWhiteSpace (typeName)) {
|
||||
typeName = null;
|
||||
assemblyName = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
1
external/linker/linker/Mono.Linker.csproj
vendored
1
external/linker/linker/Mono.Linker.csproj
vendored
@ -93,6 +93,7 @@
|
||||
<Compile Include="Linker\Pipeline.cs" />
|
||||
<Compile Include="Linker\TypePreserve.cs" />
|
||||
<Compile Include="Linker\TypeReferenceExtensions.cs" />
|
||||
<Compile Include="Linker\TypeNameParser.cs" />
|
||||
<Compile Include="Linker\XApiReader.cs" />
|
||||
<Compile Include="Linker.Steps\TypeMapStep.cs" />
|
||||
<Compile Include="Linker\ILogger.cs" />
|
||||
|
@ -34,7 +34,7 @@ static class Consts
|
||||
// Use these assembly version constants to make code more maintainable.
|
||||
//
|
||||
|
||||
public const string MonoVersion = "5.14.0.100";
|
||||
public const string MonoVersion = "5.14.0.103";
|
||||
public const string MonoCompany = "Mono development team";
|
||||
public const string MonoProduct = "Mono Common Language Infrastructure";
|
||||
public const string MonoCopyright = "(c) Various Mono authors";
|
||||
|
@ -339,7 +339,6 @@ namespace MonoTests.System.Threading.Tasks
|
||||
bool result = false;
|
||||
|
||||
Func<int, int> func = (i) => {
|
||||
Assert.IsTrue (Thread.CurrentThread.IsThreadPoolThread);
|
||||
result = true; return i + 3;
|
||||
};
|
||||
|
||||
@ -445,14 +444,12 @@ namespace MonoTests.System.Threading.Tasks
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MacNotWorking")] // Randomly fails - https://bugzilla.xamarin.com/show_bug.cgi?id=51255
|
||||
public void FromAsync_Completed ()
|
||||
{
|
||||
var completed = new CompletedAsyncResult ();
|
||||
bool? valid = null;
|
||||
|
||||
Action<IAsyncResult> end = l => {
|
||||
Assert.IsFalse (Thread.CurrentThread.IsThreadPoolThread, "#2");
|
||||
valid = l == completed;
|
||||
};
|
||||
Task task = factory.FromAsync (completed, end);
|
||||
@ -557,7 +554,6 @@ namespace MonoTests.System.Threading.Tasks
|
||||
factory = new TaskFactory (scheduler);
|
||||
|
||||
Task task = factory.FromAsync (result, l => {
|
||||
Assert.IsTrue (Thread.CurrentThread.IsThreadPoolThread, "#6");
|
||||
called = true;
|
||||
}, TaskCreationOptions.AttachedToParent);
|
||||
|
||||
@ -582,8 +578,6 @@ namespace MonoTests.System.Threading.Tasks
|
||||
if ((TaskCreationOptions) c != TaskCreationOptions.AttachedToParent)
|
||||
Assert.Fail ("#11");
|
||||
|
||||
Assert.IsFalse (Thread.CurrentThread.IsThreadPoolThread, "#12");
|
||||
|
||||
called2 = true;
|
||||
var ar = Task.CompletedTask;
|
||||
b.Invoke (ar);
|
||||
|
@ -1 +1 @@
|
||||
387874c33279821ecf4c3c65c4b6be0fbf4530ca
|
||||
1fce0633a2a5188d412fa7bed6596cdbf46eed99
|
@ -1 +1 @@
|
||||
94a0e366dc7a3a32249f013acdb108113871c9f0
|
||||
5df81156024fc164400114fca16e4f834ba26389
|
@ -1 +1 @@
|
||||
b29ac60ca35d1e9dae87583d2b7183dd9bc0e356
|
||||
e394ddb4f7e90f8160b816ceb2f3ddfd6ec43b20
|
@ -1 +1 @@
|
||||
dce6045ebed689ee7cc0cf98225aa3474f3eb3d8
|
||||
c9706b15a376f8937072f1dfbd168d1058896a6e
|
@ -1 +1 @@
|
||||
fa787623a7ef5d34d480976111f5791b0d92c4a8
|
||||
c34d1c37d97cfc74cfd58b908db37dba0cc12f68
|
@ -1 +1 @@
|
||||
80f27b413640ff25223e654724f276a4c6925abc
|
||||
7df9781615674ecdde80b8234d890a4ff3983533
|
@ -1 +1 @@
|
||||
ffde4cb2ef12a7462c5b6e336ae8c5e27f8b79ed
|
||||
45fc2f719b760217c096d2e896ae9a39a2f6c446
|
@ -1 +1 @@
|
||||
387874c33279821ecf4c3c65c4b6be0fbf4530ca
|
||||
1fce0633a2a5188d412fa7bed6596cdbf46eed99
|
@ -1 +1 @@
|
||||
94a0e366dc7a3a32249f013acdb108113871c9f0
|
||||
5df81156024fc164400114fca16e4f834ba26389
|
@ -1 +1 @@
|
||||
b29ac60ca35d1e9dae87583d2b7183dd9bc0e356
|
||||
e394ddb4f7e90f8160b816ceb2f3ddfd6ec43b20
|
@ -1 +1 @@
|
||||
dce6045ebed689ee7cc0cf98225aa3474f3eb3d8
|
||||
c9706b15a376f8937072f1dfbd168d1058896a6e
|
@ -1 +1 @@
|
||||
fa787623a7ef5d34d480976111f5791b0d92c4a8
|
||||
c34d1c37d97cfc74cfd58b908db37dba0cc12f68
|
@ -1 +1 @@
|
||||
80f27b413640ff25223e654724f276a4c6925abc
|
||||
7df9781615674ecdde80b8234d890a4ff3983533
|
@ -1 +1 @@
|
||||
ffde4cb2ef12a7462c5b6e336ae8c5e27f8b79ed
|
||||
45fc2f719b760217c096d2e896ae9a39a2f6c446
|
@ -1 +1 @@
|
||||
387874c33279821ecf4c3c65c4b6be0fbf4530ca
|
||||
1fce0633a2a5188d412fa7bed6596cdbf46eed99
|
@ -1 +1 @@
|
||||
94a0e366dc7a3a32249f013acdb108113871c9f0
|
||||
5df81156024fc164400114fca16e4f834ba26389
|
@ -1 +1 @@
|
||||
b29ac60ca35d1e9dae87583d2b7183dd9bc0e356
|
||||
e394ddb4f7e90f8160b816ceb2f3ddfd6ec43b20
|
@ -1 +1 @@
|
||||
dce6045ebed689ee7cc0cf98225aa3474f3eb3d8
|
||||
c9706b15a376f8937072f1dfbd168d1058896a6e
|
@ -1 +1 @@
|
||||
fa787623a7ef5d34d480976111f5791b0d92c4a8
|
||||
c34d1c37d97cfc74cfd58b908db37dba0cc12f68
|
@ -1 +1 @@
|
||||
80f27b413640ff25223e654724f276a4c6925abc
|
||||
7df9781615674ecdde80b8234d890a4ff3983533
|
@ -1 +1 @@
|
||||
ffde4cb2ef12a7462c5b6e336ae8c5e27f8b79ed
|
||||
45fc2f719b760217c096d2e896ae9a39a2f6c446
|
@ -18,6 +18,7 @@
|
||||
../../../external/linker/linker/Linker/MarkException.cs
|
||||
../../../external/linker/linker/Linker/MethodReferenceExtensions.cs
|
||||
../../../external/linker/linker/Linker/MarkingHelpers.cs
|
||||
../../../external/linker/linker/Linker/TypeNameParser.cs
|
||||
../../../external/linker/linker/Linker/Tracer.cs
|
||||
../../../external/linker/linker/Linker.Steps/BaseStep.cs
|
||||
../../../external/linker/linker/Linker.Steps/LoadReferencesStep.cs
|
||||
|
@ -1 +1 @@
|
||||
2076561604c744a9962b1d7c8730136b7c0c977c
|
||||
6fc683409abfde2a99a06268c825e77dcc16edcd
|
@ -1 +1 @@
|
||||
#define FULL_VERSION "explicit/46e3bd5"
|
||||
#define FULL_VERSION "explicit/8c55e41"
|
||||
|
BIN
po/mcs/de.gmo
BIN
po/mcs/de.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
83af2976a93b0983251f67c0ea05e5287c80e184
|
||||
7724023d7bbd0c27a29e20cfd192b6f0c87f8e46
|
BIN
po/mcs/es.gmo
BIN
po/mcs/es.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
f1f65123a870f0cedc5c52aa1d95d1b55de05f15
|
||||
4541123f4a3b60c078f9453b0aee658b5d9f84d8
|
BIN
po/mcs/ja.gmo
BIN
po/mcs/ja.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
96d403b13912cb1f80d597268bd150ef3450f798
|
||||
69665d4daa34511c8358f5081b675ed8491a37ed
|
@ -6,9 +6,9 @@
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: mono 5.14.0.100\n"
|
||||
"Project-Id-Version: mono 5.14.0.103\n"
|
||||
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
|
||||
"POT-Creation-Date: 2018-05-24 08:55+0000\n"
|
||||
"POT-Creation-Date: 2018-05-25 08:15+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"
|
||||
|
BIN
po/mcs/pt_BR.gmo
BIN
po/mcs/pt_BR.gmo
Binary file not shown.
@ -1 +1 @@
|
||||
8af8d403183ca79d00c207dd9a703ba567d6b6b2
|
||||
8a5f460a338d9e65fe7009b48441ceac63a6fa5d
|
Loading…
x
Reference in New Issue
Block a user