Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions product-mini/platforms/windows/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ print_help()
printf(" --gc-heap-size=n Set maximum gc heap size in bytes,\n");
printf(" default is %u KB\n", GC_HEAP_SIZE_DEFAULT / 1024);
#endif
#if WASM_ENABLE_SHARED_HEAP != 0
printf(" --shared-heap-size=n Create shared heap of n bytes and attach to the wasm app.\n");
printf(" The size n will be adjusted to a minumum number aligned to page size\n");
#endif
#if WASM_ENABLE_JIT != 0
printf(" --llvm-jit-size-level=n Set LLVM JIT size level, default is 3\n");
printf(" --llvm-jit-opt-level=n Set LLVM JIT optimization level, default is 3\n");
Expand Down Expand Up @@ -364,6 +368,13 @@ main(int argc, char *argv[])
gc_heap_size = atoi(argv[0] + 15);
}
#endif
#if WASM_ENABLE_SHARED_HEAP != 0
else if (!strncmp(argv[0], "--shared-heap-size=", 19)) {
if (argv[0][19] == '\0')
return print_help();
shared_heap_size = atoi(argv[0] + 19);
}
#endif
#if WASM_ENABLE_JIT != 0
else if (!strncmp(argv[0], "--llvm-jit-size-level=", 22)) {
if (argv[0][22] == '\0')
Expand Down Expand Up @@ -551,6 +562,23 @@ main(int argc, char *argv[])
goto fail3;
}

#if WASM_ENABLE_SHARED_HEAP != 0
if (shared_heap_size > 0) {
memset(&shared_heap_init_args, 0, sizeof(shared_heap_init_args));
shared_heap_init_args.size = shared_heap_size;
shared_heap = wasm_runtime_create_shared_heap(&shared_heap_init_args);

if (!shared_heap) {
printf("Create shared heap failed.\n");
goto fail5;
}
if (!wasm_runtime_attach_shared_heap(wasm_module_inst, shared_heap)) {
printf("Attach shared heap failed.\n");
goto fail5;
}
}
#endif

#if WASM_ENABLE_DEBUG_INTERP != 0
if (ip_addr != NULL) {
wasm_exec_env_t exec_env =
Expand Down Expand Up @@ -598,6 +626,9 @@ main(int argc, char *argv[])
if (exception)
printf("%s\n", exception);

#if WASM_ENABLE_SHARED_HEAP != 0
fail5:
#endif
#if WASM_ENABLE_DEBUG_INTERP != 0
fail4:
#endif
Expand Down
Loading