| 9742 | } |
| 9743 | |
| 9744 | void CeMachine::RemoveMethod(BfMethodInstance* methodInstance) |
| 9745 | { |
| 9746 | BfLogSys(methodInstance->GetOwner()->mModule->mSystem, "CeMachine::RemoveMethod %p\n", methodInstance); |
| 9747 | |
| 9748 | mMethodBindRevision++; |
| 9749 | |
| 9750 | auto itr = mFunctions.Find(methodInstance); |
| 9751 | auto ceFunctionInfo = itr->mValue; |
| 9752 | BF_ASSERT(itr != mFunctions.end()); |
| 9753 | if (itr != mFunctions.end()) |
| 9754 | { |
| 9755 | if (ceFunctionInfo->mMethodInstance == methodInstance) |
| 9756 | { |
| 9757 | auto ceFunction = ceFunctionInfo->mCeFunction; |
| 9758 | for (auto& callEntry : ceFunction->mCallTable) |
| 9759 | { |
| 9760 | if (callEntry.mFunctionInfo != NULL) |
| 9761 | DerefMethodInfo(callEntry.mFunctionInfo); |
| 9762 | } |
| 9763 | if (ceFunction->mId != -1) |
| 9764 | { |
| 9765 | RemoveFunc(ceFunction); |
| 9766 | for (auto innerFunction : ceFunction->mInnerFunctions) |
| 9767 | RemoveFunc(innerFunction); |
| 9768 | } |
| 9769 | |
| 9770 | delete ceFunction; |
| 9771 | ceFunctionInfo->mCeFunction = NULL; |
| 9772 | ceFunctionInfo->mMethodInstance = NULL; |
| 9773 | |
| 9774 | if (methodInstance->mMethodDef->mIsLocalMethod) |
| 9775 | { |
| 9776 | // We can't rebuild these anyway |
| 9777 | } |
| 9778 | else if (ceFunctionInfo->mRefCount > 1) |
| 9779 | { |
| 9780 | // Generate a methodref |
| 9781 | ceFunctionInfo->mMethodRef = methodInstance; |
| 9782 | } |
| 9783 | |
| 9784 | DerefMethodInfo(ceFunctionInfo); |
| 9785 | } |
| 9786 | |
| 9787 | mFunctions.Remove(itr); |
| 9788 | } |
| 9789 | methodInstance->mInCEMachine = false; |
| 9790 | } |
| 9791 | |
| 9792 | CeErrorKind CeMachine::WriteConstant(CeConstStructData& data, BeConstant* constVal, CeContext* ceContext, CeBuilder* ceBuilder) |
| 9793 | { |