This commit is contained in:
2026-05-22 18:00:20 +02:00
parent b6452880a9
commit 72253d9d6a
2 changed files with 27 additions and 2 deletions
+14 -1
View File
@@ -94,5 +94,18 @@ u32 Interpreter::Step() {
return 1;
}
u32 Interpreter::ExecuteCached() {}
u32 DivideAddr(u32 addr, u32& offset) {
offset = (addr & (MAX_LINES_PER_BLOCK - 1)) / 4;
return addr / MAX_LINES_PER_BLOCK;
}
CachedLine* GetLine(CachedState& cachedState, u32 addr) {
u32 offset;
u32 page = DivideAddr(addr, offset);
return cachedState.blocks[page][offset].lines[0];
}
u32 Interpreter::ExecuteCached() {
}
} // namespace n64
+13 -1
View File
@@ -6,6 +6,7 @@ namespace n64 {
struct Core;
static constexpr u32 MAX_INSTRUCTION_PER_LINE = 128;
static constexpr u32 MAX_LINES_PER_BLOCK = 1 << 12;
struct CachedLine {
std::array<u32, MAX_INSTRUCTION_PER_LINE> code;
@@ -14,7 +15,15 @@ struct CachedLine {
};
struct CachedBlock {
std::vector<CachedLine> lines;
std::array<CachedLine*, MAX_LINES_PER_BLOCK / 4> lines;
};
using CachedBlocks = std::array<std::vector<CachedBlock>, (u64(std::numeric_limits<u32>::max()) + 1) / MAX_LINES_PER_BLOCK>;
struct CachedState {
CachedBlocks blocks;
CachedLine* lastLine = nullptr;
bool exception = false;
};
struct Interpreter final {
@@ -29,6 +38,9 @@ struct Interpreter final {
private:
friend struct Cop1;
CachedState cachedState;
InstructionCache icache;
DataCache dcache;
Registers &regs;