Skip to content

Commit c12399f

Browse files
neelancebradfitz
authored andcommitted
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 <[email protected]>
1 parent adf72bb commit c12399f

File tree

8 files changed

+60
-41
lines changed

8 files changed

+60
-41
lines changed

src/cmd/vet/all/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,6 @@ 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-
}
200195
if p.os == "linux" && p.arch == "riscv64" {
201196
// TODO(tklauser): enable as soon as the riscv64 port has fully landed
202197
fmt.Println("skipping linux/riscv64")

src/cmd/vet/all/whitelist/wasm.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// wasm-specific vet whitelist. See readme.txt for details.
2+
3+
// False positives.
4+
5+
// Nothing much to do about cross-package assembly. Unfortunate.
6+
internal/bytealg/compare_wasm.s: [wasm] cannot check cross-package assembly function: Compare is in package bytes
7+
internal/bytealg/compare_wasm.s: [wasm] cannot check cross-package assembly function: cmpstring is in package runtime
8+
9+
// morestack intentionally omits arg size.
10+
runtime/asm_wasm.s: [wasm] morestack: use of 8(SP) points beyond argument frame
11+
runtime/asm_wasm.s: [wasm] morestack: use of 16(SP) points beyond argument frame
12+
runtime/asm_wasm.s: [wasm] morestack: use of 8(SP) points beyond argument frame
13+
14+
// rt0_go does not allocate a stack frame.
15+
runtime/asm_wasm.s: [wasm] rt0_go: use of 8(SP) points beyond argument frame
16+
17+
// Calling WebAssembly import. No write from Go assembly.
18+
runtime/sys_wasm.s: [wasm] nanotime: RET without writing to 8-byte ret+0(FP)
19+
runtime/sys_wasm.s: [wasm] scheduleCallback: RET without writing to 4-byte ret+8(FP)
20+
syscall/js/js_js.s: [wasm] boolVal: RET without writing to 4-byte ret+8(FP)
21+
syscall/js/js_js.s: [wasm] intVal: RET without writing to 4-byte ret+8(FP)
22+
syscall/js/js_js.s: [wasm] floatVal: RET without writing to 4-byte ret+8(FP)
23+
syscall/js/js_js.s: [wasm] stringVal: RET without writing to 4-byte ret+16(FP)
24+
syscall/js/js_js.s: [wasm] valueGet: RET without writing to 4-byte ret+24(FP)
25+
syscall/js/js_js.s: [wasm] valueIndex: RET without writing to 4-byte ret+16(FP)
26+
syscall/js/js_js.s: [wasm] valueCall: RET without writing to 4-byte ret+48(FP)
27+
syscall/js/js_js.s: [wasm] valueInvoke: RET without writing to 4-byte ret+32(FP)
28+
syscall/js/js_js.s: [wasm] valueNew: RET without writing to 4-byte ret+32(FP)
29+
syscall/js/js_js.s: [wasm] valueFloat: RET without writing to 8-byte ret+8(FP)
30+
syscall/js/js_js.s: [wasm] valueInt: RET without writing to 8-byte ret+8(FP)
31+
syscall/js/js_js.s: [wasm] valueBool: RET without writing to 1-byte ret+8(FP)
32+
syscall/js/js_js.s: [wasm] valueLength: RET without writing to 8-byte ret+8(FP)
33+
syscall/js/js_js.s: [wasm] valuePrepareString: RET without writing to 4-byte ret+8(FP)

src/cmd/vet/asmdecl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ var (
7777
asmArchPpc64 = asmArch{name: "ppc64", bigEndian: true, stack: "R1", lr: true}
7878
asmArchPpc64LE = asmArch{name: "ppc64le", bigEndian: false, stack: "R1", lr: true}
7979
asmArchS390X = asmArch{name: "s390x", bigEndian: true, stack: "R15", lr: true}
80+
asmArchWasm = asmArch{name: "wasm", bigEndian: false, stack: "SP", lr: false}
8081

8182
arches = []*asmArch{
8283
&asmArch386,
@@ -91,6 +92,7 @@ var (
9192
&asmArchPpc64,
9293
&asmArchPpc64LE,
9394
&asmArchS390X,
95+
&asmArchWasm,
9496
}
9597
)
9698

src/internal/bytealg/compare_wasm.s

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@
77

88
TEXT ·Compare(SB), NOSPLIT, $0-56
99
Get SP
10-
I64Load s1_base+0(FP)
11-
I64Load s1_len+8(FP)
12-
I64Load s2_base+24(FP)
13-
I64Load s2_len+32(FP)
10+
I64Load a_base+0(FP)
11+
I64Load a_len+8(FP)
12+
I64Load b_base+24(FP)
13+
I64Load b_len+32(FP)
1414
Call cmpbody<>(SB)
1515
I64Store ret+48(FP)
1616
RET
1717

1818
TEXT bytes·Compare(SB), NOSPLIT, $0-56
1919
Get SP
20-
I64Load s1_base+0(FP)
21-
I64Load s1_len+8(FP)
22-
I64Load s2_base+24(FP)
23-
I64Load s2_len+32(FP)
20+
I64Load a_base+0(FP)
21+
I64Load a_len+8(FP)
22+
I64Load b_base+24(FP)
23+
I64Load b_len+32(FP)
2424
Call cmpbody<>(SB)
2525
I64Store ret+48(FP)
2626
RET
2727

2828
TEXT runtime·cmpstring(SB), NOSPLIT, $0-40
2929
Get SP
30-
I64Load s1_base+0(FP)
31-
I64Load s1_len+8(FP)
32-
I64Load s2_base+16(FP)
33-
I64Load s2_len+24(FP)
30+
I64Load a_base+0(FP)
31+
I64Load a_len+8(FP)
32+
I64Load b_base+16(FP)
33+
I64Load b_len+24(FP)
3434
Call cmpbody<>(SB)
3535
I64Store ret+32(FP)
3636
RET

src/internal/bytealg/indexbyte_wasm.s

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#include "textflag.h"
77

88
TEXT ·IndexByte(SB), NOSPLIT, $0-40
9-
I64Load s+0(FP)
9+
I64Load b_base+0(FP)
1010
I32WrapI64
1111
I32Load8U c+24(FP)
12-
I64Load s_len+8(FP)
12+
I64Load b_len+8(FP)
1313
I32WrapI64
1414
Call memchr<>(SB)
1515
I64ExtendSI32
@@ -18,7 +18,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
1818
Get SP
1919
I64Const $-1
2020
Get R0
21-
I64Load s+0(FP)
21+
I64Load b_base+0(FP)
2222
I64Sub
2323
Get R0
2424
I64Eqz $0
@@ -29,7 +29,7 @@ TEXT ·IndexByte(SB), NOSPLIT, $0-40
2929

3030
TEXT ·IndexByteString(SB), NOSPLIT, $0-32
3131
Get SP
32-
I64Load s+0(FP)
32+
I64Load s_base+0(FP)
3333
I32WrapI64
3434
I32Load8U c+16(FP)
3535
I64Load s_len+8(FP)
@@ -40,7 +40,7 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
4040

4141
I64Const $-1
4242
Get R0
43-
I64Load s+0(FP)
43+
I64Load s_base+0(FP)
4444
I64Sub
4545
Get R0
4646
I64Eqz $0
@@ -51,18 +51,18 @@ TEXT ·IndexByteString(SB), NOSPLIT, $0-32
5151

5252
TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
5353
Get SP
54-
I64Load s+0(FP)
54+
I64Load b_base+0(FP)
5555
I32WrapI64
5656
I32Load8U c+24(FP)
57-
I64Load s_len+8(FP)
57+
I64Load b_len+8(FP)
5858
I32WrapI64
5959
Call memchr<>(SB)
6060
I64ExtendSI32
6161
Set R0
6262

6363
I64Const $-1
6464
Get R0
65-
I64Load s+0(FP)
65+
I64Load b_base+0(FP)
6666
I64Sub
6767
Get R0
6868
I64Eqz $0
@@ -73,7 +73,7 @@ TEXT bytes·IndexByte(SB), NOSPLIT, $0-40
7373

7474
TEXT strings·IndexByte(SB), NOSPLIT, $0-32
7575
Get SP
76-
I64Load s+0(FP)
76+
I64Load s_base+0(FP)
7777
I32WrapI64
7878
I32Load8U c+16(FP)
7979
I64Load s_len+8(FP)
@@ -84,7 +84,7 @@ TEXT strings·IndexByte(SB), NOSPLIT, $0-32
8484

8585
I64Const $-1
8686
Get R0
87-
I64Load s+0(FP)
87+
I64Load s_base+0(FP)
8888
I64Sub
8989
Get R0
9090
I64Eqz $0

src/runtime/asm_wasm.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ TEXT runtime·return0(SB), NOSPLIT, $0-0
186186
RET
187187

188188
TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16
189-
MOVD fn+0(FP), CTXT
189+
MOVD fv+0(FP), CTXT
190190

191191
Get CTXT
192192
I64Eqz
@@ -297,7 +297,7 @@ TEXT reflect·call(SB), NOSPLIT, $0-0
297297
JMP ·reflectcall(SB)
298298

299299
TEXT ·reflectcall(SB), NOSPLIT, $0-32
300-
I64Load f+8(FP)
300+
I64Load fn+8(FP)
301301
I64Eqz
302302
If
303303
CALLNORESUME runtime·sigpanic(SB)

src/runtime/rt0_js_wasm.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEXT runtime·pause(SB), NOSPLIT, $0
7474
Set RUN
7575
RETUNWIND
7676

77-
TEXT runtime·exit(SB), NOSPLIT, $0-8
77+
TEXT runtime·exit(SB), NOSPLIT, $0-4
7878
Call runtime·wasmExit(SB)
7979
Drop
8080
I32Const $RUN_EXITED

src/syscall/time_js_wasm.s

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)