go/test
Youlin Feng c7ccbddf22 cmd/compile/internal/ssa: more aggressive on dead auto elim
Propagate "unread" across OpMoves. If the addr of this auto is only used
by an OpMove as its source arg, and the OpMove's target arg is the addr
of another auto. If the 2nd auto can be eliminated, this one can also be
eliminated.

This CL eliminates unnecessary memory copies and makes the frame smaller
in the following code snippet:

func contains(m map[string][16]int, k string) bool {
        _, ok := m[k]
        return ok
}

These are the benchmark results followed by the benchmark code:

goos: linux
goarch: amd64
cpu: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
                │   old.txt   │              new.txt                │
                │   sec/op    │   sec/op     vs base                │
Map1Access2Ok-8   9.582n ± 2%   9.226n ± 0%   -3.72% (p=0.000 n=20)
Map2Access2Ok-8   13.79n ± 1%   10.24n ± 1%  -25.77% (p=0.000 n=20)
Map3Access2Ok-8   68.68n ± 1%   12.65n ± 1%  -81.58% (p=0.000 n=20)

package main_test

import "testing"

var (
        m1 = map[int]int{}
        m2 = map[int][16]int{}
        m3 = map[int][256]int{}
)

func init() {
        for i := range 1000 {
                m1[i] = i
                m2[i] = [16]int{15:i}
                m3[i] = [256]int{255:i}
        }
}

func BenchmarkMap1Access2Ok(b *testing.B) {
        for i := range b.N {
                _, ok := m1[i%1000]
                if !ok {
                        b.Errorf("%d not found", i)
                }
        }
}

func BenchmarkMap2Access2Ok(b *testing.B) {
        for i := range b.N {
                _, ok := m2[i%1000]
                if !ok {
                        b.Errorf("%d not found", i)
                }
        }
}

func BenchmarkMap3Access2Ok(b *testing.B) {
        for i := range b.N {
                _, ok := m3[i%1000]
                if !ok {
                        b.Errorf("%d not found", i)
                }
        }
}

Fixes #75398

Change-Id: If75e9caaa50d460efc31a94565b9ba28c8158771
Reviewed-on: https://go-review.googlesource.com/c/go/+/702875
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2025-11-04 12:46:15 -08:00
..
abi test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
alias3.dir
arenas reflect: fix ArenaNew to match documentation 2023-06-16 17:08:43 +00:00
asmhdr.dir cmd/compile: use exact constant in go_asm.h 2022-01-10 21:27:19 +00:00
chan [dev.typeparams] cmd/compile/internal/types2: implement close(ch) where ch is of type parameter type 2021-07-14 23:33:46 +00:00
closure3.dir cmd/compile: use very high budget for once-called closures 2024-11-22 02:04:41 +00:00
closure5.dir test: use dot-relative imports where appropriate 2022-03-24 02:14:15 +00:00
codegen cmd/compile/internal/ssa: more aggressive on dead auto elim 2025-11-04 12:46:15 -08:00
ddd2.dir
dwarf
fixedbugs runtime: use internal/strconv 2025-10-29 11:00:23 -07:00
import2.dir
import4.dir go/types, types2: use "and not used" instead of "but not used" in error messages 2022-09-27 21:10:19 +00:00
interface go/types, types2: more systematic use of Checker.use und useLHS 2023-03-28 14:28:33 +00:00
internal/runtime/sys runtime: move getcallersp to internal/runtime/sys 2024-09-17 17:01:20 +00:00
intrinsic.dir runtime,internal: move runtime/internal/sys to internal/runtime/sys 2024-07-23 19:05:35 +00:00
ken runtime: use internal/strconv 2025-10-29 11:00:23 -07:00
linkname.dir test: compile source files as if from "test" module 2022-03-24 17:50:47 +00:00
linknameasm.dir cmd/compile: generate args_stackmap for ABI0 assembly func regardless of linkname 2024-06-07 15:22:22 +00:00
method4.dir
retjmp.dir cmd/internal/obj: fix tail call in non-zero frame leaf function on MIPS and S390X 2021-12-13 22:42:08 +00:00
stress test/stress: fix typo in comment 2024-03-25 19:21:35 +00:00
syntax cmd/compile: better error message when offending/missing token is a keyword 2024-11-14 02:14:13 +00:00
typeparam runtime: use internal/strconv 2025-10-29 11:00:23 -07:00
uintptrescapes.dir
wasmmemsize.dir internal/buildcfg: enable greenteagc experiment by default 2025-10-06 16:01:40 -07:00
64bit.go
235.go
alg.go
alias.go
alias1.go
alias2.go go/types, types2: qualify named types in error messages with type kind 2024-10-23 04:43:01 +00:00
alias3.go
align.go
append.go
append1.go cmd/compile: use "cannot use %s as %s value in %s: %s" error message 2022-09-28 22:28:39 +00:00
args.go
armimm.go
asmhdr.go cmd/compile: emit sensible go_asm.h consts for big ints 2021-10-30 18:30:05 +00:00
assign.go sync: add explicit noCopy fields to Map, Mutex, and Once 2024-11-18 18:52:54 +00:00
assign1.go
atomicload.go
bigalg.go
bigmap.go
blank.go
blank1.go
bom.go
bombad.go
bounds.go
cannotassign.go
chancap.go
chanlinear.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
char_lit.go
char_lit1.go cmd/compile: do not report error for invalid constant 2021-03-05 18:46:43 +00:00
checkbce.go cmd/compile: make prove understand div, mod better 2025-10-29 18:49:40 -07:00
clear.go cmd/compile: add clear(x) builtin 2023-01-31 19:43:07 +00:00
clearfat.go
closedchan.go
closure.go
closure1.go
closure2.go cmd/compile: experimental loop iterator capture semantics change 2023-03-06 18:34:24 +00:00
closure3.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
closure4.go
closure5.go [dev.regabi] cmd/compile: exporting, importing, and inlining functions with OCLOSURE 2021-01-20 22:53:32 +00:00
closure6.go [dev.regabi] cmd/compile: fix escape analysis problem with closures 2021-01-23 02:15:24 +00:00
closure7.go [dev.regabi] test: add a test for inlining closures 2021-02-01 18:28:05 +00:00
cmp.go
cmp6.go
cmplx.go
cmplxdivide.c
cmplxdivide.go
cmplxdivide1.go
complit.go
complit1.go go/types, types2: report better error messages for slice expressions 2025-03-11 05:44:15 -07:00
compos.go
const.go
const1.go
const2.go
const3.go
const4.go
const5.go
const6.go
const7.go all: add wasip1 support 2023-04-11 20:56:32 +00:00
const8.go test: add more tests for const decls with ommitted RHS expressions 2022-06-28 18:11:31 +00:00
convert.go
convert1.go
convert2.go go/types, types2: implement slice-to-array conversions 2022-09-08 15:55:44 +00:00
convert3.go
convert4.go cmd/compile: implement slice-to-array conversions 2022-09-19 18:58:26 +00:00
convert5.go cmd/compile: disable use of new saturating float-to-int conversions 2025-10-14 15:09:35 -07:00
convert5.out cmd/compile: modify float-to-[u]int so that amd64 and arm64 match 2025-10-09 08:23:21 -07:00
convinline.go cmd/compile: handle integer conversions in static init inliner 2022-11-17 13:46:05 +00:00
convlit.go cmd/compile/internal/types2: refactor untyped conversions 2021-03-23 05:11:09 +00:00
convlit1.go
convT2X.go
copy.go
copy1.go go/types, types2: better error messages for copy built-in 2025-03-10 21:30:51 -07:00
crlf.go
ddd.go
ddd1.go cmd/compile: use "cannot use %s as %s value in %s: %s" error message 2022-09-28 22:28:39 +00:00
ddd2.go
decl.go
declbad.go cmd/compile: rewrite a, b = f() to use temporaries when type not identical 2021-06-14 07:12:37 +00:00
defer.go
defererrcheck.go test: add open-coded defer tests for too many exits path 2024-07-29 14:30:07 +00:00
deferfin.go
defernil.go
deferprint.go
deferprint.out runtime: use internal/strconv 2025-10-29 11:00:23 -07:00
devirt.go [dev.typeparams] cmd/compile: simplify interface conversions 2021-08-09 16:10:20 +00:00
devirtualization.go cmd/compile/internal/devirtualize: fix OCONVNOP assertion 2025-10-14 09:33:37 -07:00
devirtualization_nil_panics.go cmd/compile/internal/devirtualize: improve concrete type analysis 2025-10-08 14:09:22 -07:00
devirtualization_with_type_assertions_interleaved.go cmd/compile/internal/devirtualize: improve concrete type analysis 2025-10-08 14:09:22 -07:00
directive.go cmd/compile: restrict //go:notinheap to runtime/internal/sys 2022-09-02 06:22:23 +00:00
directive2.go cmd/compile: restrict //go:notinheap to runtime/internal/sys 2022-09-02 06:22:23 +00:00
divide.go
divmod.go
embedfunc.go cmd/compile: require 'go 1.16' go.mod line for //go:embed 2021-01-19 20:07:52 +00:00
embedvers.go cmd/compile: require 'go 1.16' go.mod line for //go:embed 2021-01-19 20:07:52 +00:00
empty.go
env.go test,internal/testdir: don't set GOOS/GOARCH 2023-05-12 12:34:59 +00:00
eof.go
eof1.go
escape.go cmd/compile: experimental loop iterator capture semantics change 2023-03-06 18:34:24 +00:00
escape2.go cmd/compile: allocate backing store for append on the stack 2025-05-19 16:14:53 -07:00
escape2n.go cmd/compile: allocate backing store for append on the stack 2025-05-19 16:14:53 -07:00
escape3.go
escape4.go cmd/compile: retire "IsHiddenClosure" and "IsDeadcodeClosure" 2024-07-22 21:27:37 +00:00
escape5.go cmd/compile/internal/escape: propagate constants to interface conversions to avoid allocs 2025-05-21 12:02:43 -07:00
escape6.go cmd/compile: allow pointer-containing elements in stack allocations 2025-04-04 15:04:34 -07:00
escape_array.go cmd/compile: determine static values of len and cap in make() calls 2025-02-19 13:38:58 -08:00
escape_calls.go cmd/compile: allocate backing store for append on the stack 2025-05-19 16:14:53 -07:00
escape_closure.go cmd/compile: retire "IsHiddenClosure" and "IsDeadcodeClosure" 2024-07-22 21:27:37 +00:00
escape_field.go
escape_goto.go [dev.typeparams] test: rename blank functions 2021-07-28 21:41:07 +00:00
escape_hash_maphash.go
escape_iface.go cmd/compile/internal/escape: propagate constants to interface conversions to avoid allocs 2025-05-21 12:02:43 -07:00
escape_iface_data.go cmd/compile/internal/walk: use global zeroVal in interface conversions for zero values 2025-05-21 12:24:22 -07:00
escape_indir.go
escape_level.go
escape_make_non_const.go cmd/compile: propagate len([]T{}) to make builtin to allow stack allocation 2025-10-02 11:02:07 -07:00
escape_map.go cmd/compile: allocate backing store for append on the stack 2025-05-19 16:14:53 -07:00
escape_mutations.go cmd/compile: restore zero-copy string->[]byte optimization 2023-08-18 11:58:37 +00:00
escape_param.go [dev.typeparams] cmd/compile: simplify ~r/~b naming 2021-05-26 23:50:32 +00:00
escape_reflect.go reflect: remove calling mapiterkey, mapiterelem 2024-09-18 20:57:20 +00:00
escape_runtime_atomic.go runtime: migrate internal/atomic to internal/runtime 2024-03-25 19:53:03 +00:00
escape_selfassign.go
escape_slice.go cmd/compile: allocate backing store for append on the stack 2025-05-19 16:14:53 -07:00
escape_struct_param1.go
escape_struct_param2.go
escape_struct_return.go [dev.typeparams] cmd/compile: simplify ~r/~b naming 2021-05-26 23:50:32 +00:00
escape_sync_atomic.go
escape_unique.go cmd/compile, unique: model data flow of non-string pointers 2025-05-21 20:07:36 -07:00
escape_unsafe.go test: fix typo in escape_unsafe.go 2022-09-07 17:25:59 +00:00
fibo.go
finprofiled.go test: ignore MemProfileRecords with no live objects in finprofiled.go 2023-11-16 05:48:00 +00:00
float_lit.go
float_lit2.go
float_lit3.go test: re-enable a bunch of tests with types2 2021-12-03 16:24:32 +00:00
floatcmp.go
for.go test: add test cases for index value with range array clear 2023-07-10 16:36:41 +00:00
func.go
func1.go
func2.go
func3.go go/parser, syntax: better error message for parameter missing type 2024-09-30 22:04:40 +00:00
func4.go
func5.go
func6.go
func7.go
func8.go
funcdup.go
funcdup2.go
fuse.go cmd/compile: handle boolean and pointer relations 2024-08-07 16:07:55 +00:00
gc.go
gc1.go
gc2.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
gcgort.go
gcstring.go
goprint.go
goprint.out runtime: use internal/strconv 2025-10-29 11:00:23 -07:00
goto.go
heapsampling.go cmd/compile: call generated size-specialized malloc functions directly 2025-10-09 14:59:40 -07:00
helloworld.go
helloworld.out
if.go
import.go
import1.go go/types, types2: use "and not used" instead of "but not used" in error messages 2022-09-27 21:10:19 +00:00
import2.go
import4.go
import5.go
import6.go test: re-enable most go/tests that were disabled because of types2 differences 2022-01-11 02:26:58 +00:00
index.go
index0.go
index1.go
index2.go
indirect.go
indirect1.go
init.go
init1.go
initcomma.go
initexp.go cmd/compile: use "init... cycle" instead of "init... loop" in error messages 2022-09-23 20:27:09 +00:00
initialize.go cmd/compile: handle simple inlined calls in staticinit 2022-11-16 04:04:52 +00:00
initializerr.go test: re-enable most go/tests that were disabled because of types2 differences 2022-01-11 02:26:58 +00:00
initloop.go go/types: improve recursive type error message 2024-10-22 22:20:29 +00:00
inline.go cmd/compile: remove no-longer-necessary recursive inlining checks 2025-03-06 10:07:17 -08:00
inline_big.go cmd/compile: restore zero-copy string->[]byte optimization 2023-08-18 11:58:37 +00:00
inline_caller.go
inline_callers.go
inline_endian.go cmd/compile: allocate backing store for append on the stack 2025-05-19 16:14:53 -07:00
inline_literal.go
inline_math_bits_rotate.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
inline_sync.go sync: use atomic.Bool for Once.done 2025-04-22 08:28:13 -07:00
inline_testingbloop.go testing: detect a stopped timer in B.Loop 2025-03-24 11:41:09 -07:00
inline_variadic.go [dev.typeparams] cmd/compile: simplify inlining variadic calls 2021-05-26 23:50:45 +00:00
int_lit.go
intcvt.go
intrinsic.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
intrinsic_atomic.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
iota.go
label.go
label1.go
linkmain.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
linkmain_run.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
linkname.go
linkname3.go cmd/compile: disallow linkname referring to instantiations 2024-05-15 19:27:25 +00:00
linknameasm.go cmd/compile: generate args_stackmap for ABI0 assembly func regardless of linkname 2024-06-07 15:22:22 +00:00
linkobj.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
linkx.go
linkx_run.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
literal.go
literal2.go
live.go cmd/compile: call generated size-specialized malloc functions directly 2025-10-09 14:59:40 -07:00
live1.go
live2.go all: remove GOEXPERIMENT=swissmap 2025-07-30 11:47:14 -07:00
live_regabi.go cmd/compile: call generated size-specialized malloc functions directly 2025-10-09 14:59:40 -07:00
live_uintptrkeepalive.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
loopbce.go cmd/compile: improve slicemask removal 2025-10-03 12:31:36 -07:00
mainsig.go
makechan.go all: fix some comments 2024-04-04 14:29:45 +00:00
makemap.go cmd/compile/internal/types2: add unsafe.Add and unsafe.Slice 2021-04-23 00:41:01 +00:00
makenew.go
makeslice.go
mallocfin.go
map.go
map1.go
mapclear.go
maplinear.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
maymorestack.go cmd/{asm,compile,internal/obj}: add "maymorestack" support 2021-11-05 00:52:06 +00:00
mergemul.go
method.go
method1.go cmd/compile: use "method T.m already declared" for method redeclaration errors 2022-09-27 21:59:19 +00:00
method2.go go/types, types2: better error message when using *interface instead of interface 2022-01-10 22:48:40 +00:00
method3.go
method4.go
method5.go
method6.go
method7.go [dev.typeparams] cmd/compile: fix MethodExpr handling with embedded fields 2021-01-26 17:05:06 +00:00
named.go
named1.go
newexpr.go cmd/compile: fix ICE with new(<untyped expr>) 2025-09-26 10:10:03 -07:00
newinline.go cmd/compile: remove no-longer-necessary recursive inlining checks 2025-03-06 10:07:17 -08:00
nil.go
nilcheck.go [dev.unified] test: tweak nilcheck test 2022-06-30 18:41:59 +00:00
nilptr.go cmd/link: use >4GB base address for 64-bit PE binaries 2025-05-12 11:05:28 -07:00
nilptr2.go
nilptr3.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
nilptr4.go
nilptr5.go cmd/compile: duplicate nil check to two branches of write barrier 2025-09-19 07:13:32 -07:00
nilptr5_aix.go cmd/compile: duplicate nil check to two branches of write barrier 2025-09-19 07:13:32 -07:00
nilptr5_wasm.go cmd/compile: duplicate nil check to two branches of write barrier 2025-09-19 07:13:32 -07:00
nilptr_aix.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
noinit.go cmd/compile: reenable inline static init 2023-04-14 17:57:36 +00:00
nosplit.go Revert "cmd/compile: redo arm64 LR/FP save and restore" 2025-10-07 08:21:14 -07:00
nowritebarrier.go cmd/compile: redo IsRuntimePkg/IsReflectPkg predicate 2023-08-22 19:18:21 +00:00
nul1.go
opt_branchlikely.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
parentype.go
peano.go
phiopt.go cmd/compile: add 2 phiopt cases 2025-05-08 10:18:37 -07:00
print.go
print.out runtime: use internal/strconv 2025-10-29 11:00:23 -07:00
printbig.go
printbig.out
prove.go cmd/compile/internal/ssa: model right shift more precisely 2025-10-30 09:17:59 -07:00
prove_constant_folding.go cmd/compile/internal/ssa: model right shift more precisely 2025-10-30 09:17:59 -07:00
prove_invert_loop_with_unused_iterators.go cmd/compile: make prove understand div, mod better 2025-10-29 18:49:40 -07:00
prove_popcount.go cmd/compile: compute bits.OnesCount's limits from argument's limits 2025-03-11 20:17:36 -07:00
range.go
range2.go internal/goexperiment: delete RangeFunc goexperiment 2025-07-29 12:44:58 -07:00
range3.go cmd/compile: fix typecheck range over rune literal 2023-12-01 17:20:08 +00:00
range4.go internal/goexperiment: delete RangeFunc goexperiment 2025-07-29 12:44:58 -07:00
rangegen.go internal/goexperiment: delete RangeFunc goexperiment 2025-07-29 12:44:58 -07:00
README.md internal/testdir: move to cmd/internal/testdir 2023-05-12 17:18:08 +00:00
recover.go
recover1.go
recover2.go
recover3.go
recover4.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
recover5.go
reflectmethod1.go
reflectmethod2.go
reflectmethod3.go
reflectmethod4.go
reflectmethod5.go
reflectmethod6.go
reflectmethod7.go all: use reflect.{Pointer,PointerTo} 2021-10-26 14:24:17 +00:00
reflectmethod8.go [dev.typeparams] cmd/compile: fix missing condition in usemethod 2021-07-22 17:48:41 +00:00
rename.go
rename1.go cmd/compile/internal/types2: only mark variables as used if they are 2023-04-19 14:07:00 +00:00
reorder.go [dev.regabi] cmd/compile: cleanup OAS2FUNC ordering 2021-01-16 23:19:26 +00:00
reorder2.go
retjmp.go
return.go
rotate.go
rotate0.go
rotate1.go
rotate2.go
rotate3.go
rune.go
runtime.go
shift1.go test: re-enable a bunch of tests with types2 2021-12-03 16:24:32 +00:00
shift2.go
shift3.go cmd/compile: adjust types2 shift check to match go/types (cleanup) 2022-04-07 17:19:55 +00:00
sieve.go
sigchld.go test: migrate remaining files to go:build syntax 2023-10-19 23:33:25 +00:00
sigchld.out
simassign.go
sizeof.go
slice3.go
slice3err.go
slicecap.go
sliceopt.go
solitaire.go
stack.go
stackobj.go
stackobj2.go
stackobj3.go
strcopy.go
strength.go
string_lit.go
stringrange.go
struct0.go
switch.go [dev.unified] test: add switch test case for tricky nil handling 2022-07-19 23:30:49 +00:00
switch2.go cmd/compile: better error message when offending/missing token is a keyword 2024-11-14 02:14:13 +00:00
switch3.go
switch4.go
switch5.go
switch6.go cmd/compile: use "missing method m" instead of "missing m method" 2022-09-24 17:04:15 +00:00
switch7.go
tailcall.go Revert "cmd/compile: Enable inlining of tail calls" 2025-06-04 08:27:44 -07:00
tighten.go cmd/compile: pair loads and stores on arm64 2025-02-13 14:07:47 -08:00
tinyfin.go
torture.go
turing.go
typecheck.go test: re-enable most go/tests that were disabled because of types2 differences 2022-01-11 02:26:58 +00:00
typecheckloop.go cmd/compile: use "init... cycle" instead of "init... loop" in error messages 2022-09-23 20:27:09 +00:00
typeswitch.go
typeswitch1.go
typeswitch2.go
typeswitch2b.go go/types, types2: use "and not used" instead of "but not used" in error messages 2022-09-27 21:10:19 +00:00
typeswitch3.go cmd/compile/internal/types2: better error for type assertion/switch on type parameter value 2021-11-12 22:20:51 +00:00
uintptrescapes.go
uintptrescapes2.go cmd/compile: call generated size-specialized malloc functions directly 2025-10-09 14:59:40 -07:00
uintptrescapes3.go
uintptrkeepalive.go cmd/compile: add //go:uintptrkeepalive 2022-04-21 18:06:38 +00:00
undef.go
unsafe_slice_data.go cmd/compile: add support for unsafe.{String,StringData,SliceData} 2022-08-31 17:15:15 +00:00
unsafe_string.go cmd/compile: add support for unsafe.{String,StringData,SliceData} 2022-08-31 17:15:15 +00:00
unsafe_string_data.go cmd/compile: add support for unsafe.{String,StringData,SliceData} 2022-08-31 17:15:15 +00:00
unsafebuiltins.go cmd/compile: add support for unsafe.{String,StringData,SliceData} 2022-08-31 17:15:15 +00:00
used.go cmd/compile/internal: support new(expr) 2025-09-23 13:12:12 -07:00
utf.go
varerr.go
varinit.go
wasmexport.go cmd/compile: add basic wasmexport support 2024-08-09 20:07:54 +00:00
wasmexport2.go cmd/compile: allow more types for wasmimport/wasmexport parameters and results 2024-11-11 17:11:50 +00:00
wasmmemsize.go test: add a test for wasm memory usage 2024-10-28 13:27:58 +00:00
weak.go weak: prevent unsafe conversions using weak pointers 2025-02-06 13:16:59 -08:00
winbatch.go
writebarrier.go cmd/compile: don't emit write barriers for offsets of global addresses 2021-08-23 19:46:36 +00:00
zerodivide.go all: use bytes.Cut, strings.Cut 2021-10-06 15:53:04 +00:00
zerosize.go cmd/link: put zero-sized data symbols at same address as runtime.zerobase 2023-04-28 18:35:43 +00:00

The test directory contains tests of the Go tool chain and runtime. It includes black box tests, regression tests, and error output tests. They are run as part of all.bash.

To run just these tests, execute:

../bin/go test cmd/internal/testdir

To run just tests from specified files in this directory, execute:

../bin/go test cmd/internal/testdir -run='Test/(file1.go|file2.go|...)'

Standard library tests should be written as regular Go tests in the appropriate package.

The tool chain and runtime also have regular Go tests in their packages. The main reasons to add a new test to this directory are:

  • it is most naturally expressed using the test runner; or
  • it is also applicable to gccgo and other Go tool chains.