Removes WASM hack used for circumventing a wasmer 2.2.1 bug, as it's now resolved in 2.3.0
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2022-06-07 22:49:37 +02:00
parent 66fb9f5bd6
commit fd4eb77dc9
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 2 additions and 12 deletions

View File

@ -73,9 +73,7 @@ public:
~Env() {} ~Env() {}
}; };
auto env = (Env*)malloc(sizeof(Env)); auto env = new Env{.Resolver = resolver, .Func = func};
new (env) Env{.Resolver = resolver, .Func = func};
resolver->Temp_WasmerBug2_2_1_Bypass.Append(env);
auto* f = wasm_func_new_with_env( auto* f = wasm_func_new_with_env(
resolver->GetStore(), funcType, resolver->GetStore(), funcType,
[](void* env, const wasm_val_vec_t* parameters, wasm_val_vec_t* results) -> wasm_trap_t* { [](void* env, const wasm_val_vec_t* parameters, wasm_val_vec_t* results) -> wasm_trap_t* {
@ -97,7 +95,7 @@ public:
} }
return nullptr; return nullptr;
}, },
env, /*[](void*) { delete (Env*)env; }*/ nullptr); env, [](void* env) { delete (Env*)env; });
wasm_functype_delete(funcType); wasm_functype_delete(funcType);
return f; return f;
} }

View File

@ -17,9 +17,6 @@ WebAssemblyScriptResolver::~WebAssemblyScriptResolver() {
for (auto& import : _imports) { for (auto& import : _imports) {
wasm_func_delete(import.second); wasm_func_delete(import.second);
} }
for (auto e : Temp_WasmerBug2_2_1_Bypass) {
free(e);
}
if (_instance != nullptr) { if (_instance != nullptr) {
wasm_instance_delete(_instance); wasm_instance_delete(_instance);
} }

View File

@ -52,11 +52,6 @@ public:
inline void RemoveRegisteredScript(i32 wasmPtr) { _loadedScripts.Remove(wasmPtr); } inline void RemoveRegisteredScript(i32 wasmPtr) { _loadedScripts.Remove(wasmPtr); }
// HACK: This is a temporary way to bypass a bug in wasmer 2.2.1. As finalizers on wasm_func_new_with_env are called
// twice, the environment objects of WasmHelpers::CreateFunc are deleted twice. This causes major issues. This
// should be fixed in the next wasmer release.
ArbUt::List<void*> Temp_WasmerBug2_2_1_Bypass;
private: private:
wasm_engine_t* _engine; wasm_engine_t* _engine;
wasm_store_t* _store; wasm_store_t* _store;