Skip to content

Commit

Permalink
Merge pull request #4272 from bylaws/declimit
Browse files Browse the repository at this point in the history
Frontend: Stop all decoding once MaxInst/DecodeBufferSize is reached
  • Loading branch information
alyssarosenzweig authored Jan 14, 2025
2 parents 8cfc016 + 5481e6d commit f635a12
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions FEXCore/Source/Interface/Core/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,9 @@ void Decoder::DecodeInstructionsAtEntry(const uint8_t* _InstStream, uint64_t PC,
}

bool EntryBlock {true};
bool FinalInstruction {false};

while (!BlocksToDecode.empty()) {
while (!FinalInstruction && !BlocksToDecode.empty()) {
auto BlockDecodeIt = BlocksToDecode.begin();
uint64_t RIPToDecode = *BlockDecodeIt;
BlockInfo.Blocks.emplace_back();
Expand Down Expand Up @@ -1158,7 +1159,7 @@ void Decoder::DecodeInstructionsAtEntry(const uint8_t* _InstStream, uint64_t PC,
CanContinue = true;
}

bool FinalInstruction = DecodedSize >= MaxInst || DecodedSize >= DefaultDecodedBufferSize || TotalInstructions >= MaxInst;
FinalInstruction = DecodedSize >= MaxInst || DecodedSize >= DefaultDecodedBufferSize || TotalInstructions >= MaxInst;

if (DecodeInst->TableInfo->Flags & FEXCore::X86Tables::InstFlags::FLAGS_SETS_RIP) {
// If we have multiblock enabled
Expand Down

0 comments on commit f635a12

Please sign in to comment.