Limit inline expansion depth
This commit is contained in:
parent
bf825302aa
commit
acc87d50fe
|
@ -2786,6 +2786,19 @@ void InterCodeBasicBlock::PerformMachineSpecificValueUsageCheck(const GrowingIns
|
|||
|
||||
if (mTrueJump) mTrueJump->PerformMachineSpecificValueUsageCheck(ltvalue, tvalid);
|
||||
if (mFalseJump) mFalseJump->PerformMachineSpecificValueUsageCheck(ltvalue, tvalid);
|
||||
|
||||
if (mInstructions.Size() > 0 && mInstructions[mInstructions.Size() - 1]->mCode == IC_BRANCH && mInstructions[mInstructions.Size() - 1]->mSTemp[0] < 0)
|
||||
{
|
||||
mInstructions[mInstructions.Size() - 1]->mCode = IC_JUMP;
|
||||
if (!mInstructions[mInstructions.Size() - 1]->mSIntConst[0])
|
||||
{
|
||||
mTrueJump->mNumEntries--;
|
||||
mTrueJump = mFalseJump;
|
||||
}
|
||||
else
|
||||
mFalseJump->mNumEntries--;
|
||||
mFalseJump = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1531,7 +1531,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
|
||||
return ExValue(TheVoidTypeDeclaration);
|
||||
}
|
||||
else if (exp->mLeft->mType == EX_CONSTANT && exp->mLeft->mDecValue->mType == DT_CONST_FUNCTION && (exp->mLeft->mDecValue->mFlags & DTF_INLINE))
|
||||
else if (exp->mLeft->mType == EX_CONSTANT && exp->mLeft->mDecValue->mType == DT_CONST_FUNCTION && (exp->mLeft->mDecValue->mFlags & DTF_INLINE) && !(inlineMapper && inlineMapper->mDepth > 3))
|
||||
{
|
||||
Declaration* fdec = exp->mLeft->mDecValue;
|
||||
Expression* fexp = fdec->mValue;
|
||||
|
@ -1539,6 +1539,8 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration*
|
|||
|
||||
InlineMapper nmapper;
|
||||
nmapper.mReturn = new InterCodeBasicBlock();
|
||||
if (inlineMapper)
|
||||
nmapper.mDepth = inlineMapper->mDepth + 1;
|
||||
proc->Append(nmapper.mReturn);
|
||||
|
||||
Declaration* pdec = ftype->mParams;
|
||||
|
|
|
@ -34,10 +34,10 @@ protected:
|
|||
{
|
||||
GrowingArray<int> mParams;
|
||||
InterCodeBasicBlock * mReturn;
|
||||
int mResult;
|
||||
int mResult, mDepth;
|
||||
|
||||
InlineMapper(void)
|
||||
: mParams(-1), mResult(-1)
|
||||
: mParams(-1), mResult(-1), mDepth(0)
|
||||
{}
|
||||
};
|
||||
|
||||
|
|
|
@ -5844,6 +5844,7 @@ void NativeCodeBasicBlock::CallAssembler(InterCodeProcedure* proc, const InterIn
|
|||
if (ins->mCode == IC_ASSEMBLER && mNoFrame)
|
||||
ins->mLinkerObject->mFlags |= LOBJF_NO_FRAME;
|
||||
|
||||
assert(ins->mLinkerObject);
|
||||
mIns.Push(NativeCodeInstruction(ASMIT_JSR, ASMIM_ABSOLUTE, ins->mSIntConst[0], ins->mLinkerObject));
|
||||
|
||||
if (ins->mTTemp >= 0)
|
||||
|
|
Loading…
Reference in New Issue