summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2015-12-21 16:01:14 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2015-12-21 16:01:14 +0100
commita55ab6d6159c3393cc66ee2bb5aeefcee855225d (patch)
treec30568eea65273a64983dc7bb6ccbe5d30ca73f5 /src/devices
parent1fefd835ce03ff8ebb09a9af09e6da2300425b63 (diff)
some handmade changes (nw)
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/bus/snes/bsx.cpp2
-rw-r--r--src/devices/bus/snes/bsx.h2
-rw-r--r--src/devices/bus/snes/sdd1.cpp30
-rw-r--r--src/devices/bus/snes/sdd1.h22
-rw-r--r--src/devices/bus/snes/spc7110.cpp2
-rw-r--r--src/devices/bus/snes/spc7110.h2
-rw-r--r--src/devices/cpu/mips/mips3.cpp6
-rw-r--r--src/devices/cpu/mips/mips3.h4
-rw-r--r--src/devices/cpu/mips/mips3drc.cpp14
-rw-r--r--src/devices/cpu/powerpc/ppc.h4
-rw-r--r--src/devices/cpu/powerpc/ppccom.cpp8
-rw-r--r--src/devices/cpu/powerpc/ppcdrc.cpp28
-rw-r--r--src/devices/cpu/rsp/rsp.cpp23
-rw-r--r--src/devices/cpu/rsp/rsp.h6
-rw-r--r--src/devices/cpu/rsp/rspcp2.h3
-rw-r--r--src/devices/cpu/rsp/rspcp2d.h4
-rw-r--r--src/devices/cpu/rsp/rspdrc.cpp12
-rw-r--r--src/devices/cpu/sh2/sh2.cpp9
-rw-r--r--src/devices/cpu/sh2/sh2.h4
-rw-r--r--src/devices/cpu/sh2/sh2drc.cpp14
-rw-r--r--src/devices/sound/ymf271.cpp20
-rw-r--r--src/devices/sound/ymf271.h2
-rw-r--r--src/devices/video/stvvdp1.cpp2
23 files changed, 102 insertions, 121 deletions
diff --git a/src/devices/bus/snes/bsx.cpp b/src/devices/bus/snes/bsx.cpp
index 450bcadcbce..a534018f78d 100644
--- a/src/devices/bus/snes/bsx.cpp
+++ b/src/devices/bus/snes/bsx.cpp
@@ -70,7 +70,7 @@ sns_rom_bsmempak_device::sns_rom_bsmempak_device(const machine_config &mconfig,
void sns_rom_bsx_device::device_start()
{
- m_base_unit = auto_alloc(machine(), BSX_base(machine()));
+ m_base_unit = std::make_unique<BSX_base>(machine());
m_base_unit->init();
memset(m_cart_regs, 0x00, sizeof(m_cart_regs));
diff --git a/src/devices/bus/snes/bsx.h b/src/devices/bus/snes/bsx.h
index d4df9529326..43ee42f7b4a 100644
--- a/src/devices/bus/snes/bsx.h
+++ b/src/devices/bus/snes/bsx.h
@@ -51,7 +51,7 @@ public:
virtual DECLARE_WRITE8_MEMBER(chip_write) override;
// base regs
- BSX_base *m_base_unit;
+ std::unique_ptr<BSX_base> m_base_unit;
// cart regs
UINT8 m_cart_regs[16];
diff --git a/src/devices/bus/snes/sdd1.cpp b/src/devices/bus/snes/sdd1.cpp
index f3282b27b84..87041e3ffb8 100644
--- a/src/devices/bus/snes/sdd1.cpp
+++ b/src/devices/bus/snes/sdd1.cpp
@@ -369,20 +369,20 @@ void SDD1_OL::OL_launch(UINT8 *ROM, UINT32 *mmc)
SDD1_emu::SDD1_emu(running_machine &machine)
: m_machine(machine)
{
- m_IM = auto_alloc(machine, SDD1_IM());
- m_GCD = auto_alloc(machine, SDD1_GCD(m_IM));
- m_BG0 = auto_alloc(machine, SDD1_BG(m_GCD, 0));
- m_BG1 = auto_alloc(machine, SDD1_BG(m_GCD, 1));
- m_BG2 = auto_alloc(machine, SDD1_BG(m_GCD, 2));
- m_BG3 = auto_alloc(machine, SDD1_BG(m_GCD, 3));
- m_BG4 = auto_alloc(machine, SDD1_BG(m_GCD, 4));
- m_BG5 = auto_alloc(machine, SDD1_BG(m_GCD, 5));
- m_BG6 = auto_alloc(machine, SDD1_BG(m_GCD, 6));
- m_BG7 = auto_alloc(machine, SDD1_BG(m_GCD, 7));
- m_PEM = auto_alloc(machine, SDD1_PEM(m_BG0, m_BG1, m_BG2, m_BG3,
- m_BG4, m_BG5, m_BG6, m_BG7));
- m_CM = auto_alloc(machine, SDD1_CM(m_PEM));
- m_OL = auto_alloc(machine, SDD1_OL(m_CM));
+ m_IM = std::make_unique<SDD1_IM>();
+ m_GCD = std::make_unique<SDD1_GCD>(m_IM.get());
+ m_BG0 = std::make_unique<SDD1_BG>(m_GCD.get(), 0);
+ m_BG1 = std::make_unique<SDD1_BG>(m_GCD.get(), 1);
+ m_BG2 = std::make_unique<SDD1_BG>(m_GCD.get(), 2);
+ m_BG3 = std::make_unique<SDD1_BG>(m_GCD.get(), 3);
+ m_BG4 = std::make_unique<SDD1_BG>(m_GCD.get(), 4);
+ m_BG5 = std::make_unique<SDD1_BG>(m_GCD.get(), 5);
+ m_BG6 = std::make_unique<SDD1_BG>(m_GCD.get(), 6);
+ m_BG7 = std::make_unique<SDD1_BG>(m_GCD.get(), 7);
+ m_PEM = std::make_unique<SDD1_PEM>(m_BG0.get(), m_BG1.get(), m_BG2.get(), m_BG3.get(),
+ m_BG4.get(), m_BG5.get(), m_BG6.get(), m_BG7.get());
+ m_CM = std::make_unique<SDD1_CM>(m_PEM.get());
+ m_OL = std::make_unique<SDD1_OL>(m_CM.get());
}
void SDD1_emu::SDD1emu_decompress(UINT8 *ROM, UINT32 *mmc, UINT32 in_buf, UINT16 out_len, UINT8 *out_buf)
@@ -426,7 +426,7 @@ sns_rom_sdd1_device::sns_rom_sdd1_device(const machine_config &mconfig, const ch
void sns_rom_sdd1_device::device_start()
{
- m_sdd1emu = auto_alloc(machine(), SDD1_emu(machine()));
+ m_sdd1emu = std::make_unique<SDD1_emu>(machine());
m_buffer.data = std::make_unique<UINT8[]>(0x10000);
m_buffer.ready = 0;
diff --git a/src/devices/bus/snes/sdd1.h b/src/devices/bus/snes/sdd1.h
index 6524a043b68..e9dcc9e71e1 100644
--- a/src/devices/bus/snes/sdd1.h
+++ b/src/devices/bus/snes/sdd1.h
@@ -126,13 +126,19 @@ public:
running_machine &machine() const { return m_machine; }
- SDD1_IM* m_IM;
- SDD1_GCD* m_GCD;
- SDD1_BG* m_BG0; SDD1_BG* m_BG1; SDD1_BG* m_BG2; SDD1_BG* m_BG3;
- SDD1_BG* m_BG4; SDD1_BG* m_BG5; SDD1_BG* m_BG6; SDD1_BG* m_BG7;
- SDD1_PEM* m_PEM;
- SDD1_CM* m_CM;
- SDD1_OL* m_OL;
+ std::unique_ptr<SDD1_IM> m_IM;
+ std::unique_ptr<SDD1_GCD> m_GCD;
+ std::unique_ptr<SDD1_BG> m_BG0;
+ std::unique_ptr<SDD1_BG> m_BG1;
+ std::unique_ptr<SDD1_BG> m_BG2;
+ std::unique_ptr<SDD1_BG> m_BG3;
+ std::unique_ptr<SDD1_BG> m_BG4;
+ std::unique_ptr<SDD1_BG> m_BG5;
+ std::unique_ptr<SDD1_BG> m_BG6;
+ std::unique_ptr<SDD1_BG> m_BG7;
+ std::unique_ptr<SDD1_PEM> m_PEM;
+ std::unique_ptr<SDD1_CM> m_CM;
+ std::unique_ptr<SDD1_OL> m_OL;
void SDD1emu_decompress(UINT8 *ROM, UINT32 *mmc, UINT32 in_buf, UINT16 out_len, UINT8 *out_buf);
@@ -176,7 +182,7 @@ public:
UINT16 size; // $43x5-$43x6 -- DMA transfer size
} m_dma[8];
- SDD1_emu* m_sdd1emu;
+ std::unique_ptr<SDD1_emu> m_sdd1emu;
struct
{
diff --git a/src/devices/bus/snes/spc7110.cpp b/src/devices/bus/snes/spc7110.cpp
index 0c7cc797316..5e5561af3d7 100644
--- a/src/devices/bus/snes/spc7110.cpp
+++ b/src/devices/bus/snes/spc7110.cpp
@@ -50,7 +50,7 @@ sns_rom_spc7110rtc_device::sns_rom_spc7110rtc_device(const machine_config &mconf
void sns_rom_spc7110_device::spc7110_start()
{
- m_decomp = auto_alloc(machine(), SPC7110_Decomp(machine()));
+ m_decomp = std::make_unique<SPC7110_Decomp>(machine());
// The SPC7110 works in conjunction with 0x2000 of RAM, which is battery backed up (and hence emulated by our m_nvram)
diff --git a/src/devices/bus/snes/spc7110.h b/src/devices/bus/snes/spc7110.h
index 7dd3710cc5d..33d7170d02c 100644
--- a/src/devices/bus/snes/spc7110.h
+++ b/src/devices/bus/snes/spc7110.h
@@ -130,7 +130,7 @@ public:
UINT8 m_r480b; // decompression control register
UINT8 m_r480c; // decompression status
- SPC7110_Decomp* m_decomp;
+ std::unique_ptr<SPC7110_Decomp> m_decomp;
UINT8 m_r4811; // data pointer low
UINT8 m_r4812; // data pointer high
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index ed95f09d418..3588db1b888 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -203,12 +203,10 @@ void mips3_device::device_stop()
if (m_drcfe != nullptr)
{
- auto_free(machine(), m_drcfe);
m_drcfe = nullptr;
}
if (m_drcuml != nullptr)
{
- auto_free(machine(), m_drcuml);
m_drcuml = nullptr;
}
}
@@ -357,7 +355,7 @@ void mips3_device::device_start()
UINT32 flags = 0;
/* initialize the UML generator */
- m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2));
+ m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, flags, 8, 32, 2);
/* add symbols for our stuff */
m_drcuml->symbol_add(&m_core->pc, sizeof(m_core->pc), "pc");
@@ -403,7 +401,7 @@ void mips3_device::device_start()
m_drcuml->symbol_add(&m_fpmode, sizeof(m_fpmode), "fpmode");
/* initialize the front-end helper */
- m_drcfe = auto_alloc(machine(), mips3_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE));
+ m_drcfe = std::make_unique<mips3_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE);
/* allocate memory for cache-local state and initialize it */
memcpy(m_fpmode, fpmode_source, sizeof(fpmode_source));
diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h
index 1b76e37fe3f..e87f8862f40 100644
--- a/src/devices/cpu/mips/mips3.h
+++ b/src/devices/cpu/mips/mips3.h
@@ -409,8 +409,8 @@ private:
/* core state */
drc_cache m_cache; /* pointer to the DRC code cache */
- drcuml_state * m_drcuml; /* DRC UML generator state */
- mips3_frontend * m_drcfe; /* pointer to the DRC front-end state */
+ std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */
+ std::unique_ptr<mips3_frontend> m_drcfe; /* pointer to the DRC front-end state */
UINT32 m_drcoptions; /* configurable DRC options */
/* internal stuff */
diff --git a/src/devices/cpu/mips/mips3drc.cpp b/src/devices/cpu/mips/mips3drc.cpp
index 02d73de3b14..4e6e9771a38 100644
--- a/src/devices/cpu/mips/mips3drc.cpp
+++ b/src/devices/cpu/mips/mips3drc.cpp
@@ -280,7 +280,7 @@ void mips3_device::code_flush_cache()
void mips3_device::code_compile_block(UINT8 mode, offs_t pc)
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
compiler_state compiler = { 0 };
const opcode_desc *seqhead, *seqlast;
const opcode_desc *desclist;
@@ -553,7 +553,7 @@ static void cfunc_unimplemented(void *param)
void mips3_device::static_generate_entry_point()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
code_label skip = 1;
drcuml_block *block;
@@ -601,7 +601,7 @@ void mips3_device::static_generate_entry_point()
void mips3_device::static_generate_nocode_handler()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -626,7 +626,7 @@ void mips3_device::static_generate_nocode_handler()
void mips3_device::static_generate_out_of_cycles()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -651,7 +651,7 @@ void mips3_device::static_generate_out_of_cycles()
void mips3_device::static_generate_tlb_mismatch()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* forward references */
@@ -702,7 +702,7 @@ void mips3_device::static_generate_tlb_mismatch()
void mips3_device::static_generate_exception(UINT8 exception, int recover, const char *name)
{
code_handle *&exception_handle = recover ? m_exception[exception] : m_exception_norecover[exception];
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
UINT32 offset = 0x180;
code_label next = 1;
code_label skip = 2;
@@ -805,7 +805,7 @@ void mips3_device::static_generate_memory_accessor(int mode, int size, int iswri
code_handle &exception_tlb = *m_exception[iswrite ? EXCEPTION_TLBSTORE : EXCEPTION_TLBLOAD];
code_handle &exception_tlbfill = *m_exception[iswrite ? EXCEPTION_TLBSTORE_FILL : EXCEPTION_TLBLOAD_FILL];
code_handle &exception_addrerr = *m_exception[iswrite ? EXCEPTION_ADDRSTORE : EXCEPTION_ADDRLOAD];
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
int tlbmiss = 0;
int label = 1;
diff --git a/src/devices/cpu/powerpc/ppc.h b/src/devices/cpu/powerpc/ppc.h
index 3a0e9b9b2f3..a73accb6409 100644
--- a/src/devices/cpu/powerpc/ppc.h
+++ b/src/devices/cpu/powerpc/ppc.h
@@ -537,8 +537,8 @@ protected:
/* core state */
drc_cache m_cache; /* pointer to the DRC code cache */
- drcuml_state * m_drcuml; /* DRC UML generator state */
- ppc_frontend * m_drcfe; /* pointer to the DRC front-end state */
+ std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */
+ std::unique_ptr<ppc_frontend> m_drcfe; /* pointer to the DRC front-end state */
UINT32 m_drcoptions; /* configurable DRC options */
/* parameters for subroutines */
diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp
index 6c8d4397206..25c39516c73 100644
--- a/src/devices/cpu/powerpc/ppccom.cpp
+++ b/src/devices/cpu/powerpc/ppccom.cpp
@@ -882,7 +882,7 @@ void ppc_device::device_start()
UINT32 flags = 0;
/* initialize the UML generator */
- m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2));
+ m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, flags, 8, 32, 2);
/* add symbols for our stuff */
m_drcuml->symbol_add(&m_core->pc, sizeof(m_core->pc), "pc");
@@ -928,7 +928,7 @@ void ppc_device::device_start()
m_drcuml->symbol_add(&m_fcmp_cr_table, sizeof(m_fcmp_cr_table), "fcmp_cr_table");
/* initialize the front-end helper */
- m_drcfe = auto_alloc(machine(), ppc_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE));
+ m_drcfe = std::make_unique<ppc_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE);
/* compute the register parameters */
for (int regnum = 0; regnum < 32; regnum++)
@@ -1151,10 +1151,6 @@ void ppc_device::device_stop()
if (m_vtlb != nullptr)
vtlb_free(m_vtlb);
m_vtlb = nullptr;
-
- /* clean up the DRC */
- auto_free(machine(), m_drcfe);
- auto_free(machine(), m_drcuml);
}
diff --git a/src/devices/cpu/powerpc/ppcdrc.cpp b/src/devices/cpu/powerpc/ppcdrc.cpp
index 57b6290a191..ed502d344de 100644
--- a/src/devices/cpu/powerpc/ppcdrc.cpp
+++ b/src/devices/cpu/powerpc/ppcdrc.cpp
@@ -369,7 +369,7 @@ void ppc_device::code_compile_block(UINT8 mode, offs_t pc)
/* get a description of this sequence */
desclist = m_drcfe->describe_code(pc);
if (m_drcuml->logging() || m_drcuml->logging_native())
- log_opcode_desc(m_drcuml, desclist, 0);
+ log_opcode_desc(m_drcuml.get(), desclist, 0);
bool succeeded = false;
while (!succeeded)
@@ -641,10 +641,10 @@ void ppc_device::static_generate_entry_point()
block = m_drcuml->begin_block(20);
/* forward references */
- alloc_handle(m_drcuml, &m_nocode, "nocode");
- alloc_handle(m_drcuml, &m_exception_norecover[EXCEPTION_EI], "exception_ei_norecover");
+ alloc_handle(m_drcuml.get(), &m_nocode, "nocode");
+ alloc_handle(m_drcuml.get(), &m_exception_norecover[EXCEPTION_EI], "exception_ei_norecover");
- alloc_handle(m_drcuml, &m_entry, "entry");
+ alloc_handle(m_drcuml.get(), &m_entry, "entry");
UML_HANDLE(block, *m_entry); // handle entry
/* reset the FPU mode */
@@ -685,7 +685,7 @@ void ppc_device::static_generate_nocode_handler()
block = m_drcuml->begin_block(10);
/* generate a hash jump via the current mode and PC */
- alloc_handle(m_drcuml, &m_nocode, "nocode");
+ alloc_handle(m_drcuml.get(), &m_nocode, "nocode");
UML_HANDLE(block, *m_nocode); // handle nocode
UML_GETEXP(block, I0); // getexp i0
UML_MOV(block, mem(&m_core->pc), I0); // mov [pc],i0
@@ -709,7 +709,7 @@ void ppc_device::static_generate_out_of_cycles()
block = m_drcuml->begin_block(10);
/* generate a hash jump via the current mode and PC */
- alloc_handle(m_drcuml, &m_out_of_cycles, "out_of_cycles");
+ alloc_handle(m_drcuml.get(), &m_out_of_cycles, "out_of_cycles");
UML_HANDLE(block, *m_out_of_cycles); // handle out_of_cycles
UML_GETEXP(block, I0); // getexp i0
UML_MOV(block, mem(&m_core->pc), I0); // mov <pc>,i0
@@ -731,15 +731,15 @@ void ppc_device::static_generate_tlb_mismatch()
int isi, exit, label = 1;
/* forward references */
- alloc_handle(m_drcuml, &m_exception[EXCEPTION_ISI], "exception_isi");
+ alloc_handle(m_drcuml.get(), &m_exception[EXCEPTION_ISI], "exception_isi");
if (m_cap & PPCCAP_603_MMU)
- alloc_handle(m_drcuml, &m_exception[EXCEPTION_ITLBMISS], "exception_itlb_miss");
+ alloc_handle(m_drcuml.get(), &m_exception[EXCEPTION_ITLBMISS], "exception_itlb_miss");
/* begin generating */
block = m_drcuml->begin_block(20);
/* generate a hash jump via the current mode and PC */
- alloc_handle(m_drcuml, &m_tlb_mismatch, "tlb_mismatch");
+ alloc_handle(m_drcuml.get(), &m_tlb_mismatch, "tlb_mismatch");
UML_HANDLE(block, *m_tlb_mismatch); // handle tlb_mismatch
UML_RECOVER(block, I0, MAPVAR_PC); // recover i0,PC
UML_SHR(block, I1, I0, 12); // shr i1,i0,12
@@ -792,7 +792,7 @@ void ppc_device::static_generate_exception(UINT8 exception, int recover, const c
block = m_drcuml->begin_block(1024);
/* add a global entry for this */
- alloc_handle(m_drcuml, &exception_handle, name);
+ alloc_handle(m_drcuml.get(), &exception_handle, name);
UML_HANDLE(block, *exception_handle); // handle name
/* exception parameter is expected to be the fault address in this case */
@@ -981,7 +981,7 @@ void ppc_device::static_generate_memory_accessor(int mode, int size, int iswrite
block = m_drcuml->begin_block(1024);
/* add a global entry for this */
- alloc_handle(m_drcuml, &handleptr, name);
+ alloc_handle(m_drcuml.get(), &handleptr, name);
UML_HANDLE(block, *handleptr); // handle *handleptr
/* check for unaligned accesses and break into two */
@@ -1388,7 +1388,7 @@ void ppc_device::static_generate_swap_tgpr()
block = m_drcuml->begin_block(30);
/* generate a hash jump via the current mode and PC */
- alloc_handle(m_drcuml, &m_swap_tgpr, "swap_tgpr");
+ alloc_handle(m_drcuml.get(), &m_swap_tgpr, "swap_tgpr");
UML_HANDLE(block, *m_swap_tgpr); // handle swap_tgpr
for (regnum = 0; regnum < 4; regnum++)
{
@@ -1423,7 +1423,7 @@ void ppc_device::static_generate_lsw_entries(int mode)
/* allocate a handle */
sprintf(temp, "lsw%d", regnum);
- alloc_handle(m_drcuml, &m_lsw[mode][regnum], temp);
+ alloc_handle(m_drcuml.get(), &m_lsw[mode][regnum], temp);
UML_HANDLE(block, *m_lsw[mode][regnum]); // handle lsw<regnum>
UML_LABEL(block, regnum); // regnum:
UML_ADD(block, I0, mem(&m_core->updateaddr), 0); // add i0,[updateaddr],0
@@ -1477,7 +1477,7 @@ void ppc_device::static_generate_stsw_entries(int mode)
/* allocate a handle */
sprintf(temp, "stsw%d", regnum);
- alloc_handle(m_drcuml, &m_stsw[mode][regnum], temp);
+ alloc_handle(m_drcuml.get(), &m_stsw[mode][regnum], temp);
UML_HANDLE(block, *m_stsw[mode][regnum]); // handle stsw<regnum>
UML_LABEL(block, regnum); // regnum:
UML_ADD(block, I0, mem(&m_core->updateaddr), 0); // add i0,[updateaddr],0
diff --git a/src/devices/cpu/rsp/rsp.cpp b/src/devices/cpu/rsp/rsp.cpp
index c8cbbfe24d1..5541c643c6b 100644
--- a/src/devices/cpu/rsp/rsp.cpp
+++ b/src/devices/cpu/rsp/rsp.cpp
@@ -373,11 +373,11 @@ void rsp_device::device_start()
if (m_isdrc)
{
- m_cop2 = auto_alloc(machine(), rsp_cop2_drc(*this, machine()));
+ m_cop2 = std::make_unique<rsp_cop2_drc>(*this, machine());
}
else
{
- m_cop2 = auto_alloc(machine(), rsp_cop2(*this, machine()));
+ m_cop2 = std::make_unique<rsp_cop2>(*this, machine());
}
m_cop2->init();
m_cop2->start();
@@ -393,7 +393,7 @@ void rsp_device::device_start()
/* initialize the UML generator */
UINT32 drc_flags = 0;
- m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, drc_flags, 8, 32, 2));
+ m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, drc_flags, 8, 32, 2);
/* add symbols for our stuff */
m_drcuml->symbol_add(&m_rsp_state->pc, sizeof(m_rsp_state->pc), "pc");
@@ -411,7 +411,7 @@ void rsp_device::device_start()
m_drcuml->symbol_add(&m_numcycles, sizeof(m_numcycles), "numcycles");
/* initialize the front-end helper */
- m_drcfe = auto_alloc(machine(), rsp_frontend(*this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE));
+ m_drcfe = std::make_unique<rsp_frontend>(*this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE);
/* compute the register parameters */
for (int regnum = 0; regnum < 32; regnum++)
@@ -596,21 +596,6 @@ void rsp_device::device_stop()
if (m_exec_output)
fclose(m_exec_output);
m_exec_output = nullptr;
-
- /* clean up the DRC */
- if (m_drcuml)
- {
- auto_free(machine(), m_drcuml);
- }
- if (m_drcfe)
- {
- auto_free(machine(), m_drcfe);
- }
-
- if (m_cop2)
- {
- auto_free(machine(), m_cop2);
- }
}
void rsp_device::device_reset()
diff --git a/src/devices/cpu/rsp/rsp.h b/src/devices/cpu/rsp/rsp.h
index 1f92aac50d9..958c4268bb8 100644
--- a/src/devices/cpu/rsp/rsp.h
+++ b/src/devices/cpu/rsp/rsp.h
@@ -217,8 +217,8 @@ private:
/* core state */
drc_cache m_cache; /* pointer to the DRC code cache */
- drcuml_state * m_drcuml; /* DRC UML generator state */
- rsp_frontend * m_drcfe; /* pointer to the DRC front-end state */
+ std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */
+ std::unique_ptr<rsp_frontend> m_drcfe; /* pointer to the DRC front-end state */
UINT32 m_drcoptions; /* configurable DRC options */
/* internal stuff */
@@ -269,7 +269,7 @@ protected:
direct_read_data *m_direct;
private:
- rsp_cop2 *m_cop2;
+ std::unique_ptr<rsp_cop2> m_cop2;
UINT32 *m_dmem32;
UINT16 *m_dmem16;
diff --git a/src/devices/cpu/rsp/rspcp2.h b/src/devices/cpu/rsp/rspcp2.h
index 909b0ae4172..8911eeb1838 100644
--- a/src/devices/cpu/rsp/rspcp2.h
+++ b/src/devices/cpu/rsp/rspcp2.h
@@ -78,9 +78,10 @@ class rsp_cop2
{
friend class rsp_device;
-protected:
+public:
rsp_cop2(rsp_device &rsp, running_machine &machine);
+protected:
virtual void init();
virtual void start();
diff --git a/src/devices/cpu/rsp/rspcp2d.h b/src/devices/cpu/rsp/rspcp2d.h
index ef727e37b95..c918d825e60 100644
--- a/src/devices/cpu/rsp/rspcp2d.h
+++ b/src/devices/cpu/rsp/rspcp2d.h
@@ -21,9 +21,9 @@
class rsp_cop2_drc : public rsp_cop2
{
friend class rsp_device;
-
+public:
rsp_cop2_drc(rsp_device &rsp, running_machine &machine) : rsp_cop2(rsp, machine) { }
-
+private:
virtual int generate_cop2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override;
virtual int generate_lwc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override;
virtual int generate_swc2(drcuml_block *block, rsp_device::compiler_state *compiler, const opcode_desc *desc) override;
diff --git a/src/devices/cpu/rsp/rspdrc.cpp b/src/devices/cpu/rsp/rspdrc.cpp
index 097a8c39507..c581cfb3aba 100644
--- a/src/devices/cpu/rsp/rspdrc.cpp
+++ b/src/devices/cpu/rsp/rspdrc.cpp
@@ -260,7 +260,7 @@ void cfunc_sp_set_status_cb(void *param)
void rsp_device::execute_run_drc()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
int execute_result;
/* reset the cache if dirty */
@@ -350,7 +350,7 @@ void rsp_device::code_flush_cache()
void rsp_device::code_compile_block(offs_t pc)
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
compiler_state compiler = { 0 };
const opcode_desc *seqhead, *seqlast;
const opcode_desc *desclist;
@@ -490,7 +490,7 @@ static void cfunc_fatalerror(void *param)
void rsp_device::static_generate_entry_point()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -518,7 +518,7 @@ void rsp_device::static_generate_entry_point()
void rsp_device::static_generate_nocode_handler()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -543,7 +543,7 @@ void rsp_device::static_generate_nocode_handler()
void rsp_device::static_generate_out_of_cycles()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -569,7 +569,7 @@ void rsp_device::static_generate_memory_accessor(int size, int iswrite, const ch
/* on entry, address is in I0; data for writes is in I1 */
/* on exit, read result is in I0 */
/* routine trashes I0-I1 */
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
diff --git a/src/devices/cpu/sh2/sh2.cpp b/src/devices/cpu/sh2/sh2.cpp
index 7cd45505c9b..71b960ac341 100644
--- a/src/devices/cpu/sh2/sh2.cpp
+++ b/src/devices/cpu/sh2/sh2.cpp
@@ -199,11 +199,6 @@ sh2_device::sh2_device(const machine_config &mconfig, const char *tag, device_t
void sh2_device::device_stop()
{
- /* clean up the DRC */
- if ( m_drcuml )
- {
- auto_free(machine(), m_drcuml);
- }
}
@@ -2536,7 +2531,7 @@ void sh2_device::device_start()
/* initialize the UML generator */
UINT32 flags = 0;
- m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 1, 32, 1));
+ m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, flags, 1, 32, 1);
/* add symbols for our stuff */
m_drcuml->symbol_add(&m_sh2_state->pc, sizeof(m_sh2_state->pc), "pc");
@@ -2555,7 +2550,7 @@ void sh2_device::device_start()
m_drcuml->symbol_add(&m_sh2_state->mach, sizeof(m_sh2_state->macl), "mach");
/* initialize the front-end helper */
- m_drcfe = auto_alloc(machine(), sh2_frontend(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE));
+ m_drcfe = std::make_unique<sh2_frontend>(this, COMPILE_BACKWARDS_BYTES, COMPILE_FORWARDS_BYTES, SINGLE_INSTRUCTION_MODE ? 1 : COMPILE_MAX_SEQUENCE);
/* compute the register parameters */
for (int regnum = 0; regnum < 16; regnum++)
diff --git a/src/devices/cpu/sh2/sh2.h b/src/devices/cpu/sh2/sh2.h
index 6a32072ada5..da6c928b939 100644
--- a/src/devices/cpu/sh2/sh2.h
+++ b/src/devices/cpu/sh2/sh2.h
@@ -219,8 +219,8 @@ private:
sh2_ftcsr_read_delegate m_ftcsr_read_cb;
drc_cache m_cache; /* pointer to the DRC code cache */
- drcuml_state * m_drcuml; /* DRC UML generator state */
- sh2_frontend * m_drcfe; /* pointer to the DRC front-end state */
+ std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */
+ std::unique_ptr<sh2_frontend> m_drcfe; /* pointer to the DRC front-end state */
UINT32 m_drcoptions; /* configurable DRC options */
internal_sh2_state *m_sh2_state;
diff --git a/src/devices/cpu/sh2/sh2drc.cpp b/src/devices/cpu/sh2/sh2drc.cpp
index 6f112eb0db5..db732e57b40 100644
--- a/src/devices/cpu/sh2/sh2drc.cpp
+++ b/src/devices/cpu/sh2/sh2drc.cpp
@@ -586,7 +586,7 @@ void sh2_device::func_SUBV() {}
void sh2_device::code_flush_cache()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
/* empty the transient cache contents */
drcuml->reset();
@@ -617,7 +617,7 @@ void sh2_device::code_flush_cache()
/* Execute cycles - returns number of cycles actually run */
void sh2_device::execute_run_drc()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
int execute_result;
// run any active DMAs now
@@ -665,7 +665,7 @@ void sh2_device::execute_run_drc()
void sh2_device::code_compile_block(UINT8 mode, offs_t pc)
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
compiler_state compiler = { 0 };
const opcode_desc *seqhead, *seqlast;
const opcode_desc *desclist;
@@ -781,7 +781,7 @@ void sh2_device::code_compile_block(UINT8 mode, offs_t pc)
void sh2_device::static_generate_entry_point()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
code_label skip = 1;
drcuml_block *block;
@@ -861,7 +861,7 @@ void sh2_device::static_generate_entry_point()
void sh2_device::static_generate_nocode_handler()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -886,7 +886,7 @@ void sh2_device::static_generate_nocode_handler()
void sh2_device::static_generate_out_of_cycles()
{
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
/* begin generating */
@@ -912,7 +912,7 @@ void sh2_device::static_generate_memory_accessor(int size, int iswrite, const ch
/* on entry, address is in I0; data for writes is in I1 */
/* on exit, read result is in I0 */
/* routine trashes I0 */
- drcuml_state *drcuml = m_drcuml;
+ drcuml_state *drcuml = m_drcuml.get();
drcuml_block *block;
int label = 1;
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index 81b657af7d4..28c4a37f4f3 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -399,7 +399,7 @@ void ymf271_device::update_lfo(YMF271Slot *slot)
slot->lfo_phase += slot->lfo_step;
slot->lfo_amplitude = m_lut_alfo[slot->lfowave][(slot->lfo_phase >> LFO_SHIFT) & (LFO_LENGTH-1)];
- slot->lfo_phasemod = m_lut_plfo[slot->lfowave][slot->pms][(slot->lfo_phase >> LFO_SHIFT) & (LFO_LENGTH-1)];
+ slot->lfo_phasemod = m_lut_plfo[slot->lfowave][slot->pms].get()[(slot->lfo_phase >> LFO_SHIFT) & (LFO_LENGTH-1)];
calculate_step(slot);
}
@@ -1508,7 +1508,7 @@ void ymf271_device::init_tables()
m_lut_waves[i] = std::make_unique<INT16[]>(SIN_LEN);
for (i = 0; i < 4*8; i++)
- m_lut_plfo[i>>3][i&7] = auto_alloc_array(machine(), double, LFO_LENGTH);
+ m_lut_plfo[i>>3][i&7] = std::make_unique<double[]>(LFO_LENGTH);
for (i = 0; i < 4; i++)
m_lut_alfo[i] = std::make_unique<int[]>(LFO_LENGTH);
@@ -1568,14 +1568,14 @@ void ymf271_device::init_tables()
for (j = 0; j < 4; j++)
{
- m_lut_plfo[j][0][i] = pow(2.0, 0.0);
- m_lut_plfo[j][1][i] = pow(2.0, (3.378 * plfo[j]) / 1200.0);
- m_lut_plfo[j][2][i] = pow(2.0, (5.0646 * plfo[j]) / 1200.0);
- m_lut_plfo[j][3][i] = pow(2.0, (6.7495 * plfo[j]) / 1200.0);
- m_lut_plfo[j][4][i] = pow(2.0, (10.1143 * plfo[j]) / 1200.0);
- m_lut_plfo[j][5][i] = pow(2.0, (20.1699 * plfo[j]) / 1200.0);
- m_lut_plfo[j][6][i] = pow(2.0, (40.1076 * plfo[j]) / 1200.0);
- m_lut_plfo[j][7][i] = pow(2.0, (79.307 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][0].get()[i] = pow(2.0, 0.0);
+ m_lut_plfo[j][1].get()[i] = pow(2.0, (3.378 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][2].get()[i] = pow(2.0, (5.0646 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][3].get()[i] = pow(2.0, (6.7495 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][4].get()[i] = pow(2.0, (10.1143 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][5].get()[i] = pow(2.0, (20.1699 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][6].get()[i] = pow(2.0, (40.1076 * plfo[j]) / 1200.0);
+ m_lut_plfo[j][7].get()[i] = pow(2.0, (79.307 * plfo[j]) / 1200.0);
}
// LFO amplitude modulation
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index d37c4895c5c..b4fbcead1af 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -122,7 +122,7 @@ private:
// lookup tables
std::unique_ptr<INT16[]> m_lut_waves[8];
- double *m_lut_plfo[4][8];
+ std::unique_ptr<double[]> m_lut_plfo[4][8];
std::unique_ptr<int[]> m_lut_alfo[4];
double m_lut_ar[64];
double m_lut_dc[64];
diff --git a/src/devices/video/stvvdp1.cpp b/src/devices/video/stvvdp1.cpp
index 09ca2e81662..a98dc8fe709 100644
--- a/src/devices/video/stvvdp1.cpp
+++ b/src/devices/video/stvvdp1.cpp
@@ -2125,7 +2125,7 @@ int saturn_state::stv_vdp1_start ( void )
m_vdp1_vram = make_unique_clear<UINT32[]>(0x100000/4 );
m_vdp1.gfx_decode = std::make_unique<UINT8[]>(0x100000 );
- stv_vdp1_shading_data = auto_alloc(machine(), struct stv_vdp1_poly_scanline_data);
+ stv_vdp1_shading_data = std::make_unique<struct stv_vdp1_poly_scanline_data>();
m_vdp1.framebuffer[0] = std::make_unique<UINT16[]>(1024 * 256 * 2 ); /* *2 is for double interlace */
m_vdp1.framebuffer[1] = std::make_unique<UINT16[]>(1024 * 256 * 2 );