1
0
mirror of https://github.com/golang/go synced 2024-10-01 16:28:33 -06:00

all: enable vet/all for js/wasm and fix vet issues

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>
This commit is contained in:
Richard Musiol 2018-06-08 18:12:57 +02:00 committed by Brad Fitzpatrick
parent adf72bbc9a
commit c12399fffb
8 changed files with 60 additions and 41 deletions

View File

@ -192,11 +192,6 @@ func vetPlatforms(pp []platform) {
} }
func (p platform) vet() { 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" { if p.os == "linux" && p.arch == "riscv64" {
// TODO(tklauser): enable as soon as the riscv64 port has fully landed // TODO(tklauser): enable as soon as the riscv64 port has fully landed
fmt.Println("skipping linux/riscv64") fmt.Println("skipping linux/riscv64")

View File

@ -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)

View File

@ -77,6 +77,7 @@ var (
asmArchPpc64 = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true} asmArchPpc64 = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true}
asmArchPpc64LE = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true} asmArchPpc64LE = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true}
asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true} asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true}
asmArchWasm = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false}
arches = []*asmArch{ arches = []*asmArch{
&asmArch386, &asmArch386,
@ -91,6 +92,7 @@ var (
&asmArchPpc64, &asmArchPpc64,
&asmArchPpc64LE, &asmArchPpc64LE,
&asmArchS390X, &asmArchS390X,
&asmArchWasm,
} }
) )

View File

@ -7,30 +7,30 @@
TEXT ·Compare(SB), NOSPLIT, $0-56 TEXT ·Compare(SB), NOSPLIT, $0-56
Get SP Get SP
I64Load s1_base+0(FP) I64Load a_base+0(FP)
I64Load s1_len+8(FP) I64Load a_len+8(FP)
I64Load s2_base+24(FP) I64Load b_base+24(FP)
I64Load s2_len+32(FP) I64Load b_len+32(FP)
Call cmpbody<>(SB) Call cmpbody<>(SB)
I64Store ret+48(FP) I64Store ret+48(FP)
RET RET
TEXT bytes·Compare(SB), NOSPLIT, $0-56 TEXT bytes·Compare(SB), NOSPLIT, $0-56
Get SP Get SP
I64Load s1_base+0(FP) I64Load a_base+0(FP)
I64Load s1_len+8(FP) I64Load a_len+8(FP)
I64Load s2_base+24(FP) I64Load b_base+24(FP)
I64Load s2_len+32(FP) I64Load b_len+32(FP)
Call cmpbody<>(SB) Call cmpbody<>(SB)
I64Store ret+48(FP) I64Store ret+48(FP)
RET RET
TEXT runtime·cmpstring(SB), NOSPLIT, $0-40 TEXT runtime·cmpstring(SB), NOSPLIT, $0-40
Get SP Get SP
I64Load s1_base+0(FP) I64Load a_base+0(FP)
I64Load s1_len+8(FP) I64Load a_len+8(FP)
I64Load s2_base+16(FP) I64Load b_base+16(FP)
I64Load s2_len+24(FP) I64Load b_len+24(FP)
Call cmpbody<>(SB) Call cmpbody<>(SB)
I64Store ret+32(FP) I64Store ret+32(FP)
RET RET

View File

@ -6,10 +6,10 @@
#include "textflag.h" #include "textflag.h"
TEXT ·IndexByte(SB), NOSPLIT, $0-40 TEXT ·IndexByte(SB), NOSPLIT, $0-40
I64Load s+0(FP) I64Load b_base+0(FP)
I32WrapI64 I32WrapI64
I32Load8U c+24(FP) I32Load8U c+24(FP)
I64Load s_len+8(FP) I64Load b_len+8(FP)
I32WrapI64 I32WrapI64
Call memchr<>(SB) Call memchr<>(SB)
I64ExtendSI32 I64ExtendSI32
@ -18,7 +18,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
Get SP Get SP
I64Const $-1 I64Const $-1
Get R0 Get R0
I64Load s+0(FP) I64Load b_base+0(FP)
I64Sub I64Sub
Get R0 Get R0
I64Eqz $0 I64Eqz $0
@ -29,7 +29,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
TEXT ·IndexByteString(SB), NOSPLIT, $0-32 TEXT ·IndexByteString(SB), NOSPLIT, $0-32
Get SP Get SP
I64Load s+0(FP) I64Load s_base+0(FP)
I32WrapI64 I32WrapI64
I32Load8U c+16(FP) I32Load8U c+16(FP)
I64Load s_len+8(FP) I64Load s_len+8(FP)
@ -40,7 +40,7 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
I64Const $-1 I64Const $-1
Get R0 Get R0
I64Load s+0(FP) I64Load s_base+0(FP)
I64Sub I64Sub
Get R0 Get R0
I64Eqz $0 I64Eqz $0
@ -51,10 +51,10 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
TEXT bytes·IndexByte(SB), NOSPLIT, $0-40 TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
Get SP Get SP
I64Load s+0(FP) I64Load b_base+0(FP)
I32WrapI64 I32WrapI64
I32Load8U c+24(FP) I32Load8U c+24(FP)
I64Load s_len+8(FP) I64Load b_len+8(FP)
I32WrapI64 I32WrapI64
Call memchr<>(SB) Call memchr<>(SB)
I64ExtendSI32 I64ExtendSI32
@ -62,7 +62,7 @@ TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
I64Const $-1 I64Const $-1
Get R0 Get R0
I64Load s+0(FP) I64Load b_base+0(FP)
I64Sub I64Sub
Get R0 Get R0
I64Eqz $0 I64Eqz $0
@ -73,7 +73,7 @@ TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
TEXT strings·IndexByte(SB), NOSPLIT, $0-32 TEXT strings·IndexByte(SB), NOSPLIT, $0-32
Get SP Get SP
I64Load s+0(FP) I64Load s_base+0(FP)
I32WrapI64 I32WrapI64
I32Load8U c+16(FP) I32Load8U c+16(FP)
I64Load s_len+8(FP) I64Load s_len+8(FP)
@ -84,7 +84,7 @@ TEXT strings·IndexByte(SB), NOSPLIT, $0-32
I64Const $-1 I64Const $-1
Get R0 Get R0
I64Load s+0(FP) I64Load s_base+0(FP)
I64Sub I64Sub
Get R0 Get R0
I64Eqz $0 I64Eqz $0

View File

@ -186,7 +186,7 @@ TEXT runtime·return0(SB), NOSPLIT, $0-0
RET RET
TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16 TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16
MOVD fn+0(FP), CTXT MOVD fv+0(FP), CTXT
Get CTXT Get CTXT
I64Eqz I64Eqz
@ -297,7 +297,7 @@ TEXT reflect·call(SB), NOSPLIT, $0-0
JMP ·reflectcall(SB) JMP ·reflectcall(SB)
TEXT ·reflectcall(SB), NOSPLIT, $0-32 TEXT ·reflectcall(SB), NOSPLIT, $0-32
I64Load f+8(FP) I64Load fn+8(FP)
I64Eqz I64Eqz
If If
CALLNORESUME runtime·sigpanic(SB) CALLNORESUME runtime·sigpanic(SB)

View File

@ -74,7 +74,7 @@ TEXT runtime·pause(SB), NOSPLIT, $0
Set RUN Set RUN
RETUNWIND RETUNWIND
TEXT runtime·exit(SB), NOSPLIT, $0-8 TEXT runtime·exit(SB), NOSPLIT, $0-4
Call runtime·wasmExit(SB) Call runtime·wasmExit(SB)
Drop Drop
I32Const $RUN_EXITED I32Const $RUN_EXITED

View File

@ -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)