ConstStrDesc.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _CONSTSTRDESC_H
  6. #define _CONSTSTRDESC_H
  7. #include "bh_platform.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. typedef struct ConstStrDescription {
  12. const char * str;
  13. bool is_sys_symbol:1;
  14. uint32 len:31;
  15. uint32 hash;
  16. struct ConstStrDescription * next;
  17. } ConstStrDescription;
  18. //#define CONST_STR_HASHMAP_KEY_HEAD_LEN (sizeof(void * ) + 2 * sizeof(uint32))
  19. #define DEF_CONST_STRING(name, string) WAMR_CSP_##name,
  20. #define DEF_CONST_STRING2(name) WAMR_CSP_##name,
  21. enum WAMR_CONST_STRING_IDENT {
  22. #include "wasm_symbols.h"
  23. WAMR_CSP_SYMBOLS_end,
  24. };
  25. #undef DEF_CONST_STRING2
  26. #undef DEF_CONST_STRING
  27. #define DEF_CONST_STRING(name, string) string "\0"
  28. #define DEF_CONST_STRING2(name) #name "\0"
  29. static const char wasm_init_symbols[] = {
  30. #include "wasm_symbols.h"
  31. };
  32. #undef DEF_CONST_STRING2
  33. #undef DEF_CONST_STRING
  34. #define CONST_STR_POOL_DESC(runtime, id) (&runtime->global_const_str_index_array[id])
  35. #define CONST_STR_POOL_STR(runtime, id) (runtime->global_const_str_index_array[id].str)
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif