1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +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] [CallingConvention(.Stdcall), CLink]
static extern int32 BfCompiler_GetCurConstEvalExecuteId(void* bfCompiler); static extern int32 BfCompiler_GetCurConstEvalExecuteId(void* bfCompiler);
[CallingConvention(.Stdcall), CLink]
static extern bool BfCompiler_GetLastHadComptimeRebuilds(void* bfCompiler);
[CallingConvention(.Stdcall), CLink] [CallingConvention(.Stdcall), CLink]
static extern void BfCompiler_Delete(void* bfCompiler); 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) if (lastCompileHadMessages)
doCompile = true; doCompile = true;
bool needsComptime = true; bool needsComptime = bfCompiler.GetLastHadComptimeRebuilds();
for (var project in mWorkspace.mProjects)
{
//Set needsComptime
}
if ((!workspaceOptions.mIncrementalBuild) && (!lastCompileHadMessages)) if ((!workspaceOptions.mIncrementalBuild) && (!lastCompileHadMessages))
{ {

View file

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

View file

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

View file

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

View file

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

View file

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