@@ -1111,6 +1111,9 @@ void InterpCompiler::BuildGCInfo(InterpMethod *pInterpMethod)
1111
1111
continue ;
1112
1112
}
1113
1113
1114
+ if (pVar->pinned )
1115
+ flags = (GcSlotFlags)(flags | GC_SLOT_PINNED);
1116
+
1114
1117
if (pass == 0 )
1115
1118
slotAllocator.AllocateOrReuseGcSlot (pVar->offset , flags);
1116
1119
else
@@ -1520,9 +1523,11 @@ void InterpCompiler::CreateILVars()
1520
1523
1521
1524
for (int i = 0 ; i < numILLocals; i++) {
1522
1525
CORINFO_CLASS_HANDLE argClass;
1523
- CorInfoType argCorType = strip (m_compHnd->getArgType (&m_methodInfo->locals , sigArg, &argClass));
1526
+ CorInfoTypeWithMod argCorTypeWithFlags = m_compHnd->getArgType (&m_methodInfo->locals , sigArg, &argClass);
1527
+ CorInfoType argCorType = strip (argCorTypeWithFlags);
1528
+ bool pinned = (argCorTypeWithFlags & CORINFO_TYPE_MOD_PINNED) == CORINFO_TYPE_MOD_PINNED;
1524
1529
InterpType interpType = GetInterpType (argCorType);
1525
- CreateNextLocalVar (index, argClass, interpType, &offset);
1530
+ CreateNextLocalVar (index, argClass, interpType, &offset, pinned );
1526
1531
sigArg = m_compHnd->getArgNext (sigArg);
1527
1532
index++;
1528
1533
}
@@ -1550,7 +1555,7 @@ void InterpCompiler::CreateILVars()
1550
1555
m_totalVarsStackSize = offset;
1551
1556
}
1552
1557
1553
- void InterpCompiler::CreateNextLocalVar (int iArgToSet, CORINFO_CLASS_HANDLE argClass, InterpType interpType, int32_t *pOffset)
1558
+ void InterpCompiler::CreateNextLocalVar (int iArgToSet, CORINFO_CLASS_HANDLE argClass, InterpType interpType, int32_t *pOffset, bool pinned )
1554
1559
{
1555
1560
int32_t align;
1556
1561
int32_t size = GetInterpTypeStackSize (argClass, interpType, &align);
@@ -1562,6 +1567,7 @@ void InterpCompiler::CreateNextLocalVar(int iArgToSet, CORINFO_CLASS_HANDLE argC
1562
1567
m_pVars[iArgToSet].size = size;
1563
1568
*pOffset = ALIGN_UP_TO (*pOffset, align);
1564
1569
m_pVars[iArgToSet].offset = *pOffset;
1570
+ m_pVars[iArgToSet].pinned = pinned;
1565
1571
INTERP_DUMP (" alloc arg var %d to offset %d\n " , iArgToSet, *pOffset);
1566
1572
*pOffset += size;
1567
1573
}
@@ -5315,7 +5321,7 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo)
5315
5321
int byrefOfTypedRefVar = m_pStackPointer[-1 ].var ;
5316
5322
m_pLastNewIns->SetDVar (byrefOfTypedRefVar);
5317
5323
m_pStackPointer--;
5318
-
5324
+
5319
5325
AddIns (GetStindForType (InterpTypeByRef));
5320
5326
m_pLastNewIns->data [0 ] = OFFSETOF__CORINFO_TypedReference__dataPtr;
5321
5327
m_pLastNewIns->SetSVars2 (byrefOfTypedRefVar, addressVar);
@@ -5380,7 +5386,7 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo)
5380
5386
m_pLastNewIns->data [2 ] = 0 ;
5381
5387
m_pLastNewIns->SetSVar (typedByRefVar);
5382
5388
m_pLastNewIns->SetDVar (classHandleVar);
5383
-
5389
+
5384
5390
AddIns (INTOP_CALL_HELPER_P_S);
5385
5391
m_pLastNewIns->data [0 ] = GetDataForHelperFtn (CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_MAYBENULL);
5386
5392
m_pLastNewIns->SetSVar (classHandleVar);
0 commit comments