Browse Source

Expose WAMR_BUILD_GC_HEAP_SIZE_DEFAULT as a CMake option

This is wired through to the GC_HEAP_SIZE_DEFAULT constant.

Also honor this value when configuring the engine with the
wasm_c_api.
Jesse Wilson 10 months ago
parent
commit
beb34c3675
2 changed files with 5 additions and 0 deletions
  1. 1 0
      core/iwasm/common/wasm_c_api.c
  2. 4 0
      core/shared/mem-alloc/mem_alloc.cmake

+ 1 - 0
core/iwasm/common/wasm_c_api.c

@@ -393,6 +393,7 @@ wasm_engine_new_internal(wasm_config_t *config)
     WASM_C_DUMP_PROC_MEM();
     WASM_C_DUMP_PROC_MEM();
 
 
     /* wasm_config_t->MemAllocOption -> RuntimeInitArgs->MemAllocOption */
     /* wasm_config_t->MemAllocOption -> RuntimeInitArgs->MemAllocOption */
+    init_args.gc_heap_size = GC_HEAP_SIZE_DEFAULT;
     init_args.mem_alloc_type = config->mem_alloc_type;
     init_args.mem_alloc_type = config->mem_alloc_type;
     memcpy(&init_args.mem_alloc_option, &config->mem_alloc_option,
     memcpy(&init_args.mem_alloc_option, &config->mem_alloc_option,
            sizeof(MemAllocOption));
            sizeof(MemAllocOption));

+ 4 - 0
core/shared/mem-alloc/mem_alloc.cmake

@@ -24,6 +24,10 @@ if (WAMR_BUILD_GC_CORRUPTION_CHECK EQUAL 0)
     add_definitions (-DBH_ENABLE_GC_CORRUPTION_CHECK=0)
     add_definitions (-DBH_ENABLE_GC_CORRUPTION_CHECK=0)
 endif ()
 endif ()
 
 
+if (DEFINED WAMR_BUILD_GC_HEAP_SIZE_DEFAULT)
+    add_definitions ("-DGC_HEAP_SIZE_DEFAULT=${WAMR_BUILD_GC_HEAP_SIZE_DEFAULT}")
+endif ()
+
 file (GLOB_RECURSE source_all
 file (GLOB_RECURSE source_all
       ${MEM_ALLOC_DIR}/ems/*.c
       ${MEM_ALLOC_DIR}/ems/*.c
       ${MEM_ALLOC_DIR}/tlsf/*.c
       ${MEM_ALLOC_DIR}/tlsf/*.c