@@ -569,12 +569,39 @@ bool CallCountingManager::SetCodeEntryPoint(
569
569
_ASSERTE (!wasMethodCalled || createTieringBackgroundWorkerRef != nullptr );
570
570
_ASSERTE (createTieringBackgroundWorkerRef == nullptr || !*createTieringBackgroundWorkerRef);
571
571
572
+ if (methodDesc->HasPrecode () &&
573
+ activeCodeVersion.GetOptimizationTier () == NativeCodeVersion::OptimizationTier::OptimizationTier0Instrumented)
574
+ {
575
+ // CallCountingManager* callCountingManager = methodDesc->GetLoaderAllocator()->GetCallCountingManager();
576
+ // CallCountingInfoByCodeVersionHash& callCountingInfoByCodeVersionHash =
577
+ // callCountingManager->m_callCountingInfoByCodeVersionHash;
578
+
579
+ // CallCount callCountThreshold = g_pConfig->TieredCompilation_CallCountThreshold();
580
+ // _ASSERTE(callCountThreshold != 0);
581
+
582
+ // NewHolder<CallCountingInfo> callCountingInfoHolder = new CallCountingInfo(activeCodeVersion, callCountThreshold / 2);
583
+ // callCountingInfoByCodeVersionHash.Add(callCountingInfoHolder);
584
+ // auto callCountingInfo = callCountingInfoHolder.Extract();
585
+
586
+ // auto callCountingStub = callCountingManager->m_callCountingStubAllocator.AllocateStub(
587
+ // callCountingInfo->GetRemainingCallCountCell(), codeEntryPoint);
588
+
589
+ // callCountingInfo->SetCallCountingStub(callCountingStub);
590
+
591
+ // // Now we need to update method's precode to point to our new callcounting stub
592
+ // Precode* precode = methodDesc->GetPrecode();
593
+ // _ASSERT(precode != nullptr);
594
+ // precode->SetTargetInterlocked(callCountingStub->GetEntryPoint(), false);
595
+ // callCountingInfo->SetStage(CallCountingInfo::Stage::StubMayBeActive);
596
+ // return true;
597
+ }
598
+
572
599
if (!methodDesc->IsEligibleForTieredCompilation () ||
573
600
(
574
601
// For a default code version that is not tier 0, call counting will have been disabled by this time (checked
575
602
// below). Avoid the redundant and not-insignificant expense of GetOptimizationTier() on a default code version.
576
603
!activeCodeVersion.IsDefaultVersion () &&
577
- activeCodeVersion.GetOptimizationTier () != NativeCodeVersion::OptimizationTier0
604
+ ! activeCodeVersion.IsUnoptimizedTier ()
578
605
) ||
579
606
!g_pConfig->TieredCompilation_CallCounting ())
580
607
{
@@ -602,7 +629,7 @@ bool CallCountingManager::SetCodeEntryPoint(
602
629
return true ;
603
630
}
604
631
605
- _ASSERTE (activeCodeVersion.GetOptimizationTier () == NativeCodeVersion::OptimizationTier0 );
632
+ _ASSERTE (activeCodeVersion.IsUnoptimizedTier () );
606
633
607
634
// If the tiering delay is active, postpone further work
608
635
if (GetAppDomain ()
@@ -649,7 +676,7 @@ bool CallCountingManager::SetCodeEntryPoint(
649
676
}
650
677
else
651
678
{
652
- _ASSERTE (activeCodeVersion.GetOptimizationTier () == NativeCodeVersion::OptimizationTier0 );
679
+ _ASSERTE (activeCodeVersion.IsUnoptimizedTier () );
653
680
654
681
// If the tiering delay is active, postpone further work
655
682
if (GetAppDomain ()
@@ -780,7 +807,7 @@ PCODE CallCountingManager::OnCallCountThresholdReached(TransitionBlock *transiti
780
807
// used going forward under appropriate locking to synchronize further with deletion.
781
808
GCX_PREEMP_THREAD_EXISTS (CURRENT_THREAD);
782
809
783
- _ASSERTE (codeVersion.GetOptimizationTier () == NativeCodeVersion::OptimizationTier0 );
810
+ _ASSERTE (codeVersion.IsUnoptimizedTier () );
784
811
785
812
codeEntryPoint = codeVersion.GetNativeCode ();
786
813
do
0 commit comments