2023-12-04 14:17:13 +01:00
|
|
|
using ARMeilleure.Memory;
|
2020-05-03 19:54:50 -03:00
|
|
|
using Ryujinx.Memory;
|
|
|
|
|
2022-05-31 16:29:35 -03:00
|
|
|
namespace Ryujinx.Cpu.Jit
|
2020-05-03 19:54:50 -03:00
|
|
|
{
|
2022-05-31 16:29:35 -03:00
|
|
|
public class JitMemoryAllocator : IJitMemoryAllocator
|
2020-05-03 19:54:50 -03:00
|
|
|
{
|
2024-01-20 11:11:28 -03:00
|
|
|
private readonly MemoryAllocationFlags _jitFlag;
|
|
|
|
|
|
|
|
public JitMemoryAllocator(bool forJit = false)
|
|
|
|
{
|
|
|
|
_jitFlag = forJit ? MemoryAllocationFlags.Jit : MemoryAllocationFlags.None;
|
|
|
|
}
|
|
|
|
|
2020-05-03 19:54:50 -03:00
|
|
|
public IJitMemoryBlock Allocate(ulong size) => new JitMemoryBlock(size, MemoryAllocationFlags.None);
|
2024-01-20 11:11:28 -03:00
|
|
|
public IJitMemoryBlock Reserve(ulong size) => new JitMemoryBlock(size, MemoryAllocationFlags.Reserve | _jitFlag);
|
2020-05-03 19:54:50 -03:00
|
|
|
}
|
|
|
|
}
|