Skip to content

Commit

Permalink
add temporary wasm buffer to instance
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Jan 19, 2025
1 parent 05b3f76 commit f175b37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sources/include/cage-core/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ namespace cage
{
public:
WasmFunction() = default;
//WasmFunction(WasmFunction &&) = default;
//WasmFunction &operator=(WasmFunction &&) = default;

explicit WasmFunction(Holder<privat::WasmFunctionInternal> &&func_) : func(std::move(func_))
{
Expand Down Expand Up @@ -305,6 +303,8 @@ namespace cage
return WasmFunction<T>(function_(name));
}

WasmBuffer temporary; // use for passing data in function calls

private:
Holder<privat::WasmFunctionInternal> function_(const WasmName &name);
};
Expand Down
3 changes: 2 additions & 1 deletion sources/libcore/wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ namespace cage
if (!instance)
{
err.rawLength() = std::strlen(err.rawData());
CAGE_LOG_CONTINUE(SeverityEnum::Note, "wasm", err);
CAGE_LOG_THROW(err);
CAGE_THROW_ERROR(Exception, "failed instantiating wasm module");
}
exec = wasm_runtime_get_exec_env_singleton(instance);
Expand All @@ -204,6 +204,7 @@ namespace cage

~WasmInstanceImpl()
{
temporary = {};
if (instance)
{
wasm_runtime_deinstantiate(instance);
Expand Down

0 comments on commit f175b37

Please sign in to comment.