add_definitions(-DFEATURE_MANAGED_ETW_CHANNELS)
add_definitions(-DFEATURE_MAIN_CLR_MODULE_USES_CORE_NAME)
add_definitions(-DFEATURE_MERGE_CULTURE_SUPPORT_AND_ENGINE)
-if(WIN32)
-# Disable the following for UNIX altjit on Windows
-add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
-endif(WIN32)
+
+# TODO_DJIT: Remove this "set" to commence loading JIT dynamically.
+set(FEATURE_MERGE_JIT_AND_ENGINE 1)
+if(FEATURE_MERGE_JIT_AND_ENGINE)
+ # Disable the following for UNIX altjit on Windows
+ add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
+endif(FEATURE_MERGE_JIT_AND_ENGINE)
add_definitions(-DFEATURE_MULTICOREJIT)
add_definitions(-DFEATURE_NORM_IDNA_ONLY)
if(CLR_CMAKE_PLATFORM_UNIX)
-DCROSSGEN_COMPILE
-DCROSS_COMPILE
-DFEATURE_NATIVE_IMAGE_GENERATION
- -DFEATURE_MERGE_JIT_AND_ENGINE
-DSELF_NO_HOST)
remove_definitions(
</PropertyGroup>
<ItemGroup>
+ <NativeSplittableBinary Include="$(BinDir)libclrjit.so"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclr.so"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclrtraceptprovider.so"/>
<NativeSplittableBinary Include="$(BinDir)libdbgshim.so"/>
<ArchitectureSpecificNativeFile Include="$(BinDir)mscorlib.ni.dll"/>
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll"/>
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen"/>
-
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)"/>
<File Include="@(ArchitectureSpecificNativeFile)">
</PropertyGroup>
<ItemGroup>
+ <NativeSplittableBinary Include="$(BinDir)libclrjit.dylib"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclr.dylib"/>
<NativeSplittableBinary Include="$(BinDir)libdbgshim.dylib"/>
<NativeSplittableBinary Include="$(BinDir)libmscordaccore.dylib"/>
<ArchitectureSpecificNativeFile Include="$(BinDir)mscorlib.ni.dll"/>
<ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll"/>
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen"/>
-
<ArchitectureSpecificNativeFile Include="@(NativeSplittableBinary)"/>
<File Include="@(ArchitectureSpecificNativeFile)">
</PropertyGroup>
<ItemGroup>
+ <NativeSplittableBinary Include="$(BinDir)libclrjit.so"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclr.so"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclrtraceptprovider.so"/>
<NativeSplittableBinary Include="$(BinDir)libdbgshim.so"/>
</PropertyGroup>
<ItemGroup>
+ <NativeSplittableBinary Include="$(BinDir)libclrjit.so"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclr.so"/>
<NativeSplittableBinary Include="$(BinDir)libcoreclrtraceptprovider.so"/>
<NativeSplittableBinary Include="$(BinDir)libdbgshim.so"/>
<ItemGroup>
<ArchitectureSpecificNativeFile Include="$(BinDir)clretwrc.dll"/>
+ <ArchitectureSpecificNativeFile Include="$(BinDir)clrjit.dll"/>
<ArchitectureSpecificNativeFile Include="$(BinDir)coreclr.dll"/>
<ArchitectureSpecificNativeFile Include="$(BinDir)dbgshim.dll"/>
<ArchitectureSpecificNativeFile Include="$(BinDir)mscordaccore.dll"/>
-# Add the Merge flag here is needed. Not needed for RyuJIT if building as a DLL.
-add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
if(WIN32)
add_subdirectory(hosts)
endif(WIN32)
set(LIB_UNWINDER unwinder_wks)
endif (CLR_CMAKE_PLATFORM_UNIX)
+if(FEATURE_MERGE_JIT_AND_ENGINE)
+ set(CLRJIT_STATIC clrjit_static)
+endif(FEATURE_MERGE_JIT_AND_ENGINE)
+
# IMPORTANT! Please do not rearrange the order of the libraries. The linker on Linux is
# order dependent and changing the order can result in undefined symbols in the shared
# library.
mdhotdata_full
bcltype
ceefgen
- clrjit_static
+ ${CLRJIT_STATIC}
comfloat_wks
corguids
gcinfo # Condition="'$(TargetCpu)'=='amd64' or '$(TargetCpu)' == 'arm' or '$(TargetCpu)' == 'arm64'"
{
#ifdef FEATURE_CORECLR
CORECLR_INFO,
+ CROSSGEN_COMPILER_INFO,
#else
CLR_INFO,
NGEN_COMPILER_INFO,
# Disable the following for UNIX altjit on Windows
if(CLR_CMAKE_PLATFORM_UNIX)
add_compile_options(-fPIC)
- add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
add_library_clr(${JIT_BASE_NAME}_static
STATIC
add_definitions(-DFEATURE_READYTORUN_COMPILER)
remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
+if(CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM)
+ add_definitions(-DLEGACY_BACKEND)
+endif()
+
if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_NETBSD)
# This is required to force using our own PAL, not one that we are loaded with.
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic -Bsymbolic-functions")
${crossgen_RESOURCES}
)
+if(FEATURE_MERGE_JIT_AND_ENGINE)
+ set(CLRJIT_CROSSGEN clrjit_crossgen)
+endif(FEATURE_MERGE_JIT_AND_ENGINE)
+
target_link_libraries(crossgen
cee_crossgen
mdcompiler_crossgen
mdruntimerw_crossgen
mdhotdata_crossgen
corguids
- clrjit_crossgen
+ ${CLRJIT_CROSSGEN}
gcinfo_crossgen
corzap_crossgen
mscorlib_crossgen
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
-# Add the Merge flag here is needed
-add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
-
if(CMAKE_CONFIGURATION_TYPES) # multi-configuration generator?
foreach (Config DEBUG CHECKED)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:${Config}>:WRITE_BARRIER_CHECK=1>)
#define IfFailGoLog(EXPR) IfFailGotoLog(EXPR, ErrExit)
#endif
+#if defined(FEATURE_MERGE_JIT_AND_ENGINE)
void jitOnDllProcessAttach();
-
+#endif // defined(FEATURE_MERGE_JIT_AND_ENGINE)
void EEStartupHelper(COINITIEE fFlags)
{
#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
}
-#ifdef CROSSGEN_COMPILE
-//ARM64TODO: Enable when jit is brought in
- #if defined(_TARGET_ARM64_)
- //_ASSERTE(!"ARM64:NYI");
-
- #else
+#if defined(CROSSGEN_COMPILE) && defined(FEATURE_MERGE_JIT_AND_ENGINE)
jitOnDllProcessAttach();
- #endif // defined(_TARGET_ARM64_)
-#endif
+#endif // defined(CROSSGEN_COMPILE) && defined(FEATURE_MERGE_JIT_AND_ENGINE)
#ifndef CROSSGEN_COMPILE
// Initialize Numa and CPU group information
HRESULT hr = E_FAIL;
-#ifdef FEATURE_MERGE_JIT_AND_ENGINE
+#ifdef FEATURE_CORECLR
+ // TODO_DJIT: Currently, we are looking up the JIT from the same location as CoreCLR. We need to get this to come from
+ // the host so that we get it from the correct servicing location
PathString CoreClrFolderHolder;
extern HINSTANCE g_hThisInst;
if (WszGetModuleFileName(g_hThisInst, CoreClrFolderHolder))
// Set as a courtesy to code:CorCompileGetRuntimeDll
s_ngenCompilerDll = m_JITCompiler;
-#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE)
+#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
// If COMPlus_UseLegacyJit=1, then we fall back to compatjit.dll.
//
// This fallback mechanism was introduced for Visual Studio "14" Preview, when JIT64 (the legacy JIT) was replaced with
}
}
}
-#endif // defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE)
+#endif // defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#endif // !FEATURE_MERGE_JIT_AND_ENGINE
/*********************************************************************/
// This static method returns the name of the jit dll
//
-LPWSTR ExecutionManager::GetJitName()
+LPCWSTR ExecutionManager::GetJitName()
{
STANDARD_VM_CONTRACT;
- LPWSTR pwzJitName;
+ LPCWSTR pwzJitName = NULL;
+#if !defined(FEATURE_CORECLR)
// Try to obtain a name for the jit library from the env. variable
IfFailThrow(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_JitName, &pwzJitName));
-
+#endif // !FEATURE_CORECLR
+
if (NULL == pwzJitName)
{
pwzJitName = MAKEDLLNAME_W(W("clrjit"));
return pwzJitName;
}
-#endif // FEATURE_MERGE_JIT_AND_ENGINE
+#endif // !FEATURE_MERGE_JIT_AND_ENGINE
#endif // #ifndef DACCESS_COMPILE
static void ClearCaches( void );
static BOOL IsCacheCleanupRequired();
- static LPWSTR GetJitName();
+ static LPCWSTR GetJitName();
static void Unload(LoaderAllocator *pLoaderAllocator);
}
#endif // CROSSGEN_COMPILE
-#ifdef CROSSGEN_COMPILE
+#if defined(CROSSGEN_COMPILE)
EXTERN_C ICorJitCompiler* __stdcall getJit();
-#endif
+#endif // defined(CROSSGEN_COMPILE)
#ifdef FEATURE_INTERPRETER
static CorJitResult CompileMethodWithEtwWrapper(EEJitManager *jitMgr,
BEGIN_SO_TOLERANT_CODE(GetThread());
-#ifdef CROSSGEN_COMPILE
+#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
ret = getJit()->compileMethod( comp,
info,
flags,
nativeEntry,
nativeSizeOfCode);
-#else // CROSSGEN_COMPILE
+#else // defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-#ifdef ALLOW_SXS_JIT
+#if defined(ALLOW_SXS_JIT) && !defined(CROSSGEN_COMPILE)
if (FAILED(ret) && jitMgr->m_alternateJit
#ifdef FEATURE_STACK_SAMPLING
&& (!samplingEnabled || (flags2 & CORJIT_FLG2_SAMPLING_JIT_BACKGROUND))
ret = CORJIT_SKIPPED;
}
}
-#endif // ALLOW_SXS_JIT
+#endif // defined(ALLOW_SXS_JIT) && !defined(CROSSGEN_COMPILE)
#ifdef FEATURE_INTERPRETER
static ConfigDWORD s_InterpreterFallback;
}
#endif // FEATURE_INTERPRETER
+#if !defined(CROSSGEN_COMPILE)
// Cleanup any internal data structures allocated
// such as IL code after a successfull JIT compile
// If the JIT fails we keep the IL around and will
comp->MethodCompileComplete(info->ftn);
#endif // FEATURE_INTERPRETER
}
-
-#endif // CROSSGEN_COMPILE
+#endif // !defined(CROSSGEN_COMPILE)
+
+#endif // defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
END_SO_TOLERANT_CODE;
static const LPCWSTR CorCompileRuntimeDllNames[NUM_RUNTIME_DLLS] =
{
#ifdef FEATURE_CORECLR
- MAKEDLLNAME_W(W("CORECLR"))
+ MAKEDLLNAME_W(W("coreclr")),
#else
MAKEDLLNAME_W(W("CLR")),
- MAKEDLLNAME_W(W("CLRJIT"))
#endif
+ MAKEDLLNAME_W(W("clrjit"))
};
#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
// Currently special cased for every entry.
#ifdef FEATURE_CORECLR
- static_assert_no_msg(NUM_RUNTIME_DLLS == 1);
+ static_assert_no_msg(NUM_RUNTIME_DLLS == 2);
static_assert_no_msg(CORECLR_INFO == 0);
#else // !FEATURE_CORECLR
static_assert_no_msg(NUM_RUNTIME_DLLS == 2);
HRESULT hr = E_FAIL;
-#ifdef FEATURE_MERGE_JIT_AND_ENGINE
+#ifdef FEATURE_CORECLR
+ // TODO_DJIT: Currently, we are looking up the JIT from the same location as CoreCLR. The path needs to be passed by the caller.
PathString CoreClrFolder;
extern HINSTANCE g_hThisInst;
if (WszGetModuleFileName(g_hThisInst, CoreClrFolder))
ThrowLastError();
}
#else
- LPCWSTR pwzJitName = CorCompileGetRuntimeDllName(NGEN_COMPILER_INFO);
+
+ CorCompileRuntimeDlls ngenDllId;
+
+#if !defined(FEATURE_CORECLR)
+ ngenDllId = NGEN_COMPILER_INFO;
+#else // FEATURE_CORECLR
+ ngenDllId = CROSSGEN_COMPILER_INFO;
+#endif
+
+ LPCWSTR pwzJitName = CorCompileGetRuntimeDllName(ngenDllId);
LoadAndInitializeJITForNgen(pwzJitName, &m_hJitLib, &m_pJitCompiler);
-#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE)
+#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
// For reasons related to servicing, and RyuJIT rollout on .NET 4.6 and beyond, we only use RyuJIT when the registry
// value UseRyuJIT (type DWORD), under key HKLM\SOFTWARE\Microsoft\.NETFramework, is set to 1. Otherwise, we fall back
// to JIT64.
// obfuscator tries to directly call the main JIT's getJit() function.
m_pJitCompiler->setRealJit(fallbackICorJitCompiler);
}
-#endif // defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE)
+#endif // defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#endif // FEATURE_MERGE_JIT_AND_ENGINE
#ifdef ALLOW_SXS_JIT_NGEN