Browse Source
[dynarmic] Refactoring to reduce latency hit from recompilation (#358)
[dynarmic] Refactoring to reduce latency hit from recompilation (#358)
Signed-off-by: lizzie <lizzie@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/358 Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>pull/2856/head
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
35 changed files with 346 additions and 460 deletions
-
7src/core/arm/dynarmic/arm_dynarmic_32.cpp
-
7src/core/arm/dynarmic/arm_dynarmic_64.cpp
-
4src/dynarmic/src/dynarmic/CMakeLists.txt
-
18src/dynarmic/src/dynarmic/backend/exception_handler.h
-
14src/dynarmic/src/dynarmic/backend/riscv64/a32_address_space.cpp
-
1src/dynarmic/src/dynarmic/backend/x64/a32_emit_x64.cpp
-
6src/dynarmic/src/dynarmic/backend/x64/a64_emit_x64.cpp
-
10src/dynarmic/src/dynarmic/backend/x64/a64_interface.cpp
-
8src/dynarmic/src/dynarmic/backend/x64/abi.cpp
-
4src/dynarmic/src/dynarmic/backend/x64/block_of_code.cpp
-
6src/dynarmic/src/dynarmic/backend/x64/emit_x64.cpp
-
7src/dynarmic/src/dynarmic/backend/x64/emit_x64_floating_point.cpp
-
93src/dynarmic/src/dynarmic/backend/x64/emit_x64_memory.cpp.inc
-
16src/dynarmic/src/dynarmic/backend/x64/emit_x64_vector.cpp
-
61src/dynarmic/src/dynarmic/backend/x64/reg_alloc.cpp
-
9src/dynarmic/src/dynarmic/backend/x64/reg_alloc.h
-
13src/dynarmic/src/dynarmic/common/memory_pool.cpp
-
65src/dynarmic/src/dynarmic/common/memory_pool.h
-
29src/dynarmic/src/dynarmic/common/variant_util.h
-
22src/dynarmic/src/dynarmic/frontend/A32/a32_types.h
-
20src/dynarmic/src/dynarmic/frontend/A32/decoder/arm.h
-
54src/dynarmic/src/dynarmic/frontend/A32/decoder/asimd.h
-
24src/dynarmic/src/dynarmic/frontend/A32/decoder/thumb16.h
-
24src/dynarmic/src/dynarmic/frontend/A32/decoder/thumb32.h
-
36src/dynarmic/src/dynarmic/frontend/A32/decoder/vfp.h
-
2src/dynarmic/src/dynarmic/frontend/A32/translate/translate_thumb.cpp
-
43src/dynarmic/src/dynarmic/frontend/A64/decoder/a64.h
-
12src/dynarmic/src/dynarmic/frontend/A64/translate/impl/a64_branch.cpp
-
69src/dynarmic/src/dynarmic/frontend/decoder/decoder_detail.h
-
51src/dynarmic/src/dynarmic/frontend/decoder/matcher.h
-
21src/dynarmic/src/dynarmic/ir/basic_block.cpp
-
11src/dynarmic/src/dynarmic/ir/basic_block.h
-
21src/dynarmic/src/dynarmic/ir/ir_emitter.cpp
-
2src/dynarmic/tests/decoder_tests.cpp
-
16src/dynarmic/tests/print_info.cpp
@ -1,13 +0,0 @@ |
|||||
/* This file is part of the dynarmic project.
|
|
||||
* Copyright (c) 2016 MerryMage |
|
||||
* SPDX-License-Identifier: 0BSD |
|
||||
*/ |
|
||||
|
|
||||
#include "dynarmic/common/memory_pool.h"
|
|
||||
|
|
||||
#include <cstdlib>
|
|
||||
|
|
||||
namespace Dynarmic::Common { |
|
||||
|
|
||||
|
|
||||
} // namespace Dynarmic::Common
|
|
||||
@ -1,65 +0,0 @@ |
|||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project |
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later |
|
||||
|
|
||||
/* This file is part of the dynarmic project. |
|
||||
* Copyright (c) 2016 MerryMage |
|
||||
* SPDX-License-Identifier: 0BSD |
|
||||
*/ |
|
||||
|
|
||||
#pragma once |
|
||||
|
|
||||
#include <cstddef> |
|
||||
#include <cstdlib> |
|
||||
#include <vector> |
|
||||
|
|
||||
namespace Dynarmic::Common { |
|
||||
|
|
||||
/// @tparam object_size Byte-size of objects to construct |
|
||||
/// @tparam slab_size Number of objects to have per slab |
|
||||
template<size_t object_size, size_t slab_size> |
|
||||
class Pool { |
|
||||
public: |
|
||||
inline Pool() noexcept { |
|
||||
AllocateNewSlab(); |
|
||||
} |
|
||||
inline ~Pool() noexcept { |
|
||||
std::free(current_slab); |
|
||||
for (char* slab : slabs) { |
|
||||
std::free(slab); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
Pool(const Pool&) = delete; |
|
||||
Pool(Pool&&) = delete; |
|
||||
|
|
||||
Pool& operator=(const Pool&) = delete; |
|
||||
Pool& operator=(Pool&&) = delete; |
|
||||
|
|
||||
/// @brief Returns a pointer to an `object_size`-bytes block of memory. |
|
||||
[[nodiscard]] void* Alloc() noexcept { |
|
||||
if (remaining == 0) { |
|
||||
slabs.push_back(current_slab); |
|
||||
AllocateNewSlab(); |
|
||||
} |
|
||||
void* ret = static_cast<void*>(current_ptr); |
|
||||
current_ptr += object_size; |
|
||||
remaining--; |
|
||||
return ret; |
|
||||
} |
|
||||
private: |
|
||||
/// @brief Allocates a completely new memory slab. |
|
||||
/// Used when an entirely new slab is needed |
|
||||
/// due the current one running out of usable space. |
|
||||
void AllocateNewSlab() noexcept { |
|
||||
current_slab = static_cast<char*>(std::malloc(object_size * slab_size)); |
|
||||
current_ptr = current_slab; |
|
||||
remaining = slab_size; |
|
||||
} |
|
||||
|
|
||||
std::vector<char*> slabs; |
|
||||
char* current_slab = nullptr; |
|
||||
char* current_ptr = nullptr; |
|
||||
size_t remaining = 0; |
|
||||
}; |
|
||||
|
|
||||
} // namespace Dynarmic::Common |
|
||||
@ -1,29 +0,0 @@ |
|||||
/* This file is part of the dynarmic project. |
|
||||
* Copyright (c) 2016 MerryMage |
|
||||
* SPDX-License-Identifier: 0BSD |
|
||||
*/ |
|
||||
|
|
||||
#pragma once |
|
||||
|
|
||||
#include <boost/variant.hpp> |
|
||||
|
|
||||
namespace Dynarmic::Common { |
|
||||
namespace detail { |
|
||||
|
|
||||
template<typename ReturnT, typename Lambda> |
|
||||
struct VariantVisitor : boost::static_visitor<ReturnT> |
|
||||
, Lambda { |
|
||||
VariantVisitor(Lambda&& lambda) |
|
||||
: Lambda(std::move(lambda)) {} |
|
||||
|
|
||||
using Lambda::operator(); |
|
||||
}; |
|
||||
|
|
||||
} // namespace detail |
|
||||
|
|
||||
template<typename ReturnT, typename Variant, typename Lambda> |
|
||||
inline ReturnT VisitVariant(Variant&& variant, Lambda&& lambda) { |
|
||||
return boost::apply_visitor(detail::VariantVisitor<ReturnT, Lambda>(std::move(lambda)), variant); |
|
||||
} |
|
||||
|
|
||||
} // namespace Dynarmic::Common |
|
||||
@ -1,21 +0,0 @@ |
|||||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||
|
|
||||
/* This file is part of the dynarmic project.
|
|
||||
* Copyright (c) 2016 MerryMage |
|
||||
* SPDX-License-Identifier: 0BSD |
|
||||
*/ |
|
||||
|
|
||||
#include "dynarmic/ir/ir_emitter.h"
|
|
||||
|
|
||||
#include <vector>
|
|
||||
|
|
||||
#include "dynarmic/common/assert.h"
|
|
||||
#include <mcl/bit_cast.hpp>
|
|
||||
|
|
||||
#include "dynarmic/ir/opcodes.h"
|
|
||||
|
|
||||
namespace Dynarmic::IR { |
|
||||
|
|
||||
|
|
||||
} // namespace Dynarmic::IR
|
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue