wagon
wagon copied to clipboard
validate: could not validate a simple program
trying to validate a simple program:
package main
func main() {
println("hello")
println("1+3=", myadd(1, 3))
}
func myadd(i, j int) int {
return i + j
}
compiled with GOOS=js GOARCH=wasm
and the gc compiler from neelance go-wasm-wip, I get:
$> wasm-run -verify-module ./a.wasm
wasm-run: could not verify module: error while validating function 686 at offset 64: invalid type, got: i32, wanted: i64
running WebAssembly.validate
(from my chromium browser) did not raise anything.
@vibhavp any idea?
Could you give me the .wasm
file produced by the compiler?
it's there: https://cern.ch/binet/wasm/a.wasm
From the wasm Go fork, I observed that node uses this file to define some runtime functions: https://github.com/neelance/go/blob/wasm-wip/misc/wasm/wasm_exec.js
With wagon, they aren't getting defined, which is what might be causing the issue. I'll take a look at this anyway.
perhaps needs go-interpreter/wagon#40
ping @vibhavp ?
Robert's work (bringing GOARCH=wasm
to the official gc toolchain) is starting to percolate.
it would be great to have this working for Go-1.11.x :)
Sorry for forgetting about this. I took another stab at my PR today, and
was able to narrow it down to the value of NewStack.StackTopDiff
somehow
changing while compiling Else blocks. I'll further investigate tomorrow,
and try coming up with a fix soon.
On Tue 3 Apr, 2018, 6:46 PM Sebastien Binet, [email protected] wrote:
ping @vibhavp https://github.com/vibhavp ?
Robert's work (bringing GOARCH=wasm to the official gc toolchain) is starting to percolate. it would be great to have this working for Go-1.11.x :)
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/go-interpreter/wagon/issues/36#issuecomment-378246218, or mute the thread https://github.com/notifications/unsubscribe-auth/ACCymKjkuXH-Mv7RhgYEoWLF1gM9Ym34ks5tk3Y-gaJpZM4Qtahj .
ping @vibhavp ? :)
I have the same problem.
I took another stab at my PR today, and was able to narrow it down to the value of
NewStack.StackTopDiff
somehow changing while compiling Else blocks.
I don't see any Else blocks in the a.wasm
file linked above, but if it is an issue around Else blocks then it might be related to https://github.com/go-interpreter/wagon/pull/104.