LFG
This commit is contained in:
@@ -94,5 +94,18 @@ u32 Interpreter::Step() {
|
|||||||
return 1;
|
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
|
} // namespace n64
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace n64 {
|
|||||||
struct Core;
|
struct Core;
|
||||||
|
|
||||||
static constexpr u32 MAX_INSTRUCTION_PER_LINE = 128;
|
static constexpr u32 MAX_INSTRUCTION_PER_LINE = 128;
|
||||||
|
static constexpr u32 MAX_LINES_PER_BLOCK = 1 << 12;
|
||||||
|
|
||||||
struct CachedLine {
|
struct CachedLine {
|
||||||
std::array<u32, MAX_INSTRUCTION_PER_LINE> code;
|
std::array<u32, MAX_INSTRUCTION_PER_LINE> code;
|
||||||
@@ -14,7 +15,15 @@ struct CachedLine {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct CachedBlock {
|
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 {
|
struct Interpreter final {
|
||||||
@@ -29,6 +38,9 @@ struct Interpreter final {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct Cop1;
|
friend struct Cop1;
|
||||||
|
|
||||||
|
CachedState cachedState;
|
||||||
|
|
||||||
InstructionCache icache;
|
InstructionCache icache;
|
||||||
DataCache dcache;
|
DataCache dcache;
|
||||||
Registers ®s;
|
Registers ®s;
|
||||||
|
|||||||
Reference in New Issue
Block a user