Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 639f185

Browse files
committed
Merge pull request #3812 from janvorli/fix-stub
Fix instantiating stub for methods of value types
2 parents 6932907 + fde6f26 commit 639f185

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/vm/prestub.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,15 +780,19 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg)
780780
CONTRACT_END;
781781

782782
SigTypeContext typeContext;
783+
MethodTable* pStubMT;
783784
if (pTargetMD->HasMethodInstantiation())
784785
{
785786
// The pHiddenArg shall be a MethodDesc*
786-
SigTypeContext::InitTypeContext(static_cast<MethodDesc *>(pHiddenArg), &typeContext);
787+
MethodDesc* pMD = static_cast<MethodDesc *>(pHiddenArg);
788+
SigTypeContext::InitTypeContext(pMD, &typeContext);
789+
pStubMT = pMD->GetMethodTable();
787790
}
788791
else
789792
{
790793
// The pHiddenArg shall be a MethodTable*
791794
SigTypeContext::InitTypeContext(TypeHandle::FromPtr(pHiddenArg), &typeContext);
795+
pStubMT = static_cast<MethodTable *>(pHiddenArg);
792796
}
793797

794798
MetaSig msig(pTargetMD);
@@ -837,7 +841,7 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg)
837841
pTargetMD->GetSig(&pSig,&cbSig);
838842
PTR_Module pLoaderModule = pTargetMD->GetLoaderModule();
839843
MethodDesc * pStubMD = ILStubCache::CreateAndLinkNewILStubMethodDesc(pTargetMD->GetLoaderAllocator(),
840-
pLoaderModule->GetILStubCache()->GetOrCreateStubMethodTable(pLoaderModule),
844+
pStubMT,
841845
ILSTUB_INSTANTIATINGSTUB,
842846
pTargetMD->GetModule(),
843847
pSig, cbSig,

0 commit comments

Comments
 (0)