specify wasm vm stack size (64KB)

This commit is contained in:
Reuben Dunnington 2023-08-10 07:29:51 -07:00
parent d5ab09366d
commit 8a84f57dbc
Signed by: rdunnington
GPG Key ID: 4EC5290E704FD482
2 changed files with 3 additions and 2 deletions

View File

@ -77,6 +77,7 @@ struct bb_module_instance_instantiate_opts
bb_wasm_memory_free* free_callback; bb_wasm_memory_free* free_callback;
void* userdata; void* userdata;
} wasm_memory_config; } wasm_memory_config;
size_t stack_size;
bool enable_debug; bool enable_debug;
}; };
typedef struct bb_module_instance_instantiate_opts bb_module_instance_instantiate_opts; typedef struct bb_module_instance_instantiate_opts bb_module_instance_instantiate_opts;

View File

@ -379,8 +379,6 @@ i32 orca_runloop(void* user)
return quit_on_wasm_init_failure("wasm decode", wasm_init_err); return quit_on_wasm_init_failure("wasm decode", wasm_init_err);
} }
// TODO [ReubenD] - allow specifying stack size
// u32 stackSize = 65536; // u32 stackSize = 65536;
// app->runtime.m3Env = m3_NewEnvironment(); // app->runtime.m3Env = m3_NewEnvironment();
@ -428,12 +426,14 @@ i32 orca_runloop(void* user)
bb_module_instance_instantiate_opts module_inst_instantiate_opts = { bb_module_instance_instantiate_opts module_inst_instantiate_opts = {
.packages = &module_imports, .packages = &module_imports,
.num_packages = 1, .num_packages = 1,
.stack_size = 1024 * 64,
.enable_debug = false, .enable_debug = false,
.wasm_memory_config = { .wasm_memory_config = {
.resize_callback = wasm_memory_resize_callback, .resize_callback = wasm_memory_resize_callback,
.free_callback = wasm_memory_free_callback, .free_callback = wasm_memory_free_callback,
.userdata = &app->runtime.wasmMemory, .userdata = &app->runtime.wasmMemory,
}, },
}; };
wasm_init_err = bb_module_instance_instantiate(app->runtime.bbModuleInst, module_inst_instantiate_opts); wasm_init_err = bb_module_instance_instantiate(app->runtime.bbModuleInst, module_inst_instantiate_opts);