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/devices/cpu/upd78k/upd78k0.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/devices/cpu/upd78k/upd78k0.cpp') diff --git a/src/devices/cpu/upd78k/upd78k0.cpp b/src/devices/cpu/upd78k/upd78k0.cpp index ff87be3553c..6af06e02685 100644 --- a/src/devices/cpu/upd78k/upd78k0.cpp +++ b/src/devices/cpu/upd78k/upd78k0.cpp @@ -30,10 +30,6 @@ upd78k0_device::upd78k0_device(const machine_config &mconfig, device_type type, address_map_constructor(FUNC(upd78k0_device::iram_map), this)) , m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map) , m_iram_size(iram_size) - , m_program_space(nullptr) - , m_program_cache(nullptr) - , m_iram_cache(nullptr) - , m_sfr_space(nullptr) , m_subclock(0) , m_pc(0) , m_ppc(0) @@ -103,10 +99,10 @@ inline u16 upd78k0_device::debug_register_base() const noexcept void upd78k0_device::device_start() { // get address spaces and access caches - m_program_space = &space(AS_PROGRAM); - m_program_cache = m_program_space->cache<0, 0, ENDIANNESS_LITTLE>(); - m_iram_cache = space(AS_DATA).cache<1, 0, ENDIANNESS_LITTLE>(); - m_sfr_space = &space(AS_IO); + space(AS_PROGRAM).specific(m_program_space); + space(AS_PROGRAM).cache(m_program_cache); + space(AS_DATA).cache(m_iram_cache); + space(AS_IO).specific(m_sfr_space); set_icountptr(m_icount); @@ -158,7 +154,7 @@ void upd78k0_device::device_reset() void upd78k0_device::execute_run() { - m_pc = m_program_cache->read_word(0); + m_pc = m_program_cache.read_word(0); m_ppc = m_pc; debugger_instruction_hook(m_pc); -- cgit v1.2.3-70-g09d2