Skip to content

Commit

Permalink
Simplify initialization of CILJit singleton (#73471)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas committed Aug 5, 2022
1 parent bceefa9 commit a231aa7
Showing 1 changed file with 5 additions and 9 deletions.
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

0 comments on commit a231aa7

Please sign in to comment.