a32_interface: remove Context

This commit is contained in:
Liam 2023-03-14 17:12:19 -04:00 committed by merry
parent b3a92ab54d
commit 4ad2dee67b
5 changed files with 0 additions and 202 deletions

View file

@ -16,64 +16,11 @@
#include "dynarmic/backend/arm64/a32_jitstate.h" #include "dynarmic/backend/arm64/a32_jitstate.h"
#include "dynarmic/common/atomic.h" #include "dynarmic/common/atomic.h"
#include "dynarmic/interface/A32/a32.h" #include "dynarmic/interface/A32/a32.h"
#include "dynarmic/interface/A32/context.h"
namespace Dynarmic::A32 { namespace Dynarmic::A32 {
using namespace Backend::Arm64; using namespace Backend::Arm64;
struct Context::Impl {
A32JitState state;
};
Context::Context()
: impl(std::make_unique<Context::Impl>()) {}
Context::~Context() = default;
Context::Context(const Context& ctx)
: impl(std::make_unique<Context::Impl>(*ctx.impl)) {}
Context::Context(Context&& ctx) noexcept
: impl(std::move(ctx.impl)) {}
Context& Context::operator=(const Context& ctx) {
*impl = *ctx.impl;
return *this;
}
Context& Context::operator=(Context&& ctx) noexcept {
impl = std::move(ctx.impl);
return *this;
}
std::array<std::uint32_t, 16>& Context::Regs() {
return impl->state.regs;
}
const std::array<std::uint32_t, 16>& Context::Regs() const {
return impl->state.regs;
}
std::array<std::uint32_t, 64>& Context::ExtRegs() {
return impl->state.ext_regs;
}
const std::array<std::uint32_t, 64>& Context::ExtRegs() const {
return impl->state.ext_regs;
}
std::uint32_t Context::Cpsr() const {
return impl->state.Cpsr();
}
void Context::SetCpsr(std::uint32_t value) {
impl->state.SetCpsr(value);
}
std::uint32_t Context::Fpscr() const {
return impl->state.Fpscr();
}
void Context::SetFpscr(std::uint32_t value) {
return impl->state.SetFpscr(value);
}
struct Jit::Impl final { struct Jit::Impl final {
Impl(Jit* jit_interface, A32::UserConfig conf) Impl(Jit* jit_interface, A32::UserConfig conf)
: jit_interface(jit_interface) : jit_interface(jit_interface)
@ -171,20 +118,6 @@ struct Jit::Impl final {
current_state.SetFpscr(value); current_state.SetFpscr(value);
} }
Context SaveContext() const {
Context ctx;
ctx.impl->state = current_state;
return ctx;
}
void SaveContext(Context& ctx) const {
ctx.impl->state = current_state;
}
void LoadContext(const Context& ctx) {
current_state = ctx.impl->state;
}
void ClearExclusiveState() { void ClearExclusiveState() {
current_state.exclusive_state = false; current_state.exclusive_state = false;
} }
@ -295,18 +228,6 @@ void Jit::SetFpscr(std::uint32_t value) {
impl->SetFpscr(value); impl->SetFpscr(value);
} }
Context Jit::SaveContext() const {
return impl->SaveContext();
}
void Jit::SaveContext(Context& ctx) const {
impl->SaveContext(ctx);
}
void Jit::LoadContext(const Context& ctx) {
impl->LoadContext(ctx);
}
void Jit::ClearExclusiveState() { void Jit::ClearExclusiveState() {
impl->ClearExclusiveState(); impl->ClearExclusiveState();
} }

View file

@ -23,7 +23,6 @@
#include "dynarmic/common/x64_disassemble.h" #include "dynarmic/common/x64_disassemble.h"
#include "dynarmic/frontend/A32/translate/a32_translate.h" #include "dynarmic/frontend/A32/translate/a32_translate.h"
#include "dynarmic/interface/A32/a32.h" #include "dynarmic/interface/A32/a32.h"
#include "dynarmic/interface/A32/context.h"
#include "dynarmic/ir/basic_block.h" #include "dynarmic/ir/basic_block.h"
#include "dynarmic/ir/location_descriptor.h" #include "dynarmic/ir/location_descriptor.h"
#include "dynarmic/ir/opt/passes.h" #include "dynarmic/ir/opt/passes.h"
@ -75,7 +74,6 @@ struct Jit::Impl {
const A32::UserConfig conf; const A32::UserConfig conf;
// Requests made during execution to invalidate the cache are queued up here. // Requests made during execution to invalidate the cache are queued up here.
size_t invalid_cache_generation = 0;
boost::icl::interval_set<u32> invalid_cache_ranges; boost::icl::interval_set<u32> invalid_cache_ranges;
bool invalidate_entire_cache = false; bool invalidate_entire_cache = false;
@ -118,7 +116,6 @@ struct Jit::Impl {
invalid_cache_ranges.clear(); invalid_cache_ranges.clear();
invalidate_entire_cache = false; invalidate_entire_cache = false;
invalid_cache_generation++;
return; return;
} }
@ -129,7 +126,6 @@ struct Jit::Impl {
jit_state.ResetRSB(); jit_state.ResetRSB();
emitter.InvalidateCacheRanges(invalid_cache_ranges); emitter.InvalidateCacheRanges(invalid_cache_ranges);
invalid_cache_ranges.clear(); invalid_cache_ranges.clear();
invalid_cache_generation++;
} }
void RequestCacheInvalidation() { void RequestCacheInvalidation() {
@ -281,72 +277,6 @@ void Jit::SetFpscr(u32 value) {
return impl->jit_state.SetFpscr(value); return impl->jit_state.SetFpscr(value);
} }
Context Jit::SaveContext() const {
Context ctx;
SaveContext(ctx);
return ctx;
}
struct Context::Impl {
A32JitState jit_state;
size_t invalid_cache_generation;
};
Context::Context()
: impl(std::make_unique<Context::Impl>()) {
impl->jit_state.ResetRSB();
}
Context::~Context() = default;
Context::Context(const Context& ctx)
: impl(std::make_unique<Context::Impl>(*ctx.impl)) {}
Context::Context(Context&& ctx) noexcept
: impl(std::move(ctx.impl)) {}
Context& Context::operator=(const Context& ctx) {
*impl = *ctx.impl;
return *this;
}
Context& Context::operator=(Context&& ctx) noexcept {
impl = std::move(ctx.impl);
return *this;
}
std::array<std::uint32_t, 16>& Context::Regs() {
return impl->jit_state.Reg;
}
const std::array<std::uint32_t, 16>& Context::Regs() const {
return impl->jit_state.Reg;
}
std::array<std::uint32_t, 64>& Context::ExtRegs() {
return impl->jit_state.ExtReg;
}
const std::array<std::uint32_t, 64>& Context::ExtRegs() const {
return impl->jit_state.ExtReg;
}
std::uint32_t Context::Cpsr() const {
return impl->jit_state.Cpsr();
}
void Context::SetCpsr(std::uint32_t value) {
impl->jit_state.SetCpsr(value);
}
std::uint32_t Context::Fpscr() const {
return impl->jit_state.Fpscr();
}
void Context::SetFpscr(std::uint32_t value) {
return impl->jit_state.SetFpscr(value);
}
void Jit::SaveContext(Context& ctx) const {
ctx.impl->jit_state.TransferJitState(impl->jit_state, false);
ctx.impl->invalid_cache_generation = impl->invalid_cache_generation;
}
void Jit::LoadContext(const Context& ctx) {
bool reset_rsb = ctx.impl->invalid_cache_generation != impl->invalid_cache_generation;
impl->jit_state.TransferJitState(ctx.impl->jit_state, reset_rsb);
}
void Jit::DumpDisassembly() const { void Jit::DumpDisassembly() const {
const size_t size = reinterpret_cast<const char*>(impl->block_of_code.getCurr()) - reinterpret_cast<const char*>(impl->block_of_code.GetCodeBegin()); const size_t size = reinterpret_cast<const char*>(impl->block_of_code.getCurr()) - reinterpret_cast<const char*>(impl->block_of_code.GetCodeBegin());
Common::DumpDisassembledX64(impl->block_of_code.GetCodeBegin(), size); Common::DumpDisassembledX64(impl->block_of_code.GetCodeBegin(), size);

View file

@ -17,8 +17,6 @@
namespace Dynarmic { namespace Dynarmic {
namespace A32 { namespace A32 {
struct Context;
class Jit final { class Jit final {
public: public:
explicit Jit(UserConfig conf); explicit Jit(UserConfig conf);
@ -80,10 +78,6 @@ public:
std::uint32_t Fpscr() const; std::uint32_t Fpscr() const;
void SetFpscr(std::uint32_t value); void SetFpscr(std::uint32_t value);
Context SaveContext() const;
void SaveContext(Context&) const;
void LoadContext(const Context&);
/// Clears exclusive state for this core. /// Clears exclusive state for this core.
void ClearExclusiveState(); void ClearExclusiveState();

View file

@ -1,45 +0,0 @@
/* This file is part of the dynarmic project.
* Copyright (c) 2016 MerryMage
* SPDX-License-Identifier: 0BSD
*/
#pragma once
#include <array>
#include <cstdint>
#include <memory>
namespace Dynarmic {
namespace A32 {
struct Context {
public:
Context();
~Context();
Context(const Context&);
Context(Context&&) noexcept;
Context& operator=(const Context&);
Context& operator=(Context&&) noexcept;
/// View and modify registers.
std::array<std::uint32_t, 16>& Regs();
const std::array<std::uint32_t, 16>& Regs() const;
std::array<std::uint32_t, 64>& ExtRegs();
const std::array<std::uint32_t, 64>& ExtRegs() const;
/// View and modify CPSR.
std::uint32_t Cpsr() const;
void SetCpsr(std::uint32_t value);
/// View and modify FPSCR.
std::uint32_t Fpscr() const;
void SetFpscr(std::uint32_t value);
private:
friend class Jit;
struct Impl;
std::unique_ptr<Impl> impl;
};
} // namespace A32
} // namespace Dynarmic

View file

@ -18,8 +18,6 @@
namespace Dynarmic { namespace Dynarmic {
namespace A64 { namespace A64 {
struct Context;
class Jit final { class Jit final {
public: public:
explicit Jit(UserConfig conf); explicit Jit(UserConfig conf);