]> Cypherpunks repositories - gostls13.git/commitdiff
go/build, go/types, cmd/dist: add js/wasm architecture
authorRichard Musiol <mail@richard-musiol.de>
Tue, 27 Mar 2018 23:15:39 +0000 (01:15 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 30 Mar 2018 21:34:18 +0000 (21:34 +0000)
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>
38 files changed:
src/cmd/dist/build.go
src/cmd/vet/all/main.go
src/go/build/syslist.go
src/go/types/sizes.go
src/runtime/internal/sys/zgoarch_386.go
src/runtime/internal/sys/zgoarch_amd64.go
src/runtime/internal/sys/zgoarch_amd64p32.go
src/runtime/internal/sys/zgoarch_arm.go
src/runtime/internal/sys/zgoarch_arm64.go
src/runtime/internal/sys/zgoarch_arm64be.go
src/runtime/internal/sys/zgoarch_armbe.go
src/runtime/internal/sys/zgoarch_mips.go
src/runtime/internal/sys/zgoarch_mips64.go
src/runtime/internal/sys/zgoarch_mips64le.go
src/runtime/internal/sys/zgoarch_mips64p32.go
src/runtime/internal/sys/zgoarch_mips64p32le.go
src/runtime/internal/sys/zgoarch_mipsle.go
src/runtime/internal/sys/zgoarch_ppc.go
src/runtime/internal/sys/zgoarch_ppc64.go
src/runtime/internal/sys/zgoarch_ppc64le.go
src/runtime/internal/sys/zgoarch_s390.go
src/runtime/internal/sys/zgoarch_s390x.go
src/runtime/internal/sys/zgoarch_sparc.go
src/runtime/internal/sys/zgoarch_sparc64.go
src/runtime/internal/sys/zgoarch_wasm.go [new file with mode: 0644]
src/runtime/internal/sys/zgoos_android.go
src/runtime/internal/sys/zgoos_darwin.go
src/runtime/internal/sys/zgoos_dragonfly.go
src/runtime/internal/sys/zgoos_freebsd.go
src/runtime/internal/sys/zgoos_js.go [new file with mode: 0644]
src/runtime/internal/sys/zgoos_linux.go
src/runtime/internal/sys/zgoos_nacl.go
src/runtime/internal/sys/zgoos_netbsd.go
src/runtime/internal/sys/zgoos_openbsd.go
src/runtime/internal/sys/zgoos_plan9.go
src/runtime/internal/sys/zgoos_solaris.go
src/runtime/internal/sys/zgoos_windows.go
src/runtime/internal/sys/zgoos_zos.go

index 398a187658928e2da294a1d568f720e4552f6b9c..d570aa1a84d2848ba306c2aab07151d88cc27e59 100644 (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,
index 09167af6d53e632d81bd2e11eb522d896899a4f8..6c56daff03b1b5a3d9810f75ae30367989ee575f 100644 (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)
 
index 73fdbe6c856e32b9f8310626c02cf4f42ff58c1b..d1fcc8f5bd5b6a10893902e19ba9db12f019ed50 100644 (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 "
index eb274799f42e96c6024ebf6b4ef311705ea5f0e4..fda0c954697ed739d003e1d580c4c4d5d7fc9f9e 100644 (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
index b07abbedc6f9b1202bfddc19fb597ae51e183655..209b7749f6d20b7cf1936222b9cf8450969550c4 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index bfdcb00bd922b140674f28247b7a57fc96ad7e29..950a196786c2b01d8e146e398afbacc5b75139dd 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index b61617d4d97ba7870ec8ef05acc4fddd3dc2085c..0d27361471f171541dfeb2c7bf6886c5bd3954c9 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 79595d545ae43bc19ab1a5b1f5ddd71f86509f61..46f7fb880faa7287a11cbb085b47385aaba61e7e 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index c839b8fc0364a8cdf27436aafc0b249f924b18e1..67893f99cc869ffdcb2a7af8d05a66456db6fe6a 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 58b4ef198b2c8d41b1a2e8ae185d9b338f7e3d1c..0a9451f38899b030b6ccf7912380b275c5eca8b4 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index e9e2c314d85dbac1fbb8d579e4e6e58e2fcef272..84cc570ec86c520364f590fd53fcf127d116bb4a 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index b0bf4ffec3a71932de74f40ad2908591e882294c..6ff4b24fcfd25cceb419f90e7c346c2d68446edf 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 093e88ceaa81aeb3ff9bf9ee792303f325cb9b73..55a8b860a58aaa321d317b50ddd9b852686a9ae2 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 3bad7cfd387d627313ccf20c90e6c0a61d07e306..ea0d94a39e2242b30ff218b181e281e013f52361 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index c5f69fc687eed5b28c5126f8cfbdc5e3d6112a11..fe0b9f6bf11995a963bf9b3e16f88178ec921206 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 014ef84ce88f1aea0122e149593e108ca75fcee8..273e2249739522d2ee78a092373caccbd95e7edd 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 75814be7872b8c0a0d3054f3d651b5c46decf794..802d1ecd4f9513bd0a505f93694ed7995f80145d 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 2a891b8477667ac77220ca6fb146acb876043098..ca241304584f0ed72bbfec415881b9b6b3aee24c 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 847db4bdb21c1a03f4c36c0d420b0c410665f7d7..e307121cd8743610dca5768f1a27077b02dca0ed 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index 5195797b299dcdb960108fefaac31810d6a5f70a..afc67c59a39be21d9560d1e3b433fb5ac61e97d9 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index cd215da577bbcc3196bb0691c4da45ed3e94f53d..1f4a1c262b79da7a8ae1f65d5616cd8be4870a52 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 1
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index b9368ff4e364ba309eb71607f1e3b59a745ce21e..13fdd2314f2398f5ca4500390ea058e1347c2e34 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 1
 const GoarchSparc = 0
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index e9afe0131b5a075f80a0cd9c92d6facbd1ea7481..825d013f93e61ea04ea5edd3f12882972a563cad 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 1
 const GoarchSparc64 = 0
+const GoarchWasm = 0
index b6004efe1c06772ec4682a973161fede62708bcb..939c56f2d36f6e6d1382e24aa5e169e78885b7fe 100644 (file)
@@ -26,3 +26,4 @@ const GoarchS390 = 0
 const GoarchS390x = 0
 const GoarchSparc = 0
 const GoarchSparc64 = 1
+const GoarchWasm = 0
diff --git a/src/runtime/internal/sys/zgoarch_wasm.go b/src/runtime/internal/sys/zgoarch_wasm.go
new file mode 100644 (file)
index 0000000..20a2241
--- /dev/null
@@ -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
index 01ebe753c5fd383f9e5278256d2537a0c969a7b6..bfdc37792e8e0d9997d4917e39a97aa785f6bbbb 100644 (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
index 1303d71ee98ee89e8a326826ca7ac3cda6b24b6c..1c4667f6debeebda92717b2d9e206b330186b983 100644 (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
index 64325c7a42f09ec5f61702b36b68123c8661180d..728bf6abe85e5fe1ca0bf6e7fea49de487364f92 100644 (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
index 37449713f9b8c787dfd8fc93d61f59fecc844706..a8d659169b11d748bef378b3200d38939146abf6 100644 (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
diff --git a/src/runtime/internal/sys/zgoos_js.go b/src/runtime/internal/sys/zgoos_js.go
new file mode 100644 (file)
index 0000000..cc8eef0
--- /dev/null
@@ -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
index c726465350359f757cf3dbb883a143a691df0364..289400c6122c5741fc84ff2a5828402c403fed0c 100644 (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
index 53b394c6312bb9b530f5a523d8819ff0b6ccc263..3fedb0a2c3b1b353b8b7c857039a6127e85579e8 100644 (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
index 8bfdf45d4a623a8fa06c2887c5d7a3926c5523af..3346e3711ca353020ffe804322cc309198568fe6 100644 (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
index fc6acb761cb8ac6eaf8360b5d397dadbd8f61088..13c0323249d2e24497e473777c43aa4389018d60 100644 (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
index 75baeb34f6442694b3399e4ea3d27b9d749a4dc2..6b2e977b5ea32a9e4732e19b149e8f7fda5acc07 100644 (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
index c18f34f398f1efee01af30078fc906938fd089af..cbf70f079a39c0f7202de4ce66375c81e2edd334 100644 (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
index b9f0d4e5842be4c5d7c55ae593c96ef98b34db9a..70839ca7938ef66323e60338d27bc1392f3df897 100644 (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
index 2563ebea23de9f5b5d0afee87794f618e8156cc9..ecf449f70348c7cf197bb72734e8b264ade04395 100644 (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