From fc8e18d89312bb703297f92152a4eb5addace8a4 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 18 Jun 2016 11:07:39 +0200 Subject: [PATCH] tagged_list to unordered_map for debugger (nw) --- src/emu/debug/debugcmd.cpp | 6 +++--- src/emu/debug/express.cpp | 16 ++++++++-------- src/emu/debug/express.h | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index ad1359baa28..4959f215caa 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -2823,12 +2823,12 @@ void debugger_commands::execute_symlist(int ref, int params, const char **param) } /* gather names for all symbols */ - for (symbol_entry &entry : symtable->entries()) + for (auto &entry : symtable->entries()) { /* only display "register" type symbols */ - if (!entry.is_function()) + if (!entry.second->is_function()) { - namelist[count++] = entry.name(); + namelist[count++] = entry.second->name(); if (count >= ARRAY_LENGTH(namelist)) break; } diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index f10a48bcd11..000ff270937 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -414,8 +414,8 @@ void symbol_table::configure_memory(void *param, valid_func valid, read_func rea void symbol_table::add(const char *name, read_write rw, UINT64 *ptr) { - m_symlist.remove(name); - m_symlist.append(name, *global_alloc(integer_symbol_entry(*this, name, rw, ptr))); + m_symlist.erase(name); + m_symlist.emplace(name, std::make_unique(*this, name, rw, ptr)); } @@ -425,8 +425,8 @@ void symbol_table::add(const char *name, read_write rw, UINT64 *ptr) void symbol_table::add(const char *name, UINT64 value) { - m_symlist.remove(name); - m_symlist.append(name, *global_alloc(integer_symbol_entry(*this, name, value))); + m_symlist.erase(name); + m_symlist.emplace(name, std::make_unique(*this, name, value)); } @@ -436,8 +436,8 @@ void symbol_table::add(const char *name, UINT64 value) void symbol_table::add(const char *name, void *ref, getter_func getter, setter_func setter) { - m_symlist.remove(name); - m_symlist.append(name, *global_alloc(integer_symbol_entry(*this, name, ref, getter, setter))); + m_symlist.erase(name); + m_symlist.emplace(name, std::make_unique(*this, name, ref, getter, setter)); } @@ -447,8 +447,8 @@ void symbol_table::add(const char *name, void *ref, getter_func getter, setter_f void symbol_table::add(const char *name, void *ref, int minparams, int maxparams, execute_func execute) { - m_symlist.remove(name); - m_symlist.append(name, *global_alloc(function_symbol_entry(*this, name, ref, minparams, maxparams, execute))); + m_symlist.erase(name); + m_symlist.emplace(name, std::make_unique(*this, name, ref, minparams, maxparams, execute)); } diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index c07f5ecc6f0..4f57bea70a2 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -117,9 +117,9 @@ protected: // construction/destruction symbol_entry(symbol_table &table, symbol_type type, const char *name, void *ref); +public: virtual ~symbol_entry(); -public: // getters symbol_entry *next() const { return m_next; } const char *name() const { return m_name.c_str(); } @@ -171,7 +171,7 @@ public: symbol_table(void *globalref, symbol_table *parent = nullptr); // getters - const tagged_list &entries() const { return m_symlist; } + const std::unordered_map> &entries() const { return m_symlist; } symbol_table *parent() const { return m_parent; } void *globalref() const { return m_globalref; } @@ -183,7 +183,7 @@ public: void add(const char *name, UINT64 constvalue); void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr); void add(const char *name, void *ref, int minparams, int maxparams, execute_func execute); - symbol_entry *find(const char *name) const { return m_symlist.find(name); } + symbol_entry *find(const char *name) const { if (name) { auto search = m_symlist.find(name); if (search != m_symlist.end()) return search->second.get(); else return nullptr; } else return nullptr; } symbol_entry *find_deep(const char *name); // value getter/setter @@ -199,7 +199,7 @@ private: // internal state symbol_table * m_parent; // pointer to the parent symbol table void * m_globalref; // global reference parameter - tagged_list m_symlist; // list of symbols + std::unordered_map> m_symlist; // list of symbols void * m_memory_param; // callback parameter for memory valid_func m_memory_valid; // validation callback read_func m_memory_read; // read callback