1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Improved comptime var, undef, unspecialized variation

This commit is contained in:
Brian Fiete 2022-01-20 08:18:28 -05:00
parent 3c091be0d5
commit a10ad8d6fe
5 changed files with 233 additions and 64 deletions

View file

@ -3461,7 +3461,7 @@ bool CeContext::WriteConstant(BfModule* module, addr_ce addr, BfConstant* consta
if (type->IsSizedArray())
{
auto sizedArrayType = (BfSizedArrayType*)type;
for (int i = 0; i < sizedArrayType->mSize; i++)
for (int i = 0; i < sizedArrayType->mElementCount; i++)
{
auto fieldConstant = module->mBfIRBuilder->GetConstant(aggConstant->mValues[i]);
if (fieldConstant == NULL)
@ -3559,6 +3559,12 @@ bool CeContext::WriteConstant(BfModule* module, addr_ce addr, BfConstant* consta
return true;
}
if (constant->mConstType == BfConstType_Undef)
{
memset(mMemory.mVals + addr, 0, type->mSize);
return true;
}
if (constant->mConstType == BfConstType_AggCE)
{
auto constAggData = (BfConstantAggCE*)constant;
@ -4130,8 +4136,8 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
{
args[argIdx] = module->CreateTypeDataRef(module->GetPrimitiveType(BfTypeCode_None));
}
else
isConst = false;
// else
// isConst = false;
}
}