From 8a84f57dbc076a7c0ef589b8c5ced028e2942f5e Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Thu, 10 Aug 2023 07:29:51 -0700 Subject: [PATCH] specify wasm vm stack size (64KB) --- ext/bytebox/include/bytebox.h | 1 + src/main.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ext/bytebox/include/bytebox.h b/ext/bytebox/include/bytebox.h index b3e6309..dedf466 100644 --- a/ext/bytebox/include/bytebox.h +++ b/ext/bytebox/include/bytebox.h @@ -77,6 +77,7 @@ struct bb_module_instance_instantiate_opts bb_wasm_memory_free* free_callback; void* userdata; } wasm_memory_config; + size_t stack_size; bool enable_debug; }; typedef struct bb_module_instance_instantiate_opts bb_module_instance_instantiate_opts; diff --git a/src/main.c b/src/main.c index 6706276..8a6a95b 100644 --- a/src/main.c +++ b/src/main.c @@ -379,8 +379,6 @@ i32 orca_runloop(void* user) return quit_on_wasm_init_failure("wasm decode", wasm_init_err); } - // TODO [ReubenD] - allow specifying stack size - // u32 stackSize = 65536; // app->runtime.m3Env = m3_NewEnvironment(); @@ -428,12 +426,14 @@ i32 orca_runloop(void* user) bb_module_instance_instantiate_opts module_inst_instantiate_opts = { .packages = &module_imports, .num_packages = 1, + .stack_size = 1024 * 64, .enable_debug = false, .wasm_memory_config = { .resize_callback = wasm_memory_resize_callback, .free_callback = wasm_memory_free_callback, .userdata = &app->runtime.wasmMemory, }, + }; wasm_init_err = bb_module_instance_instantiate(app->runtime.bbModuleInst, module_inst_instantiate_opts);