summaryrefslogtreecommitdiff
path: root/src/vm/zapsig.cpp
diff options
context:
space:
mode:
authorAndon Andonov <anandono@microsoft.com>2019-01-14 19:59:12 -0800
committerGitHub <noreply@github.com>2019-01-14 19:59:12 -0800
commit9fe3286e3810298934315e999580edd78c3322c2 (patch)
tree79258a0ed5b043cc7a0ecac0131a77e58753e436 /src/vm/zapsig.cpp
parentdbdae9cc324a97ebc9199b973abe9a21b1177f01 (diff)
downloadcoreclr-9fe3286e3810298934315e999580edd78c3322c2.tar.gz
coreclr-9fe3286e3810298934315e999580edd78c3322c2.tar.bz2
coreclr-9fe3286e3810298934315e999580edd78c3322c2.zip
Large version bubble Support (#21727)
* Preliminary Changes * Module Index Resolution * Change infoModule encoding * Change referencing module in R2R * Pre-condition Check * Virtual Method Module Resolution * Remove Workarounds and add conditional import loading * Add signature kind module override * Add ELEMENT_TYPE_MODULE_ZAPSIG * Add switch to enable large version bubble * Cleanup * Change Native header check * Add large version bubble test * Add Large Version Bubble Checks * Cleanup * Revert unnecessary check * Change EncodeMethod Version Bubble Condition * Add Large Version Bubble asserts * Cleanup * Add default argument to runtests.py * Change test PreCommands * Revert whitespace changes * Change breaking conditional check * Streamline Version Bubble test * Address PR Feedback * Address PR Feedback #2 * Remove dead code * Add crossgen-time ifdef
Diffstat (limited to 'src/vm/zapsig.cpp')
-rw-r--r--src/vm/zapsig.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/vm/zapsig.cpp b/src/vm/zapsig.cpp
index b883eaf14d..734491ed66 100644
--- a/src/vm/zapsig.cpp
+++ b/src/vm/zapsig.cpp
@@ -760,7 +760,7 @@ Module *ZapSig::DecodeModuleFromIndexIfLoaded(Module *fromModule,
fValidAssemblyRef = FALSE;
}
}
-
+
if (fValidAssemblyRef)
{
pAssembly = fromModule->GetAssemblyIfLoaded(
@@ -803,11 +803,11 @@ TypeHandle ZapSig::DecodeType(Module *pEncodeModuleContext,
TypeHandle th = p.GetTypeHandleThrowing(pInfoModule,
&typeContext,
ClassLoader::LoadTypes,
- level,
+ level,
level < CLASS_LOADED, // For non-full loads, drop a level when loading generic arguments
NULL,
pZapSigContext);
-
+
return th;
}
@@ -1127,7 +1127,11 @@ BOOL ZapSig::EncodeMethod(
TypeHandle ownerType;
#ifdef FEATURE_READYTORUN_COMPILER
- if (IsReadyToRunCompilation())
+
+ // For methods encoded outside of the version bubble, we use pResolvedToken which describes the metadata token from which the method originated
+ // For tokens inside the version bubble we are not constrained by the contents of pResolvedToken and as such we skip this codepath
+ // FUTURE: This condition should likely be changed or reevaluated once support for smaller version bubbles is implemented.
+ if (IsReadyToRunCompilation() && (!IsLargeVersionBubbleEnabled() || !pMethod->GetModule()->IsInCurrentVersionBubble()))
{
if (pResolvedToken == NULL)
{
@@ -1186,7 +1190,9 @@ BOOL ZapSig::EncodeMethod(
}
#ifdef FEATURE_READYTORUN_COMPILER
- if (IsReadyToRunCompilation())
+
+ // FUTURE: This condition should likely be changed or reevaluated once support for smaller version bubbles is implemented.
+ if (IsReadyToRunCompilation() && (!IsLargeVersionBubbleEnabled() || !pMethod->GetModule()->IsInCurrentVersionBubble()))
{
if (pConstrainedResolvedToken != NULL)
{
@@ -1202,7 +1208,6 @@ BOOL ZapSig::EncodeMethod(
// GetSvcLogger()->Printf(W("ReadyToRun: Method reference outside of current version bubble cannot be encoded\n"));
ThrowHR(E_FAIL);
}
- _ASSERTE(pReferencingModule == GetAppDomain()->ToCompilationDomain()->GetTargetModule());
methodToken = pResolvedToken->token;
@@ -1312,6 +1317,14 @@ BOOL ZapSig::EncodeMethod(
if (fEncodeUsingResolvedTokenSpecStreams && pResolvedToken != NULL && pResolvedToken->pTypeSpec != NULL)
{
_ASSERTE(pResolvedToken->cbTypeSpec > 0);
+
+ if (IsReadyToRunCompilation() && pMethod->GetModule()->IsInCurrentVersionBubble() && pInfoModule != (Module *) pResolvedToken->tokenScope)
+ {
+ pSigBuilder->AppendElementType((CorElementType)ELEMENT_TYPE_MODULE_ZAPSIG);
+ DWORD index = (*((EncodeModuleCallback)pfnEncodeModule))(pEncodeModuleContext, (Module *) pResolvedToken->tokenScope);
+ pSigBuilder->AppendData(index);
+ }
+
pSigBuilder->AppendBlob((PVOID)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
}
else