Browse Source

fix mk8d

lizzie/dynarmic-shared-labels-better
lizzie 6 days ago
parent
commit
6f2a737322
  1. 5
      src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.cpp
  2. 4
      src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.h
  3. 5
      src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.cpp
  4. 4
      src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.h
  5. 2
      src/dynarmic/src/dynarmic/backend/x64/emit_x64.cpp
  6. 5
      src/dynarmic/src/dynarmic/backend/x64/emit_x64.h

5
src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.cpp

@ -60,7 +60,7 @@ static Xbyak::Address MJitStateExtReg(A32::ExtReg reg) {
UNREACHABLE();
}
A32EmitContext::A32EmitContext(const A32::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, std::vector<Xbyak::Label>& shared_labels)
A32EmitContext::A32EmitContext(const A32::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, boost::container::stable_vector<Xbyak::Label>& shared_labels)
: EmitContext(reg_alloc, block, shared_labels)
, conf(conf)
{}
@ -113,9 +113,6 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
return gprs;
}(), any_xmm);
// up to 2 labels per insn
if (auto const inst_count = block.instructions.size(); inst_count > shared_labels.capacity())
shared_labels.reserve(inst_count * 16);
A32EmitContext ctx{conf, reg_alloc, block, shared_labels};
// Start emitting.

4
src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.h

@ -29,7 +29,7 @@ namespace Dynarmic::Backend::X64 {
class RegAlloc;
struct A32EmitContext final : public EmitContext {
A32EmitContext(const A32::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, std::vector<Xbyak::Label>& shared_labels);
A32EmitContext(const A32::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, boost::container::stable_vector<Xbyak::Label>& shared_labels);
A32::LocationDescriptor Location() const;
A32::LocationDescriptor EndLocation() const;
@ -130,7 +130,7 @@ public:
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
ankerl::unordered_dense::set<DoNotFastmemMarker> do_not_fastmem;
std::vector<Xbyak::Label> shared_labels;
boost::container::stable_vector<Xbyak::Label> shared_labels;
void (*memory_read_128)() = nullptr; // Dummy
void (*memory_write_128)() = nullptr; // Dummy
const void* terminal_handler_pop_rsb_hint;

5
src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.cpp

@ -38,7 +38,7 @@ namespace Dynarmic::Backend::X64 {
using namespace Xbyak::util;
A64EmitContext::A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, std::vector<Xbyak::Label>& shared_labels)
A64EmitContext::A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, boost::container::stable_vector<Xbyak::Label>& shared_labels)
: EmitContext(reg_alloc, block, shared_labels)
, conf(conf)
{}
@ -87,9 +87,6 @@ A64EmitX64::BlockDescriptor A64EmitX64::Emit(IR::Block& block) noexcept {
return gprs;
}(), any_xmm};
// up to 2 labels per insn
if (auto const inst_count = block.instructions.size(); inst_count > shared_labels.capacity())
shared_labels.reserve(inst_count * 16);
A64EmitContext ctx{conf, reg_alloc, block, shared_labels};
// Start emitting.

4
src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.h

@ -27,7 +27,7 @@
namespace Dynarmic::Backend::X64 {
struct A64EmitContext final : public EmitContext {
A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, std::vector<Xbyak::Label>& shared_labels);
A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block, boost::container::stable_vector<Xbyak::Label>& shared_labels);
A64::LocationDescriptor Location() const;
bool IsSingleStep() const;
@ -126,7 +126,7 @@ public:
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> write_fallbacks;
ankerl::unordered_dense::map<std::tuple<bool, size_t, int, int>, void (*)()> exclusive_write_fallbacks;
ankerl::unordered_dense::set<DoNotFastmemMarker> do_not_fastmem;
std::vector<Xbyak::Label> shared_labels;
boost::container::stable_vector<Xbyak::Label> shared_labels;
const void* terminal_handler_pop_rsb_hint = nullptr;
const void* terminal_handler_fast_dispatch_hint = nullptr;
FastDispatchEntry& (*fast_dispatch_table_lookup)(u64) = nullptr;

2
src/dynarmic/src/dynarmic/backend/x64/emit_x64.cpp

@ -33,7 +33,7 @@ namespace Dynarmic::Backend::X64 {
using namespace Xbyak::util;
EmitContext::EmitContext(RegAlloc& reg_alloc, IR::Block& block, std::vector<Xbyak::Label>& shared_labels)
EmitContext::EmitContext(RegAlloc& reg_alloc, IR::Block& block, boost::container::stable_vector<Xbyak::Label>& shared_labels)
: reg_alloc(reg_alloc)
, block(block)
, shared_labels(shared_labels)

5
src/dynarmic/src/dynarmic/backend/x64/emit_x64.h

@ -55,20 +55,19 @@ using HalfVectorArray = std::array<T, A64FullVectorWidth::value / mcl::bitsizeof
using SharedLabel = Xbyak::Label*;
struct EmitContext {
EmitContext(RegAlloc& reg_alloc, IR::Block& block, std::vector<Xbyak::Label>& shared_labels);
EmitContext(RegAlloc& reg_alloc, IR::Block& block, boost::container::stable_vector<Xbyak::Label>& shared_labels);
virtual ~EmitContext();
virtual FP::FPCR FPCR(bool fpcr_controlled = true) const = 0;
virtual bool HasOptimization(OptimizationFlag flag) const = 0;
[[nodiscard]] inline Xbyak::Label* GenSharedLabel() noexcept {
DEBUG_ASSERT(shared_labels.size() + 1 <= shared_labels.capacity());
return &shared_labels.emplace_back();
}
std::vector<std::function<void()>> deferred_emits;
RegAlloc& reg_alloc;
IR::Block& block;
std::vector<Xbyak::Label>& shared_labels;
boost::container::stable_vector<Xbyak::Label>& shared_labels;
};
class EmitX64 {

Loading…
Cancel
Save