Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>2018-05-11 22:01:37 +0300
committerGitHub <noreply@github.com>2018-05-11 22:01:37 +0300
commitae10405baffdb976e81a376379e756d0d1656f95 (patch)
treed153164bef02eae6f7042a9534a512f40eae487c /src/ILCompiler.Compiler
parent11fb1db81109ccbe7f1a6d7c4a3158c90f5f0f55 (diff)
parente19bace28a18a0d39a451bb0f0dbd325551508e1 (diff)
Merge pull request #5801 from dotnet/master
Merge master to nmirror
Diffstat (limited to 'src/ILCompiler.Compiler')
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs49
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/MainMethodRootProvider.cs4
-rw-r--r--src/ILCompiler.Compiler/src/Compiler/NativeLibraryInitializerRootProvider.cs4
-rw-r--r--src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs4
-rw-r--r--src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/StartupCodeMainMethod.cs4
5 files changed, 13 insertions, 52 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs b/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs
index cf9222cb8..e970fdd76 100644
--- a/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs
@@ -2,12 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Collections.Generic;
using Internal.TypeSystem;
-using AssemblyName = System.Reflection.AssemblyName;
using Debug = System.Diagnostics.Debug;
namespace ILCompiler
@@ -17,37 +15,22 @@ namespace ILCompiler
/// </summary>
public sealed class LibraryInitializers
{
- private const string ClassLibraryPlaceHolderString = "*ClassLibrary*";
private const string LibraryInitializerContainerNamespaceName = "Internal.Runtime.CompilerHelpers";
private const string LibraryInitializerContainerTypeName = "LibraryInitializer";
private const string LibraryInitializerMethodName = "InitializeLibrary";
- private static readonly LibraryInitializerInfo[] s_assembliesWithLibraryInitializers =
- {
- new LibraryInitializerInfo(ClassLibraryPlaceHolderString),
- new LibraryInitializerInfo("System.Private.TypeLoader"),
- new LibraryInitializerInfo("System.Private.Reflection.Execution"),
- new LibraryInitializerInfo("System.Private.DeveloperExperience.Console"),
- new LibraryInitializerInfo("System.Private.Interop"),
- new LibraryInitializerInfo("System.Private.StackTraceMetadata"),
- };
-
private List<MethodDesc> _libraryInitializerMethods;
private readonly TypeSystemContext _context;
- private readonly bool _isCppCodeGen;
+ private IReadOnlyCollection<ModuleDesc> _librariesWithInitializers;
- public LibraryInitializers(TypeSystemContext context, bool isCppCodeGen)
+ public LibraryInitializers(TypeSystemContext context, IEnumerable<ModuleDesc> librariesWithInitalizers)
{
_context = context;
- //
- // We should not care which code-gen is being used but for the time being
- // this can be useful to workaround CppCodeGen bugs.
- //
- _isCppCodeGen = isCppCodeGen;
+ _librariesWithInitializers = new List<ModuleDesc>(librariesWithInitalizers);
}
- public IList<MethodDesc> LibraryInitializerMethods
+ public IReadOnlyCollection<MethodDesc> LibraryInitializerMethods
{
get
{
@@ -64,18 +47,8 @@ namespace ILCompiler
_libraryInitializerMethods = new List<MethodDesc>();
- foreach (var entry in s_assembliesWithLibraryInitializers)
+ foreach (var assembly in _librariesWithInitializers)
{
- if (_isCppCodeGen && !entry.UseWithCppCodeGen)
- continue;
-
- ModuleDesc assembly = entry.Assembly == ClassLibraryPlaceHolderString
- ? _context.SystemModule
- : _context.ResolveAssembly(new AssemblyName(entry.Assembly), false);
-
- if (assembly == null)
- continue;
-
TypeDesc containingType = assembly.GetType(LibraryInitializerContainerNamespaceName, LibraryInitializerContainerTypeName, false);
if (containingType == null)
continue;
@@ -87,17 +60,5 @@ namespace ILCompiler
_libraryInitializerMethods.Add(initializerMethod);
}
}
-
- private sealed class LibraryInitializerInfo
- {
- public string Assembly { get; }
- public bool UseWithCppCodeGen { get; }
-
- public LibraryInitializerInfo(string assembly, bool useWithCppCodeGen = true)
- {
- Assembly = assembly;
- UseWithCppCodeGen = useWithCppCodeGen;
- }
- }
}
}
diff --git a/src/ILCompiler.Compiler/src/Compiler/MainMethodRootProvider.cs b/src/ILCompiler.Compiler/src/Compiler/MainMethodRootProvider.cs
index 4df659ad8..2b716787b 100644
--- a/src/ILCompiler.Compiler/src/Compiler/MainMethodRootProvider.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/MainMethodRootProvider.cs
@@ -22,9 +22,9 @@ namespace ILCompiler
public const string ManagedEntryPointMethodName = "__managed__Main";
private EcmaModule _module;
- private IList<MethodDesc> _libraryInitializers;
+ private IReadOnlyCollection<MethodDesc> _libraryInitializers;
- public MainMethodRootProvider(EcmaModule module, IList<MethodDesc> libraryInitializers)
+ public MainMethodRootProvider(EcmaModule module, IReadOnlyCollection<MethodDesc> libraryInitializers)
{
_module = module;
_libraryInitializers = libraryInitializers;
diff --git a/src/ILCompiler.Compiler/src/Compiler/NativeLibraryInitializerRootProvider.cs b/src/ILCompiler.Compiler/src/Compiler/NativeLibraryInitializerRootProvider.cs
index 7f1e67700..4079a902b 100644
--- a/src/ILCompiler.Compiler/src/Compiler/NativeLibraryInitializerRootProvider.cs
+++ b/src/ILCompiler.Compiler/src/Compiler/NativeLibraryInitializerRootProvider.cs
@@ -21,9 +21,9 @@ namespace ILCompiler
public const string ManagedEntryPointMethodName = "__managed__Startup";
private ModuleDesc _module;
- private IList<MethodDesc> _libraryInitializers;
+ private IReadOnlyCollection<MethodDesc> _libraryInitializers;
- public NativeLibraryInitializerRootProvider(ModuleDesc module, IList<MethodDesc> libraryInitializers)
+ public NativeLibraryInitializerRootProvider(ModuleDesc module, IReadOnlyCollection<MethodDesc> libraryInitializers)
{
_module = module;
_libraryInitializers = libraryInitializers;
diff --git a/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs b/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
index 80bd691a0..b04e5e988 100644
--- a/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
+++ b/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
@@ -17,9 +17,9 @@ namespace Internal.IL.Stubs.StartupCode
{
private TypeDesc _owningType;
private MethodSignature _signature;
- private IList<MethodDesc> _libraryInitializers;
+ private IReadOnlyCollection<MethodDesc> _libraryInitializers;
- public NativeLibraryStartupMethod(TypeDesc owningType, IList<MethodDesc> libraryInitializers)
+ public NativeLibraryStartupMethod(TypeDesc owningType, IReadOnlyCollection<MethodDesc> libraryInitializers)
{
_owningType = owningType;
_libraryInitializers = libraryInitializers;
diff --git a/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/StartupCodeMainMethod.cs b/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
index f994a1d0a..fd16383f5 100644
--- a/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
+++ b/src/ILCompiler.Compiler/src/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
@@ -21,9 +21,9 @@ namespace Internal.IL.Stubs.StartupCode
private TypeDesc _owningType;
private MainMethodWrapper _mainMethod;
private MethodSignature _signature;
- private IList<MethodDesc> _libraryInitializers;
+ private IReadOnlyCollection<MethodDesc> _libraryInitializers;
- public StartupCodeMainMethod(TypeDesc owningType, MethodDesc mainMethod, IList<MethodDesc> libraryInitializers)
+ public StartupCodeMainMethod(TypeDesc owningType, MethodDesc mainMethod, IReadOnlyCollection<MethodDesc> libraryInitializers)
{
_owningType = owningType;
_mainMethod = new MainMethodWrapper(owningType, mainMethod);