jit_utils.h 626 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (C) 2021 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _JIT_UTILS_H_
  6. #define _JIT_UTILS_H_
  7. #include "bh_platform.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. static inline void *
  12. jit_malloc(unsigned int size)
  13. {
  14. return wasm_runtime_malloc(size);
  15. }
  16. static inline void *
  17. jit_calloc(unsigned int size)
  18. {
  19. void *ret = wasm_runtime_malloc(size);
  20. if (ret) {
  21. memset(ret, 0, size);
  22. }
  23. return ret;
  24. }
  25. static inline void
  26. jit_free(void *ptr)
  27. {
  28. if (ptr)
  29. wasm_runtime_free(ptr);
  30. }
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif