Imported Upstream version 6.6.0.89

Former-commit-id: b39a328747c2f3414dc52e009fb6f0aa80ca2492
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-09-24 08:53:40 +00:00
parent cf815e07e0
commit 95fdb59ea6
2556 changed files with 138145 additions and 47453 deletions

View File

@@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<!-- net46 build is disabled until cecil uses SDK-style projects. -->
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);FEATURE_ILLINK</DefineConstants>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<Compile Include="ClearInitLocals.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\linker\Mono.Linker.csproj" />
<ProjectReference Include="..\..\external\cecil\Mono.Cecil.csproj" />
</ItemGroup>
</Project>

View File

@@ -83,9 +83,6 @@
Condition=" '$(TargetFramework)' == 'netcoreapp2.0' " />
<ProjectReference Include="../../external/cecil/Mono.Cecil.csproj"
PrivateAssets="All" />
<ProjectReference Include="../ILLink.CustomSteps/ILLink.CustomSteps.csproj"
PrivateAssets="All"
Condition=" '$(TargetFramework)' == 'netcoreapp2.0' " />
</ItemGroup>
<ItemGroup>

View File

@@ -181,9 +181,7 @@ namespace ILLink.Tasks
args.Append ("-out ").AppendLine (Quote (OutputDirectory.ItemSpec));
if (ClearInitLocals) {
args.Append ("-s ");
// Version of ILLink.CustomSteps is passed as a workaround for msbuild issue #3016
args.AppendLine ("ILLink.CustomSteps.ClearInitLocalsStep,ILLink.CustomSteps,Version=0.0.0.0:OutputStep");
args.AppendLine ("--enable-opt clearinitlocals");
if ((ClearInitLocalsAssemblies != null) && (ClearInitLocalsAssemblies.Length > 0)) {
args.Append ("-m ClearInitLocalsAssemblies ");
args.AppendLine (ClearInitLocalsAssemblies);

View File

@@ -1,5 +1,6 @@
using System;
using Mono.Cecil;
using System.Linq;
public static class Utils
{
@@ -7,9 +8,16 @@ public static class Utils
{
try {
ModuleDefinition module = ModuleDefinition.ReadModule (fileName);
return true;
return !IsCPPCLIAssembly (module);
} catch (BadImageFormatException) {
return false;
}
}
private static bool IsCPPCLIAssembly (ModuleDefinition module)
{
return module.Types.Any(t =>
t.Namespace == "<CppImplementationDetails>" ||
t.Namespace == "<CrtImplementationDetails>");
}
}

View File

@@ -93,6 +93,7 @@ namespace Mono.Linker.Steps {
case AssemblyAction.Link:
case AssemblyAction.AddBypassNGen:
case AssemblyAction.AddBypassNGenUsed:
case AssemblyAction.Copy:
return true;
default:
return false;

View File

@@ -5,7 +5,7 @@ using Mono.Linker;
using Mono.Linker.Steps;
using Mono.Cecil;
namespace ILLink.CustomSteps
namespace Mono.Linker.Steps
{
public class ClearInitLocalsStep : BaseStep
{

File diff suppressed because it is too large Load Diff

View File

@@ -408,10 +408,16 @@ namespace Mono.Linker {
case "unreachablebodies":
context.DisabledOptimizations &= ~CodeOptimizations.UnreachableBodies;
break;
case "clearinitlocals":
context.DisabledOptimizations &= ~CodeOptimizations.ClearInitLocals;
break;
}
}
}
if (context.IsOptimizationEnabled (CodeOptimizations.ClearInitLocals))
p.AddStepBefore (typeof (OutputStep), new ClearInitLocalsStep ());
PreProcessPipeline (p);
try {
@@ -574,6 +580,8 @@ namespace Mono.Linker {
Console.WriteLine (" beforefieldinit: Unused static fields are removed if there is no static ctor");
Console.WriteLine (" overrideremoval: Overrides of virtual methods on types that are never instantiated are removed");
Console.WriteLine (" unreachablebodies: Instance methods that are marked but can never be entered are converted to throws");
Console.WriteLine (" --enable-opt <name> Enable one of the non-default optimizations");
Console.WriteLine (" clearinitlocals: Remove initlocals");
Console.WriteLine (" --exclude-feature <name> Any code which has a feature <name> in linked assemblies will be removed");
Console.WriteLine (" com: Support for COM Interop");
Console.WriteLine (" etw: Event Tracing for Windows");

View File

@@ -188,6 +188,7 @@ namespace Mono.Linker {
// See https://github.com/mono/linker/issues/612
DisabledOptimizations |= CodeOptimizations.UnreachableBodies;
DisabledOptimizations |= CodeOptimizations.ClearInitLocals;
}
public TypeDefinition GetType (string fullName)
@@ -420,6 +421,11 @@ namespace Mono.Linker {
/// <summary>
/// Option to disable delaying marking of instance methods until an instance of that type could exist
/// </summary>
UnreachableBodies = 1 << 2
UnreachableBodies = 1 << 2,
/// <summary>
/// Option to clear the initlocals flag on methods
/// </summary>
ClearInitLocals = 1 << 3
}
}

View File

@@ -150,7 +150,7 @@ namespace Mono.Linker {
foreach (var genericParameter in provider.GenericParameters) {
foreach (var constraint in genericParameter.Constraints)
AddIfResolved (set, constraint);
AddIfResolved (set, constraint.ConstraintType);
}
}

View File

@@ -13,12 +13,11 @@
<AssemblyName>monolinker</AssemblyName>
<AssemblyTitle>Mono.Linker</AssemblyTitle>
<Description>Mono CIL Linker</Description>
<TargetFrameworks>net462</TargetFrameworks>
<TargetFrameworks>net471</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<RootNamespace>Mono</RootNamespace>
<Copyright>(C) 2006, Jb Evain</Copyright>
<Version>0.2.0.0</Version>
@@ -33,61 +32,6 @@
<Optimize Condition=" '$(Optimize)' == '' ">true</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="Linker.Steps\BaseStep.cs" />
<Compile Include="Linker.Steps\BlacklistStep.cs" />
<Compile Include="Linker.Steps\CleanStep.cs" />
<Compile Include="Linker.Steps\RegenerateGuidStep.cs" />
<Compile Include="Linker.Steps\LoadI18nAssemblies.cs" />
<Compile Include="Linker.Steps\RemoveSecurityStep.cs" />
<Compile Include="Linker\Inflater.cs" />
<Compile Include="Linker\MethodBodyScanner.cs" />
<Compile Include="Linker\IXApiVisitor.cs" />
<Compile Include="Linker\I18nAssemblies.cs" />
<Compile Include="Linker.Steps\IStep.cs" />
<Compile Include="Linker.Steps\LoadReferencesStep.cs" />
<Compile Include="Linker.Steps\MarkStep.cs" />
<Compile Include="Linker.Steps\OutputStep.cs" />
<Compile Include="Linker.Steps\ResolveFromXApiStep.cs" />
<Compile Include="Linker.Steps\ResolveFromAssemblyStep.cs" />
<Compile Include="Linker.Steps\ResolveFromXmlStep.cs" />
<Compile Include="Linker.Steps\ResolveStep.cs" />
<Compile Include="Linker.Steps\SweepStep.cs" />
<Compile Include="Linker.Steps\AddBypassNGenStep.cs" />
<Compile Include="Linker\Annotations.cs" />
<Compile Include="Linker\AssemblyAction.cs" />
<Compile Include="Linker\AssemblyInfo.cs" />
<Compile Include="Linker\AssemblyResolver.cs" />
<Compile Include="Linker\AssemblyUtilities.cs" />
<Compile Include="Linker\DirectoryAssemblyResolver.cs" />
<Compile Include="Linker\Driver.cs" />
<Compile Include="Linker\LinkContext.cs" />
<Compile Include="Linker\LoadException.cs" />
<Compile Include="Linker\MarkException.cs" />
<Compile Include="Linker\MarkingHelpers.cs" />
<Compile Include="Linker\MethodAction.cs" />
<Compile Include="Linker\MethodReferenceExtensions.cs" />
<Compile Include="Linker\OverrideInformation.cs" />
<Compile Include="Linker\Pipeline.cs" />
<Compile Include="Linker\TypeDefinitionExtensions.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" />
<Compile Include="Linker\ConsoleLogger.cs" />
<Compile Include="Linker\Tracer.cs" />
<Compile Include="Linker.Steps\PreserveDependencyLookupStep.cs" />
<Compile Include="Linker.Steps\PreserveCalendarsStep.cs" />
<Compile Include="Linker.Steps\RemoveFeaturesStep.cs" />
<Compile Include="Linker.Steps\CodeRewriterStep.cs" />
<Compile Include="Linker.Steps\ReflectionBlockedStep.cs" />
<Compile Include="Linker\KnownMembers.cs" />
<Compile Include="Linker\BCL.cs" />
<Compile Include="Linker\MethodDefinitionExtensions.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\external\cecil\Mono.Cecil.csproj" />
<ProjectReference Include="..\..\external\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj" />