CodeGenAllocators.h 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. template<typename TAlloc, typename TPreReservedAlloc>
  7. class CodeGenAllocators
  8. {
  9. // emitBufferManager depends on allocator which in turn depends on pageAllocator, make sure the sequence is right
  10. private:
  11. PageAllocator pageAllocator;
  12. NoRecoverMemoryArenaAllocator allocator;
  13. public:
  14. EmitBufferManager<TAlloc, TPreReservedAlloc, CriticalSection> emitBufferManager;
  15. #if !TARGET_64 && _CONTROL_FLOW_GUARD
  16. bool canCreatePreReservedSegment;
  17. #endif
  18. CodeGenAllocators(AllocationPolicyManager * policyManager, Js::ScriptContext * scriptContext, ThreadContextInfo * threadContext, CustomHeap::CodePageAllocators<TAlloc, TPreReservedAlloc> * codePageAllocators, HANDLE processHandle);
  19. ~CodeGenAllocators();
  20. #if DBG
  21. void ClearConcurrentThreadId();
  22. #endif
  23. };
  24. typedef CodeGenAllocators<VirtualAllocWrapper, PreReservedVirtualAllocWrapper> InProcCodeGenAllocators;
  25. #if ENABLE_OOP_NATIVE_CODEGEN
  26. typedef CodeGenAllocators<SectionAllocWrapper, PreReservedSectionAllocWrapper> OOPCodeGenAllocators;
  27. #endif