extern "C"
#ifdef FEATURE_PAL
-DLLEXPORT // For Win32 PAL LoadLibrary emulation
+ DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
- BOOL
- DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+ BOOL
+ DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
// get entry point
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup");
- if (pnsxsJitStartup == 0)
- {
- LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
- return;
- }
- // Setup CoreClrCallbacks and call sxsJitStartup
- original_CoreClrCallbacks = new CoreClrCallbacks();
- original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
- original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
- original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
- original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
+ if (pnsxsJitStartup != nullptr)
+ {
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ original_CoreClrCallbacks = new CoreClrCallbacks();
+ original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
+ original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
+ original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
+ original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
- CoreClrCallbacks* temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
- temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
- temp->m_pfnIEE = IEE_t;
- temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
- temp->m_pfnGetCLRFunction = GetCLRFunction;
+ temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
+ temp->m_pfnIEE = IEE_t;
+ temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
+ temp->m_pfnGetCLRFunction = GetCLRFunction;
- pnsxsJitStartup(*temp);
+ pnsxsJitStartup(*temp);
+ }
}
extern "C"
#ifdef FEATURE_PAL
-DLLEXPORT // For Win32 PAL LoadLibrary emulation
+ DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
- BOOL
- DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+ BOOL
+ DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
// get entry point
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup");
- if (pnsxsJitStartup == 0)
- {
- LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
- return;
- }
- // Setup CoreClrCallbacks and call sxsJitStartup
- original_CoreClrCallbacks = new CoreClrCallbacks();
- original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
- original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
- original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
- original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
+ if (pnsxsJitStartup != nullptr)
+ {
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ original_CoreClrCallbacks = new CoreClrCallbacks();
+ original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
+ original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
+ original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
+ original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
- CoreClrCallbacks* temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
- temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
- temp->m_pfnIEE = IEE_t;
- temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
- temp->m_pfnGetCLRFunction = GetCLRFunction;
+ temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
+ temp->m_pfnIEE = IEE_t;
+ temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
+ temp->m_pfnGetCLRFunction = GetCLRFunction;
- pnsxsJitStartup(*temp);
+ pnsxsJitStartup(*temp);
+ }
}
extern "C"
#ifdef FEATURE_PAL
-DLLEXPORT // For Win32 PAL LoadLibrary emulation
+ DLLEXPORT // For Win32 PAL LoadLibrary emulation
#endif
- BOOL
- DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+ BOOL
+ DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
// get entry point
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup");
- if (pnsxsJitStartup == 0)
- {
- LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
- return;
- }
- // Setup CoreClrCallbacks and call sxsJitStartup
- original_CoreClrCallbacks = new CoreClrCallbacks();
- original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
- original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
- original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
- original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
+ if (pnsxsJitStartup != nullptr)
+ {
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ original_CoreClrCallbacks = new CoreClrCallbacks();
+ original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
+ original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
+ original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
+ original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
- CoreClrCallbacks* temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
- temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
- temp->m_pfnIEE = IEE_t;
- temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
- temp->m_pfnGetCLRFunction = GetCLRFunction;
+ temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
+ temp->m_pfnIEE = IEE_t;
+ temp->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
+ temp->m_pfnGetCLRFunction = GetCLRFunction;
- pnsxsJitStartup(*temp);
+ pnsxsJitStartup(*temp);
+ }
}
#include "errorhandling.h"
#include "spmiutil.h"
-JitInstance* JitInstance::InitJit(char* nameOfJit,
- bool breakOnAssert,
- SimpleTimer* st1,
- MethodContext* firstContext,
+JitInstance* JitInstance::InitJit(char* nameOfJit,
+ bool breakOnAssert,
+ SimpleTimer* st1,
+ MethodContext* firstContext,
LightWeightMap<DWORD, DWORD>* forceOptions,
LightWeightMap<DWORD, DWORD>* options)
{
return -1;
}
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(hLib, "sxsJitStartup");
- if (pnsxsJitStartup == 0)
+ pnjitStartup = (PjitStartup)::GetProcAddress(hLib, "jitStartup");
+
+ if (pnsxsJitStartup != nullptr)
{
- LogError("GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
- return -1;
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ CoreClrCallbacks* cccallbacks = InitCoreClrCallbacks();
+ pnsxsJitStartup(*cccallbacks);
}
- pnjitStartup = (PjitStartup)::GetProcAddress(hLib, "jitStartup");
-
- // Setup CoreClrCallbacks and call sxsJitStartup
- CoreClrCallbacks* cccallbacks = InitCoreClrCallbacks();
- pnsxsJitStartup(*cccallbacks);
// Setup ICorJitHost and call jitStartup if necessary
if (pnjitStartup != nullptr)
return false;
}
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(hLib, "sxsJitStartup");
- if (pnsxsJitStartup == 0)
+ pnjitStartup = (PjitStartup)::GetProcAddress(hLib, "jitStartup");
+
+ if (pnsxsJitStartup != nullptr)
{
- LogError("GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
- return false;
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ CoreClrCallbacks* cccallbacks = InitCoreClrCallbacks();
+ pnsxsJitStartup(*cccallbacks);
}
- pnjitStartup = (PjitStartup)::GetProcAddress(hLib, "jitStartup");
-
- // Setup CoreClrCallbacks and call sxsJitStartup
- CoreClrCallbacks* cccallbacks = InitCoreClrCallbacks();
- pnsxsJitStartup(*cccallbacks);
// Setup ICorJitHost and call jitStartup if necessary
if (pnjitStartup != nullptr)
class ICorJitInfo : public ICorDynamicInfo
{
public:
- // return memory manager that the JIT can use to allocate a regular memory
+ // OBSOLETE: return memory manager that the JIT can use to allocate a regular memory
virtual IEEMemoryManager* getMemoryManager() = 0;
// get a block of memory for the code, readonly data, and read-write data
getJit
jitStartup
-sxsJitStartup
DllMain
PAL_RegisterModule
PAL_UnregisterModule
EXPORTS
getJit
jitStartup
- sxsJitStartup
EXPORTS
getJit
jitStartup
- sxsJitStartup
EXPORTS
getJit
jitStartup
- sxsJitStartup
return (g_hInst);
}
+#ifndef FEATURE_CORECLR
extern "C" DLLEXPORT void __stdcall sxsJitStartup(CoreClrCallbacks const& cccallbacks)
{
#ifndef SELF_NO_HOST
InitUtilcode(cccallbacks);
#endif
}
+#endif // FEATURE_CORECLR
#endif // !FEATURE_MERGE_JIT_AND_ENGINE
// This roughly translates to InitUtilcode() being called before jitDllOnProcessAttach.
//
// For CLRJIT.dll, compStartup is called on jitOnDllProcessAttach().
-// This can be called twice through sxsJitStartup -- so prevent double initialization.
-// UtilCode is init-ed by this time. The same is true for CoreCLR.
//
// 2) For CLRJIT.dll and CoreCLR, compShutdown will be called during jitOnDllProcessDetach().
//
EXPORTS
getJit
jitStartup
- sxsJitStartup
EXPORTS
getJit
jitStartup
- sxsJitStartup
{
JIT_LOAD_STATUS_STARTING = 1001, // The JIT load process is starting. Start at a number that is somewhat uncommon (i.e., not zero or 1) to help distinguish from garbage, in process dumps.
JIT_LOAD_STATUS_DONE_LOAD, // LoadLibrary of the JIT dll succeeded.
- JIT_LOAD_STATUS_DONE_GET_SXSJITSTARTUP, // GetProcAddress for "sxsJitStartup" succeeded.
- JIT_LOAD_STATUS_DONE_CALL_SXSJITSTARTUP, // Calling sxsJitStartup() succeeded.
JIT_LOAD_STATUS_DONE_GET_JITSTARTUP, // GetProcAddress for "jitStartup" succeeded.
JIT_LOAD_STATUS_DONE_CALL_JITSTARTUP, // Calling jitStartup() succeeded.
JIT_LOAD_STATUS_DONE_GET_GETJIT, // GetProcAddress for "getJit" succeeded.
EX_TRY
{
- bool fContinueToLoadJIT = false;
- // For CoreCLR, we never use "sxsJitStartup" as that is Desktop utilcode initialization
- // specific. Thus, assume we always got
- fContinueToLoadJIT = true;
+ typedef void (__stdcall* pjitStartup)(ICorJitHost*);
+ pjitStartup jitStartupFn = (pjitStartup) GetProcAddress(*phJit, "jitStartup");
- if (fContinueToLoadJIT)
+ if (jitStartupFn)
{
- typedef void (__stdcall* pjitStartup)(ICorJitHost*);
- pjitStartup jitStartupFn = (pjitStartup) GetProcAddress(*phJit, "jitStartup");
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_GET_JITSTARTUP;
- if (jitStartupFn)
- {
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_GET_JITSTARTUP;
+ (*jitStartupFn)(JitHost::getJitHost());
- (*jitStartupFn)(JitHost::getJitHost());
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_JITSTARTUP;
+ }
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_JITSTARTUP;
- }
+ typedef ICorJitCompiler* (__stdcall* pGetJitFn)();
+ pGetJitFn getJitFn = (pGetJitFn) GetProcAddress(*phJit, "getJit");
- typedef ICorJitCompiler* (__stdcall* pGetJitFn)();
- pGetJitFn getJitFn = (pGetJitFn) GetProcAddress(*phJit, "getJit");
+ if (getJitFn)
+ {
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_GET_GETJIT;
- if (getJitFn)
+ ICorJitCompiler* pICorJitCompiler = (*getJitFn)();
+ if (pICorJitCompiler != NULL)
{
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_GET_GETJIT;
-
- ICorJitCompiler* pICorJitCompiler = (*getJitFn)();
- if (pICorJitCompiler != NULL)
- {
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_GETJIT;
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_GETJIT;
- GUID versionId;
- memset(&versionId, 0, sizeof(GUID));
- pICorJitCompiler->getVersionIdentifier(&versionId);
+ GUID versionId;
+ memset(&versionId, 0, sizeof(GUID));
+ pICorJitCompiler->getVersionIdentifier(&versionId);
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_GETVERSIONIDENTIFIER;
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_GETVERSIONIDENTIFIER;
- if (memcmp(&versionId, &JITEEVersionIdentifier, sizeof(GUID)) == 0)
- {
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_VERSION_CHECK;
+ if (memcmp(&versionId, &JITEEVersionIdentifier, sizeof(GUID)) == 0)
+ {
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_VERSION_CHECK;
- // The JIT has loaded and passed the version identifier test, so publish the JIT interface to the caller.
- *ppICorJitCompiler = pICorJitCompiler;
+ // The JIT has loaded and passed the version identifier test, so publish the JIT interface to the caller.
+ *ppICorJitCompiler = pICorJitCompiler;
- // The JIT is completely loaded and initialized now.
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE;
- }
- else
- {
- // Mismatched version ID. Fail the load.
- LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: mismatched JIT version identifier in %S\n", pwzJitName));
- }
+ // The JIT is completely loaded and initialized now.
+ pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE;
}
else
{
- LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: failed to get ICorJitCompiler in %S\n", pwzJitName));
+ // Mismatched version ID. Fail the load.
+ LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: mismatched JIT version identifier in %S\n", pwzJitName));
}
}
else
{
- LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: failed to find 'getJit' entrypoint in %S\n", pwzJitName));
+ LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: failed to get ICorJitCompiler in %S\n", pwzJitName));
}
}
else
{
- LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: failed to find 'sxsJitStartup' entrypoint in %S\n", pwzJitName));
+ LOG((LF_JIT, LL_FATALERROR, "LoadAndInitializeJIT: failed to find 'getJit' entrypoint in %S\n", pwzJitName));
}
}
EX_CATCH
/*********************************************************************/
IEEMemoryManager* CEEInfo::getMemoryManager()
{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_PREEMPTIVE;
- } CONTRACTL_END;
-
- IEEMemoryManager* result = NULL;
-
- JIT_TO_EE_TRANSITION_LEAF();
-
- result = GetEEMemoryManager();
-
- EE_TO_JIT_TRANSITION_LEAF();
-
- return result;
+ UNREACHABLE(); // OBSOLETE
+ return NULL;
}
/*********************************************************************/
ThrowLastError();
}
-#if !defined(CROSSGEN_COMPILE)
- typedef void (__stdcall* pSxsJitStartup) (CoreClrCallbacks const & cccallbacks);
- pSxsJitStartup sxsJitStartupFn = (pSxsJitStartup) GetProcAddress(*phJit, "sxsJitStartup");
- if (sxsJitStartupFn == NULL)
- {
- Error(W("Unable to load Jit startup function: %s\r\n"), pwzJitName);
- ThrowLastError();
- }
-
- CoreClrCallbacks cccallbacks = GetClrCallbacks();
- (*sxsJitStartupFn) (cccallbacks);
-#endif
-
typedef void (__stdcall* pJitStartup)(ICorJitHost* host);
pJitStartup jitStartupFn = (pJitStartup)GetProcAddress(*phJit, "jitStartup");
if (jitStartupFn != nullptr)