From 22513fb6fe281f5ccb75aaddb6417a12a66c313d Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 25 May 2020 16:42:42 +0200 Subject: emumem: A little more speedup. cache and specific change syntax, and are not pointers anymore [O. Galibert] The last(?) two changes are: - Add a template parameter to everything (theoretically the address space width, in practice a level derived from it to keep as much compatibility between widths as possible) so that the shift size becomes a constant. - Change the syntax of declaring and initializing the caches and specifics so that they're embedded in the owner device. Solves lifetime issues and also removes one indirection (looking up the base dispatch pointer through the cache/specific pointer). --- src/emu/emumem_heu.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/emu/emumem_heu.cpp') diff --git a/src/emu/emumem_heu.cpp b/src/emu/emumem_heu.cpp index 7000f77dc25..42cc8c3f83c 100644 --- a/src/emu/emumem_heu.cpp +++ b/src/emu/emumem_heu.cpp @@ -7,7 +7,7 @@ #include "emumem_heu.h" -template handler_entry_read_units::handler_entry_read_units(const memory_units_descriptor &descriptor, u8 ukey, address_space *space) : +template handler_entry_read_units::handler_entry_read_units(const memory_units_descriptor &descriptor, u8 ukey, address_space *space) : handler_entry_read(space, inh::F_UNITS), m_subunits(0) { @@ -16,7 +16,7 @@ template handler_entry_read_units handler_entry_read_units::handler_entry_read_units(const memory_units_descriptor &descriptor, u8 ukey, const handler_entry_read_units *src) : +template handler_entry_read_units::handler_entry_read_units(const memory_units_descriptor &descriptor, u8 ukey, const handler_entry_read_units *src) : handler_entry_read(src->m_space, inh::F_UNITS), m_subunits(0) { @@ -36,19 +36,19 @@ template handler_entry_read_units handler_entry_read_units::~handler_entry_read_units() +template handler_entry_read_units::~handler_entry_read_units() { for(u32 i=0; i != m_subunits; i++) m_subunit_infos[i].m_handler->unref(); } -template void handler_entry_read_units::enumerate_references(handler_entry::reflist &refs) const +template void handler_entry_read_units::enumerate_references(handler_entry::reflist &refs) const { for(u32 i=0; i != m_subunits; i++) refs.add(m_subunit_infos[i].m_handler); } -template void handler_entry_read_units::fill(const memory_units_descriptor &descriptor, const std::vector::entry> &entries) +template void handler_entry_read_units::fill(const memory_units_descriptor &descriptor, const std::vector::entry> &entries) { handler_entry *handler = descriptor.get_subunit_handler(); handler->ref(entries.size()); @@ -60,7 +60,7 @@ template void handler_entry_read_units typename emu::detail::handler_entry_size::uX handler_entry_read_units::read(offs_t offset, uX mem_mask) +template typename emu::detail::handler_entry_size::uX handler_entry_read_units::read(offs_t offset, uX mem_mask) const { this->ref(); @@ -98,7 +98,7 @@ template typename emu::detail::handler_ent return result; } -template std::string handler_entry_read_units::m2r(typename emu::detail::handler_entry_size::uX mask) +template std::string handler_entry_read_units::m2r(typename emu::detail::handler_entry_size::uX mask) { constexpr u32 mbits = 8*sizeof(uX); u32 start, end; @@ -109,7 +109,7 @@ template std::string handler_entry_read_un return util::string_format("%d-%d", end, start); } -template std::string handler_entry_read_units::name() const +template std::string handler_entry_read_units::name() const { std::string result; @@ -126,7 +126,7 @@ template std::string handler_entry_read_un -template handler_entry_write_units::handler_entry_write_units(const memory_units_descriptor &descriptor, u8 ukey, address_space *space) : +template handler_entry_write_units::handler_entry_write_units(const memory_units_descriptor &descriptor, u8 ukey, address_space *space) : handler_entry_write(space, inh::F_UNITS), m_subunits(0) { @@ -135,7 +135,7 @@ template handler_entry_write_units handler_entry_write_units::handler_entry_write_units(const memory_units_descriptor &descriptor, u8 ukey, const handler_entry_write_units *src) : +template handler_entry_write_units::handler_entry_write_units(const memory_units_descriptor &descriptor, u8 ukey, const handler_entry_write_units *src) : handler_entry_write(src->m_space, inh::F_UNITS), m_subunits(0) { @@ -155,19 +155,19 @@ template handler_entry_write_units handler_entry_write_units::~handler_entry_write_units() +template handler_entry_write_units::~handler_entry_write_units() { for(u32 i=0; i != m_subunits; i++) m_subunit_infos[i].m_handler->unref(); } -template void handler_entry_write_units::enumerate_references(handler_entry::reflist &refs) const +template void handler_entry_write_units::enumerate_references(handler_entry::reflist &refs) const { for(u32 i=0; i != m_subunits; i++) refs.add(m_subunit_infos[i].m_handler); } -template void handler_entry_write_units::fill(const memory_units_descriptor &descriptor, const std::vector::entry> &entries) +template void handler_entry_write_units::fill(const memory_units_descriptor &descriptor, const std::vector::entry> &entries) { handler_entry *handler = descriptor.get_subunit_handler(); handler->ref(entries.size()); @@ -175,7 +175,7 @@ template void handler_entry_write_units void handler_entry_write_units::write(offs_t offset, uX data, uX mem_mask) +template void handler_entry_write_units::write(offs_t offset, uX data, uX mem_mask) const { this->ref(); @@ -212,7 +212,7 @@ template void handler_entry_write_units std::string handler_entry_write_units::m2r(typename emu::detail::handler_entry_size::uX mask) +template std::string handler_entry_write_units::m2r(typename emu::detail::handler_entry_size::uX mask) { constexpr u32 mbits = 8*sizeof(uX); u32 start, end; @@ -223,7 +223,7 @@ template std::string handler_entry_write_u return util::string_format("%d-%d", end, start); } -template std::string handler_entry_write_units::name() const +template std::string handler_entry_write_units::name() const { std::string result; -- cgit v1.2.3-70-g09d2