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

JIT: Remove the minopts policy against cctors #90792

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/coreclr/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ CONFIG_DWORD_INFO(INTERNAL_JitGCStress, W("JitGCStress"), 0, "GC stress mode for
CONFIG_DWORD_INFO(INTERNAL_JitHeartbeat, W("JitHeartbeat"), 0, "")
CONFIG_DWORD_INFO(INTERNAL_JitHelperLogging, W("JitHelperLogging"), 0, "")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_JITMinOpts, W("JITMinOpts"), 0, "Forces MinOpts")
RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_JITFullOptsForCctors, W("JitFullOptsForCctors"), 0, "Use FullOpts for cctors")

// *Some* relocs are just opportunistic optimizations and can be non-deterministic - it might produce
// noise for jit-diff like tools.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2434,9 +2434,9 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
{
opts.compFlags = CLFLG_MINOPT;
}
// Don't optimize .cctors (except prejit) or if we're an inlinee
// Don't optimize .cctors (except prejit and JitFullOptsForCctors) or if we're an inlinee
else if (!jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) && ((info.compFlags & FLG_CCTOR) == FLG_CCTOR) &&
hez2010 marked this conversation as resolved.
Show resolved Hide resolved
!compIsForInlining())
!compIsForInlining() && !JitConfig.JitFullOptsForCctors())
{
opts.compFlags = CLFLG_MINOPT;
}
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ CONFIG_INTEGER(JitInlineDepth, W("JITInlineDepth"), DEFAULT_MAX_INLINE_DEPTH)
CONFIG_INTEGER(JitForceInlineDepth, W("JITForceInlineDepth"), DEFAULT_MAX_FORCE_INLINE_DEPTH)
CONFIG_INTEGER(JitLongAddress, W("JitLongAddress"), 0) // Force using the large pseudo instruction form for long address
CONFIG_INTEGER(JitMaxUncheckedOffset, W("JitMaxUncheckedOffset"), 8)
CONFIG_INTEGER(JitFullOptsForCctors, W("JitFullOptsForCctors"), 0) // Use FullOpts for cctors
CONFIG_INTEGER(JitMinOpts, W("JITMinOpts"), 0) // Forces MinOpts
CONFIG_INTEGER(JitMinOptsBbCount, W("JITMinOptsBbCount"), DEFAULT_MIN_OPTS_BB_COUNT) // Internal jit control of MinOpts
CONFIG_INTEGER(JitMinOptsCodeSize, W("JITMinOptsCodeSize"), DEFAULT_MIN_OPTS_CODE_SIZE) // Internal jit control of
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/vm/eeconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ HRESULT EEConfig::sync()

fJitFramed = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_JitFramed) != 0);
fJitMinOpts = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_JITMinOpts) == 1);
fJitFullOptsForCctors = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_JITFullOptsForCctors) == 1);
fJitEnableOptionalRelocs = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_JitEnableOptionalRelocs) == 1);
iJitOptimizeType = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_JitOptimizeType);
if (iJitOptimizeType > OPT_RANDOM) iJitOptimizeType = OPT_DEFAULT;
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/vm/eeconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class EEConfig
unsigned int GenOptimizeType(void) const {LIMITED_METHOD_CONTRACT; return iJitOptimizeType; }
bool JitFramed(void) const {LIMITED_METHOD_CONTRACT; return fJitFramed; }
bool JitMinOpts(void) const {LIMITED_METHOD_CONTRACT; return fJitMinOpts; }
bool JitFullOptsForCctors(void) const {LIMITED_METHOD_CONTRACT; return fJitFullOptsForCctors; }
bool JitEnableOptionalRelocs(void) const {LIMITED_METHOD_CONTRACT; return fJitEnableOptionalRelocs; }

// Tiered Compilation config
Expand Down Expand Up @@ -479,6 +480,7 @@ class EEConfig
bool fTrackDynamicMethodDebugInfo; // Enable/Disable tracking dynamic method debug info
bool fJitFramed; // Enable/Disable EBP based frames
bool fJitMinOpts; // Enable MinOpts for all jitted methods
bool fJitFullOptsForCctors; // Enable FullOpts for cctors
bool fJitEnableOptionalRelocs; // Allow optional relocs

unsigned iJitOptimizeType; // 0=Blended,1=SmallCode,2=FastCode, default is 0=Blended
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/vm/tieredcompilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ NativeCodeVersion::OptimizationTier TieredCompilationManager::GetInitialOptimiza
WRAPPER_NO_CONTRACT;
_ASSERTE(pMethodDesc != NULL);

if (pMethodDesc->IsClassConstructor() && g_pConfig->JitFullOptsForCctors())
{
return NativeCodeVersion::OptimizationTierOptimized;
}

#ifdef FEATURE_TIERED_COMPILATION
if (!pMethodDesc->IsEligibleForTieredCompilation())
{
Expand Down Expand Up @@ -1066,6 +1071,12 @@ CORJIT_FLAGS TieredCompilationManager::GetJitFlags(PrepareCodeConfig *config)
if (nativeCodeVersion.IsDefaultVersion() && !config->WasTieringDisabledBeforeJitting())
{
MethodDesc *methodDesc = nativeCodeVersion.GetMethodDesc();

if (methodDesc->IsClassConstructor() && g_pConfig->JitFullOptsForCctors())
{
return flags;
}

if (!methodDesc->IsEligibleForTieredCompilation())
{
_ASSERTE(nativeCodeVersion.GetOptimizationTier() == NativeCodeVersion::OptimizationTierOptimized);
Expand Down
Loading