Browse Source
[dynarmic] reduce opt pass latency
[dynarmic] reduce opt pass latency
Signed-off-by: lizzie <lizzie@eden-emu.dev>pull/358/head
committed by
crueter
7 changed files with 3 additions and 123 deletions
-
3src/dynarmic/src/dynarmic/CMakeLists.txt
-
14src/dynarmic/src/dynarmic/backend/riscv64/a32_address_space.cpp
-
13src/dynarmic/src/dynarmic/common/memory_pool.cpp
-
65src/dynarmic/src/dynarmic/common/memory_pool.h
-
7src/dynarmic/src/dynarmic/ir/basic_block.cpp
-
3src/dynarmic/src/dynarmic/ir/basic_block.h
-
21src/dynarmic/src/dynarmic/ir/ir_emitter.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,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