mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
undef detection
This commit is contained in:
parent
41f95003fe
commit
621fe99882
1 changed files with 26 additions and 8 deletions
|
@ -3697,11 +3697,22 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
|
||||||
//SetAndRestoreValue<BfMethodState*> prevMethodStateInConstEval(module->mCurMethodState, NULL);
|
//SetAndRestoreValue<BfMethodState*> prevMethodStateInConstEval(module->mCurMethodState, NULL);
|
||||||
|
|
||||||
if (mCeMachine->mAppendAllocInfo != NULL)
|
if (mCeMachine->mAppendAllocInfo != NULL)
|
||||||
{
|
{
|
||||||
if ((mCeMachine->mAppendAllocInfo->mAppendSizeValue) && (!mCeMachine->mAppendAllocInfo->mAppendSizeValue.IsConst()))
|
if (mCeMachine->mAppendAllocInfo->mAppendSizeValue)
|
||||||
{
|
{
|
||||||
Fail("Non-constant append alloc");
|
bool isConst = mCeMachine->mAppendAllocInfo->mAppendSizeValue.IsConst();
|
||||||
return BfTypedValue();
|
if (isConst)
|
||||||
|
{
|
||||||
|
auto constant = module->mBfIRBuilder->GetConstant(mCeMachine->mAppendAllocInfo->mAppendSizeValue);
|
||||||
|
if (constant->mConstType == BfConstType_Undef)
|
||||||
|
isConst = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isConst)
|
||||||
|
{
|
||||||
|
Fail("Non-constant append alloc");
|
||||||
|
return BfTypedValue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3737,13 +3748,20 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (paramType->IsComposite())
|
if (paramType->IsComposite())
|
||||||
{
|
{
|
||||||
auto paramTypeInst = paramType->ToTypeInstance();
|
paramCompositeSize += paramType->mSize;
|
||||||
paramCompositeSize += paramTypeInst->mInstSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto arg = args[argIdx];
|
auto arg = args[argIdx];
|
||||||
if (!arg.IsConst())
|
bool isConst = arg.IsConst();
|
||||||
|
if (isConst)
|
||||||
|
{
|
||||||
|
auto constant = module->mBfIRBuilder->GetConstant(arg);
|
||||||
|
if (constant->mConstType == BfConstType_Undef)
|
||||||
|
isConst = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isConst)
|
||||||
{
|
{
|
||||||
if ((argIdx != thisArgIdx) && (argIdx != appendAllocIdx))
|
if ((argIdx != thisArgIdx) && (argIdx != appendAllocIdx))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue