1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed hotswap error zeroing libs, fixed indexer type lookup errors

This commit is contained in:
Brian Fiete 2020-04-13 06:41:54 -07:00
parent e2a6a122c4
commit 766b274426
4 changed files with 30 additions and 23 deletions

View file

@ -14739,7 +14739,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX;
mDebugging = function->mName == "?Hey@Blurg@bf@@SAXXZ";
//mDebugging = function->mName == "?Hey@Blurg@bf@@SAXXZ";
//"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z";
//"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z";

View file

@ -449,7 +449,7 @@ void BfCodeGenThread::RunLoop()
DoBfLog(2, "Generating obj %s\n", request->mOutFileName.c_str());
BeCOFFObject coffObject;
coffObject.mWriteToLib = (request->mOptions.mWriteToLib) && (!request->mOptions.mIsHotCompile);
coffObject.mWriteToLib = request->mOptions.mWriteToLib;
if (!coffObject.Generate(beIRCodeGen->mBeModule, objFileName))
errorMsg = StrFormat("Failed to write object file: %s", objFileName.c_str());

View file

@ -3949,7 +3949,15 @@ void BfCompiler::ProcessAutocompleteTempType()
auto propDeclaration = BfNodeDynCast<BfPropertyDeclaration>(propDef->mFieldDeclaration);
if (propDeclaration != NULL)
autoComplete->CheckProperty(propDeclaration);
module->ResolveTypeRef(propDef->mTypeRef, BfPopulateType_Data, BfResolveTypeRefFlag_AllowRef);
module->ResolveTypeRef(propDef->mTypeRef, BfPopulateType_Identity, BfResolveTypeRefFlag_AllowRef);
if (auto indexerDeclaration = BfNodeDynCast<BfIndexerDeclaration>(propDef->mFieldDeclaration))
{
for (auto paramDecl : indexerDeclaration->mParams)
{
module->ResolveTypeRef(paramDecl->mTypeRef, BfPopulateType_Identity);
}
}
if ((autoComplete->mIsGetDefinition) && (propDef->mFieldDeclaration != NULL) && (autoComplete->IsAutocompleteNode(propDef->mFieldDeclaration->mNameNode)))
{
@ -6520,19 +6528,24 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
#ifdef BF_PLATFORM_WINDOWS
if (!mIsResolveOnly)
{
for (auto mainModule : mContext->mModules)
{
BfModule* bfModule = mainModule;
if (bfModule->mIsReified)
{
if (!IsHotCompile())
{
// Remove individually-written object files from any libs that previously had them,
// in the case that lib settings changed (ie: switching a module from Og+ to O0)
for (auto mainModule : mContext->mModules)
{
for (auto outFileName : bfModule->mOutFileNames)
BfModule* bfModule = mainModule;
if (bfModule->mIsReified)
{
if (outFileName.mModuleWritten)
BeLibManager::Get()->AddUsedFileName(outFileName.mFileName);
for (auto outFileName : bfModule->mOutFileNames)
{
if (outFileName.mModuleWritten)
BeLibManager::Get()->AddUsedFileName(outFileName.mFileName);
}
}
}
}
}
auto libManager = BeLibManager::Get();
libManager->Finish();

View file

@ -19350,7 +19350,6 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
bool wasGenericParam = false;
if (resolvedParamType == NULL)
{
SetAndRestoreValue<bool> prevIngoreErrors(mIgnoreErrors, mIgnoreErrors || (methodDef->GetPropertyDeclaration() != NULL));
resolvedParamType = ResolveTypeRef(paramDef->mTypeRef, BfPopulateType_Declaration,
(BfResolveTypeRefFlags)(BfResolveTypeRefFlag_NoResolveGenericParam | BfResolveTypeRefFlag_AllowRef | BfResolveTypeRefFlag_AllowRefGeneric | BfResolveTypeRefFlag_AllowGenericMethodParamConstValue));
}
@ -21011,7 +21010,8 @@ bool BfModule::Finish()
mCompiler->mStats.mConstBytes += mBfIRBuilder->mTempAlloc.GetAllocSize();
bool allowWriteToLib = true;
if ((allowWriteToLib) && (codeGenOptions.mOptLevel == BfOptLevel_OgPlus) && (mModuleName != "vdata"))
if ((allowWriteToLib) && (codeGenOptions.mOptLevel == BfOptLevel_OgPlus) &&
(!mCompiler->IsHotCompile()) && (mModuleName != "vdata"))
{
codeGenOptions.mWriteToLib = true;
mWroteToLib = true;
@ -21065,15 +21065,9 @@ bool BfModule::Finish()
if (mCompiler->IsHotCompile())
{
codeGenOptions.mIsHotCompile = true;
//TODO: Why did we have this 'mWroteToLib' check? 'vdata' didn't get this flag set, which
// is required for rebuilding vdata after we hot create a vdata
//if (mWroteToLib)
{
if (mParentModule != NULL)
mParentModule->mHadHotObjectWrites = true;
mHadHotObjectWrites = true;
}
if (mParentModule != NULL)
mParentModule->mHadHotObjectWrites = true;
mHadHotObjectWrites = true;
}