Skip to content

Commit 92852f3

Browse files
authored
Implement a first version of shared heap feature (#3789)
ps. #3546
1 parent 27b6917 commit 92852f3

File tree

15 files changed

+826
-22
lines changed

15 files changed

+826
-22
lines changed

build-scripts/config_common.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ if (WAMR_BUILD_SHARED_MEMORY EQUAL 1)
256256
else ()
257257
add_definitions (-DWASM_ENABLE_SHARED_MEMORY=0)
258258
endif ()
259+
if (WAMR_BUILD_SHARED_HEAP EQUAL 1)
260+
add_definitions (-DWASM_ENABLE_SHARED_HEAP=1)
261+
message (" Shared heap enabled")
262+
endif()
263+
259264
if (WAMR_BUILD_MEMORY64 EQUAL 1)
260265
# if native is 32-bit or cross-compiled to 32-bit
261266
if (NOT WAMR_BUILD_TARGET MATCHES ".*64.*")

build-scripts/runtime_lib.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1)
119119
set (WAMR_BUILD_SHARED_MEMORY 1)
120120
endif ()
121121

122+
if (WAMR_BUILD_SHARED_HEAP EQUAL 1)
123+
include (${IWASM_DIR}/libraries/shared-heap/shared_heap.cmake)
124+
endif ()
125+
122126
if (WAMR_BUILD_DEBUG_INTERP EQUAL 1)
123127
set (WAMR_BUILD_THREAD_MGR 1)
124128
include (${IWASM_DIR}/libraries/debug-engine/debug_engine.cmake)
@@ -193,6 +197,7 @@ set (source_all
193197
${LIBC_EMCC_SOURCE}
194198
${LIB_RATS_SOURCE}
195199
${DEBUG_ENGINE_SOURCE}
200+
${LIB_SHARED_HEAP_SOURCE}
196201
)
197202

198203
set (WAMR_RUNTIME_LIB_SOURCE ${source_all})

core/config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,4 +688,8 @@
688688
#endif
689689
#endif /* WASM_ENABLE_FUZZ_TEST != 0 */
690690

691+
#ifndef WASM_ENABLE_SHARED_HEAP
692+
#define WASM_ENABLE_SHARED_HEAP 0
693+
#endif
694+
691695
#endif /* end of _CONFIG_H_ */

core/iwasm/aot/aot_runtime.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ typedef struct AOTModuleInstanceExtra {
119119
bh_list *sub_module_inst_list;
120120
WASMModuleInstanceCommon **import_func_module_insts;
121121
#endif
122+
123+
#if WASM_ENABLE_SHARED_HEAP != 0
124+
WASMSharedHeap *shared_heap;
125+
#endif
122126
} AOTModuleInstanceExtra;
123127

124128
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)

0 commit comments

Comments
 (0)