summaryrefslogtreecommitdiff
path: root/src/vm/codeversion.cpp
diff options
context:
space:
mode:
authorKoundinya Veluri <kouvel@users.noreply.github.com>2018-01-25 12:01:32 -0800
committerGitHub <noreply@github.com>2018-01-25 12:01:32 -0800
commit209415618ca5d1a5d1d9e39ca78d643d0935534e (patch)
treed83c946783390afbb52e3e0f968018c38dfd2560 /src/vm/codeversion.cpp
parente9985126acb0f1efd7c780faac4e66bc798b73c0 (diff)
downloadcoreclr-209415618ca5d1a5d1d9e39ca78d643d0935534e.tar.gz
coreclr-209415618ca5d1a5d1d9e39ca78d643d0935534e.tar.bz2
coreclr-209415618ca5d1a5d1d9e39ca78d643d0935534e.zip
Enable tiered jitting for R2R methods (#15967)
Enable tiered jitting for R2R methods - Included R2R methods and generics over value types in CoreLib for tiered jitting. Tier 0 for R2R methods is the precompiled code if available, and tier 1 is selectively scheduled based on call counting. - Added a delay before starting to count calls for tier 1 promotion. The delay is a short duration after frequent tier 0 jitting stops (current heuristic for identifying startup). - Startup time and steady-state performance have improved on JitBench. There is a regression shortly following startup due to call counting and tier 1 jitting, for a short duration before steady-state performance stabilizes. - Added two new config values, one for configuring the call count threshold for promoting to tier 1, and another for specifying the delay from the last tier 0 JIT invocation before starting to count calls
Diffstat (limited to 'src/vm/codeversion.cpp')
-rw-r--r--src/vm/codeversion.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/vm/codeversion.cpp b/src/vm/codeversion.cpp
index 10d3013f35..da808e8839 100644
--- a/src/vm/codeversion.cpp
+++ b/src/vm/codeversion.cpp
@@ -2177,12 +2177,14 @@ PCODE CodeVersionManager::PublishVersionableCodeIfNecessary(MethodDesc* pMethodD
// attempt to publish the active version still under the lock
if (FAILED(hr = PublishNativeCodeVersion(pMethodDesc, activeVersion, fEESuspend)))
{
- // if we need an EESuspend to publish then start over. We have to leave the lock in order to suspend,
- // and when we leave the lock the active version might change again. However now we know that suspend
+ // If we need an EESuspend to publish then start over. We have to leave the lock in order to suspend,
+ // and when we leave the lock the active version might change again. However now we know that suspend is
+ // necessary.
if (hr == CORPROF_E_RUNTIME_SUSPEND_REQUIRED)
{
_ASSERTE(!fEESuspend);
fEESuspend = true;
+ continue; // skip RestartEE() below since SuspendEE() has not been called yet
}
else
{
@@ -2215,6 +2217,8 @@ PCODE CodeVersionManager::PublishVersionableCodeIfNecessary(MethodDesc* pMethodD
HRESULT CodeVersionManager::PublishNativeCodeVersion(MethodDesc* pMethod, NativeCodeVersion nativeCodeVersion, BOOL fEESuspended)
{
+ // TODO: This function needs to make sure it does not change the precode's target if call counting is in progress. Track
+ // whether call counting is currently being done for the method, and use a lock to ensure the expected precode target.
LIMITED_METHOD_CONTRACT;
_ASSERTE(LockOwnedByCurrentThread());
_ASSERTE(pMethod->IsVersionable());
@@ -2236,7 +2240,12 @@ HRESULT CodeVersionManager::PublishNativeCodeVersion(MethodDesc* pMethod, Native
{
EX_TRY
{
- hr = pPrecode->SetTargetInterlocked(pCode, FALSE) ? S_OK : E_FAIL;
+ pPrecode->SetTargetInterlocked(pCode, FALSE);
+
+ // SetTargetInterlocked() would return false if it lost the race with another thread. That is fine, this thread
+ // can continue assuming it was successful, similarly to it successfully updating the target and another thread
+ // updating the target again shortly afterwards.
+ hr = S_OK;
}
EX_CATCH_HRESULT(hr);
return hr;