wasm-validator error #632
Copy link
Copy link
Closed
Labels
Description
Hi,
I'm trying to port WASA to refcounted assemblyscript.
Unfortunately, asc doesn't seem to produce a valid module:
[wasm-validator error in function $assembly/wasa/IO.readString] unexpected false: local.set index must be small enough, on
[i32] (local.tee $13
[i32] (call $~lib/rt/pure/__retain
[i32] (call $~lib/rt/__allocArray
[i32] (i32.const 0)
[i32] (i32.const 0)
[i32] (i32.const 4)
[i32] (i32.const 424)
)
)
)
[wasm-validator error in function $assembly/wasa/IO.readString] 1080060731 != 1: local.set type must match function, on
[i32] (local.tee $13
[i32] (call $~lib/rt/pure/__retain
[i32] (call $~lib/rt/__allocArray
[i32] (i32.const 0)
[i32] (i32.const 0)
[i32] (i32.const 4)
[i32] (i32.const 424)
)
)
)
The code is in the dev branch of WASA.
There is something in IO.readString() that it doesn't like, but I couldn't figure out what.
Reactions are currently unavailable
Activity
Fix invalid flow switch when inlining optional arguments into a call,…
dcodeIO commentedon Jun 5, 2019
Thanks, fix in the commit linked above :)
dcodeIO commentedon Jun 5, 2019
Btw, when looking at the code in question
looks like it will result in a double release. Since the result of the constructor isn't immediately assigned, but goes through a changetype first, the compiler will add an autorelease local that releases the instantiation at the end of the function automatically.
dcodeIO commentedon Jun 5, 2019
Added a few additional notes on managing lifetimes to the new docs. Let me know if that's missing something that should be covered :)
dcodeIO commentedon Jun 6, 2019
Btw, the
@startdecorator has been replaced with an--explicitStartcompiler option meanwhile. If specified, the WASM start entry point is skipped and a function named__startexported instead. Iirc you guys have been interested in this change :)