JITOutput.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 _M_X64
  38. void RecordUnwindInfo(BYTE *unwindInfo, size_t size, BYTE * xdataAddr, BYTE* localXdataAddr);
  39. #elif _M_ARM
  40. size_t RecordUnwindInfo(size_t offset, 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. union
  48. {
  49. EmitBufferAllocation<VirtualAllocWrapper, PreReservedVirtualAllocWrapper> * m_inProcAlloc;
  50. #if ENABLE_OOP_NATIVE_CODEGEN
  51. EmitBufferAllocation<SectionAllocWrapper, PreReservedSectionAllocWrapper> * m_oopAlloc;
  52. #endif
  53. };
  54. Func * m_func;
  55. JITOutputIDL * m_outputData;
  56. };