From c95f7878e6f5c00148b67b96d12be6283edb66d1 Mon Sep 17 00:00:00 2001
From: Phil Bennett
Date: Sun, 2 Jul 2017 15:57:29 -0700
Subject: Improve the speed of romident by dynamically allocating some large
device member arrays at device_start time instead [Phil Bennett]
---
src/devices/sound/ay8910.cpp | 5 +++--
src/devices/sound/ay8910.h | 2 +-
src/mame/audio/taito_en.cpp | 5 ++++-
src/mame/audio/taito_en.h | 2 +-
src/mame/video/powervr2.cpp | 10 ++++++----
src/mame/video/powervr2.h | 2 +-
6 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/devices/sound/ay8910.cpp b/src/devices/sound/ay8910.cpp
index 8fc807939d5..f5456163398 100644
--- a/src/devices/sound/ay8910.cpp
+++ b/src/devices/sound/ay8910.cpp
@@ -1147,7 +1147,7 @@ void ay8910_device::build_mixer_table()
*/
else
{
- build_3D_table(m_res_load[0], m_par, m_par_env, normalize, 3, m_zero_is_off, m_vol3d_table);
+ build_3D_table(m_res_load[0], m_par, m_par_env, normalize, 3, m_zero_is_off, m_vol3d_table.get());
}
}
@@ -1200,6 +1200,8 @@ void ay8910_device::device_start()
m_streams = 1;
}
+ m_vol3d_table = make_unique_clear(8*32*32*32);
+
build_mixer_table();
/* The envelope is pacing twice as fast for the YM2149 as for the AY-3-8910, */
@@ -1512,7 +1514,6 @@ ay8910_device::ay8910_device(const machine_config &mconfig, device_type type, co
memset(&m_vol_enabled,0,sizeof(m_vol_enabled));
memset(&m_vol_table,0,sizeof(m_vol_table));
memset(&m_env_table,0,sizeof(m_env_table));
- memset(&m_vol3d_table,0,sizeof(m_vol3d_table));
m_res_load[0] = m_res_load[1] = m_res_load[2] = 1000; //Default values for resistor loads
set_type(psg_type);
diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h
index d62d838e14a..ef796ee7071 100644
--- a/src/devices/sound/ay8910.h
+++ b/src/devices/sound/ay8910.h
@@ -190,7 +190,7 @@ private:
const ay_ym_param *m_par_env;
int32_t m_vol_table[NUM_CHANNELS][16];
int32_t m_env_table[NUM_CHANNELS][32];
- int32_t m_vol3d_table[8*32*32*32];
+ std::unique_ptr m_vol3d_table;
int m_flags; /* Flags */
int m_res_load[3]; /* Load on channel in ohms */
devcb_read8 m_port_a_read_cb;
diff --git a/src/mame/audio/taito_en.cpp b/src/mame/audio/taito_en.cpp
index 9c93d26d784..2cc1ac987e2 100644
--- a/src/mame/audio/taito_en.cpp
+++ b/src/mame/audio/taito_en.cpp
@@ -39,9 +39,12 @@ taito_en_device::taito_en_device(const machine_config &mconfig, const char *tag,
void taito_en_device::device_start()
{
+ // TODO: 16Mx32? Not likely!
+ m_es5510_dram = std::make_unique(1<<24);
+
+ save_pointer(NAME(m_es5510_dram.get()), 1<<24);
save_item(NAME(m_es5510_dsp_ram));
save_item(NAME(m_es5510_gpr));
- save_item(NAME(m_es5510_dram));
save_item(NAME(m_es5510_dol_latch));
save_item(NAME(m_es5510_dil_latch));
save_item(NAME(m_es5510_dadr_latch));
diff --git a/src/mame/audio/taito_en.h b/src/mame/audio/taito_en.h
index f4a1ae3824a..8f71884484b 100644
--- a/src/mame/audio/taito_en.h
+++ b/src/mame/audio/taito_en.h
@@ -43,9 +43,9 @@ private:
required_device m_mb87078;
//todo: hook up cpu/es5510
+ std::unique_ptr m_es5510_dram;
uint16_t m_es5510_dsp_ram[0x200];
uint32_t m_es5510_gpr[0xc0];
- uint32_t m_es5510_dram[1<<24];
uint32_t m_es5510_dol_latch;
uint32_t m_es5510_dil_latch;
uint32_t m_es5510_dadr_latch;
diff --git a/src/mame/video/powervr2.cpp b/src/mame/video/powervr2.cpp
index 10e3abd67d3..8f47668e1ed 100644
--- a/src/mame/video/powervr2.cpp
+++ b/src/mame/video/powervr2.cpp
@@ -940,9 +940,10 @@ WRITE32_MEMBER( powervr2_device::softreset_w )
logerror("%s: Core Pipeline soft reset\n", tag());
#endif
if (start_render_received == 1) {
- for (auto & elem : grab)
- if (elem.busy == 1)
- elem.busy = 0;
+ for (int a=0;a < NUM_BUFFERS;a++)
+ if (grab[a].busy == 1)
+ grab[a].busy = 0;
+
start_render_received = 0;
}
}
@@ -3620,7 +3621,8 @@ void powervr2_device::device_start()
{
irq_cb.resolve_safe();
- memset(grab, 0, sizeof(grab));
+ grab = make_unique_clear(NUM_BUFFERS);
+
pvr_build_parameterconfig();
computedilated();
diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h
index afdf4b23458..ed800973a0c 100644
--- a/src/mame/video/powervr2.h
+++ b/src/mame/video/powervr2.h
@@ -108,7 +108,7 @@ public:
int renderselect;
int listtype_used;
int alloc_ctrl_OPB_Mode, alloc_ctrl_PT_OPB, alloc_ctrl_TM_OPB, alloc_ctrl_T_OPB, alloc_ctrl_OM_OPB, alloc_ctrl_O_OPB;
- receiveddata grab[NUM_BUFFERS];
+ std::unique_ptr grab;
int grabsel;
int grabsellast;
uint32_t paracontrol,paratype,endofstrip,listtype,global_paratype,parameterconfig;
--
cgit v1.2.3