Merging Runtime into Processor.
This commit is contained in:
@@ -17,7 +17,6 @@ namespace cpu {
|
||||
class DebugInfo;
|
||||
class Function;
|
||||
class FunctionInfo;
|
||||
class Runtime;
|
||||
namespace hir {
|
||||
class HIRBuilder;
|
||||
} // namespace hir
|
||||
|
||||
@@ -13,9 +13,7 @@ namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
|
||||
using xe::cpu::Runtime;
|
||||
|
||||
Backend::Backend(Runtime* runtime) : runtime_(runtime) {
|
||||
Backend::Backend(Processor* processor) : processor_(processor) {
|
||||
memset(&machine_info_, 0, sizeof(machine_info_));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
class Runtime;
|
||||
class Processor;
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
@@ -28,10 +28,10 @@ class Assembler;
|
||||
|
||||
class Backend {
|
||||
public:
|
||||
Backend(Runtime* runtime);
|
||||
Backend(Processor* processor);
|
||||
virtual ~Backend();
|
||||
|
||||
Runtime* runtime() const { return runtime_; }
|
||||
Processor* processor() const { return processor_; }
|
||||
const MachineInfo* machine_info() const { return &machine_info_; }
|
||||
|
||||
virtual int Initialize();
|
||||
@@ -42,7 +42,7 @@ class Backend {
|
||||
virtual std::unique_ptr<Assembler> CreateAssembler() = 0;
|
||||
|
||||
protected:
|
||||
Runtime* runtime_;
|
||||
Processor* processor_;
|
||||
MachineInfo machine_info_;
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/hir/label.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
namespace BE {
|
||||
|
||||
@@ -19,9 +19,8 @@ namespace cpu {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
using xe::cpu::Runtime;
|
||||
|
||||
X64Backend::X64Backend(Runtime* runtime) : Backend(runtime), code_cache_(0) {}
|
||||
X64Backend::X64Backend(Processor* processor)
|
||||
: Backend(processor), code_cache_(nullptr) {}
|
||||
|
||||
X64Backend::~X64Backend() { delete code_cache_; }
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef void* (*GuestToHostThunk)(void* target, void* arg0, void* arg1);
|
||||
|
||||
class X64Backend : public Backend {
|
||||
public:
|
||||
X64Backend(Runtime* runtime);
|
||||
X64Backend(Processor* processor);
|
||||
~X64Backend() override;
|
||||
|
||||
X64CodeCache* code_cache() const { return code_cache_; }
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/debug_info.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
#include "xenia/profiling.h"
|
||||
@@ -60,7 +60,7 @@ const uint32_t X64Emitter::xmm_reg_map_[X64Emitter::XMM_COUNT] = {
|
||||
|
||||
X64Emitter::X64Emitter(X64Backend* backend, XbyakAllocator* allocator)
|
||||
: CodeGenerator(MAX_CODE_SIZE, AutoGrow, allocator),
|
||||
runtime_(backend->runtime()),
|
||||
processor_(backend->processor()),
|
||||
backend_(backend),
|
||||
code_cache_(backend->code_cache()),
|
||||
allocator_(allocator),
|
||||
@@ -217,7 +217,8 @@ void X64Emitter::MarkSourceOffset(const Instr* i) {
|
||||
|
||||
void X64Emitter::EmitGetCurrentThreadId() {
|
||||
// rcx must point to context. We could fetch from the stack if needed.
|
||||
mov(ax, word[rcx + runtime_->frontend()->context_info()->thread_id_offset()]);
|
||||
mov(ax,
|
||||
word[rcx + processor_->frontend()->context_info()->thread_id_offset()]);
|
||||
}
|
||||
|
||||
void X64Emitter::EmitTraceUserCallReturn() {}
|
||||
@@ -279,7 +280,7 @@ uint64_t ResolveFunctionSymbol(void* raw_context, uint64_t symbol_info_ptr) {
|
||||
|
||||
// Resolve function. This will demand compile as required.
|
||||
Function* fn = NULL;
|
||||
thread_state->runtime()->ResolveFunction(symbol_info->address(), &fn);
|
||||
thread_state->processor()->ResolveFunction(symbol_info->address(), &fn);
|
||||
assert_not_null(fn);
|
||||
auto x64_fn = static_cast<X64Function*>(fn);
|
||||
uint64_t addr = reinterpret_cast<uint64_t>(x64_fn->machine_code());
|
||||
@@ -361,7 +362,7 @@ uint64_t ResolveFunctionAddress(void* raw_context, uint32_t target_address) {
|
||||
assert_not_zero(target_address);
|
||||
|
||||
Function* fn = NULL;
|
||||
thread_state->runtime()->ResolveFunction(target_address, &fn);
|
||||
thread_state->processor()->ResolveFunction(target_address, &fn);
|
||||
assert_not_null(fn);
|
||||
auto x64_fn = static_cast<X64Function*>(fn);
|
||||
uint64_t addr = reinterpret_cast<uint64_t>(x64_fn->machine_code());
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace xe {
|
||||
namespace cpu {
|
||||
class DebugInfo;
|
||||
class FunctionInfo;
|
||||
class Runtime;
|
||||
class Processor;
|
||||
class SymbolInfo;
|
||||
namespace hir {
|
||||
class HIRBuilder;
|
||||
@@ -101,7 +101,7 @@ class X64Emitter : public Xbyak::CodeGenerator {
|
||||
X64Emitter(X64Backend* backend, XbyakAllocator* allocator);
|
||||
virtual ~X64Emitter();
|
||||
|
||||
Runtime* runtime() const { return runtime_; }
|
||||
Processor* processor() const { return processor_; }
|
||||
X64Backend* backend() const { return backend_; }
|
||||
const Xbyak::util::Cpu* cpu() const { return &cpu_; }
|
||||
|
||||
@@ -187,7 +187,7 @@ class X64Emitter : public Xbyak::CodeGenerator {
|
||||
void EmitTraceUserCallReturn();
|
||||
|
||||
protected:
|
||||
Runtime* runtime_;
|
||||
Processor* processor_;
|
||||
X64Backend* backend_;
|
||||
X64CodeCache* code_cache_;
|
||||
XbyakAllocator* allocator_;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
namespace xe {
|
||||
@@ -35,7 +35,8 @@ int X64Function::AddBreakpointImpl(Breakpoint* breakpoint) { return 0; }
|
||||
int X64Function::RemoveBreakpointImpl(Breakpoint* breakpoint) { return 0; }
|
||||
|
||||
int X64Function::CallImpl(ThreadState* thread_state, uint32_t return_address) {
|
||||
auto backend = (X64Backend*)thread_state->runtime()->backend();
|
||||
auto backend =
|
||||
reinterpret_cast<X64Backend*>(thread_state->processor()->backend());
|
||||
auto thunk = backend->host_to_guest_thunk();
|
||||
thunk(machine_code_, thread_state->context(),
|
||||
reinterpret_cast<void*>(uintptr_t(return_address)));
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "xenia/base/vec128.h"
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/processor.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
using namespace xe;
|
||||
|
||||
Reference in New Issue
Block a user