Code cleanup: moving poly logging to xenia
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "xenia/cpu/backend/x64/x64_code_cache.h"
|
||||
|
||||
#include "poly/poly.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -193,7 +194,7 @@ void X64CodeChunk::AddTableEntry(uint8_t* code, size_t code_size,
|
||||
if (fn_table_count + 1 > fn_table_capacity) {
|
||||
// Table exhausted, need to realloc. If this happens a lot we should tune
|
||||
// the table size to prevent this.
|
||||
PLOGW("X64CodeCache growing FunctionTable - adjust ESTIMATED_FN_SIZE");
|
||||
XELOGW("X64CodeCache growing FunctionTable - adjust ESTIMATED_FN_SIZE");
|
||||
RtlDeleteGrowableFunctionTable(fn_table_handle);
|
||||
size_t old_size = fn_table_capacity * sizeof(RUNTIME_FUNCTION);
|
||||
size_t new_size = old_size * 2;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
|
||||
#include "poly/vec128.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/backend/x64/x64_code_cache.h"
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
@@ -20,9 +21,9 @@
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
#include "poly/vec128.h"
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
#include "xdb/protocol.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -201,7 +202,7 @@ int X64Emitter::Emit(HIRBuilder* builder, size_t& out_stack_size) {
|
||||
if (!SelectSequence(*this, instr, &new_tail)) {
|
||||
// No sequence found!
|
||||
assert_always();
|
||||
PLOGE("Unable to process HIR opcode %s", instr->opcode->name);
|
||||
XELOGE("Unable to process HIR opcode %s", instr->opcode->name);
|
||||
break;
|
||||
}
|
||||
instr = new_tail;
|
||||
@@ -373,7 +374,7 @@ uint64_t TrapDebugPrint(void* raw_context, uint64_t address) {
|
||||
uint16_t str_len = uint16_t(thread_state->context()->r[4]);
|
||||
auto str = thread_state->memory()->TranslateVirtual<const char*>(str_ptr);
|
||||
// TODO(benvanik): truncate to length?
|
||||
PLOGD("(DebugPrint) %s", str);
|
||||
XELOGD("(DebugPrint) %s", str);
|
||||
return 0;
|
||||
}
|
||||
void X64Emitter::Trap(uint16_t trap_type) {
|
||||
@@ -395,7 +396,7 @@ void X64Emitter::Trap(uint16_t trap_type) {
|
||||
// ?
|
||||
break;
|
||||
default:
|
||||
PLOGW("Unknown trap type %d", trap_type);
|
||||
XELOGW("Unknown trap type %d", trap_type);
|
||||
db(0xCC);
|
||||
break;
|
||||
}
|
||||
@@ -620,8 +621,8 @@ void X64Emitter::CallIndirect(const hir::Instr* instr, const Reg64& reg) {
|
||||
|
||||
uint64_t UndefinedCallExtern(void* raw_context, uint64_t symbol_info_ptr) {
|
||||
auto symbol_info = reinterpret_cast<FunctionInfo*>(symbol_info_ptr);
|
||||
PLOGW("undefined extern call to %.8llX %s", symbol_info->address(),
|
||||
symbol_info->name().c_str());
|
||||
XELOGW("undefined extern call to %.8llX %s", symbol_info->address(),
|
||||
symbol_info->name().c_str());
|
||||
return 0;
|
||||
}
|
||||
void X64Emitter::CallExtern(const hir::Instr* instr,
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -5877,7 +5878,7 @@ bool SelectSequence(X64Emitter& e, const Instr* i, const Instr** new_tail) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
PLOGE("No sequence match for variant %s", i->opcode->name);
|
||||
XELOGE("No sequence match for variant %s", i->opcode->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -146,7 +147,7 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) {
|
||||
// We spill only those registers we aren't using.
|
||||
if (!SpillOneRegister(builder, block, instr->dest->type)) {
|
||||
// Unable to spill anything - this shouldn't happen.
|
||||
PLOGE("Unable to spill any registers");
|
||||
XELOGE("Unable to spill any registers");
|
||||
assert_always();
|
||||
return 1;
|
||||
}
|
||||
@@ -154,7 +155,7 @@ int RegisterAllocationPass::Run(HIRBuilder* builder) {
|
||||
// Demand allocation.
|
||||
if (!TryAllocateRegister(instr->dest)) {
|
||||
// Boned.
|
||||
PLOGE("Register allocation failed");
|
||||
XELOGE("Register allocation failed");
|
||||
assert_always();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -114,7 +115,7 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
instr_offset_list_[offset] = first_instr;
|
||||
|
||||
if (!i.type) {
|
||||
PLOGE("Invalid instruction %.8llX %.8X", i.address, i.code);
|
||||
XELOGE("Invalid instruction %.8llX %.8X", i.address, i.code);
|
||||
Comment("INVALID!");
|
||||
// TraceInvalidInstruction(i);
|
||||
continue;
|
||||
@@ -130,8 +131,8 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
}
|
||||
|
||||
if (!i.type->emit || emit(*this, i)) {
|
||||
PLOGE("Unimplemented instr %.8llX %.8X %s", i.address, i.code,
|
||||
i.type->name);
|
||||
XELOGE("Unimplemented instr %.8llX %.8X %s", i.address, i.code,
|
||||
i.type->name);
|
||||
Comment("UNIMPLEMENTED!");
|
||||
// DebugBreak();
|
||||
// TraceInvalidInstruction(i);
|
||||
|
||||
@@ -12,17 +12,17 @@
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/frontend/ppc_instr.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "poly/logging.h"
|
||||
#include "poly/memory.h"
|
||||
#include "xenia/logging.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
#if 0
|
||||
#define LOGPPC(fmt, ...) PLOGCORE('p', fmt, ##__VA_ARGS__)
|
||||
#define LOGPPC(fmt, ...) XELOGCORE('p', fmt, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOGPPC(fmt, ...) POLY_EMPTY_MACRO
|
||||
#define LOGPPC(fmt, ...) XE_EMPTY_MACRO
|
||||
#endif
|
||||
|
||||
namespace xe {
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "poly/main.h"
|
||||
#include "poly/poly.h"
|
||||
#include "xenia/cpu/cpu.h"
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/frontend/ppc_context.h"
|
||||
#include "xenia/cpu/frontend/ppc_frontend.h"
|
||||
#include "xenia/cpu/raw_module.h"
|
||||
#include "poly/main.h"
|
||||
#include "poly/poly.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
#if !XE_PLATFORM_WIN32
|
||||
#include <dirent.h>
|
||||
@@ -56,11 +57,11 @@ class TestSuite {
|
||||
|
||||
bool Load() {
|
||||
if (!ReadMap(map_file_path)) {
|
||||
PLOGE("Unable to read map for test %ls", src_file_path.c_str());
|
||||
XELOGE("Unable to read map for test %ls", src_file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
if (!ReadAnnotations(src_file_path)) {
|
||||
PLOGE("Unable to read annotations for test %ls", src_file_path.c_str());
|
||||
XELOGE("Unable to read annotations for test %ls", src_file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -138,8 +139,8 @@ class TestSuite {
|
||||
std::string label(start + strlen("test_"), strchr(start, ':'));
|
||||
current_test_case = FindTestCase(label);
|
||||
if (!current_test_case) {
|
||||
PLOGE("Test case %s not found in corresponding map for %ls",
|
||||
label.c_str(), src_file_path.c_str());
|
||||
XELOGE("Test case %s not found in corresponding map for %ls",
|
||||
label.c_str(), src_file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
} else if (strlen(start) > 3 && start[0] == '#' && start[1] == '_') {
|
||||
@@ -154,8 +155,8 @@ class TestSuite {
|
||||
value.erase(value.end() - 1);
|
||||
}
|
||||
if (!current_test_case) {
|
||||
PLOGE("Annotation outside of test case in %ls",
|
||||
src_file_path.c_str());
|
||||
XELOGE("Annotation outside of test case in %ls",
|
||||
src_file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
current_test_case->annotations.emplace_back(key, value);
|
||||
@@ -188,7 +189,7 @@ class TestRunner {
|
||||
// Load the binary module.
|
||||
auto module = std::make_unique<xe::cpu::RawModule>(runtime.get());
|
||||
if (module->LoadFile(START_ADDRESS, suite.bin_file_path)) {
|
||||
PLOGE("Unable to load test binary %ls", suite.bin_file_path.c_str());
|
||||
XELOGE("Unable to load test binary %ls", suite.bin_file_path.c_str());
|
||||
return false;
|
||||
}
|
||||
runtime->AddModule(std::move(module));
|
||||
@@ -206,7 +207,7 @@ class TestRunner {
|
||||
bool Run(TestCase& test_case) {
|
||||
// Setup test state from annotations.
|
||||
if (!SetupTestState(test_case)) {
|
||||
PLOGE("Test setup failed");
|
||||
XELOGE("Test setup failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -214,7 +215,7 @@ class TestRunner {
|
||||
xe::cpu::Function* fn;
|
||||
runtime->ResolveFunction(test_case.address, &fn);
|
||||
if (!fn) {
|
||||
PLOGE("Entry function not found");
|
||||
XELOGE("Entry function not found");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -325,7 +326,7 @@ bool DiscoverTests(std::wstring& test_path,
|
||||
WIN32_FIND_DATA ffd;
|
||||
HANDLE hFind = FindFirstFile(search_path.c_str(), &ffd);
|
||||
if (hFind == INVALID_HANDLE_VALUE) {
|
||||
PLOGE("Unable to find test path %ls", test_path.c_str());
|
||||
XELOGE("Unable to find test path %ls", test_path.c_str());
|
||||
return false;
|
||||
}
|
||||
do {
|
||||
@@ -343,7 +344,7 @@ bool DiscoverTests(std::wstring& test_path,
|
||||
#else
|
||||
DIR* d = opendir(test_path.c_str());
|
||||
if (!d) {
|
||||
PLOGE("Unable to find test path %ls", test_path.c_str());
|
||||
XELOGE("Unable to find test path %ls", test_path.c_str());
|
||||
return false;
|
||||
}
|
||||
struct dirent* dir;
|
||||
@@ -378,11 +379,11 @@ bool RunTests(const std::wstring& test_name) {
|
||||
return false;
|
||||
}
|
||||
if (!test_files.size()) {
|
||||
PLOGE("No tests discovered - invalid path?");
|
||||
XELOGE("No tests discovered - invalid path?");
|
||||
return false;
|
||||
}
|
||||
PLOGI("%d tests discovered.", (int)test_files.size());
|
||||
PLOGI("");
|
||||
XELOGI("%d tests discovered.", (int)test_files.size());
|
||||
XELOGI("");
|
||||
|
||||
std::vector<TestSuite> test_suites;
|
||||
bool load_failed = false;
|
||||
@@ -392,7 +393,7 @@ bool RunTests(const std::wstring& test_name) {
|
||||
continue;
|
||||
}
|
||||
if (!test_suite.Load()) {
|
||||
PLOGE("TEST SUITE %ls FAILED TO LOAD", test_path.c_str());
|
||||
XELOGE("TEST SUITE %ls FAILED TO LOAD", test_path.c_str());
|
||||
load_failed = true;
|
||||
continue;
|
||||
}
|
||||
@@ -403,30 +404,30 @@ bool RunTests(const std::wstring& test_name) {
|
||||
}
|
||||
|
||||
for (auto& test_suite : test_suites) {
|
||||
PLOGI("%ls.s:", test_suite.name.c_str());
|
||||
XELOGI("%ls.s:", test_suite.name.c_str());
|
||||
|
||||
for (auto& test_case : test_suite.test_cases) {
|
||||
PLOGI(" - %s", test_case.name.c_str());
|
||||
XELOGI(" - %s", test_case.name.c_str());
|
||||
TestRunner runner;
|
||||
if (!runner.Setup(test_suite)) {
|
||||
PLOGE(" TEST FAILED SETUP");
|
||||
XELOGE(" TEST FAILED SETUP");
|
||||
++failed_count;
|
||||
}
|
||||
if (runner.Run(test_case)) {
|
||||
++passed_count;
|
||||
} else {
|
||||
PLOGE(" TEST FAILED");
|
||||
XELOGE(" TEST FAILED");
|
||||
++failed_count;
|
||||
}
|
||||
}
|
||||
|
||||
PLOGI("");
|
||||
XELOGI("");
|
||||
}
|
||||
|
||||
PLOGI("");
|
||||
PLOGI("Total tests: %d", failed_count + passed_count);
|
||||
PLOGI("Passed: %d", passed_count);
|
||||
PLOGI("Failed: %d", failed_count);
|
||||
XELOGI("");
|
||||
XELOGI("Total tests: %d", failed_count + passed_count);
|
||||
XELOGI("Passed: %d", passed_count);
|
||||
XELOGI("Failed: %d", failed_count);
|
||||
|
||||
return failed_count ? false : true;
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
|
||||
#include "xenia/cpu/function.h"
|
||||
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/cpu/debugger.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
#include "poly/logging.h"
|
||||
#include "xdb/protocol.h"
|
||||
#include "xenia/logging.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -91,8 +91,8 @@ int Function::Call(ThreadState* thread_state, uint32_t return_address) {
|
||||
handler(thread_state->context(), symbol_info_->extern_arg0(),
|
||||
symbol_info_->extern_arg1());
|
||||
} else {
|
||||
PLOGW("undefined extern call to %.8llX %s", symbol_info_->address(),
|
||||
symbol_info_->name().c_str());
|
||||
XELOGW("undefined extern call to %.8llX %s", symbol_info_->address(),
|
||||
symbol_info_->name().c_str());
|
||||
result = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user