return size;
}
- // its worth noting that the acutal order of insert here doesnt meet what you migth expect. Its using memcmp, so
+ // It's worth noting that the actual order of insertion here doesnt meet what you might expect. It's using memcmp, so
// since we are on a little endian machine we'd use the lowest 8 bits as the first part of the key. This is
// a side effect of using the same code for large structs and DWORDS etc...
bool Add(_Key key, _Item item)
return true;
}
+ void Update(int index, _Item item)
+ {
+ pItems[index] = item;
+ }
+
int GetIndex(_Key key)
{
AssertCodeMsg(this != nullptr, EXCEPTIONCODE_MC, "There is no such LWM (in GetIndex)");
key.A = (DWORDLONG)field;
key.B = (DWORDLONG)memberParent;
+ value.B = (DWORD)result;
if (structType == nullptr)
{
value.A = 0;
else
{
value.A = (DWORDLONG)*structType;
- }
- value.B = (DWORD)result;
+ // If we had a previous call with null 'structType', we will not have captured the
+ // class handle (we use only 'field' and 'memberParent' as keys).
+ // Update the value in that case.
+ unsigned index = GetFieldType->GetIndex(key);
+ if ((index != -1) && (GetFieldType->GetItem(index).A == 0))
+ {
+ GetFieldType->Update(index, value);
+ DEBUG_REC(dmpGetFieldType(key, value));
+ return;
+ }
+ }
GetFieldType->Add(key, value);
DEBUG_REC(dmpGetFieldType(key, value));
}
if (fieldSize == 0 || fieldSize > TARGET_POINTER_SIZE || varTypeIsFloating(fieldVarType))
{
JITDUMP("Promotion blocked: struct contains struct field with one field,"
- " but that field has invalid size or type");
+ " but that field has invalid size or type.\n");
return false;
}
if ((outerFieldOffset % fieldSize) != 0)
{
JITDUMP("Promotion blocked: struct contains struct field with one field,"
- " but the outer struct offset %u is not a multiple of the inner field size %u",
+ " but the outer struct offset %u is not a multiple of the inner field size %u.\n",
outerFieldOffset, fieldSize);
return false;
}
if (fieldSize != innerStructSize)
{
JITDUMP("Promotion blocked: struct contains struct field with one field,"
- " but that field is not the same size as its parent.");
+ " but that field is not the same size as its parent.\n");
return false;
}