mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
compiler: conform to latest iteration of wasm types proposal (#4501)
compiler: align with current wasm types proposal https://github.com/golang/go/issues/66984 - Remove int and uint as allowed types in params, results, pointers, or struct fields - Only allow small integers in pointers, arrays, or struct fields - enforce structs.HostLayout usage per wasm types proposal https://github.com/golang/go/issues/66984 - require go1.23 for structs.HostLayout - use an interface to check if GoVersion() exists This permits TinyGo to compile with Go 1.21. - use goenv.Compare instead of WantGoVersion - testdata/wasmexport: use int32 instead of int - compiler/testdata: add structs.HostLayout - compiler/testdata: improve tests for structs.HostLayout
This commit is contained in:
Vendored
+3
-3
@@ -18,16 +18,16 @@ func hello() {
|
||||
}
|
||||
|
||||
//go:wasmexport add
|
||||
func add(a, b int) int {
|
||||
func add(a, b int32) int32 {
|
||||
println("called add:", a, b)
|
||||
return a + b
|
||||
}
|
||||
|
||||
//go:wasmimport tester callOutside
|
||||
func callOutside(a, b int) int
|
||||
func callOutside(a, b int32) int32
|
||||
|
||||
//go:wasmexport reentrantCall
|
||||
func reentrantCall(a, b int) int {
|
||||
func reentrantCall(a, b int32) int32 {
|
||||
println("reentrantCall:", a, b)
|
||||
result := callOutside(a, b)
|
||||
println("reentrantCall result:", result)
|
||||
|
||||
Vendored
+5
-5
@@ -21,15 +21,15 @@ func hello() {
|
||||
}
|
||||
|
||||
//go:wasmexport add
|
||||
func add(a, b int) int {
|
||||
func add(a, b int32) int32 {
|
||||
println("called add:", a, b)
|
||||
addInputs <- a
|
||||
addInputs <- b
|
||||
return <-addOutput
|
||||
}
|
||||
|
||||
var addInputs = make(chan int)
|
||||
var addOutput = make(chan int)
|
||||
var addInputs = make(chan int32)
|
||||
var addOutput = make(chan int32)
|
||||
|
||||
func adder() {
|
||||
for {
|
||||
@@ -41,10 +41,10 @@ func adder() {
|
||||
}
|
||||
|
||||
//go:wasmimport tester callOutside
|
||||
func callOutside(a, b int) int
|
||||
func callOutside(a, b int32) int32
|
||||
|
||||
//go:wasmexport reentrantCall
|
||||
func reentrantCall(a, b int) int {
|
||||
func reentrantCall(a, b int32) int32 {
|
||||
println("reentrantCall:", a, b)
|
||||
result := callOutside(a, b)
|
||||
println("reentrantCall result:", result)
|
||||
|
||||
Reference in New Issue
Block a user