wasm_loader_common.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2024 Amazon Inc. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _WASM_LOADER_COMMON_H
  6. #define _WASM_LOADER_COMMON_H
  7. #include "platform_common.h"
  8. #include "../interpreter/wasm.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #if WASM_ENABLE_MEMORY64 != 0
  13. /* check consistency of memory64 flags across all memories,
  14. * they must be either all wasm64 or all wasm32 */
  15. bool
  16. check_memory64_flags_consistency(WASMModule *module, char *error_buf,
  17. uint32 error_buf_size, bool is_aot);
  18. #endif
  19. bool
  20. wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
  21. uint32 error_buf_size, bool is_aot);
  22. bool
  23. wasm_table_check_flags(const uint8 table_flag, char *error_buf,
  24. uint32 error_buf_size, bool is_aot);
  25. bool
  26. is_valid_value_type(uint8 value_tpye);
  27. bool
  28. is_valid_value_type_for_interpreter(uint8 value_tpye);
  29. bool
  30. is_valid_func_type(const WASMFuncType *func_type);
  31. bool
  32. is_indices_overflow(uint32 import, uint32 other, char *error_buf,
  33. uint32 error_buf_size);
  34. bool
  35. read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign,
  36. uint64 *p_result, char *error_buf, uint32 error_buf_size);
  37. void
  38. wasm_loader_set_error_buf(char *error_buf, uint32 error_buf_size,
  39. const char *string, bool is_aot);
  40. #ifdef __cplusplus
  41. }
  42. #endif
  43. #endif /* end of _WASM_LOADER_COMMON_H */