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

Fixed const eval leaks

This commit is contained in:
Brian Fiete 2020-12-31 11:47:34 -08:00
parent 86b5e65015
commit a672b49dea

View file

@ -211,7 +211,8 @@ CeFunction::~CeFunction()
{
BF_ASSERT(mId == -1);
for (auto innerFunc : mInnerFunctions)
delete innerFunc;
delete innerFunc;
delete mCeInnerFunctionInfo;
}
//////////////////////////////////////////////////////////////////////////
@ -1209,17 +1210,6 @@ void CeBuilder::Build()
mCeMachine->MapFunctionId(innerFunction);
}
// for (int globalVarIdx = startGlobalVariableCount; globalVarIdx < (int)beModule->mGlobalVariables.size(); globalVarIdx++)
// {
// auto beGlobalVariable = beModule->mGlobalVariables[globalVarIdx];
// if (beGlobalVariable->mInitializer == NULL)
// continue;
//
// CeStaticFieldInfo* staticFieldInfoPtr = NULL;
// mCeMachine->mStaticFieldMap.TryAdd(beGlobalVariable->mName, NULL, &staticFieldInfoPtr);
// staticFieldInfoPtr->mBeConstant = beGlobalVariable;
// }
if (!mCeFunction->mCeFunctionInfo->mName.IsEmpty())
{
BF_ASSERT(mCeFunction->mCeFunctionInfo->mName == mBeFunction->mName);
@ -2645,9 +2635,8 @@ CeMachine::~CeMachine()
delete mCeModule;
delete mHeap;
for (auto kv : mFunctions)
auto _RemoveFunctionInfo = [&](CeFunctionInfo* functionInfo)
{
auto functionInfo = kv.mValue;
if (functionInfo->mCeFunction != NULL)
{
// We don't need to actually unmap it at this point
@ -2657,6 +2646,18 @@ CeMachine::~CeMachine()
}
delete functionInfo;
};
for (auto kv : mNamedFunctionMap)
{
if (kv.mValue->mMethodInstance == NULL)
_RemoveFunctionInfo(kv.mValue);
}
for (auto kv : mFunctions)
{
BF_ASSERT(kv.mValue != NULL);
_RemoveFunctionInfo(kv.mValue);
}
}