Work around GNU libstdc++ wanting to stack large temporaries when vector elements can be trivially constructed.

This commit is contained in:
Vas Crabb 2020-11-23 10:29:23 +11:00
parent 245ef45985
commit 58c8cba9b3
8 changed files with 65 additions and 25 deletions

View File

@ -264,10 +264,10 @@ before. It is created as an object of the device.
[device constructor] m_view(*this, "name"),
It is then setup through the address map API or dynamically. The, at
runtime, a variant, which is numbered, can be selected through the
``select`` method or the view can be disabled through the ``disabled``
method. A disabled view can be reenabled at any time.
It is then setup through the address map API or dynamically. At
runtime, a numbered variant can be selected using the ``select`` method,
or the view can be disabled using the ``disable`` method. A disabled
view can be re-enabled at any time.
4. Address maps API
@ -617,9 +617,9 @@ second method to setup a view is perfectly reasonable. A view is of
type **memory_view** and an indexed entry (e.g. a variant to setup) is
of type **memory_view::memory_view_entry &**.
A view can be installed in another view, but don't forget that a view
can be installed only once. A view can also being part of "what was
there before".
A view can be installed in another view, but dont forget that a view
can be installed only once. A view can also be part of “what was there
before”.
5. Address space dynamic mapping API

View File

@ -763,9 +763,9 @@ bool address_map_entry::unitmask_is_appropriate(u8 width, u64 unitmask, const ch
address_map::address_map(device_t &device, int spacenum)
: m_spacenum(spacenum),
m_device(&device),
m_view(nullptr),
m_view(nullptr),
m_unmapval(0),
m_globalmask(0)
m_globalmask(0)
{
// get our memory interface
const device_memory_interface *memintf;
@ -799,7 +799,7 @@ address_map::address_map(device_t &device, int spacenum)
address_map::address_map(device_t &device, address_map_entry *entry)
: m_spacenum(AS_PROGRAM),
m_device(&device),
m_view(nullptr),
m_view(nullptr),
m_unmapval(0),
m_globalmask(0)
{
@ -817,7 +817,7 @@ address_map::address_map(device_t &device, address_map_entry *entry)
address_map::address_map(const address_space &space, offs_t start, offs_t end, u64 unitmask, int cswidth, device_t &device, address_map_constructor submap_delegate)
: m_spacenum(space.spacenum()),
m_device(&device),
m_view(nullptr),
m_view(nullptr),
m_unmapval(space.unmap()),
m_globalmask(space.addrmask())
{

View File

@ -1012,7 +1012,7 @@ void memory_bank::configure_entries(int startentry, int numentries, void *base,
memory_region::memory_region(running_machine &machine, std::string name, u32 length, u8 width, endianness_t endian)
: m_machine(machine),
m_name(std::move(name)),
m_name(std::move(name)),
m_buffer(length),
m_endianness(endian),
m_bitwidth(width * 8),

View File

@ -54,10 +54,30 @@ private:
static constexpr offs_t HIGHMASK = make_bitmask<offs_t>(HighBits) ^ LOWMASK;
static constexpr offs_t UPMASK = ~make_bitmask<offs_t>(HighBits);
class handler_array : public std::array<handler_entry_read<Width, AddrShift, Endian> *, COUNT>
{
public:
using std::array<handler_entry_read<Width, AddrShift, Endian> *, COUNT>::array;
handler_array()
{
std::fill(this->begin(), this->end(), nullptr);
}
};
class range_array : public std::array<handler_entry::range, COUNT>
{
public:
using std::array<handler_entry::range, COUNT>::array;
range_array()
{
std::fill(this->begin(), this->end(), handler_entry::range{ 0, 0 });
}
};
memory_view *m_view;
std::vector<std::array<handler_entry_read<Width, AddrShift, Endian> *, COUNT>> m_dispatch_array;
std::vector<std::array<handler_entry::range, COUNT>> m_ranges_array;
std::vector<handler_array> m_dispatch_array;
std::vector<range_array> m_ranges_array;
handler_entry_read<Width, AddrShift, Endian> **m_a_dispatch;
handler_entry::range *m_a_ranges;

View File

@ -550,7 +550,7 @@ template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handl
fatalerror("init_handlers called on non-view handler_entry_read_dispatch.");
if(!m_dispatch_array.empty())
fatalerror("init_handlers called twice on handler_entry_read_dispatch.");
m_ranges_array.resize(1);
m_dispatch_array.resize(1);
m_a_ranges = m_ranges_array[0].data();
@ -591,7 +591,7 @@ template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handl
fatalerror("out-of-range view selection.");
m_a_ranges = m_ranges_array[i].data();
m_a_dispatch = m_dispatch_array[i].data();
m_a_dispatch = m_dispatch_array[i].data();
}
template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::select_u(int id)
@ -600,7 +600,7 @@ template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handl
if(i > m_dispatch_array.size())
fatalerror("out-of-range view update selection.");
else if(i == m_dispatch_array.size()) {
u32 aid = (std::array<handler_entry_read<Width, AddrShift, Endian> *, COUNT> *)(m_a_dispatch) - m_dispatch_array.data();
u32 aid = (handler_array *)(m_a_dispatch) - m_dispatch_array.data();
m_dispatch_array.resize(i+1);
m_ranges_array.resize(i+1);

View File

@ -54,10 +54,30 @@ private:
static constexpr offs_t HIGHMASK = make_bitmask<offs_t>(HighBits) ^ LOWMASK;
static constexpr offs_t UPMASK = ~make_bitmask<offs_t>(HighBits);
class handler_array : public std::array<handler_entry_write<Width, AddrShift, Endian> *, COUNT>
{
public:
using std::array<handler_entry_write<Width, AddrShift, Endian> *, COUNT>::array;
handler_array()
{
std::fill(this->begin(), this->end(), nullptr);
}
};
class range_array : public std::array<handler_entry::range, COUNT>
{
public:
using std::array<handler_entry::range, COUNT>::array;
range_array()
{
std::fill(this->begin(), this->end(), handler_entry::range{ 0, 0 });
}
};
memory_view *m_view;
std::vector<std::array<handler_entry_write<Width, AddrShift, Endian> *, COUNT>> m_dispatch_array;
std::vector<std::array<handler_entry::range, COUNT>> m_ranges_array;
std::vector<handler_array> m_dispatch_array;
std::vector<range_array> m_ranges_array;
handler_entry_write<Width, AddrShift, Endian> **m_a_dispatch;
handler_entry::range *m_a_ranges;

View File

@ -556,7 +556,7 @@ template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handl
fatalerror("init_handlers called on non-view handler_entry_write_dispatch.");
if(!m_dispatch_array.empty())
fatalerror("init_handlers called twice on handler_entry_write_dispatch.");
m_ranges_array.resize(1);
m_dispatch_array.resize(1);
m_a_ranges = m_ranges_array[0].data();
@ -597,7 +597,7 @@ template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handl
fatalerror("out-of-range view selection.");
m_a_ranges = m_ranges_array[i].data();
m_a_dispatch = m_dispatch_array[i].data();
m_a_dispatch = m_dispatch_array[i].data();
}
template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::select_u(int id)
@ -606,7 +606,7 @@ template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handl
if(i > m_dispatch_array.size())
fatalerror("out-of-range view update selection.");
else if(i == m_dispatch_array.size()) {
u32 aid = (std::array<handler_entry_write<Width, AddrShift, Endian> *, COUNT> *)(m_a_dispatch) - m_dispatch_array.data();
u32 aid = (handler_array *)(m_a_dispatch) - m_dispatch_array.data();
m_dispatch_array.resize(i+1);
m_ranges_array.resize(i+1);

View File

@ -460,7 +460,7 @@ namespace {
memory_view::memory_view_entry *mve_make(int Level, int Width, int AddrShift, endianness_t Endian, const address_space_config &config, memory_manager &manager, memory_view &view, int id) {
switch (Width | (AddrShift + 4)) {
case 8|(4+1): return mve_make_3<0, 1>(Level, Endian, config, manager, view, id);
case 8|(4+1): return mve_make_3<0, 1>(Level, Endian, config, manager, view, id);
case 8|(4-0): return mve_make_3<0, 0>(Level, Endian, config, manager, view, id);
case 16|(4+3): return mve_make_3<1, 3>(Level, Endian, config, manager, view, id);
case 16|(4-0): return mve_make_3<1, 0>(Level, Endian, config, manager, view, id);
@ -721,7 +721,7 @@ namespace {
case 64|(4-3): h_make_3<3, -3>(HighBits, Endian, space, view, r, w, sa, su); break;
default: abort();
}
}
}
}
std::pair<handler_entry *, handler_entry *> memory_view::make_handlers(address_space &space, offs_t addrstart, offs_t addrend)
@ -752,7 +752,7 @@ std::pair<handler_entry *, handler_entry *> memory_view::make_handlers(address_s
h_make(awidth, m_config->data_width(), m_config->addr_shift(), m_config->endianness(), space, *this, m_handler_read, m_handler_write, m_select_a, m_select_u);
}
return std::make_pair(m_handler_read, m_handler_write);
return std::make_pair(m_handler_read, m_handler_write);
}
void memory_view::make_subdispatch(std::string context)