1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Comptime rebuild flag

This commit is contained in:
Brian Fiete 2021-12-20 09:52:29 -05:00
parent ce4b6e04de
commit 4f83b61a10
7 changed files with 30 additions and 7 deletions

View file

@ -76,6 +76,9 @@ namespace IDE.Compiler
[CallingConvention(.Stdcall), CLink]
static extern int32 BfCompiler_GetCurConstEvalExecuteId(void* bfCompiler);
[CallingConvention(.Stdcall), CLink]
static extern bool BfCompiler_GetLastHadComptimeRebuilds(void* bfCompiler);
[CallingConvention(.Stdcall), CLink]
static extern void BfCompiler_Delete(void* bfCompiler);
@ -834,5 +837,10 @@ namespace IDE.Compiler
}
}
}
public bool GetLastHadComptimeRebuilds()
{
return BfCompiler_GetLastHadComptimeRebuilds(mNativeBfCompiler);
}
}
}

View file

@ -9168,11 +9168,7 @@ namespace IDE
if (lastCompileHadMessages)
doCompile = true;
bool needsComptime = true;
for (var project in mWorkspace.mProjects)
{
//Set needsComptime
}
bool needsComptime = bfCompiler.GetLastHadComptimeRebuilds();
if ((!workspaceOptions.mIncrementalBuild) && (!lastCompileHadMessages))
{

View file

@ -360,6 +360,8 @@ BfCompiler::BfCompiler(BfSystem* bfSystem, bool isResolveOnly)
//mMaxInterfaceSlots = 16;
mMaxInterfaceSlots = -1;
mInterfaceSlotCountChanged = false;
mLastHadComptimeRebuilds = false;
mHasComptimeRebuilds = false;
mHSPreserveIdx = 0;
mCompileLogFP = NULL;
@ -6561,6 +6563,7 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
// Inc revision for next run through Compile
mRevision++;
mHasComptimeRebuilds = false;
int revision = mRevision;
BfLogSysM("Compile Start. Revision: %d. HasParser:%d AutoComplete:%d\n", revision,
(mResolvePassData != NULL) && (mResolvePassData->mParser != NULL),
@ -7494,6 +7497,11 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
return false;
}
if (didCancel)
mLastHadComptimeRebuilds = mHasComptimeRebuilds || mLastHadComptimeRebuilds;
else
mLastHadComptimeRebuilds = mHasComptimeRebuilds;
return !didCancel && !mHasQueuedTypeRebuilds;
}
@ -9081,6 +9089,11 @@ BF_EXPORT int BF_CALLTYPE BfCompiler_GetCurConstEvalExecuteId(BfCompiler* bfComp
return bfCompiler->mCEMachine->mExecuteId;
}
BF_EXPORT float BF_CALLTYPE BfCompiler_GetLastHadComptimeRebuilds(BfCompiler* bfCompiler)
{
return bfCompiler->mLastHadComptimeRebuilds;
}
BF_EXPORT void BF_CALLTYPE BfCompiler_Cancel(BfCompiler* bfCompiler)
{
bfCompiler->Cancel();

View file

@ -329,6 +329,8 @@ public:
bool mHasQueuedTypeRebuilds; // Infers we had a fast finish that requires a type rebuild
bool mHadCancel;
bool mWantsDeferMethodDecls;
bool mLastHadComptimeRebuilds;
bool mHasComptimeRebuilds;
bool mInInvalidState;
float mCompletionPct;
int mHSPreserveIdx;

View file

@ -1947,6 +1947,7 @@ void BfContext::UpdateRevisedTypes()
for (auto& kv : typeInst->mCeTypeInfo->mRebuildMap)
{
mCompiler->mHasComptimeRebuilds = true;
if (kv.mKey.mKind == CeRebuildKey::Kind_File)
{
String* keyPtr = NULL;

View file

@ -3031,6 +3031,7 @@ void CeContext::AddRebuild(const CeRebuildKey& key, const CeRebuildValue& value)
if (mCurModule->mCurTypeInstance->mCeTypeInfo == NULL)
mCurModule->mCurTypeInstance->mCeTypeInfo = new BfCeTypeInfo();
mCurModule->mCurTypeInstance->mCeTypeInfo->mRebuildMap[key] = value;
mCurModule->mCompiler->mHasComptimeRebuilds = true;
}
uint8* CeContext::CeMalloc(int size)

View file

@ -231,6 +231,7 @@ namespace Tests
}
const String cTest0 = Compiler.ReadText("Test0.txt");
const uint8[?] cTest0Binary = Compiler.ReadBinary("Test0.txt");
[Test]
public static void TestBasics()
@ -274,6 +275,7 @@ namespace Tests
Test.Assert(serCtx.mStr == "x 10\ny 2\n");
Test.Assert(cTest0 == "Test\n0");
Test.Assert((cTest0Binary[0] == (.)'T') && ((cTest0Binary.Count == 6) || (cTest0Binary.Count == 7)));
}
}
}