JITOutput.h 2.4 KB

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