Skip to content

Commit 80e6922

Browse files
neelancebradfitz
authored andcommitted
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 4468b0b commit 80e6922

38 files changed

+93
-3
lines changed

src/cmd/dist/build.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ var cgoEnabled = map[string]bool{
13801380
"android/amd64": true,
13811381
"android/arm": true,
13821382
"android/arm64": true,
1383+
"js/wasm": false,
13831384
"nacl/386": false,
13841385
"nacl/amd64p32": false,
13851386
"nacl/arm": false,

src/cmd/vet/all/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ func vetPlatforms(pp []platform) {
192192
}
193193

194194
func (p platform) vet() {
195+
if p.os == "js" && p.arch == "wasm" {
196+
// TODO(neelance): enable as soon as js/wasm has fully landed
197+
fmt.Println("skipping js/wasm")
198+
return
199+
}
200+
195201
var buf bytes.Buffer
196202
fmt.Fprintf(&buf, "go run main.go -p %s\n", p)
197203

src/go/build/syslist.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
package build
66

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

src/go/types/sizes.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ var gcArchSizes = map[string]*StdSizes{
168168
"ppc64": {8, 8},
169169
"ppc64le": {8, 8},
170170
"s390x": {8, 8},
171+
"wasm": {8, 8},
171172
// When adding more architectures here,
172173
// update the doc string of SizesFor below.
173174
}
@@ -177,7 +178,7 @@ var gcArchSizes = map[string]*StdSizes{
177178
//
178179
// Supported architectures for compiler "gc":
179180
// "386", "arm", "arm64", "amd64", "amd64p32", "mips", "mipsle",
180-
// "mips64", "mips64le", "ppc64", "ppc64le", "s390x".
181+
// "mips64", "mips64le", "ppc64", "ppc64le", "s390x", "wasm".
181182
func SizesFor(compiler, arch string) Sizes {
182183
if compiler != "gc" {
183184
return nil

src/runtime/internal/sys/zgoarch_386.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoarch_amd64.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoarch_amd64p32.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoarch_arm.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoarch_arm64.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoarch_arm64be.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)