go-interpreter / wagon

wagon, a WebAssembly-based Go interpreter, for Go.
BSD 3-Clause "New" or "Revised" License
902 stars 150 forks source link

Test Suite Failing on Go1.12.7 windows/amd64 #165

Closed sampaioletti closed 5 years ago

sampaioletti commented 5 years ago

The current Master is failing on Windows (but wasm-run builds/runs fine). it completes in my WSL (go version go1.12.7 linux/amd64)

Haven't had a chance to look into it, looks like it is related to the AOT code

C:\Users\sampa\Desktop\wagon>go version
go version go1.12.7 windows/amd64

C:\Users\sampa\Desktop\wagon>go test ./...
ok      github.com/go-interpreter/wagon (cached)
ok      github.com/go-interpreter/wagon/cmd/wasm-dump   (cached)
ok      github.com/go-interpreter/wagon/cmd/wasm-run    (cached)
ok      github.com/go-interpreter/wagon/disasm  (cached)
Exception 0xc0000094 0x0 0x0 0x3a70051
PC=0x3a70051

runtime: unknown pc 0x3a70051
stack: frame={sp:0xc000df1720, fp:0x0} stack=[0xc000dee000,0xc000df2000)
000000c000df1620:  0000000000000001  0000000000030002
000000c000df1630:  0000000000c28b00  0000000000000002
000000c000df1640:  0000000000000002  0000000000000000
000000c000df1650:  000000c000df16f0  000000000040c0c3 <runtime.mallocgc+787>
000000c000df1660:  000000c0003a4040  0000002108421084
000000c000df1670:  0000000000000037  0000000000000008
000000c000df1680:  0000000000030000  0000000000002000
000000c000df1690:  0000000000000010  0000000000000010
000000c000df16a0:  000000c0003a4040  0000000000000008
000000c000df16b0:  000000000040c0c3 <runtime.mallocgc+787>  000000c000008e00
000000c000df16c0:  0000000002030003  0000000002030003
000000c000df16d0:  0000000000030003  0000000000000020
000000c000df16e0:  00000000007883d7  0000000000000068
000000c000df16f0:  000000c000df1758  0000000002030003
000000c000df1700:  0000000002030003  0000000000030003
000000c000df1710:  000000c000df17b0  000000000040c0c3 <runtime.mallocgc+787>
000000c000df1720: <00000000006295bc <github.com/go-interpreter/wagon/exec/internal/compile.(*asmBlock).Invoke+92>  000000c000006018
000000c000df1730:  000000c000176900  000000c000176918
000000c000df1740:  000000c000176978  000000c000176990
000000c000df1750:  0000000000000020  000000c000df17a0
000000c000df1760:  0000000000634b33 <github.com/go-interpreter/wagon/exec.(*VM).nativeCodeInvocation+131>  000000c000006018
000000c000df1770:  000000c000176900  000000c000176918
000000c000df1780:  000000c000176978  000000c000176990
000000c000df1790:  0000000000464c21 <sync.(*Pool).Put+113>  000000000000000c
000000c000df17a0:  000000c000df1908  000000000063e103 <github.com/go-interpreter/wagon/exec.(*VM).execCode+499>
000000c000df17b0:  000000c000176900  0000000000000000
000000c000df17c0:  000000000040c0c3 <runtime.mallocgc+787>  000000c000df1810
000000c000df17d0:  000000000041432e <runtime.(*mspan).nextFreeIndex+302>  00000000013f5a00
000000c000df17e0:  0000000000000010  0000000000000200
000000c000df17f0:  0000000000000080  000000000000007f
000000c000df1800:  000000c000df1838  000000000040bbc4 <runtime.(*mcache).nextFree+84>
000000c000df1810:  00000000013f5a00  000000000000007f
runtime: unknown pc 0x3a70051
stack: frame={sp:0xc000df1720, fp:0x0} stack=[0xc000dee000,0xc000df2000)
000000c000df1620:  0000000000000001  0000000000030002
000000c000df1630:  0000000000c28b00  0000000000000002
000000c000df1640:  0000000000000002  0000000000000000
000000c000df1650:  000000c000df16f0  000000000040c0c3 <runtime.mallocgc+787>
000000c000df1660:  000000c0003a4040  0000002108421084
000000c000df1670:  0000000000000037  0000000000000008
000000c000df1680:  0000000000030000  0000000000002000
000000c000df1690:  0000000000000010  0000000000000010
000000c000df16a0:  000000c0003a4040  0000000000000008
000000c000df16b0:  000000000040c0c3 <runtime.mallocgc+787>  000000c000008e00
000000c000df16c0:  0000000002030003  0000000002030003
000000c000df16d0:  0000000000030003  0000000000000020
000000c000df16e0:  00000000007883d7  0000000000000068
000000c000df16f0:  000000c000df1758  0000000002030003
000000c000df1700:  0000000002030003  0000000000030003
000000c000df1710:  000000c000df17b0  000000000040c0c3 <runtime.mallocgc+787>
000000c000df1720: <00000000006295bc <github.com/go-interpreter/wagon/exec/internal/compile.(*asmBlock).Invoke+92>  000000c000006018
000000c000df1730:  000000c000176900  000000c000176918
000000c000df1740:  000000c000176978  000000c000176990
000000c000df1750:  0000000000000020  000000c000df17a0
000000c000df1760:  0000000000634b33 <github.com/go-interpreter/wagon/exec.(*VM).nativeCodeInvocation+131>  000000c000006018
000000c000df1770:  000000c000176900  000000c000176918
000000c000df1780:  000000c000176978  000000c000176990
000000c000df1790:  0000000000464c21 <sync.(*Pool).Put+113>  000000000000000c
000000c000df17a0:  000000c000df1908  000000000063e103 <github.com/go-interpreter/wagon/exec.(*VM).execCode+499>
000000c000df17b0:  000000c000176900  0000000000000000
000000c000df17c0:  000000000040c0c3 <runtime.mallocgc+787>  000000c000df1810
000000c000df17d0:  000000000041432e <runtime.(*mspan).nextFreeIndex+302>  00000000013f5a00
000000c000df17e0:  0000000000000010  0000000000000200
000000c000df17f0:  0000000000000080  000000000000007f
000000c000df1800:  000000c000df1838  000000000040bbc4 <runtime.(*mcache).nextFree+84>
000000c000df1810:  00000000013f5a00  000000000000007f
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0001b6900, 0x7292db, 0x8, 0x73c988, 0x483101)
        c:/go/src/testing/testing.go:917 +0x388
testing.runTests.func1(0xc0000d2100)
        c:/go/src/testing/testing.go:1157 +0x7f
testing.tRunner(0xc0000d2100, 0xc000089e30)
        c:/go/src/testing/testing.go:865 +0xc7
testing.runTests(0xc000058940, 0x990d80, 0x13, 0x13, 0x0)
        c:/go/src/testing/testing.go:1155 +0x2b0
testing.(*M).Run(0xc0000ca100, 0x0)
        c:/go/src/testing/testing.go:1072 +0x169
main.main()
        _testmain.go:100 +0x145

goroutine 100 [chan receive]:
testing.tRunner.func1(0xc0001b6900)
        c:/go/src/testing/testing.go:841 +0x20a
testing.tRunner(0xc0001b6900, 0x73c988)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 89 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b6b00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b6b00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b6b00, 0xc0002e2980)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 90 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b6c00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0001b6c00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0001b6c00, 0xc0002e29c0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 91 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b6d00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b6d00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b6d00, 0xc0002e2a00)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 92 [chan send]:
testing.tRunner.func1(0xc0001b6e00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0001b6e00, 0xc0002e2a40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 93 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b6f00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b6f00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b6f00, 0xc0002e2ac0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 94 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7000)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0001b7000)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0001b7000, 0xc0002e2b00)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 95 [chan send]:
testing.tRunner.func1(0xc0001b7100)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0001b7100, 0xc0002e2b40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 96 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 97 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 146 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 147 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7500)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b7500)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b7500, 0xc0002e2cc0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 148 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7600)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0001b7600)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0001b7600, 0xc0002e2d40)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 149 [chan send]:
testing.tRunner.func1(0xc0001b7700)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0001b7700, 0xc0002e2dc0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 150 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7800)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0001b7800)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0001b7800, 0xc0002e2e40)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 151 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7900)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b7900)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b7900, 0xc0002e2ec0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 152 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7a00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0001b7a00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0001b7a00, 0xc0002e2f40)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 153 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7c00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b7c00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b7c00, 0xc0002e2fc0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 154 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7d00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0001b7d00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0001b7d00, 0xc0002e3040)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 155 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0001b7e00)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0001b7e00)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0001b7e00, 0xc0002e30c0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 156 [chan send]:
testing.tRunner.func1(0xc0001b7f00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0001b7f00, 0xc0002e3140)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 157 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0000d2200)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0000d2200)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0000d2200, 0xc0002e31c0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 158 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0000d2300)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0000d2300)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0000d2300, 0xc0002e3240)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 159 [chan send]:
testing.tRunner.func1(0xc0000d2400)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d2400, 0xc0002e32c0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 160 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0000d2500)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func1(0xc0000d2500)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:383 +0x66
testing.tRunner(0xc0000d2500, 0xc0002e3340)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 161 [chan receive]:
testing.(*testContext).waitParallel(0xc0000af740)
        c:/go/src/testing/testing.go:964 +0x9c
testing.(*T).Parallel(0xc0000d2600)
        c:/go/src/testing/testing.go:771 +0x1f8
github.com/go-interpreter/wagon/exec_test.testModules.func2(0xc0000d2600)
        C:/Users/sampa/Desktop/wagon/exec/exec_test.go:391 +0x66
testing.tRunner(0xc0000d2600, 0xc0002e33c0)
        c:/go/src/testing/testing.go:865 +0xc7
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 162 [chan send]:
testing.tRunner.func1(0xc0000d2700)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d2700, 0xc0002e3440)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 164 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 165 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 166 [chan send]:
testing.tRunner.func1(0xc0000d2b00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d2b00, 0xc0002e3640)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 167 [chan send]:
testing.tRunner.func1(0xc0000d2c00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d2c00, 0xc0002e36c0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 168 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 169 [running]:
        goroutine running on other thread; stack unavailable
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 170 [chan send]:
testing.tRunner.func1(0xc0000d2f00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d2f00, 0xc0002e3840)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 171 [chan send]:
testing.tRunner.func1(0xc0000d3000)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d3000, 0xc0002e38c0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 172 [chan send]:
testing.tRunner.func1(0xc0000d3100)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d3100, 0xc0002e3940)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 173 [chan send]:
testing.tRunner.func1(0xc0000d3e00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000d3e00, 0xc0002e39c0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 174 [chan send]:
testing.tRunner.func1(0xc000160500)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc000160500, 0xc0002e3a40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 175 [chan send]:
testing.tRunner.func1(0xc0000c2000)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2000, 0xc0002e3ac0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 176 [chan send]:
testing.tRunner.func1(0xc0000c2100)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2100, 0xc0002e3b40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 177 [chan send]:
testing.tRunner.func1(0xc0000c2200)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2200, 0xc0002e3bc0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 178 [chan send]:
testing.tRunner.func1(0xc0000c2300)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2300, 0xc0002e3c40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 179 [chan send]:
testing.tRunner.func1(0xc0000c2400)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2400, 0xc0002e3cc0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 180 [chan send]:
testing.tRunner.func1(0xc0000c2500)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2500, 0xc0002e3d40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 181 [chan send]:
testing.tRunner.func1(0xc0000c2600)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2600, 0xc0002e3dc0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 182 [chan send]:
testing.tRunner.func1(0xc0000c2700)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2700, 0xc0002e3e40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 183 [chan send]:
testing.tRunner.func1(0xc0000c2800)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2800, 0xc0002e3ec0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 184 [chan send]:
testing.tRunner.func1(0xc0000c2900)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2900, 0xc0002e3f40)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 185 [chan send]:
testing.tRunner.func1(0xc0000c2a00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2a00, 0xc0002e3fc0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 186 [chan send]:
testing.tRunner.func1(0xc0000c2b00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2b00, 0xc000266100)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 187 [chan send]:
testing.tRunner.func1(0xc0000c2c00)
        c:/go/src/testing/testing.go:860 +0x28a
testing.tRunner(0xc0000c2c00, 0xc0002661c0)
        c:/go/src/testing/testing.go:869 +0xd1
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361
rax     0x1
rbx     0x1
rcx     0xc00027d080
rdi     0xc000d660c0
rsi     0xc000176990
rbp     0xc000df1758
rsp     0xc000df1720
r8      0x0
r9      0x0
r10     0xc000176900
r11     0xc000176918
r12     0xc00005db00
r13     0x0
r14     0xc00005db00
r15     0xc000f487f0
rip     0x3a70051
rflags  0x10246
cs      0x33
fs      0x53
gs      0x2b
FAIL    github.com/go-interpreter/wagon/exec    2.192s
ok      github.com/go-interpreter/wagon/exec/internal/compile   (cached)
?       github.com/go-interpreter/wagon/internal/stack  [no test files]
?       github.com/go-interpreter/wagon/validate        [no test files]
--- FAIL: TestEncode (0.07s)
    --- FAIL: TestEncode/rust-basic.wasm (0.02s)
        encode_test.go:55: modules are different
FAIL
FAIL    github.com/go-interpreter/wagon/wasm    0.542s
ok      github.com/go-interpreter/wagon/wasm/internal/readpos   (cached)
ok      github.com/go-interpreter/wagon/wasm/leb128     (cached)
ok      github.com/go-interpreter/wagon/wasm/operators  (cached)
ok      github.com/go-interpreter/wagon/wast    (cached)

C:\Users\sampa\Desktop\wagon>
twitchyliquid64 commented 5 years ago

Can you run the exec/internal/compile tests with '--parallel 1' and post the output?

sampaioletti commented 5 years ago

Sorry should have done some more debugging for you before posting.

exec/internal/compile passes without modification.

The error occurs in the test exec/exec_test.go TestSpec

it produces the errors when running two tests. see blacklist

func testModules(t *testing.T, dir string, repeat bool) {
[...]
        t.Run(fileName+" native", func(t *testing.T) {
            // t.Parallel()
            if runtime.GOARCH != "amd64" || !supportedOS(runtime.GOOS) {
                t.SkipNow()
            }
            blacklist := []string{"traps_int_div.wasm", "traps_int_rem.wasm"}
            if strings.Contains(strings.Join(blacklist, ","), file.FileName) {
                t.SkipNow()
            }
            fmt.Println(fileName)
            path, err := filepath.Abs(fileName)
            if err != nil {
                t.Fatal(err)
            }
            runTest(path, testCases, t, true, repeat)
        })

I'll try and look into it some more in a few...

sampaioletti commented 5 years ago

and this is the console output for just one of those files

C:\Users\sampa\Desktop\wagon\exec>go test -p 1 -run TestSpec
testdata\spec\traps_int_div.wasm
Exception 0xc0000094 0x0 0x0 0x1260051
PC=0x1260051

runtime: unknown pc 0x1260051
stack: frame={sp:0xc0002ab6e8, fp:0x0} stack=[0xc0002a8000,0xc0002ac000)
000000c0002ab5e8:  0000000000000001  0000000000030000 
000000c0002ab5f8:  0000000001132800  0000000000000002 
000000c0002ab608:  0000000000000002  0000000000000000 
000000c0002ab618:  000000c0002ab6b8  000000000040c0c3 <runtime.mallocgc+787> 
000000c0002ab628:  000000c0000544a0  0000002108421084
000000c0002ab638:  0000000000000037  0000000000000008 
000000c0002ab648:  0000000000030000  0004210842108421 
000000c0002ab658:  0000000000000010  0000000000000010 
000000c0002ab668:  000000c0000544a0  0000000000000008 
000000c0002ab678:  0010842108421084  000000c00004c700
000000c0002ab688:  0000000002030000  0000000002030000
000000c0002ab698:  0000000000030000  0000000000000020
000000c0002ab6a8:  0000000000788557  0000000000000068 
000000c0002ab6b8:  000000c0002ab720  0000000002030000
000000c0002ab6c8:  0000000002030000  0000000000030000 
000000c0002ab6d8:  000000c0002ab778  000000000040c0c3 <runtime.mallocgc+787>
000000c0002ab6e8: <00000000006295bc <github.com/go-interpreter/wagon/exec/internal/compile.(*asmBlock).Invoke+92>  000000c00008e360
000000c0002ab6f8:  000000c0003d4900  000000c0003d4918 
000000c0002ab708:  000000c0003d4978  000000c0003d4990
000000c0002ab718:  0000000000000020  000000c0002ab768
000000c0002ab728:  0000000000634b33 <github.com/go-interpreter/wagon/exec.(*VM).nativeCodeInvocation+131>  000000c00008e360 
000000c0002ab738:  000000c0003d4900  000000c0003d4918
000000c0002ab748:  000000c0003d4978  000000c0003d4990
000000c0002ab758:  0000000000464c21 <sync.(*Pool).Put+113>  000000000000000c
000000c0002ab768:  000000c0002ab8d0  000000000063e103 <github.com/go-interpreter/wagon/exec.(*VM).execCode+499> 
000000c0002ab778:  000000c0003d4900  0000000000000000 
000000c0002ab788:  000000000040c0c3 <runtime.mallocgc+787>  000000c0002ab7d8
000000c0002ab798:  0000000000464dd2 <sync.(*Pool).Get+114>  000000c000008400
000000c0002ab7a8:  000000000050f212 <regexp.(*inputString).index+114>  000000c0002ab7d8 
000000c0002ab7b8:  00000000005088be <regexp.freeBitState+110>  00000000009bf550
000000c0002ab7c8:  0000000000000000  0000000000000000 
000000c0002ab7d8:  000000c0002ab870  0000000000509db1 <regexp.(*Regexp).backtrack+1041>
runtime: unknown pc 0x1260051
stack: frame={sp:0xc0002ab6e8, fp:0x0} stack=[0xc0002a8000,0xc0002ac000)
000000c0002ab5e8:  0000000000000001  0000000000030000
000000c0002ab5f8:  0000000001132800  0000000000000002
000000c0002ab608:  0000000000000002  0000000000000000
000000c0002ab618:  000000c0002ab6b8  000000000040c0c3 <runtime.mallocgc+787>
000000c0002ab628:  000000c0000544a0  0000002108421084
000000c0002ab638:  0000000000000037  0000000000000008 
000000c0002ab648:  0000000000030000  0004210842108421 
000000c0002ab658:  0000000000000010  0000000000000010
000000c0002ab668:  000000c0000544a0  0000000000000008
000000c0002ab678:  0010842108421084  000000c00004c700
000000c0002ab688:  0000000002030000  0000000002030000 
000000c0002ab698:  0000000000030000  0000000000000020
000000c0002ab6a8:  0000000000788557  0000000000000068
000000c0002ab6b8:  000000c0002ab720  0000000002030000
000000c0002ab6c8:  0000000002030000  0000000000030000
000000c0002ab6d8:  000000c0002ab778  000000000040c0c3 <runtime.mallocgc+787> 
000000c0002ab6e8: <00000000006295bc <github.com/go-interpreter/wagon/exec/internal/compile.(*asmBlock).Invoke+92>  000000c00008e360
000000c0002ab6f8:  000000c0003d4900  000000c0003d4918
000000c0002ab708:  000000c0003d4978  000000c0003d4990
000000c0002ab718:  0000000000000020  000000c0002ab768
000000c0002ab728:  0000000000634b33 <github.com/go-interpreter/wagon/exec.(*VM).nativeCodeInvocation+131>  000000c00008e360 
000000c0002ab738:  000000c0003d4900  000000c0003d4918
000000c0002ab748:  000000c0003d4978  000000c0003d4990
000000c0002ab758:  0000000000464c21 <sync.(*Pool).Put+113>  000000000000000c
000000c0002ab768:  000000c0002ab8d0  000000000063e103 <github.com/go-interpreter/wagon/exec.(*VM).execCode+499>
000000c0002ab778:  000000c0003d4900  0000000000000000 
000000c0002ab788:  000000000040c0c3 <runtime.mallocgc+787>  000000c0002ab7d8 
000000c0002ab798:  0000000000464dd2 <sync.(*Pool).Get+114>  000000c000008400
000000c0002ab7a8:  000000000050f212 <regexp.(*inputString).index+114>  000000c0002ab7d8
000000c0002ab7b8:  00000000005088be <regexp.freeBitState+110>  00000000009bf550
000000c0002ab7c8:  0000000000000000  0000000000000000 
000000c0002ab7d8:  000000c0002ab870  0000000000509db1 <regexp.(*Regexp).backtrack+1041>
created by testing.(*T).Run
        c:/go/src/testing/testing.go:916 +0x361

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0000d0200, 0x72941b, 0x8, 0x73cae8, 0x483101)
        c:/go/src/testing/testing.go:917 +0x388
testing.runTests.func1(0xc0000d0100)
        c:/go/src/testing/testing.go:1157 +0x7f
testing.tRunner(0xc0000d0100, 0xc00008be30)
        c:/go/src/testing/testing.go:865 +0xc7
testing.runTests(0xc00005a9a0, 0x990d80, 0x13, 0x13, 0x0)
        c:/go/src/testing/testing.go:1155 +0x2b0
testing.(*M).Run(0xc0000c8100, 0x0)
        c:/go/src/testing/testing.go:1072 +0x169
main.main()
r12     0xc00000a3e0
r13     0x0
r14     0xc00000a3e0
r15     0xc000060050
rip     0x1260051
rflags  0x10246
cs      0x33
fs      0x53
gs      0x2b
exit status 2
FAIL    github.com/go-interpreter/wagon/exec    2.207s

C:\Users\sampa\Desktop\wagon\exec>
twitchyliquid64 commented 5 years ago

Exception 0xc0000094 is a divide by zero exception. Not sure why its not a problem on Linux (does linux handle these differently?)

My guess is we need to generate code to test the divisor for equality with zero, and bail if its the case.

sampaioletti commented 5 years ago

I'm not sure, I'll dig around some more...if I turn off AOT for the test it works fine...so its something in the generated assembly...not my forte but I will try and at least narrow it down for you

twitchyliquid64 commented 5 years ago

Yeah I think thats it ... looks like Go generates a zero check for division by zero: https://github.com/golang/go/blob/98aa97806b94495847f7f7151d4453f5830f0d38/src/cmd/compile/internal/gc/ssa.go#L3620

We should too. I'll implement.

sampaioletti commented 5 years ago

ok awesome..let me know when you have it ready and I can test it if you don't have access to a windows machine

twitchyliquid64 commented 5 years ago

Can you try out https://github.com/go-interpreter/wagon/pull/167 ?

sampaioletti commented 5 years ago

Yes that fixed the original issue! now i'm having the following

C:\Users\sampa\Desktop\wagon>go version
go version go1.12.7 windows/amd64

C:\Users\sampa\Desktop\wagon>go test ./...
ok      github.com/go-interpreter/wagon (cached)
ok      github.com/go-interpreter/wagon/cmd/wasm-dump   (cached)
ok      github.com/go-interpreter/wagon/cmd/wasm-run    (cached)
ok      github.com/go-interpreter/wagon/disasm  (cached)
ok      github.com/go-interpreter/wagon/exec    (cached)
ok      github.com/go-interpreter/wagon/exec/internal/compile   (cached)
?       github.com/go-interpreter/wagon/internal/stack  [no test files]
ok      github.com/go-interpreter/wagon/validate        (cached)
--- FAIL: TestEncode (0.07s)
    --- FAIL: TestEncode/rust-basic.wasm (0.02s)
        encode_test.go:55: modules are different
FAIL
FAIL    github.com/go-interpreter/wagon/wasm    0.669s
ok      github.com/go-interpreter/wagon/wasm/internal/readpos   (cached)
ok      github.com/go-interpreter/wagon/wasm/leb128     (cached)
ok      github.com/go-interpreter/wagon/wasm/operators  (cached)
ok      github.com/go-interpreter/wagon/wast    (cached)

I'm running short of time at the moment so I cant dig into it, I will look into it when I get back and see what the cause is and file a separate issue accordingly, or add to this if its related.

sampaioletti commented 5 years ago

Appears to just be an ordering issue with how the exports are written in the wasm

image