mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Added CeEvalFlags_IgnoreConstEncodeFailure
This commit is contained in:
parent
3e8d90d300
commit
dfa03f16dd
3 changed files with 18 additions and 9 deletions
|
@ -2523,7 +2523,7 @@ void BfModule::HandleCEAttributes(CeEmitContext* ceEmitContext, BfTypeInstance*
|
||||||
callSource.mKind = CeCallSource::Kind_TypeDone;
|
callSource.mKind = CeCallSource::Kind_TypeDone;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ceContext->Call(callSource, this, methodInstance, args, CeEvalFlags_ForceReturnThis, NULL);
|
result = ceContext->Call(callSource, this, methodInstance, args, (CeEvalFlags)(CeEvalFlags_ForceReturnThis | CeEvalFlags_IgnoreConstEncodeFailure), NULL);
|
||||||
}
|
}
|
||||||
if (fieldInstance != NULL)
|
if (fieldInstance != NULL)
|
||||||
mCompiler->mCeMachine->mFieldInstanceSet.Remove(fieldInstance);
|
mCompiler->mCeMachine->mFieldInstanceSet.Remove(fieldInstance);
|
||||||
|
|
|
@ -4801,8 +4801,9 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
||||||
return instResult;
|
return instResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fail(StrFormat("Span return type '%s' must be received by a sized array", module->TypeToString(typeInst).c_str()));
|
if ((mCurEvalFlags & CeEvalFlags_IgnoreConstEncodeFailure) == 0)
|
||||||
return BfIRValue();
|
Fail(StrFormat("Span return type '%s' must be received by a sized array", module->TypeToString(typeInst).c_str()));
|
||||||
|
return irBuilder->CreateConstAggZero(irBuilder->MapType(typeInst));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeInst->IsInstanceOf(ceModule->mCompiler->mTypeTypeDef))
|
if (typeInst->IsInstanceOf(ceModule->mCompiler->mTypeTypeDef))
|
||||||
|
@ -4824,6 +4825,11 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
||||||
addr_ce typeId = *(int*)(instData);
|
addr_ce typeId = *(int*)(instData);
|
||||||
|
|
||||||
BfType* type = GetBfType(typeId);
|
BfType* type = GetBfType(typeId);
|
||||||
|
if (type == NULL)
|
||||||
|
{
|
||||||
|
Fail("Unable to locate type");
|
||||||
|
return BfIRValue();
|
||||||
|
}
|
||||||
|
|
||||||
if (type->IsInstanceOf(mCeMachine->mCompiler->mStringTypeDef))
|
if (type->IsInstanceOf(mCeMachine->mCompiler->mStringTypeDef))
|
||||||
{
|
{
|
||||||
|
@ -4860,8 +4866,9 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
||||||
|
|
||||||
if (typeInst->IsObjectOrInterface())
|
if (typeInst->IsObjectOrInterface())
|
||||||
{
|
{
|
||||||
Fail(StrFormat("Reference type '%s' return value not allowed", module->TypeToString(typeInst).c_str()));
|
if ((mCurEvalFlags & CeEvalFlags_IgnoreConstEncodeFailure) == 0)
|
||||||
return BfIRValue();
|
Fail(StrFormat("Reference type '%s' return value not allowed", module->TypeToString(typeInst).c_str()));
|
||||||
|
return irBuilder->CreateConstNull(irBuilder->MapType(typeInst));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeInst->mBaseType != NULL)
|
if (typeInst->mBaseType != NULL)
|
||||||
|
@ -4931,8 +4938,9 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
||||||
|
|
||||||
if (bfType->IsPointer())
|
if (bfType->IsPointer())
|
||||||
{
|
{
|
||||||
Fail(StrFormat("Pointer type '%s' return value not allowed", module->TypeToString(bfType).c_str()));
|
if ((mCurEvalFlags & CeEvalFlags_IgnoreConstEncodeFailure) == 0)
|
||||||
return BfIRValue();
|
Fail(StrFormat("Pointer type '%s' return value not allowed", module->TypeToString(bfType).c_str()));
|
||||||
|
return irBuilder->CreateConstNull(irBuilder->MapType(bfType));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bfType->IsSizedArray()) && (!bfType->IsUnknownSizedArrayType()))
|
if ((bfType->IsSizedArray()) && (!bfType->IsUnknownSizedArrayType()))
|
||||||
|
@ -7575,7 +7583,7 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
|
||||||
auto valueType = GetBfType(objTypeId);
|
auto valueType = GetBfType(objTypeId);
|
||||||
if ((ifaceType == NULL) || (valueType == NULL))
|
if ((ifaceType == NULL) || (valueType == NULL))
|
||||||
{
|
{
|
||||||
_Fail("Invalid type");
|
_Fail("Invalid type in CeOp_DynamicCastCheck");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -700,7 +700,8 @@ enum CeEvalFlags
|
||||||
CeEvalFlags_DeferIfNotOnlyError = 4,
|
CeEvalFlags_DeferIfNotOnlyError = 4,
|
||||||
CeEvalFlags_NoRebuild = 8,
|
CeEvalFlags_NoRebuild = 8,
|
||||||
CeEvalFlags_ForceReturnThis = 0x10,
|
CeEvalFlags_ForceReturnThis = 0x10,
|
||||||
CeEvalFlags_DbgCall = 0x20
|
CeEvalFlags_IgnoreConstEncodeFailure = 0x20,
|
||||||
|
CeEvalFlags_DbgCall = 0x40
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BF_CE_DEFAULT_STACK_SIZE 4*1024*1024
|
#define BF_CE_DEFAULT_STACK_SIZE 4*1024*1024
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue