mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +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;
|
||||
}
|
||||
|
||||
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)
|
||||
mCompiler->mCeMachine->mFieldInstanceSet.Remove(fieldInstance);
|
||||
|
|
|
@ -4801,8 +4801,9 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
|||
return instResult;
|
||||
}
|
||||
|
||||
Fail(StrFormat("Span return type '%s' must be received by a sized array", module->TypeToString(typeInst).c_str()));
|
||||
return BfIRValue();
|
||||
if ((mCurEvalFlags & CeEvalFlags_IgnoreConstEncodeFailure) == 0)
|
||||
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))
|
||||
|
@ -4824,6 +4825,11 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
|||
addr_ce typeId = *(int*)(instData);
|
||||
|
||||
BfType* type = GetBfType(typeId);
|
||||
if (type == NULL)
|
||||
{
|
||||
Fail("Unable to locate type");
|
||||
return BfIRValue();
|
||||
}
|
||||
|
||||
if (type->IsInstanceOf(mCeMachine->mCompiler->mStringTypeDef))
|
||||
{
|
||||
|
@ -4860,8 +4866,9 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
|||
|
||||
if (typeInst->IsObjectOrInterface())
|
||||
{
|
||||
Fail(StrFormat("Reference type '%s' return value not allowed", module->TypeToString(typeInst).c_str()));
|
||||
return BfIRValue();
|
||||
if ((mCurEvalFlags & CeEvalFlags_IgnoreConstEncodeFailure) == 0)
|
||||
Fail(StrFormat("Reference type '%s' return value not allowed", module->TypeToString(typeInst).c_str()));
|
||||
return irBuilder->CreateConstNull(irBuilder->MapType(typeInst));
|
||||
}
|
||||
|
||||
if (typeInst->mBaseType != NULL)
|
||||
|
@ -4931,8 +4938,9 @@ BfIRValue CeContext::CreateConstant(BfModule* module, uint8* ptr, BfType* bfType
|
|||
|
||||
if (bfType->IsPointer())
|
||||
{
|
||||
Fail(StrFormat("Pointer type '%s' return value not allowed", module->TypeToString(bfType).c_str()));
|
||||
return BfIRValue();
|
||||
if ((mCurEvalFlags & CeEvalFlags_IgnoreConstEncodeFailure) == 0)
|
||||
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()))
|
||||
|
@ -7575,7 +7583,7 @@ bool CeContext::Execute(CeFunction* startFunction, uint8* startStackPtr, uint8*
|
|||
auto valueType = GetBfType(objTypeId);
|
||||
if ((ifaceType == NULL) || (valueType == NULL))
|
||||
{
|
||||
_Fail("Invalid type");
|
||||
_Fail("Invalid type in CeOp_DynamicCastCheck");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -700,7 +700,8 @@ enum CeEvalFlags
|
|||
CeEvalFlags_DeferIfNotOnlyError = 4,
|
||||
CeEvalFlags_NoRebuild = 8,
|
||||
CeEvalFlags_ForceReturnThis = 0x10,
|
||||
CeEvalFlags_DbgCall = 0x20
|
||||
CeEvalFlags_IgnoreConstEncodeFailure = 0x20,
|
||||
CeEvalFlags_DbgCall = 0x40
|
||||
};
|
||||
|
||||
#define BF_CE_DEFAULT_STACK_SIZE 4*1024*1024
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue