mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Fixed case where BfResolvedTypeSet inserts new types during Insert
This commit is contained in:
parent
c003557bef
commit
316e3f345f
2 changed files with 48 additions and 20 deletions
|
@ -11685,11 +11685,16 @@ BfType* BfModule::ResolveTypeRef_Ref(BfTypeReference* typeRef, BfPopulateType po
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sCallIdx = 0;
|
static int sCallIdx = 0;
|
||||||
int callIdx = sCallIdx++;
|
int callIdx = 0;
|
||||||
if (callIdx == 0x00006CA4)
|
|
||||||
|
if (!mCompiler->mIsResolveOnly)
|
||||||
|
{
|
||||||
|
callIdx = sCallIdx++;
|
||||||
|
if (callIdx == 0x0000A224)
|
||||||
{
|
{
|
||||||
NOP;
|
NOP;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BfResolvedTypeSet::LookupContext lookupCtx;
|
BfResolvedTypeSet::LookupContext lookupCtx;
|
||||||
lookupCtx.mResolveFlags = (BfResolveTypeRefFlags)(resolveFlags &
|
lookupCtx.mResolveFlags = (BfResolveTypeRefFlags)(resolveFlags &
|
||||||
|
|
|
@ -2831,8 +2831,15 @@ public:
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
int startAllocSize = mAllocSize;
|
||||||
int bucket = (hashVal & 0x7FFFFFFF) % mHashSize;
|
int bucket = (hashVal & 0x7FFFFFFF) % mHashSize;
|
||||||
auto checkEntryIdx = mHashHeads[bucket];
|
auto startEntryIdx = mHashHeads[bucket];
|
||||||
|
auto checkEntryIdx = startEntryIdx;
|
||||||
|
bool needsRerun = false;
|
||||||
|
|
||||||
while (checkEntryIdx != -1)
|
while (checkEntryIdx != -1)
|
||||||
{
|
{
|
||||||
auto checkEntry = &mEntries[checkEntryIdx];
|
auto checkEntry = &mEntries[checkEntryIdx];
|
||||||
|
@ -2844,6 +2851,15 @@ public:
|
||||||
*entryPtr = EntryRef(this, checkEntryIdx);
|
*entryPtr = EntryRef(this, checkEntryIdx);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((mAllocSize != startAllocSize) || (startEntryIdx != mHashHeads[bucket]))
|
||||||
|
{
|
||||||
|
// It's possible for Equals to add types, buckets could be invalid or a new type could
|
||||||
|
// have been inserted at the start of our bucket
|
||||||
|
needsRerun = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
checkEntryIdx = checkEntry->mNext;
|
checkEntryIdx = checkEntry->mNext;
|
||||||
|
|
||||||
tryCount++;
|
tryCount++;
|
||||||
|
@ -2855,6 +2871,13 @@ public:
|
||||||
BF_ASSERT(tryCount < 10);
|
BF_ASSERT(tryCount < 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!needsRerun)
|
||||||
|
{
|
||||||
|
// Retry if we added entries
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((ctx->mResolveFlags & BfResolveTypeRefFlag_NoCreate) != 0)
|
if ((ctx->mResolveFlags & BfResolveTypeRefFlag_NoCreate) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue