diff options
author | Manu <manu-silicon@users.noreply.github.com> | 2015-11-19 10:03:32 +0300 |
---|---|---|
committer | Manu <manu-silicon@users.noreply.github.com> | 2015-11-20 03:52:22 +0300 |
commit | c73d50897f1efd55caeaab5ced4dab70bd14e02b (patch) | |
tree | 44db008a14aee8ed6e02c86124114b4a6f7d8f6f /src/ILCompiler.Compiler | |
parent | 6225d128ceb619e3d579986a36e20703fe7772bd (diff) |
Updated formatting
Using the https://github.com/dotnet/codeformatter tool with the
following command line:
/rule-:FieldNames,ReadonlyFields ILCompiler.sln
Diffstat (limited to 'src/ILCompiler.Compiler')
40 files changed, 309 insertions, 294 deletions
diff --git a/src/ILCompiler.Compiler/src/Compiler/AsmStringWriter.cs b/src/ILCompiler.Compiler/src/Compiler/AsmStringWriter.cs index cdad7f965..fe48ee492 100644 --- a/src/ILCompiler.Compiler/src/Compiler/AsmStringWriter.cs +++ b/src/ILCompiler.Compiler/src/Compiler/AsmStringWriter.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +9,7 @@ using System.Threading.Tasks; namespace ILCompiler { - class AsmStringWriter + internal class AsmStringWriter { private Encoding _stringEncoding; @@ -15,7 +18,7 @@ namespace ILCompiler public AsmStringWriter(Action<byte> byteWriter) { this.WriteByte = byteWriter; - this._stringEncoding = UTF8Encoding.UTF8; + _stringEncoding = UTF8Encoding.UTF8; } public void WriteUInt32(uint value) diff --git a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs index d8bd3d6cb..de87016b6 100644 --- a/src/ILCompiler.Compiler/src/Compiler/Compilation.cs +++ b/src/ILCompiler.Compiler/src/Compiler/Compilation.cs @@ -30,20 +30,20 @@ namespace ILCompiler public partial class Compilation { - readonly CompilerTypeSystemContext _typeSystemContext; - readonly CompilationOptions _options; - - NodeFactory _nodeFactory; - DependencyAnalyzerBase<NodeFactory> _dependencyGraph; + private readonly CompilerTypeSystemContext _typeSystemContext; + private readonly CompilationOptions _options; - Dictionary<TypeDesc, RegisteredType> _registeredTypes = new Dictionary<TypeDesc, RegisteredType>(); - Dictionary<MethodDesc, RegisteredMethod> _registeredMethods = new Dictionary<MethodDesc, RegisteredMethod>(); - Dictionary<FieldDesc, RegisteredField> _registeredFields = new Dictionary<FieldDesc, RegisteredField>(); - List<MethodDesc> _methodsThatNeedsCompilation = null; + private NodeFactory _nodeFactory; + private DependencyAnalyzerBase<NodeFactory> _dependencyGraph; - NameMangler _nameMangler = null; + private Dictionary<TypeDesc, RegisteredType> _registeredTypes = new Dictionary<TypeDesc, RegisteredType>(); + private Dictionary<MethodDesc, RegisteredMethod> _registeredMethods = new Dictionary<MethodDesc, RegisteredMethod>(); + private Dictionary<FieldDesc, RegisteredField> _registeredFields = new Dictionary<FieldDesc, RegisteredField>(); + private List<MethodDesc> _methodsThatNeedsCompilation = null; - ILCompiler.CppCodeGen.CppWriter _cppWriter = null; + private NameMangler _nameMangler = null; + + private ILCompiler.CppCodeGen.CppWriter _cppWriter = null; public Compilation(CompilerTypeSystemContext typeSystemContext, CompilationOptions options) { @@ -87,7 +87,7 @@ namespace ILCompiler set; } - MethodDesc _mainMethod; + private MethodDesc _mainMethod; internal MethodDesc MainMethod { @@ -107,7 +107,7 @@ namespace ILCompiler internal CompilationOptions Options { - get + get { return _options; } @@ -166,14 +166,14 @@ namespace ILCompiler return registration; } - ILProvider _ilProvider = new ILProvider(); + private ILProvider _ilProvider = new ILProvider(); public MethodIL GetMethodIL(MethodDesc method) { return _ilProvider.GetMethodIL(method); } - void CompileMethods() + private void CompileMethods() { var pendingMethods = _methodsThatNeedsCompilation; _methodsThatNeedsCompilation = null; @@ -181,10 +181,10 @@ namespace ILCompiler foreach (MethodDesc method in pendingMethods) { _cppWriter.CompileMethod(method); - } + } } - void ExpandVirtualMethods() + private void ExpandVirtualMethods() { // Take a snapshot of _registeredTypes - new registered types can be added during the expansion foreach (var reg in _registeredTypes.Values.ToArray()) @@ -211,7 +211,7 @@ namespace ILCompiler } } - CorInfoImpl _corInfo; + private CorInfoImpl _corInfo; public void CompileSingleFile(MethodDesc mainMethod) { @@ -228,7 +228,7 @@ namespace ILCompiler if (!_options.IsCppCodeGen) { - _nodeFactory = new NodeFactory(this._typeSystemContext); + _nodeFactory = new NodeFactory(_typeSystemContext); NodeFactory.NameMangler = NameMangler; // Choose which dependency graph implementation to use based on the amount of logging requested. @@ -578,10 +578,10 @@ namespace ILCompiler } } - struct ReadyToRunHelperKey : IEquatable<ReadyToRunHelperKey> + private struct ReadyToRunHelperKey : IEquatable<ReadyToRunHelperKey> { - ReadyToRunHelperId _id; - Object _obj; + private ReadyToRunHelperId _id; + private Object _obj; public ReadyToRunHelperKey(ReadyToRunHelperId id, Object obj) { @@ -608,7 +608,7 @@ namespace ILCompiler } } - Dictionary<ReadyToRunHelperKey, ReadyToRunHelper> _readyToRunHelpers = new Dictionary<ReadyToRunHelperKey, ReadyToRunHelper>(); + private Dictionary<ReadyToRunHelperKey, ReadyToRunHelper> _readyToRunHelpers = new Dictionary<ReadyToRunHelperKey, ReadyToRunHelper>(); public Object GetReadyToRunHelper(ReadyToRunHelperId id, Object target) { @@ -621,7 +621,7 @@ namespace ILCompiler return helper; } - Dictionary<JitHelperId, JitHelper> _jitHelpers = new Dictionary<JitHelperId, JitHelper>(); + private Dictionary<JitHelperId, JitHelper> _jitHelpers = new Dictionary<JitHelperId, JitHelper>(); public Object GetJitHelper(JitHelperId id) { JitHelper helper; @@ -632,7 +632,7 @@ namespace ILCompiler return helper; } - Dictionary<MethodDesc, DelegateInfo> _delegateInfos = new Dictionary<MethodDesc, DelegateInfo>(); + private Dictionary<MethodDesc, DelegateInfo> _delegateInfos = new Dictionary<MethodDesc, DelegateInfo>(); public DelegateInfo GetDelegateCtor(MethodDesc target) { DelegateInfo info; @@ -645,7 +645,7 @@ namespace ILCompiler return info; } - Dictionary<FieldDesc, RvaFieldData> _rvaFieldDatas = new Dictionary<FieldDesc, RvaFieldData>(); + private Dictionary<FieldDesc, RvaFieldData> _rvaFieldDatas = new Dictionary<FieldDesc, RvaFieldData>(); /// <summary> /// Gets an object representing the static data for RVA mapped fields from the PE image. diff --git a/src/ILCompiler.Compiler/src/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs b/src/ILCompiler.Compiler/src/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs index ac29d103f..01c26ac29 100644 --- a/src/ILCompiler.Compiler/src/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs +++ b/src/ILCompiler.Compiler/src/Compiler/CompilerMetadataFieldLayoutAlgorithm.cs @@ -8,7 +8,7 @@ using Internal.TypeSystem; namespace ILCompiler { - class CompilerMetadataFieldLayoutAlgorithm : MetadataFieldLayoutAlgorithm + internal class CompilerMetadataFieldLayoutAlgorithm : MetadataFieldLayoutAlgorithm { protected override void PrepareRuntimeSpecificStaticFieldLayout(TypeSystemContext context, ref ComputedStaticFieldLayout layout) { diff --git a/src/ILCompiler.Compiler/src/Compiler/CompilerTypeSystemContext.cs b/src/ILCompiler.Compiler/src/Compiler/CompilerTypeSystemContext.cs index 8fedc2a4a..89db6364c 100644 --- a/src/ILCompiler.Compiler/src/Compiler/CompilerTypeSystemContext.cs +++ b/src/ILCompiler.Compiler/src/Compiler/CompilerTypeSystemContext.cs @@ -18,7 +18,7 @@ namespace ILCompiler { public class CompilerTypeSystemContext : TypeSystemContext, IMetadataStringDecoderProvider { - static readonly string[] s_wellKnownTypeNames = new string[] { + private static readonly string[] s_wellKnownTypeNames = new string[] { "Void", "Boolean", "Char", @@ -51,22 +51,22 @@ namespace ILCompiler "Exception", }; - MetadataType[] _wellKnownTypes = new MetadataType[s_wellKnownTypeNames.Length]; + private MetadataType[] _wellKnownTypes = new MetadataType[s_wellKnownTypeNames.Length]; - MetadataFieldLayoutAlgorithm _metadataFieldLayoutAlgorithm = new CompilerMetadataFieldLayoutAlgorithm(); - MetadataRuntimeInterfacesAlgorithm _metadataRuntimeInterfacesAlgorithm = new MetadataRuntimeInterfacesAlgorithm(); - ArrayOfTRuntimeInterfacesAlgorithm _arrayOfTRuntimeInterfacesAlgorithm; + private MetadataFieldLayoutAlgorithm _metadataFieldLayoutAlgorithm = new CompilerMetadataFieldLayoutAlgorithm(); + private MetadataRuntimeInterfacesAlgorithm _metadataRuntimeInterfacesAlgorithm = new MetadataRuntimeInterfacesAlgorithm(); + private ArrayOfTRuntimeInterfacesAlgorithm _arrayOfTRuntimeInterfacesAlgorithm; - MetadataStringDecoder _metadataStringDecoder; + private MetadataStringDecoder _metadataStringDecoder; - Dictionary<string, EcmaModule> _modules = new Dictionary<string, EcmaModule>(StringComparer.OrdinalIgnoreCase); + private Dictionary<string, EcmaModule> _modules = new Dictionary<string, EcmaModule>(StringComparer.OrdinalIgnoreCase); - class ModuleData + private class ModuleData { public string Path; public Microsoft.DiaSymReader.ISymUnmanagedReader PdbReader; } - Dictionary<EcmaModule, ModuleData> _moduleData = new Dictionary<EcmaModule, ModuleData>(); + private Dictionary<EcmaModule, ModuleData> _moduleData = new Dictionary<EcmaModule, ModuleData>(); public CompilerTypeSystemContext(TargetDetails details) : base(details) @@ -201,7 +201,7 @@ namespace ILCompiler // Symbols // - PdbSymbolProvider _pdbSymbolProvider; + private PdbSymbolProvider _pdbSymbolProvider; private void InitializeSymbolReader(ModuleData moduleData) { @@ -209,7 +209,7 @@ namespace ILCompiler _pdbSymbolProvider = new PdbSymbolProvider(); moduleData.PdbReader = _pdbSymbolProvider.GetSymbolReaderForFile(moduleData.Path); - } + } public IEnumerable<ILSequencePoint> GetSequencePointsForMethod(MethodDesc method) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs index 135ff2efa..e5689f937 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ArrayOfEmbeddedDataNode.cs @@ -12,11 +12,11 @@ namespace ILCompiler.DependencyAnalysis { public class ArrayOfEmbeddedDataNode : ObjectNode { - HashSet<EmbeddedObjectNode> _nestedNodes = new HashSet<EmbeddedObjectNode>(); - List<EmbeddedObjectNode> _nestedNodesList = new List<EmbeddedObjectNode>(); - ObjectAndOffsetSymbolNode _startSymbol; - ObjectAndOffsetSymbolNode _endSymbol; - IComparer<EmbeddedObjectNode> _sorter; + private HashSet<EmbeddedObjectNode> _nestedNodes = new HashSet<EmbeddedObjectNode>(); + private List<EmbeddedObjectNode> _nestedNodesList = new List<EmbeddedObjectNode>(); + private ObjectAndOffsetSymbolNode _startSymbol; + private ObjectAndOffsetSymbolNode _endSymbol; + private IComparer<EmbeddedObjectNode> _sorter; public ArrayOfEmbeddedDataNode(string startSymbolMangledName, string endSymbolMangledName, IComparer<EmbeddedObjectNode> nodeSorter) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs index 75c34725b..1a839da1e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/BlobNode.cs @@ -5,10 +5,10 @@ namespace ILCompiler.DependencyAnalysis { public class BlobNode : ObjectNode, ISymbolNode { - string _name; - string _section; - byte[] _data; - int _alignment; + private string _name; + private string _section; + private byte[] _data; + private int _alignment; public BlobNode(string name, string section, byte[] data, int alignment) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs index 869eb7315..beaac9bc9 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EETypeNode.cs @@ -10,10 +10,10 @@ using Debug = System.Diagnostics.Debug; namespace ILCompiler.DependencyAnalysis { - class EETypeNode : ObjectNode, ISymbolNode + internal class EETypeNode : ObjectNode, ISymbolNode { - TypeDesc _type; - bool _constructed; + private TypeDesc _type; + private bool _constructed; public EETypeNode(TypeDesc type, bool constructed) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedObjectNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedObjectNode.cs index cb4f494a9..5a9a477f4 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedObjectNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/EmbeddedObjectNode.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs index 032074b06..5a749813e 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ExternSymbolNode.cs @@ -15,7 +15,7 @@ namespace ILCompiler.DependencyAnalysis /// </summary> public class ExternSymbolNode : DependencyNodeCore<NodeFactory>, ISymbolNode { - string _name; + private string _name; public ExternSymbolNode(string name) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs index d5e4905ee..208d39d72 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticEETypeNode.cs @@ -10,10 +10,10 @@ using System.Threading.Tasks; namespace ILCompiler.DependencyAnalysis { - class GCStaticEETypeNode : ObjectNode, ISymbolNode + internal class GCStaticEETypeNode : ObjectNode, ISymbolNode { - int[] _runLengths; // First is offset to first gc field, second is length of gc static run, third is length of non-gc data, etc - int _targetPointerSize; + private int[] _runLengths; // First is offset to first gc field, second is length of gc static run, third is length of non-gc data, etc + private int _targetPointerSize; public GCStaticEETypeNode(bool[] gcDesc, NodeFactory factory) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs index 8dae17acf..137f8b357 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/GCStaticsNode.cs @@ -13,7 +13,7 @@ namespace ILCompiler.DependencyAnalysis { public class GCStaticsNode : EmbeddedObjectNode, ISymbolNode { - MetadataType _type; + private MetadataType _type; public GCStaticsNode(MetadataType type, NodeFactory factory) { @@ -28,7 +28,7 @@ namespace ILCompiler.DependencyAnalysis protected override void OnMarked(NodeFactory factory) { factory.GCStaticsRegion.AddEmbeddedObject(this); - } + } string ISymbolNode.MangledName { @@ -47,7 +47,6 @@ namespace ILCompiler.DependencyAnalysis public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFactory context) { - return new DependencyListEntry[] { new DependencyListEntry(context.GCStaticsRegion, "GCStatics Region"), new DependencyListEntry(GetGCStaticEETypeNode(context), "GCStatic EEType")}; } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs index 659f443ed..9e9ceb024 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/JumpStubNode.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using ILCompiler.DependencyAnalysis.X64; using Internal.TypeSystem; using Internal.TypeSystem.Ecma; @@ -11,7 +14,7 @@ namespace ILCompiler.DependencyAnalysis public JumpStubNode(ISymbolNode target) { - this._target = target; + _target = target; } public override string MangledName diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs index 6fb38188a..ac7feed43 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/MethodCodeNode.cs @@ -7,12 +7,12 @@ using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { - class MethodCodeNode : ObjectNode, INodeWithFrameInfo, INodeWithDebugInfo, ISymbolNode + internal class MethodCodeNode : ObjectNode, INodeWithFrameInfo, INodeWithDebugInfo, ISymbolNode { - MethodDesc _method; - ObjectData _methodCode; - FrameInfo[] _frameInfos; - DebugLocInfo[] _debugLocInfos; + private MethodDesc _method; + private ObjectData _methodCode; + private FrameInfo[] _frameInfos; + private DebugLocInfo[] _debugLocInfos; public MethodCodeNode(MethodDesc method) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs index 1039a25dd..da2055110 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NodeFactory.cs @@ -11,8 +11,8 @@ namespace ILCompiler.DependencyAnalysis { public class NodeFactory { - TargetDetails _target; - CompilerTypeSystemContext _context; + private TargetDetails _target; + private CompilerTypeSystemContext _context; public NodeFactory(CompilerTypeSystemContext context) { @@ -29,10 +29,10 @@ namespace ILCompiler.DependencyAnalysis } } - struct NodeCache<TKey, TValue> + private struct NodeCache<TKey, TValue> { - Func<TKey, TValue> _creator; - Dictionary<TKey, TValue> _cache; + private Func<TKey, TValue> _creator; + private Dictionary<TKey, TValue> _cache; public NodeCache(Func<TKey, TValue> creator, IEqualityComparer<TKey> comparer) { @@ -178,13 +178,13 @@ namespace ILCompiler.DependencyAnalysis return _threadStatics.GetOrAdd(type); } - class BoolArrayEqualityComparer : IEqualityComparer<bool[]> + private class BoolArrayEqualityComparer : IEqualityComparer<bool[]> { bool IEqualityComparer<bool[]>.Equals(bool[] x, bool[] y) { if (x.Length != y.Length) return false; - + for (int i = 0; i < x.Length; i++) { if (x[i] != y[i]) @@ -254,7 +254,7 @@ namespace ILCompiler.DependencyAnalysis return _methodCode.GetOrAdd(method); } - static readonly string[][] s_helperEntrypointNames = new string[][] { + private static readonly string[][] s_helperEntrypointNames = new string[][] { new string[] { "System.Runtime.CompilerServices", "CctorHelper", "CheckStaticClassConstructionReturnGCStaticBase" }, new string[] { "System.Runtime.CompilerServices", "CctorHelper", "CheckStaticClassConstructionReturnNonGCStaticBase" } }; diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs index 7945fce5e..c9db857c1 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/NonGCStaticsNode.cs @@ -14,10 +14,10 @@ namespace ILCompiler.DependencyAnalysis /// with the class constructor context if the type has a class constructor that /// needs to be triggered before the type members can be accessed. /// </summary> - class NonGCStaticsNode : ObjectNode, ISymbolNode + internal class NonGCStaticsNode : ObjectNode, ISymbolNode { - MetadataType _type; - ISymbolNode _classConstructorContext; + private MetadataType _type; + private ISymbolNode _classConstructorContext; public NonGCStaticsNode(MetadataType type) { @@ -129,7 +129,7 @@ namespace ILCompiler.DependencyAnalysis // Add padding before the context if alignment forces us to do so builder.EmitZeros(((ISymbolNode)this).Offset - ClassConstructorContextSize); - + // Emit the actual StaticClassConstructionContext var cctorMethod = _type.GetStaticConstructor(); builder.EmitPointerReloc(factory.MethodEntrypoint(cctorMethod)); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectAndOffsetSymbolNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectAndOffsetSymbolNode.cs index 74dcd2c0d..e533f32bc 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectAndOffsetSymbolNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectAndOffsetSymbolNode.cs @@ -8,7 +8,7 @@ using ILCompiler.DependencyAnalysisFramework; namespace ILCompiler.DependencyAnalysis { - class ObjectAndOffsetSymbolNode : DependencyNodeCore<NodeFactory>, ISymbolNode + internal class ObjectAndOffsetSymbolNode : DependencyNodeCore<NodeFactory>, ISymbolNode { private ObjectNode _object; private int _offset; diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectDataBuilder.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectDataBuilder.cs index 404bd687f..db925dd58 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectDataBuilder.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectDataBuilder.cs @@ -133,7 +133,7 @@ namespace ILCompiler.DependencyAnalysis public ObjectNode.ObjectData ToObjectData() { - ObjectNode.ObjectData returnData = new ObjectNode.ObjectData(_data.ToArray(), + ObjectNode.ObjectData returnData = new ObjectNode.ObjectData(_data.ToArray(), _relocs.ToArray(), Alignment, DefinedSymbols.ToArray()); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectNode.cs index ac8300c4c..e05a68c0f 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectNode.cs @@ -104,6 +104,5 @@ namespace ILCompiler.DependencyAnalysis { return null; } - } } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectWriter.cs index f81e46473..2343c689a 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectWriter.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectWriter.cs @@ -16,94 +16,94 @@ namespace ILCompiler.DependencyAnalysis /// <summary> /// Object writer using https://github.com/dotnet/llilc /// </summary> - class ObjectWriter : IDisposable + internal class ObjectWriter : IDisposable { // This is used to look up file id for the given file name. // This is a global table across nodes. - Dictionary<string, int> _debugFileToId = new Dictionary<string, int>(); + private Dictionary<string, int> _debugFileToId = new Dictionary<string, int>(); // This is used to look up DebugLocInfo for the given native offset. // This is for individual node and should be flushed once node is emitted. - Dictionary<int, DebugLocInfo> _offsetToDebugLoc = new Dictionary<int, DebugLocInfo>(); + private Dictionary<int, DebugLocInfo> _offsetToDebugLoc = new Dictionary<int, DebugLocInfo>(); // This is one to multiple mapping -- we might have multiple symbols at the give offset. // We preserved the original order of ISymbolNode[]. - Dictionary<int, List<ISymbolNode>> _offsetToDefSymbol = new Dictionary<int, List<ISymbolNode>>(); + private Dictionary<int, List<ISymbolNode>> _offsetToDefSymbol = new Dictionary<int, List<ISymbolNode>>(); public const string MainEntryNodeName = "__managed__Main"; - const string NativeObjectWriterFileName = "objwriter"; + private const string NativeObjectWriterFileName = "objwriter"; [DllImport(NativeObjectWriterFileName)] - static extern IntPtr InitObjWriter(string objectFilePath); + private static extern IntPtr InitObjWriter(string objectFilePath); [DllImport(NativeObjectWriterFileName)] - static extern void FinishObjWriter(IntPtr objWriter); + private static extern void FinishObjWriter(IntPtr objWriter); [DllImport(NativeObjectWriterFileName)] - static extern void SwitchSection(IntPtr objWriter, string sectionName); + private static extern void SwitchSection(IntPtr objWriter, string sectionName); public void SwitchSection(string sectionName) { SwitchSection(_nativeObjectWriter, sectionName); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitAlignment(IntPtr objWriter, int byteAlignment); + private static extern void EmitAlignment(IntPtr objWriter, int byteAlignment); public void EmitAlignment(int byteAlignment) { EmitAlignment(_nativeObjectWriter, byteAlignment); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitBlob(IntPtr objWriter, int blobSize, byte[] blob); + private static extern void EmitBlob(IntPtr objWriter, int blobSize, byte[] blob); public void EmitBlob(int blobSize, byte[] blob) { EmitBlob(_nativeObjectWriter, blobSize, blob); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitIntValue(IntPtr objWriter, ulong value, int size); + private static extern void EmitIntValue(IntPtr objWriter, ulong value, int size); public void EmitIntValue(ulong value, int size) { EmitIntValue(_nativeObjectWriter, value, size); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitSymbolDef(IntPtr objWriter, string symbolName); + private static extern void EmitSymbolDef(IntPtr objWriter, string symbolName); public void EmitSymbolDef(string symbolName) { EmitSymbolDef(_nativeObjectWriter, symbolName); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitSymbolRef(IntPtr objWriter, string symbolName, int size, bool isPCRelative, int delta = 0); + private static extern void EmitSymbolRef(IntPtr objWriter, string symbolName, int size, bool isPCRelative, int delta = 0); public void EmitSymbolRef(string symbolName, int size, bool isPCRelative, int delta = 0) { EmitSymbolRef(_nativeObjectWriter, symbolName, size, isPCRelative, delta); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitFrameInfo(IntPtr objWriter, string methodName, int startOffset, int endOffset, int blobSize, byte[] blobData); + private static extern void EmitFrameInfo(IntPtr objWriter, string methodName, int startOffset, int endOffset, int blobSize, byte[] blobData); public void EmitFrameInfo(string methodName, int startOffset, int endOffset, int blobSize, byte[] blobData) { EmitFrameInfo(_nativeObjectWriter, methodName, startOffset, endOffset, blobSize, blobData); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitDebugFileInfo(IntPtr objWriter, int fileInfoSize, string[] fileInfos); + private static extern void EmitDebugFileInfo(IntPtr objWriter, int fileInfoSize, string[] fileInfos); public void EmitDebugFileInfo(int fileInfoSize, string[] fileInfos) { EmitDebugFileInfo(_nativeObjectWriter, fileInfoSize, fileInfos); } [DllImport(NativeObjectWriterFileName)] - static extern void EmitDebugLoc(IntPtr objWriter, int nativeOffset, int fileId, int linueNumber, int colNumber); - public void EmitDebugLoc(int nativeOffset, int fileId, int linueNumber, int colNumber) + private static extern void EmitDebugLoc(IntPtr objWriter, int nativeOffset, int fileId, int linueNumber, int colNumber); + public void EmitDebugLoc(int nativeOffset, int fileId, int linueNumber, int colNumber) { EmitDebugLoc(_nativeObjectWriter, nativeOffset, fileId, linueNumber, colNumber); } [DllImport(NativeObjectWriterFileName)] - static extern void FlushDebugLocs(IntPtr objWriter, string methodName, int methodSize); + private static extern void FlushDebugLocs(IntPtr objWriter, string methodName, int methodSize); public void FlushDebugLocs(string methodName, int methodSize) { // No interest if there is no debug location emission/map before. @@ -127,7 +127,7 @@ namespace ILCompiler.DependencyAnalysis DebugLocInfo[] debugLocInfos = ((INodeWithDebugInfo)node).DebugLocInfos; if (debugLocInfos != null) { - foreach(DebugLocInfo debugLocInfo in debugLocInfos) + foreach (DebugLocInfo debugLocInfo in debugLocInfos) { string fileName = debugLocInfo.FileName; if (!_debugFileToId.ContainsKey(fileName)) @@ -170,7 +170,8 @@ namespace ILCompiler.DependencyAnalysis public void EmitDebugLocInfo(int offset) { DebugLocInfo loc; - if (_offsetToDebugLoc.TryGetValue(offset, out loc)) { + if (_offsetToDebugLoc.TryGetValue(offset, out loc)) + { Debug.Assert(_debugFileToId.Count > 0); EmitDebugLoc(offset, _debugFileToId[loc.FileName], @@ -184,7 +185,8 @@ namespace ILCompiler.DependencyAnalysis _offsetToDefSymbol.Clear(); foreach (ISymbolNode n in definedSymbols) { - if (!_offsetToDefSymbol.ContainsKey(n.Offset)) { + if (!_offsetToDefSymbol.ContainsKey(n.Offset)) + { _offsetToDefSymbol[n.Offset] = new List<ISymbolNode>(); } _offsetToDefSymbol[n.Offset].Add(n); @@ -194,7 +196,8 @@ namespace ILCompiler.DependencyAnalysis public void EmitSymbolDefinition(int currentOffset) { List<ISymbolNode> nodes; - if (_offsetToDefSymbol.TryGetValue(currentOffset, out nodes)) { + if (_offsetToDefSymbol.TryGetValue(currentOffset, out nodes)) + { foreach (var node in nodes) { EmitSymbolDef(node.MangledName); @@ -202,7 +205,7 @@ namespace ILCompiler.DependencyAnalysis } } - IntPtr _nativeObjectWriter = IntPtr.Zero; + private IntPtr _nativeObjectWriter = IntPtr.Zero; public ObjectWriter(string outputPath) { @@ -346,7 +349,7 @@ namespace ILCompiler.DependencyAnalysis // Emit frame info for object code. if (node is INodeWithFrameInfo) { - FrameInfo[] frameInfos = ((INodeWithFrameInfo) node).FrameInfos; + FrameInfo[] frameInfos = ((INodeWithFrameInfo)node).FrameInfos; if (frameInfos != null) { foreach (var frameInfo in frameInfos) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs index 663c209ca..258822995 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ReadyToRunHelperNode.cs @@ -14,7 +14,7 @@ namespace ILCompiler.DependencyAnalysis { public partial class ReadyToRunHelperNode : AssemblyStubNode { - ReadyToRunHelper _helper; + private ReadyToRunHelper _helper; public ReadyToRunHelperNode(ReadyToRunHelper helper) { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringDataNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringDataNode.cs index c277302ce..d1e8ddb30 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringDataNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/StringDataNode.cs @@ -62,7 +62,7 @@ namespace ILCompiler.DependencyAnalysis Encoding encoding = UTF8Encoding.UTF8; ObjectDataBuilder objDataBuilder = new ObjectDataBuilder(factory); - AsmStringWriter stringWriter = new AsmStringWriter((byte b) =>objDataBuilder.EmitByte(b)); + AsmStringWriter stringWriter = new AsmStringWriter((byte b) => objDataBuilder.EmitByte(b)); stringWriter.WriteString(_data); objDataBuilder.DefinedSymbols.Add(this); diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/AddrMode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/AddrMode.cs index a659b1c84..b6e1fe04f 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/AddrMode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/AddrMode.cs @@ -25,11 +25,11 @@ namespace ILCompiler.DependencyAnalysis.X64 _size = size; } - Register _baseReg; - Register? _indexReg; - int _offset; - byte _scale; - AddrModeSize _size; + private Register _baseReg; + private Register? _indexReg; + private int _offset; + private byte _scale; + private AddrModeSize _size; public Register BaseReg { diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64Emitter.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64Emitter.cs index 127f86070..beef08831 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64Emitter.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64Emitter.cs @@ -230,7 +230,7 @@ namespace ILCompiler.DependencyAnalysis.X64 EmitModRM(subOpcode, ref addrMode); } - void EmitIndirInstruction(int opcode, Register dstReg, ref AddrMode addrMode) + private void EmitIndirInstruction(int opcode, Register dstReg, ref AddrMode addrMode) { EmitRexPrefix(dstReg, ref addrMode); if ((opcode >> 8) != 0) diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64JumpStubNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64JumpStubNode.cs index ac66c66ab..fdac8accd 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64JumpStubNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/Target_X64/X64JumpStubNode.cs @@ -1,4 +1,7 @@ -using ILCompiler.DependencyAnalysis; +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using ILCompiler.DependencyAnalysis; using ILCompiler.DependencyAnalysis.X64; using System; using System.Collections.Generic; @@ -15,7 +18,7 @@ namespace ILCompiler.DependencyAnalysis { protected override void EmitCode(NodeFactory factory, ref X64Emitter encoder, bool relocsOnly) { - encoder.EmitJMP(_target); + encoder.EmitJMP(_target); } } }
\ No newline at end of file diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs index 89e3f489d..d44122127 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ThreadStaticsNode.cs @@ -12,7 +12,7 @@ namespace ILCompiler.DependencyAnalysis /// </summary> public class ThreadStaticsNode : EmbeddedObjectNode, ISymbolNode { - MetadataType _type; + private MetadataType _type; public ThreadStaticsNode(MetadataType type, NodeFactory factory) { @@ -47,7 +47,6 @@ namespace ILCompiler.DependencyAnalysis public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFactory context) { - return new DependencyListEntry[] { new DependencyListEntry(context.ThreadStaticsRegion, "ThreadStatics Region"), new DependencyListEntry(GetGCStaticEETypeNode(context), "ThreadStatic EEType")}; } diff --git a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/VirtualMethodUseNode.cs b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/VirtualMethodUseNode.cs index b62db1b23..808fb4f15 100644 --- a/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/VirtualMethodUseNode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/VirtualMethodUseNode.cs @@ -17,9 +17,9 @@ namespace ILCompiler.DependencyAnalysis // // It is used to keep track of uses of virtual methods to ensure that the // vtables are properly constructed - class VirtualMethodUseNode : DependencyNodeCore<NodeFactory> + internal class VirtualMethodUseNode : DependencyNodeCore<NodeFactory> { - MethodDesc _decl; + private MethodDesc _decl; public VirtualMethodUseNode(MethodDesc decl) { @@ -36,7 +36,7 @@ namespace ILCompiler.DependencyAnalysis // For each virtual method use in the graph, ensure that our side // table of live virtual method slots is kept up to date. - MethodDesc virtualMethod = (MethodDesc)this._decl; + MethodDesc virtualMethod = (MethodDesc)_decl; TypeDesc typeOfVirtual = virtualMethod.OwningType; List<MethodDesc> virtualSlots; diff --git a/src/ILCompiler.Compiler/src/Compiler/IntrinsicMethods.cs b/src/ILCompiler.Compiler/src/Compiler/IntrinsicMethods.cs index 79285bfa6..bf9c165f0 100644 --- a/src/ILCompiler.Compiler/src/Compiler/IntrinsicMethods.cs +++ b/src/ILCompiler.Compiler/src/Compiler/IntrinsicMethods.cs @@ -8,13 +8,13 @@ using Debug = System.Diagnostics.Debug; namespace ILCompiler { - enum IntrinsicMethodKind + internal enum IntrinsicMethodKind { None, RuntimeHelpersInitializeArray, } - class IntrinsicMethods + internal class IntrinsicMethods { public static IntrinsicMethodKind GetIntrinsicMethodClassification(MethodDesc method) { diff --git a/src/ILCompiler.Compiler/src/Compiler/JitHelper.cs b/src/ILCompiler.Compiler/src/Compiler/JitHelper.cs index d9e615ef3..931d2cc08 100644 --- a/src/ILCompiler.Compiler/src/Compiler/JitHelper.cs +++ b/src/ILCompiler.Compiler/src/Compiler/JitHelper.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -86,9 +89,9 @@ namespace ILCompiler FltRound = 0xE3, } - class JitHelper + internal class JitHelper { - Compilation _compilation; + private Compilation _compilation; public JitHelper(Compilation compilation, JitHelperId id) { @@ -138,10 +141,8 @@ namespace ILCompiler // TODO: Uncomment once all helpers are implemented // throw new NotImplementedException(); return "__fail_fast"; - } } } } - } diff --git a/src/ILCompiler.Compiler/src/Compiler/MemoryHelper.cs b/src/ILCompiler.Compiler/src/Compiler/MemoryHelper.cs index d937cb4e4..662a42a53 100644 --- a/src/ILCompiler.Compiler/src/Compiler/MemoryHelper.cs +++ b/src/ILCompiler.Compiler/src/Compiler/MemoryHelper.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,7 +9,7 @@ using System.Threading.Tasks; namespace ILCompiler { - static unsafe class MemoryHelper + internal static unsafe class MemoryHelper { public static void FillMemory(byte* dest, byte fill, int count) { diff --git a/src/ILCompiler.Compiler/src/Compiler/MethodCode.cs b/src/ILCompiler.Compiler/src/Compiler/MethodCode.cs index 8fbec82d0..843017d8d 100644 --- a/src/ILCompiler.Compiler/src/Compiler/MethodCode.cs +++ b/src/ILCompiler.Compiler/src/Compiler/MethodCode.cs @@ -5,7 +5,7 @@ using System; namespace ILCompiler { - class MethodCode + internal class MethodCode { public byte[] Code; public byte[] ColdCode; @@ -19,7 +19,7 @@ namespace ILCompiler public DebugLocInfo[] DebugLocInfos; } - class BlockRelativeTarget + internal class BlockRelativeTarget { public BlockType Block; public int Offset; @@ -40,7 +40,7 @@ namespace ILCompiler ROData = 2 } - struct Relocation + internal struct Relocation { public ushort RelocType; public BlockType Block; diff --git a/src/ILCompiler.Compiler/src/Compiler/MethodExtensions.cs b/src/ILCompiler.Compiler/src/Compiler/MethodExtensions.cs index dda20196c..0e72345c3 100644 --- a/src/ILCompiler.Compiler/src/Compiler/MethodExtensions.cs +++ b/src/ILCompiler.Compiler/src/Compiler/MethodExtensions.cs @@ -17,7 +17,7 @@ namespace ILCompiler RuntimeImport }; - static class MethodExtensions + internal static class MethodExtensions { public static string GetRuntimeImportEntryPointName(this EcmaMethod This) { @@ -32,7 +32,7 @@ namespace ILCompiler } StringHandle namespaceHandle, nameHandle; - if (!metadataReader.GetAttributeTypeNamespaceAndName(attributeType, + if (!metadataReader.GetAttributeTypeNamespaceAndName(attributeType, out namespaceHandle, out nameHandle)) { continue; diff --git a/src/ILCompiler.Compiler/src/Compiler/NameMangler.cs b/src/ILCompiler.Compiler/src/Compiler/NameMangler.cs index 1f51539c0..6e51ede50 100644 --- a/src/ILCompiler.Compiler/src/Compiler/NameMangler.cs +++ b/src/ILCompiler.Compiler/src/Compiler/NameMangler.cs @@ -20,7 +20,7 @@ namespace ILCompiler // public class NameMangler { - readonly Compilation _compilation; + private readonly Compilation _compilation; public NameMangler(Compilation compilation) { @@ -75,7 +75,7 @@ namespace ILCompiler return (sb != null) ? sb.ToString() : s; } - ImmutableDictionary<TypeDesc, string> _mangledTypeNames = ImmutableDictionary<TypeDesc, string>.Empty; + private ImmutableDictionary<TypeDesc, string> _mangledTypeNames = ImmutableDictionary<TypeDesc, string>.Empty; public string GetMangledTypeName(TypeDesc type) { @@ -184,7 +184,7 @@ namespace ILCompiler return mangledName; } - ImmutableDictionary<MethodDesc, string> _mangledMethodNames = ImmutableDictionary<MethodDesc, string>.Empty; + private ImmutableDictionary<MethodDesc, string> _mangledMethodNames = ImmutableDictionary<MethodDesc, string>.Empty; public string GetMangledMethodName(MethodDesc method) { @@ -270,7 +270,7 @@ namespace ILCompiler return mangledName; } - ImmutableDictionary<FieldDesc, string> _mangledFieldNames = ImmutableDictionary<FieldDesc, string>.Empty; + private ImmutableDictionary<FieldDesc, string> _mangledFieldNames = ImmutableDictionary<FieldDesc, string>.Empty; public string GetMangledFieldName(FieldDesc field) { diff --git a/src/ILCompiler.Compiler/src/Compiler/PdbSymbolProvider.cs b/src/ILCompiler.Compiler/src/Compiler/PdbSymbolProvider.cs index e49cd604d..eafa4c2ca 100644 --- a/src/ILCompiler.Compiler/src/Compiler/PdbSymbolProvider.cs +++ b/src/ILCompiler.Compiler/src/Compiler/PdbSymbolProvider.cs @@ -14,7 +14,7 @@ namespace ILCompiler { // For now, open PDB files using legacy desktop SymBinder - class PdbSymbolProvider + internal class PdbSymbolProvider { [Guid("809c652e-7396-11d2-9771-00a0c9b4d50c")] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] @@ -50,19 +50,19 @@ namespace ILCompiler [Out, MarshalAs(UnmanagedType.Interface)] out Object ppv); [DllImport("ole32.dll")] - static extern int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, + private static extern int CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, Int32 dwClsContext, ref Guid riid, [MarshalAs(UnmanagedType.Interface)] out object ppv); - void ThrowExceptionForHR(int hr) + private void ThrowExceptionForHR(int hr) { Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); } - IMetaDataDispenser _metadataDispenser; + private IMetaDataDispenser _metadataDispenser; - ISymUnmanagedBinder _symBinder; + private ISymUnmanagedBinder _symBinder; public PdbSymbolProvider() { @@ -121,7 +121,7 @@ namespace ILCompiler } } - Dictionary<ISymUnmanagedDocument, string> _urlCache = new Dictionary<ISymUnmanagedDocument, string>(); + private Dictionary<ISymUnmanagedDocument, string> _urlCache = new Dictionary<ISymUnmanagedDocument, string>(); private string GetUrl(ISymUnmanagedDocument doc) { diff --git a/src/ILCompiler.Compiler/src/Compiler/ReadyToRunHelper.cs b/src/ILCompiler.Compiler/src/Compiler/ReadyToRunHelper.cs index a18c6d81a..ec38cf639 100644 --- a/src/ILCompiler.Compiler/src/Compiler/ReadyToRunHelper.cs +++ b/src/ILCompiler.Compiler/src/Compiler/ReadyToRunHelper.cs @@ -26,7 +26,7 @@ namespace ILCompiler public class ReadyToRunHelper : IEquatable<ReadyToRunHelper> { - Compilation _compilation; + private Compilation _compilation; public ReadyToRunHelper(Compilation compilation, ReadyToRunHelperId id, Object target) { diff --git a/src/ILCompiler.Compiler/src/Compiler/RegisteredField.cs b/src/ILCompiler.Compiler/src/Compiler/RegisteredField.cs index 152b4481f..815641d79 100644 --- a/src/ILCompiler.Compiler/src/Compiler/RegisteredField.cs +++ b/src/ILCompiler.Compiler/src/Compiler/RegisteredField.cs @@ -7,7 +7,7 @@ using Internal.TypeSystem; namespace ILCompiler { - class RegisteredField + internal class RegisteredField { public FieldDesc Field; diff --git a/src/ILCompiler.Compiler/src/Compiler/RegisteredMethod.cs b/src/ILCompiler.Compiler/src/Compiler/RegisteredMethod.cs index 316a048a0..0b9332b53 100644 --- a/src/ILCompiler.Compiler/src/Compiler/RegisteredMethod.cs +++ b/src/ILCompiler.Compiler/src/Compiler/RegisteredMethod.cs @@ -7,7 +7,7 @@ using Internal.TypeSystem; namespace ILCompiler { - class RegisteredMethod + internal class RegisteredMethod { public MethodDesc Method; diff --git a/src/ILCompiler.Compiler/src/Compiler/RegisteredType.cs b/src/ILCompiler.Compiler/src/Compiler/RegisteredType.cs index d309d9396..66f5b44a4 100644 --- a/src/ILCompiler.Compiler/src/Compiler/RegisteredType.cs +++ b/src/ILCompiler.Compiler/src/Compiler/RegisteredType.cs @@ -8,7 +8,7 @@ using Internal.TypeSystem; namespace ILCompiler { - class RegisteredType + internal class RegisteredType { public TypeDesc Type; diff --git a/src/ILCompiler.Compiler/src/Compiler/RvaFieldData.cs b/src/ILCompiler.Compiler/src/Compiler/RvaFieldData.cs index 12969a92f..34352afd4 100644 --- a/src/ILCompiler.Compiler/src/Compiler/RvaFieldData.cs +++ b/src/ILCompiler.Compiler/src/Compiler/RvaFieldData.cs @@ -8,7 +8,7 @@ using Debug = System.Diagnostics.Debug; namespace ILCompiler { - class RvaFieldData + internal class RvaFieldData { private Compilation _compilation; diff --git a/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs b/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs index b6f25ddfa..c37bbbb30 100644 --- a/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs +++ b/src/ILCompiler.Compiler/src/CppCodeGen/CppWriter.cs @@ -15,9 +15,9 @@ using Internal.IL; namespace ILCompiler.CppCodeGen { - class CppWriter + internal class CppWriter { - Compilation _compilation; + private Compilation _compilation; private void SetWellKnownTypeSignatureName(WellKnownType wellKnownType, string mangledSignatureName) { @@ -164,7 +164,6 @@ namespace ILCompiler.CppCodeGen } if (i != argCount - 1) sb.Append(", "); - } sb.Append(")"); if (!implementation) @@ -254,7 +253,7 @@ namespace ILCompiler.CppCodeGen return varName; } - string CompileSpecialMethod(MethodDesc method, SpecialMethodKind kind) + private string CompileSpecialMethod(MethodDesc method, SpecialMethodKind kind) { StringBuilder builder = new StringBuilder(); switch (kind) @@ -349,7 +348,7 @@ namespace ILCompiler.CppCodeGen _compilation.GetRegisteredMethod(method).MethodCode = methodCode; } - TextWriter Out + private TextWriter Out { get { @@ -357,15 +356,15 @@ namespace ILCompiler.CppCodeGen } } - StringBuilder _statics; - StringBuilder _gcStatics; - StringBuilder _threadStatics; - StringBuilder _gcThreadStatics; + private StringBuilder _statics; + private StringBuilder _gcStatics; + private StringBuilder _threadStatics; + private StringBuilder _gcThreadStatics; // Base classes and valuetypes has to be emitted before they are used. - HashSet<RegisteredType> _emittedTypes; + private HashSet<RegisteredType> _emittedTypes; - void OutputTypes(bool full) + private void OutputTypes(bool full) { if (full) { @@ -425,7 +424,7 @@ namespace ILCompiler.CppCodeGen } } - void OutputType(RegisteredType t, bool full) + private void OutputType(RegisteredType t, bool full) { if (_emittedTypes != null) { @@ -569,12 +568,12 @@ namespace ILCompiler.CppCodeGen Out.WriteLine(); } - void OutputMethod(RegisteredMethod m) + private void OutputMethod(RegisteredMethod m) { Out.WriteLine(GetCppMethodDeclaration(m.Method, false)); } - void AppendSlotTypeDef(StringBuilder sb, MethodDesc method) + private void AppendSlotTypeDef(StringBuilder sb, MethodDesc method) { var methodSignature = method.Signature; @@ -612,7 +611,7 @@ namespace ILCompiler.CppCodeGen } - String GetCodeForDelegate(TypeDesc delegateType) + private String GetCodeForDelegate(TypeDesc delegateType) { StringBuilder sb = new StringBuilder(); @@ -634,7 +633,7 @@ namespace ILCompiler.CppCodeGen return sb.ToString(); } - String GetCodeForVirtualMethod(MethodDesc method, int slot) + private String GetCodeForVirtualMethod(MethodDesc method, int slot) { StringBuilder sb = new StringBuilder(); @@ -653,7 +652,7 @@ namespace ILCompiler.CppCodeGen return sb.ToString(); } - void AppendVirtualSlots(StringBuilder sb, TypeDesc implType, TypeDesc declType) + private void AppendVirtualSlots(StringBuilder sb, TypeDesc implType, TypeDesc declType) { var baseType = declType.BaseType; if (baseType != null) @@ -676,7 +675,7 @@ namespace ILCompiler.CppCodeGen } } - String GetCodeForType(TypeDesc type) + private String GetCodeForType(TypeDesc type) { StringBuilder sb = new StringBuilder(); @@ -768,7 +767,7 @@ namespace ILCompiler.CppCodeGen return sb.ToString(); } - void AddInstanceFields(TypeDesc type) + private void AddInstanceFields(TypeDesc type) { foreach (var field in type.GetFields()) { diff --git a/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs b/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs index 4a2d2c610..d147d9a7a 100644 --- a/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs +++ b/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs @@ -29,49 +29,49 @@ namespace Internal.IL public bool CompilerGenerated; } - partial class ILImporter + internal partial class ILImporter { - Compilation _compilation; - CppWriter _writer; + private Compilation _compilation; + private CppWriter _writer; - TypeSystemContext _typeSystemContext; + private TypeSystemContext _typeSystemContext; - MethodDesc _method; - MethodSignature _methodSignature; + private MethodDesc _method; + private MethodSignature _methodSignature; - TypeDesc _thisType; + private TypeDesc _thisType; - MethodIL _methodIL; - byte[] _ilBytes; - LocalVariableDefinition[] _locals; + private MethodIL _methodIL; + private byte[] _ilBytes; + private LocalVariableDefinition[] _locals; - struct SequencePoint + private struct SequencePoint { public string Document; public int LineNumber; } - SequencePoint[] _sequencePoints; - Dictionary<int, LocalVariable> _localSlotToInfoMap; - Dictionary<int, string> _parameterIndexToNameMap; + private SequencePoint[] _sequencePoints; + private Dictionary<int, LocalVariable> _localSlotToInfoMap; + private Dictionary<int, string> _parameterIndexToNameMap; - class ExceptionRegion + private class ExceptionRegion { public ILExceptionRegion ILRegion; public int ReturnLabels; }; - ExceptionRegion[] _exceptionRegions; + private ExceptionRegion[] _exceptionRegions; - class SpillSlot + private class SpillSlot { public StackValueKind Kind; public TypeDesc Type; public String Name; }; - List<SpillSlot> _spillSlots; + private List<SpillSlot> _spillSlots; // TODO: Unify with verifier? [Flags] - enum Prefix + private enum Prefix { ReadOnly = 0x01, Unaligned = 0x02, @@ -80,12 +80,12 @@ namespace Internal.IL Constrained = 0x10, No = 0x20, } - Prefix _pendingPrefix; - TypeDesc _constrained; + private Prefix _pendingPrefix; + private TypeDesc _constrained; - StringBuilder _builder = new StringBuilder(); + private StringBuilder _builder = new StringBuilder(); - class BasicBlock + private class BasicBlock { // Common fields public BasicBlock Next; @@ -186,7 +186,7 @@ namespace Internal.IL _parameterIndexToNameMap = parameterIndexToNameMap; } - struct Value + private struct Value { public Value(String name) { @@ -198,14 +198,14 @@ namespace Internal.IL public Object Aux; }; - struct StackValue + private struct StackValue { public StackValueKind Kind; public TypeDesc Type; public Value Value; } - StackValueKind GetStackValueKind(TypeDesc type) + private StackValueKind GetStackValueKind(TypeDesc type) { switch (type.Category) { @@ -245,26 +245,26 @@ namespace Internal.IL } } - void Push(StackValue value) + private void Push(StackValue value) { if (_stackTop >= _stack.Length) Array.Resize(ref _stack, 2 * _stackTop + 3); _stack[_stackTop++] = value; } - void Push(StackValueKind kind, Value value, TypeDesc type = null) + private void Push(StackValueKind kind, Value value, TypeDesc type = null) { Push(new StackValue() { Kind = kind, Type = type, Value = value }); } - StackValue Pop() + private StackValue Pop() { return _stack[--_stackTop]; } private bool _msvc; - string GetStackValueKindCPPTypeName(StackValueKind kind, TypeDesc type = null) + private string GetStackValueKindCPPTypeName(StackValueKind kind, TypeDesc type = null) { switch (kind) { @@ -279,13 +279,13 @@ namespace Internal.IL } } - int _currentTemp = 1; - string NewTempName() + private int _currentTemp = 1; + private string NewTempName() { return "_" + (_currentTemp++).ToString(); } - void PushTemp(StackValueKind kind, TypeDesc type = null) + private void PushTemp(StackValueKind kind, TypeDesc type = null) { string temp = NewTempName(); @@ -297,7 +297,7 @@ namespace Internal.IL _builder.Append("="); } - void AppendCastIfNecessary(TypeDesc destType, StackValueKind srcType) + private void AppendCastIfNecessary(TypeDesc destType, StackValueKind srcType) { if (destType.IsValueType) return; @@ -306,11 +306,11 @@ namespace Internal.IL Append(")"); } - void AppendCastIfNecessary(StackValueKind dstType, TypeDesc srcType) + private void AppendCastIfNecessary(StackValueKind dstType, TypeDesc srcType) { if (dstType == StackValueKind.ByRef) { - Append("("); + Append("("); Append(_writer.GetCppSignatureTypeName(srcType)); Append(")"); } @@ -321,7 +321,7 @@ namespace Internal.IL } } - Value NewSpillSlot(StackValueKind kind, TypeDesc type) + private Value NewSpillSlot(StackValueKind kind, TypeDesc type) { if (_spillSlots == null) _spillSlots = new List<SpillSlot>(); @@ -336,18 +336,18 @@ namespace Internal.IL return new Value() { Name = spillSlot.Name }; } - void Append(string s) + private void Append(string s) { _builder.Append(s); } - void Finish() + private void Finish() { // _builder.AppendLine(";"); _builder.Append("; "); } - string GetVarName(int index, bool argument) + private string GetVarName(int index, bool argument) { if (_localSlotToInfoMap != null && !argument && _localSlotToInfoMap.ContainsKey(index) && !_localSlotToInfoMap[index].CompilerGenerated) { @@ -362,7 +362,7 @@ namespace Internal.IL return (argument ? "_a" : "_l") + index.ToString(); } - TypeDesc GetVarType(int index, bool argument) + private TypeDesc GetVarType(int index, bool argument) { if (argument) { @@ -378,25 +378,25 @@ namespace Internal.IL } else { - return _locals[index].Type; + return _locals[index].Type; } } - TypeDesc GetWellKnownType(WellKnownType wellKnownType) + private TypeDesc GetWellKnownType(WellKnownType wellKnownType) { return _typeSystemContext.GetWellKnownType(wellKnownType); } - TypeDesc ResolveTypeToken(int token) + private TypeDesc ResolveTypeToken(int token) { return (TypeDesc)_methodIL.GetObject(token); } - void MarkInstructionBoundary() + private void MarkInstructionBoundary() { } - void StartImportingInstruction() + private void StartImportingInstruction() { if (_sequencePoints == null) return; @@ -416,7 +416,7 @@ namespace Internal.IL _builder.AppendLine(); } - void EndImportingInstruction() + private void EndImportingInstruction() { if (_sequencePoints == null) _builder.AppendLine(); @@ -525,26 +525,26 @@ namespace Internal.IL return _builder.ToString(); } - void StartImportingBasicBlock(BasicBlock basicBlock) + private void StartImportingBasicBlock(BasicBlock basicBlock) { } - void EndImportingBasicBlock(BasicBlock basicBlock) + private void EndImportingBasicBlock(BasicBlock basicBlock) { basicBlock.Code = _builder.ToString(); _builder.Clear(); } - void ImportNop() + private void ImportNop() { } - void ImportBreak() + private void ImportBreak() { throw new NotImplementedException("Opcode: break"); } - void ImportLoadVar(int index, bool argument) + private void ImportLoadVar(int index, bool argument) { string name = GetVarName(index, argument); string temp = NewTempName(); @@ -558,7 +558,7 @@ namespace Internal.IL Finish(); } - void ImportStoreVar(int index, bool argument) + private void ImportStoreVar(int index, bool argument) { var value = Pop(); @@ -572,7 +572,7 @@ namespace Internal.IL Finish(); } - void ImportAddressOfVar(int index, bool argument) + private void ImportAddressOfVar(int index, bool argument) { string name = GetVarName(index, argument); string temp = NewTempName(); @@ -587,22 +587,22 @@ namespace Internal.IL Finish(); } - void ImportDup() + private void ImportDup() { Push(_stack[_stackTop - 1]); } - void ImportPop() + private void ImportPop() { Pop(); } - void ImportJmp(int token) + private void ImportJmp(int token) { throw new NotImplementedException("Opcode: jmp"); } - void ImportCasting(ILOpcode opcode, int token) + private void ImportCasting(ILOpcode opcode, int token) { TypeDesc type = (TypeDesc)_methodIL.GetObject(token); @@ -621,7 +621,7 @@ namespace Internal.IL Finish(); } - void ImportIntrinsicCall(IntrinsicMethodKind intrinsicClassification) + private void ImportIntrinsicCall(IntrinsicMethodKind intrinsicClassification) { switch (intrinsicClassification) { @@ -669,7 +669,7 @@ namespace Internal.IL } } - void ImportCall(ILOpcode opcode, int token) + private void ImportCall(ILOpcode opcode, int token) { bool callViaSlot = false; bool delegateInvoke = false; @@ -921,7 +921,7 @@ namespace Internal.IL Finish(); } - void ImportLdFtn(int token, ILOpcode opCode) + private void ImportLdFtn(int token, ILOpcode opCode) { MethodDesc method = (MethodDesc)_methodIL.GetObject(token); @@ -939,12 +939,12 @@ namespace Internal.IL Append("::"); Append(_writer.GetCppMethodName(method)); - _stack[_stackTop-1].Value.Aux = method; + _stack[_stackTop - 1].Value.Aux = method; Finish(); } - void ImportLoadInt(long value, StackValueKind kind) + private void ImportLoadInt(long value, StackValueKind kind) { string val; if (kind == StackValueKind.Int64) @@ -965,19 +965,19 @@ namespace Internal.IL Push(kind, new Value(val)); } - void ImportLoadFloat(double value) + private void ImportLoadFloat(double value) { // TODO: Handle infinity, NaN, etc. string val = value.ToString(); Push(StackValueKind.Float, new Value(val)); } - void ImportLoadNull() + private void ImportLoadNull() { Push(StackValueKind.ObjRef, new Value("0")); } - void ImportReturn() + private void ImportReturn() { var returnType = _methodSignature.ReturnType; if (returnType.IsVoid) @@ -994,7 +994,7 @@ namespace Internal.IL Finish(); } - void ImportFallthrough(BasicBlock next) + private void ImportFallthrough(BasicBlock next) { StackValue[] entryStack = next.EntryStack; @@ -1041,7 +1041,7 @@ namespace Internal.IL MarkBasicBlock(next); } - void ImportSwitchJump(int jmpBase, int[] jmpDelta, BasicBlock fallthrough) + private void ImportSwitchJump(int jmpBase, int[] jmpDelta, BasicBlock fallthrough) { var op = Pop(); @@ -1067,7 +1067,7 @@ namespace Internal.IL ImportFallthrough(fallthrough); } - void ImportBranch(ILOpcode opcode, BasicBlock target, BasicBlock fallthrough) + private void ImportBranch(ILOpcode opcode, BasicBlock target, BasicBlock fallthrough) { if (opcode != ILOpcode.br) { @@ -1197,7 +1197,7 @@ namespace Internal.IL ImportFallthrough(fallthrough); } - void ImportBinaryOperation(ILOpcode opcode) + private void ImportBinaryOperation(ILOpcode opcode) { var op1 = Pop(); var op2 = Pop(); @@ -1216,9 +1216,9 @@ namespace Internal.IL kind = op2.Kind; type = op2.Type; } - + // The one exception from the above rule - if ((kind == StackValueKind.ByRef) && + if ((kind == StackValueKind.ByRef) && (opcode == ILOpcode.sub || opcode == ILOpcode.sub_ovf || opcode == ILOpcode.sub_ovf_un)) { kind = StackValueKind.NativeInt; @@ -1242,7 +1242,7 @@ namespace Internal.IL case ILOpcode.or: op = "|"; break; case ILOpcode.xor: op = "^"; break; - // TODO: Overflow checks + // TODO: Overflow checks case ILOpcode.add_ovf: op = "+"; break; case ILOpcode.add_ovf_un: op = "+"; unsigned = true; break; case ILOpcode.sub_ovf: op = "-"; break; @@ -1272,7 +1272,7 @@ namespace Internal.IL Finish(); } - void ImportShiftOperation(ILOpcode opcode) + private void ImportShiftOperation(ILOpcode opcode) { var shiftAmount = Pop(); var op = Pop(); @@ -1293,7 +1293,7 @@ namespace Internal.IL Finish(); } - void ImportCompareOperation(ILOpcode opcode) + private void ImportCompareOperation(ILOpcode opcode) { var op1 = Pop(); var op2 = Pop(); @@ -1332,7 +1332,7 @@ namespace Internal.IL unsigned = true; } break; - case ILOpcode.clt_un: + case ILOpcode.clt_un: if (kind == StackValueKind.Float) { op = ">="; inverted = true; @@ -1375,7 +1375,7 @@ namespace Internal.IL Finish(); } - void ImportConvert(WellKnownType wellKnownType, bool checkOverflow, bool unsigned) + private void ImportConvert(WellKnownType wellKnownType, bool checkOverflow, bool unsigned) { var op = Pop(); @@ -1389,7 +1389,7 @@ namespace Internal.IL Finish(); } - void ImportLoadField(int token, bool isStatic) + private void ImportLoadField(int token, bool isStatic) { FieldDesc field = (FieldDesc)_methodIL.GetObject(token); @@ -1439,7 +1439,7 @@ namespace Internal.IL Finish(); } - void ImportAddressOfField(int token, bool isStatic) + private void ImportAddressOfField(int token, bool isStatic) { FieldDesc field = (FieldDesc)_methodIL.GetObject(token); @@ -1491,7 +1491,7 @@ namespace Internal.IL } - void ImportStoreField(int token, bool isStatic) + private void ImportStoreField(int token, bool isStatic) { FieldDesc field = (FieldDesc)_methodIL.GetObject(token); @@ -1546,12 +1546,12 @@ namespace Internal.IL Finish(); } - void ImportLoadIndirect(int token) + private void ImportLoadIndirect(int token) { ImportLoadIndirect(ResolveTypeToken(token)); } - void ImportLoadIndirect(TypeDesc type) + private void ImportLoadIndirect(TypeDesc type) { if (type == null) type = GetWellKnownType(WellKnownType.Object); @@ -1568,12 +1568,12 @@ namespace Internal.IL Finish(); } - void ImportStoreIndirect(int token) + private void ImportStoreIndirect(int token) { ImportStoreIndirect(ResolveTypeToken(token)); } - void ImportStoreIndirect(TypeDesc type) + private void ImportStoreIndirect(TypeDesc type) { if (type == null) type = GetWellKnownType(WellKnownType.Object); @@ -1594,7 +1594,7 @@ namespace Internal.IL Finish(); } - void ImportThrow() + private void ImportThrow() { var obj = Pop(); @@ -1604,7 +1604,7 @@ namespace Internal.IL Finish(); } - void ImportLoadString(int token) + private void ImportLoadString(int token) { string str = (string)_methodIL.GetObject(token); @@ -1640,7 +1640,7 @@ namespace Internal.IL Finish(); } - void ImportInitObj(int token) + private void ImportInitObj(int token) { TypeDesc type = (TypeDesc)_methodIL.GetObject(token); @@ -1653,7 +1653,7 @@ namespace Internal.IL Finish(); } - void ImportBox(int token) + private void ImportBox(int token) { TypeDesc type = (TypeDesc)_methodIL.GetObject(token); @@ -1682,18 +1682,18 @@ namespace Internal.IL } } - static bool IsOffsetContained(int offset, int start, int length) + private static bool IsOffsetContained(int offset, int start, int length) { return start <= offset && offset < start + length; } - static string AddReturnLabel(ExceptionRegion r) + private static string AddReturnLabel(ExceptionRegion r) { r.ReturnLabels++; return r.ReturnLabels.ToString(); } - void ImportLeave(BasicBlock target) + private void ImportLeave(BasicBlock target) { // Empty the stack _stackTop = 0; @@ -1740,7 +1740,7 @@ namespace Internal.IL MarkBasicBlock(target); } - int FindNearestFinally(int offset) + private int FindNearestFinally(int offset) { int candidate = -1; for (int i = 0; i < _exceptionRegions.Length; i++) @@ -1760,7 +1760,7 @@ namespace Internal.IL return candidate; } - void ImportEndFinally() + private void ImportEndFinally() { int finallyIndex = FindNearestFinally(_currentOffset - 1); @@ -1769,7 +1769,7 @@ namespace Internal.IL Finish(); } - void ImportNewArray(int token) + private void ImportNewArray(int token) { TypeDesc type = (TypeDesc)_methodIL.GetObject(token); TypeDesc arrayType = type.Context.GetArrayType(type); @@ -1790,12 +1790,12 @@ namespace Internal.IL Finish(); } - void ImportLoadElement(int token) + private void ImportLoadElement(int token) { ImportLoadElement(ResolveTypeToken(token)); } - void ImportLoadElement(TypeDesc elementType) + private void ImportLoadElement(TypeDesc elementType) { // ldelem_ref if (elementType == null) @@ -1826,12 +1826,12 @@ namespace Internal.IL Finish(); } - void ImportStoreElement(int token) + private void ImportStoreElement(int token) { ImportStoreElement(ResolveTypeToken(token)); } - void ImportStoreElement(TypeDesc elementType) + private void ImportStoreElement(TypeDesc elementType) { // stelem_ref if (elementType == null) @@ -1840,7 +1840,7 @@ namespace Internal.IL var value = Pop(); var index = Pop(); var arrayPtr = Pop(); - + // Range check Append("__range_check("); Append(arrayPtr.Value.Name); @@ -1867,7 +1867,7 @@ namespace Internal.IL Finish(); } - void ImportAddressOfElement(int token) + private void ImportAddressOfElement(int token) { TypeDesc elementType = (TypeDesc)_methodIL.GetObject(token); var index = Pop(); @@ -1898,7 +1898,7 @@ namespace Internal.IL Finish(); } - void ImportLoadLength() + private void ImportLoadLength() { var arrayPtr = Pop(); @@ -1911,7 +1911,7 @@ namespace Internal.IL Finish(); } - void ImportUnaryOperation(ILOpcode opCode) + private void ImportUnaryOperation(ILOpcode opCode) { var argument = Pop(); @@ -1919,16 +1919,16 @@ namespace Internal.IL Append((opCode == ILOpcode.neg) ? "~" : "!"); Append(argument.Value.Name); - + Finish(); } - void ImportCpOpj(int token) + private void ImportCpOpj(int token) { throw new NotImplementedException(); } - void ImportUnbox(int token, ILOpcode opCode) + private void ImportUnbox(int token, ILOpcode opCode) { var type = ResolveTypeToken(token); @@ -1970,22 +1970,22 @@ namespace Internal.IL Finish(); } - void ImportRefAnyVal(int token) + private void ImportRefAnyVal(int token) { throw new NotImplementedException(); } - void ImportCkFinite() + private void ImportCkFinite() { throw new NotImplementedException(); } - void ImportMkRefAny(int token) + private void ImportMkRefAny(int token) { throw new NotImplementedException(); } - void ImportLdToken(int token) + private void ImportLdToken(int token) { var ldtokenValue = _methodIL.GetObject(token); WellKnownType ldtokenKind; @@ -2013,7 +2013,7 @@ namespace Internal.IL Push(value); } - void ImportLocalAlloc() + private void ImportLocalAlloc() { StackValue count = Pop(); @@ -2041,77 +2041,77 @@ namespace Internal.IL Push(StackValueKind.NativeInt, new Value(bufferName)); } - void ImportEndFilter() + private void ImportEndFilter() { throw new NotImplementedException(); } - void ImportCpBlk() + private void ImportCpBlk() { throw new NotImplementedException(); } - void ImportInitBlk() + private void ImportInitBlk() { throw new NotImplementedException(); } - void ImportRethrow() + private void ImportRethrow() { throw new NotImplementedException(); } - void ImportSizeOf(int token) + private void ImportSizeOf(int token) { var type = ResolveTypeToken(token); Push(StackValueKind.Int32, new Value("sizeof(" + _writer.GetCppTypeName(type) + ")")); } - void ImportRefAnyType() + private void ImportRefAnyType() { throw new NotImplementedException(); } - void ImportArgList() + private void ImportArgList() { throw new NotImplementedException(); } - void ImportUnalignedPrefix(byte alignment) + private void ImportUnalignedPrefix(byte alignment) { throw new NotImplementedException(); } - void ImportVolatilePrefix() + private void ImportVolatilePrefix() { // TODO: // throw new NotImplementedException(); } - void ImportTailPrefix() + private void ImportTailPrefix() { throw new NotImplementedException(); } - void ImportConstrainedPrefix(int token) + private void ImportConstrainedPrefix(int token) { _pendingPrefix |= Prefix.Constrained; _constrained = ResolveTypeToken(token); } - void ImportNoPrefix(byte mask) + private void ImportNoPrefix(byte mask) { throw new NotImplementedException(); } - void ImportReadOnlyPrefix() + private void ImportReadOnlyPrefix() { throw new NotImplementedException(); } - void TriggerCctor(TypeDesc type) + private void TriggerCctor(TypeDesc type) { // TODO: Before field init |