From 2887a363f118a40d9175fcd0cc11892c6ebf5ef0 Mon Sep 17 00:00:00 2001 From: Fabian Date: Sat, 15 Oct 2022 16:43:43 -0500 Subject: [PATCH] Properly clean up generated wasm functions if they are written while being compiled --- src/cpu.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cpu.js b/src/cpu.js index 6bf9abb9..b7fe8ffd 100644 --- a/src/cpu.js +++ b/src/cpu.js @@ -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) {