memory64_common.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef UNIT_TEST_MEMORY64_COMMON_H
  6. #define UNIT_TEST_MEMORY64_COMMON_H
  7. #include "test_helper.h"
  8. #include "gtest/gtest.h"
  9. #include "platform_common.h"
  10. #include "wasm_runtime_common.h"
  11. #include "bh_read_file.h"
  12. #include "wasm_runtime.h"
  13. #include "bh_platform.h"
  14. #include "wasm_export.h"
  15. #include <unordered_map>
  16. // #include "aot_runtime.h"
  17. namespace {
  18. std::vector<RunningMode> running_mode_supported = { Mode_Interp,
  19. #if WASM_ENABLE_FAST_JIT != 0
  20. Mode_Fast_JIT,
  21. #endif
  22. #if WASM_ENABLE_JIT != 0
  23. Mode_LLVM_JIT,
  24. #endif
  25. #if WASM_ENABLE_JIT != 0 && WASM_ENABLE_FAST_JIT != 0 \
  26. && WASM_ENABLE_LAZY_JIT != 0
  27. Mode_Multi_Tier_JIT
  28. #endif
  29. };
  30. static inline uint64
  31. GET_U64_FROM_ADDR(uint32 *addr)
  32. {
  33. union {
  34. uint64 val;
  35. uint32 parts[2];
  36. } u;
  37. u.parts[0] = addr[0];
  38. u.parts[1] = addr[1];
  39. return u.val;
  40. }
  41. static inline void
  42. PUT_U64_TO_ADDR(uint32 *addr, uint64 value)
  43. {
  44. uint32 *addr_u32 = (uint32 *)(addr);
  45. union {
  46. float64 val;
  47. uint32 parts[2];
  48. } u;
  49. u.val = (value);
  50. addr_u32[0] = u.parts[0];
  51. addr_u32[1] = u.parts[1];
  52. }
  53. }
  54. #endif // UNIT_TEST_MEMORY64_COMMON_H