JITOutput.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. class JITOutput
  7. {
  8. public:
  9. JITOutput(JITOutputIDL * outputData);
  10. void SetHasJITStackClosure();
  11. void SetVarSlotsOffset(int32 offset);
  12. void SetVarChangedOffset(int32 offset);
  13. void SetHasBailoutInstr(bool val);
  14. void SetArgUsedForBranch(uint8 param);
  15. void SetFrameHeight(uint val);
  16. void RecordThrowMap(Js::ThrowMapEntry * throwMap, uint mapCount);
  17. #ifdef _M_ARM
  18. void RecordXData(BYTE * xdata);
  19. #endif
  20. bool IsTrackCompoundedIntOverflowDisabled() const;
  21. bool IsArrayCheckHoistDisabled() const;
  22. bool IsStackArgOptDisabled() const;
  23. bool IsSwitchOptDisabled() const;
  24. bool IsAggressiveIntTypeSpecDisabled() const;
  25. uint16 GetArgUsedForBranch() const;
  26. intptr_t GetCodeAddress() const;
  27. size_t GetCodeSize() const;
  28. ushort GetPdataCount() const;
  29. ushort GetXdataSize() const;
  30. void SetCodeAddress(intptr_t addr);
  31. EmitBufferAllocation<VirtualAllocWrapper, PreReservedVirtualAllocWrapper> * RecordInProcNativeCodeSize(Func *func, uint32 bytes, ushort pdataCount, ushort xdataSize);
  32. #if ENABLE_OOP_NATIVE_CODEGEN
  33. EmitBufferAllocation<SectionAllocWrapper, PreReservedSectionAllocWrapper> * RecordOOPNativeCodeSize(Func *func, uint32 bytes, ushort pdataCount, ushort xdataSize);
  34. #endif
  35. void RecordNativeCode(const BYTE* sourceBuffer, BYTE* localCodeAddress);
  36. void RecordInlineeFrameOffsetsInfo(unsigned int offsetsArrayOffset, unsigned int offsetsArrayCount);
  37. #if TARGET_64
  38. void RecordUnwindInfo(BYTE *unwindInfo, size_t size, BYTE * xdataAddr, BYTE* localXdataAddr);
  39. #elif _M_ARM
  40. size_t RecordUnwindInfo(size_t offset, const BYTE *unwindInfo, size_t size, BYTE * xdataAddr);
  41. #endif
  42. void FinalizeNativeCode();
  43. JITOutputIDL * GetOutputData();
  44. private:
  45. template <typename TEmitBufferAllocation, typename TCodeGenAllocators>
  46. void RecordNativeCode(const BYTE* sourceBuffer, BYTE* localCodeAddress, TEmitBufferAllocation allocation, TCodeGenAllocators codeGenAllocators);
  47. CustomHeap::Allocation * GetAllocation() const;
  48. union
  49. {
  50. EmitBufferAllocation<VirtualAllocWrapper, PreReservedVirtualAllocWrapper> * m_inProcAlloc;
  51. #if ENABLE_OOP_NATIVE_CODEGEN
  52. EmitBufferAllocation<SectionAllocWrapper, PreReservedSectionAllocWrapper> * m_oopAlloc;
  53. #endif
  54. };
  55. Func * m_func;
  56. JITOutputIDL * m_outputData;
  57. };