handler_entry_write_units(handler_entry_write_units <int_Width, int_AddrShift> src) : base(src.m_space, F_UNITS) { m_subunits = src.m_subunits; for (u32 i = 0; i != src.m_subunits; i++) { m_subunit_infos[i] = src.m_subunit_infos[i]; m_subunit_infos[i].m_handler = ((handler_entry_write <int_Width, int_AddrShift>)m_subunit_infos[i].m_handler).dup(); //m_subunit_infos[i].m_handler = static_cast<handler_entry_write<Width, AddrShift> *>(m_subunit_infos[i].m_handler)->dup(); } }
void mismatched_patch(memory_units_descriptor <int_Width, int_AddrShift> descriptor, u8 rkey, std.vector <mapping> mappings, ref handler_entry_write <int_Width, int_AddrShift> target) { u8 ukey = descriptor.rkey_to_ukey(rkey); handler_entry_write <int_Width, int_AddrShift> original = target.is_units() ? target : null; handler_entry_write <int_Width, int_AddrShift> replacement = null; foreach (var p in mappings) { if (p.ukey == ukey && p.original == original) { replacement = p.patched; break; } } if (replacement == null) { if (original != null) { replacement = new handler_entry_write_units <int_Width, int_AddrShift>(descriptor, ukey, (handler_entry_write_units <int_Width, int_AddrShift>)original); } else { replacement = new handler_entry_write_units <int_Width, int_AddrShift>(descriptor, ukey, m_space); } mappings.emplace_back(new mapping() { original = original, patched = replacement, ukey = ukey }); } else { replacement.ref_(); } target.unref(); target = replacement; }
public handler_entry_write_units(memory_units_descriptor <int_Width, int_AddrShift> descriptor, u8 ukey, handler_entry_write_units <int_Width, int_AddrShift> src) : base(src.m_space, F_UNITS) { m_subunits = 0; uX fullmask = new uX(Width, 0); var entries = descriptor.get_entries_for_key(ukey); foreach (var e in entries) { fullmask |= e.m_dmask; } for (u32 i = 0; i != src.m_subunits; i++) { if ((src.m_subunit_infos[i].m_dmask & fullmask) == 0) { m_subunit_infos[m_subunits] = src.m_subunit_infos[i]; m_subunit_infos[m_subunits].m_handler.ref_(); m_subunits++; } } fill(descriptor, entries); Array.Sort(m_subunit_infos, 0, m_subunits, Comparer <subunit_info> .Create((a, b) => { return(a.m_offset < b.m_offset ? -1 : 1); })); //std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; }); }