| 9767 | } |
| 9768 | |
| 9769 | BfIRValue 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 | |
| 9805 | BfIRValue BfModule::GetDbgRawAllocData(BfType* type) |
| 9806 | { |
nothing calls this directly
no test coverage detected