mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-05-13 10:58:39 +02:00
[*] change all std::unordered_map and std::unordered_set into ankerl::unordered_dense::map/set variants (#3442)
mainly doing this to reduce memory footprint; we all know how nice ankerl::unordered_dense is in theory 4x faster - in practice these maps arent that "hot" anyways so not likely to have much perf gained i just want to reduce mem fragmentation to ease my porting process, plus it helps other platforms as well (ahem weak Mediatek devices) :) Signed-off-by: lizzie <lizzie@eden-emu.dev> Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3442 Reviewed-by: DraVee <dravee@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
0f8b35c4cd
commit
a8093c2a3c
87 changed files with 368 additions and 254 deletions
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
|
@ -16,7 +19,7 @@
|
|||
#include <deque>
|
||||
#include <map>
|
||||
#include <span>
|
||||
#include <unordered_map>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
|
|
@ -50,8 +53,8 @@ struct IndirectBranchVariable {
|
|||
auto operator<=>(const IndirectBranchVariable&) const noexcept = default;
|
||||
};
|
||||
|
||||
using Variant = std::variant<IR::Reg, IR::Pred, ZeroFlagTag, SignFlagTag, CarryFlagTag,
|
||||
OverflowFlagTag, GotoVariable, IndirectBranchVariable>;
|
||||
using Variant = std::variant<IR::Reg, IR::Pred, ZeroFlagTag, SignFlagTag, CarryFlagTag, OverflowFlagTag, GotoVariable, IndirectBranchVariable>;
|
||||
// TODO: majority of these require stable iterators, test with XC beforehand
|
||||
using ValueMap = std::unordered_map<IR::Block*, IR::Value>;
|
||||
|
||||
struct DefTable {
|
||||
|
|
@ -112,6 +115,7 @@ struct DefTable {
|
|||
}
|
||||
|
||||
std::array<ValueMap, IR::NUM_USER_PREDS> preds;
|
||||
// TODO: Requires stable iterators
|
||||
std::unordered_map<u32, ValueMap> goto_vars;
|
||||
ValueMap indirect_branch_var;
|
||||
ValueMap zero_flag;
|
||||
|
|
@ -165,7 +169,8 @@ public:
|
|||
|
||||
template <typename Type>
|
||||
IR::Value ReadVariable(Type variable, IR::Block* root_block) {
|
||||
boost::container::small_vector<ReadState<Type>, 64> stack{
|
||||
// TODO: Windows commits sodoku if you use small_vector
|
||||
std::vector<ReadState<Type>> stack{
|
||||
ReadState<Type>(nullptr),
|
||||
ReadState<Type>(root_block),
|
||||
};
|
||||
|
|
@ -295,6 +300,7 @@ private:
|
|||
return same;
|
||||
}
|
||||
|
||||
// TODO: Windows dies with stack exhaustion?
|
||||
std::unordered_map<IR::Block*, std::map<Variant, IR::Inst*>> incomplete_phis;
|
||||
DefTable current_def;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
#include <tuple>
|
||||
#include <limits>
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue