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

View file

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

View file

@ -8711,6 +8711,15 @@ BF_EXPORT int BF_CALLTYPE BfCompiler_GetCompileRevision(BfCompiler* bfCompiler)
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)
{
bfCompiler->Cancel();