mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Release mode fix
This commit is contained in:
parent
c0e19171d4
commit
15c62583a2
4 changed files with 28 additions and 13 deletions
|
@ -839,7 +839,7 @@ void BeIRCodeGen::Read(BeValue*& beValue)
|
||||||
{
|
{
|
||||||
auto val = values[i];
|
auto val = values[i];
|
||||||
BeConstant* constant = BeValueDynCast<BeConstant>(val);
|
BeConstant* constant = BeValueDynCast<BeConstant>(val);
|
||||||
#ifdef _DEBUG
|
|
||||||
if (type->IsSizedArray())
|
if (type->IsSizedArray())
|
||||||
{
|
{
|
||||||
auto arrayType = (BeSizedArrayType*)type;
|
auto arrayType = (BeSizedArrayType*)type;
|
||||||
|
@ -882,9 +882,9 @@ void BeIRCodeGen::Read(BeValue*& beValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
constStruct->mMemberValues.Add(constant);
|
constStruct->mMemberValues.Add(constant);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
beValue = constStruct;
|
beValue = constStruct;
|
||||||
|
|
||||||
BE_MEM_END("ParamType_Const_Array");
|
BE_MEM_END("ParamType_Const_Array");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1236,7 +1236,7 @@ void BeIRCodeGen::HandleNextCmd()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BfIRCmd_CreateConstAgg:
|
case BfIRCmd_CreateConstAgg:
|
||||||
{
|
{
|
||||||
CMD_PARAM(BeType*, type);
|
CMD_PARAM(BeType*, type);
|
||||||
CMD_PARAM(CmdParamVec<BeValue*>, values);
|
CMD_PARAM(CmdParamVec<BeValue*>, values);
|
||||||
|
|
||||||
|
|
|
@ -3005,6 +3005,12 @@ void BeModule::AddInst(BeInst* inst)
|
||||||
|
|
||||||
void BeModule::ToString(StringImpl& str, BeType* type)
|
void BeModule::ToString(StringImpl& str, BeType* type)
|
||||||
{
|
{
|
||||||
|
if (type == NULL)
|
||||||
|
{
|
||||||
|
str += "<MissingType>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (type->mTypeCode)
|
switch (type->mTypeCode)
|
||||||
{
|
{
|
||||||
case BeTypeCode_None:
|
case BeTypeCode_None:
|
||||||
|
|
|
@ -746,7 +746,7 @@ BfIRValue BfIRConstHolder::CreateConstAgg(BfIRType type, const BfSizedArray<BfIR
|
||||||
BF_ASSERT(val);
|
BF_ASSERT(val);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
BfConstantAgg* constant = mTempAlloc.Alloc<BfConstantAgg>();
|
BfConstantAgg* constant = mTempAlloc.Alloc<BfConstantAgg>();
|
||||||
constant->mConstType = BfConstType_Agg;
|
constant->mConstType = BfConstType_Agg;
|
||||||
constant->mType = type = type;
|
constant->mType = type = type;
|
||||||
|
@ -1297,9 +1297,12 @@ String BfIRBuilder::ToString(BfIRValue irValue)
|
||||||
}
|
}
|
||||||
else if (constant->mConstType == BfConstType_GlobalVar)
|
else if (constant->mConstType == BfConstType_GlobalVar)
|
||||||
{
|
{
|
||||||
if (mBfIRCodeGen != NULL)
|
auto gvConst = (BfGlobalVar*)constant;
|
||||||
|
if (gvConst->mStreamId == -1)
|
||||||
{
|
{
|
||||||
auto gvConst = (BfGlobalVar*)constant;
|
}
|
||||||
|
else if (mBfIRCodeGen != NULL)
|
||||||
|
{
|
||||||
auto val = mBfIRCodeGen->GetLLVMValue(gvConst->mStreamId);
|
auto val = mBfIRCodeGen->GetLLVMValue(gvConst->mStreamId);
|
||||||
std::string outStr;
|
std::string outStr;
|
||||||
llvm::raw_string_ostream strStream(outStr);
|
llvm::raw_string_ostream strStream(outStr);
|
||||||
|
@ -1308,8 +1311,7 @@ String BfIRBuilder::ToString(BfIRValue irValue)
|
||||||
return outStr;
|
return outStr;
|
||||||
}
|
}
|
||||||
else if (mBeIRCodeGen != NULL)
|
else if (mBeIRCodeGen != NULL)
|
||||||
{
|
{
|
||||||
auto gvConst = (BfGlobalVar*)constant;
|
|
||||||
auto val = mBeIRCodeGen->GetBeValue(gvConst->mStreamId);
|
auto val = mBeIRCodeGen->GetBeValue(gvConst->mStreamId);
|
||||||
String outStr;
|
String outStr;
|
||||||
BeDumpContext dumpCtx;
|
BeDumpContext dumpCtx;
|
||||||
|
@ -1317,7 +1319,7 @@ String BfIRBuilder::ToString(BfIRValue irValue)
|
||||||
return outStr;
|
return outStr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return "GlobalVar???";
|
return String("GlobalVar ") + gvConst->mName;
|
||||||
}
|
}
|
||||||
else if (constant->mConstType == BfConstType_BitCast)
|
else if (constant->mConstType == BfConstType_BitCast)
|
||||||
{
|
{
|
||||||
|
@ -1368,6 +1370,16 @@ String BfIRBuilder::ToString(BfIRValue irValue)
|
||||||
{
|
{
|
||||||
return ToString(constant->mIRType) + " zeroinitializer";
|
return ToString(constant->mIRType) + " zeroinitializer";
|
||||||
}
|
}
|
||||||
|
else if (constant->mConstType == BfConstType_TypeOf)
|
||||||
|
{
|
||||||
|
auto typeofConst = (BfTypeOf_Const*)constant;
|
||||||
|
return "typeof " + mModule->TypeToString(typeofConst->mType);
|
||||||
|
}
|
||||||
|
else if (constant->mConstType == BfConstType_TypeOf_WithData)
|
||||||
|
{
|
||||||
|
auto typeofConst = (BfTypeOf_WithData_Const*)constant;
|
||||||
|
return "typeof_withData " + mModule->TypeToString(typeofConst->mType);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BF_FATAL("Unhandled");
|
BF_FATAL("Unhandled");
|
||||||
|
@ -1485,7 +1497,7 @@ String BfIRBuilder::ToString(BfIRType irType)
|
||||||
}
|
}
|
||||||
else if (irType.mKind == BfIRTypeData::TypeKind_TypeId)
|
else if (irType.mKind == BfIRTypeData::TypeKind_TypeId)
|
||||||
{
|
{
|
||||||
return StrFormat("Type Id %d", irType.mId);
|
return StrFormat("Type Id %d (%s)", irType.mId, mModule->TypeToString(mModule->mContext->mTypes[irType.mId]).c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,9 +120,6 @@ namespace Tests
|
||||||
for (let field in typeof(T).GetFields())
|
for (let field in typeof(T).GetFields())
|
||||||
if (!field.IsStatic)
|
if (!field.IsStatic)
|
||||||
fieldCount++;
|
fieldCount++;
|
||||||
|
|
||||||
//Debug.WriteLine($"{fieldCount}");
|
|
||||||
|
|
||||||
return fieldCount;
|
return fieldCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue