mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
Netlist: pongf update and code maintenance. [Couriersud]
After the recent string of updates pongf performance increased again. Also includes code maintenance and some fixes for the aligned memory operations.
This commit is contained in:
parent
063e81d756
commit
55f1dfafc2
@ -13,6 +13,7 @@
|
||||
#include "plib/pchrono.h"
|
||||
#include "plib/plists.h"
|
||||
#include "plib/ptypes.h"
|
||||
#include "plib/parray.h"
|
||||
|
||||
#include "nl_config.h"
|
||||
#include "nltypes.h"
|
||||
@ -128,28 +129,6 @@ namespace netlist
|
||||
m_prof_call.inc();
|
||||
}
|
||||
|
||||
void push_nostatsx(T && e) noexcept
|
||||
{
|
||||
/* Lock */
|
||||
lock_guard_type lck(m_lock);
|
||||
#if 1
|
||||
T * i(m_end-1);
|
||||
for (; *i < e; --i)
|
||||
{
|
||||
*(i+1) = *(i);
|
||||
}
|
||||
*(i+1) = std::move(e);
|
||||
++m_end;
|
||||
#else
|
||||
T * i(m_end++);
|
||||
while (QueueOp::less(*(--i), e))
|
||||
{
|
||||
*(i+1) = *(i);
|
||||
}
|
||||
*(i+1) = std::move(e);
|
||||
#endif
|
||||
}
|
||||
|
||||
T pop() noexcept { return *(--m_end); }
|
||||
const T &top() const noexcept { return *(m_end-1); }
|
||||
|
||||
@ -160,7 +139,6 @@ namespace netlist
|
||||
lock_guard_type lck(m_lock);
|
||||
if (KEEPSTAT)
|
||||
m_prof_remove.inc();
|
||||
#if 1
|
||||
for (T * i = m_end - 1; i > &m_list[0]; --i)
|
||||
{
|
||||
// == operator ignores time!
|
||||
@ -170,16 +148,6 @@ namespace netlist
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (T * i = &m_list[1]; i < m_end; ++i)
|
||||
{
|
||||
if (QueueOp::equal(*i, elem))
|
||||
{
|
||||
std::copy(i+1, m_end--, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <bool KEEPSTAT, class R>
|
||||
@ -231,11 +199,10 @@ namespace netlist
|
||||
using mutex_type = pspin_mutex<TS>;
|
||||
using lock_guard_type = std::lock_guard<mutex_type>;
|
||||
|
||||
mutex_type m_lock;
|
||||
mutex_type m_lock;
|
||||
PALIGNAS_CACHELINE()
|
||||
T * m_end;
|
||||
//std::vector<T> m_list;
|
||||
plib::aligned_vector<T> m_list;
|
||||
T * m_end;
|
||||
plib::aligned_vector<T> m_list;
|
||||
|
||||
public:
|
||||
// profiling
|
||||
|
@ -1219,7 +1219,10 @@ plib::unique_ptr<std::istream> source_file_t::stream(const pstring &name)
|
||||
{
|
||||
plib::unused_var(name);
|
||||
auto ret(plib::make_unique<std::ifstream>(plib::filesystem::u8path(m_filename)));
|
||||
return std::move(ret);
|
||||
if (ret->is_open())
|
||||
return std::move(ret);
|
||||
else
|
||||
return plib::unique_ptr<std::istream>(nullptr);
|
||||
}
|
||||
|
||||
bool source_proc_t::parse(nlparse_t &setup, const pstring &name)
|
||||
|
@ -261,6 +261,9 @@ namespace plib {
|
||||
template <class T, std::size_t ALIGN = alignof(T)>
|
||||
using allocator_type = arena_allocator<aligned_arena, T, ALIGN>;
|
||||
|
||||
template <typename T>
|
||||
using unique_pool_ptr = std::unique_ptr<T, arena_deleter<aligned_arena, T>>;
|
||||
|
||||
template <typename T>
|
||||
using owned_pool_ptr = plib::owned_ptr<T, arena_deleter<aligned_arena, T>>;
|
||||
|
||||
@ -300,16 +303,24 @@ namespace plib {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
template<typename T, typename... Args>
|
||||
owned_pool_ptr<T> make_poolptr(Args&&... args)
|
||||
unique_pool_ptr<T> make_unique(Args&&... args)
|
||||
{
|
||||
auto *mem = allocate(alignof(T), sizeof(T));
|
||||
return owned_pool_ptr<T>(new (mem) T(std::forward<Args>(args)...), true, arena_deleter<aligned_arena, T>(*this));
|
||||
try
|
||||
{
|
||||
auto *mema = new (mem) T(std::forward<Args>(args)...);
|
||||
return unique_pool_ptr<T>(mema, arena_deleter<aligned_arena, T>(*this));
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
deallocate(mem);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename T, typename... Args>
|
||||
owned_pool_ptr<T> make_poolptr(Args&&... args)
|
||||
owned_pool_ptr<T> make_owned(Args&&... args)
|
||||
{
|
||||
auto *mem = allocate(alignof(T), sizeof(T));
|
||||
try
|
||||
@ -324,6 +335,12 @@ namespace plib {
|
||||
}
|
||||
}
|
||||
|
||||
bool operator ==(const aligned_arena &rhs) const
|
||||
{
|
||||
plib::unused_var(rhs);
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <typename T, std::size_t ALIGN>
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "palloc.h"
|
||||
#include "pconfig.h"
|
||||
#include "pexception.h"
|
||||
#include "pstrutil.h"
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
@ -31,8 +32,7 @@ namespace plib {
|
||||
struct sizeabs<FT, 0>
|
||||
{
|
||||
static constexpr std::size_t ABS() { return 0; }
|
||||
//using container = typename std::vector<FT, aligned_allocator<FT, PALIGN_VECTOROPT>>;
|
||||
using container = typename std::vector<FT>;
|
||||
using container = typename std::vector<FT, aligned_allocator<FT, PALIGN_VECTOROPT>>;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -69,23 +69,12 @@ namespace plib {
|
||||
{
|
||||
}
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
struct tag {};
|
||||
/* allow construction in fixed size arrays */
|
||||
template <int X = SIZE >
|
||||
parray(tag A = tag(), typename std::enable_if<(X >= 0), int>::type = 0)
|
||||
: m_size(X)
|
||||
{
|
||||
}
|
||||
#else
|
||||
/* allow construction in fixed size arrays */
|
||||
parray()
|
||||
: m_size(SIZEABS())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
template <int X = SIZE >
|
||||
parray(size_type size, typename std::enable_if<(X != 0), int>::type = 0)
|
||||
: m_size(size)
|
||||
@ -101,18 +90,6 @@ namespace plib {
|
||||
|
||||
bool empty() const noexcept { return size() == 0; }
|
||||
|
||||
#if 0
|
||||
reference operator[](size_type i) /*noexcept*/
|
||||
{
|
||||
if (i >= m_size) throw plib::pexception("limits error " + to_string(i) + ">=" + to_string(m_size));
|
||||
return m_a[i];
|
||||
}
|
||||
const_reference operator[](size_type i) const /*noexcept*/
|
||||
{
|
||||
if (i >= m_size) throw plib::pexception("limits error " + to_string(i) + ">=" + to_string(m_size));
|
||||
return m_a[i];
|
||||
}
|
||||
#else
|
||||
C14CONSTEXPR reference operator[](size_type i) noexcept
|
||||
{
|
||||
return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(&m_a[0])[i];
|
||||
@ -121,7 +98,7 @@ namespace plib {
|
||||
{
|
||||
return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(&m_a[0])[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
FT * data() noexcept { return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(m_a.data()); }
|
||||
const FT * data() const noexcept { return assume_aligned_ptr<FT, PALIGN_VECTOROPT>(m_a.data()); }
|
||||
|
||||
|
@ -121,53 +121,6 @@ typedef __int128_t INT128;
|
||||
#define HAS_OPENMP (0)
|
||||
#endif
|
||||
|
||||
//============================================================
|
||||
// Pointer to Member Function
|
||||
//============================================================
|
||||
|
||||
// This will be autodetected
|
||||
//#define PPMF_TYPE 0
|
||||
|
||||
#define PPMF_TYPE_PMF 0
|
||||
#define PPMF_TYPE_GNUC_PMF_CONV 1
|
||||
#define PPMF_TYPE_INTERNAL 2
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/* does not work in versions over 4.7.x of 32bit MINGW */
|
||||
#if defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#elif defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__)
|
||||
#define PHAS_PMF_INTERNAL 1
|
||||
#define MEMBER_ABI _thiscall
|
||||
#elif defined(__clang__) && defined(__i386__) && defined(_WIN32)
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#elif defined(__arm__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__MIPSEL__) || defined(__mips_isa_rev) || defined(__mips64) || defined(__EMSCRIPTEN__)
|
||||
#define PHAS_PMF_INTERNAL 2
|
||||
#else
|
||||
#define PHAS_PMF_INTERNAL 1
|
||||
#endif
|
||||
#elif defined(_MSC_VER) && defined (_M_X64)
|
||||
#define PHAS_PMF_INTERNAL 3
|
||||
#else
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#endif
|
||||
|
||||
#ifndef MEMBER_ABI
|
||||
#define MEMBER_ABI
|
||||
#endif
|
||||
|
||||
#ifndef PPMF_TYPE
|
||||
#if (PHAS_PMF_INTERNAL > 0)
|
||||
#define PPMF_TYPE PPMF_TYPE_INTERNAL
|
||||
#else
|
||||
#define PPMF_TYPE PPMF_TYPE_PMF
|
||||
#endif
|
||||
#else
|
||||
#undef PHAS_PMF_INTERNAL
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#undef MEMBER_ABI
|
||||
#define MEMBER_ABI
|
||||
#endif
|
||||
|
||||
//============================================================
|
||||
// WARNINGS
|
||||
|
@ -41,6 +41,54 @@
|
||||
*
|
||||
*/
|
||||
|
||||
//============================================================
|
||||
// Macro magic
|
||||
//============================================================
|
||||
|
||||
//#define PPMF_TYPE 0
|
||||
|
||||
#define PPMF_TYPE_PMF 0
|
||||
#define PPMF_TYPE_GNUC_PMF_CONV 1
|
||||
#define PPMF_TYPE_INTERNAL 2
|
||||
|
||||
#if defined(__GNUC__)
|
||||
/* does not work in versions over 4.7.x of 32bit MINGW */
|
||||
#if defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#elif defined(__MINGW32__) && !defined(__x86_64) && defined(__i386__)
|
||||
#define PHAS_PMF_INTERNAL 1
|
||||
#define MEMBER_ABI _thiscall
|
||||
#elif defined(__clang__) && defined(__i386__) && defined(_WIN32)
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#elif defined(__arm__) || defined(__ARMEL__) || defined(__aarch64__) || defined(__MIPSEL__) || defined(__mips_isa_rev) || defined(__mips64) || defined(__EMSCRIPTEN__)
|
||||
#define PHAS_PMF_INTERNAL 2
|
||||
#else
|
||||
#define PHAS_PMF_INTERNAL 1
|
||||
#endif
|
||||
#elif defined(_MSC_VER) && defined (_M_X64)
|
||||
#define PHAS_PMF_INTERNAL 3
|
||||
#else
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#endif
|
||||
|
||||
#ifndef MEMBER_ABI
|
||||
#define MEMBER_ABI
|
||||
#endif
|
||||
|
||||
#ifndef PPMF_TYPE
|
||||
#if (PHAS_PMF_INTERNAL > 0)
|
||||
#define PPMF_TYPE PPMF_TYPE_INTERNAL
|
||||
#else
|
||||
#define PPMF_TYPE PPMF_TYPE_PMF
|
||||
#endif
|
||||
#else
|
||||
#undef PHAS_PMF_INTERNAL
|
||||
#define PHAS_PMF_INTERNAL 0
|
||||
#undef MEMBER_ABI
|
||||
#define MEMBER_ABI
|
||||
#endif
|
||||
|
||||
|
||||
#if (PPMF_TYPE == PPMF_TYPE_GNUC_PMF_CONV)
|
||||
#pragma GCC diagnostic ignored "-Wpmf-conversions"
|
||||
#endif
|
||||
|
@ -14,11 +14,12 @@
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
// noexcept on move operator -> issue with macosx clang
|
||||
#define COPYASSIGNMOVE(name, def) \
|
||||
name(const name &) = def; \
|
||||
name(name &&) noexcept = def; \
|
||||
name(name &&) /*noexcept*/ = def; \
|
||||
name &operator=(const name &) = def; \
|
||||
name &operator=(name &&) noexcept = def;
|
||||
name &operator=(name &&) /*noexcept*/ = def;
|
||||
|
||||
#define COPYASSIGN(name, def) \
|
||||
name(const name &) = def; \
|
||||
|
@ -571,6 +571,7 @@ NETLIST_START(pongf)
|
||||
NET_C(RV2.2, RV3.2)
|
||||
|
||||
ALIAS(videomix, RV3.2)
|
||||
|
||||
#if 1
|
||||
HINT(clk, NO_DEACTIVATE)
|
||||
HINT(ic_e1d, NO_DEACTIVATE)
|
||||
@ -593,17 +594,14 @@ NETLIST_START(pongf)
|
||||
HINT(ic_b7d, NO_DEACTIVATE)
|
||||
HINT(ic_a7a, NO_DEACTIVATE)
|
||||
HINT(ic_g1a, NO_DEACTIVATE)
|
||||
|
||||
HINT(ic_c8a, NO_DEACTIVATE)
|
||||
HINT(ic_c8b, NO_DEACTIVATE)
|
||||
HINT(ic_d8b, NO_DEACTIVATE)
|
||||
HINT(ic_d6a, NO_DEACTIVATE)
|
||||
|
||||
HINT(ic_d6b, NO_DEACTIVATE)
|
||||
HINT(ic_c6a, NO_DEACTIVATE)
|
||||
HINT(ic_c6b, NO_DEACTIVATE)
|
||||
HINT(ic_e5b, NO_DEACTIVATE)
|
||||
HINT(ic_e4c, NO_DEACTIVATE)
|
||||
HINT(ic_d4b, NO_DEACTIVATE)
|
||||
HINT(ic_g1b, NO_DEACTIVATE)
|
||||
#endif
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user