MCPcopy Create free account
hub / github.com/beefytech/Beef / GetMarkFuncPtr

Method GetMarkFuncPtr

IDEHelper/Compiler/BfModule.cpp:9769–9803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9767}
9768
9769BfIRValue BfModule::GetMarkFuncPtr(BfType* type)
9770{
9771 if (type->IsStruct())
9772 {
9773 auto typeInstance = type->ToTypeInstance();
9774
9775 BfModuleMethodInstance moduleMethodInst = GetMethodByName(typeInstance, BF_METHODNAME_MARKMEMBERS, 0, true);
9776 return mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, mBfIRBuilder->MapType(GetPrimitiveType(BfTypeCode_NullPtr)));
9777 }
9778 else if (type->IsObjectOrInterface())
9779 {
9780 auto gcType = ResolveTypeDef(mCompiler->mGCTypeDef)->ToTypeInstance();
9781 BfModuleMethodInstance moduleMethodInst = GetMethodByName(gcType, "MarkDerefedObject");
9782 BF_ASSERT(moduleMethodInst.mFunc);
9783 return mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, mBfIRBuilder->MapType(GetPrimitiveType(BfTypeCode_NullPtr)));
9784 }
9785 else
9786 {
9787 auto gcType = ResolveTypeDef(mCompiler->mGCTypeDef)->ToTypeInstance();
9788
9789 BfExprEvaluator exprEvaluator(this);
9790 SizedArray<BfResolvedArg, 1> resolvedArgs;
9791 BfResolvedArg resolvedArg;
9792 resolvedArg.mTypedValue = BfTypedValue(mBfIRBuilder->GetFakeVal(), type, type->IsComposite());
9793 resolvedArgs.Add(resolvedArg);
9794 BfMethodMatcher methodMatcher(NULL, this, "Mark", resolvedArgs, BfMethodGenericArguments());
9795 methodMatcher.CheckType(gcType, BfTypedValue(), false);
9796
9797 BfModuleMethodInstance moduleMethodInst = exprEvaluator.GetSelectedMethod(NULL, methodMatcher.mBestMethodTypeInstance, methodMatcher.mBestMethodDef, methodMatcher);
9798 BF_ASSERT(moduleMethodInst.mFunc);
9799 return mBfIRBuilder->CreateBitCast(moduleMethodInst.mFunc, mBfIRBuilder->MapType(GetPrimitiveType(BfTypeCode_NullPtr)));
9800 }
9801
9802 return BfIRValue();
9803}
9804
9805BfIRValue BfModule::GetDbgRawAllocData(BfType* type)
9806{

Callers

nothing calls this directly

Calls 13

BfTypedValueClass · 0.85
BfIRValueClass · 0.85
MapTypeMethod · 0.80
GetFakeValMethod · 0.80
GetSelectedMethodMethod · 0.80
IsStructMethod · 0.45
ToTypeInstanceMethod · 0.45
CreateBitCastMethod · 0.45
IsObjectOrInterfaceMethod · 0.45
IsCompositeMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected