mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Removed inline requests during vdata building
This commit is contained in:
parent
2f8f936657
commit
92ccadce1e
4 changed files with 17 additions and 13 deletions
|
@ -616,6 +616,9 @@ bool BfContext::ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods)
|
||||||
auto module = workItem.mFromModule;
|
auto module = workItem.mFromModule;
|
||||||
auto methodInstance = workItem.mMethodInstance;
|
auto methodInstance = workItem.mMethodInstance;
|
||||||
|
|
||||||
|
BF_ASSERT(module->mIsModuleMutable);
|
||||||
|
module->PrepareForIRWriting(methodInstance->GetOwner());
|
||||||
|
|
||||||
workIdx = mInlineMethodWorkList.RemoveAt(workIdx);
|
workIdx = mInlineMethodWorkList.RemoveAt(workIdx);
|
||||||
|
|
||||||
BfLogSysM("Module %p inlining method %p into func:%p\n", module, methodInstance, workItem.mFunc);
|
BfLogSysM("Module %p inlining method %p into func:%p\n", module, methodInstance, workItem.mFunc);
|
||||||
|
@ -647,7 +650,8 @@ bool BfContext::ProcessWorkList(bool onlyReifiedTypes, bool onlyReifiedMethods)
|
||||||
module->mBfIRBuilder->Func_SetLinkage(workItem.mFunc, BfIRLinkageType_Internal);
|
module->mBfIRBuilder->Func_SetLinkage(workItem.mFunc, BfIRLinkageType_Internal);
|
||||||
|
|
||||||
BF_ASSERT(module->mContext == this);
|
BF_ASSERT(module->mContext == this);
|
||||||
BF_ASSERT(module->mIsModuleMutable);
|
BF_ASSERT(module->mIsModuleMutable);
|
||||||
|
|
||||||
if (module->WantsFinishModule())
|
if (module->WantsFinishModule())
|
||||||
{
|
{
|
||||||
BfLogSysM("Module finished: %s (from inlining)\n", module->mModuleName.c_str());
|
BfLogSysM("Module finished: %s (from inlining)\n", module->mModuleName.c_str());
|
||||||
|
|
|
@ -4412,7 +4412,7 @@ BfIRValue BfModule::CreateClassVDataExtGlobal(BfTypeInstance* declTypeInst, BfTy
|
||||||
if ((methodInstance != NULL) && (!methodInstance->mMethodDef->mIsAbstract))
|
if ((methodInstance != NULL) && (!methodInstance->mMethodDef->mIsAbstract))
|
||||||
{
|
{
|
||||||
BF_ASSERT(implTypeInst->IsTypeMemberAccessible(methodInstance->mMethodDef->mDeclaringType, mProject));
|
BF_ASSERT(implTypeInst->IsTypeMemberAccessible(methodInstance->mMethodDef->mDeclaringType, mProject));
|
||||||
auto moduleMethodInst = GetMethodInstanceAtIdx(methodInstance->mMethodInstanceGroup->mOwner, methodInstance->mMethodInstanceGroup->mMethodIdx);
|
auto moduleMethodInst = GetMethodInstanceAtIdx(methodInstance->mMethodInstanceGroup->mOwner, methodInstance->mMethodInstanceGroup->mMethodIdx, NULL, BfGetMethodInstanceFlag_NoInline);
|
||||||
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
||||||
vValue = funcPtr;
|
vValue = funcPtr;
|
||||||
}
|
}
|
||||||
|
@ -5023,7 +5023,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
if ((methodInstance != NULL) && (!methodInstance->mMethodDef->mIsAbstract))
|
if ((methodInstance != NULL) && (!methodInstance->mMethodDef->mIsAbstract))
|
||||||
{
|
{
|
||||||
BF_ASSERT(typeInstance->IsTypeMemberAccessible(methodInstance->mMethodDef->mDeclaringType, mProject));
|
BF_ASSERT(typeInstance->IsTypeMemberAccessible(methodInstance->mMethodDef->mDeclaringType, mProject));
|
||||||
moduleMethodInst = GetMethodInstanceAtIdx(methodInstance->mMethodInstanceGroup->mOwner, methodInstance->mMethodInstanceGroup->mMethodIdx);
|
moduleMethodInst = GetMethodInstanceAtIdx(methodInstance->mMethodInstanceGroup->mOwner, methodInstance->mMethodInstanceGroup->mMethodIdx, NULL, BfGetMethodInstanceFlag_NoInline);
|
||||||
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
||||||
vValue = funcPtr;
|
vValue = funcPtr;
|
||||||
}
|
}
|
||||||
|
@ -5118,7 +5118,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
BF_ASSERT(methodInstance->mIsReified);
|
BF_ASSERT(methodInstance->mIsReified);
|
||||||
// This doesn't work because we may have FOREIGN methods from implicit interface methods
|
// This doesn't work because we may have FOREIGN methods from implicit interface methods
|
||||||
//auto moduleMethodInst = GetMethodInstanceAtIdx(methodRef.mTypeInstance, methodRef.mMethodNum);
|
//auto moduleMethodInst = GetMethodInstanceAtIdx(methodRef.mTypeInstance, methodRef.mMethodNum);
|
||||||
auto moduleMethodInst = ReferenceExternalMethodInstance(methodInstance);
|
auto moduleMethodInst = ReferenceExternalMethodInstance(methodInstance, BfGetMethodInstanceFlag_NoInline);
|
||||||
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
||||||
pushValue = funcPtr;
|
pushValue = funcPtr;
|
||||||
}
|
}
|
||||||
|
@ -5173,7 +5173,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
BF_ASSERT(methodInstance->mIsReified);
|
BF_ASSERT(methodInstance->mIsReified);
|
||||||
// This doesn't work because we may have FOREIGN methods from implicit interface methods
|
// This doesn't work because we may have FOREIGN methods from implicit interface methods
|
||||||
//auto moduleMethodInst = GetMethodInstanceAtIdx(methodRef.mTypeInstance, methodRef.mMethodNum);
|
//auto moduleMethodInst = GetMethodInstanceAtIdx(methodRef.mTypeInstance, methodRef.mMethodNum);
|
||||||
auto moduleMethodInst = ReferenceExternalMethodInstance(methodInstance);
|
auto moduleMethodInst = ReferenceExternalMethodInstance(methodInstance, BfGetMethodInstanceFlag_NoInline);
|
||||||
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
auto funcPtr = mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, voidPtrIRType);
|
||||||
|
|
||||||
int idx = checkIFace.mStartVirtualIdx + ifaceMethodInstance->mVirtualTableIdx;
|
int idx = checkIFace.mStartVirtualIdx + ifaceMethodInstance->mVirtualTableIdx;
|
||||||
|
@ -5901,7 +5901,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
(!methodDef->mIsAbstract) &&
|
(!methodDef->mIsAbstract) &&
|
||||||
(methodDef->mGenericParams.size() == 0))
|
(methodDef->mGenericParams.size() == 0))
|
||||||
{
|
{
|
||||||
moduleMethodInstance = GetMethodInstanceAtIdx(typeInstance, methodIdx);
|
moduleMethodInstance = GetMethodInstanceAtIdx(typeInstance, methodIdx, NULL, BfGetMethodInstanceFlag_NoInline);
|
||||||
if (moduleMethodInstance.mFunc)
|
if (moduleMethodInstance.mFunc)
|
||||||
funcVal = mBfIRBuilder->CreateBitCast(moduleMethodInstance.mFunc, voidPtrIRType);
|
funcVal = mBfIRBuilder->CreateBitCast(moduleMethodInstance.mFunc, voidPtrIRType);
|
||||||
}
|
}
|
||||||
|
@ -9135,7 +9135,7 @@ BfIRValue BfModule::CreateFunctionFrom(BfMethodInstance* methodInstance, bool tr
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
BfModuleMethodInstance BfModule::GetMethodInstanceAtIdx(BfTypeInstance* typeInstance, int methodIdx, const char* assertName)
|
BfModuleMethodInstance BfModule::GetMethodInstanceAtIdx(BfTypeInstance* typeInstance, int methodIdx, const char* assertName, BfGetMethodInstanceFlags flags)
|
||||||
{
|
{
|
||||||
if (assertName != NULL)
|
if (assertName != NULL)
|
||||||
{
|
{
|
||||||
|
@ -9159,7 +9159,7 @@ BfModuleMethodInstance BfModule::GetMethodInstanceAtIdx(BfTypeInstance* typeInst
|
||||||
return BfModuleMethodInstance(methodInstance, func);
|
return BfModuleMethodInstance(methodInstance, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetMethodInstance(typeInstance, typeInstance->mTypeDef->mMethods[methodIdx], BfTypeVector());
|
return GetMethodInstance(typeInstance, typeInstance->mTypeDef->mMethods[methodIdx], BfTypeVector(), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
BfModuleMethodInstance BfModule::GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, int paramCount, bool checkBase)
|
BfModuleMethodInstance BfModule::GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, int paramCount, bool checkBase)
|
||||||
|
@ -11197,7 +11197,7 @@ BfModuleMethodInstance BfModule::ReferenceExternalMethodInstance(BfMethodInstanc
|
||||||
mFuncReferences[methodRef] = func;
|
mFuncReferences[methodRef] = func;
|
||||||
BfLogSysM("Adding func reference. Module:%p MethodInst:%p NewLLVMFunc:%d OldLLVMFunc:%d\n", this, methodInstance, func.mId, methodInstance->mIRFunction.mId);
|
BfLogSysM("Adding func reference. Module:%p MethodInst:%p NewLLVMFunc:%d OldLLVMFunc:%d\n", this, methodInstance, func.mId, methodInstance->mIRFunction.mId);
|
||||||
|
|
||||||
if ((isInlined) && (!mIsScratchModule))
|
if ((isInlined) && (!mIsScratchModule) && ((flags & BfGetMethodInstanceFlag_NoInline) == 0))
|
||||||
{
|
{
|
||||||
// We can't just add a dependency to mCurTypeInstance because we may have nested inlined functions, and
|
// We can't just add a dependency to mCurTypeInstance because we may have nested inlined functions, and
|
||||||
// mCurTypeInstance will just reflect the owner of the method currently being inlined, not the top-level
|
// mCurTypeInstance will just reflect the owner of the method currently being inlined, not the top-level
|
||||||
|
@ -11210,13 +11210,12 @@ BfModuleMethodInstance BfModule::ReferenceExternalMethodInstance(BfMethodInstanc
|
||||||
if ((!mCompiler->mIsResolveOnly) && (mIsReified) && (!methodInstance->mIsUnspecialized))
|
if ((!mCompiler->mIsResolveOnly) && (mIsReified) && (!methodInstance->mIsUnspecialized))
|
||||||
{
|
{
|
||||||
mIncompleteMethodCount++;
|
mIncompleteMethodCount++;
|
||||||
|
|
||||||
BfInlineMethodRequest* inlineMethodRequest = mContext->mInlineMethodWorkList.Alloc();
|
BfInlineMethodRequest* inlineMethodRequest = mContext->mInlineMethodWorkList.Alloc();
|
||||||
inlineMethodRequest->mType = methodInstance->GetOwner();
|
inlineMethodRequest->mType = methodInstance->GetOwner();
|
||||||
inlineMethodRequest->mFromModule = this;
|
inlineMethodRequest->mFromModule = this;
|
||||||
inlineMethodRequest->mFunc = func;
|
inlineMethodRequest->mFunc = func;
|
||||||
inlineMethodRequest->mFromModuleRevision = mRevision;
|
inlineMethodRequest->mFromModuleRevision = mRevision;
|
||||||
inlineMethodRequest->mMethodInstance = methodInstance;
|
inlineMethodRequest->mMethodInstance = methodInstance;
|
||||||
BF_ASSERT(mIsModuleMutable);
|
BF_ASSERT(mIsModuleMutable);
|
||||||
|
|
||||||
BfLogSysM("mInlineMethodWorkList %p for method %p in module %p in ReferenceExternalMethodInstance\n", inlineMethodRequest, methodInstance, this);
|
BfLogSysM("mInlineMethodWorkList %p for method %p in module %p in ReferenceExternalMethodInstance\n", inlineMethodRequest, methodInstance, this);
|
||||||
|
@ -11838,7 +11837,7 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM
|
||||||
inlineMethodRequest->mFromModule = this;
|
inlineMethodRequest->mFromModule = this;
|
||||||
inlineMethodRequest->mFunc = methodInstance->mIRFunction;
|
inlineMethodRequest->mFunc = methodInstance->mIRFunction;
|
||||||
inlineMethodRequest->mFromModuleRevision = mRevision;
|
inlineMethodRequest->mFromModuleRevision = mRevision;
|
||||||
inlineMethodRequest->mMethodInstance = methodInstance;
|
inlineMethodRequest->mMethodInstance = methodInstance;
|
||||||
|
|
||||||
BfLogSysM("mInlineMethodWorkList %p for method %p in module %p in GetMethodInstance\n", inlineMethodRequest, methodInstance, this);
|
BfLogSysM("mInlineMethodWorkList %p for method %p in module %p in GetMethodInstance\n", inlineMethodRequest, methodInstance, this);
|
||||||
BF_ASSERT(mIsModuleMutable);
|
BF_ASSERT(mIsModuleMutable);
|
||||||
|
|
|
@ -1772,7 +1772,7 @@ public:
|
||||||
BfMethodInstance* GetUnspecializedMethodInstance(BfMethodInstance* methodInstance); // Unspecialized owner type and unspecialized method type
|
BfMethodInstance* GetUnspecializedMethodInstance(BfMethodInstance* methodInstance); // Unspecialized owner type and unspecialized method type
|
||||||
int GetGenericParamAndReturnCount(BfMethodInstance* methodInstance);
|
int GetGenericParamAndReturnCount(BfMethodInstance* methodInstance);
|
||||||
BfModule* GetSpecializedMethodModule(const SizedArrayImpl<BfProject*>& projectList);
|
BfModule* GetSpecializedMethodModule(const SizedArrayImpl<BfProject*>& projectList);
|
||||||
BfModuleMethodInstance GetMethodInstanceAtIdx(BfTypeInstance* typeInstance, int methodIdx, const char* assertName = NULL);
|
BfModuleMethodInstance GetMethodInstanceAtIdx(BfTypeInstance* typeInstance, int methodIdx, const char* assertName = NULL, BfGetMethodInstanceFlags flags = BfGetMethodInstanceFlag_None);
|
||||||
BfModuleMethodInstance GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, int paramCount = -1, bool checkBase = false);
|
BfModuleMethodInstance GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, int paramCount = -1, bool checkBase = false);
|
||||||
BfModuleMethodInstance GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, const Array<BfType*>& paramTypes, bool checkBase = false);
|
BfModuleMethodInstance GetMethodByName(BfTypeInstance* typeInstance, const StringImpl& methodName, const Array<BfType*>& paramTypes, bool checkBase = false);
|
||||||
BfModuleMethodInstance GetInternalMethod(const StringImpl& methodName, int paramCount = -1);
|
BfModuleMethodInstance GetInternalMethod(const StringImpl& methodName, int paramCount = -1);
|
||||||
|
|
|
@ -51,6 +51,7 @@ enum BfGetMethodInstanceFlags : uint16
|
||||||
BfGetMethodInstanceFlag_ForceInline = 0x80,
|
BfGetMethodInstanceFlag_ForceInline = 0x80,
|
||||||
BfGetMethodInstanceFlag_Friend = 0x100,
|
BfGetMethodInstanceFlag_Friend = 0x100,
|
||||||
BfGetMethodInstanceFlag_DisableObjectAccessChecks = 0x200,
|
BfGetMethodInstanceFlag_DisableObjectAccessChecks = 0x200,
|
||||||
|
BfGetMethodInstanceFlag_NoInline = 0x400
|
||||||
};
|
};
|
||||||
|
|
||||||
class BfDependencyMap
|
class BfDependencyMap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue