1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed method graveyard issue on canceled compile

This commit is contained in:
Brian Fiete 2021-10-22 11:48:33 -07:00
parent bfb5435ce3
commit 05dc68be03

View file

@ -2889,13 +2889,14 @@ void BfContext::Finish()
void BfContext::Cleanup()
{
BfLogSysM("BfContext::Cleanup() MethodWorkList: %d LocalMethodGraveyard: %d\n", mMethodWorkList.size(), mLocalMethodGraveyard.size());
// Can't clean up LLVM types, they are allocated with a bump allocator
RemoveInvalidFailTypes();
mCompiler->mCompileState = BfCompiler::CompileState_Cleanup;
// We can't remove the local methods if they still may be referenced by a BfMethodRefType used to specialize a method
if (mMethodWorkList.empty())
///
{
Array<BfLocalMethod*> survivingLocalMethods;
@ -2920,6 +2921,14 @@ void BfContext::Cleanup()
}
else if ((localMethod->mMethodInstanceGroup != NULL) && (localMethod->mMethodInstanceGroup->mRefCount > 0))
{
BfLogSysM("BfContext::Cleanup surviving local method with refs %p\n", localMethod);
localMethod->Dispose();
survivingLocalMethods.push_back(localMethod);
}
else if (!mMethodWorkList.empty())
{
// We can't remove the local methods if they still may be referenced by a BfMethodRefType used to specialize a method
BfLogSysM("BfContext::Cleanup surviving local method %p\n", localMethod);
localMethod->Dispose();
survivingLocalMethods.push_back(localMethod);
}