methodDescData->bHasNativeCode = FALSE;
methodDescData->NativeCodeAddr = (CLRDATA_ADDRESS)-1;
}
- methodDescData->AddressOfNativeCodeSlot = pMD->HasNativeCodeSlot() ? TO_CDADDR(pMD->GetAddrOfNativeCodeSlot()) : NULL;
+ methodDescData->AddressOfNativeCodeSlot = pMD->HasNativeCodeSlot() ? TO_CDADDR(dac_cast<TADDR>(pMD->GetAddrOfNativeCodeSlot())) : NULL;
methodDescData->MDToken = pMD->GetMemberDef();
methodDescData->MethodDescPtr = methodDesc;
methodDescData->MethodTablePtr = HOST_CDADDR(pMD->GetMethodTable());
#include <daccess.h>
#include <corbbtprof.h>
#include <clrtypes.h>
-#include <fixuppointer.h>
typedef DPTR(struct CORCOMPILE_EXCEPTION_LOOKUP_TABLE)
PTR_CORCOMPILE_EXCEPTION_LOOKUP_TABLE;
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-/*****************************************************************************\
-* *
-* FixupPointer.h - Fixup pointer holder types *
-* *
-\*****************************************************************************/
-
-#ifndef _FIXUPPOINTER_H
-#define _FIXUPPOINTER_H
-
-#include "daccess.h"
-
-//----------------------------------------------------------------------------
-// PlainPointer is simple pointer wrapper to support compilation without indirections
-// This is useful for building size-constrained runtime without NGen support.
-template<typename PTR_TYPE>
-class PlainPointer
-{
-public:
-
- static constexpr bool isRelative = false;
- typedef PTR_TYPE type;
-
- // Returns whether the encoded pointer is NULL.
- BOOL IsNull() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return m_ptr == NULL;
- }
-
- // Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
- BOOL IsTagged(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return FALSE;
- }
-
- // Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
- BOOL IsTagged() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return FALSE;
- }
-
- // Returns value of the encoded pointer.
- PTR_TYPE GetValue() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<PTR_TYPE>(m_ptr);
- }
-
-#ifndef DACCESS_COMPILE
- // Returns the pointer to the indirection cell.
- PTR_TYPE * GetValuePtr() const
- {
- LIMITED_METHOD_CONTRACT;
- return (PTR_TYPE *)&m_ptr;
- }
-#endif // !DACCESS_COMPILE
-
- // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
- PTR_TYPE GetValue(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<PTR_TYPE>(m_ptr);
- }
-
- // Static version of GetValue. It is meant to simplify access to arrays of pointers.
- FORCEINLINE static PTR_TYPE GetValueAtPtr(TADDR base)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->GetValue(base);
- }
-
- // Returns value of the encoded pointer. The pointer can be NULL.
- PTR_TYPE GetValueMaybeNull() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<PTR_TYPE>(m_ptr);
- }
-
- // Returns value of the encoded pointer. The pointer can be NULL.
- PTR_TYPE GetValueMaybeNull(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<PTR_TYPE>(m_ptr);
- }
-
- // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
- FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtr(TADDR base)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
- }
-
- // Returns value of the encoded pointer.
- // Allows the value to be tagged.
- FORCEINLINE TADDR GetValueMaybeTagged() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return m_ptr;
- }
-
- // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
- // Allows the value to be tagged.
- FORCEINLINE TADDR GetValueMaybeTagged(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return m_ptr;
- }
-
- // Returns whether pointer is indirect. Assumes that the value is not NULL.
- bool IsIndirectPtr(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return FALSE;
- }
-
-#ifndef DACCESS_COMPILE
- // Returns whether pointer is indirect. Assumes that the value is not NULL.
- // Does not need explicit base and thus can be used in non-DAC builds only.
- bool IsIndirectPtr() const
- {
- LIMITED_METHOD_CONTRACT;
- return FALSE;
- }
-#endif
-
- // Returns whether pointer is indirect. The value can be NULL.
- bool IsIndirectPtrMaybeNull(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return FALSE;
- }
-
-#ifndef DACCESS_COMPILE
- // Returns whether pointer is indirect. The value can be NULL.
- // Does not need explicit base and thus can be used in non-DAC builds only.
- bool IsIndirectPtrMaybeNull() const
- {
- LIMITED_METHOD_CONTRACT;
- return FALSE;
- }
-#endif
-
-#ifndef DACCESS_COMPILE
- void SetValue(PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- m_ptr = dac_cast<TADDR>(addr);
- }
-
- // Set encoded value of the pointer. Assumes that the value is not NULL.
- void SetValue(TADDR base, PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- m_ptr = dac_cast<TADDR>(addr);
- }
-
- // Static version of SetValue. It is meant to simplify access to arrays of pointers.
- FORCEINLINE static void SetValueAtPtr(TADDR base, PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->SetValue(base, addr);
- }
-
- // Set encoded value of the pointer. The value can be NULL.
- void SetValueMaybeNull(TADDR base, PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- m_ptr = dac_cast<TADDR>(addr);
- }
-
- // Set encoded value of the pointer. The value can be NULL.
- // Does not need explicit base and thus can be used in non-DAC builds only.
- FORCEINLINE void SetValueMaybeNull(PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- return SetValueMaybeNull((TADDR)this, addr);
- }
-
- // Static version of SetValueMaybeNull. It is meant to simplify access to arrays of pointers.
- FORCEINLINE static void SetValueMaybeNullAtPtr(TADDR base, PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->SetValueMaybeNull(base, addr);
- }
-
- FORCEINLINE void SetValueVolatile(PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- VolatileStore((PTR_TYPE *)(&m_ptr), addr);
- }
-#endif
-
- static TADDR GetRelativeMaybeNull(TADDR base, TADDR addr)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return addr;
- }
-
- static TADDR GetRelative(TADDR base, TADDR addr)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- PRECONDITION(addr != NULL);
- return addr;
- }
-
-private:
- TADDR m_ptr;
-};
-
-#define FixupPointer PlainPointer
-#define RelativePointer PlainPointer
-#define RelativeFixupPointer PlainPointer
-
-//----------------------------------------------------------------------------
-// RelativePointer32 is pointer encoded as relative 32-bit offset. It is used
-// to reduce both the size of the pointer itself as well as size of relocation
-// section for pointers that live exlusively in NGen images.
-template<typename PTR_TYPE>
-class RelativePointer32
-{
-public:
-
- static constexpr bool isRelative = true;
- typedef PTR_TYPE type;
-
- // Returns whether the encoded pointer is NULL.
- BOOL IsNull() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- // Pointer pointing to itself is treated as NULL
- return m_delta == 0;
- }
-
- // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
- PTR_TYPE GetValue(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- PRECONDITION(!IsNull());
- return dac_cast<PTR_TYPE>(base + m_delta);
- }
-
-#ifndef DACCESS_COMPILE
- // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
- // Does not need explicit base and thus can be used in non-DAC builds only.
- FORCEINLINE PTR_TYPE GetValue() const
- {
- LIMITED_METHOD_CONTRACT;
- return GetValue((TADDR)this);
- }
-#endif
-
- // Static version of GetValue. It is meant to simplify access to arrays of pointers.
- FORCEINLINE static PTR_TYPE GetValueAtPtr(TADDR base)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->GetValue(base);
- }
-
- // Returns value of the encoded pointer. The pointer can be NULL.
- PTR_TYPE GetValueMaybeNull(TADDR base) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
-
- // Cache local copy of delta to avoid races when the value is changing under us.
- TADDR delta = m_delta;
-
- if (delta == 0)
- return NULL;
-
- return dac_cast<PTR_TYPE>(base + delta);
- }
-
-#ifndef DACCESS_COMPILE
- // Returns value of the encoded pointer. The pointer can be NULL.
- // Does not need explicit base and thus can be used in non-DAC builds only.
- FORCEINLINE PTR_TYPE GetValueMaybeNull() const
- {
- LIMITED_METHOD_CONTRACT;
- return GetValueMaybeNull((TADDR)this);
- }
-#endif
-
- // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
- FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtr(TADDR base)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
- }
-
-private:
- INT32 m_delta;
-};
-
-//----------------------------------------------------------------------------
-// IndirectPointer is pointer with optional indirection, similar to FixupPointer and RelativeFixupPointer.
-//
-// In comparison to FixupPointer, IndirectPointer's indirection is handled from outside by isIndirect flag.
-// In comparison to RelativeFixupPointer, IndirectPointer's offset is a constant,
-// while RelativeFixupPointer's offset is an address.
-//
-// IndirectPointer can contain NULL only if it is not indirect.
-//
-template<typename PTR_TYPE>
-class IndirectPointer
-{
-public:
-
- static constexpr bool isRelative = false;
- typedef PTR_TYPE type;
-
- // Returns whether the encoded pointer is NULL.
- BOOL IsNull() const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return m_addr == (TADDR)NULL;
- }
-
- // Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- FORCEINLINE BOOL IsTaggedIndirect(TADDR base, bool isIndirect, intptr_t offset) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- TADDR addr = m_addr;
- if (isIndirect)
- {
- _ASSERTE(!IsNull());
- return (*PTR_TADDR(addr + offset) & 1) != 0;
- }
- return FALSE;
- }
-
- // Returns value of the encoded pointer.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- FORCEINLINE PTR_TYPE GetValueIndirect(bool isIndirect, intptr_t offset) const
- {
- LIMITED_METHOD_DAC_CONTRACT;
- TADDR addr = m_addr;
- if (isIndirect)
- {
- _ASSERTE(!IsNull());
- addr = *PTR_TADDR(addr + offset);
- }
- return dac_cast<PTR_TYPE>(addr);
- }
-
-#ifndef DACCESS_COMPILE
- // Returns the pointer to the indirection cell.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- PTR_TYPE * GetValuePtrIndirect(bool isIndirect, intptr_t offset) const
- {
- LIMITED_METHOD_CONTRACT;
- TADDR addr = m_addr;
- if (isIndirect)
- {
- _ASSERTE(!IsNull());
- return (PTR_TYPE *)(addr + offset);
- }
- return (PTR_TYPE *)&m_addr;
- }
-#endif // !DACCESS_COMPILE
-
- // Static version of GetValue. It is meant to simplify access to arrays of pointers.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- FORCEINLINE static PTR_TYPE GetValueAtPtrIndirect(TADDR base, bool isIndirect, intptr_t offset)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(IndirectPointer<PTR_TYPE>)>(base)->GetValueIndirect(isIndirect, offset);
- }
-
- // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtrIndirect(TADDR base, bool isIndirect, intptr_t offset)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return GetValueAtPtrIndirect(base, isIndirect, offset);
- }
-
-#ifndef DACCESS_COMPILE
- // Returns whether pointer is indirect. Assumes that the value is not NULL.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- bool IsIndirectPtrIndirect(bool isIndirect, intptr_t offset) const
- {
- LIMITED_METHOD_CONTRACT;
- if (isIndirect)
- _ASSERTE(!IsNull());
- return isIndirect;
- }
-
- // Returns whether pointer is indirect. The value can be NULL.
- // Uses isIndirect to identify, whether pointer is indirect or not. If it is, uses offset.
- bool IsIndirectPtrMaybeNullIndirect(bool isIndirect, intptr_t offset) const
- {
- LIMITED_METHOD_CONTRACT;
- return IsIndirectPtrIndirect(isIndirect, offset);
- }
-#endif // !DACCESS_COMPILE
-
-#ifndef DACCESS_COMPILE
- // Set encoded value of the pointer. Assumes that the value is not NULL.
- void SetValue(PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- m_addr = dac_cast<TADDR>(addr);
- }
-
- // Set encoded value of the pointer. The value can be NULL.
- void SetValueMaybeNull(PTR_TYPE addr)
- {
- LIMITED_METHOD_CONTRACT;
- SetValue(addr);
- }
-#endif // !DACCESS_COMPILE
-
-private:
- TADDR m_addr;
-};
-
-template<bool isMaybeNull, typename T, typename PT>
-typename PT::type
-ReadPointer(const T *base, const PT T::* pPointerFieldMember)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- uintptr_t offset = (uintptr_t) &(base->*pPointerFieldMember) - (uintptr_t) base;
-
- if (isMaybeNull)
- {
- return PT::GetValueMaybeNullAtPtr(dac_cast<TADDR>(base) + offset);
- }
- else
- {
- return PT::GetValueAtPtr(dac_cast<TADDR>(base) + offset);
- }
-}
-
-template<bool isMaybeNull, typename T, typename PT>
-typename PT::type
-ReadPointer(const T *base, const PT T::* pPointerFieldMember, bool isIndirect)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- uintptr_t offset = (uintptr_t) &(base->*pPointerFieldMember) - (uintptr_t) base;
-
- if (isMaybeNull)
- {
- return PT::GetValueMaybeNullAtPtrIndirect(dac_cast<TADDR>(base) + offset, isIndirect, offset);
- }
- else
- {
- return PT::GetValueAtPtrIndirect(dac_cast<TADDR>(base) + offset, isIndirect, offset);
- }
-}
-
-template<typename T, typename PT>
-typename PT::type
-ReadPointerMaybeNull(const T *base, const PT T::* pPointerFieldMember)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return ReadPointer<true>(base, pPointerFieldMember);
-}
-
-template<typename T, typename PT>
-typename PT::type
-ReadPointerMaybeNull(const T *base, const PT T::* pPointerFieldMember, bool isIndirect)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return ReadPointer<true>(base, pPointerFieldMember, isIndirect);
-}
-
-template<typename T, typename PT>
-typename PT::type
-ReadPointer(const T *base, const PT T::* pPointerFieldMember)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return ReadPointer<false>(base, pPointerFieldMember);
-}
-
-template<typename T, typename PT>
-typename PT::type
-ReadPointer(const T *base, const PT T::* pPointerFieldMember, bool isIndirect)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return ReadPointer<false>(base, pPointerFieldMember, isIndirect);
-}
-
-template<bool isMaybeNull, typename T, typename C, typename PT>
-typename PT::type
-ReadPointer(const T *base, const C T::* pFirstPointerFieldMember, const PT C::* pSecondPointerFieldMember)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- const PT *ptr = &(base->*pFirstPointerFieldMember.*pSecondPointerFieldMember);
- uintptr_t offset = (uintptr_t) ptr - (uintptr_t) base;
-
- if (isMaybeNull)
- {
- return PT::GetValueMaybeNullAtPtr(dac_cast<TADDR>(base) + offset);
- }
- else
- {
- return PT::GetValueAtPtr(dac_cast<TADDR>(base) + offset);
- }
-}
-
-template<typename T, typename C, typename PT>
-typename PT::type
-ReadPointerMaybeNull(const T *base, const C T::* pFirstPointerFieldMember, const PT C::* pSecondPointerFieldMember)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return ReadPointer<true>(base, pFirstPointerFieldMember, pSecondPointerFieldMember);
-}
-
-template<typename T, typename C, typename PT>
-typename PT::type
-ReadPointer(const T *base, const C T::* pFirstPointerFieldMember, const PT C::* pSecondPointerFieldMember)
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return ReadPointer<false>(base, pFirstPointerFieldMember, pSecondPointerFieldMember);
-}
-
-#endif //_FIXUPPOINTER_H
PRECONDITION(pLoaderAllocator != NULL || pMethod->GetLoaderAllocator() != NULL);
// If a domain is provided, the MethodDesc mustn't yet be set up to have one, or it must match the MethodDesc's domain,
// unless we're in a compilation domain (NGen loads assemblies as domain-bound but compiles them as domain neutral).
- PRECONDITION(!pLoaderAllocator || !pMethod || pMethod->GetMethodDescChunk()->GetMethodTablePtr()->IsNull() ||
+ PRECONDITION(!pLoaderAllocator || !pMethod || pMethod->GetMethodDescChunk()->GetMethodTable() == NULL ||
pLoaderAllocator == pMethod->GetMethodDescChunk()->GetFirstMethodDesc()->GetLoaderAllocator());
}
CONTRACTL_END;
{
STANDARD_VM_CONTRACT;
- _ASSERTE(!MethodTable::IsPerInstInfoRelative());
-
PCODE helperAddress = (pLookup->helper == CORINFO_HELP_RUNTIMEHANDLE_METHOD ?
GetEEFuncEntryPoint(JIT_GenericHandleMethodWithSlotAndModule) :
GetEEFuncEntryPoint(JIT_GenericHandleClassWithSlotAndModule));
{
unsigned offsetOfIndirection = MethodTable::GetVtableOffset() + MethodTable::GetIndexOfVtableIndirection(slot) * TARGET_POINTER_SIZE;
unsigned offsetAfterIndirection = MethodTable::GetIndexAfterVtableIndirection(slot) * TARGET_POINTER_SIZE;
- _ASSERTE(MethodTable::VTableIndir_t::isRelative == false /* TODO: NYI */);
VTableCallStub* pStub = stub();
BYTE* p = (BYTE*)pStub->entryPoint();
void StubLinkerCPU::ThumbEmitTailCallManagedMethod(MethodDesc *pMD)
{
- bool isRelative = MethodTable::VTableIndir2_t::isRelative
- && pMD->IsVtableSlot();
-
- _ASSERTE(!isRelative);
-
// Use direct call if possible.
if (pMD->HasStableEntryPoint())
{
// mov r12, #slotaddress
ThumbEmitMovConstant(ThumbReg(12), (TADDR)pMD->GetAddrOfSlot());
- if (isRelative)
- {
- // mov r4, r12
- ThumbEmitMovRegReg(ThumbReg(4), ThumbReg(12));
- }
-
// ldr r12, [r12]
ThumbEmitLoadRegIndirect(ThumbReg(12), ThumbReg(12), 0);
-
- if (isRelative)
- {
- // add r12, r4
- ThumbEmitAddReg(ThumbReg(12), ThumbReg(4));
- }
}
- if (!isRelative)
- {
- // bx r12
- ThumbEmitJumpRegister(ThumbReg(12));
- }
- else
- {
- // Replace LR with R12 on stack: hybrid-tail call, same as for EmitShuffleThunk
- // str r12, [sp, 4]
- ThumbEmitStoreRegIndirect(ThumbReg(12), thumbRegSp, 4);
- }
+ // bx r12
+ ThumbEmitJumpRegister(ThumbReg(12));
}
VOID StubLinkerCPU::EmitComputedInstantiatingMethodStub(MethodDesc* pSharedMD, struct ShuffleEntry *pShuffleEntryArray, void* extraArg)
ThumbEmitIncrement(ThumbReg(0), sizeof(MethodTable*));
}
- bool isRelative = MethodTable::VTableIndir2_t::isRelative
- && pSharedMD->IsVtableSlot();
-
- _ASSERTE(!isRelative);
-
- if (isRelative)
- {
- ThumbEmitProlog(1, 0, FALSE);
- }
-
ThumbEmitTailCallManagedMethod(pSharedMD);
-
- if (isRelative)
- {
- ThumbEmitEpilog();
- }
}
{
STANDARD_VM_CONTRACT;
- _ASSERTE(!MethodTable::IsPerInstInfoRelative());
-
PCODE helperAddress = (pLookup->helper == CORINFO_HELP_RUNTIMEHANDLE_METHOD ?
GetEEFuncEntryPoint(JIT_GenericHandleMethodWithSlotAndModule) :
GetEEFuncEntryPoint(JIT_GenericHandleClassWithSlotAndModule));
{
unsigned offsetOfIndirection = MethodTable::GetVtableOffset() + MethodTable::GetIndexOfVtableIndirection(slot) * TARGET_POINTER_SIZE;
unsigned offsetAfterIndirection = MethodTable::GetIndexAfterVtableIndirection(slot) * TARGET_POINTER_SIZE;
- _ASSERTE(MethodTable::VTableIndir_t::isRelative == false /* TODO: NYI */);
VTableCallStub* pStub = stub();
BYTE* p = (BYTE*)(pStub->entryPoint() & ~THUMB_CODE);
{
STANDARD_VM_CONTRACT;
- _ASSERTE(!MethodTable::IsPerInstInfoRelative());
-
PCODE helperAddress = (pLookup->helper == CORINFO_HELP_RUNTIMEHANDLE_METHOD ?
GetEEFuncEntryPoint(JIT_GenericHandleMethodWithSlotAndModule) :
GetEEFuncEntryPoint(JIT_GenericHandleClassWithSlotAndModule));
{
unsigned offsetOfIndirection = MethodTable::GetVtableOffset() + MethodTable::GetIndexOfVtableIndirection(slot) * TARGET_POINTER_SIZE;
unsigned offsetAfterIndirection = MethodTable::GetIndexAfterVtableIndirection(slot) * TARGET_POINTER_SIZE;
- _ASSERTE(MethodTable::VTableIndir_t::isRelative == false /* TODO: NYI */);
int indirectionsCodeSize = (offsetOfIndirection >= 0x8000 ? 8 : 4) + (offsetAfterIndirection >= 0x8000 ? 8 : 4);
int indirectionsDataSize = (offsetOfIndirection >= 0x8000 ? 4 : 0) + (offsetAfterIndirection >= 0x8000 ? 4 : 0);
_ASSERTE(pNewMD->GetMethodName() && GetDebugClassName());
pNewMD->m_pszDebugMethodName = pNewMD->GetMethodName();
pNewMD->m_pszDebugClassName = GetDebugClassName();
- pNewMD->m_pDebugMethodTable.SetValue(pNewMD->GetMethodTable());
+ pNewMD->m_pDebugMethodTable = pNewMD->GetMethodTable();
#endif // _DEBUG
}
if (canShareVtableChunks)
{
// Share the parent chunk
- it.SetIndirectionSlot(pParentClass->GetVtableIndirections()[it.GetIndex()].GetValueMaybeNull());
+ it.SetIndirectionSlot(pParentClass->GetVtableIndirections()[it.GetIndex()]);
}
else
{
}
-ArrayDPTR(RelativeFixupPointer<PTR_MethodTable>) ModuleCtorInfo::GetGCStaticMTs(DWORD index)
+ArrayDPTR(PTR_MethodTable) ModuleCtorInfo::GetGCStaticMTs(DWORD index)
{
LIMITED_METHOD_CONTRACT;
// This class is contained so do not enumerate 'this'.
DacEnumMemoryRegion(dac_cast<TADDR>(ppMT), numElements *
- sizeof(RelativePointer<MethodTable *>));
+ sizeof(MethodTable *));
DacEnumMemoryRegion(dac_cast<TADDR>(cctorInfoHot), numElementsHot *
sizeof(ClassCtorInfoEntry));
DacEnumMemoryRegion(dac_cast<TADDR>(cctorInfoCold),
DWORD numElements;
DWORD numLastAllocated;
DWORD numElementsHot;
- DPTR(RelativePointer<PTR_MethodTable>) ppMT; // size is numElements
+ DPTR(PTR_MethodTable) ppMT; // size is numElements
PTR_ClassCtorInfoEntry cctorInfoHot; // size is numElementsHot
PTR_ClassCtorInfoEntry cctorInfoCold; // size is numElements-numElementsHot
DWORD numHotHashes;
DWORD numColdHashes;
- ArrayDPTR(RelativeFixupPointer<PTR_MethodTable>) ppHotGCStaticsMTs; // hot table
- ArrayDPTR(RelativeFixupPointer<PTR_MethodTable>) ppColdGCStaticsMTs; // cold table
+ ArrayDPTR(PTR_MethodTable) ppHotGCStaticsMTs; // hot table
+ ArrayDPTR(PTR_MethodTable) ppColdGCStaticsMTs; // cold table
DWORD numHotGCStaticsMTs;
DWORD numColdGCStaticsMTs;
return hashVal;
};
- ArrayDPTR(RelativeFixupPointer<PTR_MethodTable>) GetGCStaticMTs(DWORD index);
+ ArrayDPTR(PTR_MethodTable) GetGCStaticMTs(DWORD index);
PTR_MethodTable GetMT(DWORD i)
{
LIMITED_METHOD_DAC_CONTRACT;
- return ppMT[i].GetValue(dac_cast<TADDR>(ppMT) + i * sizeof(RelativePointer<PTR_MethodTable>));
+ return ppMT[i];
}
};
{
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
- TYPE value = RelativePointer<TYPE>::GetValueMaybeNullAtPtr(dac_cast<TADDR>(pValue));
+ TYPE value = dac_cast<TYPE>(*pValue);
if (pFlags)
*pFlags = dac_cast<TADDR>(value) & supportedFlags;
{
WRAPPER_NO_CONTRACT;
- value = (TYPE)(dac_cast<TADDR>(value) | flags);
+ value = dac_cast<TYPE>((dac_cast<TADDR>(value) | flags));
- RelativePointer<TYPE> *pRelPtr = (RelativePointer<TYPE> *)pValue;
- pRelPtr->SetValue(value);
+ *(dac_cast<DPTR(TYPE)>(pValue)) = value;
}
//
}
#endif // DACCESS_COMPILE
-//
-// Specialization of GetValueAt methods for tables with cross-module references
-//
-template<>
-inline
-PTR_TypeRef LookupMap<PTR_TypeRef>::GetValueAt(PTR_TADDR pValue, TADDR* pFlags, TADDR supportedFlags)
-{
- WRAPPER_NO_CONTRACT;
- SUPPORTS_DAC;
-
- // Strip flags before RelativeFixupPointer dereference
- TADDR value = *pValue;
-
- TADDR flags = (value & supportedFlags);
- value -= flags;
- value = ((RelativeFixupPointer<TADDR>&)(value)).GetValueMaybeNull(dac_cast<TADDR>(pValue));
-
- if (pFlags)
- *pFlags = flags;
-
- return dac_cast<PTR_TypeRef>(value);
-}
-
-template<>
-inline
-PTR_Module LookupMap<PTR_Module>::GetValueAt(PTR_TADDR pValue, TADDR* pFlags, TADDR supportedFlags)
-{
- WRAPPER_NO_CONTRACT;
- SUPPORTS_DAC;
-
- // Strip flags before RelativeFixupPointer dereference
- TADDR value = *pValue;
-
- TADDR flags = (value & supportedFlags);
- value -= flags;
- value = ((RelativeFixupPointer<TADDR>&)(value)).GetValueMaybeNull(dac_cast<TADDR>(pValue));
-
- if (pFlags)
- *pFlags = flags;
-
- return dac_cast<PTR_Module>(value);
-}
-
-template<>
-inline
-PTR_MemberRef LookupMap<PTR_MemberRef>::GetValueAt(PTR_TADDR pValue, TADDR* pFlags, TADDR supportedFlags)
-{
- WRAPPER_NO_CONTRACT;
- SUPPORTS_DAC;
-
- // Strip flags before RelativeFixupPointer dereference
- TADDR value = *pValue;
-
- TADDR flags = (value & supportedFlags);
- value -= flags;
- value = ((RelativeFixupPointer<TADDR>&)(value)).GetValueMaybeNull(dac_cast<TADDR>(pValue));
-
- if (pFlags)
- *pFlags = flags;
-
- return dac_cast<PTR_MemberRef>(value);
-
-}
-
// Retrieve the value associated with a rid
template<typename TYPE>
TYPE LookupMap<TYPE>::GetElement(DWORD rid, TADDR* pFlags)
LOG((LF_CLASSLOADER, LL_INFO1000, "GENERICS: Replaced approximate parent %s with exact parent %s from token %x\n", pParentMT->GetDebugClassName(), pNewParentMT->GetDebugClassName(), crExtends));
// SetParentMethodTable is not used here since we want to update the indirection cell in the NGen case
- if (pMT->IsParentMethodTableIndirectPointerMaybeNull())
- {
- *pMT->GetParentMethodTableValuePtr() = pNewParentMT;
- }
- else
- {
- pMT->GetParentMethodTablePointerPtr()->SetValueMaybeNull(pNewParentMT);
- }
-
+ *pMT->GetParentMethodTableValuePtr() = pNewParentMT;
pParentMT = pNewParentMT;
}
}
DWORD nDicts = pParentMT->GetNumDicts();
for (DWORD iDict = 0; iDict < nDicts; iDict++)
{
- if (pMT->GetPerInstInfo()[iDict].GetValueMaybeNull() != pParentMT->GetPerInstInfo()[iDict].GetValueMaybeNull())
+ if (pMT->GetPerInstInfo()[iDict] != pParentMT->GetPerInstInfo()[iDict])
{
- pMT->GetPerInstInfo()[iDict].SetValueMaybeNull(pParentMT->GetPerInstInfo()[iDict].GetValueMaybeNull());
+ pMT->GetPerInstInfo()[iDict] = pParentMT->GetPerInstInfo()[iDict];
}
}
}
// Variance info for each type parameter (gpNonVariant, gpCovariant, or gpContravariant)
// If NULL, this type has no type parameters that are co/contravariant
- RelativePointer<PTR_BYTE> m_pVarianceInfo;
+ PTR_BYTE m_pVarianceInfo;
//
// COM RELATED FIELDS.
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointerMaybeNull(this, &EEClassOptionalFields::m_pVarianceInfo);
+ return m_pVarianceInfo;
}
};
typedef DPTR(EEClassOptionalFields) PTR_EEClassOptionalFields;
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
- return ReadPointerMaybeNull(this, &EEClass::m_pMethodTable);
+ return m_pMethodTable;
}
// DO NOT ADD ANY ASSERTS TO THIS METHOD.
CANNOT_HAVE_CONTRACT;
SUPPORTS_DAC;
- return ReadPointerMaybeNull(this, &EEClass::m_pMethodTable);
+ return m_pMethodTable;
}
#ifndef DACCESS_COMPILE
inline void SetMethodTable(MethodTable* pMT)
{
LIMITED_METHOD_CONTRACT;
- m_pMethodTable.SetValueMaybeNull(pMT);
+ m_pMethodTable = pMT;
}
#endif // !DACCESS_COMPILE
LIMITED_METHOD_DAC_CONTRACT;
// Careful about using this method. If it's possible that fields may have been added via EnC, then
// must use the FieldDescIterator as any fields added via EnC won't be in the raw list
- return m_pFieldDescList.GetValueMaybeNull(PTR_HOST_MEMBER_TADDR(EEClass, this, m_pFieldDescList));
+ return m_pFieldDescList;
}
PTR_FieldDesc GetFieldDescByIndex(DWORD fieldIndex);
inline void SetFieldDescList (FieldDesc* pFieldDescList)
{
LIMITED_METHOD_CONTRACT;
- m_pFieldDescList.SetValue(pFieldDescList);
+ m_pFieldDescList = pFieldDescList;
}
#endif // !DACCESS_COMPILE
inline void SetChunks (MethodDescChunk* pChunks)
{
LIMITED_METHOD_CONTRACT;
- m_pChunks.SetValueMaybeNull(pChunks);
+ m_pChunks = pChunks;
}
#endif // !DACCESS_COMPILE
void AddChunk (MethodDescChunk* pNewChunk);
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointerMaybeNull(this, &EEClass::m_pGuidInfo);
+ return m_pGuidInfo;
}
inline void SetGuidInfo(GuidInfo* pGuidInfo)
{
WRAPPER_NO_CONTRACT;
#ifndef DACCESS_COMPILE
- m_pGuidInfo.SetValueMaybeNull(pGuidInfo);
+ m_pGuidInfo = pGuidInfo;
#endif // DACCESS_COMPILE
}
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(HasOptionalFields());
- GetOptionalFields()->m_pVarianceInfo.SetValueMaybeNull(pVarianceInfo);
+ GetOptionalFields()->m_pVarianceInfo = pVarianceInfo;
}
#endif // !DACCESS_COMPILE
// C_ASSERTs in Jitinterface.cpp need this to be public to check the offset.
// Put it first so the offset rarely changes, which just reduces the number of times we have to fiddle
// with the offset.
- RelativePointer<PTR_GuidInfo> m_pGuidInfo; // The cached guid information for interfaces.
+ PTR_GuidInfo m_pGuidInfo; // The cached guid information for interfaces.
#ifdef _DEBUG
public:
private:
// Layout rest of fields below from largest to smallest to lessen the chance of wasting bytes with
// compiler injected padding (especially with the difference between pointers and DWORDs on 64-bit).
- RelativePointer<PTR_EEClassOptionalFields> m_rpOptionalFields;
+ PTR_EEClassOptionalFields m_rpOptionalFields;
// TODO: Remove this field. It is only used by SOS and object validation for stress.
- RelativePointer<PTR_MethodTable> m_pMethodTable;
+ PTR_MethodTable m_pMethodTable;
- RelativePointer<PTR_FieldDesc> m_pFieldDescList;
- RelativePointer<PTR_MethodDescChunk> m_pChunks;
+ PTR_FieldDesc m_pFieldDescList;
+ PTR_MethodDescChunk m_pChunks;
#ifdef FEATURE_COMINTEROP
union
void AttachOptionalFields(EEClassOptionalFields *pFields)
{
LIMITED_METHOD_CONTRACT;
- _ASSERTE(m_rpOptionalFields.IsNull());
+ _ASSERTE(m_rpOptionalFields == NULL);
- m_rpOptionalFields.SetValue(pFields);
+ m_rpOptionalFields = pFields;
}
#endif // !DACCESS_COMPILE
bool HasOptionalFields()
{
LIMITED_METHOD_DAC_CONTRACT;
- return !m_rpOptionalFields.IsNull();
+ return m_rpOptionalFields != NULL;
}
PTR_EEClassOptionalFields GetOptionalFields()
{
LIMITED_METHOD_DAC_CONTRACT;
- return m_rpOptionalFields.GetValueMaybeNull(PTR_HOST_MEMBER_TADDR(EEClass, this, m_rpOptionalFields));
+ return m_rpOptionalFields;
}
private:
DAC_ALIGNAS(EEClass) // Align the first member to the alignment of the base class
PTR_Stub m_pStaticCallStub;
PTR_Stub m_pInstRetBuffCallStub;
- RelativePointer<PTR_MethodDesc> m_pInvokeMethod;
+ PTR_MethodDesc m_pInvokeMethod;
PTR_Stub m_pMultiCastInvokeStub;
PTR_Stub m_pWrapperDelegateInvokeStub;
UMThunkMarshInfo* m_pUMThunkMarshInfo;
- RelativePointer<PTR_MethodDesc> m_pBeginInvokeMethod;
- RelativePointer<PTR_MethodDesc> m_pEndInvokeMethod;
+ PTR_MethodDesc m_pBeginInvokeMethod;
+ PTR_MethodDesc m_pEndInvokeMethod;
Volatile<PCODE> m_pMarshalStub;
#ifdef FEATURE_COMINTEROP
PTR_MethodDesc GetInvokeMethod()
{
- return ReadPointer(this, &DelegateEEClass::m_pInvokeMethod);
+ return m_pInvokeMethod;
}
PTR_MethodDesc GetBeginInvokeMethod()
{
- return ReadPointer(this, &DelegateEEClass::m_pBeginInvokeMethod);
+ return m_pBeginInvokeMethod;
}
PTR_MethodDesc GetEndInvokeMethod()
{
- return ReadPointer(this, &DelegateEEClass::m_pEndInvokeMethod);
+ return m_pEndInvokeMethod;
}
#ifndef DACCESS_COMPILE
inline PTR_MethodDescChunk EEClass::GetChunks()
{
LIMITED_METHOD_DAC_CONTRACT;
- return m_pChunks.GetValueMaybeNull(PTR_HOST_MEMBER_TADDR(EEClass, this, m_pChunks));
+ return m_pChunks;
}
//*******************************************************************************
{
LIMITED_METHOD_CONTRACT;
m_pDictLayout = NULL;
- m_pVarianceInfo.SetValueMaybeNull(NULL);
+ m_pVarianceInfo = NULL;
#ifdef FEATURE_COMINTEROP
m_pSparseVTableMap = NULL;
m_pCoClassForIntf = TypeHandle();
}
CONTRACTL_END;
- // TypeHandles are encoded as a relative pointer rather than a regular pointer to avoid the need for image
- // fixups (any TypeHandles in this hash are defined in the same module).
- if ((dac_cast<TADDR>(m_Data) & EECLASSHASH_TYPEHANDLE_DISCR) == 0)
- return RelativePointer<PTR_VOID>::GetValueMaybeNullAtPtr(PTR_HOST_INT_MEMBER_TADDR(EEClassHashEntry, this, m_Data));
-
return m_Data;
}
}
CONTRACTL_END;
- // TypeHandles are encoded as a relative pointer rather than a regular pointer to avoid the need for image
- // fixups (any TypeHandles in this hash are defined in the same module).
- if (((TADDR)data & EECLASSHASH_TYPEHANDLE_DISCR) == 0)
- {
- RelativePointer<void *> *pRelPtr = (RelativePointer<void *> *) &m_Data;
- pRelPtr->SetValueMaybeNull(data);
- }
- else
- m_Data = data;
+ m_Data = data;
}
void EEClassHashEntry::SetEncloser(EEClassHashEntry *pEncloser)
// in this case, the lifetime of Key is bounded by the lifetime of cqb, which will free the memory
// it allocated on destruction.
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
LPSTR pszName = NULL;
LPSTR pszNameSpace = NULL;
IMDInternalImport *pInternalImport = NULL;
_ASSERTE(pszNamespace != NULL);
_ASSERTE(pszClassName != NULL);
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
EEClassHashEntry *pEntry = BaseAllocateEntry(pamTracker);
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
_ASSERTE(pszNamespace != NULL);
_ASSERTE(pszClassName != NULL);
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
_ASSERTE(pszNamespace != NULL);
_ASSERTE(pszClassName != NULL);
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
_ASSERTE(pName);
if (pName->GetNameSpace())
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
PTR_EEClassHashEntry pSearch = BaseFindNextEntryByHash(pContext);
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
CQuickBytes szNamespace;
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
CQuickBytes szNamespace;
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
EEClassHashEntry_t *pItem = FindItem(pszNamespace, pszClassName, IsNested, pContext);
if (pItem)
*pData = pItem->GetData();
_ASSERTE(pName);
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
if(pName->GetNameSpace() == NULL) {
return GetValue(pName->GetName(), pData, IsNested, pContext);
}
CONTRACTL_END;
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
_ASSERTE (pEntry);
_ASSERTE (pKey2);
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
_ASSERTE(pModule == GetModule());
// Allocate the table and verify that we actually got one.
pComInfo = ComPlusCallInfo::FromMethodDesc(pMD);
_ASSERTE(pComInfo != NULL);
- _ASSERTE((*ppStubMD) == pComInfo->m_pStubMD.GetValue());
+ _ASSERTE((*ppStubMD) == pComInfo->m_pStubMD);
if (pComInfo->m_pInterfaceMT == NULL)
{
DWORD dwStubFlags;
pComInfo = ComPlusCall::PopulateComPlusCallMethodDesc(pMD, &dwStubFlags);
- if (!pComInfo->m_pStubMD.IsNull())
+ if (pComInfo->m_pStubMD != NULL)
{
// Discard pre-implemented code
- PCODE pPreImplementedCode = pComInfo->m_pStubMD.GetValue()->GetNativeCode();
+ PCODE pPreImplementedCode = pComInfo->m_pStubMD->GetNativeCode();
InterlockedCompareExchangeT<PCODE>(pComInfo->GetAddrOfILStubField(), NULL, pPreImplementedCode);
}
DelegateEEClass* delegateCls = (DelegateEEClass*)pMD->GetMethodTable()->GetClass();
_ASSERTE(pFrame->GetThis()->GetMethodTable()->IsDelegate());
- if (pMD == delegateCls->m_pBeginInvokeMethod.GetValue())
+ if (pMD == delegateCls->m_pBeginInvokeMethod)
{
callsiteFlags |= CallsiteDetails::BeginInvoke;
}
else
{
- _ASSERTE(pMD == delegateCls->m_pEndInvokeMethod.GetValue());
+ _ASSERTE(pMD == delegateCls->m_pEndInvokeMethod);
callsiteFlags |= CallsiteDetails::EndInvoke;
}
if (HasNativeCodeSlot())
{
- RelativePointer<TADDR> *pRelPtr = (RelativePointer<TADDR> *)GetAddrOfNativeCodeSlot();
- pRelPtr->SetValueMaybeNull(NULL);
+ *GetAddrOfNativeCodeSlot() = NULL;
}
else
{
#include "utilcode.h"
#include "log.h"
#include "loaderheap.h"
-#include "fixuppointer.h"
#include "stgpool.h"
// src/vm
if (isMemoryReadable((TADDR)chunk, sizeof(MethodDescChunk)))
{
- RelativeFixupPointer<PTR_MethodTable> * ppMT = chunk->GetMethodTablePtr();
+ PTR_MethodTable * ppMT = chunk->GetMethodTablePtr();
- // The MethodTable is stored as a RelativeFixupPointer which does an
- // extra indirection if the address is tagged (the low bit is set).
- // That could AV if we don't check it first.
+ // Access to the MethodTable could AV if we don't check it first.
- if (!ppMT->IsTagged((TADDR)ppMT) || isMemoryReadable((TADDR)ppMT->GetValuePtr(), sizeof(MethodTable*)))
+ if (isMemoryReadable((TADDR)ppMT, sizeof(MethodTable*)))
{
- if (AsMethodTable((size_t)RelativeFixupPointer<PTR_MethodTable>::GetValueAtPtr((TADDR)ppMT)) != 0)
+ if (*ppMT != NULL)
{
pValidMD = pMD;
}
#endif // _DEBUG
pcsEmit->EmitADD();
- if (decltype(NDirectMethodDesc::ndirect.m_pWriteableData)::isRelative)
- {
- pcsEmit->EmitDUP();
- }
-
pcsEmit->EmitLDIND_I();
- if (decltype(NDirectMethodDesc::ndirect.m_pWriteableData)::isRelative)
- {
- pcsEmit->EmitADD();
- }
-
pcsEmit->EmitLDIND_I();
}
#ifdef FEATURE_COMINTEROP
}
else
{
- pNMD->ndirect.m_pszLibName.SetValueMaybeNull(libName);
- pNMD->ndirect.m_pszEntrypointName.SetValueMaybeNull(entryPointName);
+ pNMD->ndirect.m_pszLibName = libName;
+ pNMD->ndirect.m_pszEntrypointName = entryPointName;
}
// Do not publish incomplete prestub flags or you will introduce a race condition.
if (pMD->IsNDirect())
{
NDirectMethodDesc* pNMD = (NDirectMethodDesc*)pMD;
- return pNMD->ndirect.m_pStubMD.GetValueMaybeNull();
+ return pNMD->ndirect.m_pStubMD;
}
#ifdef FEATURE_COMINTEROP
else if (pMD->IsComPlusCall() || pMD->IsGenericComPlusCall())
{
ComPlusCallInfo *pComInfo = ComPlusCallInfo::FromMethodDesc(pMD);
- return (pComInfo == NULL ? NULL : pComInfo->m_pStubMD.GetValueMaybeNull());
+ return (pComInfo == NULL ? NULL : pComInfo->m_pStubMD);
}
#endif // FEATURE_COMINTEROP
else if (pMD->IsEEImpl())
pNewMD->SetTemporaryEntryPoint(m_pDomain->GetLoaderAllocator(), &amt);
#ifdef _DEBUG
- pNewMD->m_pDebugMethodTable.SetValue(m_pMethodTable);
+ pNewMD->m_pDebugMethodTable = m_pMethodTable;
#endif
if (pPrevMD)
// the store sig part of the method desc
pNewMD->SetStoredMethodSig((PCCOR_SIGNATURE)psig, sigSize);
// the dynamic part of the method desc
- pNewMD->m_pszMethodName.SetValueMaybeNull(name);
+ pNewMD->m_pszMethodName = name;
pNewMD->m_dwExtendedFlags = mdPublic | mdStatic | DynamicMethodDesc::nomdLCGMethod;
// The m_pSig and m_pszMethodName need to be destroyed after the GetLCGMethodResolver()->Destroy() call
// otherwise the EEJitManager::CodeHeapIterator could return DynamicMethodDesc with these members NULLed, but
// the nibble map for the corresponding code memory indicating that this DynamicMethodDesc is still alive.
- PCODE pSig = m_pSig.GetValue();
- PTR_CUTF8 pszMethodName = m_pszMethodName.GetValue();
+ PCODE pSig = m_pSig;
+ PTR_CUTF8 pszMethodName = m_pszMethodName;
GetLCGMethodResolver()->Destroy();
// The current DynamicMethodDesc storage is destroyed at this point
#endif
protected:
- RelativePointer<PTR_MethodTable> m_pMTOfEnclosingClass; // This is used to hold the log2 of the field size temporarily during class loading. Yuck.
+ PTR_MethodTable m_pMTOfEnclosingClass; // This is used to hold the log2 of the field size temporarily during class loading. Yuck.
// See also: FieldDesc::InitializeFrom method
#ifndef DACCESS_COMPILE
void InitializeFrom(const FieldDesc& sourceField, MethodTable *pMT)
{
- m_pMTOfEnclosingClass.SetValue(pMT);
+ m_pMTOfEnclosingClass = pMT;
m_mb = sourceField.m_mb;
m_isStatic = sourceField.m_isStatic;
void SetMethodTable(MethodTable* mt)
{
LIMITED_METHOD_CONTRACT;
- m_pMTOfEnclosingClass.SetValue(mt);
+ m_pMTOfEnclosingClass = mt;
}
#endif
PTR_MethodTable GetApproxEnclosingMethodTable_NoLogging()
{
LIMITED_METHOD_DAC_CONTRACT;
- return m_pMTOfEnclosingClass.GetValue(PTR_HOST_MEMBER_TADDR(FieldDesc, this, m_pMTOfEnclosingClass));
+ return m_pMTOfEnclosingClass;
}
PTR_MethodTable GetApproxEnclosingMethodTable()
*pNewDictionary->GetBackPointerSlot(numGenericArgs) = pDictionary;
// Publish the new dictionary slots to the type.
- FastInterlockExchangePointer(pIMD->m_pPerInstInfo.GetValuePtr(), pNewDictionary);
+ FastInterlockExchangePointer(&pIMD->m_pPerInstInfo, pNewDictionary);
pDictionary = pNewDictionary;
}
// Publish the new dictionary slots to the type.
ULONG dictionaryIndex = pMT->GetNumDicts() - 1;
- Dictionary** pPerInstInfo = pMT->GetPerInstInfo()->GetValuePtr();
+ Dictionary** pPerInstInfo = pMT->GetPerInstInfo();
FastInterlockExchangePointer(pPerInstInfo + dictionaryIndex, pNewDictionary);
pDictionary = pNewDictionary;
// MethodTable is expected to be normalized
Dictionary* pDictionary = pMT->GetDictionary();
- _ASSERTE(pDictionary == pMT->GetPerInstInfo()[dictionaryIndex].GetValueMaybeNull());
+ _ASSERTE(pDictionary == pMT->GetPerInstInfo()[dictionaryIndex]);
#endif
}
friend class NativeImageDumper;
#endif
private:
- // First N entries are generic instantiations arguments. They are stored as FixupPointers
- // in NGen images. It means that the lowest bit is used to mark optional indirection (see code:FixupPointer).
- // The rest of the open array are normal pointers (no optional indirection).
+ // First N entries are generic instantiations arguments.
+ // The rest of the open array are normal pointers (no optional indirection) and may be NULL.
DictionaryEntry m_pEntries[1];
TADDR EntryAddr(ULONG32 idx)
}
public:
- inline DPTR(FixupPointer<TypeHandle>) GetInstantiation()
+ inline DPTR(TypeHandle) GetInstantiation()
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
- return dac_cast<DPTR(FixupPointer<TypeHandle>)>(EntryAddr(0));
+ return dac_cast<DPTR(TypeHandle)>(EntryAddr(0));
}
#ifndef DACCESS_COMPILE
pMT->ClearFlag(MethodTable::enum_flag_GenericsMask);
pMT->SetFlag(MethodTable::enum_flag_GenericsMask_GenericInst);
- pMT->m_pParentMethodTable.SetValueMaybeNull(NULL);
+ pMT->m_pParentMethodTable = NULL;
// Non non-virtual slots
pMT->ClearFlag(MethodTable::enum_flag_HasSingleNonVirtualSlot);
if (canShareVtableChunks)
{
// Share the canonical chunk
- it.SetIndirectionSlot(pOldMT->GetVtableIndirections()[it.GetIndex()].GetValueMaybeNull());
+ it.SetIndirectionSlot(pOldMT->GetVtableIndirections()[it.GetIndex()]);
}
else
{
// dictionary pointers.
Dictionary * pDict = (Dictionary*) (pMemory + cbMT + cbOptional + cbIMap + cbPerInst);
MethodTable::PerInstInfoElem_t *pPInstInfo = (MethodTable::PerInstInfoElem_t *) (pMT->GetPerInstInfo() + (pOldMT->GetNumDicts()-1));
- pPInstInfo->SetValueMaybeNull(pDict);
+ *pPInstInfo = pDict;
// Fill in the instantiation section of the generic dictionary. The remainder of the
// generic dictionary will be zeroed, which is the correct initial state.
if (pLayout != NULL)
{
_ASSERTE(pLayout->GetMaxSlots() > 0);
- PTR_Dictionary pDictionarySlots = pMT->GetPerInstInfo()[pOldMT->GetNumDicts() - 1].GetValue();
+ PTR_Dictionary pDictionarySlots = pMT->GetPerInstInfo()[pOldMT->GetNumDicts() - 1];
DWORD* pSizeSlot = (DWORD*)(pDictionarySlots + ntypars);
*pSizeSlot = cbInstAndDictSlotSize;
}
pMD->m_pszDebugMethodSignature = "<generic method signature>";
pMD->m_pszDebugClassName = "<generic method class name>";
pMD->m_pszDebugMethodName = "<generic method name>";
- pMD->m_pDebugMethodTable.SetValue(pMT);
+ pMD->m_pDebugMethodTable = pMT;
#endif // _DEBUG
return pMD;
S_SIZE_T dwAllocSize = S_SIZE_T(numTyPars) * S_SIZE_T(sizeof(TypeHandle));
// the memory allocated for m_pMethInst will be freed if the declaring type fails to load
- m_pPerInstInfo.SetValue((Dictionary *) pamTracker->Track(pAllocator->GetLowFrequencyHeap()->AllocMem(dwAllocSize)));
+ m_pPerInstInfo = (Dictionary *) pamTracker->Track(pAllocator->GetLowFrequencyHeap()->AllocMem(dwAllocSize));
TypeHandle * pInstDest = (TypeHandle *) IMD_GetMethodDictionaryNonNull();
//_ASSERTE(sharedMD->IMD_IsSharedByGenericMethodInstantiations());
- m_pWrappedMethodDesc.SetValue(wrappedMD);
+ m_pWrappedMethodDesc = wrappedMD;
m_wFlags2 = WrapperStubWithInstantiations | (m_wFlags2 & ~KindMask);
- m_pPerInstInfo.SetValueMaybeNull((Dictionary*)pInst);
+ m_pPerInstInfo = (Dictionary*)pInst;
_ASSERTE(FitsIn<WORD>(numGenericArgs));
m_wNumGenericArgs = static_cast<WORD>(numGenericArgs);
_ASSERTE(numGenericArgs != 0);
// Initially the dictionary layout is empty
m_wFlags2 = SharedMethodInstantiation | (m_wFlags2 & ~KindMask);
- m_pPerInstInfo.SetValueMaybeNull((Dictionary *)pPerInstInfo);
+ m_pPerInstInfo = (Dictionary *)pPerInstInfo;
_ASSERTE(FitsIn<WORD>(numGenericArgs));
m_wNumGenericArgs = static_cast<WORD>(numGenericArgs);
- m_pDictLayout.SetValueMaybeNull(pDL);
+ m_pDictLayout = pDL;
_ASSERTE(IMD_IsSharedByGenericMethodInstantiations());
// The first field is never used
m_wFlags2 = UnsharedMethodInstantiation | (m_wFlags2 & ~KindMask);
- m_pPerInstInfo.SetValueMaybeNull((Dictionary *)pInst);
+ m_pPerInstInfo = (Dictionary *)pInst;
_ASSERTE(FitsIn<WORD>(numGenericArgs));
m_wNumGenericArgs = static_cast<WORD>(numGenericArgs);
{
STANDARD_VM_CONTRACT;
- _ASSERTE(!MethodTable::IsPerInstInfoRelative());
-
PCODE helperAddress = (pLookup->helper == CORINFO_HELP_RUNTIMEHANDLE_METHOD ?
GetEEFuncEntryPoint(JIT_GenericHandleMethodWithSlotAndModule) :
GetEEFuncEntryPoint(JIT_GenericHandleClassWithSlotAndModule));
{
unsigned offsetOfIndirection = MethodTable::GetVtableOffset() + MethodTable::GetIndexOfVtableIndirection(slot) * TARGET_POINTER_SIZE;
unsigned offsetAfterIndirection = MethodTable::GetIndexAfterVtableIndirection(slot) * TARGET_POINTER_SIZE;
- _ASSERTE(MethodTable::VTableIndir_t::isRelative == false /* TODO: NYI */);
VTableCallStub* pStub = stub();
BYTE* p = (BYTE*)pStub->entryPoint();
if (g_pObjectClass == NULL || g_pStringClass == NULL)
goto DelayCallback;
- RelativeFixupPointer<PTR_MethodTable> * ppMT = pMD->GetMethodTablePtr();
- if (ppMT->IsNull())
+ PTR_MethodTable pMT = pMD->GetMethodTable();
+ if (pMT == NULL)
goto DelayCallback;
- TADDR pMaybeTaggedMT = ppMT->GetValueMaybeTagged((TADDR)ppMT);
- if (CORCOMPILE_IS_POINTER_TAGGED(pMaybeTaggedMT))
- goto DelayCallback;
-
- MethodTable *pMT = (MethodTable *)pMaybeTaggedMT;
if (!pMT->IsRestored_NoLogging())
goto DelayCallback;
pMD->SetMemberDef(0);
pMD->SetSlot(MethodTable::NO_SLOT); // we can't ever use the slot for dynamic methods
// the no metadata part of the method desc
- pMD->m_pszMethodName.SetValue((PTR_CUTF8)"IL_STUB");
+ pMD->m_pszMethodName = (PTR_CUTF8)"IL_STUB";
pMD->m_dwExtendedFlags = mdPublic | DynamicMethodDesc::nomdILStub;
pMD->SetTemporaryEntryPoint(pMT->GetLoaderAllocator(), pamTracker);
{
switch(dwStubFlags)
{
- case ILSTUB_ARRAYOP_GET: pMD->m_pszMethodName.SetValue((PTR_CUTF8)"IL_STUB_Array_Get");
+ case ILSTUB_ARRAYOP_GET: pMD->m_pszMethodName = (PTR_CUTF8)"IL_STUB_Array_Get";
break;
- case ILSTUB_ARRAYOP_SET: pMD->m_pszMethodName.SetValue((PTR_CUTF8)"IL_STUB_Array_Set");
+ case ILSTUB_ARRAYOP_SET: pMD->m_pszMethodName = (PTR_CUTF8)"IL_STUB_Array_Set";
break;
- case ILSTUB_ARRAYOP_ADDRESS: pMD->m_pszMethodName.SetValue((PTR_CUTF8)"IL_STUB_Array_Address");
+ case ILSTUB_ARRAYOP_ADDRESS: pMD->m_pszMethodName = (PTR_CUTF8)"IL_STUB_Array_Address";
break;
default: _ASSERTE(!"Unknown array il stub");
}
else
#endif
{
- pMD->m_pszMethodName.SetValue(pMD->GetILStubResolver()->GetStubMethodName());
+ pMD->m_pszMethodName = pMD->GetILStubResolver()->GetStubMethodName();
}
#ifdef _DEBUG
- pMD->m_pszDebugMethodName = RelativePointer<PTR_CUTF8>::GetValueAtPtr(PTR_HOST_MEMBER_TADDR(DynamicMethodDesc, pMD, m_pszMethodName));
+ pMD->m_pszDebugMethodName = pMD->m_pszMethodName;
pMD->m_pszDebugClassName = ILStubResolver::GetStubClassName(pMD); // must be called after type is set
pMD->m_pszDebugMethodSignature = FormatSig(pMD, pCreationHeap, pamTracker);
- pMD->m_pDebugMethodTable.SetValue(pMT);
+ pMD->m_pDebugMethodTable = pMT;
#endif // _DEBUG
RETURN pMD;
}
else
{
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
return GetModule()->GetLoaderAllocator();
}
}
// If the dictionary on the base type got expanded, update the current type's base type dictionary
// pointer to use the new one on the base type.
- Dictionary* pMTDictionary = pMT->GetPerInstInfo()[dictionaryIndex].GetValue();
- Dictionary* pDeclaringMTDictionary = pDeclaringMT->GetPerInstInfo()[dictionaryIndex].GetValue();
+ Dictionary* pMTDictionary = pMT->GetPerInstInfo()[dictionaryIndex];
+ Dictionary* pDeclaringMTDictionary = pDeclaringMT->GetPerInstInfo()[dictionaryIndex];
if (pMTDictionary != pDeclaringMTDictionary)
{
- TypeHandle** pPerInstInfo = (TypeHandle**)pMT->GetPerInstInfo()->GetValuePtr();
+ TypeHandle** pPerInstInfo = (TypeHandle**)pMT->GetPerInstInfo();
FastInterlockExchangePointer(pPerInstInfo + dictionaryIndex, (TypeHandle*)pDeclaringMTDictionary);
}
}
pResult->testForFixup = 0;
pResult->offsets[0] = offsetof(InstantiatedMethodDesc, m_pPerInstInfo);
- if (decltype(InstantiatedMethodDesc::m_pPerInstInfo)::isRelative)
- {
- pResult->indirectFirstOffset = 1;
- }
-
uint32_t data;
IfFailThrow(sigptr.GetData(&data));
pResult->offsets[1] = sizeof(TypeHandle) * data;
IfFailThrow(sigptr.GetData(&data));
pResult->offsets[2] = sizeof(TypeHandle) * data;
- if (MethodTable::IsPerInstInfoRelative())
- {
- pResult->indirectFirstOffset = 1;
- pResult->indirectSecondOffset = 1;
- }
-
return;
}
else if (type == ELEMENT_TYPE_GENERICINST &&
// Indirect through dictionary table pointer in InstantiatedMethodDesc
pResult->offsets[0] = offsetof(InstantiatedMethodDesc, m_pPerInstInfo);
-
- if (decltype(InstantiatedMethodDesc::m_pPerInstInfo)::isRelative)
- {
- pResult->indirectFirstOffset = 1;
- }
}
}
// Next indirect through the dictionary appropriate to this instantiated type
pResult->offsets[1] = sizeof(TypeHandle*) * (pContextMT->GetNumDicts() - 1);
-
- if (MethodTable::IsPerInstInfoRelative())
- {
- pResult->indirectFirstOffset = 1;
- pResult->indirectSecondOffset = 1;
- }
}
}
}
void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd,
unsigned * pOffsetOfIndirection,
unsigned * pOffsetAfterIndirection,
- bool * isRelative)
+ bool * isRelative)
{
CONTRACTL {
NOTHROW;
*pOffsetOfIndirection = MethodTable::GetVtableOffset() + MethodTable::GetIndexOfVtableIndirection(method->GetSlot()) * TARGET_POINTER_SIZE /* sizeof(MethodTable::VTableIndir_t) */;
*pOffsetAfterIndirection = MethodTable::GetIndexAfterVtableIndirection(method->GetSlot()) * TARGET_POINTER_SIZE /* sizeof(MethodTable::VTableIndir2_t) */;
- *isRelative = MethodTable::VTableIndir_t::isRelative ? 1 : 0;
- _ASSERTE(MethodTable::VTableIndir_t::isRelative == MethodTable::VTableIndir2_t::isRelative);
+ *isRelative = false;
EE_TO_JIT_TRANSITION_LEAF();
}
ret = (void *)ftn->GetAddrOfSlot();
- if (MethodTable::VTableIndir2_t::isRelative
- && ftn->IsVtableSlot())
- {
- accessType = IAT_RELPVALUE;
- }
- else
- {
- accessType = IAT_PVALUE;
- }
+ accessType = IAT_PVALUE;
}
return GetMethodTable_NoLogging()->GetSlot(GetSlot());
}
-TADDR MethodDesc::GetAddrOfSlot()
+PTR_PCODE MethodDesc::GetAddrOfSlot()
{
CONTRACTL
{
{
SIZE_T size = GetBaseSize();
- return dac_cast<TADDR>(this) + size;
+ return PTR_PCODE(dac_cast<TADDR>(this) + size);
}
_ASSERTE(GetMethodTable()->IsCanonicalMethodTable());
{
// When profiler is enabled, profiler may ask to rejit a code even though we
// we have ngen code for this MethodDesc. (See MethodDesc::DoPrestub).
- // This means that NativeCodeSlot::GetValueMaybeNullAtPtr(GetAddrOfNativeCodeSlot())
+ // This means that *GetAddrOfNativeCodeSlot()
// is not stable. It can turn from non-zero to zero.
- PCODE pCode = PCODE(NativeCodeSlot::GetValueMaybeNullAtPtr(GetAddrOfNativeCodeSlot()) & ~FIXUP_LIST_MASK);
+ PCODE pCode = *GetAddrOfNativeCodeSlot();
#ifdef TARGET_ARM
if (pCode != NULL)
pCode |= THUMB_CODE;
}
//*******************************************************************************
-TADDR MethodDesc::GetAddrOfNativeCodeSlot()
+PTR_PCODE MethodDesc::GetAddrOfNativeCodeSlot()
{
WRAPPER_NO_CONTRACT;
SIZE_T size = s_ClassificationSizeTable[m_wFlags & (mdcClassification | mdcHasNonVtableSlot | mdcMethodImpl)];
- return dac_cast<TADDR>(this) + size;
+ return (PTR_PCODE)(dac_cast<TADDR>(this) + size);
}
//*******************************************************************************
pMD = (MethodDesc *)((BYTE *)pMD + oneSize);
}
- pChunk->m_next.SetValueMaybeNull(pFirstChunk);
+ pChunk->m_next = pFirstChunk;
pFirstChunk = pChunk;
methodDescCount -= count;
InterlockedUpdateFlags2(enum_flag2_HasStableEntryPoint | enum_flag2_HasPrecode, FALSE);
- TADDR slot = GetAddrOfSlot();
- if (IsVtableSlot())
- {
- ((MethodTable::VTableIndir2_t *) slot)->SetValue(GetTemporaryEntryPoint());
- }
- else
- {
- *((PCODE *) slot) = GetTemporaryEntryPoint();
- }
+ *GetAddrOfSlot() = GetTemporaryEntryPoint();
}
if (HasNativeCodeSlot())
{
- RelativePointer<TADDR> *pRelPtr = (RelativePointer<TADDR> *)GetAddrOfNativeCodeSlot();
- pRelPtr->SetValueMaybeNull(NULL);
+ *GetAddrOfNativeCodeSlot() = NULL;
}
_ASSERTE(!HasNativeCode());
}
GetMethodDescChunk()->EnsureTemporaryEntryPointsCreated(pLoaderAllocator, pamTracker);
- TADDR slot = GetAddrOfSlot();
- if (IsVtableSlot())
- {
- MethodTable::VTableIndir2_t *slotPtr = ((MethodTable::VTableIndir2_t *) slot);
- _ASSERTE(slotPtr->IsNull());
- slotPtr->SetValue(GetTemporaryEntryPoint());
- }
- else
- {
- PCODE *slotPtr = (PCODE *) slot;
- _ASSERTE(*slotPtr == NULL);
- *slotPtr = GetTemporaryEntryPoint();
- }
+ PTR_PCODE pSlot = GetAddrOfSlot();
+ _ASSERTE(*pSlot == NULL);
+ *pSlot = GetTemporaryEntryPoint();
if (RequiresStableEntryPoint())
{
return GetPrecode();
}
- TADDR pSlot = GetAddrOfSlot();
+ PTR_PCODE pSlot = GetAddrOfSlot();
PCODE tempEntry = GetTemporaryEntryPoint();
PrecodeType requiredType = GetPrecodeType();
AllocMemTracker amt;
Precode* pPrecode = Precode::Allocate(requiredType, this, GetLoaderAllocator(), &amt);
- PCODE newVal;
- PCODE oldVal;
- TADDR *slotAddr;
- if (IsVtableSlot())
- {
- newVal = MethodTable::VTableIndir2_t::GetRelative(pSlot, pPrecode->GetEntryPoint());
- oldVal = MethodTable::VTableIndir2_t::GetRelative(pSlot, tempEntry);
- slotAddr = (TADDR *) (MethodTable::VTableIndir2_t *) pSlot;
- }
- else
- {
- newVal = pPrecode->GetEntryPoint();
- oldVal = tempEntry;
- slotAddr = (TADDR *) (PCODE *) pSlot;
- }
- if (FastInterlockCompareExchangePointer(slotAddr, (TADDR) newVal, (TADDR) oldVal) == oldVal)
+ if (FastInterlockCompareExchangePointer(pSlot, pPrecode->GetEntryPoint(), tempEntry) == tempEntry)
amt.SuppressRelease();
}
// Set the flags atomically
InterlockedUpdateFlags2(enum_flag2_HasStableEntryPoint | enum_flag2_HasPrecode, TRUE);
- PCODE addr;
- if (IsVtableSlot())
- {
- addr = ((MethodTable::VTableIndir2_t *)pSlot)->GetValue();
- }
- else
- {
- addr = *((PCODE *)pSlot);
- }
- return Precode::GetPrecodeFromEntryPoint(addr);
+ return Precode::GetPrecodeFromEntryPoint(*pSlot);
}
bool MethodDesc::DetermineAndSetIsEligibleForTieredCompilation()
if (HasNativeCodeSlot())
{
- RelativePointer<TADDR> *pRelPtr = (RelativePointer<TADDR> *)GetAddrOfNativeCodeSlot();
- pRelPtr->SetValueMaybeNull(NULL);
+ *GetAddrOfNativeCodeSlot() = NULL;
}
}
}
#endif
- TADDR pSlot = GetAddrOfNativeCodeSlot();
- NativeCodeSlot value, expected;
+ PTR_PCODE pSlot = GetAddrOfNativeCodeSlot();
+ NativeCodeSlot expected;
- value.SetValueMaybeNull(pSlot, addr | (*dac_cast<PTR_TADDR>(pSlot) & FIXUP_LIST_MASK));
- expected.SetValueMaybeNull(pSlot, pExpected | (*dac_cast<PTR_TADDR>(pSlot) & FIXUP_LIST_MASK));
+ expected = *pSlot;
return FastInterlockCompareExchangePointer(reinterpret_cast<TADDR*>(pSlot),
- (TADDR&)value, (TADDR&)expected) == (TADDR&)expected;
+ (TADDR&)addr, (TADDR&)expected) == (TADDR&)expected;
}
_ASSERTE(pExpected == NULL);
// synchronized. Currently, the only caller synchronizes with the following lock.
_ASSERTE(MethodDescBackpatchInfoTracker::IsLockOwnedByCurrentThread());
- TADDR pSlot = GetAddrOfSlot();
-
- TADDR *slotAddr;
- PCODE newVal;
-
- if (IsVtableSlot())
- {
- newVal = MethodTable::VTableIndir2_t::GetRelative(pSlot, addr);
- slotAddr = (TADDR *) (MethodTable::VTableIndir2_t *) pSlot;
- }
- else
- {
- newVal = addr;
- slotAddr = (TADDR *) (PCODE *) pSlot;
- }
-
- *(TADDR *)slotAddr = newVal;
+ *GetAddrOfSlot() = addr;
}
_ASSERTE(!IsVersionable());
PCODE pExpected = GetTemporaryEntryPoint();
- TADDR pSlot = GetAddrOfSlot();
-
- BOOL fResult;
-
- TADDR *slotAddr;
- PCODE newVal;
- PCODE oldVal;
-
- if (IsVtableSlot())
- {
- newVal = MethodTable::VTableIndir2_t::GetRelative(pSlot, addr);
- oldVal = MethodTable::VTableIndir2_t::GetRelative(pSlot, pExpected);
- slotAddr = (TADDR *) (MethodTable::VTableIndir2_t *) pSlot;
- }
- else
- {
- newVal = addr;
- oldVal = pExpected;
- slotAddr = (TADDR *) (PCODE *) pSlot;
- }
+ PTR_PCODE pSlot = GetAddrOfSlot();
- fResult = FastInterlockCompareExchangePointer(slotAddr, (TADDR) newVal, (TADDR) oldVal) == oldVal;
+ BOOL fResult = FastInterlockCompareExchangePointer(pSlot, addr, pExpected) == pExpected;
InterlockedUpdateFlags2(enum_flag2_HasStableEntryPoint, TRUE);
#include "eeconfig.h"
#include "precode.h"
-#include "fixuppointer.h"
-
class Stub;
class FCallMethodDesc;
class FieldDesc;
LPCUTF8 m_pszDebugMethodName;
LPCUTF8 m_pszDebugClassName;
LPCUTF8 m_pszDebugMethodSignature;
- FixupPointer<PTR_MethodTable> m_pDebugMethodTable;
+ PTR_MethodTable m_pDebugMethodTable;
PTR_GCCoverageInfo m_GcCover;
inline PTR_MethodTable GetMethodTable() const;
inline PTR_MethodTable GetMethodTable_NoLogging() const;
- inline DPTR(RelativeFixupPointer<PTR_MethodTable>) GetMethodTablePtr() const;
+ inline DPTR(PTR_MethodTable) GetMethodTablePtr() const;
public:
inline MethodDescChunk* GetMethodDescChunk() const;
return IsVirtualSlot() && !HasNonVtableSlot();
}
- TADDR GetAddrOfSlot();
+ PTR_PCODE GetAddrOfSlot();
PTR_MethodDesc GetDeclMethodDesc(UINT32 slotNumber);
BOOL SetNativeCodeInterlocked(PCODE addr, PCODE pExpected = NULL);
- TADDR GetAddrOfNativeCodeSlot();
+ PTR_PCODE GetAddrOfNativeCodeSlot();
BOOL MayHaveNativeCode();
// class MethodImpl; // Present if HasMethodImplSlot() is true
- typedef RelativePointer<PCODE> NonVtableSlot; // Present if HasNonVtableSlot() is true
- // RelativePointer for NGen, PCODE for JIT
-
-#define FIXUP_LIST_MASK 1
- typedef RelativePointer<TADDR> NativeCodeSlot; // Present if HasNativeCodeSlot() is true
- // lower order bit (FIXUP_LIST_MASK) used to determine if FixupListSlot is present
- typedef RelativePointer<TADDR> FixupListSlot;
+ typedef PCODE NonVtableSlot; // Present if HasNonVtableSlot() is true
+ typedef PCODE NativeCodeSlot; // Present if HasNativeCodeSlot() is true
// Stub Dispatch code
public:
FORCEINLINE PTR_MethodTable GetMethodTable()
{
LIMITED_METHOD_DAC_CONTRACT;
- return m_methodTable.GetValue(PTR_HOST_MEMBER_TADDR(MethodDescChunk, this, m_methodTable));
+ return m_methodTable;
}
- inline DPTR(RelativeFixupPointer<PTR_MethodTable>) GetMethodTablePtr() const
+ inline DPTR(PTR_MethodTable) GetMethodTablePtr() const
{
LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(RelativeFixupPointer<PTR_MethodTable>)>(PTR_HOST_MEMBER_TADDR(MethodDescChunk, this, m_methodTable));
+ return dac_cast<DPTR(PTR_MethodTable)>(PTR_HOST_MEMBER_TADDR(MethodDescChunk, this, m_methodTable));
}
#ifndef DACCESS_COMPILE
inline void SetMethodTable(MethodTable * pMT)
{
LIMITED_METHOD_CONTRACT;
- _ASSERTE(m_methodTable.IsNull());
+ _ASSERTE(m_methodTable == NULL);
_ASSERTE(pMT != NULL);
- m_methodTable.SetValue(pMT);
+ m_methodTable = pMT;
}
inline void SetSizeAndCount(ULONG sizeOfMethodDescs, COUNT_T methodDescCount)
void SetNextChunk(MethodDescChunk *chunk)
{
LIMITED_METHOD_CONTRACT;
- m_next.SetValueMaybeNull(chunk);
+ m_next = chunk;
}
#endif // !DACCESS_COMPILE
PTR_MethodDescChunk GetNextChunk()
{
LIMITED_METHOD_CONTRACT;
- return m_next.GetValueMaybeNull(PTR_HOST_MEMBER_TADDR(MethodDescChunk, this, m_next));
+ return m_next;
}
UINT32 GetCount()
m_flagsAndTokenRange = (m_flagsAndTokenRange & ~enum_flag_TokenRangeMask) | tokenRange;
}
- RelativeFixupPointer<PTR_MethodTable> m_methodTable;
+ PTR_MethodTable m_methodTable;
- RelativePointer<PTR_MethodDescChunk> m_next;
+ PTR_MethodDescChunk m_next;
BYTE m_size; // The size of this chunk minus 1 (in multiples of MethodDesc::ALIGNMENT)
BYTE m_count; // The number of MethodDescs in this chunk minus 1
// Put the sig RVA in here - this allows us to avoid
// touching the method desc table when CoreLib is prejitted.
- RelativePointer<TADDR> m_pSig;
+ TADDR m_pSig;
DWORD m_cSig;
#ifdef TARGET_64BIT
// m_dwExtendedFlags is not used by StoredSigMethodDesc itself.
TADDR GetSigRVA()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<TADDR>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(StoredSigMethodDesc, this, m_pSig));
+ return m_pSig;
}
bool HasStoredMethodSig(void)
{
LIMITED_METHOD_DAC_CONTRACT;
- return !m_pSig.IsNull();
+ return m_pSig != NULL;
}
PCCOR_SIGNATURE GetStoredMethodSig(DWORD* sigLen = NULL)
{
DacInstantiateTypeByAddress(GetSigRVA(), m_cSig, true);
#else // !DACCESS_COMPILE
g_IBCLogger.LogNDirectCodeAccess(this);
- return (PCCOR_SIGNATURE) m_pSig.GetValueMaybeNull();
+ return (PCCOR_SIGNATURE) m_pSig;
#endif // !DACCESS_COMPILE
}
void SetStoredMethodSig(PCCOR_SIGNATURE sig, DWORD sigBytes)
{
#ifndef DACCESS_COMPILE
- m_pSig.SetValueMaybeNull((TADDR)sig);
+ m_pSig = (TADDR)sig;
m_cSig = sigBytes;
#endif // !DACCESS_COMPILE
}
#endif
protected:
- RelativePointer<PTR_CUTF8> m_pszMethodName;
+ PTR_CUTF8 m_pszMethodName;
PTR_DynamicResolver m_pResolver;
#ifndef TARGET_64BIT
PTR_CUTF8 GetMethodName()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<PTR_CUTF8>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(DynamicMethodDesc, this, m_pszMethodName));
+ return m_pszMethodName;
}
WORD GetAttrs()
LPVOID m_pNativeNDirectTarget;
// Information about the entrypoint
- RelativePointer<PTR_CUTF8> m_pszEntrypointName;
+ PTR_CUTF8 m_pszEntrypointName;
union
{
- RelativePointer<PTR_CUTF8> m_pszLibName;
+ PTR_CUTF8 m_pszLibName;
DWORD m_dwECallID; // ECallID for QCalls
};
// The writeable part of the methoddesc.
- PlainPointer<PTR_NDirectWriteableData> m_pWriteableData;
+ PTR_NDirectWriteableData m_pWriteableData;
#ifdef HAS_NDIRECT_IMPORT_PRECODE
- RelativePointer<PTR_NDirectImportThunkGlue> m_pImportThunkGlue;
+ PTR_NDirectImportThunkGlue m_pImportThunkGlue;
#else // HAS_NDIRECT_IMPORT_PRECODE
NDirectImportThunkGlue m_ImportThunkGlue;
#endif // HAS_NDIRECT_IMPORT_PRECODE
#endif // defined(TARGET_X86)
// This field gets set only when this MethodDesc is marked as PreImplemented
- RelativePointer<PTR_MethodDesc> m_pStubMD;
+ PTR_MethodDesc m_pStubMD;
} ndirect;
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<PTR_CUTF8>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(NDirectMethodDesc, this, ndirect.m_pszLibName));
+ return ndirect.m_pszLibName;
}
#ifndef DACCESS_COMPILE
{
LIMITED_METHOD_CONTRACT;
- return IsQCall() ? "QCall" : ndirect.m_pszLibName.GetValueMaybeNull();
+ return IsQCall() ? "QCall" : ndirect.m_pszLibName;
}
#endif // !DACCESS_COMPILE
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<PTR_CUTF8>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(NDirectMethodDesc, this, ndirect.m_pszEntrypointName));
+ return ndirect.m_pszEntrypointName;
}
BOOL IsVarArgs() const
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointer(this, &NDirectMethodDesc::ndirect, &decltype(NDirectMethodDesc::ndirect)::m_pWriteableData);
+ return ndirect.m_pWriteableData;
}
PTR_NDirectImportThunkGlue GetNDirectImportThunkGlue()
{
LIMITED_METHOD_DAC_CONTRACT;
- TADDR base = PTR_HOST_MEMBER_TADDR(NDirectMethodDesc, this, ndirect.m_pImportThunkGlue);
-
-#ifdef HAS_NDIRECT_IMPORT_PRECODE
- return RelativePointer<PTR_NDirectImportThunkGlue>::GetValueAtPtr(base);
-#else
- return dac_cast<PTR_NDirectImportThunkGlue>(base);
-#endif
+ return ndirect.m_pImportThunkGlue;
}
LPVOID GetNDirectTarget()
#endif // TARGET_X86
// This field gets set only when this MethodDesc is marked as PreImplemented
- RelativePointer<PTR_MethodDesc> m_pStubMD;
+ PTR_MethodDesc m_pStubMD;
};
if (IMD_IsGenericMethodDefinition())
return TRUE;
else
- return !m_pPerInstInfo.IsNull();
+ return m_pPerInstInfo != NULL;
}
// All varieties of InstantiatedMethodDesc's support this method.
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointerMaybeNull(this, &InstantiatedMethodDesc::m_pPerInstInfo);
+ return m_pPerInstInfo;
}
PTR_Dictionary IMD_GetMethodDictionaryNonNull()
{
LIMITED_METHOD_DAC_CONTRACT;
+ _ASSERTE(m_pPerInstInfo != NULL);
- return ReadPointer(this, &InstantiatedMethodDesc::m_pPerInstInfo);
+ return m_pPerInstInfo;
}
BOOL IMD_IsGenericMethodDefinition()
PTR_DictionaryLayout GetDictLayoutRaw()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<PTR_DictionaryLayout>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(InstantiatedMethodDesc, this, m_pDictLayout));
+ return m_pDictLayout;
}
PTR_MethodDesc IMD_GetWrappedMethodDesc()
LIMITED_METHOD_DAC_CONTRACT;
_ASSERTE(IMD_IsWrapperStubWithInstantiations());
- return RelativeFixupPointer<PTR_MethodDesc>::GetValueAtPtr(PTR_HOST_MEMBER_TADDR(InstantiatedMethodDesc, this, m_pWrappedMethodDesc));
+ return m_pWrappedMethodDesc;
}
#ifndef DACCESS_COMPILE
if (IMD_IsWrapperStubWithInstantiations() && IMD_HasMethodInstantiation())
{
InstantiatedMethodDesc* pIMD = IMD_GetWrappedMethodDesc()->AsInstantiatedMethodDesc();
- return pIMD->m_pDictLayout.GetValueMaybeNull();
+ return pIMD->m_pDictLayout;
}
else if (IMD_IsSharedByGenericMethodInstantiations())
- return m_pDictLayout.GetValueMaybeNull();
+ return m_pDictLayout;
else
return NULL;
}
if (IMD_IsWrapperStubWithInstantiations() && IMD_HasMethodInstantiation())
{
InstantiatedMethodDesc* pIMD = IMD_GetWrappedMethodDesc()->AsInstantiatedMethodDesc();
- pIMD->m_pDictLayout.SetValueMaybeNull(pNewLayout);
+ pIMD->m_pDictLayout = pNewLayout;
}
else if (IMD_IsSharedByGenericMethodInstantiations())
{
- m_pDictLayout.SetValueMaybeNull(pNewLayout);
+ m_pDictLayout = pNewLayout;
}
}
#endif // !DACCESS_COMPILE
friend class MethodDesc; // this fields are currently accessed by MethodDesc::Save/Restore etc.
union {
- RelativePointer<PTR_DictionaryLayout> m_pDictLayout; //SharedMethodInstantiation
+ PTR_DictionaryLayout m_pDictLayout; //SharedMethodInstantiation
- RelativeFixupPointer<PTR_MethodDesc> m_pWrappedMethodDesc; // For WrapperStubWithInstantiations
+ PTR_MethodDesc m_pWrappedMethodDesc; // For WrapperStubWithInstantiations
};
public: // <TODO>make private: JITinterface.cpp accesses through this </TODO>
//
// For generic method definitions that are not the typical method definition (e.g. C<int>.m<U>)
// this field is null; to obtain the instantiation use LoadMethodInstantiation
- PlainPointer<PTR_Dictionary> m_pPerInstInfo; //SHARED
+ PTR_Dictionary m_pPerInstInfo; //SHARED
private:
WORD m_wFlags2;
return GetMethodTable_NoLogging();
}
-inline DPTR(RelativeFixupPointer<PTR_MethodTable>) MethodDesc::GetMethodTablePtr() const
+inline DPTR(PTR_MethodTable) MethodDesc::GetMethodTablePtr() const
{
LIMITED_METHOD_DAC_CONTRACT;
{
// If it looks good, do a more intensive sanity test. We don't care about the result,
// we just want it to not AV.
- return GetMethodTable() == m_pDebugMethodTable.GetValue() && this->GetModule() != NULL;
+ return GetMethodTable() == m_pDebugMethodTable && this->GetModule() != NULL;
}
return TRUE;
break;
case SlotType_Vtable:
- ((MethodTable::VTableIndir2_t *)slot)->SetValue(entryPoint);
+ *((MethodTable::VTableIndir2_t *)slot) = entryPoint;
break;
case SlotType_Executable:
}
CONTRACTL_END
- DPTR(RelativePointer<PTR_MethodDesc>) pRelPtrForSlot = GetImpMDsNonNull();
+ DPTR(PTR_MethodDesc) pRelPtrForSlot = GetImpMDsNonNull();
// The method descs are not offset by one
- TADDR base = dac_cast<TADDR>(pRelPtrForSlot) + slotIndex * sizeof(RelativePointer<MethodDesc *>);
- PTR_MethodDesc result = RelativePointer<PTR_MethodDesc>::GetValueMaybeNullAtPtr(base);
+ TADDR base = dac_cast<TADDR>(pRelPtrForSlot) + slotIndex * sizeof(MethodDesc *);
+ PTR_MethodDesc result = *dac_cast<DPTR(PTR_MethodDesc)>(base);
// Prejitted images may leave NULL in this table if
// the methoddesc is declared in another module.
NOTHROW;
GC_NOTRIGGER;
FORBID_FAULT;
- PRECONDITION(!pdwSlots.IsNull());
+ PRECONDITION(pdwSlots != NULL);
}
CONTRACTL_END
MethodDesc *result;
- PREFIX_ASSUME(!pdwSlots.IsNull());
+ PREFIX_ASSUME(pdwSlots != NULL);
DWORD slot = GetSlots()[index];
// Since the overridden method is in a different module, we
_ASSERTE(result != NULL);
- pImplementedMD.GetValue()[index].SetValue(result);
+ pImplementedMD[index] = result;
return result;
}
THROWS;
GC_NOTRIGGER;
PRECONDITION(CheckPointer(this));
- PRECONDITION(pdwSlots.GetValueMaybeNull()==NULL && pImplementedMD.GetValueMaybeNull()==NULL);
+ PRECONDITION(pdwSlots==NULL && pImplementedMD==NULL);
INJECT_FAULT(ThrowOutOfMemory());
} CONTRACTL_END;
S_SIZE_T(size) * S_SIZE_T(sizeof(mdToken)); // Token each for the method tokens
// MethodDesc* for each of the implemented methods
- S_SIZE_T cbMethodDescs = S_SIZE_T(size) * S_SIZE_T(sizeof(RelativePointer<MethodDesc *>));
+ S_SIZE_T cbMethodDescs = S_SIZE_T(size) * S_SIZE_T(sizeof(MethodDesc *));
// Need to align-up the slot entries so that the MethodDesc* array starts on a pointer boundary.
cbCountAndSlots.AlignUp(sizeof(MethodDesc*));
LPBYTE pAllocData = (BYTE*)pamTracker->Track(pHeap->AllocMem(cbTotal));
// Set the count and slot array
- pdwSlots.SetValue((DWORD*)pAllocData);
+ pdwSlots = (DWORD*)pAllocData;
// Set the MethodDesc* array. Make sure to adjust for alignment.
- pImplementedMD.SetValue((RelativePointer<MethodDesc*> *)ALIGN_UP(pAllocData + cbCountAndSlots.Value(), sizeof(RelativePointer <MethodDesc*>)));
+ pImplementedMD = (MethodDesc**)ALIGN_UP(pAllocData + cbCountAndSlots.Value(), sizeof(MethodDesc*));
// Store the count in the first entry
- *pdwSlots.GetValue() = size;
+ *pdwSlots = size;
}
}
///////////////////////////////////////////////////////////////////////////////////////
-void MethodImpl::SetData(DWORD* slots, mdToken* tokens, RelativePointer<MethodDesc*>* md)
+void MethodImpl::SetData(DWORD* slots, mdToken* tokens, MethodDesc** md)
{
CONTRACTL {
NOTHROW;
GC_NOTRIGGER;
PRECONDITION(CheckPointer(this));
- PRECONDITION(!pdwSlots.IsNull());
+ PRECONDITION(pdwSlots != NULL);
} CONTRACTL_END;
- DWORD *pdwSize = pdwSlots.GetValue();
+ DWORD *pdwSize = pdwSlots;
DWORD dwSize = *pdwSize;
memcpy(&(pdwSize[1]), slots, dwSize*sizeof(DWORD));
// Copy tokens that correspond to the slots above
memcpy(&(pdwSize[1 + dwSize]), tokens, dwSize*sizeof(mdToken));
- RelativePointer<MethodDesc *> *pImplMD = pImplementedMD.GetValue();
+ MethodDesc **pImplMD = pImplementedMD;
for (uint32_t i = 0; i < dwSize; ++i)
{
- pImplMD[i].SetValue(md[i].GetValue());
+ pImplMD[i] = md[i];
}
}
if (GetImpMDs().IsValid())
{
DacEnumMemoryRegion(dac_cast<TADDR>(GetImpMDsNonNull()),
- numSlots * sizeof(RelativePointer<MethodDesc *>));
+ numSlots * sizeof(MethodDesc *));
for (DWORD i = 0; i < numSlots; i++)
{
- DPTR(RelativePointer<PTR_MethodDesc>) pRelPtr = GetImpMDsNonNull();
- PTR_MethodDesc methodDesc = pRelPtr[i].GetValueMaybeNull();
+ DPTR(PTR_MethodDesc) pRelPtr = GetImpMDsNonNull();
+ PTR_MethodDesc methodDesc = pRelPtr[i];
if (methodDesc.IsValid())
{
methodDesc->EnumMemoryRegions(flags);
friend class NativeImageDumper;
#endif
- RelativePointer<PTR_DWORD> pdwSlots; // Maintains the slots and tokens in sorted order, the first entry is the size
- RelativePointer<DPTR( RelativePointer<PTR_MethodDesc> )> pImplementedMD;
+ PTR_DWORD pdwSlots; // Maintains the slots and tokens in sorted order, the first entry is the size
+ DPTR( PTR_MethodDesc ) pImplementedMD;
public:
};
#endif // !DACCESS_COMPILE
- inline DPTR(RelativePointer<PTR_MethodDesc>) GetImpMDs()
+ inline DPTR(PTR_MethodDesc) GetImpMDs()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<DPTR(RelativePointer<PTR_MethodDesc>)>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(MethodImpl, this, pImplementedMD));
+ return pImplementedMD;
}
- inline DPTR(RelativePointer<PTR_MethodDesc>) GetImpMDsNonNull()
+ inline DPTR(PTR_MethodDesc) GetImpMDsNonNull()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<DPTR(RelativePointer<PTR_MethodDesc>)>::GetValueAtPtr(PTR_HOST_MEMBER_TADDR(MethodImpl, this, pImplementedMD));
+ _ASSERTE(pImplementedMD != NULL);
+ return pImplementedMD;
}
///////////////////////////////////////////////////////////////////////////////////////
PRECONDITION(CheckPointer(this));
} CONTRACTL_END;
- if(pdwSlots.IsNull())
+ if(pdwSlots == NULL)
return 0;
else
return *GetSlotsRawNonNull();
SUPPORTS_DAC;
} CONTRACTL_END;
- if(pdwSlots.IsNull())
+ if(pdwSlots == NULL)
return NULL;
else
return GetSlotsRawNonNull() + 1;
inline PTR_DWORD GetSlotsRaw()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<PTR_DWORD>::GetValueMaybeNullAtPtr(PTR_HOST_MEMBER_TADDR(MethodImpl, this, pdwSlots));
+ return pdwSlots;
}
inline PTR_DWORD GetSlotsRawNonNull()
{
LIMITED_METHOD_DAC_CONTRACT;
- return RelativePointer<PTR_DWORD>::GetValueAtPtr(PTR_HOST_MEMBER_TADDR(MethodImpl, this, pdwSlots));
+ _ASSERTE(pdwSlots);
+ return pdwSlots;
}
#ifndef DACCESS_COMPILE
SUPPORTS_DAC;
} CONTRACTL_END;
- if (pdwSlots.IsNull())
+ if (pdwSlots == NULL)
return NULL;
else
return (mdToken*)(GetSlotsRawNonNull() + 1 + *GetSlotsRawNonNull());
void SetSize(LoaderHeap *pHeap, AllocMemTracker *pamTracker, DWORD size);
///////////////////////////////////////////////////////////////////////////////////////
- void SetData(DWORD* slots, mdToken* tokens, RelativePointer<MethodDesc*> * md);
+ void SetData(DWORD* slots, mdToken* tokens, MethodDesc** md);
#endif // !DACCESS_COMPILE
return pMTForModule->GetLoaderModule();
TADDR pSlot = pMTForModule->GetMultipurposeSlotPtr(enum_flag_HasModuleOverride, c_ModuleOverrideOffsets);
- return RelativeFixupPointer<PTR_Module>::GetValueAtPtr(pSlot);
+ return *dac_cast<DPTR(PTR_Module)>(pSlot);
}
//==========================================================================================
return pMTForModule->GetLoaderModule();
TADDR pSlot = pMTForModule->GetMultipurposeSlotPtr(enum_flag_HasModuleOverride, c_ModuleOverrideOffsets);
- return RelativeFixupPointer<PTR_Module>::GetValueAtPtr(pSlot);
+ return *dac_cast<DPTR(PTR_Module)>(pSlot);
}
//==========================================================================================
g_IBCLogger.LogDispatchMapAccess(pMT);
TADDR pSlot = pMT->GetMultipurposeSlotPtr(enum_flag_HasDispatchMapSlot, c_DispatchMapSlotOffsets);
- return RelativePointer<PTR_DispatchMap>::GetValueAtPtr(pSlot);
+ return *dac_cast<DPTR(PTR_DispatchMap)>(pSlot);
}
//==========================================================================================
if (HasModuleOverride())
{
- GetModuleOverridePtr()->SetValue(pModule);
+ *GetModuleOverridePtr() = pModule;
}
_ASSERTE(GetModule() == pModule);
m_wNumInterfaces = wNumInterfaces;
CONSISTENCY_CHECK(IS_ALIGNED(iMap, sizeof(void*)));
- m_pInterfaceMap.SetValue(iMap);
+ m_pInterfaceMap = iMap;
}
//==========================================================================================
*(((DWORD_PTR *)pNewItfMap) - 1) = NumDynAddedInterfaces + 1;
// Switch the old interface map with the new one.
- m_pInterfaceMap.SetValueVolatile(pNewItfMap);
+ VolatileStore(&m_pInterfaceMap, pNewItfMap);
// Log the fact that we leaked the interface vtable map.
#ifdef _DEBUG
pInfo->m_DynamicTypeID = (SIZE_T)-1;
}
- pInfo->m_pFieldDescs.SetValueMaybeNull(pStaticFieldDescs);
+ pInfo->m_pFieldDescs = pStaticFieldDescs;
}
#endif // !DACCESS_COMPILE
{
// The instantiation for this class is stored in the type slots table
// *after* any inherited slots
- TADDR base = dac_cast<TADDR>(&(GetPerInstInfo()[GetNumDicts()-1]));
- return PerInstInfoElem_t::GetValueMaybeNullAtPtr(base);
+ return GetPerInstInfo()[GetNumDicts()-1];
}
else
{
if (HasInstantiation())
{
PTR_GenericsDictInfo pDictInfo = GetGenericsDictInfo();
- TADDR base = dac_cast<TADDR>(&(GetPerInstInfo()[pDictInfo->m_wNumDicts-1]));
- return Instantiation(PerInstInfoElem_t::GetValueMaybeNullAtPtr(base)->GetInstantiation(), pDictInfo->m_wNumTyPars);
+ return Instantiation(GetPerInstInfo()[pDictInfo->m_wNumDicts-1]->GetInstantiation(), pDictInfo->m_wNumTyPars);
}
else
{
GC_NOTRIGGER;
NOTHROW;
POSTCONDITION(CheckPointer(RETVAL, NULL_NOT_OK));
- POSTCONDITION(RETVAL->m_pDebugMethodTable.IsNull() || // We must be in BuildMethdTableThrowing()
+ POSTCONDITION(RETVAL->m_pDebugMethodTable == NULL || // We must be in BuildMethdTableThrowing()
RETVAL->SanityCheck());
}
CONTRACT_END;
// strings have component size2, all other non-arrays should have 0
_ASSERTE((GetComponentSize() <= 2) || IsArray());
- if (m_pEEClass.IsNull())
+ if (m_pEEClass == NULL)
{
return FALSE;
}
if (!GetWriteableData_NoLogging()->IsParentMethodTablePointerValid())
return FALSE;
- return !IsParentMethodTableTagged(dac_cast<PTR_MethodTable>(this));
+ return TRUE;
}
#endif
DacEnumMemoryRegion(dac_cast<TADDR>(it.GetIndirectionSlot()), it.GetSize());
}
- PTR_MethodTableWriteableData pWriteableData = ReadPointer(this, &MethodTable::m_pWriteableData);
+ PTR_MethodTableWriteableData pWriteableData = m_pWriteableData;
if (pWriteableData.IsValid())
{
pWriteableData.EnumMem();
if (!IsCanonicalMethodTable())
{
- if (GetVtableIndirections()[indirectionIndex].GetValueMaybeNull() == GetCanonicalMethodTable()->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull())
+ if (GetVtableIndirections()[indirectionIndex] == GetCanonicalMethodTable()->GetVtableIndirections()[indirectionIndex])
fSharedVtableChunk = TRUE;
}
if (slotNumber < GetNumParentVirtuals())
{
- if (GetVtableIndirections()[indirectionIndex].GetValueMaybeNull() == GetParentMethodTable()->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull())
+ if (GetVtableIndirections()[indirectionIndex] == GetParentMethodTable()->GetVtableIndirections()[indirectionIndex])
fSharedVtableChunk = TRUE;
}
_ASSERTE(IsThumbCode(slotCode));
#endif
- TADDR slot = GetSlotPtrRaw(slotNumber);
- if (slotNumber < GetNumVirtuals())
- {
- ((MethodTable::VTableIndir2_t *) slot)->SetValueMaybeNull(slotCode);
- }
- else
- {
- *((PCODE *)slot) = slotCode;
- }
+ *GetSlotPtrRaw(slotNumber) = slotCode;
}
//==========================================================================================
ASSERT_AND_CHECK(SanityCheck());
#ifdef _DEBUG
- ASSERT_AND_CHECK(!m_pWriteableData.IsNull());
+ ASSERT_AND_CHECK(m_pWriteableData != NULL);
- MethodTableWriteableData *pWriteableData = m_pWriteableData.GetValue();
+ MethodTableWriteableData *pWriteableData = m_pWriteableData;
DWORD dwLastVerifiedGCCnt = pWriteableData->m_dwLastVerifedGCCnt;
// Here we used to assert that (dwLastVerifiedGCCnt <= GCHeapUtilities::GetGCHeap()->GetGcCount()) but
// this is no longer true because with background gc. Since the purpose of having
#include "eehash.h"
#include "contractimpl.h"
#include "generics.h"
-#include "fixuppointer.h"
#include "gcinfotypes.h"
/*
struct GenericsStaticsInfo
{
// Pointer to field descs for statics
- RelativePointer<PTR_FieldDesc> m_pFieldDescs;
+ PTR_FieldDesc m_pFieldDescs;
// Method table ID for statics
SIZE_T m_DynamicTypeID;
// code with the given MT because of generics.
PTR_MethodTable GetCanonicalMethodTable();
- // Returns fixup if canonical method table needs fixing up, NULL otherwise
- TADDR GetCanonicalMethodTableFixup();
-
//-------------------------------------------------------------------
// Accessing methods by slot number
//
WRAPPER_NO_CONTRACT;
CONSISTENCY_CHECK(slotNumber < GetNumVtableSlots());
- TADDR pSlot = GetSlotPtrRaw(slotNumber);
- if (slotNumber < GetNumVirtuals())
- {
- return VTableIndir2_t::GetValueMaybeNullAtPtr(pSlot);
- }
-
- return *dac_cast<PTR_PCODE>(pSlot);
+ return *GetSlotPtrRaw(slotNumber);
}
// Special-case for when we know that the slot number corresponds
CONSISTENCY_CHECK(slotNum < GetNumVirtuals());
// Virtual slots live in chunks pointed to by vtable indirections
-
- DWORD index = GetIndexOfVtableIndirection(slotNum);
- TADDR base = dac_cast<TADDR>(&(GetVtableIndirections()[index]));
- DPTR(VTableIndir2_t) baseAfterInd = VTableIndir_t::GetValueMaybeNullAtPtr(base) + GetIndexAfterVtableIndirection(slotNum);
- return VTableIndir2_t::GetValueMaybeNullAtPtr(dac_cast<TADDR>(baseAfterInd));
+ return *(GetVtableIndirections()[GetIndexOfVtableIndirection(slotNum)] + GetIndexAfterVtableIndirection(slotNum));
}
- TADDR GetSlotPtrRaw(UINT32 slotNum)
+ PTR_PCODE GetSlotPtrRaw(UINT32 slotNum)
{
WRAPPER_NO_CONTRACT;
CONSISTENCY_CHECK(slotNum < GetNumVtableSlots());
if (slotNum < GetNumVirtuals())
{
- // Virtual slots live in chunks pointed to by vtable indirections
- DWORD index = GetIndexOfVtableIndirection(slotNum);
- TADDR base = dac_cast<TADDR>(&(GetVtableIndirections()[index]));
- DPTR(VTableIndir2_t) baseAfterInd = VTableIndir_t::GetValueMaybeNullAtPtr(base) + GetIndexAfterVtableIndirection(slotNum);
- return dac_cast<TADDR>(baseAfterInd);
+ // Virtual slots live in chunks pointed to by vtable indirections
+ return GetVtableIndirections()[GetIndexOfVtableIndirection(slotNum)] + GetIndexAfterVtableIndirection(slotNum);
}
else if (HasSingleNonVirtualSlot())
{
// Non-virtual slots < GetNumVtableSlots live in a single chunk pointed to by an optional member,
// except when there is only one in which case it lives in the optional member itself
_ASSERTE(slotNum == GetNumVirtuals());
- return GetNonVirtualSlotsPtr();
+ return dac_cast<PTR_PCODE>(GetNonVirtualSlotsPtr());
}
else
{
// Non-virtual slots < GetNumVtableSlots live in a single chunk pointed to by an optional member
_ASSERTE(HasNonVirtualSlotsArray());
g_IBCLogger.LogMethodTableNonVirtualSlotsAccess(this);
- return dac_cast<TADDR>(GetNonVirtualSlotsArray() + (slotNum - GetNumVirtuals()));
+ return GetNonVirtualSlotsArray() + (slotNum - GetNumVirtuals());
}
}
- TADDR GetSlotPtr(UINT32 slotNum)
+ PTR_PCODE GetSlotPtr(UINT32 slotNum)
{
WRAPPER_NO_CONTRACT;
return GetSlotPtrRaw(slotNum);
#define VTABLE_SLOTS_PER_CHUNK 8
#define VTABLE_SLOTS_PER_CHUNK_LOG2 3
- typedef PlainPointer<PCODE> VTableIndir2_t;
- typedef PlainPointer<DPTR(VTableIndir2_t)> VTableIndir_t;
+ typedef PCODE VTableIndir2_t;
+ typedef DPTR(VTableIndir2_t) VTableIndir_t;
static DWORD GetIndexOfVtableIndirection(DWORD slotNum);
static DWORD GetStartSlotForVtableIndirection(UINT32 indirectionIndex, DWORD wNumVirtuals);
{
LIMITED_METHOD_DAC_CONTRACT;
_ASSERTE(HasNonVirtualSlotsArray());
- return RelativePointer<PTR_PCODE>::GetValueAtPtr(GetNonVirtualSlotsPtr());
+ return *dac_cast<PTR_PTR_PCODE>(GetNonVirtualSlotsPtr());
}
#ifndef DACCESS_COMPILE
LIMITED_METHOD_CONTRACT;
_ASSERTE(HasNonVirtualSlotsArray());
- RelativePointer<PCODE *> *pRelPtr = (RelativePointer<PCODE *> *)GetNonVirtualSlotsPtr();
- pRelPtr->SetValue(slots);
+ *(PCODE **)GetNonVirtualSlotsPtr() = slots;
}
inline void SetHasSingleNonVirtualSlot()
//-------------------------------------------------------------------
// THE METHOD TABLE PARENT (SUPERCLASS/BASE CLASS)
//
-#define PARENT_MT_FIXUP_OFFSET ((SSIZE_T)offsetof(MethodTable, m_pParentMethodTable))
- typedef IndirectPointer<PTR_MethodTable> ParentMT_t;
-
BOOL HasApproxParent()
{
LIMITED_METHOD_DAC_CONTRACT;
LIMITED_METHOD_DAC_CONTRACT;
PRECONDITION(IsParentMethodTablePointerValid());
- return ReadPointerMaybeNull(this, &MethodTable::m_pParentMethodTable, GetFlagHasIndirectParent());
- }
-
- inline static PTR_VOID GetParentMethodTableOrIndirection(PTR_VOID pMT)
- {
- WRAPPER_NO_CONTRACT;
- return PTR_VOID(*PTR_TADDR(dac_cast<TADDR>(pMT) + offsetof(MethodTable, m_pParentMethodTable)));
- }
-
- inline static BOOL IsParentMethodTableTagged(PTR_MethodTable pMT)
- {
- LIMITED_METHOD_CONTRACT;
- TADDR base = dac_cast<TADDR>(pMT) + offsetof(MethodTable, m_pParentMethodTable);
- return pMT->m_pParentMethodTable.IsTaggedIndirect(base, pMT->GetFlagHasIndirectParent(), PARENT_MT_FIXUP_OFFSET);
- }
-
- bool GetFlagHasIndirectParent()
- {
- return false;
+ return m_pParentMethodTable;
}
#ifndef DACCESS_COMPILE
- inline ParentMT_t * GetParentMethodTablePointerPtr()
- {
- LIMITED_METHOD_CONTRACT;
- return &m_pParentMethodTable;
- }
-
- inline bool IsParentMethodTableIndirectPointerMaybeNull()
- {
- LIMITED_METHOD_CONTRACT;
- return m_pParentMethodTable.IsIndirectPtrMaybeNullIndirect(GetFlagHasIndirectParent(), PARENT_MT_FIXUP_OFFSET);
- }
-
- inline bool IsParentMethodTableIndirectPointer()
- {
- LIMITED_METHOD_CONTRACT;
- return m_pParentMethodTable.IsIndirectPtrIndirect(GetFlagHasIndirectParent(), PARENT_MT_FIXUP_OFFSET);
- }
-
inline MethodTable ** GetParentMethodTableValuePtr()
{
LIMITED_METHOD_CONTRACT;
- return m_pParentMethodTable.GetValuePtrIndirect(GetFlagHasIndirectParent(), PARENT_MT_FIXUP_OFFSET);
+ return &m_pParentMethodTable;
}
#endif // !DACCESS_COMPILE
void SetParentMethodTable (MethodTable *pParentMethodTable)
{
LIMITED_METHOD_CONTRACT;
- PRECONDITION(!IsParentMethodTableIndirectPointerMaybeNull());
- m_pParentMethodTable.SetValueMaybeNull(pParentMethodTable);
+ m_pParentMethodTable = pParentMethodTable;
#ifdef _DEBUG
GetWriteableDataForWrite_NoLogging()->SetParentMethodTablePointerValid();
#endif
inline void SetClass(EEClass *pClass)
{
LIMITED_METHOD_CONTRACT;
- m_pEEClass.SetValue(pClass);
+ m_pEEClass = pClass;
}
inline void SetCanonicalMethodTable(MethodTable * pMT)
{
- m_pCanonMT.SetValue((TADDR)pMT | MethodTable::UNION_METHODTABLE);
+ m_pCanonMT = (TADDR)pMT | MethodTable::UNION_METHODTABLE;
}
#endif
_ASSERTE(HasDispatchMapSlot());
TADDR pSlot = GetMultipurposeSlotPtr(enum_flag_HasDispatchMapSlot, c_DispatchMapSlotOffsets);
-
- RelativePointer<DispatchMap *> *pRelPtr = (RelativePointer<DispatchMap *> *)pSlot;
- pRelPtr->SetValue(pDispatchMap);
+ *(DispatchMap **)pSlot = pDispatchMap;
}
#endif // !DACCESS_COMPILE
{
WRAPPER_NO_CONTRACT;
_ASSERTE(HasGenericsStaticsInfo());
- return ReadPointerMaybeNull((GenericsStaticsInfo *)GetGenericsStaticsInfo(), &GenericsStaticsInfo::m_pFieldDescs);
+ return GetGenericsStaticsInfo()->m_pFieldDescs;
}
BOOL HasCrossModuleGenericStaticsInfo()
// must have a dictionary entry. On the other hand, for instantiations shared with Dict<string,double> the opposite holds.
//
- typedef PlainPointer<PTR_Dictionary> PerInstInfoElem_t;
- typedef PlainPointer<DPTR(PerInstInfoElem_t)> PerInstInfo_t;
+ typedef PTR_Dictionary PerInstInfoElem_t;
+ typedef DPTR(PerInstInfoElem_t) PerInstInfo_t;
// Return a pointer to the per-instantiation information. See field itself for comments.
DPTR(PerInstInfoElem_t) GetPerInstInfo()
{
LIMITED_METHOD_DAC_CONTRACT;
_ASSERTE(HasPerInstInfo());
- return ReadPointer(this, &MethodTable::m_pPerInstInfo);
+ return m_pPerInstInfo;
}
BOOL HasPerInstInfo()
{
return GetFlag(enum_flag_HasPerInstInfo) && !IsArray();
}
#ifndef DACCESS_COMPILE
- static inline bool IsPerInstInfoRelative()
- {
- LIMITED_METHOD_CONTRACT;
- return decltype(m_pPerInstInfo)::isRelative;
- }
static inline DWORD GetOffsetOfPerInstInfo()
{
LIMITED_METHOD_CONTRACT;
void SetPerInstInfo(PerInstInfoElem_t *pPerInstInfo)
{
LIMITED_METHOD_CONTRACT;
- m_pPerInstInfo.SetValue(pPerInstInfo);
+ m_pPerInstInfo = pPerInstInfo;
}
void SetDictInfo(WORD numDicts, WORD numTyPars)
{
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(pMTWriteableData);
- m_pWriteableData.SetValue(pMTWriteableData);
+ m_pWriteableData = pMTWriteableData;
}
#endif
inline PTR_Const_MethodTableWriteableData GetWriteableData_NoLogging() const
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointer(this, &MethodTable::m_pWriteableData);
+ return MethodTable::m_pWriteableData;
}
inline PTR_MethodTableWriteableData GetWriteableDataForWrite()
inline PTR_MethodTableWriteableData GetWriteableDataForWrite_NoLogging()
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointer(this, &MethodTable::m_pWriteableData);
+ return MethodTable::m_pWriteableData;
}
//-------------------------------------------------------------------
enum_flag_ICastable = 0x00400000, // class implements ICastable interface
- enum_flag_HasIndirectParent = 0x00800000, // m_pParentMethodTable has double indirection
+ enum_flag_Unused_1 = 0x00800000,
enum_flag_ContainsPointers = 0x01000000,
LPCUTF8 debug_m_szClassName;
#endif //_DEBUG
- // On Linux ARM is a RelativeFixupPointer. Otherwise,
- // Parent PTR_MethodTable if enum_flag_HasIndirectParent is not set. Pointer to indirection cell
- // if enum_flag_enum_flag_HasIndirectParent is set. The indirection is offset by offsetof(MethodTable, m_pParentMethodTable).
- // It allows casting helpers to go through parent chain natually. Casting helper do not need need the explicit check
- // for enum_flag_HasIndirectParentMethodTable.
- ParentMT_t m_pParentMethodTable;
+ PTR_MethodTable m_pParentMethodTable;
- RelativePointer<PTR_Module> m_pLoaderModule; // LoaderModule. It is equal to the ZapModule in ngened images
+ PTR_Module m_pLoaderModule; // LoaderModule. It is equal to the ZapModule in ngened images
- PlainPointer<PTR_MethodTableWriteableData> m_pWriteableData;
+ PTR_MethodTableWriteableData m_pWriteableData;
// The value of lowest two bits describe what the union contains
enum LowBits {
UNION_EECLASS = 0, // 0 - pointer to EEClass. This MethodTable is the canonical method table.
- UNION_INVALID = 1, // 1 - not used
- UNION_METHODTABLE = 2, // 2 - pointer to canonical MethodTable.
- UNION_INDIRECTION = 3 // 3 - pointer to indirection cell that points to canonical MethodTable.
- }; // (used only if FEATURE_PREJIT is defined)
- static const TADDR UNION_MASK = 3;
+ UNION_METHODTABLE = 1, // 1 - pointer to canonical MethodTable.
+ };
+ static const TADDR UNION_MASK = 1;
union {
- PlainPointer<DPTR(EEClass)> m_pEEClass;
- PlainPointer<TADDR> m_pCanonMT;
+ DPTR(EEClass) m_pEEClass;
+ TADDR m_pCanonMT;
};
__forceinline static LowBits union_getLowBits(TADDR pCanonMT)
public:
union
{
- PlainPointer<PTR_InterfaceInfo> m_pInterfaceMap;
+ PTR_InterfaceInfo m_pInterfaceMap;
TADDR m_pMultipurposeSlot2;
};
return GetFlag(enum_flag_HasModuleOverride);
}
- DPTR(RelativeFixupPointer<PTR_Module>) GetModuleOverridePtr()
+ DPTR(PTR_Module) GetModuleOverridePtr()
{
LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast<DPTR(RelativeFixupPointer<PTR_Module>)>(GetMultipurposeSlotPtr(enum_flag_HasModuleOverride, c_ModuleOverrideOffsets));
+ return dac_cast<DPTR(PTR_Module)>(GetMultipurposeSlotPtr(enum_flag_HasModuleOverride, c_ModuleOverrideOffsets));
}
void SetModule(Module * pModule);
{
LIMITED_METHOD_DAC_CONTRACT;
- TADDR addr = ReadPointer(this, &MethodTable::m_pCanonMT);
+ TADDR addr = m_pCanonMT;
-#ifdef _DEBUG
LowBits lowBits = union_getLowBits(addr);
if (lowBits == UNION_EECLASS)
{
return PTR_EEClass(addr);
}
- else if (lowBits == UNION_METHODTABLE)
+ else
{
// pointer to canonical MethodTable.
TADDR canonicalMethodTable = union_getPointer(addr);
- return PTR_EEClass(ReadPointer((MethodTable *) PTR_MethodTable(canonicalMethodTable), &MethodTable::m_pCanonMT));
- }
-#ifdef DACCESS_COMPILE
- // Minidumps don't guarantee that every member of every class will be able to work here.
-#else
- _ASSERTE(!"Malformed m_pEEClass in MethodTable");
-#endif
- return NULL;
-
-#else
-
- if ((addr & 2) == 0)
- {
- // pointer to EEClass
- return PTR_EEClass(addr);
+ return PTR_EEClass(PTR_MethodTable(canonicalMethodTable)->m_pCanonMT);
}
-
- // pointer to canonical MethodTable.
- return PTR_EEClass(ReadPointer((MethodTable *) PTR_MethodTable(addr - 2), &MethodTable::m_pCanonMT));
-#endif
}
//==========================================================================================
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
- TADDR addr = ReadPointer(this, &MethodTable::m_pCanonMT);
-
- LowBits lowBits = union_getLowBits(addr);
+ LowBits lowBits = union_getLowBits(m_pCanonMT);
if (lowBits == UNION_EECLASS)
{
- return !m_pEEClass.IsNull();
+ return (m_pEEClass != NULL);
}
- else if (lowBits == UNION_METHODTABLE)
+ else
{
// pointer to canonical MethodTable.
- TADDR canonicalMethodTable = union_getPointer(addr);
- return !PTR_MethodTable(canonicalMethodTable)->m_pEEClass.IsNull();
+ TADDR canonicalMethodTable = union_getPointer(m_pCanonMT);
+ return (PTR_MethodTable(canonicalMethodTable)->m_pEEClass != NULL);
}
- _ASSERTE(!"Malformed m_pEEClass in MethodTable");
- return FALSE;
}
//==========================================================================================
inline PTR_Module MethodTable::GetLoaderModule()
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointer(this, &MethodTable::m_pLoaderModule);
+ return m_pLoaderModule;
}
inline PTR_LoaderAllocator MethodTable::GetLoaderAllocator()
inline void MethodTable::SetLoaderModule(Module* pModule)
{
WRAPPER_NO_CONTRACT;
- m_pLoaderModule.SetValue(pModule);
+ m_pLoaderModule = pModule;
}
inline void MethodTable::SetLoaderAllocator(LoaderAllocator* pAllocator)
LIMITED_METHOD_DAC_CONTRACT;
PRECONDITION(m_i != (DWORD) -1 && m_i < m_count);
- return m_pSlot->GetValueMaybeNull(dac_cast<TADDR>(m_pSlot));
+ return *m_pSlot;
}
-
//==========================================================================================
#ifndef DACCESS_COMPILE
inline void MethodTable::VtableIndirectionSlotIterator::SetIndirectionSlot(DPTR(MethodTable::VTableIndir2_t) pChunk)
{
LIMITED_METHOD_CONTRACT;
- m_pSlot->SetValueMaybeNull(pChunk);
+ (*m_pSlot) = pChunk;
}
#endif
{
LIMITED_METHOD_DAC_CONTRACT;
- TADDR addr = ReadPointer(this, &MethodTable::m_pCanonMT);
+ TADDR addr = m_pCanonMT;
-#ifdef _DEBUG
LowBits lowBits = union_getLowBits(addr);
if (lowBits == UNION_EECLASS)
{
return dac_cast<PTR_MethodTable>(this);
}
- else if (lowBits == UNION_METHODTABLE)
+ else
{
// pointer to canonical MethodTable.
return PTR_MethodTable(union_getPointer(addr));
}
- _ASSERTE(!"Malformed m_pCanonMT in MethodTable");
- return NULL;
-#else
-
- if ((addr & 2) == 0)
- return dac_cast<PTR_MethodTable>(this);
-
- return PTR_MethodTable(addr - 2);
-#endif
-}
-
-//==========================================================================================
-inline TADDR MethodTable::GetCanonicalMethodTableFixup()
-{
- LIMITED_METHOD_DAC_CONTRACT;
-
- return NULL;
}
//==========================================================================================
{
LIMITED_METHOD_DAC_CONTRACT;
- return (union_getLowBits(ReadPointer(this, &MethodTable::m_pCanonMT)) == UNION_EECLASS);
+ return (union_getLowBits(m_pCanonMT) == UNION_EECLASS);
}
//==========================================================================================
{
LIMITED_METHOD_DAC_CONTRACT;
- return ReadPointer(this, &MethodTable::m_pInterfaceMap);
+ return m_pInterfaceMap;
}
//==========================================================================================
NDirectMethodDesc *pNewNMD = (NDirectMethodDesc*)pNewMD;
// Allocate writeable data
- pNewNMD->ndirect.m_pWriteableData.SetValue((NDirectWriteableData*)
- AllocateFromHighFrequencyHeap(S_SIZE_T(sizeof(NDirectWriteableData))));
+ pNewNMD->ndirect.m_pWriteableData = (NDirectWriteableData*)
+ AllocateFromHighFrequencyHeap(S_SIZE_T(sizeof(NDirectWriteableData)));
#ifdef HAS_NDIRECT_IMPORT_PRECODE
- pNewNMD->ndirect.m_pImportThunkGlue.SetValue(Precode::Allocate(PRECODE_NDIRECT_IMPORT, pNewMD,
- GetLoaderAllocator(), GetMemTracker())->AsNDirectImportPrecode());
+ pNewNMD->ndirect.m_pImportThunkGlue = Precode::Allocate(PRECODE_NDIRECT_IMPORT, pNewMD,
+ GetLoaderAllocator(), GetMemTracker())->AsNDirectImportPrecode();
#else // !HAS_NDIRECT_IMPORT_PRECODE
pNewNMD->GetNDirectImportThunkGlue()->Init(pNewNMD);
#endif // !HAS_NDIRECT_IMPORT_PRECODE
if (strcmp(pMethodName, "Invoke") == 0)
{
- BAD_FORMAT_NOTHROW_ASSERT(((DelegateEEClass*)GetHalfBakedClass())->m_pInvokeMethod.IsNull());
- ((DelegateEEClass*)GetHalfBakedClass())->m_pInvokeMethod.SetValue(pNewMD);
+ BAD_FORMAT_NOTHROW_ASSERT(((DelegateEEClass*)GetHalfBakedClass())->m_pInvokeMethod == NULL);
+ ((DelegateEEClass*)GetHalfBakedClass())->m_pInvokeMethod = pNewMD;
}
else if (strcmp(pMethodName, "BeginInvoke") == 0)
{
- BAD_FORMAT_NOTHROW_ASSERT(((DelegateEEClass*)GetHalfBakedClass())->m_pBeginInvokeMethod.IsNull());
- ((DelegateEEClass*)GetHalfBakedClass())->m_pBeginInvokeMethod.SetValue(pNewMD);
+ BAD_FORMAT_NOTHROW_ASSERT(((DelegateEEClass*)GetHalfBakedClass())->m_pBeginInvokeMethod == NULL);
+ ((DelegateEEClass*)GetHalfBakedClass())->m_pBeginInvokeMethod = pNewMD;
}
else if (strcmp(pMethodName, "EndInvoke") == 0)
{
- BAD_FORMAT_NOTHROW_ASSERT(((DelegateEEClass*)GetHalfBakedClass())->m_pEndInvokeMethod.IsNull());
- ((DelegateEEClass*)GetHalfBakedClass())->m_pEndInvokeMethod.SetValue(pNewMD);
+ BAD_FORMAT_NOTHROW_ASSERT(((DelegateEEClass*)GetHalfBakedClass())->m_pEndInvokeMethod == NULL);
+ ((DelegateEEClass*)GetHalfBakedClass())->m_pEndInvokeMethod = pNewMD;
}
else
{
#ifdef _DEBUG
pNewMD->m_pszDebugMethodName = (LPUTF8)pszDebugMethodName;
pNewMD->m_pszDebugClassName = (LPUTF8)pszDebugClassName;
- pNewMD->m_pDebugMethodTable.SetValue(GetHalfBakedMethodTable());
+ pNewMD->m_pDebugMethodTable = GetHalfBakedMethodTable();
if (pszDebugMethodSignature == NULL)
pNewMD->m_pszDebugMethodSignature = FormatSig(pNewMD,pNewMD->GetLoaderAllocator()->GetLowFrequencyHeap(),GetMemTracker());
DWORD * slots = new (GetStackingAllocator()) DWORD[dwMaxSlotSize];
mdToken * tokens = new (GetStackingAllocator()) mdToken[dwMaxSlotSize];
- RelativePointer<MethodDesc *> * replaced = new (GetStackingAllocator()) RelativePointer<MethodDesc*>[dwMaxSlotSize];
+ MethodDesc ** replaced = new (GetStackingAllocator()) MethodDesc*[dwMaxSlotSize];
DWORD iEntry = 0;
bmtMDMethod * pCurImplMethod = bmtMethodImpl->GetImplementationMethod(iEntry);
DWORD cSlots,
DWORD * rgSlots,
mdToken * rgTokens,
- RelativePointer<MethodDesc *> * rgDeclMD)
+ MethodDesc ** rgDeclMD)
{
STANDARD_VM_CONTRACT;
if (min != i)
{
- MethodDesc * mTmp = rgDeclMD[i].GetValue();
- rgDeclMD[i].SetValue(rgDeclMD[min].GetValue());
- rgDeclMD[min].SetValue(mTmp);
+ MethodDesc * mTmp = rgDeclMD[i];
+ rgDeclMD[i] = rgDeclMD[min];
+ rgDeclMD[min] = mTmp;
DWORD sTmp = rgSlots[i];
rgSlots[i] = rgSlots[min];
bmtMDMethod * pDecl,
bmtMDMethod * pImpl,
DWORD * slots,
- RelativePointer<MethodDesc *> * replaced,
+ MethodDesc ** replaced,
DWORD * pSlotIndex,
DWORD dwMaxSlotSize)
{
// We implement this slot, record it
ASSERT(*pSlotIndex < dwMaxSlotSize);
slots[*pSlotIndex] = pDecl->GetSlotIndex();
- replaced[*pSlotIndex].SetValue(pDecl->GetMethodDesc());
+ replaced[*pSlotIndex] = pDecl->GetMethodDesc();
// increment the counter
(*pSlotIndex)++;
bmtMethodHandle hDecl,
bmtMDMethod *pImpl,
DWORD * slots,
- RelativePointer<MethodDesc *> * replaced,
+ MethodDesc ** replaced,
DWORD * pSlotIndex,
DWORD dwMaxSlotSize)
{
// We implement this slot, record it
ASSERT(*pSlotIndex < dwMaxSlotSize);
slots[*pSlotIndex] = hDecl.GetSlotIndex();
- replaced[*pSlotIndex].SetValue(pDeclMD);
+ replaced[*pSlotIndex] = pDeclMD;
// increment the counter
(*pSlotIndex)++;
bmtRTMethod * pDecl,
bmtMDMethod * pImpl,
DWORD * slots,
- RelativePointer<MethodDesc *> * replaced,
+ MethodDesc** replaced,
DWORD * pSlotIndex,
DWORD dwMaxSlotSize)
{
// We implement this slot, record it
ASSERT(*pSlotIndex < dwMaxSlotSize);
slots[*pSlotIndex] = pDeclMD->GetSlot();
- replaced[*pSlotIndex].SetValue(pDeclMD);
+ replaced[*pSlotIndex] = pDeclMD;
// increment the counter
(*pSlotIndex)++;
// If pTargetMT is null, this indicates that the target MethodDesc belongs
// to the current type. Otherwise, the MethodDesc MUST be owned by a parent
// of the type we're building.
- BOOL fTargetIsOwnedByParent = !pTargetMD->GetMethodTablePtr()->IsNull();
+ BOOL fTargetIsOwnedByParent = pTargetMD->GetMethodTable() != NULL;
// If the method is owned by a parent, we need to use the parent's module,
// and we must construct the substitution chain all the way up to the parent.
//
// Non-canonical method tables either share everything or nothing so it is sufficient to check
// just the first indirection to detect sharing.
- if (pMT->GetVtableIndirections()[0].GetValueMaybeNull() != pCanonMT->GetVtableIndirections()[0].GetValueMaybeNull())
+ if (pMT->GetVtableIndirections()[0] != pCanonMT->GetVtableIndirections()[0])
{
MethodTable::MethodDataWrapper hCanonMTData(MethodTable::GetMethodData(pCanonMT, FALSE));
for (DWORD i = 0; i < nParentVirtuals; i++)
// We need to re-inherit this slot from the exact parent.
DWORD indirectionIndex = MethodTable::GetIndexOfVtableIndirection(i);
- if (pMT->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull() == pApproxParentMT->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull())
+ if (pMT->GetVtableIndirections()[indirectionIndex] == pApproxParentMT->GetVtableIndirections()[indirectionIndex])
{
// The slot lives in a chunk shared from the approximate parent MT
// If so, we need to change to share the chunk from the exact parent MT
_ASSERTE(MethodTable::CanShareVtableChunksFrom(pParentMT, pMT->GetLoaderModule()));
- pMT->GetVtableIndirections()[indirectionIndex].SetValueMaybeNull(pParentMT->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull());
+ pMT->GetVtableIndirections()[indirectionIndex] = pParentMT->GetVtableIndirections()[indirectionIndex];
i = MethodTable::GetEndSlotForVtableIndirection(indirectionIndex, nParentVirtuals) - 1;
continue;
{
// Share the parent chunk
_ASSERTE(it.GetEndSlot() <= pMTParent->GetNumVirtuals());
- it.SetIndirectionSlot(pMTParent->GetVtableIndirections()[it.GetIndex()].GetValueMaybeNull());
+ it.SetIndirectionSlot(pMTParent->GetVtableIndirections()[it.GetIndex()]);
}
else
{
if (cbInstAndDict)
{
MethodTable::PerInstInfoElem_t *pPInstInfo = (MethodTable::PerInstInfoElem_t *)(pPerInstInfo + (dwNumDicts-1));
- pPInstInfo->SetValueMaybeNull((Dictionary*) (pPerInstInfo + dwNumDicts));
+ *pPInstInfo = (Dictionary*) (pPerInstInfo + dwNumDicts);
}
}
#ifdef _DEBUG
- pMT->m_pWriteableData.GetValue()->m_dwLastVerifedGCCnt = (DWORD)-1;
+ pMT->m_pWriteableData->m_dwLastVerifedGCCnt = (DWORD)-1;
#endif // _DEBUG
RETURN(pMT);
GetMemTracker());
pMT->SetClass(pClass);
- pClass->m_pMethodTable.SetValue(pMT);
+ pClass->m_pMethodTable = pMT;
m_pHalfBakedMT = pMT;
#ifdef _DEBUG
MethodDesc *pMD = it->GetMethodDesc();
if (pMD != NULL)
{
- pMD->m_pDebugMethodTable.SetValue(pMT);
+ pMD->m_pDebugMethodTable = pMT;
pMD->m_pszDebugMethodSignature = FormatSig(pMD, GetLoaderAllocator()->GetLowFrequencyHeap(), GetMemTracker());
}
MethodDesc *pUnboxedMD = it->GetUnboxedMethodDesc();
if (pUnboxedMD != NULL)
{
- pUnboxedMD->m_pDebugMethodTable.SetValue(pMT);
+ pUnboxedMD->m_pDebugMethodTable = pMT;
pUnboxedMD->m_pszDebugMethodSignature = FormatSig(pUnboxedMD, GetLoaderAllocator()->GetLowFrequencyHeap(), GetMemTracker());
}
}
// Set all field slots to point to the newly created MethodTable
for (i = 0; i < (bmtEnumFields->dwNumStaticFields + bmtEnumFields->dwNumInstanceFields); i++)
{
- pFieldDescList[i].m_pMTOfEnclosingClass.SetValue(pMT);
+ pFieldDescList[i].m_pMTOfEnclosingClass = pMT;
}
// Fill in type parameters before looking up exact parent or fetching the types of any field descriptors!
{
_ASSERTE(pLayout->GetMaxSlots() > 0);
- PTR_Dictionary pDictionarySlots = pMT->GetPerInstInfo()[bmtGenerics->numDicts - 1].GetValue();
+ PTR_Dictionary pDictionarySlots = pMT->GetPerInstInfo()[bmtGenerics->numDicts - 1];
DWORD* pSizeSlot = (DWORD*)(pDictionarySlots + bmtGenerics->GetNumGenericArgs());
*pSizeSlot = cbDictSlotSize;
}
// with code:MethodDesc::SetStableEntryPointInterlocked.
//
DWORD indirectionIndex = MethodTable::GetIndexOfVtableIndirection(iCurSlot);
- if (GetParentMethodTable()->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull() != pMT->GetVtableIndirections()[indirectionIndex].GetValueMaybeNull())
+ if (GetParentMethodTable()->GetVtableIndirections()[indirectionIndex] != pMT->GetVtableIndirections()[indirectionIndex])
pMT->SetSlot(iCurSlot, pMD->GetInitialEntryPointForCopiedSlot());
}
else
DWORD cSlots,
DWORD * rgSlots,
mdToken * rgTokens,
- RelativePointer<MethodDesc *> * rgDeclMD);
+ MethodDesc ** rgDeclMD);
// --------------------------------------------------------------------------------------------
// Places a methodImpl pair where the decl is declared by the type being built.
bmtMDMethod * pDecl,
bmtMDMethod * pImpl,
DWORD* slots,
- RelativePointer<MethodDesc *> * replaced,
+ MethodDesc** replaced,
DWORD* pSlotIndex,
DWORD dwMaxSlotSize);
bmtRTMethod * pDecl,
bmtMDMethod * pImpl,
DWORD* slots,
- RelativePointer<MethodDesc *> * replaced,
+ MethodDesc** replaced,
DWORD* pSlotIndex,
DWORD dwMaxSlotSize);
bmtMethodHandle hDecl,
bmtMDMethod * pImpl,
DWORD* slots,
- RelativePointer<MethodDesc *> * replaced,
+ MethodDesc** replaced,
DWORD* pSlotIndex,
DWORD dwMaxSlotSize);
PTR_Module GetModule()
{
- return ReadPointerMaybeNull(this, &NgenHashTable<NGEN_HASH_ARGS>::m_pModule);
+ return m_pModule;
}
// Owning module set at hash creation time (possibly NULL if this hash instance is not to be ngen'd).
- RelativePointer<PTR_Module> m_pModule;
+ PTR_Module m_pModule;
private:
// Internal implementation details. Nothing of interest to sub-classers for here on.
{
SUPPORTS_DAC;
- return ReadPointer(this, &NgenHashTable<NGEN_HASH_ARGS>::m_pWarmBuckets);
+ return m_pWarmBuckets;
}
// Loader heap provided at construction time. May be NULL (in which case m_pModule must *not* be NULL).
LoaderHeap *m_pHeap;
// Fields related to the runtime (volatile or warm) part of the hash.
- RelativePointer<DPTR(PTR_VolatileEntry)> m_pWarmBuckets; // Pointer to a simple bucket list (array of VolatileEntry pointers)
+ DPTR(PTR_VolatileEntry) m_pWarmBuckets; // Pointer to a simple bucket list (array of VolatileEntry pointers)
DWORD m_cWarmBuckets; // Count of buckets in the above array (always non-zero)
DWORD m_cWarmEntries; // Count of elements in the warm section of the hash
};
#endif // !DACCESS_COMPILE
private:
- RelativePointer<DPTR(VALUE)> m_rpEntryRef; // Entry ref encoded as a delta from this field's location.
+ DPTR(VALUE) m_rpEntryRef; // Entry ref encoded as a delta from this field's location.
};
#endif // __NGEN_HASH_INCLUDED
// At least one of module or heap must have been specified or we won't know how to allocate entries and
// buckets.
_ASSERTE(pModule || pHeap);
- m_pModule.SetValueMaybeNull(pModule);
+ m_pModule = pModule;
m_pHeap = pHeap;
S_SIZE_T cbBuckets = S_SIZE_T(sizeof(VolatileEntry*)) * S_SIZE_T(cInitialBuckets);
m_cWarmEntries = 0;
m_cWarmBuckets = cInitialBuckets;
- m_pWarmBuckets.SetValue((PTR_VolatileEntry*)(void*)GetHeap()->AllocMem(cbBuckets));
+ m_pWarmBuckets = (PTR_VolatileEntry*)(void*)GetHeap()->AllocMem(cbBuckets);
// Note: Memory allocated on loader heap is zero filled
// memset(m_pWarmBuckets, 0, sizeof(VolatileEntry*) * cInitialBuckets);
// If not specified then we fall back to the owning module's heap (a module must have been specified in
// this case).
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
return GetModule()->GetAssembly()->GetLowFrequencyHeap();
}
// Make sure that all writes are visible before publishing the new array.
MemoryBarrier();
- m_pWarmBuckets.SetValue(pNewBuckets);
+ m_pWarmBuckets = pNewBuckets;
// The new number of buckets has to be published last (prior to this readers may miscalculate a bucket
// index, but the result will always be in range and they'll simply walk the wrong chain and get a miss,
}
CONTRACTL_END;
- // Short-cut the NULL case, it's a lot cheaper than the code below when compiling for DAC.
- if (m_rpEntryRef.IsNull())
- return NULL;
-
- // Note that the following code uses a special DAC lookup for an interior pointer (i.e. "this" isn't a
- // host address corresponding to a DAC marshalled instance, it's some host address within such an
- // instance). These lookups are a little slower than the regular kind since we have to search for the
- // containing instance.
-
- // @todo: The following causes gcc to choke on Mac 10.4 at least (complains that offsetof is being passed
- // four arguments instead of two). Expanding the top-level macro manually fixes this.
- // TADDR pBase = PTR_HOST_INT_MEMBER_TADDR(NgenHashEntryRef<NGEN_HASH_ARGS>, this, m_rpEntryRef);
- TADDR pBase = PTR_HOST_INT_TO_TADDR(this) + (TADDR)offsetof(NgenHashEntryRef<NGEN_HASH_ARGS>, m_rpEntryRef);
-
- return m_rpEntryRef.GetValue(pBase);
+ return m_rpEntryRef;
}
#ifndef DACCESS_COMPILE
}
CONTRACTL_END;
- m_rpEntryRef.SetValueMaybeNull(pEntry);
+ m_rpEntryRef = pEntry;
}
#endif // !DACCESS_COMPILE
RecordAndBackpatchEntryPointSlot_Locked(
mdLoaderAllocator,
patchedMT->GetLoaderAllocator(),
- patchedMT->GetSlotPtr(slotIndex),
+ dac_cast<TADDR>(patchedMT->GetSlotPtr(slotIndex)),
EntryPointSlots::SlotType_Vtable,
pTarget);
};
}
DispatchToken token;
- if (pMT->IsInterface() || MethodTable::VTableIndir_t::isRelative)
+ if (pMT->IsInterface())
{
if (pMT->IsInterface())
token = pMT->GetLoaderAllocator()->GetDispatchToken(pMT->GetTypeID(), slot);
pResult->indirections = 2;
pResult->offsets[0] = offsetof(InstantiatedMethodDesc, m_pPerInstInfo);
- if (decltype(InstantiatedMethodDesc::m_pPerInstInfo)::isRelative)
- {
- pResult->indirectFirstOffset = 1;
- }
-
uint32_t data;
IfFailThrow(sigptr.GetData(&data));
pResult->offsets[1] = sizeof(TypeHandle) * data;
IfFailThrow(sigptr.GetData(&data));
pResult->offsets[2] = sizeof(TypeHandle) * data;
- if (MethodTable::IsPerInstInfoRelative())
- {
- pResult->indirectFirstOffset = 1;
- pResult->indirectSecondOffset = 1;
- }
-
return;
}
}
// Indirect through dictionary table pointer in InstantiatedMethodDesc
pResult->offsets[0] = offsetof(InstantiatedMethodDesc, m_pPerInstInfo);
- if (decltype(InstantiatedMethodDesc::m_pPerInstInfo)::isRelative)
- {
- pResult->indirectFirstOffset = 1;
- }
-
*pDictionaryIndexAndSlot |= dictionarySlot;
}
}
// Next indirect through the dictionary appropriate to this instantiated type
pResult->offsets[1] = sizeof(TypeHandle*) * (pContextMT->GetNumDicts() - 1);
- if (MethodTable::IsPerInstInfoRelative())
- {
- pResult->indirectFirstOffset = 1;
- pResult->indirectSecondOffset = 1;
- }
-
*pDictionaryIndexAndSlot |= dictionarySlot;
}
}
return CORPROF_E_DATAINCOMPLETE;
}
- // Types can be pre-restored, but they still aren't expected to handle queries before
- // eager fixups have run. This is a targetted band-aid for a bug intellitrace was
- // running into - attempting to get the class layout for all types at module load time.
- // If we don't detect this the runtime will AV during the field iteration below. Feel
- // free to eliminate this check when a more complete solution is available.
- if (MethodTable::IsParentMethodTableTagged(typeHandle.AsMethodTable()))
- {
- return CORPROF_E_DATAINCOMPLETE;
- }
-
// !IsValueType = IsArray || IsReferenceType Since IsArry has been ruled out above, it must
// be a reference type if !IsValueType.
BOOL fReferenceType = !typeHandle.IsValueType();
END_QCALL;
}
-PTRARRAYREF CopyRuntimeTypeHandles(TypeHandle * prgTH, FixupPointer<TypeHandle> * prgTH2, INT32 numTypeHandles, BinderClassID arrayElemType)
+PTRARRAYREF CopyRuntimeTypeHandles(TypeHandle * prgTH, INT32 numTypeHandles, BinderClassID arrayElemType)
{
CONTRACTL {
THROWS;
if (numTypeHandles == 0)
return NULL;
- _ASSERTE((prgTH != NULL) || (prgTH2 != NULL));
- if (prgTH != NULL)
- {
- _ASSERTE(prgTH2 == NULL);
- }
+ _ASSERTE(prgTH != NULL);
GCPROTECT_BEGIN(refArray);
TypeHandle thRuntimeType = TypeHandle(CoreLibBinder::GetClass(arrayElemType));
{
TypeHandle th;
- if (prgTH != NULL)
- th = prgTH[i];
- else
- th = prgTH2[i].GetValue();
+ th = prgTH[i];
OBJECTREF refType = th.GetManagedClassObject();
refArray->SetAt(i, refType);
constraints = pGenericVariable->GetConstraints(&dwCount);
GCX_COOP();
- retTypeArray.Set(CopyRuntimeTypeHandles(constraints, NULL, dwCount, CLASS__TYPE));
+ retTypeArray.Set(CopyRuntimeTypeHandles(constraints, dwCount, CLASS__TYPE));
END_QCALL;
TypeHandle typeHandle = pType.AsTypeHandle();
Instantiation inst = typeHandle.GetInstantiation();
GCX_COOP();
- retTypes.Set(CopyRuntimeTypeHandles(NULL, inst.GetRawArgs(), inst.GetNumArgs(), fAsRuntimeTypeArray ? CLASS__CLASS : CLASS__TYPE));
+ retTypes.Set(CopyRuntimeTypeHandles(inst.GetRawArgs(), inst.GetNumArgs(), fAsRuntimeTypeArray ? CLASS__CLASS : CLASS__TYPE));
END_QCALL;
return;
Instantiation inst = pMethod->LoadMethodInstantiation();
GCX_COOP();
- retTypes.Set(CopyRuntimeTypeHandles(NULL, inst.GetRawArgs(), inst.GetNumArgs(), fAsRuntimeTypeArray ? CLASS__CLASS : CLASS__TYPE));
+ retTypes.Set(CopyRuntimeTypeHandles(inst.GetRawArgs(), inst.GetNumArgs(), fAsRuntimeTypeArray ? CLASS__CLASS : CLASS__TYPE));
END_QCALL;
return;
STATIC_CONTRACT_DEBUG_ONLY;
STATIC_CONTRACT_SUPPORTS_DAC;
- _ASSERTE(m_TemplateMT.IsNull() || GetTemplateMethodTableInternal()->SanityCheck());
+ _ASSERTE((m_TemplateMT == NULL) || GetTemplateMethodTableInternal()->SanityCheck());
_ASSERTE(!GetTypeParam().IsNull());
_ASSERTE(CorTypeInfo::IsModifier_NoThrow(GetInternalCorElementType()) ||
GetInternalCorElementType() == ELEMENT_TYPE_VALUETYPE);
ParamTypeDesc* pPTD = (ParamTypeDesc*) this;
// Fully load the template method table
- if (!pPTD->m_TemplateMT.IsNull())
+ if (pPTD->m_TemplateMT != NULL)
{
pPTD->GetTemplateMethodTableInternal()->DoFullyLoad(&newVisited, level, pPending, &fBailed, pInstContext);
}
LIMITED_METHOD_CONTRACT;
- m_TemplateMT.SetValueMaybeNull(pMT);
+ m_TemplateMT = pMT;
// ParamTypeDescs start out life not fully loaded
m_typeAndFlags |= TypeDesc::enum_flag_IsNotFullyLoaded;
protected:
PTR_MethodTable GetTemplateMethodTableInternal() {
WRAPPER_NO_CONTRACT;
- return ReadPointerMaybeNull(this, &ParamTypeDesc::m_TemplateMT);
+ return m_TemplateMT;
}
// the m_typeAndFlags field in TypeDesc tell what kind of parameterized type we have
- RelativeFixupPointer<PTR_MethodTable> m_TemplateMT; // The shared method table, some variants do not use this field (it is null)
+ PTR_MethodTable m_TemplateMT; // The shared method table, some variants do not use this field (it is null)
TypeHandle m_Arg; // The type that is being modified
LOADERHANDLE m_hExposedClassObject; // handle back to the internal reflection Type object
};
}
CONTRACTL_END;
- m_pModule.SetValue(pModule);
+ m_pModule = pModule;
m_typeOrMethodDef = typeOrMethodDef;
m_token = token;
m_index = index;
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
- return ReadPointer(this, &TypeVarTypeDesc::m_pModule);
+ return m_pModule;
}
unsigned int GetIndex()
BOOL ConstrainedAsObjRefHelper();
// Module containing the generic definition, also the loader module for this type desc
- RelativePointer<PTR_Module> m_pModule;
+ PTR_Module m_pModule;
// Declaring type or method
mdToken m_typeOrMethodDef;
#include "check.h"
#include "classloadlevel.h"
-#include "fixuppointer.h"
class TypeDesc;
class TypeHandle;
#endif // CHECK_INVARIANTS
/*************************************************************************/
-// dac_casts for TypeHandle makes FixupPointer<TypeHandle> work.
-//
-// TypeHandle is wrapper around pointer to MethodTable or TypeDesc. Even though
-// it may feel counterintuitive, it is possible to treat it like a pointer and
-// use the regular FixupPointer to implement TypeHandle indirection cells.
-// The lowest bit of TypeHandle (when wrapped inside FixupPointer) is
-// used to mark optional indirection.
-//
-template<>
-inline TADDR dac_cast(TypeHandle src)
-{
- SUPPORTS_DAC;
- return src.AsTAddr();
-}
-
-template<>
-inline TypeHandle dac_cast(TADDR src)
-{
- SUPPORTS_DAC;
- return TypeHandle::FromTAddr(src);
-}
-
-/*************************************************************************/
// Instantiation is representation of generic instantiation.
// It is simple read-only array of TypeHandles. In NGen, the type handles
// may be encoded using indirections. That's one reason why it is convenient
public:
// Construct empty instantiation
Instantiation()
- : m_pArgs(NULL), m_nArgs(0)
+ : m_pArgs((TypeHandle*)NULL), m_nArgs(0)
{
LIMITED_METHOD_DAC_CONTRACT;
}
_ASSERTE(m_nArgs == 0 || m_pArgs != NULL);
}
- // Construct instantiation from array of FixupPointers
- Instantiation(FixupPointer<TypeHandle> * pArgs, DWORD nArgs)
- : m_pArgs(pArgs), m_nArgs(nArgs)
- {
- LIMITED_METHOD_DAC_CONTRACT;
- _ASSERTE(m_nArgs == 0 || m_pArgs != NULL);
- }
-
// Construct instantiation from array of TypeHandles
- Instantiation(TypeHandle * pArgs, DWORD nArgs)
+ Instantiation(TypeHandle *pArgs, DWORD nArgs)
: m_nArgs(nArgs)
{
LIMITED_METHOD_DAC_CONTRACT;
DACCOP_IGNORE(CastOfMarshalledType, "Dual mode DAC problem, but since the size is the same, the cast is safe");
- m_pArgs = (FixupPointer<TypeHandle> *)pArgs;
+ m_pArgs = pArgs;
_ASSERTE(m_nArgs == 0 || m_pArgs != NULL);
}
#ifdef DACCESS_COMPILE
- // Construct instantiation from target array of FixupPointers in DAC.
// This method will create local copy of the instantiation arguments.
- Instantiation(DPTR(FixupPointer<TypeHandle>) pArgs, DWORD nArgs)
+ Instantiation(PTR_TypeHandle pArgs, DWORD nArgs)
{
LIMITED_METHOD_DAC_CONTRACT;
// Create a local copy of the instanitation under DAC
PVOID pLocalArgs = PTR_READ(dac_cast<TADDR>(pArgs), nArgs * sizeof(TypeHandle));
- m_pArgs = (FixupPointer<TypeHandle> *)pLocalArgs;
+ m_pArgs = (TypeHandle*)pLocalArgs;
m_nArgs = nArgs;
{
LIMITED_METHOD_DAC_CONTRACT;
_ASSERTE(iArg < m_nArgs);
- return m_pArgs[iArg].GetValue();
+ return m_pArgs[iArg];
}
DWORD GetNumArgs() const
}
// Unsafe access to the instantiation. Do not use unless absolutely necessary!!!
- FixupPointer<TypeHandle> * GetRawArgs() const
+ TypeHandle * GetRawArgs() const
{
LIMITED_METHOD_DAC_CONTRACT;
return m_pArgs;
private:
// Note that for DAC builds, m_pArgs may be host allocated buffer, not a copy of an object marshalled by DAC.
- FixupPointer<TypeHandle> * m_pArgs;
+ TypeHandle* m_pArgs;
DWORD m_nArgs;
};
}
else
{
- _ASSERTE(!m_pModule.IsNull());
+ _ASSERTE(m_pModule != NULL);
return GetModule()->GetLoaderAllocator();
}
}
PRECONDITION(!data.IsEncodedFixup());
PRECONDITION(!data.IsGenericTypeDefinition()); // Generic type defs live in typedef table (availableClasses)
PRECONDITION(data.HasInstantiation() || data.HasTypeParam() || data.IsFnPtrType()); // It's an instantiated type or an array/ptr/byref type
- PRECONDITION(m_pModule.IsNull() || GetModule()->IsTenured()); // Destruct won't destruct m_pAvailableParamTypes for non-tenured modules - so make sure no one tries to insert one before the Module has been tenured
+ PRECONDITION(m_pModule == NULL || GetModule()->IsTenured()); // Destruct won't destruct m_pAvailableParamTypes for non-tenured modules - so make sure no one tries to insert one before the Module has been tenured
}
CONTRACTL_END
// We plan to steal the low-order bit of the handle for ngen purposes.
_ASSERTE((handle.AsTAddr() & 0x1) == 0);
- m_data.SetValueMaybeNull(handle.AsPtr());
+ m_data = handle.AsPtr();
}
#endif // !DACCESS_COMPILE
#ifndef DACCESS_COMPILE
EETypeHashEntry& operator=(const EETypeHashEntry& src)
{
- m_data.SetValueMaybeNull(src.m_data.GetValueMaybeNull());
+ m_data = src.m_data;
return *this;
}
PTR_VOID GetData()
{
- return ReadPointerMaybeNull(this, &EETypeHashEntry::m_data);
+ return m_data;
}
private:
friend class NativeImageDumper;
#endif
- RelativePointer<PTR_VOID> m_data;
+ PTR_VOID m_data;
} EETypeHashEntry_t;
Module * m_pModule;
mdToken m_typeDef;
DWORD m_numGenericArgs; // 0 for non-generic types
- FixupPointer<TypeHandle> * m_pGenericArgs; // NULL for non-generic types
+ TypeHandle * m_pGenericArgs; // NULL for non-generic types
// Note that for DAC builds, m_pGenericArgs is a host allocated buffer (eg. by in SigPointer::GetTypeHandleThrowing),
// not a copy of an object marshalled by DAC.
} asClass;
}
for (DWORD i = 0; i < pKey1->u.asClass.m_numGenericArgs; i++)
{
- if (pKey1->u.asClass.m_pGenericArgs[i].GetValue() != pKey2->u.asClass.m_pGenericArgs[i].GetValue())
+ if (pKey1->u.asClass.m_pGenericArgs[i] != pKey2->u.asClass.m_pGenericArgs[i])
return FALSE;
}
return TRUE;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
- PRECONDITION(!MethodTable::VTableIndir_t::isRelative /* Not yet supported */);
POSTCONDITION(RETVAL != NULL);
} CONTRACT_END;
GC_TRIGGERS;
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
- PRECONDITION(!MethodTable::VTableIndir_t::isRelative /* Not yet supported */);
POSTCONDITION(RETVAL != NULL);
} CONTRACT_END;