Merge pull request #3823 from bytecodealliance/dev/shared_heap

Implement the shared heap feature for interpreter, aot and llvm jit.
Add below runtime APIs:
```C
wasm_shared_heap_t
wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args);

bool
wasm_runtime_attach_shared_heap(wasm_module_inst_t module_inst,
                                wasm_shared_heap_t shared_heap);

void
wasm_runtime_detach_shared_heap(wasm_module_inst_t module_inst);

uint64_t
wasm_runtime_shared_heap_malloc(wasm_module_inst_t module_inst, uint64_t size,
                                void **p_native_addr);

void
wasm_runtime_shared_heap_free(wasm_module_inst_t module_inst, uint64_t ptr);
```

And allow wasm app to call API shared_heap_malloc and shared_heap_free:
```C
void *shared_heap_malloc(uint32_t size);
void shared_heap_free(void *ptr);
```
This commit is contained in:
Wenyong Huang
2024-10-15 14:26:22 +08:00
committed by GitHub
41 changed files with 2499 additions and 105 deletions

View File

@ -206,6 +206,7 @@ print_help()
printf(" --enable-linux-perf Enable linux perf support\n");
#endif
printf(" --mllvm=<option> Add the LLVM command line option\n");
printf(" --enable-shared-heap Enable shared heap feature\n");
printf(" -v=n Set log verbose level (0 to 5, default is 2), larger with more log\n");
printf(" --version Show version information\n");
printf("Examples: wamrc -o test.aot test.wasm\n");
@ -647,6 +648,9 @@ main(int argc, char *argv[])
llvm_options[llvm_options_count - 2] = "wamrc";
llvm_options[llvm_options_count - 1] = argv[0] + 8;
}
else if (!strcmp(argv[0], "--enable-shared-heap")) {
option.enable_shared_heap = true;
}
else if (!strcmp(argv[0], "--version")) {
uint32 major, minor, patch;
wasm_runtime_get_version(&major, &minor, &patch);