1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Release mode fix

This commit is contained in:
Brian Fiete 2021-01-19 07:56:18 -08:00
parent c0e19171d4
commit 15c62583a2
4 changed files with 28 additions and 13 deletions

View file

@ -839,7 +839,7 @@ void BeIRCodeGen::Read(BeValue*& beValue)
{
auto val = values[i];
BeConstant* constant = BeValueDynCast<BeConstant>(val);
#ifdef _DEBUG
if (type->IsSizedArray())
{
auto arrayType = (BeSizedArrayType*)type;
@ -882,9 +882,9 @@ void BeIRCodeGen::Read(BeValue*& beValue)
}
constStruct->mMemberValues.Add(constant);
#endif
}
beValue = constStruct;
BE_MEM_END("ParamType_Const_Array");
return;
}
@ -1236,7 +1236,7 @@ void BeIRCodeGen::HandleNextCmd()
}
break;
case BfIRCmd_CreateConstAgg:
{
{
CMD_PARAM(BeType*, type);
CMD_PARAM(CmdParamVec<BeValue*>, values);

View file

@ -3005,6 +3005,12 @@ void BeModule::AddInst(BeInst* inst)
void BeModule::ToString(StringImpl& str, BeType* type)
{
if (type == NULL)
{
str += "<MissingType>";
return;
}
switch (type->mTypeCode)
{
case BeTypeCode_None:

View file

@ -746,7 +746,7 @@ BfIRValue BfIRConstHolder::CreateConstAgg(BfIRType type, const BfSizedArray<BfIR
BF_ASSERT(val);
}
#endif
BfConstantAgg* constant = mTempAlloc.Alloc<BfConstantAgg>();
constant->mConstType = BfConstType_Agg;
constant->mType = type = type;
@ -1297,9 +1297,12 @@ String BfIRBuilder::ToString(BfIRValue irValue)
}
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);
std::string outStr;
llvm::raw_string_ostream strStream(outStr);
@ -1308,8 +1311,7 @@ String BfIRBuilder::ToString(BfIRValue irValue)
return outStr;
}
else if (mBeIRCodeGen != NULL)
{
auto gvConst = (BfGlobalVar*)constant;
{
auto val = mBeIRCodeGen->GetBeValue(gvConst->mStreamId);
String outStr;
BeDumpContext dumpCtx;
@ -1317,7 +1319,7 @@ String BfIRBuilder::ToString(BfIRValue irValue)
return outStr;
}
else
return "GlobalVar???";
return String("GlobalVar ") + gvConst->mName;
}
else if (constant->mConstType == BfConstType_BitCast)
{
@ -1368,6 +1370,16 @@ String BfIRBuilder::ToString(BfIRValue irValue)
{
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
{
BF_FATAL("Unhandled");
@ -1485,7 +1497,7 @@ String BfIRBuilder::ToString(BfIRType irType)
}
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
{

View file

@ -120,9 +120,6 @@ namespace Tests
for (let field in typeof(T).GetFields())
if (!field.IsStatic)
fieldCount++;
//Debug.WriteLine($"{fieldCount}");
return fieldCount;
}