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/unsp/unsp.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/devices/cpu/unsp/unsp.cpp') diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp index 40adc713f01..ea416cbe05c 100644 --- a/src/devices/cpu/unsp/unsp.cpp +++ b/src/devices/cpu/unsp/unsp.cpp @@ -41,12 +41,11 @@ unsp_device::unsp_device(const machine_config &mconfig, device_type type, const : cpu_device(mconfig, type, tag, owner, clock) , m_core(nullptr) , m_program_config("program", ENDIANNESS_BIG, 16, 23, -1, internal) - , m_program(nullptr) , m_debugger_temp(0) #if UNSP_LOG_OPCODES || UNSP_LOG_REGS , m_log_ops(0) #endif - , m_cache(CACHE_SIZE + sizeof(unsp_device)) + , m_drccache(CACHE_SIZE + sizeof(unsp_device)) , m_drcuml(nullptr) , m_drcfe(nullptr) , m_drcoptions(0) @@ -193,7 +192,7 @@ void unsp_device::unimplemented_opcode(uint16_t op, uint16_t ximm, uint16_t ximm void unsp_device::device_start() { - m_core = (internal_unsp_state *)m_cache.alloc_near(sizeof(internal_unsp_state)); + m_core = (internal_unsp_state *)m_drccache.alloc_near(sizeof(internal_unsp_state)); memset(m_core, 0, sizeof(internal_unsp_state)); #if ENABLE_UNSP_DRC @@ -211,13 +210,11 @@ void unsp_device::device_start() m_debugger_temp = 0; - m_program = &space(AS_PROGRAM); - auto cache = m_program->cache<1, -1, ENDIANNESS_BIG>(); - m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); }; - m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); }; + space(AS_PROGRAM).cache(m_cache); + space(AS_PROGRAM).specific(m_program); uint32_t umlflags = 0; - m_drcuml = std::make_unique(*this, m_cache, umlflags, 1, 23, 0); + m_drcuml = std::make_unique(*this, m_drccache, umlflags, 1, 23, 0); // add UML symbols- m_drcuml->symbol_add(&m_core->m_r[REG_SP], sizeof(uint32_t), "SP"); -- cgit v1.2.3-70-g09d2