Fix assert in linux sample build

This commit is contained in:
drmortalwombat 2024-02-28 21:26:25 +01:00
parent 2d50d56606
commit f877e5b8c2
2 changed files with 16 additions and 9 deletions

View File

@ -162,14 +162,15 @@ void GlobalAnalyzer::AutoInline(void)
{ {
Declaration* f = mTopoFunctions[i]; Declaration* f = mTopoFunctions[i];
if (!(f->mFlags & DTF_INLINE) && if (f->mType == DT_CONST_FUNCTION &&
!(f->mFlags & DTF_INLINE) &&
!(f->mFlags & DTF_EXPORT) && !(f->mFlags & DTF_EXPORT) &&
!(f->mFlags & DTF_PREVENT_INLINE) && !(f->mFlags & DTF_PREVENT_INLINE) &&
!(f->mBase->mFlags & DTF_VARIADIC) && !(f->mBase->mFlags & DTF_VARIADIC) &&
!(f->mFlags & DTF_FUNC_VARIABLE) && !(f->mFlags & DTF_FUNC_VARIABLE) &&
!((f->mFlags & DTF_FUNC_ASSEMBLER) && !(f->mFlags & DTF_REQUEST_INLINE)) && !((f->mFlags & DTF_FUNC_ASSEMBLER) && !(f->mFlags & DTF_REQUEST_INLINE)) &&
!(f->mFlags & DTF_INTRINSIC) && !(f->mFlags & DTF_INTRINSIC) &&
!(f->mFlags & DTF_FUNC_RECURSIVE) && f->mLocalSize < 100) !(f->mFlags & DTF_FUNC_RECURSIVE))
{ {
int nparams = 0; int nparams = 0;
Declaration* dec = f->mBase->mParams; Declaration* dec = f->mBase->mParams;
@ -186,18 +187,21 @@ void GlobalAnalyzer::AutoInline(void)
bool doinline = false; bool doinline = false;
if ((f->mCompilerOptions & COPT_OPTIMIZE_INLINE) && (f->mFlags & DTF_REQUEST_INLINE)) if ((f->mCompilerOptions & COPT_OPTIMIZE_INLINE) && (f->mFlags & DTF_REQUEST_INLINE))
doinline = true; doinline = true;
if ((f->mCompilerOptions & COPT_OPTIMIZE_AUTO_INLINE) && ((cost - 20) * (f->mCallers.Size() - 1) <= 20)) if (f->mLocalSize < 100)
{ {
if (f->mCallers.Size() == 1 && f->mComplexity > 100) if ((f->mCompilerOptions & COPT_OPTIMIZE_AUTO_INLINE) && ((cost - 20) * (f->mCallers.Size() - 1) <= 20))
{ {
if (f->mCallers[0]->mCalled.Size() == 1) if (f->mCallers.Size() == 1 && f->mComplexity > 100)
{
if (f->mCallers[0]->mCalled.Size() == 1)
doinline = true;
}
else
doinline = true; doinline = true;
} }
else if ((f->mCompilerOptions & COPT_OPTIMIZE_AUTO_INLINE_ALL) && (cost * (f->mCallers.Size() - 1) <= 10000))
doinline = true; doinline = true;
} }
if ((f->mCompilerOptions & COPT_OPTIMIZE_AUTO_INLINE_ALL) && (cost * (f->mCallers.Size() - 1) <= 10000))
doinline = true;
if (doinline) if (doinline)
{ {

View File

@ -423,7 +423,10 @@ NativeCodeInstruction::NativeCodeInstruction(const InterInstruction* ins, AsmIns
NativeCodeInstruction::NativeCodeInstruction(const InterInstruction* ins, AsmInsType type, const NativeCodeInstruction& addr) NativeCodeInstruction::NativeCodeInstruction(const InterInstruction* ins, AsmInsType type, const NativeCodeInstruction& addr)
: mIns(ins), mType(type), mMode(addr.mMode), mAddress(addr.mAddress), mLinkerObject(addr.mLinkerObject), mFlags(addr.mFlags), mParam(addr.mParam), mLive(LIVE_ALL) : mIns(ins), mType(type), mMode(addr.mMode), mAddress(addr.mAddress), mLinkerObject(addr.mLinkerObject), mFlags(addr.mFlags), mParam(addr.mParam), mLive(LIVE_ALL)
{ {
assert(mIns->mLocation.mFileName); if (mIns)
{
assert(mIns->mLocation.mFileName);
}
} }