diff --git a/.gitmodules b/.gitmodules index 9b89d58d..6253fc74 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,9 +13,6 @@ [submodule "oaknut"] path = externals/oaknut url = https://git.eden-emu.dev/eden-emu/oaknut.git -[submodule "robin-map"] - path = externals/robin-map - url = https://git.eden-emu.dev/eden-emu/robin-map.git [submodule "xbyak"] path = externals/xbyak url = https://git.eden-emu.dev/eden-emu/xbyak.git @@ -25,3 +22,6 @@ [submodule "zydis"] path = externals/zydis url = https://git.eden-emu.dev/eden-emu/zydis.git +[submodule "unordered_dense"] + path = externals/unordered_dense + url = https://github.com/Lizzie841/unordered_dense.git diff --git a/CMakeLists.txt b/CMakeLists.txt index e95050da..8f9cad94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,18 +135,15 @@ if (DYNARMIC_USE_BUNDLED_EXTERNALS) set(CMAKE_DISABLE_FIND_PACKAGE_fmt ON) set(CMAKE_DISABLE_FIND_PACKAGE_mcl ON) set(CMAKE_DISABLE_FIND_PACKAGE_oaknut ON) - set(CMAKE_DISABLE_FIND_PACKAGE_tsl-robin-map ON) + set(CMAKE_DISABLE_FIND_PACKAGE_unordered_dense ON) set(CMAKE_DISABLE_FIND_PACKAGE_xbyak ON) set(CMAKE_DISABLE_FIND_PACKAGE_Zydis ON) endif() -# Ensure that robin-map `export`s -set(TSL_ROBIN_MAP_ENABLE_INSTALL ON) - find_package(Boost 1.57 REQUIRED) find_package(fmt 9 CONFIG) find_package(mcl 0.1.12 EXACT CONFIG) -find_package(tsl-robin-map CONFIG) +find_package(unordered_dense CONFIG) if ("arm64" IN_LIST ARCHITECTURE OR DYNARMIC_TESTS) find_package(oaknut 2.0.1 CONFIG) diff --git a/CMakeModules/dynarmicConfig.cmake.in b/CMakeModules/dynarmicConfig.cmake.in index 6a5db016..51bb2dda 100644 --- a/CMakeModules/dynarmicConfig.cmake.in +++ b/CMakeModules/dynarmicConfig.cmake.in @@ -8,7 +8,7 @@ if (NOT @BUILD_SHARED_LIBS@) find_dependency(Boost 1.57) find_dependency(fmt 9) find_dependency(mcl 0.1.12 EXACT) - find_dependency(tsl-robin-map) + find_dependency(unordered_dense) if ("arm64" IN_LIST ARCHITECTURE) find_dependency(oaknut 2.0.1) diff --git a/README.md b/README.md index b93049f5..e1cc5ab0 100644 --- a/README.md +++ b/README.md @@ -315,12 +315,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` -### robin-map +### unordered_dense ``` MIT License -Copyright (c) 2017 Thibaut Goetghebuer-Planchon +Copyright (c) 2022 Martin Leitner-Ankerl Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index d9d98d48..0d6e748e 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -56,10 +56,11 @@ if (NOT TARGET merry::oaknut) endif() endif() -# robin-map +# unordered_dense -if (NOT TARGET tsl::robin_map) - add_subdirectory(robin-map) +if (NOT TARGET ankerl::unordered_dense) + set(UNORDERED_DENSE_INSTALL ON) + add_subdirectory(unordered_dense) endif() # xbyak diff --git a/externals/robin-map b/externals/robin-map deleted file mode 160000 index 054ec5ad..00000000 --- a/externals/robin-map +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 054ec5ad67440fcd65e0497e5a27ef31f53fcc7f diff --git a/externals/unordered_dense b/externals/unordered_dense new file mode 160000 index 00000000..e59d30b7 --- /dev/null +++ b/externals/unordered_dense @@ -0,0 +1 @@ +Subproject commit e59d30b7b12e1d04cc2fc9c6219e35bda447c17e diff --git a/src/dynarmic/CMakeLists.txt b/src/dynarmic/CMakeLists.txt index 6f0813ca..69a206ed 100644 --- a/src/dynarmic/CMakeLists.txt +++ b/src/dynarmic/CMakeLists.txt @@ -506,7 +506,7 @@ target_link_libraries(dynarmic Boost::boost fmt::fmt merry::mcl - tsl::robin_map + unordered_dense::unordered_dense ) if (DYNARMIC_USE_LLVM) target_include_directories(dynarmic PRIVATE ${LLVM_INCLUDE_DIRS}) diff --git a/src/dynarmic/backend/arm64/address_space.cpp b/src/dynarmic/backend/arm64/address_space.cpp index 2c7ae777..614ca033 100644 --- a/src/dynarmic/backend/arm64/address_space.cpp +++ b/src/dynarmic/backend/arm64/address_space.cpp @@ -70,7 +70,7 @@ CodePtr AddressSpace::GetOrEmit(IR::LocationDescriptor descriptor) { return block_info.entry_point; } -void AddressSpace::InvalidateBasicBlocks(const tsl::robin_set& descriptors) { +void AddressSpace::InvalidateBasicBlocks(const ankerl::unordered_dense::set& descriptors) { UnprotectCodeMemory(); for (const auto& descriptor : descriptors) { diff --git a/src/dynarmic/backend/arm64/address_space.h b/src/dynarmic/backend/arm64/address_space.h index 835566bd..792ecf69 100644 --- a/src/dynarmic/backend/arm64/address_space.h +++ b/src/dynarmic/backend/arm64/address_space.h @@ -11,8 +11,7 @@ #include #include #include -#include -#include +#include #include "dynarmic/backend/arm64/emit_arm64.h" #include "dynarmic/backend/arm64/fastmem.h" @@ -39,7 +38,7 @@ public: CodePtr GetOrEmit(IR::LocationDescriptor descriptor); - void InvalidateBasicBlocks(const tsl::robin_set& descriptors); + void InvalidateBasicBlocks(const ankerl::unordered_dense::set& descriptors); void ClearCache(); @@ -75,10 +74,10 @@ protected: // A IR::LocationDescriptor will have one current CodePtr. // However, there can be multiple other CodePtrs which are older, previously invalidated blocks. - tsl::robin_map block_entries; std::map reverse_block_entries; - tsl::robin_map block_infos; - tsl::robin_map> block_references; + ankerl::unordered_dense::map block_entries; + ankerl::unordered_dense::map block_infos; + ankerl::unordered_dense::map> block_references; ExceptionHandler exception_handler; FastmemManager fastmem_manager; diff --git a/src/dynarmic/backend/arm64/emit_arm64.h b/src/dynarmic/backend/arm64/emit_arm64.h index 58ccb0e4..f80f2689 100644 --- a/src/dynarmic/backend/arm64/emit_arm64.h +++ b/src/dynarmic/backend/arm64/emit_arm64.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include "dynarmic/backend/arm64/fastmem.h" #include "dynarmic/interface/A32/coprocessor.h" @@ -102,8 +102,8 @@ struct EmittedBlockInfo { CodePtr entry_point; size_t size; std::vector relocations; - tsl::robin_map> block_relocations; - tsl::robin_map fastmem_patch_info; + ankerl::unordered_dense::map> block_relocations; + ankerl::unordered_dense::map fastmem_patch_info; }; struct EmitConfig { diff --git a/src/dynarmic/backend/arm64/fastmem.h b/src/dynarmic/backend/arm64/fastmem.h index 8ed686ae..7e14ce6d 100644 --- a/src/dynarmic/backend/arm64/fastmem.h +++ b/src/dynarmic/backend/arm64/fastmem.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include "dynarmic/backend/exception_handler.h" #include "dynarmic/ir/location_descriptor.h" @@ -50,7 +50,7 @@ public: private: ExceptionHandler& exception_handler; - tsl::robin_set do_not_fastmem; + ankerl::unordered_dense::set do_not_fastmem; }; } // namespace Dynarmic::Backend::Arm64 diff --git a/src/dynarmic/backend/arm64/reg_alloc.h b/src/dynarmic/backend/arm64/reg_alloc.h index 3a2d5388..5ba8332d 100644 --- a/src/dynarmic/backend/arm64/reg_alloc.h +++ b/src/dynarmic/backend/arm64/reg_alloc.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "dynarmic/backend/arm64/stack_layout.h" #include "dynarmic/ir/cond.h" @@ -335,7 +335,7 @@ private: mutable std::mt19937 rand_gen; - tsl::robin_set defined_insts; + ankerl::unordered_dense::set defined_insts; }; template diff --git a/src/dynarmic/backend/block_range_information.cpp b/src/dynarmic/backend/block_range_information.cpp index 47e512f5..ab83ce6a 100644 --- a/src/dynarmic/backend/block_range_information.cpp +++ b/src/dynarmic/backend/block_range_information.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include namespace Dynarmic::Backend { @@ -23,8 +23,8 @@ void BlockRangeInformation::ClearCache() { } template -tsl::robin_set BlockRangeInformation::InvalidateRanges(const boost::icl::interval_set& ranges) { - tsl::robin_set erase_locations; +ankerl::unordered_dense::set BlockRangeInformation::InvalidateRanges(const boost::icl::interval_set& ranges) { + ankerl::unordered_dense::set erase_locations; for (auto invalidate_interval : ranges) { auto pair = block_ranges.equal_range(invalidate_interval); for (auto it = pair.first; it != pair.second; ++it) { diff --git a/src/dynarmic/backend/block_range_information.h b/src/dynarmic/backend/block_range_information.h index 3402b155..e39bf992 100644 --- a/src/dynarmic/backend/block_range_information.h +++ b/src/dynarmic/backend/block_range_information.h @@ -9,7 +9,7 @@ #include #include -#include +#include #include "dynarmic/ir/location_descriptor.h" @@ -20,7 +20,7 @@ class BlockRangeInformation { public: void AddRange(boost::icl::discrete_interval range, IR::LocationDescriptor location); void ClearCache(); - tsl::robin_set InvalidateRanges(const boost::icl::interval_set& ranges); + ankerl::unordered_dense::set InvalidateRanges(const boost::icl::interval_set& ranges); private: boost::icl::interval_map> block_ranges; diff --git a/src/dynarmic/backend/riscv64/a32_address_space.h b/src/dynarmic/backend/riscv64/a32_address_space.h index 628f72c2..e583dae6 100644 --- a/src/dynarmic/backend/riscv64/a32_address_space.h +++ b/src/dynarmic/backend/riscv64/a32_address_space.h @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include "dynarmic/backend/riscv64/code_block.h" #include "dynarmic/backend/riscv64/emit_riscv64.h" @@ -71,8 +71,8 @@ private: CodeBlock cb; biscuit::Assembler as; - tsl::robin_map block_entries; - tsl::robin_map block_infos; + ankerl::unordered_dense::map block_entries; + ankerl::unordered_dense::map block_infos; struct PreludeInfo { CodePtr end_of_prelude; diff --git a/src/dynarmic/backend/riscv64/reg_alloc.h b/src/dynarmic/backend/riscv64/reg_alloc.h index d80f588b..c94027d9 100644 --- a/src/dynarmic/backend/riscv64/reg_alloc.h +++ b/src/dynarmic/backend/riscv64/reg_alloc.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "dynarmic/backend/riscv64/stack_layout.h" #include "dynarmic/ir/cond.h" diff --git a/src/dynarmic/backend/x64/a32_emit_x64.h b/src/dynarmic/backend/x64/a32_emit_x64.h index 3706b30a..15552030 100644 --- a/src/dynarmic/backend/x64/a32_emit_x64.h +++ b/src/dynarmic/backend/x64/a32_emit_x64.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include "dynarmic/backend/block_range_information.h" #include "dynarmic/backend/x64/a32_jitstate.h" @@ -104,7 +104,7 @@ protected: DoNotFastmemMarker marker; bool recompile; }; - tsl::robin_map fastmem_patch_info; + ankerl::unordered_dense::map fastmem_patch_info; std::set do_not_fastmem; std::optional ShouldFastmem(A32EmitContext& ctx, IR::Inst* inst) const; FakeCall FastmemCallback(u64 rip); diff --git a/src/dynarmic/backend/x64/a64_emit_x64.h b/src/dynarmic/backend/x64/a64_emit_x64.h index ed493155..d5d83cad 100644 --- a/src/dynarmic/backend/x64/a64_emit_x64.h +++ b/src/dynarmic/backend/x64/a64_emit_x64.h @@ -9,6 +9,7 @@ #include #include #include +#include #include "dynarmic/backend/block_range_information.h" #include "dynarmic/backend/x64/a64_jitstate.h" @@ -102,7 +103,7 @@ protected: DoNotFastmemMarker marker; bool recompile; }; - tsl::robin_map fastmem_patch_info; + ankerl::unordered_dense::map fastmem_patch_info; std::set do_not_fastmem; std::optional ShouldFastmem(A64EmitContext& ctx, IR::Inst* inst) const; FakeCall FastmemCallback(u64 rip); diff --git a/src/dynarmic/backend/x64/constant_pool.h b/src/dynarmic/backend/x64/constant_pool.h index 2ab64215..ca79a9ec 100644 --- a/src/dynarmic/backend/x64/constant_pool.h +++ b/src/dynarmic/backend/x64/constant_pool.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include namespace Dynarmic::Backend::X64 { @@ -40,7 +40,7 @@ private: } }; - tsl::robin_map constant_info; + ankerl::unordered_dense::map constant_info; BlockOfCode& code; std::span pool; diff --git a/src/dynarmic/backend/x64/emit_x64.cpp b/src/dynarmic/backend/x64/emit_x64.cpp index 902ddef9..ea19fdf2 100644 --- a/src/dynarmic/backend/x64/emit_x64.cpp +++ b/src/dynarmic/backend/x64/emit_x64.cpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include "dynarmic/backend/x64/block_of_code.h" #include "dynarmic/backend/x64/nzcv_util.h" @@ -394,7 +394,7 @@ void EmitX64::ClearCache() { PerfMapClear(); } -void EmitX64::InvalidateBasicBlocks(const tsl::robin_set& locations) { +void EmitX64::InvalidateBasicBlocks(const ankerl::unordered_dense::set& locations) { code.EnableWriting(); SCOPE_EXIT { code.DisableWriting(); diff --git a/src/dynarmic/backend/x64/emit_x64.h b/src/dynarmic/backend/x64/emit_x64.h index 5a46f04e..2d3945f6 100644 --- a/src/dynarmic/backend/x64/emit_x64.h +++ b/src/dynarmic/backend/x64/emit_x64.h @@ -14,8 +14,7 @@ #include #include -#include -#include +#include #include #include @@ -88,7 +87,7 @@ public: virtual void ClearCache(); /// Invalidates a selection of basic blocks. - void InvalidateBasicBlocks(const tsl::robin_set& locations); + void InvalidateBasicBlocks(const ankerl::unordered_dense::set& locations); protected: // Microinstruction emitters @@ -138,8 +137,8 @@ protected: // State BlockOfCode& code; ExceptionHandler exception_handler; - tsl::robin_map block_descriptors; - tsl::robin_map patch_information; + ankerl::unordered_dense::map block_descriptors; + ankerl::unordered_dense::map patch_information; }; } // namespace Dynarmic::Backend::X64