mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Unreified string table reference fix
This commit is contained in:
parent
e6a918600b
commit
a31770ca98
3 changed files with 16 additions and 1 deletions
|
@ -5106,6 +5106,12 @@ void BfCompiler::MarkStringPool(BfModule* module)
|
||||||
stringPoolEntry.mLastUsedRevision = mRevision;
|
stringPoolEntry.mLastUsedRevision = mRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int stringId : module->mUnreifiedStringPoolRefs)
|
||||||
|
{
|
||||||
|
BfStringPoolEntry& stringPoolEntry = module->mContext->mStringObjectIdMap[stringId];
|
||||||
|
stringPoolEntry.mLastUsedRevision = mRevision;
|
||||||
|
}
|
||||||
|
|
||||||
for (int stringId : module->mImportFileNames)
|
for (int stringId : module->mImportFileNames)
|
||||||
{
|
{
|
||||||
BfStringPoolEntry& stringPoolEntry = module->mContext->mStringObjectIdMap[stringId];
|
BfStringPoolEntry& stringPoolEntry = module->mContext->mStringObjectIdMap[stringId];
|
||||||
|
|
|
@ -1222,7 +1222,10 @@ void BfModule::StartNewRevision(RebuildKind rebuildKind, bool force)
|
||||||
|
|
||||||
// Clear this here, not in ClearModuleData, so we preserve those references even after writing out module
|
// Clear this here, not in ClearModuleData, so we preserve those references even after writing out module
|
||||||
if (rebuildKind != BfModule::RebuildKind_None) // Leave string pool refs for when we need to use things like [LinkName("")] methods bofore re-reification
|
if (rebuildKind != BfModule::RebuildKind_None) // Leave string pool refs for when we need to use things like [LinkName("")] methods bofore re-reification
|
||||||
|
{
|
||||||
mStringPoolRefs.Clear();
|
mStringPoolRefs.Clear();
|
||||||
|
mUnreifiedStringPoolRefs.Clear();
|
||||||
|
}
|
||||||
mDllImportEntries.Clear();
|
mDllImportEntries.Clear();
|
||||||
mImportFileNames.Clear();
|
mImportFileNames.Clear();
|
||||||
for (auto& pairVal : mDeferredMethodCallData)
|
for (auto& pairVal : mDeferredMethodCallData)
|
||||||
|
@ -1657,7 +1660,10 @@ String* BfModule::GetStringPoolString(BfIRValue constantStr, BfIRConstHolder * c
|
||||||
BfIRValue BfModule::GetStringCharPtr(int stringId, bool force)
|
BfIRValue BfModule::GetStringCharPtr(int stringId, bool force)
|
||||||
{
|
{
|
||||||
if ((mBfIRBuilder->mIgnoreWrites) && (!force))
|
if ((mBfIRBuilder->mIgnoreWrites) && (!force))
|
||||||
|
{
|
||||||
|
mUnreifiedStringPoolRefs.Add(stringId);
|
||||||
return mBfIRBuilder->CreateConst(BfTypeCode_StringId, stringId);
|
return mBfIRBuilder->CreateConst(BfTypeCode_StringId, stringId);
|
||||||
|
}
|
||||||
|
|
||||||
BfIRValue* irValue = NULL;
|
BfIRValue* irValue = NULL;
|
||||||
if (!mStringCharPtrPool.TryAdd(stringId, NULL, &irValue))
|
if (!mStringCharPtrPool.TryAdd(stringId, NULL, &irValue))
|
||||||
|
@ -1711,6 +1717,7 @@ BfIRValue BfModule::GetStringObjectValue(const StringImpl& str, bool define, boo
|
||||||
|
|
||||||
if ((mBfIRBuilder->mIgnoreWrites) && (!force))
|
if ((mBfIRBuilder->mIgnoreWrites) && (!force))
|
||||||
{
|
{
|
||||||
|
mUnreifiedStringPoolRefs.Add(strId);
|
||||||
return mBfIRBuilder->CreateConst(BfTypeCode_StringId, strId);
|
return mBfIRBuilder->CreateConst(BfTypeCode_StringId, strId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10658,6 +10665,7 @@ void BfModule::ClearConstData()
|
||||||
mStringObjectPool.Clear();
|
mStringObjectPool.Clear();
|
||||||
mStringCharPtrPool.Clear();
|
mStringCharPtrPool.Clear();
|
||||||
mStringPoolRefs.Clear();
|
mStringPoolRefs.Clear();
|
||||||
|
mUnreifiedStringPoolRefs.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
BfTypedValue BfModule::GetTypedValueFromConstant(BfConstant* constant, BfIRConstHolder* constHolder, BfType* wantType)
|
BfTypedValue BfModule::GetTypedValueFromConstant(BfConstant* constant, BfIRConstHolder* constHolder, BfType* wantType)
|
||||||
|
|
|
@ -1435,6 +1435,7 @@ public:
|
||||||
Dictionary<int, BfIRValue> mStringObjectPool;
|
Dictionary<int, BfIRValue> mStringObjectPool;
|
||||||
Dictionary<int, BfIRValue> mStringCharPtrPool;
|
Dictionary<int, BfIRValue> mStringCharPtrPool;
|
||||||
Array<int> mStringPoolRefs;
|
Array<int> mStringPoolRefs;
|
||||||
|
HashSet<int> mUnreifiedStringPoolRefs;
|
||||||
|
|
||||||
Array<BfIRBuilder*> mPrevIRBuilders; // Before extensions
|
Array<BfIRBuilder*> mPrevIRBuilders; // Before extensions
|
||||||
BfIRBuilder* mBfIRBuilder;
|
BfIRBuilder* mBfIRBuilder;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue