summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/cpu/vtlb.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2014-02-19 17:45:48 +0000
committer Aaron Giles <aaron@aarongiles.com>2014-02-19 17:45:48 +0000
commitdf5a4f15f848cbcb971fb4f6c611d6656fea401e (patch)
tree0cbb0e29830ec41d8528ab9d329b3e3c3104b96f /src/emu/cpu/vtlb.c
parentc33da39e3d5045e978cbec906a3fd38c67de95fc (diff)
Removed some auto_mallocs in favor of dynamic_arrays.
Added option to clear dynamic_arrays; on gcc this should assert if not done on POD (which is unsafe to memset).
Diffstat (limited to 'src/emu/cpu/vtlb.c')
-rw-r--r--src/emu/cpu/vtlb.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/emu/cpu/vtlb.c b/src/emu/cpu/vtlb.c
index 7afc1de91ec..151d0b054ae 100644
--- a/src/emu/cpu/vtlb.c
+++ b/src/emu/cpu/vtlb.c
@@ -35,10 +35,9 @@ struct vtlb_state
int dynindex; /* index of next dynamic entry */
int pageshift; /* bits to shift to get page index */
int addrwidth; /* logical address bus width */
- offs_t * live; /* array of live entries by table index */
- int * fixedpages; /* number of pages each fixed entry covers */
- vtlb_entry * table; /* table of entries by address */
- vtlb_entry * save; /* cache of live table entries for saving */
+ dynamic_array<offs_t> live; /* array of live entries by table index */
+ dynamic_array<int> fixedpages; /* number of pages each fixed entry covers */
+ dynamic_array<vtlb_entry> table; /* table of entries by address */
};
@@ -74,18 +73,18 @@ vtlb_state *vtlb_alloc(device_t *cpu, address_spacenum space, int fixed_entries,
assert(vtlb->addrwidth > vtlb->pageshift);
/* allocate the entry array */
- vtlb->live = auto_alloc_array_clear(cpu->machine(), offs_t, fixed_entries + dynamic_entries);
- cpu->save_pointer(NAME(vtlb->live), fixed_entries + dynamic_entries, space);
+ vtlb->live.resize_and_clear(fixed_entries + dynamic_entries);
+ cpu->save_item(NAME(vtlb->live));
/* allocate the lookup table */
- vtlb->table = auto_alloc_array_clear(cpu->machine(), vtlb_entry, (size_t) 1 << (vtlb->addrwidth - vtlb->pageshift));
- cpu->save_pointer(NAME(vtlb->table), 1 << (vtlb->addrwidth - vtlb->pageshift), space);
+ vtlb->table.resize_and_clear((size_t) 1 << (vtlb->addrwidth - vtlb->pageshift));
+ cpu->save_item(NAME(vtlb->table));
/* allocate the fixed page count array */
if (fixed_entries > 0)
{
- vtlb->fixedpages = auto_alloc_array_clear(cpu->machine(), int, fixed_entries);
- cpu->save_pointer(NAME(vtlb->fixedpages), fixed_entries, space);
+ vtlb->fixedpages.resize_and_clear(fixed_entries);
+ cpu->save_item(NAME(vtlb->fixedpages));
}
return vtlb;
}