Properly clean up generated wasm functions if they are written while being compiled

This commit is contained in:
Fabian 2022-10-15 16:43:43 -05:00
parent d0ca758177
commit 2887a363f1

View file

@ -1296,9 +1296,8 @@ CPU.prototype.codegen_finalize = function(wasm_table_index, start, state_flags,
const result = new WebAssembly.Instance(module, { "e": this.jit_imports });
const f = result.exports["f"];
this.codegen_finalize_finished(wasm_table_index, start, state_flags);
this.wm.wasm_table.set(wasm_table_index + WASM_TABLE_OFFSET, f);
this.codegen_finalize_finished(wasm_table_index, start, state_flags);
if(this.test_hook_did_finalize_wasm)
{
@ -1311,9 +1310,8 @@ CPU.prototype.codegen_finalize = function(wasm_table_index, start, state_flags,
const result = WebAssembly.instantiate(code, { "e": this.jit_imports }).then(result => {
const f = result.instance.exports["f"];
this.codegen_finalize_finished(wasm_table_index, start, state_flags);
this.wm.wasm_table.set(wasm_table_index + WASM_TABLE_OFFSET, f);
this.codegen_finalize_finished(wasm_table_index, start, state_flags);
if(this.test_hook_did_finalize_wasm)
{