Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomáš Rylek <trylek@microsoft.com>2022-03-04 13:51:57 +0300
committerGitHub <noreply@github.com>2022-03-04 13:51:57 +0300
commit4e9ff76d3bc5cd04e2413105f867239b3e694b37 (patch)
tree40cb63d1706686cb16e5d7508688c1faeb1174ad
parentaaa2388d8e27bee8f19c37473a862cffa1f8aea4 (diff)
Only register composite R2R native image code range once (#65623)
As David Wrighton noticed during an independent investigation, today CoreCLR runtime logic ends up registering composite image code range with the execution manager the number of times equal to the number of component modules of the composite image accessed at runtime, i.e. ultimately up to over 200 times in case of the composite framework. This change fixes that by slightly shuffling the initialization housekeeping chores. Thanks Tomas Fixes: https://github.com/dotnet/runtime/issues/65481
-rw-r--r--src/coreclr/inc/CrstTypes.def1
-rw-r--r--src/coreclr/inc/crsttypes.h2
-rw-r--r--src/coreclr/vm/ceeload.cpp8
-rw-r--r--src/coreclr/vm/domainassembly.cpp8
4 files changed, 10 insertions, 9 deletions
diff --git a/src/coreclr/inc/CrstTypes.def b/src/coreclr/inc/CrstTypes.def
index 0335e4965f1..279118f3012 100644
--- a/src/coreclr/inc/CrstTypes.def
+++ b/src/coreclr/inc/CrstTypes.def
@@ -206,6 +206,7 @@ Crst ExecutableAllocatorLock
End
Crst ExecuteManRangeLock
+ AcquiredAfter NativeImageEagerFixups
End
Crst FCall
diff --git a/src/coreclr/inc/crsttypes.h b/src/coreclr/inc/crsttypes.h
index d462cbd3c88..815b2636466 100644
--- a/src/coreclr/inc/crsttypes.h
+++ b/src/coreclr/inc/crsttypes.h
@@ -216,7 +216,7 @@ int g_rgCrstLevelMap[] =
4, // CrstModuleLookupTable
0, // CrstMulticoreJitHash
13, // CrstMulticoreJitManager
- 0, // CrstNativeImageEagerFixups
+ 3, // CrstNativeImageEagerFixups
0, // CrstNativeImageLoad
0, // CrstNls
0, // CrstNotifyGdb
diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp
index c48f2fcb596..aeb4868ee2a 100644
--- a/src/coreclr/vm/ceeload.cpp
+++ b/src/coreclr/vm/ceeload.cpp
@@ -4703,6 +4703,14 @@ void Module::RunEagerFixupsUnlocked()
}
}
}
+
+ TADDR base = dac_cast<TADDR>(pNativeImage->GetBase());
+
+ ExecutionManager::AddCodeRange(
+ base, base + (TADDR)pNativeImage->GetVirtualSize(),
+ ExecutionManager::GetReadyToRunJitManager(),
+ RangeSection::RANGE_SECTION_READYTORUN,
+ this /* pHeapListOrZapModule */);
}
#endif // !DACCESS_COMPILE
diff --git a/src/coreclr/vm/domainassembly.cpp b/src/coreclr/vm/domainassembly.cpp
index b8b19bb08b1..47c0fd53a74 100644
--- a/src/coreclr/vm/domainassembly.cpp
+++ b/src/coreclr/vm/domainassembly.cpp
@@ -532,14 +532,6 @@ void DomainAssembly::EagerFixups()
{
GetModule()->RunEagerFixups();
- PEImageLayout * pLayout = GetModule()->GetReadyToRunInfo()->GetImage();
-
- TADDR base = dac_cast<TADDR>(pLayout->GetBase());
-
- ExecutionManager::AddCodeRange(base, base + (TADDR)pLayout->GetVirtualSize(),
- ExecutionManager::GetReadyToRunJitManager(),
- RangeSection::RANGE_SECTION_READYTORUN,
- GetModule() /* (void *)pLayout */);
}
#endif // FEATURE_READYTORUN
}