Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

validate: could not validate a simple program #36

Open
sbinet opened this issue Nov 28, 2017 · 9 comments
Open

validate: could not validate a simple program #36

sbinet opened this issue Nov 28, 2017 · 9 comments

Comments

@sbinet
Copy link
Contributor

sbinet commented Nov 28, 2017

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?

@vibhavp
Copy link
Collaborator

vibhavp commented Nov 28, 2017

Could you give me the .wasm file produced by the compiler?

@sbinet
Copy link
Contributor Author

sbinet commented Nov 28, 2017

it's there: https://cern.ch/binet/wasm/a.wasm

@vibhavp
Copy link
Collaborator

vibhavp commented Nov 29, 2017

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.

@sbinet
Copy link
Contributor Author

sbinet commented Dec 5, 2017

perhaps needs #40

@sbinet
Copy link
Contributor Author

sbinet commented Apr 3, 2018

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 :)

@vibhavp
Copy link
Collaborator

vibhavp commented Apr 3, 2018 via email

@sbinet
Copy link
Contributor Author

sbinet commented Jun 8, 2018

ping @vibhavp ? :)

@hunjixin
Copy link

I have the same problem.

@cdetrio
Copy link
Contributor

cdetrio commented Feb 20, 2019

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 #104.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants