diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index e913964c..0b7fcaf4 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -5106,6 +5106,12 @@ void BfCompiler::MarkStringPool(BfModule* module) stringPoolEntry.mLastUsedRevision = mRevision; } + for (int stringId : module->mUnreifiedStringPoolRefs) + { + BfStringPoolEntry& stringPoolEntry = module->mContext->mStringObjectIdMap[stringId]; + stringPoolEntry.mLastUsedRevision = mRevision; + } + for (int stringId : module->mImportFileNames) { BfStringPoolEntry& stringPoolEntry = module->mContext->mStringObjectIdMap[stringId]; diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 0f294eb0..7d1c7329 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -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 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(); mImportFileNames.Clear(); for (auto& pairVal : mDeferredMethodCallData) @@ -1657,7 +1660,10 @@ String* BfModule::GetStringPoolString(BfIRValue constantStr, BfIRConstHolder * c BfIRValue BfModule::GetStringCharPtr(int stringId, bool force) { if ((mBfIRBuilder->mIgnoreWrites) && (!force)) + { + mUnreifiedStringPoolRefs.Add(stringId); return mBfIRBuilder->CreateConst(BfTypeCode_StringId, stringId); + } BfIRValue* irValue = NULL; if (!mStringCharPtrPool.TryAdd(stringId, NULL, &irValue)) @@ -1711,6 +1717,7 @@ BfIRValue BfModule::GetStringObjectValue(const StringImpl& str, bool define, boo if ((mBfIRBuilder->mIgnoreWrites) && (!force)) { + mUnreifiedStringPoolRefs.Add(strId); return mBfIRBuilder->CreateConst(BfTypeCode_StringId, strId); } @@ -10658,6 +10665,7 @@ void BfModule::ClearConstData() mStringObjectPool.Clear(); mStringCharPtrPool.Clear(); mStringPoolRefs.Clear(); + mUnreifiedStringPoolRefs.Clear(); } BfTypedValue BfModule::GetTypedValueFromConstant(BfConstant* constant, BfIRConstHolder* constHolder, BfType* wantType) diff --git a/IDEHelper/Compiler/BfModule.h b/IDEHelper/Compiler/BfModule.h index 881944c0..5ae6babe 100644 --- a/IDEHelper/Compiler/BfModule.h +++ b/IDEHelper/Compiler/BfModule.h @@ -1435,6 +1435,7 @@ public: Dictionary mStringObjectPool; Dictionary mStringCharPtrPool; Array mStringPoolRefs; + HashSet mUnreifiedStringPoolRefs; Array mPrevIRBuilders; // Before extensions BfIRBuilder* mBfIRBuilder;