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:
-rw-r--r--src/BuildIntegration/Microsoft.NETCore.Native.Windows.props1
-rw-r--r--src/BuildIntegration/Microsoft.NETCore.Native.targets14
-rw-r--r--src/JitInterface/src/CorInfoImpl.cs18
-rw-r--r--src/Native/jitinterface/CMakeLists.txt19
-rw-r--r--src/Native/jitinterface/CodeHeap.cpp10
-rw-r--r--src/Native/jitinterface/JITCodeManager.cpp18
-rw-r--r--src/Native/jitinterface/JITCodeManager.h14
-rw-r--r--src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs12
-rw-r--r--src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.Experimental.csproj8
-rw-r--r--src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.csproj8
10 files changed, 87 insertions, 35 deletions
diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.Windows.props b/src/BuildIntegration/Microsoft.NETCore.Native.Windows.props
index 22392cd25..b06165b8a 100644
--- a/src/BuildIntegration/Microsoft.NETCore.Native.Windows.props
+++ b/src/BuildIntegration/Microsoft.NETCore.Native.Windows.props
@@ -40,6 +40,7 @@ See the LICENSE file in the project root for more information.
<NativeLibrary Condition="$(NativeCodeGen) == '' and $(NativeLib) != ''" Include="$(IlcPath)\sdk\bootstrapperdll.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\$(FullRuntimeName).lib" />
<NativeLibrary Condition="$(NativeCodeGen) == ''" Include="$(IlcPath)\sdk\System.Private.TypeLoader.Native.lib" />
+ <NativeLibrary Condition="$(NativeCodeGen) == '' and '$(ExperimentalJitSupport)' == 'true'" Include="$(IlcPath)\sdk\System.Private.Jit.Native.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == 'cpp'" Include="$(IlcPath)\sdk\PortableRuntime.lib" />
<NativeLibrary Condition="$(NativeCodeGen) == 'wasm'" Include="$(IlcPath)\sdk\bootstrappercpp.lib" />
diff --git a/src/BuildIntegration/Microsoft.NETCore.Native.targets b/src/BuildIntegration/Microsoft.NETCore.Native.targets
index 66af195d0..e5d806dce 100644
--- a/src/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -67,6 +67,8 @@ See the LICENSE file in the project root for more information.
<FrameworkLibPath Condition="'$(FrameworkLibPath)' == ''">$(NativeOutputPath)</FrameworkLibPath>
<FrameworkObjPath Condition="'$(FrameworkObjPath)' == ''">$(NativeIntermediateOutputPath)</FrameworkObjPath>
+ <ExperimentalDynamicCodeSupport Condition="'$(ExperimentalInterpreterSupport)' == 'true' or '$(ExperimentalJitSupport)' == 'true'">true</ExperimentalDynamicCodeSupport>
+
<SharedLibrary Condition="'$(OS)' == 'Windows_NT'">$(FrameworkLibPath)\Framework$(LibFileExt)</SharedLibrary>
<SharedLibrary Condition="'$(OS)' != 'Windows_NT'">$(FrameworkLibPath)\libframework$(LibFileExt)</SharedLibrary>
<IlcDynamicBuildPropertyDependencies Condition="'$(IlcCalledViaPackage)' == 'true'">SetupProperties</IlcDynamicBuildPropertyDependencies>
@@ -81,17 +83,19 @@ See the LICENSE file in the project root for more information.
<ItemGroup>
<AutoInitializedAssemblies Include="System.Private.CoreLib" />
<AutoInitializedAssemblies Include="System.Private.DeveloperExperience.Console" />
- <AutoInitializedAssemblies Include="System.Private.StackTraceMetadata" />
+ <AutoInitializedAssemblies Condition="'$(ExperimentalInterpreterSupport)' == 'true'" Include="System.Private.Interpreter" />
+ <AutoInitializedAssemblies Condition="'$(ExperimentalJitSupport)' == 'true'" Include="System.Private.Jit" />
</ItemGroup>
- <ItemGroup Condition="'$(ExperimentalInterpreterSupport)' != 'true'">
+ <ItemGroup Condition="'$(ExperimentalDynamicCodeSupport)' != 'true'">
+ <AutoInitializedAssemblies Include="System.Private.StackTraceMetadata" />
<AutoInitializedAssemblies Include="System.Private.TypeLoader" />
<AutoInitializedAssemblies Include="System.Private.Reflection.Execution" />
<AutoInitializedAssemblies Include="System.Private.Interop" />
</ItemGroup>
- <ItemGroup Condition="'$(ExperimentalInterpreterSupport)' == 'true'">
- <AutoInitializedAssemblies Include="System.Private.Interpreter" />
+ <ItemGroup Condition="'$(ExperimentalDynamicCodeSupport)' == 'true'">
+ <AutoInitializedAssemblies Include="System.Private.StackTraceMetadata.Experimental" />
<AutoInitializedAssemblies Include="System.Private.TypeLoader.Experimental" />
<AutoInitializedAssemblies Include="System.Private.Reflection.Execution.Experimental" />
<AutoInitializedAssemblies Include="System.Private.Interop.Experimental" />
@@ -180,7 +184,7 @@ See the LICENSE file in the project root for more information.
<IlcArg Condition="$(OutputType) == 'Library' and $(NativeLib) != ''" Include="--nativelib" />
<IlcArg Condition="$(ExportsFile) != ''" Include="--exportsfile:$(ExportsFile)" />
<ILcArg Condition="'$(Platform)' == 'wasm'" Include="--wasm" />
- <ILcArg Condition="'$(ExperimentalInterpreterSupport)' == 'true'" Include="--nometadatablocking" />
+ <ILcArg Condition="'$(ExperimentalDynamicCodeSupport)' == 'true'" Include="--nometadatablocking" />
<IlcArg Include="@(AutoInitializedAssemblies->'--initassembly:%(Identity)')" />
<IlcArg Include="@(AppContextSwitchOverrides->'--appcontextswitch:%(Identity)')" />
<IlcArg Condition="$(ServerGarbageCollection) != ''" Include="--runtimeopt:RH_UseServerGC=1" />
diff --git a/src/JitInterface/src/CorInfoImpl.cs b/src/JitInterface/src/CorInfoImpl.cs
index 13d2ccac4..b02092b30 100644
--- a/src/JitInterface/src/CorInfoImpl.cs
+++ b/src/JitInterface/src/CorInfoImpl.cs
@@ -42,6 +42,12 @@ namespace Internal.JitInterface
ARM = 0x01c4,
}
+#if SUPPORT_JIT
+ private const string JitSupportLibrary = "*";
+#else
+ private const string JitSupportLibrary = "jitinterface";
+#endif
+
private IntPtr _jit;
private IntPtr _unmanagedCallbacks; // array of pointers to JIT-EE interface callbacks
@@ -55,7 +61,7 @@ namespace Internal.JitInterface
[DllImport("clrjitilc", CallingConvention=CallingConvention.StdCall)]
private extern static IntPtr getJit();
- [DllImport("jitinterface")]
+ [DllImport(JitSupportLibrary)]
private extern static IntPtr GetJitHost(IntPtr configProvider);
//
@@ -68,15 +74,15 @@ namespace Internal.JitInterface
return _this;
}
- [DllImport("jitinterface")]
+ [DllImport(JitSupportLibrary)]
private extern static CorJitResult JitCompileMethod(out IntPtr exception,
IntPtr jit, IntPtr thisHandle, IntPtr callbacks,
ref CORINFO_METHOD_INFO info, uint flags, out IntPtr nativeEntry, out uint codeSize);
- [DllImport("jitinterface")]
+ [DllImport(JitSupportLibrary)]
private extern static uint GetMaxIntrinsicSIMDVectorLength(IntPtr jit, CORJIT_FLAGS* flags);
- [DllImport("jitinterface")]
+ [DllImport(JitSupportLibrary)]
private extern static IntPtr AllocException([MarshalAs(UnmanagedType.LPWStr)]string message, int messageLength);
private IntPtr AllocException(Exception ex)
@@ -93,10 +99,10 @@ namespace Internal.JitInterface
return nativeException;
}
- [DllImport("jitinterface")]
+ [DllImport(JitSupportLibrary)]
private extern static void FreeException(IntPtr obj);
- [DllImport("jitinterface")]
+ [DllImport(JitSupportLibrary)]
private extern static char* GetExceptionMessage(IntPtr obj);
private Compilation _compilation;
diff --git a/src/Native/jitinterface/CMakeLists.txt b/src/Native/jitinterface/CMakeLists.txt
index 46c071c8a..5262e0d8c 100644
--- a/src/Native/jitinterface/CMakeLists.txt
+++ b/src/Native/jitinterface/CMakeLists.txt
@@ -7,15 +7,23 @@ set(NATIVE_SOURCES
corinfoexception.cpp
)
+set (JIT_SOURCES
+ CodeHeap.cpp
+ JITCodeManager.cpp
+ ../Runtime/coreclr/GCInfoDecoder.cpp
+)
+
if(WIN32 AND CLR_CMAKE_PLATFORM_ARCH_AMD64)
- set(NATIVE_SOURCES ${NATIVE_SOURCES}
- CodeHeap.cpp
- JITCodeManager.cpp
- ../Runtime/coreclr/GCInfoDecoder.cpp
- )
add_definitions(-DGCINFODECODER_NO_EE)
add_definitions(-DFEATURE_REDHAWK)
+ add_definitions(-DFEATURE_SINGLE_MODULE_RUNTIME)
+
+ add_library(System.Private.Jit.Native
+ STATIC
+ ${NATIVE_SOURCES}
+ ${JIT_SOURCES}
+ )
endif(WIN32 AND CLR_CMAKE_PLATFORM_ARCH_AMD64)
add_library(jitinterface
@@ -27,4 +35,5 @@ install (TARGETS jitinterface DESTINATION tools)
if(WIN32)
target_link_libraries(jitinterface ntdll.lib)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/jitinterface.pdb DESTINATION tools)
+ install (TARGETS System.Private.Jit.Native DESTINATION sdk)
endif(WIN32)
diff --git a/src/Native/jitinterface/CodeHeap.cpp b/src/Native/jitinterface/CodeHeap.cpp
index 1adc206ea..468bd2588 100644
--- a/src/Native/jitinterface/CodeHeap.cpp
+++ b/src/Native/jitinterface/CodeHeap.cpp
@@ -18,13 +18,23 @@ static void *s_topAddress = nullptr;
static DWORD s_pageSize = 0;
extern HMODULE s_hRuntime;
+#if FEATURE_SINGLE_MODULE_RUNTIME
+extern "C" void RhpNewArray();
+#endif
+
void InitMemoryStatics()
{
std::call_once(s_staticInit, []()
{
HMODULE module = s_hRuntime;
if (module != NULL)
+ {
+#if FEATURE_SINGLE_MODULE_RUNTIME
+ s_mrtAddr = &RhpNewArray;
+#else
s_mrtAddr = GetProcAddress(module, "RhpNewArray");
+#endif
+ }
assert(s_mrtAddr != nullptr);
diff --git a/src/Native/jitinterface/JITCodeManager.cpp b/src/Native/jitinterface/JITCodeManager.cpp
index 198671f14..11a1088be 100644
--- a/src/Native/jitinterface/JITCodeManager.cpp
+++ b/src/Native/jitinterface/JITCodeManager.cpp
@@ -46,14 +46,24 @@ HMODULE s_hRuntime = NULL;
pfnRegisterCodeManager s_pfnRegisterCodeManager;
pfnUnregisterCodeManager s_pfnUnregisterCodeManager;
+#if FEATURE_SINGLE_MODULE_RUNTIME
+extern "C" bool RegisterCodeManager(ICodeManager * pCodeManager, PTR_VOID pvStartRange, UInt32 cbRange);
+extern "C" void UnregisterCodeManager(ICodeManager * pCodeManager);
+#endif
+
bool InitializeCodeManagerRuntime()
{
std::call_once(s_RuntimeInit, []()
{
if (s_hRuntime != NULL)
{
+#if FEATURE_SINGLE_MODULE_RUNTIME
+ s_pfnRegisterCodeManager = &RegisterCodeManager;
+ s_pfnUnregisterCodeManager = &UnregisterCodeManager;
+#else
s_pfnRegisterCodeManager = (pfnRegisterCodeManager)GetProcAddress(s_hRuntime, "RegisterCodeManager");
s_pfnUnregisterCodeManager = (pfnUnregisterCodeManager)GetProcAddress(s_hRuntime, "UnregisterCodeManager");
+#endif
}
});
@@ -259,7 +269,7 @@ bool JITCodeManager::Initialize()
// Note that main method bodies will not have an entry in the map.
PTR_RUNTIME_FUNCTION JITCodeManager::AllocRuntimeFunction(PTR_RUNTIME_FUNCTION mainMethod, DWORD beginAddr, DWORD endAddr, DWORD unwindData)
{
- ReaderWriterLock::WriteHolder lh(&m_lock);
+ SlimReaderWriterLock::WriteHolder lh(&m_lock);
m_runtimeFunctions.push_back(RUNTIME_FUNCTION());
PTR_RUNTIME_FUNCTION method = &m_runtimeFunctions.back();
@@ -278,7 +288,7 @@ PTR_RUNTIME_FUNCTION JITCodeManager::AllocRuntimeFunction(PTR_RUNTIME_FUNCTION m
void JITCodeManager::UpdateRuntimeFunctionTable()
{
- ReaderWriterLock::WriteHolder lh(&m_lock);
+ SlimReaderWriterLock::WriteHolder lh(&m_lock);
PTR_RUNTIME_FUNCTION pFunctionTable = &m_runtimeFunctions[0];
DWORD nEntryCount = (DWORD)m_runtimeFunctions.size();
@@ -381,7 +391,7 @@ bool JITCodeManager::FindMethodInfo(PTR_VOID ControlPC,
if (RelativePC >= m_cbRange)
return false;
- ReaderWriterLock::ReadHolder lh(&m_lock);
+ SlimReaderWriterLock::ReadHolder lh(&m_lock);
int MethodIndex = LookupUnwindInfoForMethod((UInt32)RelativePC, m_pRuntimeFunctionTable,
0, m_nRuntimeFunctionTable - 1);
@@ -420,7 +430,7 @@ bool JITCodeManager::IsFunclet(MethodInfo * pMethInfo)
JITMethodInfo * pMethodInfo = (JITMethodInfo *)pMethInfo;
// A funclet will have an entry in funclet to main method map
- ReaderWriterLock::ReadHolder lh(&m_lock);
+ SlimReaderWriterLock::ReadHolder lh(&m_lock);
return m_FuncletToMainMethodMap.find(pMethodInfo->runtimeFunction.BeginAddress) != m_FuncletToMainMethodMap.end();
}
diff --git a/src/Native/jitinterface/JITCodeManager.h b/src/Native/jitinterface/JITCodeManager.h
index aeff8bc89..991cb0d65 100644
--- a/src/Native/jitinterface/JITCodeManager.h
+++ b/src/Native/jitinterface/JITCodeManager.h
@@ -51,19 +51,19 @@ typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO;
typedef DPTR(union _UNWIND_CODE) PTR_UNWIND_CODE;
#endif // target_amd64
-class ReaderWriterLock : private SRWLOCK
+class SlimReaderWriterLock : private SRWLOCK
{
public:
- ReaderWriterLock()
+ SlimReaderWriterLock()
{
::InitializeSRWLock(this);
}
class ReadHolder
{
- ReaderWriterLock * m_pLock;
+ SlimReaderWriterLock * m_pLock;
public:
- ReadHolder(ReaderWriterLock * pLock)
+ ReadHolder(SlimReaderWriterLock * pLock)
: m_pLock(pLock)
{
::AcquireSRWLockShared(m_pLock);
@@ -77,10 +77,10 @@ public:
class WriteHolder
{
- ReaderWriterLock * m_pLock;
+ SlimReaderWriterLock * m_pLock;
public:
- WriteHolder(ReaderWriterLock * pLock)
+ WriteHolder(SlimReaderWriterLock * pLock)
: m_pLock(pLock)
{
::AcquireSRWLockExclusive(m_pLock);
@@ -167,7 +167,7 @@ class JITCodeManager : ICodeManager
UInt32 m_cbRange;
// lock to protect m_runtimeFunctions and m_FuncletToMainMethodMap
- ReaderWriterLock m_lock;
+ SlimReaderWriterLock m_lock;
std::vector<RUNTIME_FUNCTION> m_runtimeFunctions;
PTR_RUNTIME_FUNCTION m_pRuntimeFunctionTable;
diff --git a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs
index e67b3b8c4..9548f2f08 100644
--- a/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs
+++ b/src/System.Private.Jit/src/Internal/Runtime/JitSupport/RyuJitExecutionStrategy.cs
@@ -22,6 +22,8 @@ namespace Internal.Runtime.JitSupport
{
public class RyuJitExecutionStrategy : MethodExecutionStrategy
{
+ private const string NativeJitSupportLibrary = "*";
+
private CorInfoImpl _corInfoImpl;
private TypeSystemContext _context;
private NodeFactory _nodeFactory;
@@ -33,13 +35,13 @@ namespace Internal.Runtime.JitSupport
return;
}
- [DllImport("jitinterface")]
+ [DllImport(NativeJitSupportLibrary)]
static extern IntPtr AllocJittedCode(UInt32 cbCode, UInt32 align, out IntPtr pCodeManager);
- [DllImport("jitinterface")]
+ [DllImport(NativeJitSupportLibrary)]
static extern void SetEHInfoPtr(IntPtr pCodeManager, IntPtr pbCode, IntPtr ehInfo);
- [DllImport("jitinterface")]
+ [DllImport(NativeJitSupportLibrary)]
static extern unsafe IntPtr PublishRuntimeFunction(
IntPtr pCodeManager,
IntPtr pbCode,
@@ -51,10 +53,10 @@ namespace Internal.Runtime.JitSupport
byte[] pGCData,
UInt32 cbGCData);
- [DllImport("jitinterface")]
+ [DllImport(NativeJitSupportLibrary)]
static extern void UpdateRuntimeFunctionTable(IntPtr pCodeManager);
- [DllImport("jitinterface")]
+ [DllImport(NativeJitSupportLibrary)]
static extern void InitJitCodeManager(IntPtr mrtModule);
public override IntPtr OnEntryPoint(MethodEntrypointPtr methodEntrypoint, IntPtr callerArgs)
diff --git a/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.Experimental.csproj b/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.Experimental.csproj
new file mode 100644
index 000000000..637480fcb
--- /dev/null
+++ b/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.Experimental.csproj
@@ -0,0 +1,8 @@
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+ <PropertyGroup>
+ <AssemblyName>System.Private.StackTraceMetadata.Experimental</AssemblyName>
+ <DynamicCodeSupport>true</DynamicCodeSupport>
+ </PropertyGroup>
+
+ <Import Project="System.Private.StackTraceMetadata.csproj" />
+</Project>
diff --git a/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.csproj b/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.csproj
index 799bc65e0..22c4b488c 100644
--- a/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.csproj
+++ b/src/System.Private.StackTraceMetadata/src/System.Private.StackTraceMetadata.csproj
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
- <AssemblyName>System.Private.StackTraceMetadata</AssemblyName>
+ <AssemblyName Condition="'$(AssemblyName)' == ''">System.Private.StackTraceMetadata</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<OutputType>Library</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -11,8 +11,10 @@
<ItemGroup Condition="'$(IsProjectNLibrary)' != 'true'">
<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.csproj" />
- <ProjectReference Include="..\..\System.Private.Reflection.Execution\src\System.Private.Reflection.Execution.csproj" />
+ <ProjectReference Condition="'$(DynamicCodeSupport)' != 'true'" Include="..\..\System.Private.TypeLoader\src\System.Private.TypeLoader.csproj" />
+ <ProjectReference Condition="'$(DynamicCodeSupport)' != 'true'" Include="..\..\System.Private.Reflection.Execution\src\System.Private.Reflection.Execution.csproj" />
+ <ProjectReference Condition="'$(DynamicCodeSupport)' == 'true'" Include="..\..\System.Private.TypeLoader\src\System.Private.TypeLoader.Experimental.csproj" />
+ <ProjectReference Condition="'$(DynamicCodeSupport)' == 'true'" Include="..\..\System.Private.Reflection.Execution\src\System.Private.Reflection.Execution.Experimental.csproj" />
</ItemGroup>
<ItemGroup>