Skip to content

Version Bubble implementation flaw: some methods are forced to rejit #46160

@y-yamshchikov

Description

@y-yamshchikov

The runtime does not load precompiled R2R code for methods like System.Collections.Concurrent.ConcurrentDictionary<int32,System.__Canon>.TryAddInternal in case where assembly with entrypoint does not contain in it's manifest metadata a direct mentioning of System.Collections.Concurrent assembly. In case where the method is used from assembly with entrypoint things work fine.

I have explored this issue on x64 and armel machines.
All R2R NI assemblies were built using crossgen2 with "-O --compilebubblegenerics --inputbubble" options.
In my minimal reproducing case the Manifest Metadata of entrypoint assembly contains mentioning of the second assembly, which in turn uses System.Collections.Concurrent stuff. The second assembly's Manifest Metadata contains mentioning of System.Collections.Concurrent assembly.

The runtime makes it's final decision to rejit existing method with this code:

pModule = SystemDomain::System()->DefaultDomain()->GetRootAssembly()->GetManifestModule();
_ASSERT(pModule != NULL);
if (pModule->IsReadyToRun() && pModule->IsInSameVersionBubble(GetModule()))
{
pCode = pModule->GetReadyToRunInfo()->GetEntryPoint(this, pConfig, TRUE /* fFixups */);
}

IsInSameVersionBubble returns false for the ("clear" entrypoint) : (System.Collections.Concurrent) pair and code goes to rejit when it returns true for (entrypoint using Concurrent stuff) : (System.Collections.Concurrent) pair, the runtime takes some valuable pCode and things work fine.

Should we consider such a behavior a bug?

@jkotas @alpencolt @gbalykov

Metadata

Metadata

Assignees

Labels

area-crossgen2-coreclrin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions