Remove std typeinfo

This commit is contained in:
Marin Baron 2020-12-26 20:41:20 +00:00 committed by Ivan
parent 66581d115b
commit 92e5bb88e8
2 changed files with 8 additions and 13 deletions

View File

@ -2114,15 +2114,15 @@ void Emulator::ConfigurePPUCache()
} }
template <> template <>
void stx::manual_fixed_typemap<void>::init_reporter(const char* name, unsigned long long created) const noexcept void stx::manual_fixed_typemap<void>::init_reporter(unsigned long long created) const noexcept
{ {
sys_log.notice("[ord:%u] Object '%s' was created", created, name); sys_log.notice("[ord:%u] Object was created", created);
} }
template <> template <>
void stx::manual_fixed_typemap<void>::destroy_reporter(const char* name, unsigned long long created) const noexcept void stx::manual_fixed_typemap<void>::destroy_reporter(unsigned long long created) const noexcept
{ {
sys_log.notice("[ord:%u] Object '%s' is destroying", created, name); sys_log.notice("[ord:%u] Object is destroying", created);
} }
Emulator Emu; Emulator Emu;

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <typeinfo>
#include <utility> #include <utility>
#include <type_traits> #include <type_traits>
#include <util/typeindices.hpp> #include <util/typeindices.hpp>
@ -16,7 +15,6 @@ namespace stx
void** object_pointer; void** object_pointer;
unsigned long long created; unsigned long long created;
void(*destroy)(void*& ptr) noexcept; void(*destroy)(void*& ptr) noexcept;
const char* name;
static void sort_by_reverse_creation_order(destroy_info* begin, destroy_info* end); static void sort_by_reverse_creation_order(destroy_info* begin, destroy_info* end);
}; };
@ -31,7 +29,6 @@ namespace stx
{ {
void(*create)(void*& ptr) noexcept; void(*create)(void*& ptr) noexcept;
void(*destroy)(void*& ptr) noexcept; void(*destroy)(void*& ptr) noexcept;
const char* type_name = "__";
template <typename T> template <typename T>
static void call_ctor(void*& ptr) noexcept static void call_ctor(void*& ptr) noexcept
@ -60,7 +57,6 @@ namespace stx
typeinfo r; typeinfo r;
r.create = &call_ctor<T>; r.create = &call_ctor<T>;
r.destroy = &call_dtor<T>; r.destroy = &call_dtor<T>;
r.type_name = typeid(T).name();
return r; return r;
} }
}; };
@ -75,10 +71,10 @@ namespace stx
unsigned long long m_init_count = 0; unsigned long long m_init_count = 0;
// Body is somewhere else if enabled // Body is somewhere else if enabled
void init_reporter(const char* name, unsigned long long created) const noexcept; void init_reporter(unsigned long long created) const noexcept;
// Body is somewhere else if enabled // Body is somewhere else if enabled
void destroy_reporter(const char* name, unsigned long long created) const noexcept; void destroy_reporter(unsigned long long created) const noexcept;
public: public:
constexpr manual_fixed_typemap() noexcept = default; constexpr manual_fixed_typemap() noexcept = default;
@ -145,7 +141,6 @@ namespace stx
all_data[_max].object_pointer = &m_list[type.index()]; all_data[_max].object_pointer = &m_list[type.index()];
all_data[_max].created = m_order[type.index()]; all_data[_max].created = m_order[type.index()];
all_data[_max].destroy = type.destroy; all_data[_max].destroy = type.destroy;
all_data[_max].name = type.type_name;
// Clear creation order // Clear creation order
m_order[type.index()] = 0; m_order[type.index()] = 0;
@ -159,7 +154,7 @@ namespace stx
for (unsigned i = 0; i < _max; i++) for (unsigned i = 0; i < _max; i++)
{ {
if constexpr (Report) if constexpr (Report)
destroy_reporter(all_data[i].name, all_data[i].created); destroy_reporter(all_data[i].created);
all_data[i].destroy(*all_data[i].object_pointer); all_data[i].destroy(*all_data[i].object_pointer);
} }
@ -179,7 +174,7 @@ namespace stx
{ {
m_order[type.index()] = ++m_init_count; m_order[type.index()] = ++m_init_count;
if constexpr (Report) if constexpr (Report)
init_reporter(type.type_name, m_init_count); init_reporter(m_init_count);
} }
} }
} }