Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify initialization of CILJit singleton #73471

Merged
merged 2 commits into from
Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/coreclr/jit/ee_il_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

FILE* jitstdout = nullptr;

ICorJitHost* g_jitHost = nullptr;
static CILJit* ILJitter = nullptr; // The one and only JITTER I return
bool g_jitInitialized = false;
ICorJitHost* g_jitHost = nullptr;
bool g_jitInitialized = false;

/*****************************************************************************/

Expand Down Expand Up @@ -152,19 +151,16 @@ void jitShutdown(bool processIsTerminating)

/*****************************************************************************/

static CILJit g_CILJit;

DLLEXPORT ICorJitCompiler* getJit()
{
if (!g_jitInitialized)
{
return nullptr;
}

if (ILJitter == nullptr)
{
alignas(alignof(CILJit)) static char CILJitBuff[sizeof(CILJit)];
ILJitter = new (CILJitBuff, jitstd::placement_t()) CILJit();
}
return (ILJitter);
return &g_CILJit;
}

/*****************************************************************************/
Expand Down