]> Cypherpunks repositories - gostls13.git/commitdiff
all: enable vet/all for js/wasm and fix vet issues
authorRichard Musiol <mail@richard-musiol.de>
Fri, 8 Jun 2018 16:12:57 +0000 (18:12 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 15 Jun 2018 00:05:22 +0000 (00:05 +0000)
This commit enables vet/all for the js/wasm architecture. It got
skipped initially because the codebase did not fully compile yet
for js/wasm, which made vet/all fail.

startTimer and stopTimer are not needed in the syscall package.
Removed their assembly code since their Go stubs were already gone.

Change-Id: Icaeb6d903876e51ceb1edff7631f715a98c28696
Reviewed-on: https://go-review.googlesource.com/118657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/vet/all/main.go
src/cmd/vet/all/whitelist/wasm.txt [new file with mode: 0644]
src/cmd/vet/asmdecl.go
src/internal/bytealg/compare_wasm.s
src/internal/bytealg/indexbyte_wasm.s
src/runtime/asm_wasm.s
src/runtime/rt0_js_wasm.s
src/syscall/time_js_wasm.s [deleted file]

index 4b1df73b54dbb5b2b978a77571bc11051235e59e..09181f968950cc17ab1bae8966398bee1e3ff4af 100644 (file)
@@ -192,11 +192,6 @@ 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
-       }
        if p.os == "linux" && p.arch == "riscv64" {
                // TODO(tklauser): enable as soon as the riscv64 port has fully landed
                fmt.Println("skipping linux/riscv64")
diff --git a/src/cmd/vet/all/whitelist/wasm.txt b/src/cmd/vet/all/whitelist/wasm.txt
new file mode 100644 (file)
index 0000000..ade7590
--- /dev/null
@@ -0,0 +1,33 @@
+// wasm-specific vet whitelist. See readme.txt for details.
+
+// False positives.
+
+// Nothing much to do about cross-package assembly. Unfortunate.
+internal/bytealg/compare_wasm.s: [wasm] cannot check cross-package assembly function: Compare is in package bytes
+internal/bytealg/compare_wasm.s: [wasm] cannot check cross-package assembly function: cmpstring is in package runtime
+
+// morestack intentionally omits arg size.
+runtime/asm_wasm.s: [wasm] morestack: use of 8(SP) points beyond argument frame
+runtime/asm_wasm.s: [wasm] morestack: use of 16(SP) points beyond argument frame
+runtime/asm_wasm.s: [wasm] morestack: use of 8(SP) points beyond argument frame
+
+// rt0_go does not allocate a stack frame.
+runtime/asm_wasm.s: [wasm] rt0_go: use of 8(SP) points beyond argument frame
+
+// Calling WebAssembly import. No write from Go assembly.
+runtime/sys_wasm.s: [wasm] nanotime: RET without writing to 8-byte ret+0(FP)
+runtime/sys_wasm.s: [wasm] scheduleCallback: RET without writing to 4-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] boolVal: RET without writing to 4-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] intVal: RET without writing to 4-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] floatVal: RET without writing to 4-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] stringVal: RET without writing to 4-byte ret+16(FP)
+syscall/js/js_js.s: [wasm] valueGet: RET without writing to 4-byte ret+24(FP)
+syscall/js/js_js.s: [wasm] valueIndex: RET without writing to 4-byte ret+16(FP)
+syscall/js/js_js.s: [wasm] valueCall: RET without writing to 4-byte ret+48(FP)
+syscall/js/js_js.s: [wasm] valueInvoke: RET without writing to 4-byte ret+32(FP)
+syscall/js/js_js.s: [wasm] valueNew: RET without writing to 4-byte ret+32(FP)
+syscall/js/js_js.s: [wasm] valueFloat: RET without writing to 8-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] valueInt: RET without writing to 8-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] valueBool: RET without writing to 1-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] valueLength: RET without writing to 8-byte ret+8(FP)
+syscall/js/js_js.s: [wasm] valuePrepareString: RET without writing to 4-byte ret+8(FP)
index 43c420380938707fa3f4ccd2b41e5af97c609dc3..ccf6269f1db292cb696aa8d7e17b3fff6fa70872 100644 (file)
@@ -77,6 +77,7 @@ var (
        asmArchPpc64    = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true}
        asmArchPpc64LE  = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true}
        asmArchS390X    = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true}
+       asmArchWasm     = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false}
 
        arches = []*asmArch{
                &asmArch386,
@@ -91,6 +92,7 @@ var (
                &asmArchPpc64,
                &asmArchPpc64LE,
                &asmArchS390X,
+               &asmArchWasm,
        }
 )
 
index 39bc0fc37a414c0db40d9cd614aee93dee1709e5..b412649e04bcc0befc1f57ee4d0ad3fb5aed0584 100644 (file)
@@ -7,30 +7,30 @@
 
 TEXT ·Compare(SB), NOSPLIT, $0-56
        Get SP
-       I64Load s1_base+0(FP)
-       I64Load s1_len+8(FP)
-       I64Load s2_base+24(FP)
-       I64Load s2_len+32(FP)
+       I64Load a_base+0(FP)
+       I64Load a_len+8(FP)
+       I64Load b_base+24(FP)
+       I64Load b_len+32(FP)
        Call cmpbody<>(SB)
        I64Store ret+48(FP)
        RET
 
 TEXT bytes·Compare(SB), NOSPLIT, $0-56
        Get SP
-       I64Load s1_base+0(FP)
-       I64Load s1_len+8(FP)
-       I64Load s2_base+24(FP)
-       I64Load s2_len+32(FP)
+       I64Load a_base+0(FP)
+       I64Load a_len+8(FP)
+       I64Load b_base+24(FP)
+       I64Load b_len+32(FP)
        Call cmpbody<>(SB)
        I64Store ret+48(FP)
        RET
 
 TEXT runtime·cmpstring(SB), NOSPLIT, $0-40
        Get SP
-       I64Load s1_base+0(FP)
-       I64Load s1_len+8(FP)
-       I64Load s2_base+16(FP)
-       I64Load s2_len+24(FP)
+       I64Load a_base+0(FP)
+       I64Load a_len+8(FP)
+       I64Load b_base+16(FP)
+       I64Load b_len+24(FP)
        Call cmpbody<>(SB)
        I64Store ret+32(FP)
        RET
index 113c7a0a6fb4c1e423db2ec3d7af04e0d9f2cef4..f9f8e65002bb8c93ea66e8a253f3970a6ca220fb 100644 (file)
@@ -6,10 +6,10 @@
 #include "textflag.h"
 
 TEXT ·IndexByte(SB), NOSPLIT, $0-40
-       I64Load s+0(FP)
+       I64Load b_base+0(FP)
        I32WrapI64
        I32Load8U c+24(FP)
-       I64Load s_len+8(FP)
+       I64Load b_len+8(FP)
        I32WrapI64
        Call memchr<>(SB)
        I64ExtendSI32
@@ -18,7 +18,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
        Get SP
        I64Const $-1
        Get R0
-       I64Load s+0(FP)
+       I64Load b_base+0(FP)
        I64Sub
        Get R0
        I64Eqz $0
@@ -29,7 +29,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
 
 TEXT ·IndexByteString(SB), NOSPLIT, $0-32
        Get SP
-       I64Load s+0(FP)
+       I64Load s_base+0(FP)
        I32WrapI64
        I32Load8U c+16(FP)
        I64Load s_len+8(FP)
@@ -40,7 +40,7 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
 
        I64Const $-1
        Get R0
-       I64Load s+0(FP)
+       I64Load s_base+0(FP)
        I64Sub
        Get R0
        I64Eqz $0
@@ -51,10 +51,10 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
 
 TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
        Get SP
-       I64Load s+0(FP)
+       I64Load b_base+0(FP)
        I32WrapI64
        I32Load8U c+24(FP)
-       I64Load s_len+8(FP)
+       I64Load b_len+8(FP)
        I32WrapI64
        Call memchr<>(SB)
        I64ExtendSI32
@@ -62,7 +62,7 @@ TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
 
        I64Const $-1
        Get R0
-       I64Load s+0(FP)
+       I64Load b_base+0(FP)
        I64Sub
        Get R0
        I64Eqz $0
@@ -73,7 +73,7 @@ TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
 
 TEXT strings·IndexByte(SB), NOSPLIT, $0-32
        Get SP
-       I64Load s+0(FP)
+       I64Load s_base+0(FP)
        I32WrapI64
        I32Load8U c+16(FP)
        I64Load s_len+8(FP)
@@ -84,7 +84,7 @@ TEXT strings·IndexByte(SB), NOSPLIT, $0-32
 
        I64Const $-1
        Get R0
-       I64Load s+0(FP)
+       I64Load s_base+0(FP)
        I64Sub
        Get R0
        I64Eqz $0
index 67d7bf17dd5e144ecb34d08c4adea5d0c686571e..baf840d0cf5fb2e95cdeec89a0e85833c466634e 100644 (file)
@@ -186,7 +186,7 @@ TEXT runtime·return0(SB), NOSPLIT, $0-0
        RET
 
 TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16
-       MOVD fn+0(FP), CTXT
+       MOVD fv+0(FP), CTXT
 
        Get CTXT
        I64Eqz
@@ -297,7 +297,7 @@ TEXT reflect·call(SB), NOSPLIT, $0-0
        JMP ·reflectcall(SB)
 
 TEXT ·reflectcall(SB), NOSPLIT, $0-32
-       I64Load f+8(FP)
+       I64Load fn+8(FP)
        I64Eqz
        If
                CALLNORESUME runtime·sigpanic(SB)
index e20f623610563eeee217c62a644eb76effd351b9..c494b0a34a3ffa5f0111f7aeace0f1309ef35f56 100644 (file)
@@ -74,7 +74,7 @@ TEXT runtime·pause(SB), NOSPLIT, $0
        Set RUN
        RETUNWIND
 
-TEXT runtime·exit(SB), NOSPLIT, $0-8
+TEXT runtime·exit(SB), NOSPLIT, $0-4
        Call runtime·wasmExit(SB)
        Drop
        I32Const $RUN_EXITED
diff --git a/src/syscall/time_js_wasm.s b/src/syscall/time_js_wasm.s
deleted file mode 100644 (file)
index f08b170..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "textflag.h"
-
-TEXT ·startTimer(SB),NOSPLIT,$0
-       JMP time·startTimer(SB)
-
-TEXT ·stopTimer(SB),NOSPLIT,$0
-       JMP time·stopTimer(SB)