aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Cpu/Jit/JitMemoryAllocator.cs
blob: 06c11b7b9733be9bcf9e66dbdc44dc4b3255d496 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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);
    }
}