In the 64-bit implementation, we now use one more bit in the method table pointer, so SOS needs to mask out one more bit as well.
Update SOS_BREAKING_CHANGE_VERSION to 2, so users get a warning if they are using an older SOS. This should almost always work just fine though, as the new bit is only set in rare cases during plan_phase.
static MethodTableInfo* GetMethodTableInfo(DWORD_PTR dwAddrMethTable)
{
// Remove lower bits in case we are in mark phase
- dwAddrMethTable = dwAddrMethTable & ~3;
+ dwAddrMethTable = dwAddrMethTable & ~sos::Object::METHODTABLE_PTR_LOW_BITMASK;
MethodTableInfo* info = g_special_mtCache.Lookup(dwAddrMethTable);
if (!info->IsInitialized()) // An uninitialized entry
{
return FALSE;
}
- dwAddrMethTable = dwAddrMethTable & ~3;
+ dwAddrMethTable = dwAddrMethTable & ~sos::Object::METHODTABLE_PTR_LOW_BITMASK;
if (dwAddrMethTable == 0)
{
// Is this the beginning of an allocation context?
return FALSE;
}
- dwAddrMethTable = dwAddrMethTable & ~3;
+ dwAddrMethTable = dwAddrMethTable & ~sos::Object::METHODTABLE_PTR_LOW_BITMASK;
BOOL bContainsPointers;
BOOL bMTOk = GetSizeEfficient(dwAddrCurrObj, dwAddrMethTable, TRUE, s, bContainsPointers);
if (verify && bMTOk)
if (temp == NULL)
sos::Throw<HeapCorruption>("Object %s has an invalid method table.", DMLListNearObj(mAddress));
- mMT = temp & ~3;
+ mMT = temp & ~METHODTABLE_PTR_LOW_BITMASK;
}
return mMT;
sos::Throw<DataRead>("Failed to request object data for %s.", DMLListNearObj(mAddress));
if (mMT == NULL)
- mMT = TO_TADDR(objData.MethodTable) & ~3;
+ mMT = TO_TADDR(objData.MethodTable) & ~METHODTABLE_PTR_LOW_BITMASK;
return TO_TADDR(objData.ElementTypeHandle);
}
#endif
}
+ // GC uses the low bits of the method table ptr in objects to store information
+ // it uses one more bit in the 64-bit implementations for the doubly linked free lists
+ static const size_t METHODTABLE_PTR_LOW_BITMASK =
+#ifdef _TARGET_WIN64_
+ 7;
+#else
+ 3;
+#endif
+
public:
/* Constructor. Use Object(TADDR, TADDR) instead if you know the method table.
* Parameters:
// Increment anytime there is a change in the data structures that SOS depends on like
// stress log structs (StressMsg, StressLogChunck, ThreadStressLog, etc), exception
// stack traces (StackTraceElement), the PredefinedTlsSlots enums, etc.
-cpp_quote("#define SOS_BREAKING_CHANGE_VERSION 1")
+cpp_quote("#define SOS_BREAKING_CHANGE_VERSION 2")
[
object,
/* interface __MIDL_itf_sospriv_0000_0012 */
/* [local] */
-#define SOS_BREAKING_CHANGE_VERSION 1
+#define SOS_BREAKING_CHANGE_VERSION 2
extern RPC_IF_HANDLE __MIDL_itf_sospriv_0000_0012_v0_0_c_ifspec;