diff options
author | 2020-05-25 16:42:42 +0200 | |
---|---|---|
committer | 2020-05-25 16:42:57 +0200 | |
commit | 22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch) | |
tree | 3cf84032cc6482d685a8dbb57e015bd17c7f7fdc /src/emu/emumem_hedp.h | |
parent | e42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (diff) |
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).
Diffstat (limited to 'src/emu/emumem_hedp.h')
-rw-r--r-- | src/emu/emumem_hedp.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/emu/emumem_hedp.h b/src/emu/emumem_hedp.h index 37b47747d61..3cd1c646f17 100644 --- a/src/emu/emumem_hedp.h +++ b/src/emu/emumem_hedp.h @@ -5,7 +5,7 @@ // Executes an access through called a delegate, usually containing a handler or a lambda -template<int Width, int AddrShift, int Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian> +template<int Width, int AddrShift, endianness_t Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian> { public: using uX = typename emu::detail::handler_entry_size<Width>::uX; @@ -14,7 +14,7 @@ public: handler_entry_read_delegate(address_space *space, const READ &delegate) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {} ~handler_entry_read_delegate() = default; - uX read(offs_t offset, uX mem_mask) override; + uX read(offs_t offset, uX mem_mask) const override; std::string name() const override; @@ -26,45 +26,45 @@ private: std::is_same<R, read16_delegate>::value || std::is_same<R, read32_delegate>::value || std::is_same<R, read64_delegate>::value, - uX> read_impl(offs_t offset, uX mem_mask); + uX> read_impl(offs_t offset, uX mem_mask) const; template<typename R> std::enable_if_t<std::is_same<R, read8m_delegate>::value || std::is_same<R, read16m_delegate>::value || std::is_same<R, read32m_delegate>::value || std::is_same<R, read64m_delegate>::value, - uX> read_impl(offs_t offset, uX mem_mask); + uX> read_impl(offs_t offset, uX mem_mask) const; template<typename R> std::enable_if_t<std::is_same<R, read8s_delegate>::value || std::is_same<R, read16s_delegate>::value || std::is_same<R, read32s_delegate>::value || std::is_same<R, read64s_delegate>::value, - uX> read_impl(offs_t offset, uX mem_mask); + uX> read_impl(offs_t offset, uX mem_mask) const; template<typename R> std::enable_if_t<std::is_same<R, read8sm_delegate>::value || std::is_same<R, read16sm_delegate>::value || std::is_same<R, read32sm_delegate>::value || std::is_same<R, read64sm_delegate>::value, - uX> read_impl(offs_t offset, uX mem_mask); + uX> read_impl(offs_t offset, uX mem_mask) const; template<typename R> std::enable_if_t<std::is_same<R, read8mo_delegate>::value || std::is_same<R, read16mo_delegate>::value || std::is_same<R, read32mo_delegate>::value || std::is_same<R, read64mo_delegate>::value, - uX> read_impl(offs_t offset, uX mem_mask); + uX> read_impl(offs_t offset, uX mem_mask) const; template<typename R> std::enable_if_t<std::is_same<R, read8smo_delegate>::value || std::is_same<R, read16smo_delegate>::value || std::is_same<R, read32smo_delegate>::value || std::is_same<R, read64smo_delegate>::value, - uX> read_impl(offs_t offset, uX mem_mask); + uX> read_impl(offs_t offset, uX mem_mask) const; }; -template<int Width, int AddrShift, int Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian> +template<int Width, int AddrShift, endianness_t Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian> { public: using uX = typename emu::detail::handler_entry_size<Width>::uX; @@ -73,7 +73,7 @@ public: handler_entry_write_delegate(address_space *space, const WRITE &delegate) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {} ~handler_entry_write_delegate() = default; - void write(offs_t offset, uX data, uX mem_mask) override; + void write(offs_t offset, uX data, uX mem_mask) const override; std::string name() const override; @@ -85,42 +85,42 @@ private: std::is_same<W, write16_delegate>::value || std::is_same<W, write32_delegate>::value || std::is_same<W, write64_delegate>::value, - void> write_impl(offs_t offset, uX data, uX mem_mask); + void> write_impl(offs_t offset, uX data, uX mem_mask) const; template<typename W> std::enable_if_t<std::is_same<W, write8m_delegate>::value || std::is_same<W, write16m_delegate>::value || std::is_same<W, write32m_delegate>::value || std::is_same<W, write64m_delegate>::value, - void> write_impl(offs_t offset, uX data, uX mem_mask); + void> write_impl(offs_t offset, uX data, uX mem_mask) const; template<typename W> std::enable_if_t<std::is_same<W, write8s_delegate>::value || std::is_same<W, write16s_delegate>::value || std::is_same<W, write32s_delegate>::value || std::is_same<W, write64s_delegate>::value, - void> write_impl(offs_t offset, uX data, uX mem_mask); + void> write_impl(offs_t offset, uX data, uX mem_mask) const; template<typename W> std::enable_if_t<std::is_same<W, write8sm_delegate>::value || std::is_same<W, write16sm_delegate>::value || std::is_same<W, write32sm_delegate>::value || std::is_same<W, write64sm_delegate>::value, - void> write_impl(offs_t offset, uX data, uX mem_mask); + void> write_impl(offs_t offset, uX data, uX mem_mask) const; template<typename W> std::enable_if_t<std::is_same<W, write8mo_delegate>::value || std::is_same<W, write16mo_delegate>::value || std::is_same<W, write32mo_delegate>::value || std::is_same<W, write64mo_delegate>::value, - void> write_impl(offs_t offset, uX data, uX mem_mask); + void> write_impl(offs_t offset, uX data, uX mem_mask) const; template<typename W> std::enable_if_t<std::is_same<W, write8smo_delegate>::value || std::is_same<W, write16smo_delegate>::value || std::is_same<W, write32smo_delegate>::value || std::is_same<W, write64smo_delegate>::value, - void> write_impl(offs_t offset, uX data, uX mem_mask); + void> write_impl(offs_t offset, uX data, uX mem_mask) const; }; @@ -128,7 +128,7 @@ private: // Accesses an ioport -template<int Width, int AddrShift, int Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian> +template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian> { public: using uX = typename emu::detail::handler_entry_size<Width>::uX; @@ -137,7 +137,7 @@ public: handler_entry_read_ioport(address_space *space, ioport_port *port) : handler_entry_read<Width, AddrShift, Endian>(space, 0), m_port(port) {} ~handler_entry_read_ioport() = default; - uX read(offs_t offset, uX mem_mask) override; + uX read(offs_t offset, uX mem_mask) const override; std::string name() const override; @@ -145,7 +145,7 @@ private: ioport_port *m_port; }; -template<int Width, int AddrShift, int Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian> +template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian> { public: using uX = typename emu::detail::handler_entry_size<Width>::uX; @@ -154,7 +154,7 @@ public: handler_entry_write_ioport(address_space *space, ioport_port *port) : handler_entry_write<Width, AddrShift, Endian>(space, 0), m_port(port) {} ~handler_entry_write_ioport() = default; - void write(offs_t offset, uX data, uX mem_mask) override; + void write(offs_t offset, uX data, uX mem_mask) const override; std::string name() const override; |