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:
authorDavid Wrighton <davidwr@microsoft.com>2017-03-17 03:43:47 +0300
committerDavid Wrighton <davidwr@microsoft.com>2017-03-17 03:43:47 +0300
commitd4da37e00d89a168c178d7177b8f77793e2a08e9 (patch)
tree20396f947434652af21b6d0d1dc4bdfa69631a39 /src/System.Private.Jit
parenta64d77c6301b16a1209fe2909d18ee0df004f515 (diff)
Experimental prototype of jit for CoreRT
- Refactorings and tweaks of various ILCompiler infrastructure to allow use within the runtime - Refactor delegate creation info off of CompilerTypeSystemContext onto TypeSystemContext - Tweak jit interface to always refer to nodes via interfaces instead of concrete types - adjust CorInfoImpl.constructStringLiteral to respect the RepresentsIndirectionCell flag - Initial copy of JitCodeManager. Currently only supports Windows. - System.Private.Jit - Uses infrastructure from the ILCompiler such as the CorInfoImpl, jitinterface, and the dependency node infrastructure to define a way to express newly generated code and its dependencies. - Where relocs from jitted code depend on resolving to other components, they are always indirected through an indirection cell, and the final value is computed by the dynamic type loader GenericDictionaryCell system (which is poorly named, and is actually a general purpose runtime component resolution system.) - New concept of dynamic MethodEntrypoints in the type loader. This is used to bridge to the jit where necessary - The various bits of build time goo to produce experimental versions of System.Private.Reflection.Core, System.Private.Reflection.Execution, and System.Private.TypeLoader which contain the ECMA based type loader, and support the jit. - The new behavior is only enabled for these new experimental builds. - As the existing ECMA 335 based typeloader/reflection logic hasn't been enabled for building, there are fixes to make it work again [tfs-changeset: 1651156]
Diffstat (limited to 'src/System.Private.Jit')
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/ExternObjectSymbolNode.cs45
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/FrozenStrings.cs90
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitCompilation.cs105
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitEETypeNode.cs28
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitFrozenStringNode.cs28
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitGenericMethodDictionaryNode.cs28
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitInterfaceDispatchCellNode.cs35
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodCodeNode.cs103
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodEntrypointNode.cs26
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitNodeFactory.cs188
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitTemp.cs56
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs286
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/VirtualMethodSlotHelper.cs45
-rw-r--r--src/System.Private.Jit/src/System.Private.Jit.csproj140
14 files changed, 1203 insertions, 0 deletions
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/ExternObjectSymbolNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/ExternObjectSymbolNode.cs
new file mode 100644
index 000000000..812618d50
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/ExternObjectSymbolNode.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Runtime.TypeLoader;
+using Internal.Text;
+
+using ILCompiler;
+using ILCompiler.DependencyAnalysis;
+using ILCompiler.DependencyAnalysisFramework;
+
+namespace Internal.Runtime.JitSupport
+{
+ public abstract class ExternObjectSymbolNode : DependencyNodeCore<NodeFactory>, ISymbolNode
+ {
+ public ExternObjectSymbolNode()
+ {
+ }
+
+ protected override string GetName(NodeFactory factory) { throw new PlatformNotSupportedException(); }
+
+ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { throw new PlatformNotSupportedException(); }
+ public int Offset => 0;
+
+ public override bool InterestingForDynamicDependencyAnalysis => false;
+ public override bool HasDynamicDependencies => false;
+ public override bool HasConditionalStaticDependencies => false;
+ public override bool StaticDependenciesAreComputed => true;
+
+ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFactory factory) => null;
+ public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) => null;
+ public override IEnumerable<CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<NodeFactory>> markedNodes, int firstNode, NodeFactory factory) => null;
+
+ public bool RepresentsIndirectionCell => true;
+
+ /// <summary>
+ /// Return a "GenericDictionaryCell" which can be used to get a pointer sized value
+ /// points to or is what this nodeis used with.
+ /// </summary>
+ public abstract GenericDictionaryCell GetDictionaryCell();
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/FrozenStrings.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/FrozenStrings.cs
new file mode 100644
index 000000000..0070456d8
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/FrozenStrings.cs
@@ -0,0 +1,90 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Runtime.InteropServices;
+using Internal.TypeSystem;
+
+namespace Internal.Runtime.JitSupport
+{
+ public static class FrozenStrings
+ {
+ private class FrozenStringHashTable : LockFreeReaderHashtableOfPointers<string, GCHandle>
+ {
+ /// <summary>
+ /// Given a key, compute a hash code. This function must be thread safe.
+ /// </summary>
+ protected override int GetKeyHashCode(string key)
+ {
+ return key.GetHashCode();
+ }
+
+ /// <summary>
+ /// Given a value, compute a hash code which would be identical to the hash code
+ /// for a key which should look up this value. This function must be thread safe.
+ /// </summary>
+ protected override int GetValueHashCode(GCHandle value)
+ {
+ return value.Target.GetHashCode();
+ }
+
+ /// <summary>
+ /// Compare a key and value. If the key refers to this value, return true.
+ /// This function must be thread safe.
+ /// </summary>
+ protected override bool CompareKeyToValue(string key, GCHandle value)
+ {
+ return key.Equals((string)value.Target);
+ }
+
+ /// <summary>
+ /// Compare a value with another value. Return true if values are equal.
+ /// This function must be thread safe.
+ /// </summary>
+ protected override bool CompareValueToValue(GCHandle value1, GCHandle value2)
+ {
+ return value1.Target.Equals(value2.Target);
+ }
+
+ /// <summary>
+ /// Create a new value from a key. Must be threadsafe. Value may or may not be added
+ /// to collection. Return value must not be null.
+ /// </summary>
+ protected override GCHandle CreateValueFromKey(string key)
+ {
+ return GCHandle.Alloc(key, GCHandleType.Pinned);
+ }
+
+ /// <summary>
+ /// Convert a value to an IntPtr for storage into the hashtable
+ /// </summary>
+ protected override IntPtr ConvertValueToIntPtr(GCHandle value)
+ {
+ return GCHandle.ToIntPtr(value);
+ }
+
+ /// <summary>
+ /// Convert an IntPtr into a value for comparisions, or for returning.
+ /// </summary>
+ protected override GCHandle ConvertIntPtrToValue(IntPtr pointer)
+ {
+ return GCHandle.FromIntPtr(pointer);
+ }
+ }
+
+ private static FrozenStringHashTable s_stringHash = new FrozenStringHashTable();
+
+ public static IntPtr GetRawPointer(string str)
+ {
+ GCHandle gcHandle = s_stringHash.GetOrCreateValue(str);
+
+ // Manual reading out of pointer to target object from pinned GCHandle
+ IntPtr gcHandleAsIntPtr = GCHandle.ToIntPtr(gcHandle) - 1;
+ unsafe
+ {
+ return *(IntPtr*)gcHandleAsIntPtr.ToPointer();
+ }
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitCompilation.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitCompilation.cs
new file mode 100644
index 000000000..14faeb3f9
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitCompilation.cs
@@ -0,0 +1,105 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Diagnostics;
+
+using Internal.TypeSystem;
+using ILCompiler.DependencyAnalysis;
+using Internal.IL;
+using Internal.IL.Stubs;
+
+namespace ILCompiler
+{
+ /// <summary>
+ /// Version of Compilation class used for JIT compilation. Should probably be merged with the Compilation class used in AOT compilation
+ /// </summary>
+ internal class Compilation
+ {
+ public Compilation(TypeSystemContext context)
+ {
+ _typeSystemContext = context;
+ _typeGetTypeMethodThunks = new TypeGetTypeMethodThunkCache(context.GetWellKnownType(WellKnownType.Object));
+ _methodILCache = new ILProvider(new PInvokeILProvider(new PInvokeILEmitterConfiguration(forceLazyResolution: true)));
+ _nodeFactory = new NodeFactory(context);
+ }
+
+ private readonly NodeFactory _nodeFactory;
+ private readonly TypeSystemContext _typeSystemContext;
+ protected readonly Logger _logger = Logger.Null;
+ private readonly TypeGetTypeMethodThunkCache _typeGetTypeMethodThunks;
+ private ILProvider _methodILCache;
+
+ internal Logger Logger => _logger;
+
+ public TypeSystemContext TypeSystemContext { get { return _typeSystemContext; } }
+ public NodeFactory NodeFactory { get { return _nodeFactory; } }
+
+ public NameMangler NameMangler { get { return null; } }
+
+ public ObjectNode GetFieldRvaData(FieldDesc field)
+ {
+ // Use the typical field definition in case this is an instantiated generic type
+ field = field.GetTypicalFieldDefinition();
+ throw new NotImplementedException();
+ }
+
+ internal MethodIL GetMethodIL(MethodDesc method)
+ {
+ // Flush the cache when it grows too big
+ if (_methodILCache.Count > 1000)
+ _methodILCache = new ILProvider(new PInvokeILProvider(new PInvokeILEmitterConfiguration(forceLazyResolution: true)));
+
+ return _methodILCache.GetMethodIL(method);
+ }
+
+ public bool HasLazyStaticConstructor(TypeDesc type) { return type.HasStaticConstructor; }
+
+ public MethodDebugInformation GetDebugInfo(MethodIL methodIL)
+ {
+ // This method looks odd right now, but it's an extensibility point that lets us generate
+ // fake debugging information for things that don't have physical symbols.
+ return methodIL.GetDebugInfo();
+ }
+
+ /// <summary>
+ /// Resolves a reference to an intrinsic method to a new method that takes it's place in the compilation.
+ /// This is used for intrinsics where the intrinsic expansion depends on the callsite.
+ /// </summary>
+ /// <param name="intrinsicMethod">The intrinsic method called.</param>
+ /// <param name="callsiteMethod">The callsite that calls the intrinsic.</param>
+ /// <returns>The intrinsic implementation to be called for this specific callsite.</returns>
+ public MethodDesc ExpandIntrinsicForCallsite(MethodDesc intrinsicMethod, MethodDesc callsiteMethod)
+ {
+ Debug.Assert(intrinsicMethod.IsIntrinsic);
+
+ var intrinsicOwningType = intrinsicMethod.OwningType as MetadataType;
+ if (intrinsicOwningType == null)
+ return intrinsicMethod;
+
+ if (intrinsicOwningType.Module != TypeSystemContext.SystemModule)
+ return intrinsicMethod;
+
+ if (intrinsicOwningType.Name == "Type" && intrinsicOwningType.Namespace == "System")
+ {
+ if (intrinsicMethod.Signature.IsStatic && intrinsicMethod.Name == "GetType")
+ {
+ ModuleDesc callsiteModule = (callsiteMethod.OwningType as MetadataType)?.Module;
+ if (callsiteModule != null)
+ {
+ Debug.Assert(callsiteModule is IAssemblyDesc, "Multi-module assemblies");
+ return _typeGetTypeMethodThunks.GetHelper(intrinsicMethod, ((IAssemblyDesc)callsiteModule).GetName().FullName);
+ }
+ }
+ }
+
+ return intrinsicMethod;
+ }
+
+ public DelegateCreationInfo GetDelegateCtor(TypeDesc delegateType, MethodDesc target)
+ {
+ return DelegateCreationInfo.Create(delegateType, target, NodeFactory);
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitEETypeNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitEETypeNode.cs
new file mode 100644
index 000000000..312ff701a
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitEETypeNode.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.TypeSystem;
+
+using ILCompiler.DependencyAnalysis;
+using Internal.Runtime.TypeLoader;
+
+namespace Internal.Runtime.JitSupport
+{
+ class JitEETypeNode : ExternObjectSymbolNode
+ {
+ public JitEETypeNode(TypeDesc type)
+ {
+ Type = type;
+ }
+
+ public TypeDesc Type { get; }
+
+ public override GenericDictionaryCell GetDictionaryCell()
+ {
+ return GenericDictionaryCell.CreateTypeHandleCell(Type);
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitFrozenStringNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitFrozenStringNode.cs
new file mode 100644
index 000000000..9502ae8e9
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitFrozenStringNode.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.TypeSystem;
+
+using ILCompiler.DependencyAnalysis;
+using Internal.Runtime.TypeLoader;
+
+namespace Internal.Runtime.JitSupport
+{
+ public class JitFrozenStringNode : ExternObjectSymbolNode
+ {
+ public JitFrozenStringNode(string stringToBeFrozen)
+ {
+ FrozenString = stringToBeFrozen;
+ }
+
+ public string FrozenString { get; }
+
+ public override GenericDictionaryCell GetDictionaryCell()
+ {
+ return GenericDictionaryCell.CreateIntPtrCell(FrozenStrings.GetRawPointer(FrozenString));
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitGenericMethodDictionaryNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitGenericMethodDictionaryNode.cs
new file mode 100644
index 000000000..54fc9f383
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitGenericMethodDictionaryNode.cs
@@ -0,0 +1,28 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.TypeSystem;
+
+using ILCompiler.DependencyAnalysis;
+using Internal.Runtime.TypeLoader;
+
+namespace Internal.Runtime.JitSupport
+{
+ public class JitGenericMethodDictionaryNode : ExternObjectSymbolNode
+ {
+ public JitGenericMethodDictionaryNode(InstantiatedMethod method)
+ {
+ Method = method;
+ }
+
+ public InstantiatedMethod Method { get; }
+
+ public override GenericDictionaryCell GetDictionaryCell()
+ {
+ return GenericDictionaryCell.CreateMethodDictionaryCell(Method);
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitInterfaceDispatchCellNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitInterfaceDispatchCellNode.cs
new file mode 100644
index 000000000..40d636b5d
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitInterfaceDispatchCellNode.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.TypeSystem;
+
+using ILCompiler.DependencyAnalysis;
+using Internal.Runtime.TypeLoader;
+
+namespace Internal.Runtime.JitSupport
+{
+ class JitInterfaceDispatchCellNode : ExternObjectSymbolNode
+ {
+ public JitInterfaceDispatchCellNode(MethodDesc m)
+ {
+ Method = m;
+ }
+
+ public MethodDesc Method { get; }
+
+ public override GenericDictionaryCell GetDictionaryCell()
+ {
+ ushort slot;
+
+ if (!LazyVTableResolver.TryGetInterfaceSlotNumberFromMethod(Method, out slot))
+ {
+ Environment.FailFast("Unable to get interface slot number for method");
+ }
+
+ return GenericDictionaryCell.CreateInterfaceCallCell(Method.OwningType, slot);
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodCodeNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodCodeNode.cs
new file mode 100644
index 000000000..4e66d5d38
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodCodeNode.cs
@@ -0,0 +1,103 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.Text;
+using Internal.TypeSystem;
+
+using ILCompiler;
+using ILCompiler.DependencyAnalysis;
+
+using Debug = System.Diagnostics.Debug;
+
+namespace Internal.Runtime.JitSupport
+{
+ public class JitMethodCodeNode : ObjectNode, IMethodCodeNode
+ {
+ public JitMethodCodeNode(MethodDesc method)
+ {
+ _method = method;
+ }
+
+ private MethodDesc _method;
+ private ObjectData _methodCode;
+ private FrameInfo[] _frameInfos;
+ private byte[] _gcInfo;
+ private ObjectData _ehInfo;
+ private DebugLocInfo[] _debugLocInfos;
+ private DebugVarInfo[] _debugVarInfos;
+
+ public void SetCode(ObjectData data)
+ {
+ Debug.Assert(_methodCode == null);
+ _methodCode = data;
+ }
+
+ public MethodDesc Method => _method;
+
+ public FrameInfo[] FrameInfos => _frameInfos;
+ public byte[] GCInfo => _gcInfo;
+ public ObjectData EHInfo => _ehInfo;
+
+ public void InitializeFrameInfos(FrameInfo[] frameInfos)
+ {
+ Debug.Assert(_frameInfos == null);
+ _frameInfos = frameInfos;
+ }
+
+ public void InitializeGCInfo(byte[] gcInfo)
+ {
+ Debug.Assert(_gcInfo == null);
+ _gcInfo = gcInfo;
+ }
+
+ public void InitializeEHInfo(ObjectData ehInfo)
+ {
+ Debug.Assert(_ehInfo == null);
+ _ehInfo = ehInfo;
+ }
+ public DebugLocInfo[] DebugLocInfos => _debugLocInfos;
+ public DebugVarInfo[] DebugVarInfos => _debugVarInfos;
+
+ public void InitializeDebugLocInfos(DebugLocInfo[] debugLocInfos)
+ {
+ Debug.Assert(_debugLocInfos == null);
+ _debugLocInfos = debugLocInfos;
+ }
+
+ public void InitializeDebugVarInfos(DebugVarInfo[] debugVarInfos)
+ {
+ Debug.Assert(_debugVarInfos == null);
+ _debugVarInfos = debugVarInfos;
+ }
+
+ protected override string GetName(NodeFactory factory)
+ {
+ throw new PlatformNotSupportedException();
+ }
+
+ public override ObjectNodeSection Section
+ {
+ get
+ {
+ throw new PlatformNotSupportedException();
+ }
+ }
+
+ public override bool StaticDependenciesAreComputed => _methodCode != null;
+
+ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
+ {
+ throw new PlatformNotSupportedException();
+ }
+ public int Offset => 0;
+ public override bool IsShareable => false;
+
+ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
+ {
+ return _methodCode;
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodEntrypointNode.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodEntrypointNode.cs
new file mode 100644
index 000000000..3b775ba49
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitMethodEntrypointNode.cs
@@ -0,0 +1,26 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Internal.TypeSystem;
+
+using ILCompiler.DependencyAnalysis;
+using Internal.Runtime.TypeLoader;
+
+namespace Internal.Runtime.JitSupport
+{
+ internal class JitMethodEntrypointNode : ExternObjectSymbolNode, IMethodNode
+ {
+ public JitMethodEntrypointNode(MethodDesc m)
+ {
+ Method = m;
+ }
+
+ public MethodDesc Method { get; }
+
+ public override GenericDictionaryCell GetDictionaryCell()
+ {
+ return GenericDictionaryCell.CreateExactCallableMethodCell(Method);
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitNodeFactory.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitNodeFactory.cs
new file mode 100644
index 000000000..413c17ecc
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitNodeFactory.cs
@@ -0,0 +1,188 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Runtime.JitSupport;
+
+using Internal.TypeSystem;
+using Internal.IL;
+using ILCompiler.DependencyAnalysisFramework;
+
+namespace ILCompiler.DependencyAnalysis
+{
+ /// <summary>
+ /// Separate copy of NodeFactory from compiler implementation. This should be refactored to use
+ /// NodeFactory as a base type, but time constraints currently prevent resourcing for that
+ /// </summary>
+ public class NodeFactory
+ {
+ private struct NodeCache<TKey, TValue>
+ {
+ private Func<TKey, TValue> _creator;
+ private Dictionary<TKey, TValue> _cache;
+
+ public NodeCache(Func<TKey, TValue> creator, IEqualityComparer<TKey> comparer)
+ {
+ _creator = creator;
+ _cache = new Dictionary<TKey, TValue>(comparer);
+ }
+
+ public NodeCache(Func<TKey, TValue> creator)
+ {
+ _creator = creator;
+ _cache = new Dictionary<TKey, TValue>();
+ }
+
+ public TValue GetOrAdd(TKey key)
+ {
+ TValue result;
+ if (!_cache.TryGetValue(key, out result))
+ {
+ result = _creator(key);
+ _cache.Add(key, result);
+ }
+ return result;
+ }
+ }
+
+ private NodeCache<MethodDesc, IMethodNode> _methodEntrypoints;
+ private NodeCache<string, JitFrozenStringNode> _frozenStrings;
+
+ private void CreateNodeCaches()
+ {
+ _methodEntrypoints = new NodeCache<MethodDesc, IMethodNode>(method =>
+ {
+ return new JitMethodEntrypointNode(method);
+ });
+
+ _frozenStrings = new NodeCache<string, JitFrozenStringNode>(str =>
+ {
+ return new JitFrozenStringNode(str);
+ });
+ }
+
+ TargetDetails _targetDetails;
+ TypeSystemContext _typeSystemContext;
+
+ public NodeFactory(TypeSystemContext typeSystemContext)
+ {
+ _targetDetails = typeSystemContext.Target;
+ _typeSystemContext = typeSystemContext;
+ CreateNodeCaches();
+ }
+
+ public BlobNode ReadOnlyDataBlob(string s, byte[] b, int align) { throw new NotImplementedException(); }
+ public ISymbolNode ReadyToRunHelper(ReadyToRunHelperId id, Object target) { throw new NotImplementedException(); }
+ public IMethodNode MethodEntrypoint(MethodDesc method, bool unboxingStub = false)
+ {
+ if (unboxingStub != false)
+ {
+ throw new NotImplementedException();
+ }
+
+ return _methodEntrypoints.GetOrAdd(method);
+ }
+
+ public IMethodNode RuntimeDeterminedMethod(MethodDesc method) { throw new NotImplementedException(); }
+ public JitFrozenStringNode SerializedStringObject(string data) { return _frozenStrings.GetOrAdd(data); }
+ public JitGenericMethodDictionaryNode MethodGenericDictionary(MethodDesc method) { throw new NotImplementedException(); }
+ public IEETypeNode ConstructedTypeSymbol(TypeDesc type) { throw new NotImplementedException(); }
+ public IMethodNode ShadowConcreteMethod(MethodDesc method, bool isUnboxingStub = false) { throw new NotImplementedException(); }
+ internal IMethodNode StringAllocator(MethodDesc stringConstructor) { throw new NotImplementedException(); }
+ public ISymbolNode ExternSymbol(string name) { throw new NotImplementedException(); }
+ public IEETypeNode NecessaryTypeSymbol(TypeDesc type) { return ConstructedTypeSymbol(type); }
+ internal JitInterfaceDispatchCellNode InterfaceDispatchCell(MethodDesc method) { throw new NotImplementedException(); }
+ public ISymbolNode RuntimeMethodHandle(MethodDesc method) { throw new NotImplementedException(); }
+ public ISymbolNode RuntimeFieldHandle(FieldDesc field) { throw new NotImplementedException(); }
+ public IMethodNode FatFunctionPointer(MethodDesc method, bool isUnboxingStub = false) { return MethodEntrypoint(method); }
+ public ISymbolNode TypeThreadStaticIndex(MetadataType type) { throw new NotImplementedException(); }
+
+ public TargetDetails Target
+ {
+ get
+ {
+ return _targetDetails;
+ }
+ }
+
+ public TypeSystemContext TypeSystemContext
+ {
+ get
+ {
+ return _typeSystemContext;
+ }
+ }
+
+ public NameMangler NameMangler
+ {
+ get
+ {
+ return null; // No name mangling in the jit
+ }
+ }
+
+ public ISymbolNode ReadyToRunHelperFromDictionaryLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner)
+ {
+ throw new NotImplementedException();
+ }
+
+ public ISymbolNode ReadyToRunHelperFromTypeLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner)
+ {
+ throw new NotImplementedException();
+ }
+
+ public DependencyNode VirtualMethodUse(MethodDesc decl)
+ {
+ throw new NotImplementedException();
+ }
+
+ internal DependencyNodeCore<NodeFactory> VTable(TypeDesc type)
+ {
+ throw new NotImplementedException();
+ }
+
+ public ISymbolNode TypeNonGCStaticsSymbol(MetadataType type)
+ {
+ throw new NotImplementedException();
+ }
+
+ public ISymbolNode TypeGCStaticsSymbol(MetadataType type)
+ {
+ throw new NotImplementedException();
+ }
+
+ private static readonly string[][] s_helperEntrypointNames = new string[][] {
+ new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnGCStaticBase" },
+ new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnNonGCStaticBase" },
+ new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnThreadStaticBase" },
+ new string[] { "Internal.Runtime", "ThreadStatics", "GetThreadStaticBaseForType" }
+ };
+
+ private ISymbolNode[] _helperEntrypointSymbols;
+
+ public ISymbolNode HelperEntrypoint(HelperEntrypoint entrypoint)
+ {
+ if (_helperEntrypointSymbols == null)
+ _helperEntrypointSymbols = new ISymbolNode[s_helperEntrypointNames.Length];
+
+ int index = (int)entrypoint;
+
+ ISymbolNode symbol = _helperEntrypointSymbols[index];
+ if (symbol == null)
+ {
+ var entry = s_helperEntrypointNames[index];
+
+ var type = TypeSystemContext.SystemModule.GetKnownType(entry[0], entry[1]);
+ var method = type.GetKnownMethod(entry[2], null);
+
+ symbol = MethodEntrypoint(method);
+
+ _helperEntrypointSymbols[index] = symbol;
+ }
+ return symbol;
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitTemp.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitTemp.cs
new file mode 100644
index 000000000..0cd3244bb
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/JitTemp.cs
@@ -0,0 +1,56 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.Runtime.TypeLoader;
+
+using Internal.TypeSystem;
+using Internal.IL;
+
+namespace ILCompiler
+{
+ public static class TypeSystemContextExtensionsForCompiler
+ {
+ public static bool HasLazyStaticConstructor(this TypeSystemContext context, TypeDesc type)
+ {
+ return type.HasStaticConstructor;
+ }
+ public static bool IsSpecialUnboxingThunkTargetMethod(this TypeSystemContext context, MethodDesc method)
+ {
+ return false;
+ }
+ }
+}
+
+namespace ILCompiler.DependencyAnalysis
+{
+ public static class EETypeNode
+ {
+ public static int GetVTableOffset(int pointerSize)
+ {
+ // THIS FACTORING IS NOT GOOD. MOVE THIS SOMEWHERE BETTER
+ throw new NotImplementedException();
+ }
+ }
+
+ public static class NonGCStaticsNode
+ {
+ public static int GetClassConstructorContextStorageSize(TargetDetails target, MetadataType type)
+ {
+ // THIS FACTORING IS NOT GOOD. MOVE THIS SOMEWHERE BETTER
+ throw new NotImplementedException();
+ }
+ }
+
+ public static class ConstructedEETypeNode
+ {
+ public static bool CreationAllowed(TypeDesc type)
+ {
+ // The type handles created by the jit environment don't distinguish between creatable and not.
+ // THIS FACTORING IS NOT GOOD. MOVE THIS SOMEWHERE BETTER
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs
new file mode 100644
index 000000000..078258ef8
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs
@@ -0,0 +1,286 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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.Runtime;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+
+using Internal.JitInterface;
+using Internal.Runtime.TypeLoader;
+using Internal.TypeSystem;
+
+using ILCompiler;
+using ILCompiler.DependencyAnalysisFramework;
+using ILCompiler.DependencyAnalysis;
+
+using Debug = System.Diagnostics.Debug;
+
+namespace Internal.Runtime.JitSupport
+{
+ public class RyuJitExecutionStrategy : MethodExecutionStrategy
+ {
+ private CorInfoImpl _corInfoImpl;
+ private TypeSystemContext _context;
+ private NodeFactory _nodeFactory;
+
+ private void UpdateBytesUsed(ObjectNode.ObjectData nodeData, ref int bytesUsed)
+ {
+ bytesUsed = bytesUsed.AlignUp(nodeData.Alignment);
+ bytesUsed += nodeData.Data.Length;
+ return;
+ }
+
+ [DllImport("jitinterface")]
+ static extern IntPtr AllocJittedCode(UInt32 cbCode, UInt32 align, out IntPtr pCodeManager);
+
+ [DllImport("jitinterface")]
+ static extern void SetEHInfoPtr(IntPtr pCodeManager, IntPtr pbCode, IntPtr ehInfo);
+
+ [DllImport("jitinterface")]
+ static extern unsafe IntPtr PublishRuntimeFunction(
+ IntPtr pCodeManager,
+ IntPtr pbCode,
+ IntPtr pMainRuntimeFunction,
+ UInt32 startOffset,
+ UInt32 endOffset,
+ byte[] pUnwindInfo,
+ UInt32 cbUnwindInfo,
+ byte[] pGCData,
+ UInt32 cbGCData);
+
+ [DllImport("jitinterface")]
+ static extern void UpdateRuntimeFunctionTable(IntPtr pCodeManager);
+
+ [DllImport("jitinterface")]
+ static extern void InitJitCodeManager(IntPtr mrtModule);
+
+ public override IntPtr OnEntryPoint(MethodEntrypointPtr methodEntrypoint, IntPtr callerArgs)
+ {
+ lock (this)
+ {
+ if (_corInfoImpl == null)
+ {
+ InitJitCodeManager(RuntimeImports.RhGetOSModuleForMrt ());
+
+ // TODO: Recycle jit interface object and TypeSystemContext
+ _context = TypeSystemContextFactory.Create();
+
+ Compilation compilation = new Compilation(_context);
+ _nodeFactory = compilation.NodeFactory;
+
+ JitConfigProvider configProvider = new JitConfigProvider(new CorJitFlag[] { CorJitFlag.CORJIT_FLAG_DEBUG_CODE }, Array.Empty<KeyValuePair<string, string>>());
+
+ _corInfoImpl = new CorInfoImpl(compilation, configProvider);
+ }
+
+ MethodDesc methodToCompile = methodEntrypoint.MethodIdentifier.ToMethodDesc(_context);
+
+ JitMethodCodeNode codeNode = new JitMethodCodeNode(methodToCompile);
+ _corInfoImpl.CompileMethod(codeNode);
+
+ ObjectNode.ObjectData codeData = codeNode.GetData(null, false);
+
+ List<ObjectNode> nodesToEmit = new List<ObjectNode>();
+ Dictionary<DependencyNodeCore<NodeFactory>, object> relocTargets = new Dictionary<DependencyNodeCore<NodeFactory>, object>();
+ int totalAllocSizeNeeded = 0;
+ int nonObjectRelocTargets = 0;
+
+ nodesToEmit.Add(codeNode);
+ UpdateBytesUsed(codeNode.GetData(_nodeFactory), ref totalAllocSizeNeeded);
+
+ int offsetOfEHData = totalAllocSizeNeeded;
+
+ if (codeNode.EHInfo != null)
+ {
+ Debug.Assert(codeNode.EHInfo.Alignment == 1); // Assert needed as otherwise offsetOfEHData will be wrong
+
+ UpdateBytesUsed(codeNode.EHInfo, ref totalAllocSizeNeeded);
+ ComputeDependencySizeAndRelocData(codeNode.EHInfo, relocTargets, nodesToEmit, ref totalAllocSizeNeeded, ref nonObjectRelocTargets);
+ }
+
+ for (int i = 0; i < nodesToEmit.Count; i++)
+ {
+ ObjectNode objNode = nodesToEmit[i];
+ ComputeDependencySizeAndRelocData(objNode.GetData(_nodeFactory, true), relocTargets, nodesToEmit, ref totalAllocSizeNeeded, ref nonObjectRelocTargets);
+ }
+
+ if (nonObjectRelocTargets != 0)
+ {
+ totalAllocSizeNeeded = totalAllocSizeNeeded.AlignUp(IntPtr.Size);
+ }
+
+ int relocTargetOffsetStart = totalAllocSizeNeeded;
+
+ DependencyNodeCore<NodeFactory>[] relocTargetsArray = new DependencyNodeCore<NodeFactory>[nonObjectRelocTargets];
+ {
+ int iRelocTarget = 0;
+ foreach (var relocTarget in relocTargets)
+ {
+ if (!(relocTarget.Key is ObjectNode))
+ {
+ relocTargetsArray[iRelocTarget] = relocTarget.Key;
+ totalAllocSizeNeeded += IntPtr.Size;
+ iRelocTarget++;
+ }
+ }
+ Debug.Assert(iRelocTarget == nonObjectRelocTargets);
+ }
+
+ GenericDictionaryCell[] genDictCells = new GenericDictionaryCell[relocTargetsArray.Length];
+ for (int iRelocTarget = 0; iRelocTarget < relocTargetsArray.Length; iRelocTarget++)
+ {
+ DependencyNodeCore<NodeFactory> relocTarget = relocTargetsArray[iRelocTarget];
+ GenericDictionaryCell newCell = null;
+
+ if (relocTarget is ExternObjectSymbolNode)
+ {
+ var externObjectSymbolNode = (ExternObjectSymbolNode)relocTarget;
+ var newMethodCell = externObjectSymbolNode.GetDictionaryCell();
+ newCell = newMethodCell;
+ }
+
+ if (newCell == null)
+ {
+ Environment.FailFast("Unknown reloc target type");
+ }
+ genDictCells[iRelocTarget] = newCell;
+ }
+
+ IntPtr[] relocTargetsAsIntPtr = null;
+
+ TypeLoaderEnvironment.Instance.RunUnderTypeLoaderLock(
+ () =>
+ {
+ TypeBuilderApi.ResolveMultipleCells(genDictCells, out relocTargetsAsIntPtr);
+ });
+
+ // Layout of allocated memory...
+ // ObjectNodes (aligned as appropriate)
+ IntPtr pCodeManager;
+ IntPtr jittedCode = AllocJittedCode(checked((uint)totalAllocSizeNeeded), 8/* TODO, alignment calculation */, out pCodeManager);
+ int currentOffset = 0;
+
+ foreach (var node in nodesToEmit)
+ {
+ ObjectNode.ObjectData objectData = node.GetData(_nodeFactory);
+ EmitAndRelocData(objectData, jittedCode, relocTargetOffsetStart, ref currentOffset, relocTargetsArray, relocTargetsAsIntPtr);
+
+ // EHInfo doesn't get its own node, but it does get emitted into the stream.
+ if ((node == codeNode) && (codeNode.EHInfo != null))
+ {
+ Debug.Assert(offsetOfEHData == currentOffset);
+ EmitAndRelocData(codeNode.EHInfo, jittedCode, relocTargetOffsetStart, ref currentOffset, relocTargetsArray, relocTargetsAsIntPtr);
+ }
+ }
+
+ foreach (IntPtr ptr in relocTargetsAsIntPtr)
+ {
+ currentOffset = currentOffset.AlignUp(IntPtr.Size);
+ Marshal.WriteIntPtr(jittedCode, currentOffset, ptr);
+ currentOffset += IntPtr.Size;
+ }
+
+ SetEHInfoPtr(pCodeManager, jittedCode, jittedCode + offsetOfEHData);
+
+ IntPtr mainRuntimeFunction = IntPtr.Zero;
+
+ for (int i = 0; i < codeNode.FrameInfos.Length; i++)
+ {
+ FrameInfo frame = codeNode.FrameInfos[i];
+ byte[] frameData = frame.BlobData;
+ byte[] gcInfoData = Array.Empty<byte>();
+ byte[] gcInfoDataDeref = frameData;
+
+ if (i == 0)
+ {
+ // For main function, add the gc info to the data
+ gcInfoDataDeref = gcInfoData = codeNode.GCInfo;
+ }
+
+ IntPtr publishedFunction = PublishRuntimeFunction(pCodeManager,
+ jittedCode,
+ mainRuntimeFunction,
+ checked((uint)frame.StartOffset),
+ checked((uint)frame.EndOffset),
+ frameData,
+ checked((uint)frameData.Length),
+ gcInfoDataDeref,
+ checked((uint)gcInfoData.Length));
+
+ if (i == 0)
+ {
+ mainRuntimeFunction = publishedFunction;
+ }
+ }
+
+ if (mainRuntimeFunction != IntPtr.Zero)
+ {
+ UpdateRuntimeFunctionTable(pCodeManager);
+ }
+
+ methodEntrypoint.MethodCode = jittedCode;
+
+ return jittedCode;
+ }
+ }
+
+ void ComputeDependencySizeAndRelocData(ObjectNode.ObjectData objectData, Dictionary<DependencyNodeCore<NodeFactory>, object> relocTargets, List<ObjectNode> nodesToEmit, ref int totalAllocSizeNeeded, ref int nonObjectRelocTargets)
+ {
+ foreach (var reloc in objectData.Relocs)
+ {
+ DependencyNodeCore<NodeFactory> relocTargetAsNode = (DependencyNodeCore<NodeFactory>)reloc.Target;
+
+ if (!relocTargets.ContainsKey(relocTargetAsNode))
+ {
+ relocTargets.Add(relocTargetAsNode, null);
+ ObjectNode relocTargetObjectNode = relocTargetAsNode as ObjectNode;
+ if (relocTargetObjectNode != null)
+ {
+ UpdateBytesUsed(relocTargetObjectNode.GetData(_nodeFactory), ref totalAllocSizeNeeded);
+ nodesToEmit.Add(relocTargetObjectNode);
+ }
+ else
+ {
+ nonObjectRelocTargets++;
+ }
+ }
+ }
+ }
+
+ void EmitAndRelocData(ObjectNode.ObjectData objectData, IntPtr jittedCode, int relocTargetOffsetStart, ref int currentOffset, DependencyNodeCore<NodeFactory>[] relocTargetsArray, IntPtr[] relocTargetsAsIntPtr)
+ {
+ currentOffset = currentOffset.AlignUp(objectData.Alignment);
+ Marshal.Copy(objectData.Data, 0, jittedCode + currentOffset, objectData.Data.Length);
+ foreach (Relocation reloc in objectData.Relocs)
+ {
+ switch (reloc.RelocType)
+ {
+ case RelocType.IMAGE_REL_BASED_REL32:
+ // 4 byte offset from current pointer to target
+ // ADD ROUTINE TO FIND Relocation
+ for (int i = 0; i < relocTargetsArray.Length; i++)
+ {
+ if (relocTargetsArray[i] == reloc.Target)
+ {
+ int relocTargetAddressOffset = relocTargetOffsetStart + i * IntPtr.Size;
+ int relocAddressOffset = currentOffset + reloc.Offset;
+
+ int relocTargetAddressDelta = relocTargetAddressOffset - relocAddressOffset - 4;
+ Marshal.WriteInt32(jittedCode, relocAddressOffset, relocTargetAddressDelta);
+ break;
+ }
+ }
+ break;
+
+ default:
+ Environment.FailFast("Unknown RelocType");
+ break;
+ }
+ }
+
+ currentOffset += objectData.Data.Length;
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/VirtualMethodSlotHelper.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/VirtualMethodSlotHelper.cs
new file mode 100644
index 000000000..10e3466bd
--- /dev/null
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/VirtualMethodSlotHelper.cs
@@ -0,0 +1,45 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// 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 Internal.TypeSystem;
+using Internal.Runtime.TypeLoader;
+
+using ILCompiler.DependencyAnalysis;
+
+using Debug = System.Diagnostics.Debug;
+
+namespace ILCompiler
+{
+ /// <summary>
+ /// Jit specific version of virtual method slot resolution. Completely different from the compiler implementation
+ /// as it is able to function in a partial metadata environment.
+ /// </summary>
+ internal static class VirtualMethodSlotHelper
+ {
+ /// <summary>
+ /// Given a virtual method decl, return its VTable slot if the method is used on its containing type.
+ /// Return -1 if the virtual method is not used.
+ /// </summary>
+ public static int GetVirtualMethodSlot(NodeFactory factory, MethodDesc method)
+ {
+ Debug.Assert(method.IsVirtual);
+
+ if (method.OwningType.IsInterface)
+ {
+ ushort slot;
+ if (!LazyVTableResolver.TryGetInterfaceSlotNumberFromMethod(method, out slot))
+ {
+ Environment.FailFast("Unable to get interface slot number for method");
+ }
+ return slot;
+ }
+ else
+ {
+ return LazyVTableResolver.VirtualMethodToSlotIndex(method);
+ }
+ }
+ }
+}
diff --git a/src/System.Private.Jit/src/System.Private.Jit.csproj b/src/System.Private.Jit/src/System.Private.Jit.csproj
new file mode 100644
index 000000000..5a47091dc
--- /dev/null
+++ b/src/System.Private.Jit/src/System.Private.Jit.csproj
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>System.Private.Jit</AssemblyName>
+ <AssemblyVersion>4.0.0.0</AssemblyVersion>
+ <OutputType>Library</OutputType>
+ <ProjectGuid>{82CAE34B-8C3B-4D47-A809-CB2E22E0D36B}</ProjectGuid>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CLSCompliant>false</CLSCompliant>
+ <DefineConstants>TYPE_LOADER_IMPLEMENTATION;SUPPORTS_NATIVE_METADATA_TYPE_LOADING;$(DefineConstants)</DefineConstants>
+ <METADATA_TYPE_LOADER>true</METADATA_TYPE_LOADER>
+ <EcmaMetadataSupport>true</EcmaMetadataSupport>
+ <JitSupport>true</JitSupport>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the options -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
+ <PropertyGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+ <DefineConstants>CORERT;AMD64;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(JitSupport)' == 'true'">
+ <DefineConstants>SUPPORT_JIT;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(EcmaMetadataSupport)' == 'true'">
+ <DefineConstants>ECMA_METADATA_SUPPORT;$(DefineConstants)</DefineConstants>
+ </PropertyGroup>
+ <!-- Setup the right references -->
+ <ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
+ <ProjectReference Include="..\..\AotPackageReference\AotPackageReference.depproj">
+ <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
+ </ProjectReference>
+ <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.dll" />
+ <ReferencePath Include="$(AotPackageReferencePath)\System.Runtime.Extensions.dll" />
+ <ReferencePath Include="$(EcmaMetadataDllPath)\System.Private.Reflection.Metadata.Ecma335.dll" />
+ <ProjectReference Include="..\..\System.Private.CoreLib\src\System.Private.CoreLib.csproj" />
+ <ProjectReference Include="..\..\System.Private.Reflection.Metadata\src\System.Private.Reflection.Metadata.csproj" />
+ <ProjectReference Include="..\..\System.Private.TypeLoader\src\System.Private.TypeLoader.Experimental.csproj" />
+ <ProjectReference Include="..\..\System.Private.Interop\src\System.Private.Interop.csproj" />
+ </ItemGroup>
+ <PropertyGroup>
+ <NativeFormatCommonPath>..\..\Common\src\Internal\NativeFormat</NativeFormatCommonPath>
+ <TypeSystemBasePath>..\..\Common\src\TypeSystem</TypeSystemBasePath>
+ <TypeLoaderBasePath>..\..\System.Private.TypeLoader\src</TypeLoaderBasePath>
+ <CommonBasePath>..\..\Common\src</CommonBasePath>
+ <ILCompilerBasePath>..\..\ILCompiler.Compiler\src</ILCompilerBasePath>
+ <DependencyAnalysisFrameworkBasePath>..\..\ILCompiler.DependencyAnalysisFramework\src</DependencyAnalysisFrameworkBasePath>
+ <JitInterfaceBasePath>..\..\JitInterface\src</JitInterfaceBasePath>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Internal\Runtime\JitSupport\ExternObjectSymbolNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\FrozenStrings.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitCompilation.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitEETypeNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitFrozenStringNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitGenericMethodDictionaryNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitInterfaceDispatchCellNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitMethodCodeNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitMethodEntrypointNode.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitNodeFactory.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\JitTemp.cs" />
+ <Compile Include="$(CommonBasePath)\Internal\Runtime\EEType.Constants.cs" />
+ <Compile Include="$(CommonBasePath)\Internal\Runtime\EETypeBuilderHelpers.cs" />
+ <Compile Include="$(CommonBasePath)\Internal\Runtime\RuntimeConstants.cs" />
+ <Compile Include="$(CommonBasePath)\Internal\Runtime\ITargetBinaryWriter.cs" />
+ <Compile Include="$(CommonBasePath)\Internal\Text\Utf8String.cs" />
+ <Compile Include="$(CommonBasePath)\Internal\Text\Utf8StringBuilder.cs" />
+ <Compile Include="$(CommonBasePath)\System\Collections\Generic\ArrayBuilder.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\EcmaMethodIL.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\ILProvider.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\McgInteropSupport.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\HelperExtensions.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\AddrOfIntrinsic.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\ArrayMethodILEmitter.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\CalliIntrinsic.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\DelegateMarshallingMethodThunk.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\EETypePtrOfIntrinsic.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\DelegateMethodILEmitter.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\PInvokeILEmitter.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\TypeGetTypeMethodThunk.cs" />
+ <Compile Include="$(TypeSystemBasePath)\IL\Stubs\UnsafeIntrinsics.cs" />
+ <Compile Include="$(TypeSystemBasePath)\Interop\IL\Marshaller.cs" />
+ <Compile Include="$(TypeSystemBasePath)\Interop\IL\MarshalHelpers.cs" />
+ <Compile Include="$(TypeSystemBasePath)\Interop\IL\PInvokeMethodData.cs" />
+ <Compile Include="$(TypeSystemBasePath)\Interop\IL\PInvokeILEmitterConfiguration.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Logger.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X64\TargetRegisterMap.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X64\X64Emitter.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X64\AddrMode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X64\Register.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X64\X64ReadyToRunHelperNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X86\TargetRegisterMap.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X86\X86Emitter.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X86\AddrMode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X86\Register.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_X86\X86ReadyToRunHelperNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_ARM\TargetRegisterMap.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_ARM\ARMEmitter.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_ARM\Register.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Target_ARM\ARMReadyToRunHelperNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\AssemblyStubNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\HelperEntrypoint.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\IFatFunctionPointerNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\INodeWithDebugInfo.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\INodeWithCodeInfo.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ISymbolNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\IMethodNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\IMethodCodeNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\IEETypeNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ObjectDataBuilder.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\BlobNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ExternSymbolNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ObjectNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ObjectNodeSection.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\ReadyToRunHelperNode.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DependencyAnalysis\Relocation.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\DelegateCreationInfo.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\JitHelper.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\MethodExtensions.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\MemoryHelper.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\ReadyToRun.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\TypeExtensions.cs" />
+ <Compile Include="$(ILCompilerBasePath)\Compiler\NameMangler.cs" />
+ <Compile Include="$(ILCompilerBasePath)\IL\Stubs\PInvokeILProvider.cs" />
+ <Compile Include="$(DependencyAnalysisFrameworkBasePath)\IDependencyNode.cs" />
+ <Compile Include="$(DependencyAnalysisFrameworkBasePath)\DependencyNode.cs" />
+ <Compile Include="$(DependencyAnalysisFrameworkBasePath)\DependencyNodeCore.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\CorInfoBase.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\CorInfoHelpFunc.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\CorInfoImpl.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\CorInfoImpl.Intrinsics.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\CorInfoTypes.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\JitConfigProvider.cs" />
+ <Compile Include="$(JitInterfaceBasePath)\TypesDebugInfo\PrimitiveTypeDescriptor.cs" />
+ <Compile Include="$(TypeLoaderBasePath)\Internal\TypeSystem\PInvokeTargetNativeMethod.Runtime.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\RyuJitExecutionStrategy.cs" />
+ <Compile Include="Internal\Runtime\JitSupport\VirtualMethodSlotHelper.cs" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project> \ No newline at end of file