Renamed the IR instruction, new UI button added

This commit is contained in:
Nemoumbra
2024-09-10 15:16:08 +03:00
parent a26afb4c2f
commit ff5877e993
6 changed files with 21 additions and 5 deletions
+1 -1
View File
@@ -309,7 +309,7 @@ void IRFrontend::DoJit(u32 em_address, std::vector<IRInst> &instructions, u32 &m
instructions.reserve(block_instructions.capacity());
// The first instruction is "Downcount"
instructions.push_back(block_instructions.front());
instructions.push_back({ IROp::LogBlockHash, 0, 0, 0, 0 });
instructions.push_back({ IROp::LogIRBlock, 0, 0, 0, 0 });
std::copy(block_instructions.begin() + 1, block_instructions.end(), std::back_inserter(instructions));
}
+1 -1
View File
@@ -238,7 +238,7 @@ enum class IROp : uint8_t {
ValidateAddress128,
// Tracing support.
LogBlockHash,
LogIRBlock,
Nop,
Bad,
+1 -1
View File
@@ -1237,7 +1237,7 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst) {
return mips->pc;
}
break;
case IROp::LogBlockHash:
case IROp::LogIRBlock:
if (mipsTracer.tracing_enabled) {
mipsTracer.executed_blocks.push_back(inst->constant);
}
+8 -2
View File
@@ -117,18 +117,24 @@ void MIPSTracer::flush_block_to_file(TraceBlockInfo& block_info) {
for (; addr < end_addr; addr += 4, ++index) {
snprintf(buffer, sizeof(buffer), "0x%08x: ", addr);
MIPSDisAsm(storage[index], addr, buffer + prefix_size, sizeof(buffer) - prefix_size, true);
// TODO: check if removing the std::string makes this faster
output << std::string(buffer) << "\n";
}
}
void MIPSTracer::start_tracing() {
if (!tracing_enabled) {
INFO_LOG(Log::JIT, "MIPSTracer enabled");
}
tracing_enabled = true;
INFO_LOG(Log::JIT, "MIPSTracer enabled");
}
void MIPSTracer::stop_tracing() {
if (tracing_enabled) {
INFO_LOG(Log::JIT, "MIPSTracer disabled");
}
tracing_enabled = false;
INFO_LOG(Log::JIT, "MIPSTracer disabled");
}
void MIPSTracer::initialize(u32 storage_capacity, u32 max_trace_size) {
+9
View File
@@ -1951,6 +1951,9 @@ void DeveloperToolsScreen::CreateViews() {
#endif
});
Button *InvalidateJitCache = list->Add(new Button(dev->T("Clear the JIT cache")));
InvalidateJitCache->OnClick.Handle(this, &DeveloperToolsScreen::OnMIPSTracerClearJitCache);
Draw::DrawContext *draw = screenManager()->getDrawContext();
list->Add(new ItemHeader(dev->T("Ubershaders")));
@@ -2184,6 +2187,12 @@ UI::EventReturn DeveloperToolsScreen::OnMIPSTracerFlushTrace(UI::EventParams &e)
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnMIPSTracerClearJitCache(UI::EventParams &e) {
INFO_LOG(Log::JIT, "Ordered to clear the jit cache");
System_PostUIMessage(UIMessage::REQUEST_CLEAR_JIT);
return UI::EVENT_DONE;
}
void DeveloperToolsScreen::update() {
UIDialogScreenWithBackground::update();
allowDebugger_ = !WebServerStopped(WebServerFlags::DEBUGGER);
+1
View File
@@ -153,6 +153,7 @@ private:
UI::EventReturn OnMIPSTracerEnabled(UI::EventParams &e);
UI::EventReturn OnMIPSTracerPathChanged(UI::EventParams &e);
UI::EventReturn OnMIPSTracerFlushTrace(UI::EventParams &e);
UI::EventReturn OnMIPSTracerClearJitCache(UI::EventParams &e);
UI::EventReturn OnGPUDriverTest(UI::EventParams &e);
UI::EventReturn OnFramedumpTest(UI::EventParams &e);
UI::EventReturn OnMemstickTest(UI::EventParams &e);