WasmElementSegment.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. 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. namespace Wasm
  7. {
  8. class WasmElementSegment
  9. {
  10. public:
  11. WasmElementSegment(ArenaAllocator * alloc, const UINT32 index, const WasmNode initExpr, const UINT32 numElem);
  12. void AddElement(const UINT32 funcIndex, const Js::WebAssemblyModule& module);
  13. UINT32 GetElement(const UINT32 tableIndex) const;
  14. UINT32 GetNumElements() const { return m_numElem; }
  15. WasmNode GetOffsetExpr() const { return m_offsetExpr; }
  16. private:
  17. ArenaAllocator* m_alloc;
  18. UINT32 m_index;
  19. const WasmNode m_offsetExpr;
  20. UINT32 m_numElem;
  21. UINT32 m_offset;
  22. UINT32 m_elemIdx;
  23. UINT32* m_elems;
  24. void Init(const Js::WebAssemblyModule& module);
  25. };
  26. } // Namespace Wasm