Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add Tier0/1 jit flags
Browse files Browse the repository at this point in the history
These flags provides a hook to change the JIT policy in the future and diverge tier0/tier1 compilation from min_opt/speed_opt respectively.
  • Loading branch information
noahfalk committed Apr 1, 2017
1 parent bf6a03a commit 4561dad
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ TODO: Talk about initializing strutures before use
#endif

// Update this one
SELECTANY const GUID JITEEVersionIdentifier = { /* 61783541-8fc0-44ce-80f7-7789b93a3309 */
0x61783541,
0x8fc0,
0x44ce,
{ 0x80, 0xf7, 0x77, 0x89, 0xb9, 0x3a, 0x33, 0x09 }
SELECTANY const GUID JITEEVersionIdentifier = { /* f00b3f49-ddd2-49be-ba43-6e49ffa66959 */
0xf00b3f49,
0xddd2,
0x49be,
{ 0xba, 0x43, 0x6e, 0x49, 0xff, 0xa6, 0x69, 0x59 }
};

//////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions src/inc/corjit.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ class CORJIT_FLAGS
CORJIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
CORJIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
CORJIT_FLAG_DESKTOP_QUIRKS = 38, // The JIT should generate desktop-quirk-compatible code
CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code
};

CORJIT_FLAGS()
Expand Down
6 changes: 4 additions & 2 deletions src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,8 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
opts.jitFlags = jitFlags;
opts.compFlags = CLFLG_MAXOPT; // Default value is for full optimization

if (jitFlags->IsSet(JitFlags::JIT_FLAG_DEBUG_CODE) || jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT))
if (jitFlags->IsSet(JitFlags::JIT_FLAG_DEBUG_CODE) || jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT) ||
jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0))
{
opts.compFlags = CLFLG_MINOPT;
}
Expand All @@ -2495,7 +2496,8 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
//
// If the EE sets SPEED_OPT we will optimize for speed at the expense of code size
//
else if (jitFlags->IsSet(JitFlags::JIT_FLAG_SPEED_OPT))
else if (jitFlags->IsSet(JitFlags::JIT_FLAG_SPEED_OPT) ||
(jitFlags->IsSet(JitFlags::JIT_FLAG_TIER1) && !jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT)))
{
opts.compCodeOpt = FAST_CODE;
assert(!jitFlags->IsSet(JitFlags::JIT_FLAG_SIZE_OPT));
Expand Down
4 changes: 4 additions & 0 deletions src/jit/jitee.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ class JitFlags
JIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
JIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
JIT_FLAG_DESKTOP_QUIRKS = 38, // The JIT should generate desktop-quirk-compatible code
JIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
JIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code
};
// clang-format on

Expand Down Expand Up @@ -187,6 +189,8 @@ class JitFlags
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_USE_PINVOKE_HELPERS, JIT_FLAG_USE_PINVOKE_HELPERS);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE, JIT_FLAG_REVERSE_PINVOKE);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS, JIT_FLAG_DESKTOP_QUIRKS);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TIER0, JIT_FLAG_TIER0);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TIER1, JIT_FLAG_TIER1);

#undef FLAGS_EQUAL
}
Expand Down
4 changes: 2 additions & 2 deletions src/vm/prestub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ PCODE MethodDesc::MakeJitWorker(COR_ILMETHOD_DECODER* ILHeader, CORJIT_FLAGS fla
bool fBackgroundThread = flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND);
#endif

// If this is the first stage of a tiered compilation progression, use min-opt, otherwise
// If this is the first stage of a tiered compilation progression, use tier0, otherwise
// use default compilation options
#ifdef FEATURE_TIERED_COMPILATION
if (!IsEligibleForTieredCompilation())
Expand All @@ -295,7 +295,7 @@ PCODE MethodDesc::MakeJitWorker(COR_ILMETHOD_DECODER* ILHeader, CORJIT_FLAGS fla
else
{
fStable = FALSE;
flags.Add(CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_MIN_OPT));
flags.Add(CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_TIER0));
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/vm/tieredcompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ PCODE TieredCompilationManager::CompileMethod(MethodDesc* pMethod)
EX_TRY
{
CORJIT_FLAGS flags = CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND);
flags.Add(CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_SPEED_OPT));
flags.Add(CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_TIER1));

if (pMethod->IsDynamicMethod())
{
Expand Down

0 comments on commit 4561dad

Please sign in to comment.