//==========================================================================================
DispatchSlot MethodTable::FindDispatchSlot(UINT32 typeID, UINT32 slotNumber, BOOL throwOnConflict)
{
- WRAPPER_NO_CONTRACT;
- DispatchSlot implSlot(NULL);
- FindDispatchImpl(typeID, slotNumber, &implSlot, throwOnConflict);
- return implSlot;
-}
-
-//==========================================================================================
-DispatchSlot MethodTable::FindDispatchSlot(DispatchToken tok, BOOL throwOnConflict)
-{
CONTRACTL
{
THROWS;
MODE_ANY;
}
CONTRACTL_END;
- return FindDispatchSlot(tok.GetTypeID(), tok.GetSlotNumber(), throwOnConflict);
+
+ DispatchSlot implSlot(NULL);
+ FindDispatchImpl(typeID, slotNumber, &implSlot, throwOnConflict);
+ return implSlot;
}
#ifndef DACCESS_COMPILE
UINT32 slotNumber,
DispatchMapEntry *pEntry);
-public:
+private:
BOOL FindDispatchImpl(
UINT32 typeID,
UINT32 slotNumber,
DispatchSlot * pImplSlot,
BOOL throwOnConflict);
-
+public:
#ifndef DACCESS_COMPILE
BOOL FindDefaultInterfaceImplementation(
MethodDesc *pInterfaceMD,
DispatchSlot FindDispatchSlot(UINT32 typeID, UINT32 slotNumber, BOOL throwOnConflict);
- DispatchSlot FindDispatchSlot(DispatchToken tok, BOOL throwOnConflict);
-
// You must use the second of these two if there is any chance the pMD is a method
// on a generic interface such as IComparable<T> (which it normally can be). The
// ownerType is used to provide an exact qualification in the case the pMD is
// Get the token from the stub
CONSISTENCY_CHECK(isStub(pStub));
- size_t token = GetTokenFromStub(pStub);
+ DispatchToken token(GetTokenFromStub(pStub));
// Get the this object from ECX
Object *pObj = StubManagerHelpers::GetThisPtr(pContext);
}
#endif
- target = pMgr->ResolveWorker(&callSite, protectedObj, token, stubKind);
+ target = pMgr->ResolveWorker(&callSite, protectedObj, representativeToken, stubKind);
GCPROTECT_END();
if (token.IsTypedToken())
{
dbg_pTokenMT = GetThread()->GetDomain()->LookupType(token.GetTypeID());
- dbg_pTokenMD = dbg_pTokenMT->FindDispatchSlot(token.GetSlotNumber(), throwOnConflict).GetMethodDesc();
+ dbg_pTokenMD = dbg_pTokenMT->FindDispatchSlot(TYPE_ID_THIS_CLASS, token.GetSlotNumber(), throwOnConflict).GetMethodDesc();
}
#endif // _DEBUG
MethodDesc * pMD = NULL;
BOOL fShouldPatch = FALSE;
- DispatchSlot implSlot(pMT->FindDispatchSlot(token, throwOnConflict));
+ DispatchSlot implSlot(pMT->FindDispatchSlot(token.GetTypeID(), token.GetSlotNumber(), throwOnConflict));
// If we found a target, then just figure out if we're allowed to create a stub around
// this target and backpatch the callsite.
else if (pMT->IsComObjectType() && IsInterfaceToken(token))
{
MethodTable * pItfMT = GetTypeFromToken(token);
- implSlot = pItfMT->FindDispatchSlot(token.GetSlotNumber(), throwOnConflict);
+ implSlot = pItfMT->FindDispatchSlot(TYPE_ID_THIS_CLASS, token.GetSlotNumber(), throwOnConflict);
if (pItfMT->HasInstantiation())
{
if (token.IsTypedToken())
{
pTokenMT = GetThread()->GetDomain()->LookupType(token.GetTypeID());
- pTokenMD = pTokenMT->FindDispatchSlot(token.GetSlotNumber(), throwOnConflict).GetMethodDesc();
+ pTokenMD = pTokenMT->FindDispatchSlot(TYPE_ID_THIS_CLASS, token.GetSlotNumber(), throwOnConflict).GetMethodDesc();
}
#ifdef FEATURE_COMINTEROP
MethodTable *pMT = pObj->GetMethodTable();
CONSISTENCY_CHECK(CheckPointer(pMT));
-
- DispatchSlot slot(pMT->FindDispatchSlot(token, FALSE /* throwOnConflict */));
-
+ DispatchSlot slot(pMT->FindDispatchSlot(token.GetTypeID(), token.GetSlotNumber(), FALSE /* throwOnConflict */));
if (slot.IsNull() && IsInterfaceToken(token) && pMT->IsComObjectType())
{
MethodDesc * pItfMD = GetInterfaceMethodDescFromToken(token);
CONSISTENCY_CHECK(pItfMD->GetMethodTable()->GetSlot(pItfMD->GetSlot()) == pItfMD->GetMethodEntryPoint());
- slot = pItfMD->GetMethodTable()->FindDispatchSlot(pItfMD->GetSlot(), FALSE /* throwOnConflict */);
+
+ // Look up the slot on the interface itself.
+ slot = pItfMD->GetMethodTable()->FindDispatchSlot(TYPE_ID_THIS_CLASS, pItfMD->GetSlot(), FALSE /* throwOnConflict */);
}
// The dispatch slot's target may change due to code versioning shortly after it was retrieved above for the trace. This
return NULL;
// Do the full resolve
- size_t token = VirtualCallStubManager::GetTokenFromStubQuick(pMgr, stubStartAddress, sk);
+ DispatchToken token(VirtualCallStubManager::GetTokenFromStubQuick(pMgr, stubStartAddress, sk));
PCODE target = NULL;
// TODO: passing NULL as protectedObj here can lead to incorrect behavior for ICastable objects