Merge pull request #507 from Sonicadvance1/resizable_frontend_buffer

Adds resizable frontend decoded buffer
This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis authored and GitHub committed 2020-11-18 11:14:41 +02:00
commit 5ff2e0edf7
2 files changed
+13 -3

No files matched your search

+10 -2
View File
@@ -983,11 +983,19 @@ bool Decoder::DecodeInstructionsAtEntry(uint8_t const* _InstStream, uint64_t PC)
break;
}
if (DecodedSize >= CTX->Config.MaxInstPerBlock ||
DecodedSize >= DecodedBuffer.size()) {
if (DecodedSize >= CTX->Config.MaxInstPerBlock) {
break;
}
if (DecodedSize >= DecodedBuffer.size() &&
DecodedBuffer.size() == MaxDecodedBufferSize) {
break;
}
else if (DecodedSize >= DecodedBuffer.size()) {
// We can keep going
DecodedBuffer.resize(std::min(static_cast<size_t>(DecodedBuffer.size() * 1.5), MaxDecodedBufferSize));
}
if (TotalInstructions >= CTX->Config.MaxInstPerBlock) {
break;
}
+3 -1
View File
@@ -45,7 +45,9 @@ private:
bool NormalOp(FEXCore::X86Tables::X86InstInfo const *Info, uint16_t Op);
bool NormalOpHeader(FEXCore::X86Tables::X86InstInfo const *Info, uint16_t Op);
static constexpr size_t DefaultDecodedBufferSize = 0x10000;
static constexpr size_t DefaultDecodedBufferSize = 0x200;
static constexpr size_t MaxDecodedBufferSize = 0x10000;
std::vector<FEXCore::X86Tables::DecodedInst> DecodedBuffer;
size_t DecodedSize {};