mirror of
https://github.com/holub/mame
synced 2025-10-05 16:50:57 +03:00
More memory timebombs removed. (nw)
This commit is contained in:
parent
d200744fbf
commit
9102271ef7
@ -148,9 +148,6 @@ NETLIB_RESET(logic_input)
|
||||
|
||||
NETLIB_STOP(logic_input)
|
||||
{
|
||||
if (m_logic_family != nullptr)
|
||||
if (!m_logic_family->m_is_static)
|
||||
pfree(m_logic_family);
|
||||
}
|
||||
|
||||
|
||||
|
@ -321,8 +321,6 @@ public:
|
||||
|
||||
virtual ~netlist_base_factory_truthtable_t()
|
||||
{
|
||||
if (!m_family->m_is_static)
|
||||
pfree(m_family);
|
||||
}
|
||||
|
||||
pstring_vector_t m_desc;
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
m_high_V = 4.0;
|
||||
m_R_low = 1.0;
|
||||
m_R_high = 130.0;
|
||||
m_is_static = true;
|
||||
}
|
||||
virtual powned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_t &anetlist, const pstring &name, logic_output_t *proxied) const override
|
||||
{
|
||||
@ -57,7 +56,6 @@ public:
|
||||
m_high_V = 4.95;
|
||||
m_R_low = 10.0;
|
||||
m_R_high = 10.0;
|
||||
m_is_static = true;
|
||||
}
|
||||
virtual powned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_t &anetlist, const pstring &name, logic_output_t *proxied) const override
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ namespace netlist
|
||||
class logic_family_desc_t
|
||||
{
|
||||
public:
|
||||
logic_family_desc_t() : m_is_static(false) {}
|
||||
logic_family_desc_t() {}
|
||||
virtual ~logic_family_desc_t() {}
|
||||
virtual powned_ptr<devices::nld_base_d_to_a_proxy> create_d_a_proxy(netlist_t &anetlist, const pstring &name,
|
||||
logic_output_t *proxied) const = 0;
|
||||
@ -363,8 +363,6 @@ namespace netlist
|
||||
nl_double m_high_V;
|
||||
nl_double m_R_low;
|
||||
nl_double m_R_high;
|
||||
|
||||
bool m_is_static;
|
||||
};
|
||||
|
||||
class logic_family_t
|
||||
@ -1316,8 +1314,13 @@ namespace netlist
|
||||
void print_stats() const;
|
||||
|
||||
pvector_t<powned_ptr<device_t>> m_devices;
|
||||
|
||||
/* sole use is to manage lifetime of net objects */
|
||||
net_t::list_t m_nets;
|
||||
|
||||
/* sole use is to manage lifetime of family objects */
|
||||
std::vector<std::pair<pstring, std::unique_ptr<logic_family_desc_t>>> m_family_cache;
|
||||
|
||||
protected:
|
||||
|
||||
#if (NL_KEEP_STATISTICS)
|
||||
|
@ -886,7 +886,11 @@ const logic_family_desc_t *setup_t::family_from_model(const pstring &model)
|
||||
if (setup_t::model_value_str(map, "TYPE") == "CD4XXX")
|
||||
return family_CD4XXX();
|
||||
|
||||
logic_family_std_proxy_t *ret = palloc(logic_family_std_proxy_t);
|
||||
for (auto & e : netlist().m_family_cache)
|
||||
if (e.first == model)
|
||||
return e.second.get();
|
||||
|
||||
auto ret = make_unique_base<logic_family_desc_t, logic_family_std_proxy_t>();
|
||||
|
||||
ret->m_low_thresh_V = setup_t::model_value(map, "IVL");
|
||||
ret->m_high_thresh_V = setup_t::model_value(map, "IVH");
|
||||
@ -895,7 +899,13 @@ const logic_family_desc_t *setup_t::family_from_model(const pstring &model)
|
||||
ret->m_R_low = setup_t::model_value(map, "ORL");
|
||||
ret->m_R_high = setup_t::model_value(map, "ORH");
|
||||
|
||||
return ret;
|
||||
auto retp = ret.get();
|
||||
|
||||
printf("placing %s in cache\n", model.cstr());
|
||||
//netlist().m_family_cache.push_back(std::pair<pstring, std::unique_ptr<logic_family_desc_t>>(model, std::move(ret)));
|
||||
netlist().m_family_cache.emplace_back(model, std::move(ret));
|
||||
|
||||
return retp;
|
||||
}
|
||||
|
||||
static pstring model_string(model_map_t &map)
|
||||
|
@ -199,5 +199,12 @@ private:
|
||||
bool m_is_owned;
|
||||
};
|
||||
|
||||
template<typename _BC, typename _DC, typename... _Args>
|
||||
static std::unique_ptr<_BC> make_unique_base(_Args&&... __args)
|
||||
{
|
||||
std::unique_ptr<_BC> ret(new _DC(std::forward<_Args>(__args)...));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
#endif /* NL_UTIL_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user