Clone data segments when specified with load args (#3463)

Follow-up on https://github.com/bytecodealliance/wasm-micro-runtime/pull/3389, specifically: https://github.com/bytecodealliance/wasm-micro-runtime/pull/3389#discussion_r1600872451

If we want to free the wasm binary buffer early, we need to clone the data segments into the module.
That's because, in case of [passive data segments](https://webassembly.github.io/threads/core/syntax/modules.html#syntax-data),
they can be referred during wasm execution.
This commit is contained in:
Enrico Loparco
2024-05-27 03:59:24 +02:00
committed by GitHub
parent f378edc408
commit 3b8ef89110
9 changed files with 81 additions and 60 deletions

View File

@ -3007,13 +3007,12 @@ wasm_module_get_name(wasm_module_t *module)
}
bool
wasm_module_is_underlying_binary_freeable(
const wasm_module_t *module, const struct wasm_instance_t *instance)
wasm_module_is_underlying_binary_freeable(const wasm_module_t *module)
{
if (((wasm_module_ex_t *)module)->is_binary_cloned)
return true;
return wasm_runtime_is_underlying_binary_freeable(instance->inst_comm_rt);
return wasm_runtime_is_underlying_binary_freeable(*module);
}
static wasm_func_t *