1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Comptime naming fixes

This commit is contained in:
Brian Fiete 2021-01-09 04:20:45 -08:00
parent 3bbf2d8313
commit 0f33968030
11 changed files with 107 additions and 74 deletions

View file

@ -5239,7 +5239,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
{
if (mModule->mIsComptimeModule)
{
funcCallInst = mModule->mBfIRBuilder->ConstEval_GetInterfaceFunc(irArgs[0], methodInstance->mMethodInstanceGroup->mOwner->mTypeId, methodInstance->mMethodDef->mIdx, funcPtrType1);
funcCallInst = mModule->mBfIRBuilder->Comptime_GetInterfaceFunc(irArgs[0], methodInstance->mMethodInstanceGroup->mOwner->mTypeId, methodInstance->mMethodDef->mIdx, funcPtrType1);
}
else
{
@ -5259,7 +5259,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
}
else if (mModule->mIsComptimeModule)
{
funcCallInst = mModule->mBfIRBuilder->ConstEval_GetVirtualFunc(irArgs[0], methodInstance->mVirtualTableIdx, funcPtrType1);
funcCallInst = mModule->mBfIRBuilder->Comptime_GetVirtualFunc(irArgs[0], methodInstance->mVirtualTableIdx, funcPtrType1);
}
else
{

View file

@ -4893,37 +4893,37 @@ void BfIRBuilder::Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage)
NEW_CMD_INSERTED;
}
BfIRValue BfIRBuilder::ConstEval_GetBfType(int typeId, BfIRType resultType)
BfIRValue BfIRBuilder::Comptime_GetBfType(int typeId, BfIRType resultType)
{
BfIRValue retVal = WriteCmd(BfIRCmd_ConstEval_GetBfType, typeId, resultType);
BfIRValue retVal = WriteCmd(BfIRCmd_Comptime_GetBfType, typeId, resultType);
NEW_CMD_INSERTED;
return retVal;
}
BfIRValue BfIRBuilder::ConstEval_GetReflectType(int typeId, BfIRType resultType)
BfIRValue BfIRBuilder::Comptime_GetReflectType(int typeId, BfIRType resultType)
{
BfIRValue retVal = WriteCmd(BfIRCmd_ConstEval_GetReflectType, typeId, resultType);
BfIRValue retVal = WriteCmd(BfIRCmd_Comptime_GetReflectType, typeId, resultType);
NEW_CMD_INSERTED;
return retVal;
}
BfIRValue BfIRBuilder::ConstEval_DynamicCastCheck(BfIRValue value, int typeId, BfIRType resultType)
BfIRValue BfIRBuilder::Comptime_DynamicCastCheck(BfIRValue value, int typeId, BfIRType resultType)
{
BfIRValue retVal = WriteCmd(BfIRCmd_ConstEval_DynamicCastCheck, value, typeId, resultType);
BfIRValue retVal = WriteCmd(BfIRCmd_Comptime_DynamicCastCheck, value, typeId, resultType);
NEW_CMD_INSERTED;
return retVal;
}
BfIRValue BfIRBuilder::ConstEval_GetVirtualFunc(BfIRValue value, int virtualTableId, BfIRType resultType)
BfIRValue BfIRBuilder::Comptime_GetVirtualFunc(BfIRValue value, int virtualTableId, BfIRType resultType)
{
BfIRValue retVal = WriteCmd(BfIRCmd_ConstEval_GetVirtualFunc, value, virtualTableId, resultType);
BfIRValue retVal = WriteCmd(BfIRCmd_Comptime_GetVirtualFunc, value, virtualTableId, resultType);
NEW_CMD_INSERTED;
return retVal;
}
BfIRValue BfIRBuilder::ConstEval_GetInterfaceFunc(BfIRValue value, int typeId, int methodIdx, BfIRType resultType)
BfIRValue BfIRBuilder::Comptime_GetInterfaceFunc(BfIRValue value, int typeId, int methodIdx, BfIRType resultType)
{
BfIRValue retVal = WriteCmd(BfIRCmd_ConstEval_GetInterfaceFunc, value, typeId, methodIdx, resultType);
BfIRValue retVal = WriteCmd(BfIRCmd_Comptime_GetInterfaceFunc, value, typeId, methodIdx, resultType);
NEW_CMD_INSERTED;
return retVal;
}

View file

@ -284,11 +284,11 @@ enum BfIRCmd : uint8
BfIRCmd_Func_SafeRename,
BfIRCmd_Func_SetLinkage,
BfIRCmd_ConstEval_GetBfType,
BfIRCmd_ConstEval_GetReflectType,
BfIRCmd_ConstEval_DynamicCastCheck,
BfIRCmd_ConstEval_GetVirtualFunc,
BfIRCmd_ConstEval_GetInterfaceFunc,
BfIRCmd_Comptime_GetBfType,
BfIRCmd_Comptime_GetReflectType,
BfIRCmd_Comptime_DynamicCastCheck,
BfIRCmd_Comptime_GetVirtualFunc,
BfIRCmd_Comptime_GetInterfaceFunc,
BfIRCmd_SaveDebugLocation,
BfIRCmd_RestoreDebugLocation,
@ -1263,11 +1263,11 @@ public:
void Func_SafeRename(BfIRFunction func);
void Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage);
BfIRValue ConstEval_GetBfType(int typeId, BfIRType resultType);
BfIRValue ConstEval_GetReflectType(int typeId, BfIRType resultType);
BfIRValue ConstEval_DynamicCastCheck(BfIRValue value, int typeId, BfIRType resultType);
BfIRValue ConstEval_GetVirtualFunc(BfIRValue value, int virtualTableId, BfIRType resultType);
BfIRValue ConstEval_GetInterfaceFunc(BfIRValue value, int typeId, int methodIdx, BfIRType resultType);
BfIRValue Comptime_GetBfType(int typeId, BfIRType resultType);
BfIRValue Comptime_GetReflectType(int typeId, BfIRType resultType);
BfIRValue Comptime_DynamicCastCheck(BfIRValue value, int typeId, BfIRType resultType);
BfIRValue Comptime_GetVirtualFunc(BfIRValue value, int virtualTableId, BfIRType resultType);
BfIRValue Comptime_GetInterfaceFunc(BfIRValue value, int typeId, int methodIdx, BfIRType resultType);
void SaveDebugLocation();
void RestoreDebugLocation();

View file

@ -4838,7 +4838,7 @@ BfIRValue BfModule::GetClassVDataPtr(BfTypeInstance* typeInstance)
{
auto classVDataType = ResolveTypeDef(mCompiler->mClassVDataTypeDef);
if (mIsComptimeModule)
return mBfIRBuilder->ConstEval_GetBfType(typeInstance->mTypeId, mBfIRBuilder->MapType(CreatePointerType(classVDataType)));
return mBfIRBuilder->Comptime_GetBfType(typeInstance->mTypeId, mBfIRBuilder->MapType(CreatePointerType(classVDataType)));
return mBfIRBuilder->CreateBitCast(CreateClassVDataGlobal(typeInstance), mBfIRBuilder->MapType(CreatePointerType(classVDataType)));
}
@ -4955,7 +4955,7 @@ BfIRValue BfModule::CreateTypeDataRef(BfType* type)
{
auto typeTypeDef = ResolveTypeDef(mCompiler->mTypeTypeDef);
auto typeTypeInst = typeTypeDef->ToTypeInstance();
return mBfIRBuilder->ConstEval_GetReflectType(type->mTypeId, mBfIRBuilder->MapType(typeTypeInst));
return mBfIRBuilder->Comptime_GetReflectType(type->mTypeId, mBfIRBuilder->MapType(typeTypeInst));
}
BfIRValue globalVariable;
@ -9370,7 +9370,7 @@ void BfModule::EmitDynamicCastCheck(const BfTypedValue& targetValue, BfType* tar
if (mIsComptimeModule)
{
auto callResult = mBfIRBuilder->ConstEval_DynamicCastCheck(targetValue.mValue, targetType->mTypeId, mBfIRBuilder->MapType(mContext->mBfObjectType));
auto callResult = mBfIRBuilder->Comptime_DynamicCastCheck(targetValue.mValue, targetType->mTypeId, mBfIRBuilder->MapType(mContext->mBfObjectType));
auto cmpResult = mBfIRBuilder->CreateCmpNE(callResult, GetDefaultValue(mContext->mBfObjectType));
irb->CreateCondBr(cmpResult, trueBlock, falseBlock);
return;
@ -19753,7 +19753,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
// incase it gets called later by some hot-loaded coded
if ((mCompiler->mOptions.mAllowHotSwapping) && (mCurMethodInstance->mIRFunction) && (!mCurMethodInstance->mIRFunction.IsFake()) && (mCurTypeInstance != mContext->mBfObjectType))
{
if (!mCurMethodInstance->mMethodDef->mName.StartsWith("ConstEval_"))
if (!mCurMethodInstance->mMethodDef->mName.StartsWith("Comptime_"))
CreateFakeCallerMethod(mangledName);
}
mBfIRBuilder->Func_DeleteBody(mCurMethodInstance->mIRFunction);

View file

@ -1371,8 +1371,8 @@ void CeBuilder::Build()
case BeValueScopeStartInst::TypeId:
case BeValueScopeEndInst::TypeId:
case BeValueScopeRetainInst::TypeId:
case BeConstEvalGetVirtualFunc::TypeId:
case BeConstEvalGetInterfaceFunc::TypeId:
case BeComptimeGetVirtualFunc::TypeId:
case BeComptimeGetInterfaceFunc::TypeId:
break;
case BeUnreachableInst::TypeId:
Emit(CeOp_InvalidOp);
@ -2385,7 +2385,7 @@ void CeBuilder::Build()
ceFunc = GetOperand(beFunction, false, true);
}
else if (auto beGetVirtualFunc = BeValueDynCast<BeConstEvalGetVirtualFunc>(castedInst->mFunc))
else if (auto beGetVirtualFunc = BeValueDynCast<BeComptimeGetVirtualFunc>(castedInst->mFunc))
{
virtTarget = GetOperand(beGetVirtualFunc->mValue);
virtualTableIdx = beGetVirtualFunc->mVirtualTableIdx;
@ -2394,7 +2394,7 @@ void CeBuilder::Build()
BF_ASSERT(resultType->IsPointer());
beFuncType = (BeFunctionType*)((BePointerType*)resultType)->mElementType;
}
else if (auto beGetInterfaceFunc = BeValueDynCast<BeConstEvalGetInterfaceFunc>(castedInst->mFunc))
else if (auto beGetInterfaceFunc = BeValueDynCast<BeComptimeGetInterfaceFunc>(castedInst->mFunc))
{
virtTarget = GetOperand(beGetInterfaceFunc->mValue);
ifaceTypeId = beGetInterfaceFunc->mIFaceTypeId;
@ -2533,17 +2533,17 @@ void CeBuilder::Build()
EmitFrameOffset(mcStackVal);
}
break;
case BeConstEvalGetType::TypeId:
case BeComptimeGetType::TypeId:
{
auto castedInst = (BeConstEvalGetType*)inst;
auto castedInst = (BeComptimeGetType*)inst;
result.mKind = CeOperandKind_Immediate;
result.mImmediate = castedInst->mTypeId;
result.mType = beModule->mContext->GetPrimitiveType(BeTypeCode_Int32);
}
break;
case BeConstEvalGetReflectType::TypeId:
case BeComptimeGetReflectType::TypeId:
{
auto castedInst = (BeConstEvalGetReflectType*)inst;
auto castedInst = (BeComptimeGetReflectType*)inst;
auto ptrType = beModule->mContext->GetVoidPtrType();
result = FrameAlloc(ptrType);
@ -2552,9 +2552,9 @@ void CeBuilder::Build()
Emit((int32)castedInst->mTypeId);
}
break;
case BeConstEvalDynamicCastCheck::TypeId:
case BeComptimeDynamicCastCheck::TypeId:
{
auto castedInst = (BeConstEvalDynamicCastCheck*)inst;
auto castedInst = (BeComptimeDynamicCastCheck*)inst;
auto mcValue = GetOperand(castedInst->mValue);
auto ptrType = beModule->mContext->GetVoidPtrType();