From 057969e8c239d811397bc6dbcd19ede1a731526d Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 28 Dec 2020 14:25:18 +0100 Subject: [PATCH] views: pre-inline h_make_1, reduces the memory a little more --- src/emu/emumem_mview.cpp | 105 +++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 55 deletions(-) diff --git a/src/emu/emumem_mview.cpp b/src/emu/emumem_mview.cpp index e8248d7727e..653a37bcf1a 100644 --- a/src/emu/emumem_mview.cpp +++ b/src/emu/emumem_mview.cpp @@ -658,73 +658,68 @@ void memory_view::initialize_from_address_map(offs_t addrstart, offs_t addrend, } namespace { - template void h_make_1(address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { - r = new handler_entry_read_dispatch (&space, view); - w = new handler_entry_write_dispatch(&space, view); - } - - template void h_make_2(int HighBits, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { + template void h_make_1(int HighBits, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { switch(HighBits) { - case 0: h_make_1(space, view, r, w); break; - case 1: h_make_1(space, view, r, w); break; - case 2: h_make_1(space, view, r, w); break; - case 3: h_make_1(space, view, r, w); break; - case 4: h_make_1< 4, Width, AddrShift, Endian>(space, view, r, w); break; - case 5: h_make_1< 5, Width, AddrShift, Endian>(space, view, r, w); break; - case 6: h_make_1< 6, Width, AddrShift, Endian>(space, view, r, w); break; - case 7: h_make_1< 7, Width, AddrShift, Endian>(space, view, r, w); break; - case 8: h_make_1< 8, Width, AddrShift, Endian>(space, view, r, w); break; - case 9: h_make_1< 9, Width, AddrShift, Endian>(space, view, r, w); break; - case 10: h_make_1<10, Width, AddrShift, Endian>(space, view, r, w); break; - case 11: h_make_1<11, Width, AddrShift, Endian>(space, view, r, w); break; - case 12: h_make_1<12, Width, AddrShift, Endian>(space, view, r, w); break; - case 13: h_make_1<13, Width, AddrShift, Endian>(space, view, r, w); break; - case 14: h_make_1<14, Width, AddrShift, Endian>(space, view, r, w); break; - case 15: h_make_1<15, Width, AddrShift, Endian>(space, view, r, w); break; - case 16: h_make_1<16, Width, AddrShift, Endian>(space, view, r, w); break; - case 17: h_make_1<17, Width, AddrShift, Endian>(space, view, r, w); break; - case 18: h_make_1<18, Width, AddrShift, Endian>(space, view, r, w); break; - case 19: h_make_1<19, Width, AddrShift, Endian>(space, view, r, w); break; - case 20: h_make_1<20, Width, AddrShift, Endian>(space, view, r, w); break; - case 21: h_make_1<21, Width, AddrShift, Endian>(space, view, r, w); break; - case 22: h_make_1<22, Width, AddrShift, Endian>(space, view, r, w); break; - case 23: h_make_1<23, Width, AddrShift, Endian>(space, view, r, w); break; - case 24: h_make_1<24, Width, AddrShift, Endian>(space, view, r, w); break; - case 25: h_make_1<25, Width, AddrShift, Endian>(space, view, r, w); break; - case 26: h_make_1<26, Width, AddrShift, Endian>(space, view, r, w); break; - case 27: h_make_1<27, Width, AddrShift, Endian>(space, view, r, w); break; - case 28: h_make_1<28, Width, AddrShift, Endian>(space, view, r, w); break; - case 29: h_make_1<29, Width, AddrShift, Endian>(space, view, r, w); break; - case 30: h_make_1<20, Width, AddrShift, Endian>(space, view, r, w); break; - case 31: h_make_1<31, Width, AddrShift, Endian>(space, view, r, w); break; - case 32: h_make_1<32, Width, AddrShift, Endian>(space, view, r, w); break; + case 0: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; + case 1: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; + case 2: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; + case 3: r = new handler_entry_read_dispatch(&space, view); w = new handler_entry_write_dispatch(&space, view); break; + case 4: r = new handler_entry_read_dispatch< 4, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch< 4, Width, AddrShift, Endian>(&space, view); break; + case 5: r = new handler_entry_read_dispatch< 5, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch< 5, Width, AddrShift, Endian>(&space, view); break; + case 6: r = new handler_entry_read_dispatch< 6, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch< 6, Width, AddrShift, Endian>(&space, view); break; + case 7: r = new handler_entry_read_dispatch< 7, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch< 7, Width, AddrShift, Endian>(&space, view); break; + case 8: r = new handler_entry_read_dispatch< 8, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch< 8, Width, AddrShift, Endian>(&space, view); break; + case 9: r = new handler_entry_read_dispatch< 9, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch< 9, Width, AddrShift, Endian>(&space, view); break; + case 10: r = new handler_entry_read_dispatch<10, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<10, Width, AddrShift, Endian>(&space, view); break; + case 11: r = new handler_entry_read_dispatch<11, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<11, Width, AddrShift, Endian>(&space, view); break; + case 12: r = new handler_entry_read_dispatch<12, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<12, Width, AddrShift, Endian>(&space, view); break; + case 13: r = new handler_entry_read_dispatch<13, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<13, Width, AddrShift, Endian>(&space, view); break; + case 14: r = new handler_entry_read_dispatch<14, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<14, Width, AddrShift, Endian>(&space, view); break; + case 15: r = new handler_entry_read_dispatch<15, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<15, Width, AddrShift, Endian>(&space, view); break; + case 16: r = new handler_entry_read_dispatch<16, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<16, Width, AddrShift, Endian>(&space, view); break; + case 17: r = new handler_entry_read_dispatch<17, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<17, Width, AddrShift, Endian>(&space, view); break; + case 18: r = new handler_entry_read_dispatch<18, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<18, Width, AddrShift, Endian>(&space, view); break; + case 19: r = new handler_entry_read_dispatch<19, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<19, Width, AddrShift, Endian>(&space, view); break; + case 20: r = new handler_entry_read_dispatch<20, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<20, Width, AddrShift, Endian>(&space, view); break; + case 21: r = new handler_entry_read_dispatch<21, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<21, Width, AddrShift, Endian>(&space, view); break; + case 22: r = new handler_entry_read_dispatch<22, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<22, Width, AddrShift, Endian>(&space, view); break; + case 23: r = new handler_entry_read_dispatch<23, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<23, Width, AddrShift, Endian>(&space, view); break; + case 24: r = new handler_entry_read_dispatch<24, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<24, Width, AddrShift, Endian>(&space, view); break; + case 25: r = new handler_entry_read_dispatch<25, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<25, Width, AddrShift, Endian>(&space, view); break; + case 26: r = new handler_entry_read_dispatch<26, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<26, Width, AddrShift, Endian>(&space, view); break; + case 27: r = new handler_entry_read_dispatch<27, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<27, Width, AddrShift, Endian>(&space, view); break; + case 28: r = new handler_entry_read_dispatch<28, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<28, Width, AddrShift, Endian>(&space, view); break; + case 29: r = new handler_entry_read_dispatch<29, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<29, Width, AddrShift, Endian>(&space, view); break; + case 30: r = new handler_entry_read_dispatch<30, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<30, Width, AddrShift, Endian>(&space, view); break; + case 31: r = new handler_entry_read_dispatch<31, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<31, Width, AddrShift, Endian>(&space, view); break; + case 32: r = new handler_entry_read_dispatch<32, Width, AddrShift, Endian>(&space, view); w = new handler_entry_write_dispatch<32, Width, AddrShift, Endian>(&space, view); break; default: abort(); } } - template void h_make_3(int HighBits, endianness_t Endian, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { + template void h_make_2(int HighBits, endianness_t Endian, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { switch(Endian) { - case ENDIANNESS_LITTLE: h_make_2(HighBits, space, view, r, w); break; - case ENDIANNESS_BIG: h_make_2 (HighBits, space, view, r, w); break; + case ENDIANNESS_LITTLE: h_make_1(HighBits, space, view, r, w); break; + case ENDIANNESS_BIG: h_make_1 (HighBits, space, view, r, w); break; default: abort(); } } void h_make(int HighBits, int Width, int AddrShift, endianness_t Endian, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) { switch (Width | (AddrShift + 4)) { - case 8|(4+1): h_make_3<0, 1>(HighBits, Endian, space, view, r, w); break; - case 8|(4-0): h_make_3<0, 0>(HighBits, Endian, space, view, r, w); break; - case 16|(4+3): h_make_3<1, 3>(HighBits, Endian, space, view, r, w); break; - case 16|(4-0): h_make_3<1, 0>(HighBits, Endian, space, view, r, w); break; - case 16|(4-1): h_make_3<1, -1>(HighBits, Endian, space, view, r, w); break; - case 32|(4+3): h_make_3<2, 3>(HighBits, Endian, space, view, r, w); break; - case 32|(4-0): h_make_3<2, 0>(HighBits, Endian, space, view, r, w); break; - case 32|(4-1): h_make_3<2, -1>(HighBits, Endian, space, view, r, w); break; - case 32|(4-2): h_make_3<2, -2>(HighBits, Endian, space, view, r, w); break; - case 64|(4-0): h_make_3<3, 0>(HighBits, Endian, space, view, r, w); break; - case 64|(4-1): h_make_3<3, -1>(HighBits, Endian, space, view, r, w); break; - case 64|(4-2): h_make_3<3, -2>(HighBits, Endian, space, view, r, w); break; - case 64|(4-3): h_make_3<3, -3>(HighBits, Endian, space, view, r, w); break; + case 8|(4+1): h_make_2<0, 1>(HighBits, Endian, space, view, r, w); break; + case 8|(4-0): h_make_2<0, 0>(HighBits, Endian, space, view, r, w); break; + case 16|(4+3): h_make_2<1, 3>(HighBits, Endian, space, view, r, w); break; + case 16|(4-0): h_make_2<1, 0>(HighBits, Endian, space, view, r, w); break; + case 16|(4-1): h_make_2<1, -1>(HighBits, Endian, space, view, r, w); break; + case 32|(4+3): h_make_2<2, 3>(HighBits, Endian, space, view, r, w); break; + case 32|(4-0): h_make_2<2, 0>(HighBits, Endian, space, view, r, w); break; + case 32|(4-1): h_make_2<2, -1>(HighBits, Endian, space, view, r, w); break; + case 32|(4-2): h_make_2<2, -2>(HighBits, Endian, space, view, r, w); break; + case 64|(4-0): h_make_2<3, 0>(HighBits, Endian, space, view, r, w); break; + case 64|(4-1): h_make_2<3, -1>(HighBits, Endian, space, view, r, w); break; + case 64|(4-2): h_make_2<3, -2>(HighBits, Endian, space, view, r, w); break; + case 64|(4-3): h_make_2<3, -3>(HighBits, Endian, space, view, r, w); break; default: abort(); } }