mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Comptime naming fixes
This commit is contained in:
parent
3bbf2d8313
commit
0f33968030
11 changed files with 107 additions and 74 deletions
|
@ -304,7 +304,7 @@ namespace System
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Method /*2*/)]
|
[AttributeUsage(.Method /*2*/)]
|
||||||
public struct IntrinsicAttribute : Attribute
|
public struct IntrinsicAttribute : Attribute
|
||||||
|
@ -519,4 +519,14 @@ namespace System
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IComptimeTypeApply
|
||||||
|
{
|
||||||
|
void ApplyToType(Type type);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IComptimeMethodApply
|
||||||
|
{
|
||||||
|
void ApplyToMethod(Type type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,16 +98,6 @@ namespace System
|
||||||
public static void EmitDefinition(Type owner, StringView text)
|
public static void EmitDefinition(Type owner, StringView text)
|
||||||
{
|
{
|
||||||
Comptime_EmitDefinition((.)owner.TypeId, text);
|
Comptime_EmitDefinition((.)owner.TypeId, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IComptimeTypeApply
|
|
||||||
{
|
|
||||||
void ApplyToType(Type type);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IComptimeMethodApply
|
|
||||||
{
|
|
||||||
void ApplyToMethod(Type type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,30 @@ namespace System
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AttributeUsage(.Method | .Invocation)]
|
[AttributeUsage(.Method)]
|
||||||
|
public struct ComptimeAttribute : Attribute
|
||||||
|
{
|
||||||
|
public this()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnlyFromComptime
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ConstEval
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[AttributeUsage(.Invocation)]
|
||||||
public struct ConstEvalAttribute : Attribute
|
public struct ConstEvalAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -456,4 +479,14 @@ namespace System
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IComptimeTypeApply
|
||||||
|
{
|
||||||
|
void ApplyToType(Type type);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IComptimeMethodApply
|
||||||
|
{
|
||||||
|
void ApplyToMethod(Type type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2646,62 +2646,62 @@ void BeIRCodeGen::HandleNextCmd()
|
||||||
SetResult(curId, mBeModule->GetInsertBlock());
|
SetResult(curId, mBeModule->GetInsertBlock());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfIRCmd_ConstEval_GetBfType:
|
case BfIRCmd_Comptime_GetBfType:
|
||||||
{
|
{
|
||||||
CMD_PARAM(int32, typeId);
|
CMD_PARAM(int32, typeId);
|
||||||
CMD_PARAM(BeType*, resultType);
|
CMD_PARAM(BeType*, resultType);
|
||||||
|
|
||||||
auto inst = mBeModule->AllocInst<BeConstEvalGetType>();
|
auto inst = mBeModule->AllocInst<BeComptimeGetType>();
|
||||||
inst->mTypeId = typeId;
|
inst->mTypeId = typeId;
|
||||||
inst->mResultType = resultType;
|
inst->mResultType = resultType;
|
||||||
SetResult(curId, inst);
|
SetResult(curId, inst);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfIRCmd_ConstEval_GetReflectType:
|
case BfIRCmd_Comptime_GetReflectType:
|
||||||
{
|
{
|
||||||
CMD_PARAM(int32, typeId);
|
CMD_PARAM(int32, typeId);
|
||||||
CMD_PARAM(BeType*, resultType);
|
CMD_PARAM(BeType*, resultType);
|
||||||
|
|
||||||
auto inst = mBeModule->AllocInst<BeConstEvalGetReflectType>();
|
auto inst = mBeModule->AllocInst<BeComptimeGetReflectType>();
|
||||||
inst->mTypeId = typeId;
|
inst->mTypeId = typeId;
|
||||||
inst->mResultType = resultType;
|
inst->mResultType = resultType;
|
||||||
SetResult(curId, inst);
|
SetResult(curId, inst);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfIRCmd_ConstEval_DynamicCastCheck:
|
case BfIRCmd_Comptime_DynamicCastCheck:
|
||||||
{
|
{
|
||||||
CMD_PARAM(BeValue*, value);
|
CMD_PARAM(BeValue*, value);
|
||||||
CMD_PARAM(int32, typeId);
|
CMD_PARAM(int32, typeId);
|
||||||
CMD_PARAM(BeType*, resultType);
|
CMD_PARAM(BeType*, resultType);
|
||||||
|
|
||||||
auto inst = mBeModule->AllocInst<BeConstEvalDynamicCastCheck>();
|
auto inst = mBeModule->AllocInst<BeComptimeDynamicCastCheck>();
|
||||||
inst->mValue = value;
|
inst->mValue = value;
|
||||||
inst->mTypeId = typeId;
|
inst->mTypeId = typeId;
|
||||||
inst->mResultType = resultType;
|
inst->mResultType = resultType;
|
||||||
SetResult(curId, inst);
|
SetResult(curId, inst);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfIRCmd_ConstEval_GetVirtualFunc:
|
case BfIRCmd_Comptime_GetVirtualFunc:
|
||||||
{
|
{
|
||||||
CMD_PARAM(BeValue*, value);
|
CMD_PARAM(BeValue*, value);
|
||||||
CMD_PARAM(int32, virtualTableIdx);
|
CMD_PARAM(int32, virtualTableIdx);
|
||||||
CMD_PARAM(BeType*, resultType);
|
CMD_PARAM(BeType*, resultType);
|
||||||
|
|
||||||
auto inst = mBeModule->AllocInst<BeConstEvalGetVirtualFunc>();
|
auto inst = mBeModule->AllocInst<BeComptimeGetVirtualFunc>();
|
||||||
inst->mValue = value;
|
inst->mValue = value;
|
||||||
inst->mVirtualTableIdx = virtualTableIdx;
|
inst->mVirtualTableIdx = virtualTableIdx;
|
||||||
inst->mResultType = resultType;
|
inst->mResultType = resultType;
|
||||||
SetResult(curId, inst);
|
SetResult(curId, inst);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfIRCmd_ConstEval_GetInterfaceFunc:
|
case BfIRCmd_Comptime_GetInterfaceFunc:
|
||||||
{
|
{
|
||||||
CMD_PARAM(BeValue*, value);
|
CMD_PARAM(BeValue*, value);
|
||||||
CMD_PARAM(int32, ifaceTypeId);
|
CMD_PARAM(int32, ifaceTypeId);
|
||||||
CMD_PARAM(int32, methodIdx);
|
CMD_PARAM(int32, methodIdx);
|
||||||
CMD_PARAM(BeType*, resultType);
|
CMD_PARAM(BeType*, resultType);
|
||||||
|
|
||||||
auto inst = mBeModule->AllocInst<BeConstEvalGetInterfaceFunc>();
|
auto inst = mBeModule->AllocInst<BeComptimeGetInterfaceFunc>();
|
||||||
inst->mValue = value;
|
inst->mValue = value;
|
||||||
inst->mIFaceTypeId = ifaceTypeId;
|
inst->mIFaceTypeId = ifaceTypeId;
|
||||||
inst->mMethodIdx = methodIdx;
|
inst->mMethodIdx = methodIdx;
|
||||||
|
|
|
@ -2451,11 +2451,11 @@ String BeModule::ToString(BeFunction* wantFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
DISPLAY_INST1(BeConstEvalGetType, "ConstEvalGetType", mTypeId);
|
DISPLAY_INST1(BeComptimeGetType, "ComptimeGetType", mTypeId);
|
||||||
DISPLAY_INST1(BeConstEvalGetReflectType, "ConstEvalGetReflectType", mTypeId);
|
DISPLAY_INST1(BeComptimeGetReflectType, "ComptimeGetReflectType", mTypeId);
|
||||||
DISPLAY_INST2(BeConstEvalDynamicCastCheck, "ConstEvalDynamicCastCheck", mValue, mTypeId);
|
DISPLAY_INST2(BeComptimeDynamicCastCheck, "ComptimeDynamicCastCheck", mValue, mTypeId);
|
||||||
DISPLAY_INST2(BeConstEvalGetVirtualFunc, "ConstEvalGetVirtualFunc", mValue, mVirtualTableIdx);
|
DISPLAY_INST2(BeComptimeGetVirtualFunc, "ComptimeGetVirtualFunc", mValue, mVirtualTableIdx);
|
||||||
DISPLAY_INST3(BeConstEvalGetInterfaceFunc, "ConstEvalGetInterfaceFunc", mValue, mIFaceTypeId, mMethodIdx);
|
DISPLAY_INST3(BeComptimeGetInterfaceFunc, "ComptimeGetInterfaceFunc", mValue, mIFaceTypeId, mMethodIdx);
|
||||||
default:
|
default:
|
||||||
BF_FATAL("Notimpl");
|
BF_FATAL("Notimpl");
|
||||||
str += "<UNKNOWN INST>";
|
str += "<UNKNOWN INST>";
|
||||||
|
|
|
@ -1348,10 +1348,10 @@ public:
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class BeConstEvalGetType : public BeInst
|
class BeComptimeGetType : public BeInst
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BE_VALUE_TYPE(BeConstEvalGetType, BeInst);
|
BE_VALUE_TYPE(BeComptimeGetType, BeInst);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int mTypeId;
|
int mTypeId;
|
||||||
|
@ -1370,10 +1370,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BeConstEvalGetReflectType : public BeInst
|
class BeComptimeGetReflectType : public BeInst
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BE_VALUE_TYPE(BeConstEvalGetReflectType, BeInst);
|
BE_VALUE_TYPE(BeComptimeGetReflectType, BeInst);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int mTypeId;
|
int mTypeId;
|
||||||
|
@ -1392,10 +1392,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BeConstEvalDynamicCastCheck : public BeInst
|
class BeComptimeDynamicCastCheck : public BeInst
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BE_VALUE_TYPE(BeConstEvalDynamicCastCheck, BeInst);
|
BE_VALUE_TYPE(BeComptimeDynamicCastCheck, BeInst);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BeValue* mValue;
|
BeValue* mValue;
|
||||||
|
@ -1416,10 +1416,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BeConstEvalGetVirtualFunc : public BeInst
|
class BeComptimeGetVirtualFunc : public BeInst
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BE_VALUE_TYPE(BeConstEvalGetVirtualFunc, BeInst);
|
BE_VALUE_TYPE(BeComptimeGetVirtualFunc, BeInst);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BeValue* mValue;
|
BeValue* mValue;
|
||||||
|
@ -1440,10 +1440,10 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class BeConstEvalGetInterfaceFunc : public BeInst
|
class BeComptimeGetInterfaceFunc : public BeInst
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BE_VALUE_TYPE(BeConstEvalGetInterfaceFunc, BeInst);
|
BE_VALUE_TYPE(BeComptimeGetInterfaceFunc, BeInst);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BeValue* mValue;
|
BeValue* mValue;
|
||||||
|
|
|
@ -5239,7 +5239,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
|
||||||
{
|
{
|
||||||
if (mModule->mIsComptimeModule)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -5259,7 +5259,7 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, BfMethodInstance*
|
||||||
}
|
}
|
||||||
else if (mModule->mIsComptimeModule)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -4893,37 +4893,37 @@ void BfIRBuilder::Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage)
|
||||||
NEW_CMD_INSERTED;
|
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;
|
NEW_CMD_INSERTED;
|
||||||
return retVal;
|
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;
|
NEW_CMD_INSERTED;
|
||||||
return retVal;
|
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;
|
NEW_CMD_INSERTED;
|
||||||
return retVal;
|
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;
|
NEW_CMD_INSERTED;
|
||||||
return retVal;
|
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;
|
NEW_CMD_INSERTED;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,11 +284,11 @@ enum BfIRCmd : uint8
|
||||||
BfIRCmd_Func_SafeRename,
|
BfIRCmd_Func_SafeRename,
|
||||||
BfIRCmd_Func_SetLinkage,
|
BfIRCmd_Func_SetLinkage,
|
||||||
|
|
||||||
BfIRCmd_ConstEval_GetBfType,
|
BfIRCmd_Comptime_GetBfType,
|
||||||
BfIRCmd_ConstEval_GetReflectType,
|
BfIRCmd_Comptime_GetReflectType,
|
||||||
BfIRCmd_ConstEval_DynamicCastCheck,
|
BfIRCmd_Comptime_DynamicCastCheck,
|
||||||
BfIRCmd_ConstEval_GetVirtualFunc,
|
BfIRCmd_Comptime_GetVirtualFunc,
|
||||||
BfIRCmd_ConstEval_GetInterfaceFunc,
|
BfIRCmd_Comptime_GetInterfaceFunc,
|
||||||
|
|
||||||
BfIRCmd_SaveDebugLocation,
|
BfIRCmd_SaveDebugLocation,
|
||||||
BfIRCmd_RestoreDebugLocation,
|
BfIRCmd_RestoreDebugLocation,
|
||||||
|
@ -1263,11 +1263,11 @@ public:
|
||||||
void Func_SafeRename(BfIRFunction func);
|
void Func_SafeRename(BfIRFunction func);
|
||||||
void Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage);
|
void Func_SetLinkage(BfIRFunction func, BfIRLinkageType linkage);
|
||||||
|
|
||||||
BfIRValue ConstEval_GetBfType(int typeId, BfIRType resultType);
|
BfIRValue Comptime_GetBfType(int typeId, BfIRType resultType);
|
||||||
BfIRValue ConstEval_GetReflectType(int typeId, BfIRType resultType);
|
BfIRValue Comptime_GetReflectType(int typeId, BfIRType resultType);
|
||||||
BfIRValue ConstEval_DynamicCastCheck(BfIRValue value, int typeId, BfIRType resultType);
|
BfIRValue Comptime_DynamicCastCheck(BfIRValue value, int typeId, BfIRType resultType);
|
||||||
BfIRValue ConstEval_GetVirtualFunc(BfIRValue value, int virtualTableId, BfIRType resultType);
|
BfIRValue Comptime_GetVirtualFunc(BfIRValue value, int virtualTableId, BfIRType resultType);
|
||||||
BfIRValue ConstEval_GetInterfaceFunc(BfIRValue value, int typeId, int methodIdx, BfIRType resultType);
|
BfIRValue Comptime_GetInterfaceFunc(BfIRValue value, int typeId, int methodIdx, BfIRType resultType);
|
||||||
|
|
||||||
void SaveDebugLocation();
|
void SaveDebugLocation();
|
||||||
void RestoreDebugLocation();
|
void RestoreDebugLocation();
|
||||||
|
|
|
@ -4838,7 +4838,7 @@ BfIRValue BfModule::GetClassVDataPtr(BfTypeInstance* typeInstance)
|
||||||
{
|
{
|
||||||
auto classVDataType = ResolveTypeDef(mCompiler->mClassVDataTypeDef);
|
auto classVDataType = ResolveTypeDef(mCompiler->mClassVDataTypeDef);
|
||||||
if (mIsComptimeModule)
|
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)));
|
return mBfIRBuilder->CreateBitCast(CreateClassVDataGlobal(typeInstance), mBfIRBuilder->MapType(CreatePointerType(classVDataType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4955,7 +4955,7 @@ BfIRValue BfModule::CreateTypeDataRef(BfType* type)
|
||||||
{
|
{
|
||||||
auto typeTypeDef = ResolveTypeDef(mCompiler->mTypeTypeDef);
|
auto typeTypeDef = ResolveTypeDef(mCompiler->mTypeTypeDef);
|
||||||
auto typeTypeInst = typeTypeDef->ToTypeInstance();
|
auto typeTypeInst = typeTypeDef->ToTypeInstance();
|
||||||
return mBfIRBuilder->ConstEval_GetReflectType(type->mTypeId, mBfIRBuilder->MapType(typeTypeInst));
|
return mBfIRBuilder->Comptime_GetReflectType(type->mTypeId, mBfIRBuilder->MapType(typeTypeInst));
|
||||||
}
|
}
|
||||||
|
|
||||||
BfIRValue globalVariable;
|
BfIRValue globalVariable;
|
||||||
|
@ -9370,7 +9370,7 @@ void BfModule::EmitDynamicCastCheck(const BfTypedValue& targetValue, BfType* tar
|
||||||
|
|
||||||
if (mIsComptimeModule)
|
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));
|
auto cmpResult = mBfIRBuilder->CreateCmpNE(callResult, GetDefaultValue(mContext->mBfObjectType));
|
||||||
irb->CreateCondBr(cmpResult, trueBlock, falseBlock);
|
irb->CreateCondBr(cmpResult, trueBlock, falseBlock);
|
||||||
return;
|
return;
|
||||||
|
@ -19753,7 +19753,7 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup)
|
||||||
// incase it gets called later by some hot-loaded coded
|
// incase it gets called later by some hot-loaded coded
|
||||||
if ((mCompiler->mOptions.mAllowHotSwapping) && (mCurMethodInstance->mIRFunction) && (!mCurMethodInstance->mIRFunction.IsFake()) && (mCurTypeInstance != mContext->mBfObjectType))
|
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);
|
CreateFakeCallerMethod(mangledName);
|
||||||
}
|
}
|
||||||
mBfIRBuilder->Func_DeleteBody(mCurMethodInstance->mIRFunction);
|
mBfIRBuilder->Func_DeleteBody(mCurMethodInstance->mIRFunction);
|
||||||
|
|
|
@ -1371,8 +1371,8 @@ void CeBuilder::Build()
|
||||||
case BeValueScopeStartInst::TypeId:
|
case BeValueScopeStartInst::TypeId:
|
||||||
case BeValueScopeEndInst::TypeId:
|
case BeValueScopeEndInst::TypeId:
|
||||||
case BeValueScopeRetainInst::TypeId:
|
case BeValueScopeRetainInst::TypeId:
|
||||||
case BeConstEvalGetVirtualFunc::TypeId:
|
case BeComptimeGetVirtualFunc::TypeId:
|
||||||
case BeConstEvalGetInterfaceFunc::TypeId:
|
case BeComptimeGetInterfaceFunc::TypeId:
|
||||||
break;
|
break;
|
||||||
case BeUnreachableInst::TypeId:
|
case BeUnreachableInst::TypeId:
|
||||||
Emit(CeOp_InvalidOp);
|
Emit(CeOp_InvalidOp);
|
||||||
|
@ -2385,7 +2385,7 @@ void CeBuilder::Build()
|
||||||
|
|
||||||
ceFunc = GetOperand(beFunction, false, true);
|
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);
|
virtTarget = GetOperand(beGetVirtualFunc->mValue);
|
||||||
virtualTableIdx = beGetVirtualFunc->mVirtualTableIdx;
|
virtualTableIdx = beGetVirtualFunc->mVirtualTableIdx;
|
||||||
|
@ -2394,7 +2394,7 @@ void CeBuilder::Build()
|
||||||
BF_ASSERT(resultType->IsPointer());
|
BF_ASSERT(resultType->IsPointer());
|
||||||
beFuncType = (BeFunctionType*)((BePointerType*)resultType)->mElementType;
|
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);
|
virtTarget = GetOperand(beGetInterfaceFunc->mValue);
|
||||||
ifaceTypeId = beGetInterfaceFunc->mIFaceTypeId;
|
ifaceTypeId = beGetInterfaceFunc->mIFaceTypeId;
|
||||||
|
@ -2533,17 +2533,17 @@ void CeBuilder::Build()
|
||||||
EmitFrameOffset(mcStackVal);
|
EmitFrameOffset(mcStackVal);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BeConstEvalGetType::TypeId:
|
case BeComptimeGetType::TypeId:
|
||||||
{
|
{
|
||||||
auto castedInst = (BeConstEvalGetType*)inst;
|
auto castedInst = (BeComptimeGetType*)inst;
|
||||||
result.mKind = CeOperandKind_Immediate;
|
result.mKind = CeOperandKind_Immediate;
|
||||||
result.mImmediate = castedInst->mTypeId;
|
result.mImmediate = castedInst->mTypeId;
|
||||||
result.mType = beModule->mContext->GetPrimitiveType(BeTypeCode_Int32);
|
result.mType = beModule->mContext->GetPrimitiveType(BeTypeCode_Int32);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BeConstEvalGetReflectType::TypeId:
|
case BeComptimeGetReflectType::TypeId:
|
||||||
{
|
{
|
||||||
auto castedInst = (BeConstEvalGetReflectType*)inst;
|
auto castedInst = (BeComptimeGetReflectType*)inst;
|
||||||
auto ptrType = beModule->mContext->GetVoidPtrType();
|
auto ptrType = beModule->mContext->GetVoidPtrType();
|
||||||
result = FrameAlloc(ptrType);
|
result = FrameAlloc(ptrType);
|
||||||
|
|
||||||
|
@ -2552,9 +2552,9 @@ void CeBuilder::Build()
|
||||||
Emit((int32)castedInst->mTypeId);
|
Emit((int32)castedInst->mTypeId);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BeConstEvalDynamicCastCheck::TypeId:
|
case BeComptimeDynamicCastCheck::TypeId:
|
||||||
{
|
{
|
||||||
auto castedInst = (BeConstEvalDynamicCastCheck*)inst;
|
auto castedInst = (BeComptimeDynamicCastCheck*)inst;
|
||||||
auto mcValue = GetOperand(castedInst->mValue);
|
auto mcValue = GetOperand(castedInst->mValue);
|
||||||
|
|
||||||
auto ptrType = beModule->mContext->GetVoidPtrType();
|
auto ptrType = beModule->mContext->GetVoidPtrType();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue