diff options
author | Koundinya Veluri <kouvel@users.noreply.github.com> | 2018-10-03 08:52:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 08:52:40 -0700 |
commit | b68296ce2c56188cf2a7bd263903e27c67717702 (patch) | |
tree | 3c535c8fe4f92d91fc590a6cd25731ed5b222f25 /src/vm/prestub.cpp | |
parent | 50567db6e3851f4c4680771424a354e2258333b4 (diff) | |
download | coreclr-b68296ce2c56188cf2a7bd263903e27c67717702.tar.gz coreclr-b68296ce2c56188cf2a7bd263903e27c67717702.tar.bz2 coreclr-b68296ce2c56188cf2a7bd263903e27c67717702.zip |
Add MethodImplOptions.AggressiveOptimization and use it for tiering (#20009)
Add MethodImplOptions.AggressiveOptimization and use it for tiering
Part of fix for https://github.com/dotnet/corefx/issues/32235
Workaround for https://github.com/dotnet/coreclr/issues/19751
- Added and set CORJIT_FLAG_AGGRESSIVE_OPT to indicate that a method is flagged with AggressiveOptimization
- For a method flagged with AggressiveOptimization, tiering uses a foreground tier 1 JIT on first call to the method, skipping the tier 0 JIT and call counting
- When tiering is disabled, a method flagged with AggressiveOptimization does not use r2r-pregenerated code
- R2r crossgen does not generate code for a method flagged with AggressiveOptimization
Diffstat (limited to 'src/vm/prestub.cpp')
-rw-r--r-- | src/vm/prestub.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index 378dc2e120..1893cf6c23 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -1745,20 +1745,16 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT) // When the TieredCompilationManager has received enough call notifications // for this method only then do we back-patch it. BOOL fCanBackpatchPrestub = TRUE; - BOOL fEligibleForCallCounting = FALSE; #ifdef FEATURE_TIERED_COMPILATION + BOOL fNeedsCallCounting = FALSE; TieredCompilationManager* pTieredCompilationManager = nullptr; - BOOL fEligibleForTieredCompilation = IsEligibleForTieredCompilation(); - BOOL fWasPromotedToTier1 = FALSE; - if (fEligibleForTieredCompilation) + if (IsEligibleForTieredCompilation() && TieredCompilationManager::RequiresCallCounting(this)) { - fEligibleForCallCounting = g_pConfig->TieredCompilation_CallCounting(); - if (fEligibleForCallCounting) - { - pTieredCompilationManager = GetAppDomain()->GetTieredCompilationManager(); - CallCounter * pCallCounter = GetCallCounter(); - pCallCounter->OnMethodCalled(this, pTieredCompilationManager, &fCanBackpatchPrestub, &fWasPromotedToTier1); - } + pTieredCompilationManager = GetAppDomain()->GetTieredCompilationManager(); + CallCounter * pCallCounter = GetCallCounter(); + BOOL fWasPromotedToTier1 = FALSE; + pCallCounter->OnMethodCalled(this, pTieredCompilationManager, &fCanBackpatchPrestub, &fWasPromotedToTier1); + fNeedsCallCounting = !fWasPromotedToTier1; } #endif @@ -1771,10 +1767,12 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT) { pCode = GetCodeVersionManager()->PublishVersionableCodeIfNecessary(this, fCanBackpatchPrestub); - if (pTieredCompilationManager != nullptr && fEligibleForCallCounting && fCanBackpatchPrestub && pCode != NULL && !fWasPromotedToTier1) +#ifdef FEATURE_TIERED_COMPILATION + if (pTieredCompilationManager != nullptr && fNeedsCallCounting && fCanBackpatchPrestub && pCode != NULL) { pTieredCompilationManager->OnMethodCallCountingStoppedWithoutTier1Promotion(this); } +#endif fIsPointingToPrestub = IsPointingToPrestub(); } |