1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:04:46 -07:00

go/build, go/types, cmd/dist: add js/wasm architecture

This is the first commit of a series that will add WebAssembly
as an architecture target. The design document can be found at
https://docs.google.com/document/d/131vjr4DH6JFnb-blm_uRdaC0_Nv3OUwjEY5qVCxCup4.

The GOARCH name "wasm" is the official abbreviation of WebAssembly.
The GOOS name "js" got chosen because initially the host environment
that executes WebAssembly bytecode will be web browsers and Node.js,
which both use JavaScript to embed WebAssembly. Other GOOS values
may be possible later, see:
https://github.com/WebAssembly/design/blob/master/NonWeb.md

Updates #18892

Change-Id: Ia25b4fa26bba8029c25923f48ad009fd3681933a
Reviewed-on: https://go-review.googlesource.com/102835
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Richard Musiol 2018-03-28 01:15:39 +02:00 committed by Brad Fitzpatrick
parent 4468b0bac1
commit 80e69220c8
38 changed files with 93 additions and 3 deletions

View File

@ -1380,6 +1380,7 @@ var cgoEnabled = map[string]bool{
"android/amd64": true,
"android/arm": true,
"android/arm64": true,
"js/wasm": false,
"nacl/386": false,
"nacl/amd64p32": false,
"nacl/arm": false,

View File

@ -192,6 +192,12 @@ func vetPlatforms(pp []platform) {
}
func (p platform) vet() {
if p.os == "js" && p.arch == "wasm" {
// TODO(neelance): enable as soon as js/wasm has fully landed
fmt.Println("skipping js/wasm")
return
}
var buf bytes.Buffer
fmt.Fprintf(&buf, "go run main.go -p %s\n", p)

View File

@ -4,5 +4,5 @@
package build
const goosList = "android darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris windows zos "
const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 "
const goosList = "android darwin dragonfly freebsd js linux nacl netbsd openbsd plan9 solaris windows zos "
const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be ppc64 ppc64le mips mipsle mips64 mips64le mips64p32 mips64p32le ppc s390 s390x sparc sparc64 wasm "

View File

@ -168,6 +168,7 @@ var gcArchSizes = map[string]*StdSizes{
"ppc64": {8, 8},
"ppc64le": {8, 8},
"s390x": {8, 8},
"wasm": {8, 8},
// When adding more architectures here,
// update the doc string of SizesFor below.
}
@ -177,7 +178,7 @@ var gcArchSizes = map[string]*StdSizes{
//
// Supported architectures for compiler "gc":
// "386", "arm", "arm64", "amd64", "amd64p32", "mips", "mipsle",
// "mips64", "mips64le", "ppc64", "ppc64le", "s390x".
// "mips64", "mips64le", "ppc64", "ppc64le", "s390x", "wasm".
func SizesFor(compiler, arch string) Sizes {
if compiler != "gc" {
return nil

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 1
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 1
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 1
const GoarchSparc64 = 0
const GoarchWasm = 0

View File

@ -26,3 +26,4 @@ const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 1
const GoarchWasm = 0

View File

@ -0,0 +1,29 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
// +build wasm
package sys
const GOARCH = `wasm`
const Goarch386 = 0
const GoarchAmd64 = 0
const GoarchAmd64p32 = 0
const GoarchArm = 0
const GoarchArmbe = 0
const GoarchArm64 = 0
const GoarchArm64be = 0
const GoarchPpc64 = 0
const GoarchPpc64le = 0
const GoarchMips = 0
const GoarchMipsle = 0
const GoarchMips64 = 0
const GoarchMips64le = 0
const GoarchMips64p32 = 0
const GoarchMips64p32le = 0
const GoarchPpc = 0
const GoarchS390 = 0
const GoarchS390x = 0
const GoarchSparc = 0
const GoarchSparc64 = 0
const GoarchWasm = 1

View File

@ -10,6 +10,7 @@ const GoosAndroid = 1
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 1
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 1
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 1
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -0,0 +1,21 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
// +build js
package sys
const GOOS = `js`
const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 1
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0
const GoosOpenbsd = 0
const GoosPlan9 = 0
const GoosSolaris = 0
const GoosWindows = 0
const GoosZos = 0

View File

@ -11,6 +11,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 1
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 1
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 1

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0

View File

@ -10,6 +10,7 @@ const GoosAndroid = 0
const GoosDarwin = 0
const GoosDragonfly = 0
const GoosFreebsd = 0
const GoosJs = 0
const GoosLinux = 0
const GoosNacl = 0
const GoosNetbsd = 0