[core/device_memory_manager] use more pointer/iterator stable std::vector<> instead of deque<> for multi address scatter/gather

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie 2026-06-15 08:40:37 +00:00
parent 5ebb5b8772
commit 4063ce09e2

View file

@ -33,20 +33,21 @@ public:
void GatherValues(u32 start_entry, Common::ScratchBuffer<u32>& buffer) { void GatherValues(u32 start_entry, Common::ScratchBuffer<u32>& buffer) {
buffer.resize(8); buffer.resize(8);
buffer.resize(0); const auto add_value = [&buffer](u32 value, size_t index) {
size_t index = 0; if (buffer.size() < index + 1)
const auto add_value = [&](u32 value) { buffer.resize(index + 1);
buffer.resize(index + 1);
buffer[index++] = value; buffer[index++] = value;
return index;
}; };
size_t index = 0;
u32 iter_entry = start_entry; u32 iter_entry = start_entry;
Entry* current = &storage[iter_entry - 1]; Entry* current = &storage[iter_entry - 1];
add_value(current->value); index = add_value(current->value, index);
while (current->next_entry != 0) { while (current->next_entry != 0) {
iter_entry = current->next_entry; iter_entry = current->next_entry;
current = &storage[iter_entry - 1]; current = &storage[iter_entry - 1];
add_value(current->value); index = add_value(current->value, index);
} }
} }
@ -124,8 +125,8 @@ private:
u32 value{}; u32 value{};
}; };
std::deque<Entry> storage; std::vector<Entry> storage;
std::deque<u32> free_entries; boost::container::deque<u32> free_entries;
}; };
struct EmptyAllocator { struct EmptyAllocator {