mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-07-01 11:25:21 +02:00
[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:
parent
5ebb5b8772
commit
4063ce09e2
1 changed files with 10 additions and 9 deletions
|
|
@ -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 {
|
||||||
|
|
@ -619,7 +620,7 @@ template <typename Traits>
|
||||||
void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta) {
|
void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size, s32 delta) {
|
||||||
Common::ScopedRangeLock lk(counter_guard, addr, size);
|
Common::ScopedRangeLock lk(counter_guard, addr, size);
|
||||||
UpdatePagesCachedCountNoLock(addr, size, delta);
|
UpdatePagesCachedCountNoLock(addr, size, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Traits>
|
template <typename Traits>
|
||||||
void DeviceMemoryManager<Traits>::UpdatePagesCachedBatch(std::span<const std::pair<DAddr, size_t>> ranges, s32 delta) {
|
void DeviceMemoryManager<Traits>::UpdatePagesCachedBatch(std::span<const std::pair<DAddr, size_t>> ranges, s32 delta) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue