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);
  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();
  25. };
  26. } // Namespace Wasm