`--instantiation sync` seems broken
Closed this issue · 3 comments
whitequark commented
jco 1.0.0 generates this code for --instantiate sync
:
export function instantiate(getCoreModule, imports, instantiateCore = WebAssembly.Instance) {
This doesn't actually work:
file:///home/whitequark/Projects/yowasp/yosys/npmjs/gen/bundle.js:4429
({ exports: exports0 } = instantiateCore(module2));
^
TypeError: WebAssembly.Instance(): WebAssembly.Instance must be invoked with 'new'
at Application.instantiate (file:///home/whitequark/Projects/yowasp/yosys/npmjs/gen/bundle.js:4429:28)
at Application.run (file:///home/whitequark/Projects/yowasp/yosys/npmjs/gen/bundle.js:483:36)
It should be something like:
export function instantiate(getCoreModule, imports, instantiateCore = (module, imports) => new WebAssembly.Instance(module, imports)) {
guybedford commented
This was actually fixed in #364, release is coming soon.
whitequark commented
Thanks. Please let me know once the release is done (such as by closing this issue :) and I'll upgrade all of the YoWASP packages, since I'm currently blocked on the need for sync instantiation. (I have a case where Pyodide needs to call YoWASP Yosys from an existing sync function and it turns out that doing that asynchronously requires JSPI, which is basically unavailable yet...)
bakkot commented
Looks like this is working in the now-released 1.0.2 and can presumably be closed.