Moving cpu/runtime/ to cpu/.
This commit is contained in:
@@ -14,15 +14,13 @@
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace hir {
|
||||
class HIRBuilder;
|
||||
} // namespace hir
|
||||
namespace runtime {
|
||||
class DebugInfo;
|
||||
class Function;
|
||||
class FunctionInfo;
|
||||
class Runtime;
|
||||
} // namespace runtime
|
||||
namespace hir {
|
||||
class HIRBuilder;
|
||||
} // namespace hir
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
@@ -41,11 +39,10 @@ class Assembler {
|
||||
|
||||
virtual void Reset();
|
||||
|
||||
virtual int Assemble(runtime::FunctionInfo* symbol_info,
|
||||
hir::HIRBuilder* builder, uint32_t debug_info_flags,
|
||||
std::unique_ptr<runtime::DebugInfo> debug_info,
|
||||
uint32_t trace_flags,
|
||||
runtime::Function** out_function) = 0;
|
||||
virtual int Assemble(FunctionInfo* symbol_info, hir::HIRBuilder* builder,
|
||||
uint32_t debug_info_flags,
|
||||
std::unique_ptr<DebugInfo> debug_info,
|
||||
uint32_t trace_flags, Function** out_function) = 0;
|
||||
|
||||
protected:
|
||||
Backend* backend_;
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
|
||||
using xe::cpu::runtime::Runtime;
|
||||
using xe::cpu::Runtime;
|
||||
|
||||
Backend::Backend(Runtime* runtime) : runtime_(runtime) {
|
||||
memset(&machine_info_, 0, sizeof(machine_info_));
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace runtime {
|
||||
class Runtime;
|
||||
} // namespace runtime
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
@@ -30,10 +28,10 @@ class Assembler;
|
||||
|
||||
class Backend {
|
||||
public:
|
||||
Backend(runtime::Runtime* runtime);
|
||||
Backend(Runtime* runtime);
|
||||
virtual ~Backend();
|
||||
|
||||
runtime::Runtime* runtime() const { return runtime_; }
|
||||
Runtime* runtime() const { return runtime_; }
|
||||
const MachineInfo* machine_info() const { return &machine_info_; }
|
||||
|
||||
virtual int Initialize();
|
||||
@@ -44,7 +42,7 @@ class Backend {
|
||||
virtual std::unique_ptr<Assembler> CreateAssembler() = 0;
|
||||
|
||||
protected:
|
||||
runtime::Runtime* runtime_;
|
||||
Runtime* runtime_;
|
||||
MachineInfo machine_info_;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,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/runtime.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "poly/reset_scope.h"
|
||||
#include "xenia/profiling.h"
|
||||
|
||||
@@ -28,12 +28,9 @@ namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
// TODO(benvanik): remove when enums redefined.
|
||||
using namespace xe::cpu::runtime;
|
||||
using namespace xe::cpu;
|
||||
|
||||
using xe::cpu::hir::HIRBuilder;
|
||||
using xe::cpu::runtime::DebugInfo;
|
||||
using xe::cpu::runtime::Function;
|
||||
using xe::cpu::runtime::FunctionInfo;
|
||||
|
||||
X64Assembler::X64Assembler(X64Backend* backend)
|
||||
: Assembler(backend), x64_backend_(backend) {}
|
||||
|
||||
@@ -33,13 +33,12 @@ class X64Assembler : public Assembler {
|
||||
|
||||
void Reset() override;
|
||||
|
||||
int Assemble(runtime::FunctionInfo* symbol_info, hir::HIRBuilder* builder,
|
||||
uint32_t debug_info_flags,
|
||||
std::unique_ptr<runtime::DebugInfo> debug_info,
|
||||
uint32_t trace_flags, runtime::Function** out_function) override;
|
||||
int Assemble(FunctionInfo* symbol_info, hir::HIRBuilder* builder,
|
||||
uint32_t debug_info_flags, std::unique_ptr<DebugInfo> debug_info,
|
||||
uint32_t trace_flags, Function** out_function) override;
|
||||
|
||||
private:
|
||||
void DumpMachineCode(runtime::DebugInfo* debug_info, void* machine_code,
|
||||
void DumpMachineCode(DebugInfo* debug_info, void* machine_code,
|
||||
size_t code_size, poly::StringBuffer* str);
|
||||
|
||||
private:
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace cpu {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
using xe::cpu::runtime::Runtime;
|
||||
using xe::cpu::Runtime;
|
||||
|
||||
X64Backend::X64Backend(Runtime* runtime) : Backend(runtime), code_cache_(0) {}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef void* (*GuestToHostThunk)(void* target, void* arg0, void* arg1);
|
||||
|
||||
class X64Backend : public Backend {
|
||||
public:
|
||||
X64Backend(runtime::Runtime* runtime);
|
||||
X64Backend(Runtime* runtime);
|
||||
~X64Backend() override;
|
||||
|
||||
X64CodeCache* code_cache() const { return code_cache_; }
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
#include "xenia/cpu/backend/x64/x64_thunk_emitter.h"
|
||||
#include "xenia/cpu/cpu-private.h"
|
||||
#include "xenia/cpu/hir/hir_builder.h"
|
||||
#include "xenia/cpu/runtime/debug_info.h"
|
||||
#include "xenia/cpu/runtime/runtime.h"
|
||||
#include "xenia/cpu/runtime/symbol_info.h"
|
||||
#include "xenia/cpu/runtime/thread_state.h"
|
||||
#include "xenia/cpu/debug_info.h"
|
||||
#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/profiling.h"
|
||||
@@ -31,7 +31,7 @@ namespace x64 {
|
||||
|
||||
// TODO(benvanik): remove when enums redefined.
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::runtime;
|
||||
using namespace xe::cpu;
|
||||
|
||||
using poly::vec128b;
|
||||
using poly::vec128f;
|
||||
@@ -40,10 +40,6 @@ using poly::vec128i;
|
||||
using namespace Xbyak;
|
||||
using xe::cpu::hir::HIRBuilder;
|
||||
using xe::cpu::hir::Instr;
|
||||
using xe::cpu::runtime::Function;
|
||||
using xe::cpu::runtime::FunctionInfo;
|
||||
using xe::cpu::runtime::SourceMapEntry;
|
||||
using xe::cpu::runtime::ThreadState;
|
||||
|
||||
static const size_t MAX_CODE_SIZE = 1 * 1024 * 1024;
|
||||
|
||||
@@ -76,7 +72,7 @@ X64Emitter::~X64Emitter() {}
|
||||
int X64Emitter::Initialize() { return 0; }
|
||||
|
||||
int X64Emitter::Emit(HIRBuilder* builder, uint32_t debug_info_flags,
|
||||
runtime::DebugInfo* debug_info, uint32_t trace_flags,
|
||||
DebugInfo* debug_info, uint32_t trace_flags,
|
||||
void*& out_code_address, size_t& out_code_size) {
|
||||
SCOPE_profile_cpu_f("cpu");
|
||||
|
||||
@@ -439,8 +435,7 @@ uint64_t ResolveFunctionSymbol(void* raw_context, uint64_t symbol_info_ptr) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
void X64Emitter::Call(const hir::Instr* instr,
|
||||
runtime::FunctionInfo* symbol_info) {
|
||||
void X64Emitter::Call(const hir::Instr* instr, FunctionInfo* symbol_info) {
|
||||
auto fn = reinterpret_cast<X64Function*>(symbol_info->function());
|
||||
// Resolve address to the function to call and store in rax.
|
||||
if (fn) {
|
||||
|
||||
@@ -16,16 +16,14 @@
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace hir {
|
||||
class HIRBuilder;
|
||||
class Instr;
|
||||
} // namespace hir
|
||||
namespace runtime {
|
||||
class DebugInfo;
|
||||
class FunctionInfo;
|
||||
class Runtime;
|
||||
class SymbolInfo;
|
||||
} // namespace runtime
|
||||
namespace hir {
|
||||
class HIRBuilder;
|
||||
class Instr;
|
||||
} // namespace hir
|
||||
} // namespace cpu
|
||||
} // namespace xe
|
||||
|
||||
@@ -103,14 +101,14 @@ class X64Emitter : public Xbyak::CodeGenerator {
|
||||
X64Emitter(X64Backend* backend, XbyakAllocator* allocator);
|
||||
virtual ~X64Emitter();
|
||||
|
||||
runtime::Runtime* runtime() const { return runtime_; }
|
||||
Runtime* runtime() const { return runtime_; }
|
||||
X64Backend* backend() const { return backend_; }
|
||||
|
||||
int Initialize();
|
||||
|
||||
int Emit(hir::HIRBuilder* builder, uint32_t debug_info_flags,
|
||||
runtime::DebugInfo* debug_info, uint32_t trace_flags,
|
||||
void*& out_code_address, size_t& out_code_size);
|
||||
DebugInfo* debug_info, uint32_t trace_flags, void*& out_code_address,
|
||||
size_t& out_code_size);
|
||||
|
||||
public:
|
||||
// Reserved: rsp
|
||||
@@ -149,10 +147,9 @@ class X64Emitter : public Xbyak::CodeGenerator {
|
||||
void UnimplementedInstr(const hir::Instr* i);
|
||||
void UnimplementedExtern(const hir::Instr* i);
|
||||
|
||||
void Call(const hir::Instr* instr, runtime::FunctionInfo* symbol_info);
|
||||
void Call(const hir::Instr* instr, FunctionInfo* symbol_info);
|
||||
void CallIndirect(const hir::Instr* instr, const Xbyak::Reg64& reg);
|
||||
void CallExtern(const hir::Instr* instr,
|
||||
const runtime::FunctionInfo* symbol_info);
|
||||
void CallExtern(const hir::Instr* instr, const FunctionInfo* symbol_info);
|
||||
void CallNative(void* fn);
|
||||
void CallNative(uint64_t (*fn)(void* raw_context));
|
||||
void CallNative(uint64_t (*fn)(void* raw_context, uint64_t arg0));
|
||||
@@ -191,7 +188,7 @@ class X64Emitter : public Xbyak::CodeGenerator {
|
||||
void EmitTraceUserCallReturn();
|
||||
|
||||
protected:
|
||||
runtime::Runtime* runtime_;
|
||||
Runtime* runtime_;
|
||||
X64Backend* backend_;
|
||||
X64CodeCache* code_cache_;
|
||||
XbyakAllocator* allocator_;
|
||||
|
||||
@@ -10,19 +10,14 @@
|
||||
#include "xenia/cpu/backend/x64/x64_function.h"
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_backend.h"
|
||||
#include "xenia/cpu/runtime/runtime.h"
|
||||
#include "xenia/cpu/runtime/thread_state.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
using xe::cpu::runtime::Breakpoint;
|
||||
using xe::cpu::runtime::Function;
|
||||
using xe::cpu::runtime::FunctionInfo;
|
||||
using xe::cpu::runtime::ThreadState;
|
||||
|
||||
X64Function::X64Function(FunctionInfo* symbol_info)
|
||||
: Function(symbol_info), machine_code_(nullptr), code_size_(0) {}
|
||||
|
||||
|
||||
@@ -10,17 +10,18 @@
|
||||
#ifndef XENIA_BACKEND_X64_X64_FUNCTION_H_
|
||||
#define XENIA_BACKEND_X64_X64_FUNCTION_H_
|
||||
|
||||
#include "xenia/cpu/runtime/function.h"
|
||||
#include "xenia/cpu/runtime/symbol_info.h"
|
||||
#include "xenia/cpu/function.h"
|
||||
#include "xenia/cpu/symbol_info.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
namespace x64 {
|
||||
|
||||
class X64Function : public runtime::Function {
|
||||
class X64Function : public Function {
|
||||
public:
|
||||
X64Function(runtime::FunctionInfo* symbol_info);
|
||||
X64Function(FunctionInfo* symbol_info);
|
||||
virtual ~X64Function();
|
||||
|
||||
void* machine_code() const { return machine_code_; }
|
||||
@@ -29,10 +30,9 @@ class X64Function : public runtime::Function {
|
||||
void Setup(void* machine_code, size_t code_size);
|
||||
|
||||
protected:
|
||||
virtual int AddBreakpointImpl(runtime::Breakpoint* breakpoint);
|
||||
virtual int RemoveBreakpointImpl(runtime::Breakpoint* breakpoint);
|
||||
virtual int CallImpl(runtime::ThreadState* thread_state,
|
||||
uint64_t return_address);
|
||||
virtual int AddBreakpointImpl(Breakpoint* breakpoint);
|
||||
virtual int RemoveBreakpointImpl(Breakpoint* breakpoint);
|
||||
virtual int CallImpl(ThreadState* thread_state, uint64_t return_address);
|
||||
|
||||
private:
|
||||
void* machine_code_;
|
||||
|
||||
@@ -27,7 +27,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/runtime.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
@@ -38,7 +38,7 @@ using namespace Xbyak;
|
||||
|
||||
// TODO(benvanik): direct usings.
|
||||
using namespace xe::cpu::hir;
|
||||
using namespace xe::cpu::runtime;
|
||||
using namespace xe::cpu;
|
||||
|
||||
using poly::vec128b;
|
||||
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#include "xenia/cpu/backend/x64/x64_tracers.h"
|
||||
|
||||
#include "xenia/cpu/backend/x64/x64_emitter.h"
|
||||
#include "xenia/cpu/runtime/runtime.h"
|
||||
#include "xenia/cpu/runtime/thread_state.h"
|
||||
#include "xenia/cpu/runtime.h"
|
||||
#include "xenia/cpu/thread_state.h"
|
||||
|
||||
using namespace xe;
|
||||
using namespace xe::cpu::backend::x64;
|
||||
using namespace xe::cpu::runtime;
|
||||
using namespace xe::cpu;
|
||||
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
|
||||
Reference in New Issue
Block a user