wasm_loader_common.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. bool
  13. wasm_memory_check_flags(const uint8 mem_flag, char *error_buf,
  14. uint32 error_buf_size, bool is_aot);
  15. bool
  16. is_valid_value_type(uint8 value_tpye);
  17. bool
  18. is_valid_value_type_for_interpreter(uint8 value_tpye);
  19. bool
  20. is_valid_func_type(const WASMFuncType *func_type);
  21. bool
  22. is_indices_overflow(uint32 import, uint32 other, char *error_buf,
  23. uint32 error_buf_size);
  24. bool
  25. read_leb(uint8 **p_buf, const uint8 *buf_end, uint32 maxbits, bool sign,
  26. uint64 *p_result, char *error_buf, uint32 error_buf_size);
  27. void
  28. wasm_loader_set_error_buf(char *error_buf, uint32 error_buf_size,
  29. const char *string, bool is_aot);
  30. #ifdef __cplusplus
  31. }
  32. #endif
  33. #endif /* end of _WASM_LOADER_COMMON_H */