aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
diff options
context:
space:
mode:
authorjhorv <38920027+jhorv@users.noreply.github.com>2024-04-21 06:57:35 -0400
committerGitHub <noreply@github.com>2024-04-21 12:57:35 +0200
commit216026c096d844f8bf09ee0e185dec4111c64095 (patch)
tree222eb5476aacb79f9d67abd799ee1657c2d63e7c /src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
parent7070cf6ae502b5c11551fceb164bc9f158ba980b (diff)
Use pooled memory and avoid memory copies (#6691)
* perf: use ByteMemoryPool * feat: KPageTableBase/KPageTable new methods to read and write `ReadOnlySequence<byte>` * new: add IWritableBlock.Write(ulong, ReadOnlySequence<byte>) with default impl * perf: use GetReadOnlySequence() instead of GetSpan() * perf: make `Parcel` IDisposable, use `ByteMemoryPool` for internal allocation, and make Parcel consumers dispose of it * remove comment about copySize * remove unnecessary Clear()
Diffstat (limited to 'src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs')
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
index d262c159..4ffa447d 100644
--- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
+++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
@@ -2,6 +2,7 @@ using Ryujinx.Horizon.Common;
using Ryujinx.Memory;
using Ryujinx.Memory.Range;
using System;
+using System.Buffers;
using System.Collections.Generic;
using System.Diagnostics;
@@ -35,6 +36,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
}
/// <inheritdoc/>
+ protected override ReadOnlySequence<byte> GetReadOnlySequence(ulong va, int size)
+ {
+ return _cpuMemory.GetReadOnlySequence(va, size);
+ }
+
+ /// <inheritdoc/>
protected override ReadOnlySpan<byte> GetSpan(ulong va, int size)
{
return _cpuMemory.GetSpan(va, size);
@@ -248,6 +255,12 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
}
/// <inheritdoc/>
+ protected override void Write(ulong va, ReadOnlySequence<byte> data)
+ {
+ _cpuMemory.Write(va, data);
+ }
+
+ /// <inheritdoc/>
protected override void Write(ulong va, ReadOnlySpan<byte> data)
{
_cpuMemory.Write(va, data);