Revert "Grow table from within WebAssembly"

It doesn't work in Node 16 (used by GitHub actions)

This reverts commit 2747458242.
This commit is contained in:
Remko Tronçon 2022-05-23 20:08:47 +02:00
parent 2747458242
commit c013b2493d
2 changed files with 6 additions and 6 deletions

View file

@ -2201,12 +2201,9 @@
(global.set $cp (i32.add (global.get $cp) (local.get $nameLength)))))
;; Load the code
(if (i32.ge_u (global.get $nextTableIndex) (table.size 0))
(then (drop (table.grow 0 (ref.func $!) (table.size 0))))) ;; Double size
(call $shell_load
(i32.const 0x1000 (; = MODULE_HEADER_BASE ;))
(i32.sub (global.get $cp) (i32.const 0x1000 (; = MODULE_HEADER_BASE ;)))
(global.get $nextTableIndex))
(call $shell_load (i32.const 0x1000 (; = MODULE_HEADER_BASE ;))
(i32.sub (global.get $cp) (i32.const 0x1000 (; = MODULE_HEADER_BASE ;)))
(global.get $nextTableIndex))
(global.set $nextTableIndex (i32.add (global.get $nextTableIndex) (i32.const 1))))

View file

@ -147,6 +147,9 @@ class WAForth {
}
data = new Uint8Array(dataCopy);
}
if (index >= table.length) {
table.grow(table.length); // Double size
}
// console.log("Load", index, arrayToBase64(data));
try {
var module = new WebAssembly.Module(data);