1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 05:14:10 +02:00

Fixed slow const eval detection

This commit is contained in:
Brian Fiete 2020-12-24 07:45:58 -08:00
parent 73b643d298
commit 0952f3f278
4 changed files with 29 additions and 12 deletions

View file

@ -70,6 +70,9 @@ namespace IDE.Compiler
[CallingConvention(.Stdcall), CLink] [CallingConvention(.Stdcall), CLink]
static extern int32 BfCompiler_GetCompileRevision(void* bfCompiler); static extern int32 BfCompiler_GetCompileRevision(void* bfCompiler);
[CallingConvention(.Stdcall), CLink]
static extern int32 BfCompiler_GetCurConstEvalExecuteId(void* bfCompiler);
[CallingConvention(.Stdcall), CLink] [CallingConvention(.Stdcall), CLink]
static extern void BfCompiler_Delete(void* bfCompiler); static extern void BfCompiler_Delete(void* bfCompiler);
@ -670,6 +673,11 @@ namespace IDE.Compiler
return BfCompiler_GetCompileRevision(mNativeBfCompiler); return BfCompiler_GetCompileRevision(mNativeBfCompiler);
} }
public int32 GetCurConstEvalExecuteId()
{
return BfCompiler_GetCurConstEvalExecuteId(mNativeBfCompiler);
}
public void GetTypeDefList(String outStr) public void GetTypeDefList(String outStr)
{ {
outStr.Append(BfCompiler_GetTypeDefList(mNativeBfCompiler)); outStr.Append(BfCompiler_GetTypeDefList(mNativeBfCompiler));

View file

@ -26,8 +26,8 @@ namespace IDE.ui
public int mDirtyDelay; public int mDirtyDelay;
public int mStatusBoxUpdateCnt = -1; public int mStatusBoxUpdateCnt = -1;
public int32 mResolveStuckTicks; public int32 mResolveConstEvalStuckTicks;
public float mResolveLastPct = -1; public float mResolveLastConstEvalExecuteId = -1;
public this() public this()
{ {
@ -228,19 +228,19 @@ namespace IDE.ui
#endif #endif
) )
{ {
float completionPct = gApp.mBfResolveCompiler.GetCompletionPercentage(); int32 executeId = gApp.mBfResolveCompiler.GetCurConstEvalExecuteId();
if (completionPct != mResolveLastPct) if (executeId != mResolveLastConstEvalExecuteId)
{ {
mResolveStuckTicks = 0; mResolveConstEvalStuckTicks = 0;
mResolveLastPct = completionPct; mResolveLastConstEvalExecuteId = executeId;
} }
else else if (executeId != -1)
mResolveStuckTicks++; mResolveConstEvalStuckTicks++;
MarkDirtyEx(); MarkDirtyEx();
} }
else else
mResolveStuckTicks = 0; mResolveConstEvalStuckTicks = 0;
} }
public override void Draw(Graphics g) public override void Draw(Graphics g)
@ -394,7 +394,7 @@ namespace IDE.ui
{ {
DrawStatusBox("Custom Build Commands...", gApp.mBuildContext.mUpdateCnt); DrawStatusBox("Custom Build Commands...", gApp.mBuildContext.mUpdateCnt);
} }
else if (mResolveStuckTicks > 300) else if (mResolveConstEvalStuckTicks > 300)
{ {
DrawStatusBox("Const Evaluation"); DrawStatusBox("Const Evaluation");
} }

View file

@ -8711,6 +8711,15 @@ BF_EXPORT int BF_CALLTYPE BfCompiler_GetCompileRevision(BfCompiler* bfCompiler)
return bfCompiler->mRevision; return bfCompiler->mRevision;
} }
BF_EXPORT int BF_CALLTYPE BfCompiler_GetCurConstEvalExecuteId(BfCompiler* bfCompiler)
{
if (bfCompiler->mCEMachine == NULL)
return -1;
if (bfCompiler->mCEMachine->mCurMethodInstance == NULL)
return -1;
return bfCompiler->mCEMachine->mExecuteId;
}
BF_EXPORT void BF_CALLTYPE BfCompiler_Cancel(BfCompiler* bfCompiler) BF_EXPORT void BF_CALLTYPE BfCompiler_Cancel(BfCompiler* bfCompiler)
{ {
bfCompiler->Cancel(); bfCompiler->Cancel();

View file

@ -419,7 +419,7 @@ public:
int mCurTypeId; int mCurTypeId;
int mTypeInitCount; int mTypeInitCount;
String mOutputPath; String mOutputPath;
Array<BfType*> mGenericInstancePurgatory; Array<BfType*> mGenericInstancePurgatory;
Array<int> mTypeIdFreeList; Array<int> mTypeIdFreeList;
@ -436,7 +436,7 @@ public:
BfIRFunction CreateLoadSharedLibraries(BfVDataModule* bfModule, Array<BfMethodInstance*>& dllMethods); BfIRFunction CreateLoadSharedLibraries(BfVDataModule* bfModule, Array<BfMethodInstance*>& dllMethods);
void GetTestMethods(BfVDataModule* bfModule, Array<TestMethod>& testMethods, HashContext& vdataHashCtx); void GetTestMethods(BfVDataModule* bfModule, Array<TestMethod>& testMethods, HashContext& vdataHashCtx);
void EmitTestMethod(BfVDataModule* bfModule, Array<TestMethod>& testMethods, BfIRValue& retValue); void EmitTestMethod(BfVDataModule* bfModule, Array<TestMethod>& testMethods, BfIRValue& retValue);
void CreateVData(BfVDataModule* bfModule); void CreateVData(BfVDataModule* bfModule);
void UpdateDependencyMap(bool deleteUnusued, bool& didWork); void UpdateDependencyMap(bool deleteUnusued, bool& didWork);
void ProcessPurgatory(bool reifiedOnly); void ProcessPurgatory(bool reifiedOnly);
bool VerifySlotNums(); bool VerifySlotNums();