JITOutput.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 IsMemOpDisabled() const;
  22. bool IsArrayCheckHoistDisabled() const;
  23. bool IsStackArgOptDisabled() const;
  24. bool IsSwitchOptDisabled() const;
  25. bool IsAggressiveIntTypeSpecDisabled() const;
  26. uint16 GetArgUsedForBranch() const;
  27. intptr_t GetCodeAddress() const;
  28. size_t GetCodeSize() const;
  29. ushort GetPdataCount() const;
  30. ushort GetXdataSize() const;
  31. void SetCodeAddress(intptr_t addr);
  32. EmitBufferAllocation<VirtualAllocWrapper, PreReservedVirtualAllocWrapper> * RecordInProcNativeCodeSize(Func *func, uint32 bytes, ushort pdataCount, ushort xdataSize);
  33. #if ENABLE_OOP_NATIVE_CODEGEN
  34. EmitBufferAllocation<SectionAllocWrapper, PreReservedSectionAllocWrapper> * RecordOOPNativeCodeSize(Func *func, uint32 bytes, ushort pdataCount, ushort xdataSize);
  35. #endif
  36. void RecordNativeCode(const BYTE* sourceBuffer, BYTE* localCodeAddress);
  37. void RecordInlineeFrameOffsetsInfo(unsigned int offsetsArrayOffset, unsigned int offsetsArrayCount);
  38. #if TARGET_64
  39. void RecordUnwindInfo(BYTE *unwindInfo, size_t size, BYTE * xdataAddr, BYTE* localXdataAddr);
  40. #elif _M_ARM
  41. size_t RecordUnwindInfo(size_t offset, const BYTE *unwindInfo, size_t size, BYTE * xdataAddr);
  42. #endif
  43. void FinalizeNativeCode();
  44. JITOutputIDL * GetOutputData();
  45. private:
  46. template <typename TEmitBufferAllocation, typename TCodeGenAllocators>
  47. void RecordNativeCode(const BYTE* sourceBuffer, BYTE* localCodeAddress, TEmitBufferAllocation allocation, TCodeGenAllocators codeGenAllocators);
  48. CustomHeap::Allocation * GetAllocation() const;
  49. union
  50. {
  51. EmitBufferAllocation<VirtualAllocWrapper, PreReservedVirtualAllocWrapper> * m_inProcAlloc;
  52. #if ENABLE_OOP_NATIVE_CODEGEN
  53. EmitBufferAllocation<SectionAllocWrapper, PreReservedSectionAllocWrapper> * m_oopAlloc;
  54. #endif
  55. };
  56. Func * m_func;
  57. JITOutputIDL * m_outputData;
  58. };