1
0
forked from MeloNX/MeloNX
MeloNX/src/Ryujinx.Cpu/Jit/JitMemoryAllocator.cs

21 lines
668 B
C#

using ARMeilleure.Memory;
using Ryujinx.Memory;
namespace Ryujinx.Cpu.Jit
{
public class JitMemoryAllocator : IJitMemoryAllocator
{
private readonly MemoryAllocationFlags _jitFlag;
public JitMemoryAllocator(bool forJit = false)
{
_jitFlag = forJit ? MemoryAllocationFlags.Jit : MemoryAllocationFlags.None;
}
public IJitMemoryBlock Allocate(ulong size) => new JitMemoryBlock(size, MemoryAllocationFlags.None);
public IJitMemoryBlock Reserve(ulong size) => new JitMemoryBlock(size, MemoryAllocationFlags.Reserve | _jitFlag);
public ulong GetPageSize() => MemoryBlock.GetPageSize();
}
}