Fix reading Time zone rules using Julian days (#17672)
[platform/upstream/coreclr.git] / src / jit / hostallocator.h
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5 #pragma once
6
7 class HostAllocator final
8 {
9 private:
10     static HostAllocator s_hostAllocator;
11
12     HostAllocator()
13     {
14     }
15
16 public:
17     void* Alloc(size_t size);
18
19     void* ArrayAlloc(size_t elemSize, size_t numElems);
20
21     void Free(void* p);
22
23     static HostAllocator* getHostAllocator();
24 };
25
26 // Global operator new overloads that work with HostAllocator
27
28 inline void* __cdecl operator new(size_t n, HostAllocator* alloc)
29 {
30     return alloc->Alloc(n);
31 }
32
33 inline void* __cdecl operator new[](size_t n, HostAllocator* alloc)
34 {
35     return alloc->Alloc(n);
36 }