aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Findley <rfindley@google.com>2021-03-03 19:59:48 -0500
committerRob Findley <rfindley@google.com>2021-03-04 11:08:34 -0500
commit8f19f8a9e13a2b065b49acfc72e52a2f6262f221 (patch)
treeeddd089275050046d22d7bbc2bd0cb2c71b08a2b
parent356c1719ec430d55da2bb86dce114926867773f5 (diff)
parent12bb256cb30a76b540dbbc1cac38d7044facfa29 (diff)
downloadgo-8f19f8a9e13a2b065b49acfc72e52a2f6262f221.tar.gz
go-8f19f8a9e13a2b065b49acfc72e52a2f6262f221.zip
[dev.go2go] all: merge master (12bb256) into dev.go2go
Included in this merge are CL 293010 switching to a new ast.ListExpr for type argument lists (instead of overloading CallExpr), and CL 295929 partially hiding the new type parameter API. As a result of those two CLs, the following changes were made to fix the go2go tool: + Update the go2go rewriter for the new syntax. + Update test cases to eliminate some remaining '()' syntax for type argument lists. + Add new files exposing the now-hidden API. These changes can be reviewed by comparing the latest patchset to patchset 1. Merge List: + 2021-03-04 12bb256cb3 go/types: use correct recv for parameterized embedded methods + 2021-03-03 6db80d7420 cmd/compile/internal/types2: use correct recv for parameterized embedded methods + 2021-03-03 d6f6ef6358 cmd/compile: remove races introduced in abiutils field update + 2021-03-03 3e524ee65a cmd/compile: make modified Aux type for OpArgXXXX pass ssa/check + 2021-03-03 9f33dc3ca1 cmd/compile: handle aggregate OpArg in registers + 2021-03-03 c4e3f6c4c7 cmd/compile: remove 8-byte alignment requirement of stack slot on s390x + 2021-03-03 85f62b0941 cmd/compile: remove 8-byte alignment requirement of stack slot on mips + 2021-03-03 497feff168 cmd/compile: intrinsify runtime/internal/atomic.{And,Or}{8,} on RISCV64 + 2021-03-03 00cb841b83 syscall: implement rawVforkSyscall for remaining linux platforms + 2021-03-03 f2df1e3c34 cmd/compile: retrieve Args from registers + 2021-03-03 06c72f3627 A+C: change email address for Baokun Lee + 2021-03-03 84ca4949a7 cmd/compile: remove 8-byte alignment requirement of stack slot on mips64 + 2021-03-03 77973863c3 cmd/compile: use abiutils for all rcvr/in/out frame offsets. + 2021-03-03 aea1259a72 cmd/link: disable flaky Darwin "symbols" test + 2021-03-02 312fd9937d cmd/go: remove -insecure flag on go get + 2021-03-02 2a2f99eefb cmd/go/internal/modload: do not resolve an arbitrary version for 'go list --versions' + 2021-03-02 b65091c11d cmd/go: add a test case that reproduces #44296 + 2021-03-02 e9eed78dc3 cmd/go: resolve std-vendored dependencies as std packages except in 'go get' and 'go mod' + 2021-03-02 09f4ef4fa7 cmd/go/internal/mvs: prune spurious dependencies in Downgrade + 2021-03-02 c6374f5162 dist: generate stub go.mod in workdir + 2021-03-02 97b32a6724 cmd/compile: better version of check frame offsets against abi + 2021-03-02 2b50ab2aee cmd/compile: optimize single-precision floating point square root + 2021-03-02 ebb92dfed9 internal/poll, runtime: handle netpollopen error in poll_runtime_pollOpen + 2021-03-02 4c1a7ab49c cmd/go: reject relative paths in GOMODCACHE environment + 2021-03-02 580636a78a all: fix spelling + 2021-03-02 a6eeb4add4 go/parser,go/types: hide API changes related to type parameters + 2021-03-02 ff5cf4ced3 cmd/link,debug/elf: mips32, add .gnu.attributes and .MIPS.abiflags sections + 2021-03-01 700b73975e runtime: use entersyscall in syscall_syscallX on Darwin + 2021-03-01 a69c45213d go/types: review of expr.go + 2021-03-01 b98ce3b606 cmd/compile: import empty closure function correctly + 2021-03-01 97bdac03ae cmd: upgrade golang.org/x/mod to relax import path check + 2021-03-01 f6a74c6568 cmd/compile/internal/ir: fix up stale comment + 2021-03-01 87beecd6df cmd/go: add missing newline to retraction warning message + 2021-03-01 a400eb3261 Revert "cmd/compile: check frame offsets against abi" + 2021-03-01 5fafc0bbd4 cmd/go/internal/modload: don't query when fixing canonical versions + 2021-03-01 2a8df4488e os: mark pipes returned by os.Pipe() as inheritable by default + 2021-02-27 5ff7ec98b7 cmd/compile: check frame offsets against abi + 2021-02-27 a429926159 cmd/compile: fix escape analysis of heap-allocated results + 2021-02-27 998fe70b68 cmd/compile: fixed which-result confusion in presence of 0-width types + 2021-02-27 d9fd38e68b time: correct unusual extension string cases + 2021-02-26 cda8ee095e reflect: fix register ABI spill space calculation + 2021-02-26 d8e33d558e cmd/compile: deal with closures in generic functions and instantiated function values + 2021-02-26 19f96e73bf syscall: introduce SysProcAttr.ParentProcess on Windows + 2021-02-26 3146166baa syscall: introduce SysProcAttr.AdditionalInheritedHandles on Windows + 2021-02-26 2d760816ff syscall: restrict inherited handles on Windows + 2021-02-26 ba9168bd07 syscall: add support for proc thread attribute lists + 2021-02-26 f41460145e cmd/link: recognize ARM64 PE files and relocations + 2021-02-26 a655208c9e cmd/link: handle types as converted to interface when dynlink + 2021-02-26 23943a6737 cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in go/defer + 2021-02-26 e25040d162 cmd/compile: change StaticCall to return a "Results" + 2021-02-26 9a555fc24c cmd/compile: fix missing descend in Addrtaken for closures. + 2021-02-25 a61524d103 cmd/internal/obj: add Prog.SetFrom3{Reg,Const} + 2021-02-25 5f15af111c syscall: comment on fields omitted from the win32finddata1 struct + 2021-02-25 9a7fe196e4 Revert "cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in go/defer" + 2021-02-25 b83d073e9e reflect: add Method.IsExported and StructField.IsExported methods + 2021-02-25 7fcf9893f7 cmd/internal/obj: fix typo in docs + 2021-02-25 6c3bcda866 cmd/compile: declare inlined result params early for empty returns + 2021-02-25 526ee96f49 os: avoid allocation in File.WriteString + 2021-02-25 194b636f8f database/sql: close driver.Connector if it implements io.Closer + 2021-02-25 4ebb6f5110 cmd/compile: automate resultInArg0 register checks + 2021-02-25 1a3e968b1f cmd/compile: fix mishandling of unsafe-uintptr arguments with call method in go/defer + 2021-02-25 ee2a45e5fb runtime: use pipe2 for nonblockingPipe on dragonfly + 2021-02-25 1f7a01459b runtime: batch moving gFree list between local p and global schedt + 2021-02-25 bcac57f89c cmd: upgrade golang.org/x/mod to fix go.mod parser + 2021-02-25 3137da82fd cmd/go: add a script test corresponding to the downhiddenartifact MVS test + 2021-02-25 2c4c189bba cmd/go/internal/mvs: add test cases for downgrade interaction with hidden versions + 2021-02-25 9fe8ebf9b4 test: add test case that failed with gccgo + 2021-02-25 ad17b65b34 testing/fstest: treat dash specially when building glob + 2021-02-25 37ca84a9cd syscall: return error if GetQueuedCompletionStatus truncates key + 2021-02-25 76c0003cd5 syscall, os: use pipe2 syscall on DragonflyBSD instead of pipe + 2021-02-25 666ad85df4 cmd/compile: fix typo in rewrite_test.go + 2021-02-25 d822ffebc5 test: fix inline.go test for linux-amd64-noopt + 2021-02-25 ff614b13d9 runtime: subtract one from ip when determining abort + 2021-02-24 dbbc5ec7e8 syscall: restore broken GetQueuedCompletionStatus signature but make it not crash + 2021-02-24 d0d21b7c4c cmd/compile: plumb abi info into expandCalls + 2021-02-24 8027343b63 cmd/compile: disable inlining functions with closures for now + 2021-02-24 6c3f8a2f47 cmd/link: use ctxt.Logf instead of package log + 2021-02-24 3ee32439b5 cmd/compile: ARM64 optimize []float64 and []float32 access + 2021-02-24 80ddc17ae1 cmd/compile/internal-abi: fix ABI0-equivalence for zero-sized values + 2021-02-24 3deb528199 cmd/compile/internal-abi: update internal ABI spec for g register + 2021-02-24 478277f812 cmd/compile/internal-abi: use x87 mode, not MMX mode + 2021-02-24 bf48163e8f cmd/compile: add rule to coalesce writes + 2021-02-24 b7f62daa59 cmd/internal/goobj: add test case for object file reader + 2021-02-24 c9d9b40b13 context: avoid importing context package twice + 2021-02-24 dc4698f52b syscall: do not overflow key memory in GetQueuedCompletionStatus + 2021-02-24 7a2f3273c5 cmd/compile: plumb abi info into ssagen/ssa + 2021-02-24 adb467ffd2 cmd/compile: reduce inline cost of OCONVOP + 2021-02-24 27684ea195 testing: print late arriving log line in panic + 2021-02-24 ae1fa08e41 context: reduce contention in cancelCtx.Done + 2021-02-24 691ac806d2 cmd/go: fix version validation in 'go mod edit -exclude' + 2021-02-24 b97b1456ae cmd/go, cmd/cgo: pass -mfp32 and -mhard/soft-float to MIPS GCC + 2021-02-24 07c658316b io/ioutil: forward TempFile and TempDir to os package + 2021-02-24 04edf418d2 encoding/json: reduce allocated space in Unmarshal + 2021-02-24 e496120891 database: remove race in TestTxContextWait + 2021-02-24 26001d109e go/types: review of call.go + 2021-02-24 35b80eac7d hash/maphash: remove duplicate from Hash documentation + 2021-02-24 eb863240dc runtime: remove unused const stackSystem on dragonfly + 2021-02-24 084b07d6f6 spec: improve sentence structure for passing a slice + 2021-02-24 6ba4a300d8 docs: fix spelling + 2021-02-24 43652dc46f bufio, bytes, strings: handle negative runes in WriteRune + 2021-02-24 3780529255 unicode: correctly handle negative runes + 2021-02-24 0694fb3d78 image: resolve the TODO of doc comment style + 2021-02-23 6cc8aa7ece go/types: minor updates to comments to align with types2 + 2021-02-23 42b9e3a8df context: fix XTestInterlockedCancels + 2021-02-23 aaed6cbced testing/race: fixing intermittent test failure + 2021-02-23 fbed561f8a runtime: reset stack poison flag accidentally set + 2021-02-23 0458d8c983 go/types, types2: constraints may be parenthesized and that includes "any" + 2021-02-23 74903553bc doc: start draft go1.17 release notes, move go1.16 to x/website + 2021-02-23 fa40c0232c cmd/go: reproduce issue #44497 in TestScript/mod_edit + 2021-02-23 a4dac8bd22 runtime: use BX instead of R15 in race detector + 2021-02-23 c49c7a675a runtime: save R15 before checking AVX state + 2021-02-23 d2911d7612 cmd/compile: fold MOV*nop and MOV*const + 2021-02-23 d434c2338b runtime: clarify GC fractional mode description + 2021-02-23 a671e33c6d all: use more precise build tags + 2021-02-23 c584f42dcf cmd/compile: change riscv64 Eq32/Neq32 to zero extend before subtraction + 2021-02-23 080119799b runtime: fix usleep on windows/arm + 2021-02-23 74cac8d479 cmd/compile: add AMD64 parameter register defs, Arg ops, plumb to ssa.Config + 2021-02-23 42cd40ee74 cmd/compile: improve bit test code + 2021-02-23 f1562c7610 cmd/go: recognize DLL magic from llvm binaries + 2021-02-23 bf5fa2d198 cmd/compile: guard special register usage with GOEXPERIMENT=regabi + 2021-02-23 c7f596f919 cmd/go: resolve TODO by replacing InDir() function + 2021-02-23 5e94fe9316 go/build/constraint: fix splitPlusBuild func doc comment + 2021-02-23 55d7dcc3cd runtime: optimize the memory padding in p struct + 2021-02-23 ab331c0254 runtime/cgo: use correct lean and mean macro + 2021-02-23 91cfbf39e4 cmd/link: set .ctors COFF section to writable and aligned + 2021-02-23 811167e2c9 cmd/link: do not pass -Bsymbolic for PE DLLs + 2021-02-23 a51daac840 cmd/link: set SizeOfRawData rather than VirtualSize in COFF files for .bss section + 2021-02-23 e5159b2a2f cmd/internal/dwarf: minor cleanups + 2021-02-23 b3b65f2176 runtime: enable race detector on openbsd/amd64 + 2021-02-23 a78b0e6721 internal/poll: fix the verbose condition in splice + 2021-02-23 08543f0715 ios/fs: mention f.dir in (*subFS).fixErr godoc + 2021-02-23 0398a771d2 cmd/internal/obj/riscv: prevent constant loads that do not target registers + 2021-02-23 6525abddce cmd/internal/obj/riscv: clean up branch tests + 2021-02-23 c4b771348c runtime: fix windows/arm signal handling assembly + 2021-02-23 2a18e37c4e cmd/compile: remove backend's "scratch mem" support + 2021-02-23 e52149822b cmd/compile: simplify assert{E,I}2I{,2} calling conventions + 2021-02-23 86deb459de cmd/compile: remove selectnbrecv2 + 2021-02-23 4048491234 cmd/compile,runtime: make selectnbrecv return two values + 2021-02-23 5e804ba17d cmd/compile: use transitive relations for slice len/cap in poset + 2021-02-23 6a40dd05d8 cmd/compile/internal/types2: review of sanitize.go + 2021-02-23 975ba6e2b2 cmd/compile: mark OpSB, OpSP as poor statement Op + 2021-02-23 a2e150c7cd go/types, cmd/compile/internal/types2: use regular type printing for unsafe.Pointer + 2021-02-23 5a0e4fc4e7 cmd/compile/internal/types2: review of conversions.go + 2021-02-23 89eb2b55b9 cmd/compile/internal/types2: review of issues_test.go + 2021-02-23 378f73e2d5 cmd/compile/internal/types2: enable TestIssue25627 + 2021-02-23 1901e2647f test: add test for findTypeLoop with symbols from other packages + 2021-02-23 5f3dabbb79 cmd/compile: fix import of functions of multiple nested closure + 2021-02-23 7af821a661 all: faster midpoint computation in binary search + 2021-02-23 f113e9a14f cmd/dist: match goexperiment.regabi tag when GOEXPERIMENT is on + 2021-02-22 1126bbb82a go/parser: return ast.BadExpr for missing index operands + 2021-02-22 1678829d95 cmd/compile: correctly use X15 to zero frame + 2021-02-22 094048b938 cmd/compile/internal: loop opt + 2021-02-22 1391d4142c fix typo in issue16760.go + 2021-02-22 04903476fe cmd/compile: reject some rare looping CFGs in shortcircuit + 2021-02-22 87e984ab29 test: add test for issue 38698 + 2021-02-22 b2bdadfe88 cmd/internal: cleanup ppc64 optab structure + 2021-02-21 0f66fb7b85 go/internal/gccgoimporter: fix up gccgo installation test + 2021-02-21 e78e04ce39 cmd/compile: fix panic in DWARF-gen handling obfuscated code + 2021-02-20 03d36d8198 syscall: add explicit ios build tag + 2021-02-20 40656f3a75 doc/1.16: fix link to fs.FileInfo + 2021-02-20 d4b2638234 all: go fmt std cmd (but revert vendor) + 2021-02-20 0625460f79 cmd/vet: update buildtag check for //go:build lines + 2021-02-20 9fd6cc105d go/printer: canonicalize //go:build and // +build lines while formatting + 2021-02-20 5b76343a10 go/build: prefer //go:build over // +build lines + 2021-02-20 a8942d2cff runtime/pprof: disable TestMorestack on darwin/arm64 + 2021-02-20 078f08f0ee spec: every type has a method set (minor clarification) + 2021-02-19 26713b5fef go/types: don't write during sanitizeInfo if nothing has changed + 2021-02-19 9a99515c8f all: REVERSE MERGE dev.typeparams (7cdfa49) into master + 2021-02-19 7cdfa4969a [dev.typeparams] all: merge master (06b86e9) into dev.typeparams + 2021-02-19 6521c7b378 [dev.typeparams] cmd/compile/internal/types2: resolve decl cycle the same way as in go/types + 2021-02-19 06b86e9803 cmd/compile: fix check to avoid creating new closure function when typechecking inline body + 2021-02-19 9322eec8a2 codereview.cfg: add codereview.cfg for master branch + 2021-02-19 02e5a8fdfc runtime: ignore SPWRITE in syscall functions + 2021-02-19 fa18f224c3 runtime/pprof: disable TestMorestack on macOS under race detector + 2021-02-19 01eb70e3dd os: fix hex exit code print on 32-bit windows + 2021-02-19 49add6ad90 runtime: fix spurious stack overflow detection + 2021-02-19 fce2a94d84 cmd/compile: fix buglet in inlined info abstract function dwarf-gen + 2021-02-19 dfe0ef961b [dev.typeparams] go/types, types2: revert fancy struct printing (fixes x/tools tests) + 2021-02-19 7764ee5614 runtime: fix invalid nil g check for for mips64x + 2021-02-19 2f37939a21 go/parser: improve error recovery from invalid selector exprs + 2021-02-19 8654db4555 [dev.typeparams] go/types: adjust printing of embedded struct fields (fixes x/tools/cmd/guru tests) + 2021-02-19 87f425da14 cmd/go/internal/mvs: split Reqs into narrower per-function interfaces + 2021-02-19 4da0188c6c cmd/go/internal/modget: split resolveCandidates into two methods + 2021-02-19 5f2e24efb3 cmd/internal/diff: skip over Cygwin warning in diff output + 2021-02-19 ee7038f6a5 net: disable Windows netsh tests when netsh won't run + 2021-02-19 40765ffa95 os/exec: disable failing LookPathTest on windows/arm64 + 2021-02-19 b445d6ea34 runtime/pprof: expect tests to pass on macOS + 2021-02-19 b110a43628 runtime: delete gosave (dead code) + 2021-02-19 474d5f4f4d math: remove most 387 implementations + 2021-02-19 c7c6c113be runtime: convert windows/arm64 assembly + 2021-02-19 3527caa7d6 runtime: initial windows/arm64 implementation files + 2021-02-19 427bd7599d runtime: generate windows/arm64 callback asm + 2021-02-19 f6c4b4bf96 syscall: add windows/arm64 support + 2021-02-19 ac024a0c7b cmd/vendor: get golang.org/x/sys@beda7e5e158 + 2021-02-19 a3b97e7628 test: disable nilptr on windows/arm64 + 2021-02-19 985d087782 cmd/link: add windows/arm64 support + 2021-02-19 95a44d2409 cmd/internal/objfile: recognize Windows ARM64 executables + 2021-02-19 0ca0551f02 debug/pe: recognize arm64 executables + 2021-02-19 47e4b0739e Merge "[dev.typeparams] all: merge master (eb98272) into dev.typeparams" into dev.typeparams + 2021-02-19 0c633125f2 cmd/dist: add windows/arm64 support + 2021-02-19 bb6efb9609 build: set GOPATH consistently in run.bash, run.bat, run.rc + 2021-02-19 a1222b7535 cmd/link: add debug print in deadcode + 2021-02-19 1c659f2525 cmd/link: clean up windows PE generation + 2021-02-19 b6379f190b syscall: clean up windows a bit + 2021-02-19 09e059afb1 runtime: enable framepointer on all arm64 + 2021-02-19 b19e7b518e runtime: clean up windows a bit + 2021-02-19 5421c37a1d runtime: fix windows/arm externalthreadhandler + 2021-02-19 91cc484ea9 runtime: fix time on windows/arm under WINE + 2021-02-19 38672d3dcf runtime: crash earlier on windows for runtime.abort + 2021-02-19 a1e9148e3d runtime: print hex numbers with hex prefixes in traceback debug + 2021-02-19 75e273fc2c runtime: fix windows/arm CONTEXT_CONTROL + 2021-02-19 76ab626bfc runtime: factor common code out of defs_windows_*.go + 2021-02-19 ece954d8b8 runtime: find g in Windows profiler using SP + 2021-02-19 a54f7fc0fd runtime: do not treat asmcgocall as a topofstack on g0 + 2021-02-19 776ee4079a runtime: do not treat morestack as a topofstack + 2021-02-19 5ecd9e34df runtime: do not treat mcall as a topofstack + 2021-02-19 54da3ab385 runtime: use TOPFRAME to identify top-of-frame functions + 2021-02-19 fbe74dbf42 runtime: use FuncInfo SPWRITE flag to identify untraceable profile samples + 2021-02-19 4dd77bdc91 cmd/asm, cmd/link, runtime: introduce FuncInfo flag bits + 2021-02-19 aa0388f2ed runtime: remove unnecessary writes to gp.sched.g + 2021-02-19 6fe8981620 cmd/internal/obj/riscv: fix JMP name<>(SB) + 2021-02-19 01f05d8ff1 runtime: unify asmcgocall and systemstack traceback setup + 2021-02-19 229695a283 runtime: clean up funcID assignment + 2021-02-19 c80da0a33a runtime: handle nil gp in cpuprof + 2021-02-19 a78879ac67 runtime: move sys.DefaultGoroot to runtime.defaultGOROOT + 2021-02-19 8ac23a1f15 runtime: document, clean up internal/sys + 2021-02-19 678568a5cf runtime: delete windows setlasterror (unused) + 2021-02-19 0d94f989d1 runtime: clean up system calls during cgo callback init + 2021-02-19 e7ee3c1fa8 os: report Windows exit status in hex + 2021-02-18 a789be7814 [dev.typeparams] cmd/compile: use new converter functions rather than methods (fix build) + 2021-02-18 20050a15fe [dev.typeparams] cmd/compile: support generic types (with stenciling of method calls) + 2021-02-18 e7493a9c74 [dev.typeparams] all: merge master (eb98272) into dev.typeparams + 2021-02-18 2ff1e05a4c [dev.typeparams] all: update parent repository + 2021-02-18 eb982727e3 cmd/go/internal/mvs: fix Downgrade to match Algorithm 4 + 2021-02-18 3b7277d365 cmd/go: add a script test for artifacts resulting from 'go get -u' + 2021-02-18 8960ce7735 [dev.typeparams] cmd/compile/internal/types2: minor adjustments to match go/types more closely + 2021-02-18 6f3878b942 [dev.typeparams] cmd/compile/internal/types: review of typestring_test.go + 2021-02-18 d6bdd1aeef [dev.typeparams] cmd/compile/internal/types: review of typestring.go + 2021-02-18 c2314babb8 [dev.typeparams] cmd/compile/internal/types: review of type.go + 2021-02-18 099374b55e [dev.typeparams] cmd/compile/internal/types2: remove Type.Under method in favor of function + 2021-02-18 653386a89a [dev.typeparams] cmd/compile/internal/types2: replace Named, TypeParam methods with functions + 2021-02-18 5e4da8670b [dev.typeparams] cmd/compile/internal/types2: use converter functions rather than methods + 2021-02-18 5ecb9a7887 [dev.typeparams] go/types: use a new ast.ListExpr for multi-type instances + 2021-02-18 f3c2208e2c cmd/go: add script tests for potential upgrades due to downgrades + 2021-02-18 a5c8a15f64 cmd/go/internal/mvs: clarify and annotate test cases + 2021-02-18 a76efea1fe cmd/go/internal/mvs: don't emit duplicates from Req + 2021-02-18 609d82b289 cmd/dist: set GOARM=7 for windows/arm + 2021-02-18 7b679617f3 [dev.typeparams] go/types: conversions to type parameters are not constant + 2021-02-18 f0be3cc547 runtime: unbreak linux/riscv64 following regabi merge + 2021-02-18 07ef313525 runtime/cgo: add cast in C code to avoid C compiler warning + 2021-02-17 f5d0c653e6 [dev.typeparams] merge master (2f0da6d) into dev.typeparams + 2021-02-17 e196cb8258 [dev.typeparams] cmd/dist: disable -G=3 on the std go tests for now + 2021-02-17 2f0da6d9e2 go/types: revert "no 'declared but not used' errors for invalid var decls" + 2021-02-17 70c37ee7d0 cmd/compile/internal/test: gofmt abiutils_test.go + 2021-02-16 84825599dc all: merge branch dev.regabi (d3cd4830ad) into master + 2021-02-16 d3cd4830ad [dev.regabi] test: run abi/regabipragma test with -c=1 + 2021-02-16 03cea563d1 [dev.regabi] all: merge master (5faf941) into dev.regabi + 2021-02-16 b8fb049c7a [dev.regabi] cmd/go: copy internal/abi in TestNewReleaseRebuildsStalePackagesInGOPATH + 2021-02-16 5faf941df0 internal/goversion: update Version to 1.17 + 2021-02-16 ed55da46ab [dev.regabi] go/types: overlapping embedded interfaces requires go1.14 + 2021-02-16 7696c94334 [dev.regabi] go/types: type alias decl requires go1.9 + 2021-02-16 c2358a1ae7 [dev.regabi] runtime: stub out spillArgs and unspillArgs + 2021-02-16 8cfbf34dd9 internal/abi: set register count constants to zero for regabi experiment + 2021-02-16 6f3da9d2f6 README: pull gopher image from website + 2021-02-16 d28aae26b0 [dev.regabi] cmd/link: recognize internal/abi as runtime package + 2021-02-16 098504c73f cmd/link: generate trampoline for inter-dependent packages + 2021-02-16 1004a7cb31 runtime/metrics: update documentation to current interface + 2021-02-16 6530f2617f doc/go1.16: remove draft notice + 2021-02-16 353e111455 doc/go1.16: fix mismatched id attribute + 2021-02-16 e0215315f5 [dev.regabi] reflect: support for register ABI on amd64 for reflect.(Value).Call + 2021-02-16 f0d23c9dbb internal/poll: netpollcheckerr before sendfile + 2021-02-16 0cb3415154 doc: remove all docs not tied to distribution + 2021-02-16 626ef08127 doc: remove install.html and install-source.html + 2021-02-16 30641e36aa internal/poll: if copy_file_range returns 0, assume it failed + 2021-02-15 33d72fd412 doc/faq: update generics entry to reflect accepted proposal + 2021-02-15 852ce7c212 cmd/go: provide a more helpful suggestion for "go vet -?" + 2021-02-13 66c27093d0 cmd/link: fix typo in link_test.go + 2021-02-13 b81efb7ec4 [dev.regabi] go/types: add support for language version checking + 2021-02-13 a7e9b4b948 [dev.regabi] go/types: untyped shift counts must fit into uint + 2021-02-13 060fa49bd2 [dev.regabi] go/types: refuse excessively long constants + 2021-02-12 a06bd9fecb [dev.typeparams] cmd/compile/internal/types: review of resolver_test.go + 2021-02-12 042f88fe30 [dev.typeparams] cmd/compile/internal/types: review of errors_test.go + 2021-02-12 0abd7b768b [dev.typeparams] cmd/compile/internal/types: review of universe.go + 2021-02-12 1b6f0bf1b2 [dev.typeparams] cmd/compile/internal/types: review of sizes_test.go + 2021-02-12 1758780181 [dev.typeparams] cmd/compile/internal/types: review of sizes.go + 2021-02-12 3aee461d5c [dev.typeparams] cmd/compile/internal/types: review of return.go + 2021-02-12 7428318af6 [dev.typeparams] cmd/compile/internal/types: review of object_test.go + 2021-02-12 b20f9e2da1 [dev.typeparams] cmd/compile/internal/types: review of object.go + 2021-02-12 20746b2f37 [dev.typeparams] cmd/compile/internal/types: review of labels.go + 2021-02-12 bab3461123 [dev.typeparams] cmd/compile/internal/types: review of infer.go + 2021-02-12 9168590977 [dev.typeparams] cmd/compile/internal/types: review of builtin_test.go + 2021-02-12 f1777cf84c [dev.typeparams] cmd/compile/internal/types: review of builtin.go + 2021-02-12 baa6c75dce [dev.regabi] internal/abi: add new internal/abi package for ABI constants + 2021-02-12 d1fd9a8863 [dev.regabi] all: merge master (ff0e93e) into dev.regabi + 2021-02-12 ff0e93ea31 doc/go1.16: note that package path elements beginning with '.' are disallowed + 2021-02-12 0f43973b4b [dev.typeparams] go/types: make predeclared "any" alias for interface{} + 2021-02-12 58758e0a21 [dev.typeparams] go/types: better error message for invalid ... use + 2021-02-11 c0aa7bd760 [dev.typeparams] cmd/compile: small fixes for stenciling + 2021-02-11 249da7ec02 CONTRIBUTORS: update for the Go 1.16 release + 2021-02-11 864d4f1c6b cmd/go: multiple small 'go help' fixes + 2021-02-11 26ceae85a8 spec: More precise wording in section on function calls. + 2021-02-11 930c2c9a68 cmd/go: reject embedded files that can't be packed into modules + 2021-02-11 e5b08e6d5c io/fs: allow backslash in ValidPath, reject in os.DirFS.Open + 2021-02-10 df23540dde [dev.typeparams] cmd/gofmt: add the -G flag to allow generic code + 2021-02-10 ed8079096f cmd/compile: mark concrete call of reflect.(*rtype).Method as REFLECTMETHOD + 2021-02-10 ddec18cf82 [dev.typeparams] cmd/compile/internal/types2: overlapping embedded interfaces requires go1.14 + 2021-02-10 59703d53e2 [dev.regabi] cmd/link: stop using ABI aliases if wrapper is enabled + 2021-02-10 fdf3496fcc [dev.typeparams] cmd/compile: make type conversions by type parameters work + 2021-02-10 12e15d430d [dev.typeparams] cmd/compile: handle calling a method on a type param in stenciling + 2021-02-09 e9c9683597 cmd/go: suppress errors from 'go get -d' for packages that only conditionally exist + 2021-02-09 168d6a49a5 [dev.regabi] go/types: use 512 bits as max. integer precision + 2021-02-09 0a62067708 [dev.regabi] go/types: adjust importer to match compiler importer + 2021-02-09 1c58fcf7ed [dev.regabi] go/types: handle untyped constant arithmetic overflow + 2021-02-09 493363ccff [dev.regabi] go/types: must not import a package called "init" + 2021-02-09 e0ac989cf3 archive/tar: detect out of bounds accesses in PAX records resulting from padded lengths + 2021-02-09 c48d1503ba [dev.regabi] go/types: report unused packages in source order + 2021-02-09 813958f13c [dev.regabi] go/types: factor out sorting of methods + 2021-02-09 11d15c171b [dev.regabi] go/types: convert untyped arguments to delete + 2021-02-08 ca18c42054 [dev.typeparams] merge dev.regabi (618e3c1) into dev.typeparams + 2021-02-09 c9d6f45fec runtime/metrics: fix a couple of documentation typpos + 2021-02-09 cea4e21b52 io/fs: backslash is always a glob meta character + 2021-02-08 dc725bfb3c doc/go1.16: mention new vet check for asn1.Unmarshal + 2021-02-08 618e3c15bd [dev.regabi] go/types: consistently report nil type as "untyped nil" + 2021-02-08 a360eeb528 [dev.typeparams] cmd/compile/internal/types2: conversions to type parameters are not constant + 2021-02-08 0fbde54ea6 [dev.typeparams] cmd/compile: allow generic funcs to call other generic funcs for stenciling + 2021-02-08 50449de66a [dev.regabi] all: merge master (1901853) into dev.regabi + 2021-02-08 7b0dfb177f [dev.regabi] runtime: use g register in some assembly functions on AMD64 + 2021-02-08 2e60c00f56 [dev.regabi] cmd/internal/obj/x86: use g register in stack bounds check + 2021-02-08 22f9e1ccbc [dev.regabi] runtime: initialize special registers before sigpanic + 2021-02-08 5d7dc53888 [dev.regabi] cmd/compile, runtime: reserve R14 as g registers on AMD64 + 2021-02-08 1901853098 runtime/metrics: fix panic in readingAllMetric example + 2021-02-08 ed3e4afa12 syscall/plan9: remove spooky fd action at a distance + 2021-02-08 a21de9ec73 [dev.regabi] cmd/link: resolve symbol ABI in shared linkage + 2021-02-05 724d0720b3 doc/go1.16: add missed heading tag in vet section + 2021-02-05 b54cd94d47 embed, io/fs: clarify that leading and trailing slashes are disallowed + 2021-02-05 4516afebed testing/fstest: avoid symlink-induced failures in tester + 2021-02-05 8fa84772ba [dev.regabi] runtime: delete gosave function + 2021-02-05 946351d5a2 [dev.regabi] runtime: zero X15 in racecall + 2021-02-05 397a46a10a [dev.regabi] cmd/asm: define g register on AMD64 + 2021-02-05 e79c2fd428 [dev.regabi] runtime: mark racecallbackthunk as ABIInternal + 2021-02-05 7cc6de59f2 [dev.regabi] runtime: don't mark rt0_go ABIInternal + 2021-02-05 dcb5e0392e [dev.typeparams] cmd/compile: add stenciling of simple generic functions + 2021-02-05 63de211014 [dev.regabi] runtime/cgo: call setg_gcc in crosscall_amd64 + 2021-02-04 f37b0c6c12 [dev.typeparams] cmd/compile/internal/types2: type alias decl requires go1.9 + 2021-02-04 721488498a [dev.typeparams] cmd/compile: pass -lang flag value to new type checker + 2021-02-04 1ff2fdaaf1 [dev.typeparams] cmd/compile/internal/types2: add support for language version checking + 2021-02-04 370e9f5843 [dev.typeparams] cmd/compile/internal/types2: use 512 bits as max. integer precision + 2021-02-04 120b819f45 [dev.regabi] go/types: report error for invalid main function signature + 2021-02-04 52d5cb2822 [dev.regabi] cmd/internal/obj: access Attribute atomically + 2021-02-04 bc451b5770 [dev.regabi] go/types: port check_test.go ergonomics from dev.typeparams + 2021-02-04 afd67f3334 [dev.regabi] go/types: no "declared but not used" errors for invalid var decls + 2021-02-04 ca2f152893 [dev.typeparams] go/types: add missing test from dev.go2go + 2021-02-04 8869086d8f runtime: fix typo in histogram.go + 2021-02-03 401d7e5a24 [dev.regabi] cmd/compile: reserve X15 as zero register on AMD64 + 2021-02-03 bfc7418e6d [dev.regabi] runtime, syscall, etc.: mark Darwin syscall wrappers as ABIInternal + 2021-02-03 e491c6eea9 math/big: fix comment in divRecursiveStep Change-Id: Idc1fbc206629b016f7bb24c2066c2be9046a511a
-rw-r--r--AUTHORS2
-rw-r--r--CONTRIBUTORS160
-rw-r--r--README.md12
-rw-r--r--doc/articles/go_command.html254
-rw-r--r--doc/articles/index.html8
-rw-r--r--doc/articles/race_detector.html440
-rw-r--r--doc/articles/wiki/edit.html6
-rw-r--r--doc/articles/wiki/final-noclosure.go105
-rw-r--r--doc/articles/wiki/final-noerror.go56
-rw-r--r--doc/articles/wiki/final-parsetemplate.go94
-rw-r--r--doc/articles/wiki/final-template.go68
-rw-r--r--doc/articles/wiki/final.go92
-rw-r--r--doc/articles/wiki/final_test.go24
-rw-r--r--doc/articles/wiki/go.mod3
-rw-r--r--doc/articles/wiki/http-sample.go18
-rw-r--r--doc/articles/wiki/index.html741
-rw-r--r--doc/articles/wiki/notemplate.go59
-rw-r--r--doc/articles/wiki/part1-noerror.go35
-rw-r--r--doc/articles/wiki/part1.go38
-rw-r--r--doc/articles/wiki/part2.go44
-rw-r--r--doc/articles/wiki/part3-errorhandling.go76
-rw-r--r--doc/articles/wiki/part3.go60
-rw-r--r--doc/articles/wiki/test_Test.txt.good1
-rw-r--r--doc/articles/wiki/test_edit.good6
-rw-r--r--doc/articles/wiki/test_view.good5
-rw-r--r--doc/articles/wiki/view.html5
-rw-r--r--doc/articles/wiki/wiki_test.go165
-rw-r--r--doc/cmd.html100
-rw-r--r--doc/codewalk/codewalk.css234
-rw-r--r--doc/codewalk/codewalk.js305
-rw-r--r--doc/codewalk/codewalk.xml124
-rw-r--r--doc/codewalk/codewalk_test.go52
-rw-r--r--doc/codewalk/functions.xml105
-rw-r--r--doc/codewalk/markov.go130
-rw-r--r--doc/codewalk/markov.xml307
-rw-r--r--doc/codewalk/pig.go121
-rw-r--r--doc/codewalk/popout.pngbin213 -> 0 bytes
-rw-r--r--doc/codewalk/sharemem.xml181
-rw-r--r--doc/codewalk/urlpoll.go116
-rw-r--r--doc/contribute.html1294
-rw-r--r--doc/debugging_with_gdb.html554
-rw-r--r--doc/diagnostics.html472
-rw-r--r--doc/editors.html33
-rw-r--r--doc/effective_go.html3673
-rw-r--r--doc/gccgo_contribute.html112
-rw-r--r--doc/gccgo_install.html533
-rw-r--r--doc/go-logo-black.pngbin8843 -> 0 bytes
-rw-r--r--doc/go-logo-blue.pngbin9360 -> 0 bytes
-rw-r--r--doc/go-logo-white.pngbin21469 -> 0 bytes
-rw-r--r--doc/go1.1.html1099
-rw-r--r--doc/go1.10.html1448
-rw-r--r--doc/go1.11.html934
-rw-r--r--doc/go1.12.html949
-rw-r--r--doc/go1.13.html1066
-rw-r--r--doc/go1.14.html924
-rw-r--r--doc/go1.15.html1064
-rw-r--r--doc/go1.16.html1206
-rw-r--r--doc/go1.17.html92
-rw-r--r--doc/go1.2.html979
-rw-r--r--doc/go1.3.html608
-rw-r--r--doc/go1.4.html896
-rw-r--r--doc/go1.5.html1310
-rw-r--r--doc/go1.6.html923
-rw-r--r--doc/go1.7.html1281
-rw-r--r--doc/go1.8.html1666
-rw-r--r--doc/go1.9.html1024
-rw-r--r--doc/go1.html2038
-rw-r--r--doc/go1compat.html202
-rw-r--r--doc/go_faq.html2475
-rw-r--r--doc/go_spec.html12
-rw-r--r--doc/gopher/README3
-rw-r--r--doc/gopher/appenginegopher.jpgbin135882 -> 0 bytes
-rw-r--r--doc/gopher/appenginegophercolor.jpgbin162023 -> 0 bytes
-rw-r--r--doc/gopher/appenginelogo.gifbin2105 -> 0 bytes
-rw-r--r--doc/gopher/biplane.jpgbin203420 -> 0 bytes
-rw-r--r--doc/gopher/bumper.pngbin276215 -> 0 bytes
-rw-r--r--doc/gopher/bumper192x108.pngbin8432 -> 0 bytes
-rw-r--r--doc/gopher/bumper320x180.pngbin15098 -> 0 bytes
-rw-r--r--doc/gopher/bumper480x270.pngbin26509 -> 0 bytes
-rw-r--r--doc/gopher/bumper640x360.pngbin42013 -> 0 bytes
-rw-r--r--doc/gopher/doc.pngbin4395 -> 0 bytes
-rw-r--r--doc/gopher/favicon.svg238
-rw-r--r--doc/gopher/fiveyears.jpgbin220526 -> 0 bytes
-rw-r--r--doc/gopher/frontpage.pngbin17668 -> 0 bytes
-rw-r--r--doc/gopher/gopherbw.pngbin171323 -> 0 bytes
-rw-r--r--doc/gopher/gophercolor.pngbin169406 -> 0 bytes
-rw-r--r--doc/gopher/gophercolor16x16.pngbin739 -> 0 bytes
-rw-r--r--doc/gopher/help.pngbin5729 -> 0 bytes
-rw-r--r--doc/gopher/modelsheet.jpgbin85880 -> 0 bytes
-rw-r--r--doc/gopher/pencil/gopherhat.jpgbin129627 -> 0 bytes
-rw-r--r--doc/gopher/pencil/gopherhelmet.jpgbin151965 -> 0 bytes
-rw-r--r--doc/gopher/pencil/gophermega.jpgbin122348 -> 0 bytes
-rw-r--r--doc/gopher/pencil/gopherrunning.jpgbin86299 -> 0 bytes
-rw-r--r--doc/gopher/pencil/gopherswim.jpgbin158593 -> 0 bytes
-rw-r--r--doc/gopher/pencil/gopherswrench.jpgbin231095 -> 0 bytes
-rw-r--r--doc/gopher/pkg.pngbin5409 -> 0 bytes
-rw-r--r--doc/gopher/project.pngbin8042 -> 0 bytes
-rw-r--r--doc/gopher/ref.pngbin5895 -> 0 bytes
-rw-r--r--doc/gopher/run.pngbin9220 -> 0 bytes
-rw-r--r--doc/gopher/talks.pngbin4877 -> 0 bytes
-rw-r--r--doc/help.html96
-rw-r--r--doc/ie.css1
-rw-r--r--doc/install-source.html777
-rw-r--r--doc/install.html315
-rw-r--r--doc/play/fib.go19
-rw-r--r--doc/play/hello.go9
-rw-r--r--doc/play/life.go113
-rw-r--r--doc/play/peano.go88
-rw-r--r--doc/play/pi.go34
-rw-r--r--doc/play/sieve.go36
-rw-r--r--doc/play/solitaire.go117
-rw-r--r--doc/play/tree.go100
-rw-r--r--doc/progs/cgo1.go22
-rw-r--r--doc/progs/cgo2.go22
-rw-r--r--doc/progs/cgo3.go18
-rw-r--r--doc/progs/cgo4.go18
-rw-r--r--doc/progs/defer.go64
-rw-r--r--doc/progs/defer2.go58
-rw-r--r--doc/progs/eff_bytesize.go47
-rw-r--r--doc/progs/eff_qr.go50
-rw-r--r--doc/progs/eff_sequence.go49
-rw-r--r--doc/progs/eff_unused1.go16
-rw-r--r--doc/progs/eff_unused2.go20
-rw-r--r--doc/progs/error.go127
-rw-r--r--doc/progs/error2.go54
-rw-r--r--doc/progs/error3.go63
-rw-r--r--doc/progs/error4.go74
-rw-r--r--doc/progs/go1.go245
-rw-r--r--doc/progs/gobs1.go22
-rw-r--r--doc/progs/gobs2.go43
-rw-r--r--doc/progs/image_draw.go142
-rw-r--r--doc/progs/image_package1.go15
-rw-r--r--doc/progs/image_package2.go16
-rw-r--r--doc/progs/image_package3.go15
-rw-r--r--doc/progs/image_package4.go16
-rw-r--r--doc/progs/image_package5.go17
-rw-r--r--doc/progs/image_package6.go17
-rw-r--r--doc/progs/interface.go62
-rw-r--r--doc/progs/interface2.go132
-rw-r--r--doc/progs/json1.go88
-rw-r--r--doc/progs/json2.go42
-rw-r--r--doc/progs/json3.go73
-rw-r--r--doc/progs/json4.go45
-rw-r--r--doc/progs/json5.go31
-rw-r--r--doc/progs/run.go229
-rw-r--r--doc/progs/slices.go63
-rw-r--r--doc/progs/timeout1.go29
-rw-r--r--doc/progs/timeout2.go28
-rw-r--r--doc/share.pngbin2993 -> 0 bytes
-rw-r--r--doc/tos.html11
-rw-r--r--misc/cgo/test/callback.go2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_386.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_amd64x.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_arm.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_arm64.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_mips64x.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_mipsx.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_ppc64x.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_riscv64.s2
-rw-r--r--misc/cgo/test/testdata/issue9400/asm_s390x.s2
-rw-r--r--misc/cgo/testplugin/plugin_test.go13
-rw-r--r--misc/cgo/testplugin/testdata/method2/main.go32
-rw-r--r--misc/cgo/testplugin/testdata/method2/p/p.go9
-rw-r--r--misc/cgo/testplugin/testdata/method2/plugin.go11
-rw-r--r--misc/cgo/testshared/testdata/depBase/asm.s2
-rw-r--r--misc/cgo/testshared/testdata/depBase/stubs.go2
-rw-r--r--src/archive/tar/stat_actime1.go1
-rw-r--r--src/archive/tar/stat_actime2.go1
-rw-r--r--src/archive/tar/stat_unix.go1
-rw-r--r--src/archive/tar/strconv.go21
-rw-r--r--src/archive/tar/strconv_test.go7
-rw-r--r--src/bufio/bufio.go3
-rw-r--r--src/bufio/bufio_test.go14
-rw-r--r--src/bytes/boundary_test.go1
-rw-r--r--src/bytes/buffer.go3
-rw-r--r--src/bytes/buffer_test.go11
-rw-r--r--src/cmd/api/run.go1
-rw-r--r--src/cmd/asm/internal/arch/arch.go4
-rw-r--r--src/cmd/asm/internal/asm/asm.go5
-rw-r--r--src/cmd/asm/internal/asm/endtoend_test.go10
-rw-r--r--src/cmd/asm/internal/asm/operand_test.go1
-rw-r--r--src/cmd/asm/internal/asm/testdata/riscv64.s (renamed from src/cmd/asm/internal/asm/testdata/riscvenc.s)0
-rw-r--r--src/cmd/asm/internal/asm/testdata/riscv64error.s14
-rw-r--r--src/cmd/asm/internal/flags/flags.go2
-rw-r--r--src/cmd/asm/main.go1
-rw-r--r--src/cmd/cgo/gcc.go12
-rw-r--r--src/cmd/cgo/main.go4
-rw-r--r--src/cmd/compile/internal-abi.md24
-rw-r--r--src/cmd/compile/internal/abi/abiutils.go237
-rw-r--r--src/cmd/compile/internal/amd64/ggen.go26
-rw-r--r--src/cmd/compile/internal/amd64/ssa.go191
-rw-r--r--src/cmd/compile/internal/arm/ssa.go8
-rw-r--r--src/cmd/compile/internal/arm64/ssa.go34
-rw-r--r--src/cmd/compile/internal/base/debug.go45
-rw-r--r--src/cmd/compile/internal/base/flag.go1
-rw-r--r--src/cmd/compile/internal/dwarfgen/dwarf.go3
-rw-r--r--src/cmd/compile/internal/dwarfgen/dwinl.go3
-rw-r--r--src/cmd/compile/internal/dwarfgen/scope.go4
-rw-r--r--src/cmd/compile/internal/escape/escape.go7
-rw-r--r--src/cmd/compile/internal/gc/bootstrap.go1
-rw-r--r--src/cmd/compile/internal/gc/compile.go3
-rw-r--r--src/cmd/compile/internal/gc/export.go5
-rw-r--r--src/cmd/compile/internal/gc/pprof.go1
-rw-r--r--src/cmd/compile/internal/gc/trace.go1
-rw-r--r--src/cmd/compile/internal/importer/support.go16
-rw-r--r--src/cmd/compile/internal/inline/inl.go46
-rw-r--r--src/cmd/compile/internal/ir/expr.go8
-rw-r--r--src/cmd/compile/internal/ir/mknode.go1
-rw-r--r--src/cmd/compile/internal/ir/name.go2
-rw-r--r--src/cmd/compile/internal/ir/node.go2
-rw-r--r--src/cmd/compile/internal/ir/package.go3
-rw-r--r--src/cmd/compile/internal/ir/visit.go8
-rw-r--r--src/cmd/compile/internal/logopt/escape.go1
-rw-r--r--src/cmd/compile/internal/logopt/escape_bootstrap.go1
-rw-r--r--src/cmd/compile/internal/mips/ssa.go10
-rw-r--r--src/cmd/compile/internal/mips64/ssa.go4
-rw-r--r--src/cmd/compile/internal/noder/decl.go4
-rw-r--r--src/cmd/compile/internal/noder/expr.go80
-rw-r--r--src/cmd/compile/internal/noder/helpers.go15
-rw-r--r--src/cmd/compile/internal/noder/irgen.go16
-rw-r--r--src/cmd/compile/internal/noder/lex.go4
-rw-r--r--src/cmd/compile/internal/noder/object.go3
-rw-r--r--src/cmd/compile/internal/noder/stencil.go556
-rw-r--r--src/cmd/compile/internal/noder/types.go71
-rw-r--r--src/cmd/compile/internal/ppc64/ssa.go22
-rw-r--r--src/cmd/compile/internal/reflectdata/reflect.go5
-rw-r--r--src/cmd/compile/internal/riscv64/ssa.go11
-rw-r--r--src/cmd/compile/internal/s390x/ssa.go58
-rw-r--r--src/cmd/compile/internal/ssa/check.go6
-rw-r--r--src/cmd/compile/internal/ssa/config.go61
-rw-r--r--src/cmd/compile/internal/ssa/cse.go2
-rw-r--r--src/cmd/compile/internal/ssa/expand_calls.go578
-rw-r--r--src/cmd/compile/internal/ssa/flags_test.go1
-rw-r--r--src/cmd/compile/internal/ssa/func.go5
-rw-r--r--src/cmd/compile/internal/ssa/gen/386.rules1
-rw-r--r--src/cmd/compile/internal/ssa/gen/386Ops.go33
-rw-r--r--src/cmd/compile/internal/ssa/gen/AMD64.rules44
-rw-r--r--src/cmd/compile/internal/ssa/gen/AMD64Ops.go107
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARM.rules5
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARM64.rules24
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARM64Ops.go21
-rw-r--r--src/cmd/compile/internal/ssa/gen/ARMOps.go1
-rw-r--r--src/cmd/compile/internal/ssa/gen/MIPS.rules5
-rw-r--r--src/cmd/compile/internal/ssa/gen/MIPS64.rules5
-rw-r--r--src/cmd/compile/internal/ssa/gen/MIPS64Ops.go1
-rw-r--r--src/cmd/compile/internal/ssa/gen/MIPSOps.go1
-rw-r--r--src/cmd/compile/internal/ssa/gen/PPC64.rules1
-rw-r--r--src/cmd/compile/internal/ssa/gen/RISCV64.rules25
-rw-r--r--src/cmd/compile/internal/ssa/gen/RISCV64Ops.go8
-rw-r--r--src/cmd/compile/internal/ssa/gen/S390X.rules12
-rw-r--r--src/cmd/compile/internal/ssa/gen/S390XOps.go1
-rw-r--r--src/cmd/compile/internal/ssa/gen/Wasm.rules2
-rw-r--r--src/cmd/compile/internal/ssa/gen/WasmOps.go14
-rw-r--r--src/cmd/compile/internal/ssa/gen/generic.rules57
-rw-r--r--src/cmd/compile/internal/ssa/gen/genericOps.go13
-rw-r--r--src/cmd/compile/internal/ssa/gen/main.go69
-rw-r--r--src/cmd/compile/internal/ssa/gen/rulegen.go1
-rw-r--r--src/cmd/compile/internal/ssa/location.go14
-rw-r--r--src/cmd/compile/internal/ssa/loopreschedchecks.go3
-rw-r--r--src/cmd/compile/internal/ssa/lower.go6
-rw-r--r--src/cmd/compile/internal/ssa/numberlines.go2
-rw-r--r--src/cmd/compile/internal/ssa/op.go131
-rw-r--r--src/cmd/compile/internal/ssa/opGen.go2598
-rw-r--r--src/cmd/compile/internal/ssa/prove.go16
-rw-r--r--src/cmd/compile/internal/ssa/regalloc.go46
-rw-r--r--src/cmd/compile/internal/ssa/rewrite.go14
-rw-r--r--src/cmd/compile/internal/ssa/rewrite386.go3
-rw-r--r--src/cmd/compile/internal/ssa/rewriteAMD64.go222
-rw-r--r--src/cmd/compile/internal/ssa/rewriteARM.go20
-rw-r--r--src/cmd/compile/internal/ssa/rewriteARM64.go314
-rw-r--r--src/cmd/compile/internal/ssa/rewriteMIPS.go20
-rw-r--r--src/cmd/compile/internal/ssa/rewriteMIPS64.go20
-rw-r--r--src/cmd/compile/internal/ssa/rewritePPC64.go3
-rw-r--r--src/cmd/compile/internal/ssa/rewriteRISCV64.go117
-rw-r--r--src/cmd/compile/internal/ssa/rewriteS390X.go51
-rw-r--r--src/cmd/compile/internal/ssa/rewriteWasm.go3
-rw-r--r--src/cmd/compile/internal/ssa/rewrite_test.go2
-rw-r--r--src/cmd/compile/internal/ssa/rewritegeneric.go431
-rw-r--r--src/cmd/compile/internal/ssa/schedule.go18
-rw-r--r--src/cmd/compile/internal/ssa/shortcircuit.go7
-rw-r--r--src/cmd/compile/internal/ssa/stackalloc.go15
-rw-r--r--src/cmd/compile/internal/ssa/tighten.go3
-rw-r--r--src/cmd/compile/internal/ssa/tuple.go40
-rw-r--r--src/cmd/compile/internal/ssa/value.go21
-rw-r--r--src/cmd/compile/internal/ssa/writebarrier.go16
-rw-r--r--src/cmd/compile/internal/ssagen/abi.go15
-rw-r--r--src/cmd/compile/internal/ssagen/pgen.go15
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go323
-rw-r--r--src/cmd/compile/internal/test/abiutils_test.go4
-rw-r--r--src/cmd/compile/internal/test/abiutilsaux_test.go32
-rw-r--r--src/cmd/compile/internal/test/fixedbugs_test.go2
-rw-r--r--src/cmd/compile/internal/test/global_test.go4
-rw-r--r--src/cmd/compile/internal/typecheck/builtin.go209
-rw-r--r--src/cmd/compile/internal/typecheck/builtin/runtime.go11
-rw-r--r--src/cmd/compile/internal/typecheck/const.go2
-rw-r--r--src/cmd/compile/internal/typecheck/func.go11
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go2
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go19
-rw-r--r--src/cmd/compile/internal/typecheck/mapfile_mmap.go1
-rw-r--r--src/cmd/compile/internal/typecheck/mapfile_read.go1
-rw-r--r--src/cmd/compile/internal/typecheck/mkbuiltin.go1
-rw-r--r--src/cmd/compile/internal/typecheck/subr.go9
-rw-r--r--src/cmd/compile/internal/typecheck/typecheck.go2
-rw-r--r--src/cmd/compile/internal/types/size.go14
-rw-r--r--src/cmd/compile/internal/types/sizeof_test.go2
-rw-r--r--src/cmd/compile/internal/types/type.go92
-rw-r--r--src/cmd/compile/internal/types2/api.go7
-rw-r--r--src/cmd/compile/internal/types2/assignments.go2
-rw-r--r--src/cmd/compile/internal/types2/builtins.go29
-rw-r--r--src/cmd/compile/internal/types2/builtins_test.go1
-rw-r--r--src/cmd/compile/internal/types2/call.go52
-rw-r--r--src/cmd/compile/internal/types2/check.go37
-rw-r--r--src/cmd/compile/internal/types2/check_test.go32
-rw-r--r--src/cmd/compile/internal/types2/conversions.go23
-rw-r--r--src/cmd/compile/internal/types2/decl.go23
-rw-r--r--src/cmd/compile/internal/types2/errors_test.go1
-rw-r--r--src/cmd/compile/internal/types2/example_test.go1
-rw-r--r--src/cmd/compile/internal/types2/examples/types.go218
-rw-r--r--src/cmd/compile/internal/types2/expr.go128
-rw-r--r--src/cmd/compile/internal/types2/fixedbugs/issue44688.go283
-rw-r--r--src/cmd/compile/internal/types2/infer.go20
-rw-r--r--src/cmd/compile/internal/types2/issues_test.go68
-rw-r--r--src/cmd/compile/internal/types2/labels.go1
-rw-r--r--src/cmd/compile/internal/types2/lookup.go18
-rw-r--r--src/cmd/compile/internal/types2/object.go3
-rw-r--r--src/cmd/compile/internal/types2/object_test.go1
-rw-r--r--src/cmd/compile/internal/types2/operand.go6
-rw-r--r--src/cmd/compile/internal/types2/predicates.go19
-rw-r--r--src/cmd/compile/internal/types2/resolver_test.go1
-rw-r--r--src/cmd/compile/internal/types2/return.go1
-rw-r--r--src/cmd/compile/internal/types2/sanitize.go87
-rw-r--r--src/cmd/compile/internal/types2/selection.go16
-rw-r--r--src/cmd/compile/internal/types2/sizes.go7
-rw-r--r--src/cmd/compile/internal/types2/sizes_test.go1
-rw-r--r--src/cmd/compile/internal/types2/stdlib_test.go14
-rw-r--r--src/cmd/compile/internal/types2/stmt.go10
-rw-r--r--src/cmd/compile/internal/types2/subst.go10
-rw-r--r--src/cmd/compile/internal/types2/testdata/builtins.src10
-rw-r--r--src/cmd/compile/internal/types2/testdata/const0.src17
-rw-r--r--src/cmd/compile/internal/types2/testdata/const1.src18
-rw-r--r--src/cmd/compile/internal/types2/testdata/go1_12.src34
-rw-r--r--src/cmd/compile/internal/types2/testdata/go1_13.src21
-rw-r--r--src/cmd/compile/internal/types2/testdata/go1_8.src10
-rw-r--r--src/cmd/compile/internal/types2/testdata/typeparams.go24
-rw-r--r--src/cmd/compile/internal/types2/type.go322
-rw-r--r--src/cmd/compile/internal/types2/typestring.go80
-rw-r--r--src/cmd/compile/internal/types2/typestring_test.go1
-rw-r--r--src/cmd/compile/internal/types2/typexpr.go44
-rw-r--r--src/cmd/compile/internal/types2/unify.go10
-rw-r--r--src/cmd/compile/internal/types2/universe.go63
-rw-r--r--src/cmd/compile/internal/types2/version.go81
-rw-r--r--src/cmd/compile/internal/walk/assign.go2
-rw-r--r--src/cmd/compile/internal/walk/expr.go16
-rw-r--r--src/cmd/compile/internal/walk/select.go20
-rw-r--r--src/cmd/compile/internal/walk/stmt.go21
-rw-r--r--src/cmd/compile/internal/x86/ssa.go48
-rw-r--r--src/cmd/dist/build.go34
-rw-r--r--src/cmd/dist/sys_default.go1
-rw-r--r--src/cmd/dist/sys_windows.go5
-rw-r--r--src/cmd/dist/test.go18
-rw-r--r--src/cmd/dist/test_linux.go1
-rw-r--r--src/cmd/dist/util.go4
-rw-r--r--src/cmd/dist/util_gc.go3
-rw-r--r--src/cmd/dist/util_gccgo.go1
-rw-r--r--src/cmd/go.mod6
-rw-r--r--src/cmd/go.sum13
-rw-r--r--src/cmd/go/alldocs.go56
-rw-r--r--src/cmd/go/go11.go1
-rw-r--r--src/cmd/go/go_test.go1
-rw-r--r--src/cmd/go/go_unix_test.go1
-rw-r--r--src/cmd/go/internal/base/signal_notunix.go1
-rw-r--r--src/cmd/go/internal/base/signal_unix.go1
-rw-r--r--src/cmd/go/internal/cfg/cfg.go2
-rw-r--r--src/cmd/go/internal/envcmd/env.go2
-rw-r--r--src/cmd/go/internal/get/get.go57
-rw-r--r--src/cmd/go/internal/help/helpdoc.go9
-rw-r--r--src/cmd/go/internal/load/pkg.go5
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go1
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go1
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go1
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go1
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_unix.go1
-rw-r--r--src/cmd/go/internal/lockedfile/internal/filelock/filelock_windows.go1
-rw-r--r--src/cmd/go/internal/lockedfile/lockedfile_filelock.go1
-rw-r--r--src/cmd/go/internal/lockedfile/lockedfile_plan9.go1
-rw-r--r--src/cmd/go/internal/lockedfile/lockedfile_test.go1
-rw-r--r--src/cmd/go/internal/lockedfile/transform_test.go1
-rw-r--r--src/cmd/go/internal/modcmd/tidy.go9
-rw-r--r--src/cmd/go/internal/modcmd/vendor.go9
-rw-r--r--src/cmd/go/internal/modcmd/why.go9
-rw-r--r--src/cmd/go/internal/modfetch/bootstrap.go1
-rw-r--r--src/cmd/go/internal/modfetch/cache.go31
-rw-r--r--src/cmd/go/internal/modfetch/codehost/shell.go1
-rw-r--r--src/cmd/go/internal/modfetch/fetch.go6
-rw-r--r--src/cmd/go/internal/modfetch/insecure.go16
-rw-r--r--src/cmd/go/internal/modfetch/repo.go4
-rw-r--r--src/cmd/go/internal/modfetch/sumdb.go3
-rw-r--r--src/cmd/go/internal/modget/get.go189
-rw-r--r--src/cmd/go/internal/modload/build.go6
-rw-r--r--src/cmd/go/internal/modload/help.go13
-rw-r--r--src/cmd/go/internal/modload/init.go5
-rw-r--r--src/cmd/go/internal/modload/list.go14
-rw-r--r--src/cmd/go/internal/modload/load.go9
-rw-r--r--src/cmd/go/internal/modload/stat_openfile.go1
-rw-r--r--src/cmd/go/internal/modload/stat_unix.go1
-rw-r--r--src/cmd/go/internal/modload/stat_windows.go1
-rw-r--r--src/cmd/go/internal/mvs/mvs.go83
-rw-r--r--src/cmd/go/internal/mvs/mvs_test.go160
-rw-r--r--src/cmd/go/internal/renameio/renameio_test.go1
-rw-r--r--src/cmd/go/internal/renameio/umask_test.go1
-rw-r--r--src/cmd/go/internal/robustio/robustio_flaky.go1
-rw-r--r--src/cmd/go/internal/robustio/robustio_other.go1
-rw-r--r--src/cmd/go/internal/search/search.go1
-rw-r--r--src/cmd/go/internal/test/genflags.go1
-rw-r--r--src/cmd/go/internal/test/test.go17
-rw-r--r--src/cmd/go/internal/vet/vetflag.go3
-rw-r--r--src/cmd/go/internal/web/bootstrap.go1
-rw-r--r--src/cmd/go/internal/web/http.go3
-rw-r--r--src/cmd/go/internal/web/url_other.go1
-rw-r--r--src/cmd/go/internal/web/url_other_test.go1
-rw-r--r--src/cmd/go/internal/work/exec.go15
-rw-r--r--src/cmd/go/internal/work/testgo.go1
-rw-r--r--src/cmd/go/testdata/mod/example.com_split-incompatible_subpkg_v0.1.0.txt2
-rw-r--r--src/cmd/go/testdata/script/build_overlay.txt2
-rw-r--r--src/cmd/go/testdata/script/env_write.txt6
-rw-r--r--src/cmd/go/testdata/script/get_404_meta.txt5
-rw-r--r--src/cmd/go/testdata/script/get_insecure.txt20
-rw-r--r--src/cmd/go/testdata/script/get_insecure_custom_domain.txt4
-rw-r--r--src/cmd/go/testdata/script/get_insecure_deprecated.txt21
-rw-r--r--src/cmd/go/testdata/script/get_insecure_no_longer_supported.txt13
-rw-r--r--src/cmd/go/testdata/script/get_insecure_redirect.txt5
-rw-r--r--src/cmd/go/testdata/script/get_insecure_update.txt8
-rw-r--r--src/cmd/go/testdata/script/help.txt7
-rw-r--r--src/cmd/go/testdata/script/list_std_stale.txt31
-rw-r--r--src/cmd/go/testdata/script/mod_cache_dir.txt11
-rw-r--r--src/cmd/go/testdata/script/mod_edit.txt16
-rw-r--r--src/cmd/go/testdata/script/mod_empty_err.txt2
-rw-r--r--src/cmd/go/testdata/script/mod_get_downadd_indirect.txt81
-rw-r--r--src/cmd/go/testdata/script/mod_get_downup_artifact.txt165
-rw-r--r--src/cmd/go/testdata/script/mod_get_downup_indirect.txt101
-rw-r--r--src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt129
-rw-r--r--src/cmd/go/testdata/script/mod_get_insecure_redirect.txt4
-rw-r--r--src/cmd/go/testdata/script/mod_get_pkgtags.txt116
-rw-r--r--src/cmd/go/testdata/script/mod_get_retract.txt2
-rw-r--r--src/cmd/go/testdata/script/mod_invalid_path.txt24
-rw-r--r--src/cmd/go/testdata/script/mod_list_std.txt14
-rw-r--r--src/cmd/go/testdata/script/mod_load_badchain.txt3
-rw-r--r--src/cmd/go/testdata/script/mod_outside.txt2
-rw-r--r--src/cmd/go/testdata/script/mod_proxy_https.txt1
-rw-r--r--src/cmd/go/testdata/script/mod_retract_fix_version.txt48
-rw-r--r--src/cmd/go/testdata/script/mod_retract_versions.txt17
-rw-r--r--src/cmd/go/testdata/script/mod_std_vendor.txt6
-rw-r--r--src/cmd/go/testdata/script/mod_sumdb_cache.txt7
-rw-r--r--src/cmd/go/testdata/script/test_chatty_parallel_fail.txt2
-rw-r--r--src/cmd/go/testdata/script/test_chatty_parallel_success.txt2
-rw-r--r--src/cmd/go/testdata/script/test_chatty_parallel_success_sleepy.txt2
-rw-r--r--src/cmd/go2go/testdata/go2path/src/chans/chans_test.go24
-rw-r--r--src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go22
-rw-r--r--src/cmd/go2go/testdata/go2path/src/list/list_test.go22
-rw-r--r--src/cmd/go2go/testdata/go2path/src/maps/maps_test.go22
-rw-r--r--src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go22
-rw-r--r--src/cmd/go2go/testdata/go2path/src/slices/slices.go24
-rw-r--r--src/cmd/go2go/testdata/go2path/src/slices/slices_test.go26
-rw-r--r--src/cmd/gofmt/doc.go3
-rw-r--r--src/cmd/gofmt/gofmt.go13
-rw-r--r--src/cmd/gofmt/gofmt_go1.18.go12
-rw-r--r--src/cmd/gofmt/gofmt_go2go.go10
-rw-r--r--src/cmd/gofmt/gofmt_test.go3
-rw-r--r--src/cmd/gofmt/testdata/typeparams.golden35
-rw-r--r--src/cmd/gofmt/testdata/typeparams.input32
-rw-r--r--src/cmd/internal/archive/archive_test.go4
-rw-r--r--src/cmd/internal/bio/buf_mmap.go1
-rw-r--r--src/cmd/internal/bio/buf_nommap.go1
-rw-r--r--src/cmd/internal/diff/diff.go20
-rw-r--r--src/cmd/internal/dwarf/dwarf.go20
-rw-r--r--src/cmd/internal/goobj/funcinfo.go60
-rw-r--r--src/cmd/internal/goobj/mkbuiltin.go1
-rw-r--r--src/cmd/internal/goobj/objfile.go4
-rw-r--r--src/cmd/internal/goobj/objfile_test.go62
-rw-r--r--src/cmd/internal/obj/arm/obj5.go16
-rw-r--r--src/cmd/internal/obj/arm64/a.out.go2
-rw-r--r--src/cmd/internal/obj/arm64/obj7.go307
-rw-r--r--src/cmd/internal/obj/link.go101
-rw-r--r--src/cmd/internal/obj/mips/obj0.go16
-rw-r--r--src/cmd/internal/obj/objfile.go16
-rw-r--r--src/cmd/internal/obj/pcln.go2
-rw-r--r--src/cmd/internal/obj/plist.go10
-rw-r--r--src/cmd/internal/obj/ppc64/asm9.go912
-rw-r--r--src/cmd/internal/obj/ppc64/obj9.go16
-rw-r--r--src/cmd/internal/obj/riscv/obj.go27
-rw-r--r--src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go117
-rw-r--r--src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.s28
-rw-r--r--src/cmd/internal/obj/s390x/objz.go16
-rw-r--r--src/cmd/internal/obj/stringer.go1
-rw-r--r--src/cmd/internal/obj/util.go2
-rw-r--r--src/cmd/internal/obj/x86/a.out.go1
-rw-r--r--src/cmd/internal/obj/x86/asm6.go2
-rw-r--r--src/cmd/internal/obj/x86/obj6.go44
-rw-r--r--src/cmd/internal/objabi/funcid.go124
-rw-r--r--src/cmd/internal/objabi/path.go2
-rw-r--r--src/cmd/internal/objabi/util.go2
-rw-r--r--src/cmd/internal/objfile/pe.go2
-rw-r--r--src/cmd/internal/sys/supported.go2
-rw-r--r--src/cmd/link/dwarf_test.go3
-rw-r--r--src/cmd/link/elf_test.go1
-rw-r--r--src/cmd/link/internal/arm/asm.go16
-rw-r--r--src/cmd/link/internal/arm64/asm.go34
-rw-r--r--src/cmd/link/internal/arm64/obj.go5
-rw-r--r--src/cmd/link/internal/ld/config.go9
-rw-r--r--src/cmd/link/internal/ld/data.go13
-rw-r--r--src/cmd/link/internal/ld/deadcode.go11
-rw-r--r--src/cmd/link/internal/ld/dwarf.go4
-rw-r--r--src/cmd/link/internal/ld/elf.go145
-rw-r--r--src/cmd/link/internal/ld/elf_test.go1
-rw-r--r--src/cmd/link/internal/ld/execarchive.go1
-rw-r--r--src/cmd/link/internal/ld/execarchive_noexec.go1
-rw-r--r--src/cmd/link/internal/ld/fallocate_test.go1
-rw-r--r--src/cmd/link/internal/ld/lib.go62
-rw-r--r--src/cmd/link/internal/ld/main.go2
-rw-r--r--src/cmd/link/internal/ld/outbuf_mmap.go1
-rw-r--r--src/cmd/link/internal/ld/outbuf_nofallocate.go1
-rw-r--r--src/cmd/link/internal/ld/outbuf_nommap.go1
-rw-r--r--src/cmd/link/internal/ld/outbuf_notdarwin.go1
-rw-r--r--src/cmd/link/internal/ld/pcln.go13
-rw-r--r--src/cmd/link/internal/ld/pe.go113
-rw-r--r--src/cmd/link/internal/loader/loader.go43
-rw-r--r--src/cmd/link/internal/loadpe/ldpe.go29
-rw-r--r--src/cmd/link/internal/ppc64/asm.go12
-rw-r--r--src/cmd/link/link_test.go40
-rw-r--r--src/cmd/link/testdata/pe-binutils/main.go (renamed from src/cmd/link/testdata/testPErsrc/main.go)7
-rw-r--r--src/cmd/link/testdata/pe-binutils/rsrc_386.sysobin0 -> 228 bytes
-rw-r--r--src/cmd/link/testdata/pe-binutils/rsrc_amd64.syso (renamed from src/cmd/link/testdata/testPErsrc/rsrc.syso)bin228 -> 228 bytes
-rw-r--r--src/cmd/link/testdata/pe-llvm/main.go (renamed from src/cmd/link/testdata/testPErsrc-complex/main.go)4
-rw-r--r--src/cmd/link/testdata/pe-llvm/rsrc_386.sysobin0 -> 352 bytes
-rw-r--r--src/cmd/link/testdata/pe-llvm/rsrc_amd64.syso (renamed from src/cmd/link/testdata/testPErsrc-complex/rsrc.syso)bin352 -> 352 bytes
-rw-r--r--src/cmd/link/testdata/pe-llvm/rsrc_arm.sysobin0 -> 352 bytes
-rw-r--r--src/cmd/link/testdata/pe-llvm/rsrc_arm64.sysobin0 -> 352 bytes
-rw-r--r--src/cmd/nm/nm_cgo_test.go1
-rw-r--r--src/cmd/pprof/readlineui.go1
-rw-r--r--src/cmd/trace/annotations_test.go1
-rw-r--r--src/cmd/trace/trace_test.go1
-rw-r--r--src/cmd/trace/trace_unix_test.go1
-rw-r--r--src/cmd/vendor/golang.org/x/mod/modfile/rule.go167
-rw-r--r--src/cmd/vendor/golang.org/x/mod/module/module.go40
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ptrace_darwin.go11
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ptrace_ios.go11
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go24
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go17
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go13
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go18
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go4
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go4
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd.go21
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd.go4
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go16
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/timestruct.go26
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go62
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go62
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go157
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go9
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go6
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go15
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go10
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go27
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go8
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go1496
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go2
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go1
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go35
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/types_windows.go311
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/types_windows_arm64.go34
-rw-r--r--src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go154
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go318
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag_old.go174
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go67
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go2
-rw-r--r--src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go1
-rw-r--r--src/cmd/vendor/modules.txt6
-rw-r--r--src/cmd/vet/testdata/asm/asm1.s1
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag.go6
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag2.go22
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag3.go15
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag4.go11
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag5.go11
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag6.s (renamed from src/io/ioutil/export_test.go)6
-rw-r--r--src/cmd/vet/testdata/buildtag/buildtag7.s11
-rw-r--r--src/cmd/vet/testdata/tagtest/file1.go1
-rw-r--r--src/cmd/vet/testdata/tagtest/file2.go1
-rw-r--r--src/cmd/vet/vet_test.go9
-rw-r--r--src/context/benchmark_test.go14
-rw-r--r--src/context/context.go30
-rw-r--r--src/context/context_test.go2
-rw-r--r--src/crypto/aes/aes_gcm.go1
-rw-r--r--src/crypto/aes/cipher_asm.go1
-rw-r--r--src/crypto/aes/cipher_generic.go1
-rw-r--r--src/crypto/aes/gcm_ppc64le.go1
-rw-r--r--src/crypto/cipher/xor_generic.go1
-rw-r--r--src/crypto/cipher/xor_ppc64x.go1
-rw-r--r--src/crypto/ecdsa/ecdsa_noasm.go1
-rw-r--r--src/crypto/ecdsa/ecdsa_s390x_test.go1
-rw-r--r--src/crypto/elliptic/fuzz_test.go1
-rw-r--r--src/crypto/elliptic/p256.go1
-rw-r--r--src/crypto/elliptic/p256_asm.go1
-rw-r--r--src/crypto/elliptic/p256_generic.go1
-rw-r--r--src/crypto/elliptic/p256_ppc64le.go1
-rw-r--r--src/crypto/elliptic/p256_s390x.go1
-rw-r--r--src/crypto/internal/subtle/aliasing.go1
-rw-r--r--src/crypto/internal/subtle/aliasing_appengine.go1
-rw-r--r--src/crypto/md5/gen.go1
-rw-r--r--src/crypto/md5/md5block_decl.go1
-rw-r--r--src/crypto/md5/md5block_generic.go1
-rw-r--r--src/crypto/rand/eagain.go1
-rw-r--r--src/crypto/rand/rand_batched.go1
-rw-r--r--src/crypto/rand/rand_batched_test.go1
-rw-r--r--src/crypto/rand/rand_js.go1
-rw-r--r--src/crypto/rand/rand_unix.go1
-rw-r--r--src/crypto/sha1/fallback_test.go1
-rw-r--r--src/crypto/sha1/issue15617_test.go1
-rw-r--r--src/crypto/sha1/sha1block_decl.go1
-rw-r--r--src/crypto/sha1/sha1block_generic.go1
-rw-r--r--src/crypto/sha256/fallback_test.go1
-rw-r--r--src/crypto/sha256/sha256block_decl.go1
-rw-r--r--src/crypto/sha256/sha256block_generic.go1
-rw-r--r--src/crypto/sha512/fallback_test.go1
-rw-r--r--src/crypto/sha512/sha512block_amd64.go1
-rw-r--r--src/crypto/sha512/sha512block_decl.go1
-rw-r--r--src/crypto/sha512/sha512block_generic.go1
-rw-r--r--src/crypto/tls/generate_cert.go1
-rw-r--r--src/crypto/tls/handshake_client_test.go6
-rw-r--r--src/crypto/tls/handshake_unix_test.go1
-rw-r--r--src/crypto/x509/internal/macos/corefoundation.go1
-rw-r--r--src/crypto/x509/internal/macos/corefoundation.s21
-rw-r--r--src/crypto/x509/internal/macos/security.go1
-rw-r--r--src/crypto/x509/internal/macos/security.s11
-rw-r--r--src/crypto/x509/root_bsd.go1
-rw-r--r--src/crypto/x509/root_darwin.go1
-rw-r--r--src/crypto/x509/root_ios.go4
-rw-r--r--src/crypto/x509/root_ios_gen.go1
-rw-r--r--src/crypto/x509/root_js.go1
-rw-r--r--src/crypto/x509/root_omit.go1
-rw-r--r--src/crypto/x509/root_omit_test.go1
-rw-r--r--src/crypto/x509/root_plan9.go1
-rw-r--r--src/crypto/x509/root_unix.go1
-rw-r--r--src/crypto/x509/root_unix_test.go1
-rw-r--r--src/crypto/x509/x509_test_import.go1
-rw-r--r--src/database/sql/driver/driver.go3
-rw-r--r--src/database/sql/fakedb_test.go9
-rw-r--r--src/database/sql/sql.go6
-rw-r--r--src/database/sql/sql_test.go26
-rw-r--r--src/debug/elf/elf.go2
-rw-r--r--src/debug/pe/file.go15
-rw-r--r--src/debug/pe/file_cgo_test.go1
-rw-r--r--src/embed/embed.go18
-rw-r--r--src/encoding/asn1/asn1.go2
-rw-r--r--src/encoding/asn1/marshal.go2
-rw-r--r--src/encoding/csv/fuzz.go1
-rw-r--r--src/encoding/gob/debug.go1
-rw-r--r--src/encoding/gob/decgen.go1
-rw-r--r--src/encoding/gob/dump.go1
-rw-r--r--src/encoding/gob/encgen.go1
-rw-r--r--src/encoding/json/decode.go51
-rw-r--r--src/encoding/json/encode.go5
-rw-r--r--src/encoding/json/fuzz.go1
-rw-r--r--src/encoding/xml/typeinfo.go2
-rw-r--r--src/go.mod2
-rw-r--r--src/go.sum4
-rw-r--r--src/go/ast/ast.go47
-rw-r--r--src/go/ast/example_test.go33
-rw-r--r--src/go/build/build.go139
-rw-r--r--src/go/build/build_test.go88
-rw-r--r--src/go/build/constraint/expr.go4
-rw-r--r--src/go/build/deps_test.go18
-rw-r--r--src/go/build/gc.go1
-rw-r--r--src/go/build/gccgo.go1
-rw-r--r--src/go/doc/headscan.go1
-rw-r--r--src/go/format/format.go8
-rw-r--r--src/go/format/format_test.go4
-rw-r--r--src/go/go2go/go2go.go8
-rw-r--r--src/go/go2go/importer.go8
-rw-r--r--src/go/go2go/instantiate.go19
-rw-r--r--src/go/go2go/rewrite.go24
-rw-r--r--src/go/internal/gccgoimporter/gccgoinstallation_test.go2
-rw-r--r--src/go/internal/gccgoimporter/importer_test.go2
-rw-r--r--src/go/internal/gcimporter/iimport.go52
-rw-r--r--src/go/parser/error_test.go2
-rw-r--r--src/go/parser/interface.go8
-rw-r--r--src/go/parser/parser.go49
-rw-r--r--src/go/parser/short_test.go14
-rw-r--r--src/go/parser/testdata/issue44504.src13
-rw-r--r--src/go/printer/gobuild.go170
-rw-r--r--src/go/printer/nodes.go43
-rw-r--r--src/go/printer/printer.go14
-rw-r--r--src/go/printer/printer_test.go37
-rw-r--r--src/go/printer/testdata/gobuild1.golden6
-rw-r--r--src/go/printer/testdata/gobuild1.input7
-rw-r--r--src/go/printer/testdata/gobuild2.golden8
-rw-r--r--src/go/printer/testdata/gobuild2.input9
-rw-r--r--src/go/printer/testdata/gobuild3.golden10
-rw-r--r--src/go/printer/testdata/gobuild3.input11
-rw-r--r--src/go/printer/testdata/gobuild4.golden6
-rw-r--r--src/go/printer/testdata/gobuild4.input5
-rw-r--r--src/go/printer/testdata/gobuild5.golden4
-rw-r--r--src/go/printer/testdata/gobuild5.input4
-rw-r--r--src/go/printer/testdata/gobuild6.golden5
-rw-r--r--src/go/printer/testdata/gobuild6.input4
-rw-r--r--src/go/printer/testdata/gobuild7.golden11
-rw-r--r--src/go/printer/testdata/gobuild7.input11
-rw-r--r--src/go/token/position.go2
-rw-r--r--src/go/token/position_bench_test.go24
-rw-r--r--src/go/types/api.go17
-rw-r--r--src/go/types/api_go1.18.go22
-rw-r--r--src/go/types/api_go1.18_test.go138
-rw-r--r--src/go/types/api_go2go.go22
-rw-r--r--src/go/types/api_test.go196
-rw-r--r--src/go/types/assignments.go14
-rw-r--r--src/go/types/builtins.go12
-rw-r--r--src/go/types/call.go258
-rw-r--r--src/go/types/check.go84
-rw-r--r--src/go/types/check_test.go106
-rw-r--r--src/go/types/conversions.go6
-rw-r--r--src/go/types/decl.go9
-rw-r--r--src/go/types/errorcodes.go13
-rw-r--r--src/go/types/eval_test.go2
-rw-r--r--src/go/types/example_test.go1
-rw-r--r--src/go/types/examples/functions.go24
-rw-r--r--src/go/types/examples/types.go222
-rw-r--r--src/go/types/expr.go243
-rw-r--r--src/go/types/exprstring.go16
-rw-r--r--src/go/types/fixedbugs/issue39634.go22
-rw-r--r--src/go/types/fixedbugs/issue44688.go283
-rw-r--r--src/go/types/gotype.go1
-rw-r--r--src/go/types/infer.go8
-rw-r--r--src/go/types/issues_test.go26
-rw-r--r--src/go/types/lookup.go4
-rw-r--r--src/go/types/operand.go2
-rw-r--r--src/go/types/predicates.go36
-rw-r--r--src/go/types/resolver.go113
-rw-r--r--src/go/types/sanitize.go88
-rw-r--r--src/go/types/scope.go4
-rw-r--r--src/go/types/sizes.go2
-rw-r--r--src/go/types/stdlib_test.go13
-rw-r--r--src/go/types/stmt.go2
-rw-r--r--src/go/types/subst.go20
-rw-r--r--src/go/types/testdata/builtins.src12
-rw-r--r--src/go/types/testdata/const0.src13
-rw-r--r--src/go/types/testdata/const1.src18
-rw-r--r--src/go/types/testdata/go1_12.src35
-rw-r--r--src/go/types/testdata/go1_13.src22
-rw-r--r--src/go/types/testdata/go1_8.src11
-rw-r--r--src/go/types/testdata/importdecl0/importdecl0a.src2
-rw-r--r--src/go/types/testdata/importdecl0/importdecl0b.src2
-rw-r--r--src/go/types/testdata/importdecl1/importdecl1b.src2
-rw-r--r--src/go/types/testdata/issues.go28
-rw-r--r--src/go/types/testdata/main.src9
-rw-r--r--src/go/types/testdata/shifts.src12
-rw-r--r--src/go/types/testdata/stmt0.src2
-rw-r--r--src/go/types/testdata/typeparams.go216
-rw-r--r--src/go/types/type.go150
-rw-r--r--src/go/types/type_go2go.go27
-rw-r--r--src/go/types/typestring.go55
-rw-r--r--src/go/types/typexpr.go103
-rw-r--r--src/go/types/unify.go8
-rw-r--r--src/go/types/universe.go9
-rw-r--r--src/go/types/version.go82
-rw-r--r--src/hash/crc32/crc32_otherarch.go1
-rw-r--r--src/hash/crc32/gen_const_ppc64le.go1
-rw-r--r--src/hash/maphash/maphash.go2
-rw-r--r--src/html/fuzz.go1
-rw-r--r--src/image/color/palette/gen.go1
-rw-r--r--src/image/internal/imageutil/gen.go1
-rw-r--r--src/image/jpeg/reader.go3
-rw-r--r--src/image/png/fuzz.go1
-rw-r--r--src/image/png/writer.go1
-rw-r--r--src/index/suffixarray/gen.go1
-rw-r--r--src/internal/abi/abi.go53
-rw-r--r--src/internal/abi/abi_amd64.go25
-rw-r--r--src/internal/abi/abi_generic.go39
-rw-r--r--src/internal/bytealg/compare_generic.go1
-rw-r--r--src/internal/bytealg/compare_native.go1
-rw-r--r--src/internal/bytealg/count_generic.go1
-rw-r--r--src/internal/bytealg/count_native.go1
-rw-r--r--src/internal/bytealg/index_generic.go1
-rw-r--r--src/internal/bytealg/index_native.go1
-rw-r--r--src/internal/bytealg/indexbyte_generic.go1
-rw-r--r--src/internal/bytealg/indexbyte_native.go1
-rw-r--r--src/internal/cpu/cpu_arm64_android.go1
-rw-r--r--src/internal/cpu/cpu_arm64_darwin.go5
-rw-r--r--src/internal/cpu/cpu_arm64_freebsd.go1
-rw-r--r--src/internal/cpu/cpu_arm64_hwcap.go4
-rw-r--r--src/internal/cpu/cpu_arm64_linux.go5
-rw-r--r--src/internal/cpu/cpu_arm64_other.go1
-rw-r--r--src/internal/cpu/cpu_mips64x.go1
-rw-r--r--src/internal/cpu/cpu_no_name.go4
-rw-r--r--src/internal/cpu/cpu_ppc64x.go1
-rw-r--r--src/internal/cpu/cpu_ppc64x_aix.go1
-rw-r--r--src/internal/cpu/cpu_ppc64x_linux.go1
-rw-r--r--src/internal/cpu/cpu_x86.go1
-rw-r--r--src/internal/cpu/cpu_x86_test.go1
-rw-r--r--src/internal/goroot/gc.go1
-rw-r--r--src/internal/goroot/gccgo.go1
-rw-r--r--src/internal/goversion/goversion.go2
-rw-r--r--src/internal/poll/copy_file_range_linux.go16
-rw-r--r--src/internal/poll/errno_unix.go1
-rw-r--r--src/internal/poll/errno_windows.go1
-rw-r--r--src/internal/poll/error_stub_test.go1
-rw-r--r--src/internal/poll/export_posix_test.go1
-rw-r--r--src/internal/poll/fcntl_js.go1
-rw-r--r--src/internal/poll/fcntl_libc.go1
-rw-r--r--src/internal/poll/fcntl_syscall.go1
-rw-r--r--src/internal/poll/fd_fsync_posix.go1
-rw-r--r--src/internal/poll/fd_poll_js.go1
-rw-r--r--src/internal/poll/fd_poll_runtime.go5
-rw-r--r--src/internal/poll/fd_posix.go1
-rw-r--r--src/internal/poll/fd_posix_test.go1
-rw-r--r--src/internal/poll/fd_unix.go1
-rw-r--r--src/internal/poll/fd_writev_darwin.go1
-rw-r--r--src/internal/poll/fd_writev_illumos.go1
-rw-r--r--src/internal/poll/fd_writev_unix.go1
-rw-r--r--src/internal/poll/hook_cloexec.go1
-rw-r--r--src/internal/poll/hook_unix.go1
-rw-r--r--src/internal/poll/iovec_illumos.go1
-rw-r--r--src/internal/poll/iovec_unix.go1
-rw-r--r--src/internal/poll/sendfile_bsd.go5
-rw-r--r--src/internal/poll/sendfile_linux.go3
-rw-r--r--src/internal/poll/sendfile_solaris.go3
-rw-r--r--src/internal/poll/sock_cloexec.go1
-rw-r--r--src/internal/poll/sockopt.go1
-rw-r--r--src/internal/poll/sockopt_unix.go1
-rw-r--r--src/internal/poll/sockoptip.go1
-rw-r--r--src/internal/poll/splice_linux.go2
-rw-r--r--src/internal/poll/strconv.go1
-rw-r--r--src/internal/poll/sys_cloexec.go1
-rw-r--r--src/internal/poll/writev.go1
-rw-r--r--src/internal/race/norace.go1
-rw-r--r--src/internal/race/race.go1
-rw-r--r--src/internal/syscall/execenv/execenv_default.go1
-rw-r--r--src/internal/syscall/execenv/execenv_windows.go1
-rw-r--r--src/internal/syscall/unix/at.go1
-rw-r--r--src/internal/syscall/unix/at_libc.go1
-rw-r--r--src/internal/syscall/unix/at_sysnum_fstatat64_linux.go1
-rw-r--r--src/internal/syscall/unix/at_sysnum_fstatat_linux.go1
-rw-r--r--src/internal/syscall/unix/at_sysnum_newfstatat_linux.go1
-rw-r--r--src/internal/syscall/unix/fcntl_linux_32bit.go1
-rw-r--r--src/internal/syscall/unix/nonblocking.go1
-rw-r--r--src/internal/syscall/unix/nonblocking_js.go1
-rw-r--r--src/internal/syscall/unix/nonblocking_libc.go1
-rw-r--r--src/internal/syscall/unix/pipe2_illumos.go1
-rw-r--r--src/internal/syscall/unix/sysnum_linux_generic.go1
-rw-r--r--src/internal/syscall/unix/sysnum_linux_mips64x.go1
-rw-r--r--src/internal/syscall/unix/sysnum_linux_mipsx.go1
-rw-r--r--src/internal/syscall/unix/sysnum_linux_ppc64x.go1
-rw-r--r--src/internal/syscall/unix/writev_illumos.go1
-rw-r--r--src/internal/testenv/testenv_cgo.go1
-rw-r--r--src/internal/testenv/testenv_notwin.go1
-rw-r--r--src/io/fs/fs.go22
-rw-r--r--src/io/fs/fs_test.go7
-rw-r--r--src/io/fs/glob.go5
-rw-r--r--src/io/fs/glob_test.go3
-rw-r--r--src/io/fs/sub.go2
-rw-r--r--src/io/ioutil/tempfile.go108
-rw-r--r--src/io/ioutil/tempfile_test.go13
-rw-r--r--src/log/syslog/example_test.go1
-rw-r--r--src/log/syslog/syslog.go1
-rw-r--r--src/log/syslog/syslog_test.go1
-rw-r--r--src/log/syslog/syslog_unix.go1
-rw-r--r--src/math/all_test.go34
-rw-r--r--src/math/asin_386.s30
-rw-r--r--src/math/atan2_386.s13
-rw-r--r--src/math/atan_386.s13
-rw-r--r--src/math/big/arith_amd64.go1
-rw-r--r--src/math/big/arith_decl.go1
-rw-r--r--src/math/big/arith_decl_pure.go1
-rw-r--r--src/math/big/arith_decl_s390x.go1
-rw-r--r--src/math/big/arith_s390x_test.go1
-rw-r--r--src/math/big/nat.go2
-rw-r--r--src/math/bits/bits_errors.go1
-rw-r--r--src/math/bits/bits_errors_bootstrap.go1
-rw-r--r--src/math/bits/make_examples.go1
-rw-r--r--src/math/bits/make_tables.go1
-rw-r--r--src/math/cmplx/huge_test.go1
-rw-r--r--src/math/exp2_386.s40
-rw-r--r--src/math/exp_asm.go1
-rw-r--r--src/math/expm1_386.s57
-rw-r--r--src/math/frexp_386.s25
-rw-r--r--src/math/huge_test.go1
-rw-r--r--src/math/ldexp_386.s14
-rw-r--r--src/math/log10_386.s21
-rw-r--r--src/math/log1p_386.s27
-rw-r--r--src/math/log_386.s13
-rw-r--r--src/math/mod_386.s17
-rw-r--r--src/math/modf_386.s34
-rw-r--r--src/math/rand/gen_cooked.go1
-rw-r--r--src/math/remainder_386.s17
-rw-r--r--src/math/stubs_386.s45
-rw-r--r--src/mime/type_unix.go1
-rw-r--r--src/net/addrselect.go1
-rw-r--r--src/net/addrselect_test.go1
-rw-r--r--src/net/cgo_aix.go1
-rw-r--r--src/net/cgo_android.go1
-rw-r--r--src/net/cgo_bsd.go4
-rw-r--r--src/net/cgo_linux.go1
-rw-r--r--src/net/cgo_netbsd.go1
-rw-r--r--src/net/cgo_openbsd.go1
-rw-r--r--src/net/cgo_resnew.go4
-rw-r--r--src/net/cgo_resold.go4
-rw-r--r--src/net/cgo_socknew.go4
-rw-r--r--src/net/cgo_sockold.go4
-rw-r--r--src/net/cgo_solaris.go1
-rw-r--r--src/net/cgo_stub.go1
-rw-r--r--src/net/cgo_unix.go4
-rw-r--r--src/net/cgo_unix_test.go4
-rw-r--r--src/net/cgo_windows.go1
-rw-r--r--src/net/conf.go1
-rw-r--r--src/net/conf_netcgo.go1
-rw-r--r--src/net/conf_test.go1
-rw-r--r--src/net/conn_test.go1
-rw-r--r--src/net/dial_test.go1
-rw-r--r--src/net/dial_unix_test.go1
-rw-r--r--src/net/dnsclient_unix.go1
-rw-r--r--src/net/dnsclient_unix_test.go1
-rw-r--r--src/net/dnsconfig_unix.go1
-rw-r--r--src/net/dnsconfig_unix_test.go1
-rw-r--r--src/net/dnsname_test.go1
-rw-r--r--src/net/error_posix.go1
-rw-r--r--src/net/error_posix_test.go1
-rw-r--r--src/net/error_test.go1
-rw-r--r--src/net/error_unix.go1
-rw-r--r--src/net/error_unix_test.go1
-rw-r--r--src/net/external_test.go1
-rw-r--r--src/net/fd_posix.go1
-rw-r--r--src/net/fd_unix.go1
-rw-r--r--src/net/file_stub.go1
-rw-r--r--src/net/file_test.go1
-rw-r--r--src/net/file_unix.go1
-rw-r--r--src/net/hook_unix.go1
-rw-r--r--src/net/http/cgi/plan9_test.go1
-rw-r--r--src/net/http/cgi/posix_test.go1
-rw-r--r--src/net/http/h2_bundle.go1
-rw-r--r--src/net/http/omithttp2.go1
-rw-r--r--src/net/http/roundtrip.go1
-rw-r--r--src/net/http/roundtrip_js.go1
-rw-r--r--src/net/http/triv.go1
-rw-r--r--src/net/interface_bsd.go1
-rw-r--r--src/net/interface_bsd_test.go1
-rw-r--r--src/net/interface_bsdvar.go1
-rw-r--r--src/net/interface_stub.go1
-rw-r--r--src/net/interface_test.go1
-rw-r--r--src/net/interface_unix_test.go1
-rw-r--r--src/net/internal/socktest/main_test.go1
-rw-r--r--src/net/internal/socktest/main_unix_test.go1
-rw-r--r--src/net/internal/socktest/switch_posix.go1
-rw-r--r--src/net/internal/socktest/switch_stub.go1
-rw-r--r--src/net/internal/socktest/switch_unix.go1
-rw-r--r--src/net/internal/socktest/sys_cloexec.go1
-rw-r--r--src/net/internal/socktest/sys_unix.go1
-rw-r--r--src/net/ip_test.go1
-rw-r--r--src/net/iprawsock_posix.go1
-rw-r--r--src/net/iprawsock_test.go1
-rw-r--r--src/net/ipsock_posix.go1
-rw-r--r--src/net/listen_test.go1
-rw-r--r--src/net/lookup_fake.go1
-rw-r--r--src/net/lookup_test.go1
-rw-r--r--src/net/lookup_unix.go1
-rw-r--r--src/net/main_cloexec_test.go1
-rw-r--r--src/net/main_conf_test.go1
-rw-r--r--src/net/main_noconf_test.go1
-rw-r--r--src/net/main_posix_test.go1
-rw-r--r--src/net/main_test.go1
-rw-r--r--src/net/main_unix_test.go1
-rw-r--r--src/net/mockserver_test.go1
-rw-r--r--src/net/net_fake.go1
-rw-r--r--src/net/net_test.go1
-rw-r--r--src/net/net_windows_test.go17
-rw-r--r--src/net/netgo_unix_test.go1
-rw-r--r--src/net/nss.go1
-rw-r--r--src/net/nss_test.go1
-rw-r--r--src/net/packetconn_test.go1
-rw-r--r--src/net/port_unix.go1
-rw-r--r--src/net/protoconn_test.go1
-rw-r--r--src/net/rawconn_stub_test.go1
-rw-r--r--src/net/rawconn_test.go1
-rw-r--r--src/net/rawconn_unix_test.go1
-rw-r--r--src/net/rpc/server.go2
-rw-r--r--src/net/sendfile_stub.go1
-rw-r--r--src/net/sendfile_test.go66
-rw-r--r--src/net/sendfile_unix_alt.go1
-rw-r--r--src/net/server_test.go1
-rw-r--r--src/net/sock_bsd.go1
-rw-r--r--src/net/sock_cloexec.go1
-rw-r--r--src/net/sock_posix.go1
-rw-r--r--src/net/sock_stub.go1
-rw-r--r--src/net/sockaddr_posix.go1
-rw-r--r--src/net/sockopt_bsd.go1
-rw-r--r--src/net/sockopt_posix.go1
-rw-r--r--src/net/sockopt_stub.go1
-rw-r--r--src/net/sockoptip_bsdvar.go1
-rw-r--r--src/net/sockoptip_posix.go1
-rw-r--r--src/net/sockoptip_stub.go1
-rw-r--r--src/net/splice_stub.go1
-rw-r--r--src/net/splice_test.go1
-rw-r--r--src/net/sys_cloexec.go1
-rw-r--r--src/net/tcpsock_posix.go1
-rw-r--r--src/net/tcpsock_test.go1
-rw-r--r--src/net/tcpsock_unix_test.go1
-rw-r--r--src/net/tcpsockopt_posix.go1
-rw-r--r--src/net/tcpsockopt_stub.go1
-rw-r--r--src/net/tcpsockopt_unix.go1
-rw-r--r--src/net/timeout_test.go1
-rw-r--r--src/net/udpsock_posix.go1
-rw-r--r--src/net/udpsock_test.go1
-rw-r--r--src/net/unixsock_posix.go1
-rw-r--r--src/net/unixsock_test.go1
-rw-r--r--src/net/unixsock_windows_test.go1
-rw-r--r--src/net/write_unix_test.go1
-rw-r--r--src/net/writev_test.go1
-rw-r--r--src/net/writev_unix.go1
-rw-r--r--src/os/dir_unix.go1
-rw-r--r--src/os/endian_big.go1
-rw-r--r--src/os/endian_little.go1
-rw-r--r--src/os/env_unix_test.go1
-rw-r--r--src/os/error_errno.go1
-rw-r--r--src/os/error_posix.go1
-rw-r--r--src/os/error_unix_test.go1
-rw-r--r--src/os/error_windows_test.go1
-rw-r--r--src/os/exec/exec_linux_test.go1
-rw-r--r--src/os/exec/exec_posix_test.go1
-rw-r--r--src/os/exec/exec_test.go10
-rw-r--r--src/os/exec/exec_unix.go1
-rw-r--r--src/os/exec/exec_windows_test.go43
-rw-r--r--src/os/exec/lp_js.go1
-rw-r--r--src/os/exec/lp_unix.go1
-rw-r--r--src/os/exec/lp_unix_test.go1
-rw-r--r--src/os/exec/lp_windows_test.go19
-rw-r--r--src/os/exec/read3.go1
-rw-r--r--src/os/exec_posix.go8
-rw-r--r--src/os/exec_unix.go1
-rw-r--r--src/os/exec_unix_test.go1
-rw-r--r--src/os/executable_path.go1
-rw-r--r--src/os/executable_plan9.go1
-rw-r--r--src/os/executable_procfs.go1
-rw-r--r--src/os/executable_sysctl.go1
-rw-r--r--src/os/export_unix_test.go1
-rw-r--r--src/os/fifo_test.go1
-rw-r--r--src/os/file.go22
-rw-r--r--src/os/file_posix.go1
-rw-r--r--src/os/file_unix.go1
-rw-r--r--src/os/file_windows.go5
-rw-r--r--src/os/os_test.go52
-rw-r--r--src/os/os_unix_test.go1
-rw-r--r--src/os/path_unix.go1
-rw-r--r--src/os/pipe2_bsd.go3
-rw-r--r--src/os/pipe2_illumos.go1
-rw-r--r--src/os/pipe_bsd.go3
-rw-r--r--src/os/pipe_test.go1
-rw-r--r--src/os/rawconn.go1
-rw-r--r--src/os/rawconn_test.go1
-rw-r--r--src/os/readfrom_linux_test.go38
-rw-r--r--src/os/readfrom_stub.go1
-rw-r--r--src/os/removeall_at.go1
-rw-r--r--src/os/removeall_noat.go1
-rw-r--r--src/os/signal/example_unix_test.go1
-rw-r--r--src/os/signal/internal/pty/pty.go1
-rw-r--r--src/os/signal/signal_cgo_test.go1
-rw-r--r--src/os/signal/signal_linux_test.go1
-rw-r--r--src/os/signal/signal_test.go1
-rw-r--r--src/os/signal/signal_unix.go1
-rw-r--r--src/os/stat_js.go1
-rw-r--r--src/os/stat_unix.go1
-rw-r--r--src/os/sticky_bsd.go1
-rw-r--r--src/os/sticky_notbsd.go1
-rw-r--r--src/os/str.go36
-rw-r--r--src/os/sys_bsd.go1
-rw-r--r--src/os/sys_js.go1
-rw-r--r--src/os/sys_unix.go1
-rw-r--r--src/os/timeout_test.go5
-rw-r--r--src/os/types_unix.go4
-rw-r--r--src/os/user/cgo_lookup_unix.go4
-rw-r--r--src/os/user/cgo_unix_test.go4
-rw-r--r--src/os/user/getgrouplist_darwin.go1
-rw-r--r--src/os/user/getgrouplist_unix.go4
-rw-r--r--src/os/user/listgroups_aix.go1
-rw-r--r--src/os/user/listgroups_solaris.go1
-rw-r--r--src/os/user/listgroups_unix.go4
-rw-r--r--src/os/user/lookup_android.go1
-rw-r--r--src/os/user/lookup_stubs.go1
-rw-r--r--src/os/user/lookup_unix.go1
-rw-r--r--src/os/user/lookup_unix_test.go1
-rw-r--r--src/os/wait_unimp.go1
-rw-r--r--src/os/wait_wait6.go1
-rw-r--r--src/os/wait_waitid.go1
-rw-r--r--src/path/filepath/example_unix_test.go1
-rw-r--r--src/path/filepath/example_unix_walk_test.go1
-rw-r--r--src/path/filepath/path_unix.go1
-rw-r--r--src/path/filepath/symlink_unix.go1
-rw-r--r--src/plugin/plugin_dlopen.go1
-rw-r--r--src/plugin/plugin_stubs.go1
-rw-r--r--src/plugin/plugin_test.go1
-rwxr-xr-xsrc/race.bash7
-rw-r--r--src/reflect/abi.go400
-rw-r--r--src/reflect/all_test.go55
-rw-r--r--src/reflect/export_test.go12
-rw-r--r--src/reflect/makefunc.go10
-rw-r--r--src/reflect/type.go82
-rw-r--r--src/reflect/value.go249
-rw-r--r--src/regexp/exec2_test.go1
-rwxr-xr-xsrc/run.bash10
-rw-r--r--src/run.bat4
-rwxr-xr-xsrc/run.rc9
-rw-r--r--src/runtime/asm.s5
-rw-r--r--src/runtime/asm_386.s94
-rw-r--r--src/runtime/asm_amd64.s248
-rw-r--r--src/runtime/asm_arm.s117
-rw-r--r--src/runtime/asm_arm64.s109
-rw-r--r--src/runtime/asm_mips64x.s90
-rw-r--r--src/runtime/asm_mipsx.s83
-rw-r--r--src/runtime/asm_ppc64x.s86
-rw-r--r--src/runtime/asm_riscv64.s86
-rw-r--r--src/runtime/asm_s390x.s84
-rw-r--r--src/runtime/asm_wasm.s38
-rw-r--r--src/runtime/auxv_none.go8
-rw-r--r--src/runtime/cgo/callbacks_traceback.go1
-rw-r--r--src/runtime/cgo/dragonfly.go1
-rw-r--r--src/runtime/cgo/freebsd.go1
-rw-r--r--src/runtime/cgo/gcc_amd64.S7
-rw-r--r--src/runtime/cgo/gcc_darwin_amd64.c11
-rw-r--r--src/runtime/cgo/gcc_dragonfly_amd64.c7
-rw-r--r--src/runtime/cgo/gcc_freebsd_amd64.c7
-rw-r--r--src/runtime/cgo/gcc_libinit_windows.c2
-rw-r--r--src/runtime/cgo/gcc_linux_amd64.c7
-rw-r--r--src/runtime/cgo/gcc_netbsd_amd64.c7
-rw-r--r--src/runtime/cgo/gcc_openbsd_amd64.c7
-rw-r--r--src/runtime/cgo/gcc_solaris_amd64.c7
-rw-r--r--src/runtime/cgo/gcc_windows_amd64.c12
-rw-r--r--src/runtime/cgo/libcgo.h2
-rw-r--r--src/runtime/cgo/linux.go1
-rw-r--r--src/runtime/cgo/linux_syscall.c2
-rw-r--r--src/runtime/cgo/mmap.go1
-rw-r--r--src/runtime/cgo/netbsd.go1
-rw-r--r--src/runtime/cgo/openbsd.go1
-rw-r--r--src/runtime/cgo/setenv.go1
-rw-r--r--src/runtime/cgo/sigaction.go1
-rw-r--r--src/runtime/cgo_mmap.go1
-rw-r--r--src/runtime/cgo_ppc64x.go1
-rw-r--r--src/runtime/cgo_sigaction.go1
-rw-r--r--src/runtime/cgocall.go9
-rw-r--r--src/runtime/chan.go30
-rw-r--r--src/runtime/chan_test.go4
-rw-r--r--src/runtime/cpuprof.go11
-rw-r--r--src/runtime/cputicks.go9
-rw-r--r--src/runtime/crash_cgo_test.go1
-rw-r--r--src/runtime/crash_nonunix_test.go1
-rw-r--r--src/runtime/crash_unix_test.go1
-rw-r--r--src/runtime/debug/panic_test.go1
-rw-r--r--src/runtime/debug_test.go5
-rw-r--r--src/runtime/debugcall.go1
-rw-r--r--src/runtime/debuglog_off.go1
-rw-r--r--src/runtime/debuglog_on.go1
-rw-r--r--src/runtime/defs1_linux.go1
-rw-r--r--src/runtime/defs2_linux.go1
-rw-r--r--src/runtime/defs3_linux.go1
-rw-r--r--src/runtime/defs_aix.go1
-rw-r--r--src/runtime/defs_aix_ppc64.go1
-rw-r--r--src/runtime/defs_arm_linux.go1
-rw-r--r--src/runtime/defs_darwin.go1
-rw-r--r--src/runtime/defs_dragonfly.go5
-rw-r--r--src/runtime/defs_dragonfly_amd64.go4
-rw-r--r--src/runtime/defs_freebsd.go1
-rw-r--r--src/runtime/defs_linux.go1
-rw-r--r--src/runtime/defs_linux_mips64x.go1
-rw-r--r--src/runtime/defs_linux_mipsx.go1
-rw-r--r--src/runtime/defs_netbsd.go1
-rw-r--r--src/runtime/defs_netbsd_386.go1
-rw-r--r--src/runtime/defs_netbsd_amd64.go1
-rw-r--r--src/runtime/defs_netbsd_arm.go1
-rw-r--r--src/runtime/defs_openbsd.go1
-rw-r--r--src/runtime/defs_solaris.go1
-rw-r--r--src/runtime/defs_solaris_amd64.go1
-rw-r--r--src/runtime/defs_windows.go128
-rw-r--r--src/runtime/defs_windows_386.go84
-rw-r--r--src/runtime/defs_windows_amd64.go87
-rw-r--r--src/runtime/defs_windows_arm.go85
-rw-r--r--src/runtime/defs_windows_arm64.go83
-rw-r--r--src/runtime/duff_amd64.s128
-rw-r--r--src/runtime/env_posix.go1
-rw-r--r--src/runtime/export_debug_test.go4
-rw-r--r--src/runtime/export_futex_test.go1
-rw-r--r--src/runtime/export_mmap_test.go1
-rw-r--r--src/runtime/export_pipe2_test.go3
-rw-r--r--src/runtime/export_pipe_test.go3
-rw-r--r--src/runtime/export_test.go2
-rw-r--r--src/runtime/export_unix_test.go1
-rw-r--r--src/runtime/extern.go4
-rw-r--r--src/runtime/futex_test.go1
-rw-r--r--src/runtime/hash32.go1
-rw-r--r--src/runtime/hash64.go1
-rw-r--r--src/runtime/histogram.go2
-rw-r--r--src/runtime/iface.go28
-rw-r--r--src/runtime/internal/atomic/atomic_386.go1
-rw-r--r--src/runtime/internal/atomic/atomic_arm.go1
-rw-r--r--src/runtime/internal/atomic/atomic_arm64.go1
-rw-r--r--src/runtime/internal/atomic/atomic_mips64x.go1
-rw-r--r--src/runtime/internal/atomic/atomic_mipsx.go1
-rw-r--r--src/runtime/internal/atomic/atomic_ppc64x.go1
-rw-r--r--src/runtime/internal/atomic/stubs.go1
-rw-r--r--src/runtime/internal/sys/arch.go34
-rw-r--r--src/runtime/internal/sys/arch_386.go13
-rw-r--r--src/runtime/internal/sys/arch_amd64.go13
-rw-r--r--src/runtime/internal/sys/arch_arm.go13
-rw-r--r--src/runtime/internal/sys/arch_arm64.go13
-rw-r--r--src/runtime/internal/sys/arch_mips.go13
-rw-r--r--src/runtime/internal/sys/arch_mips64.go13
-rw-r--r--src/runtime/internal/sys/arch_mips64le.go13
-rw-r--r--src/runtime/internal/sys/arch_mipsle.go13
-rw-r--r--src/runtime/internal/sys/arch_ppc64.go13
-rw-r--r--src/runtime/internal/sys/arch_ppc64le.go13
-rw-r--r--src/runtime/internal/sys/arch_riscv64.go15
-rw-r--r--src/runtime/internal/sys/arch_s390x.go13
-rw-r--r--src/runtime/internal/sys/arch_wasm.go13
-rw-r--r--src/runtime/internal/sys/gengoos.go1
-rw-r--r--src/runtime/internal/sys/intrinsics.go1
-rw-r--r--src/runtime/internal/sys/intrinsics_stubs.go1
-rw-r--r--src/runtime/internal/sys/stubs.go16
-rw-r--r--src/runtime/internal/sys/zgoarch_386.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_amd64.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_arm.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_arm64.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_arm64be.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_armbe.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_mips.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_mips64.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_mips64le.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_mips64p32.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_mips64p32le.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_mipsle.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_ppc.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_ppc64.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_ppc64le.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_riscv.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_riscv64.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_s390.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_s390x.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_sparc.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_sparc64.go1
-rw-r--r--src/runtime/internal/sys/zgoarch_wasm.go1
-rw-r--r--src/runtime/internal/sys/zgoos_aix.go1
-rw-r--r--src/runtime/internal/sys/zgoos_android.go1
-rw-r--r--src/runtime/internal/sys/zgoos_darwin.go4
-rw-r--r--src/runtime/internal/sys/zgoos_dragonfly.go1
-rw-r--r--src/runtime/internal/sys/zgoos_freebsd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_hurd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_illumos.go1
-rw-r--r--src/runtime/internal/sys/zgoos_ios.go1
-rw-r--r--src/runtime/internal/sys/zgoos_js.go1
-rw-r--r--src/runtime/internal/sys/zgoos_linux.go4
-rw-r--r--src/runtime/internal/sys/zgoos_netbsd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_openbsd.go1
-rw-r--r--src/runtime/internal/sys/zgoos_plan9.go1
-rw-r--r--src/runtime/internal/sys/zgoos_solaris.go4
-rw-r--r--src/runtime/internal/sys/zgoos_windows.go1
-rw-r--r--src/runtime/internal/sys/zgoos_zos.go1
-rw-r--r--src/runtime/lfstack_32bit.go1
-rw-r--r--src/runtime/lfstack_64bit.go1
-rw-r--r--src/runtime/libfuzzer.go1
-rw-r--r--src/runtime/lock_futex.go1
-rw-r--r--src/runtime/lock_js.go1
-rw-r--r--src/runtime/lock_sema.go1
-rw-r--r--src/runtime/lockrank_off.go1
-rw-r--r--src/runtime/lockrank_on.go3
-rw-r--r--src/runtime/mbarrier.go10
-rw-r--r--src/runtime/mem_bsd.go1
-rw-r--r--src/runtime/mem_js.go1
-rw-r--r--src/runtime/memclr_arm.s1
-rw-r--r--src/runtime/memclr_arm64.s1
-rw-r--r--src/runtime/metrics.go2
-rw-r--r--src/runtime/metrics/doc.go5
-rw-r--r--src/runtime/metrics/example_test.go2
-rw-r--r--src/runtime/metrics/sample.go8
-rw-r--r--src/runtime/metrics/value.go2
-rw-r--r--src/runtime/mfinal.go11
-rw-r--r--src/runtime/mgc.go8
-rw-r--r--src/runtime/mgcscavenge.go2
-rw-r--r--src/runtime/mkduff.go15
-rw-r--r--src/runtime/mkfastlog2table.go1
-rw-r--r--src/runtime/mkpreempt.go20
-rw-r--r--src/runtime/mksizeclasses.go1
-rw-r--r--src/runtime/mmap.go1
-rw-r--r--src/runtime/mpagealloc_32bit.go1
-rw-r--r--src/runtime/mpagealloc_64bit.go1
-rw-r--r--src/runtime/msan.go1
-rw-r--r--src/runtime/msan0.go1
-rw-r--r--src/runtime/nbpipe_fcntl_libc_test.go1
-rw-r--r--src/runtime/nbpipe_fcntl_unix_test.go1
-rw-r--r--src/runtime/nbpipe_pipe.go3
-rw-r--r--src/runtime/nbpipe_pipe2.go3
-rw-r--r--src/runtime/nbpipe_test.go1
-rw-r--r--src/runtime/netpoll.go10
-rw-r--r--src/runtime/netpoll_epoll.go1
-rw-r--r--src/runtime/netpoll_fake.go1
-rw-r--r--src/runtime/netpoll_kqueue.go1
-rw-r--r--src/runtime/netpoll_stub.go1
-rw-r--r--src/runtime/norace_linux_test.go1
-rw-r--r--src/runtime/norace_test.go1
-rw-r--r--src/runtime/os2_aix.go42
-rw-r--r--src/runtime/os3_plan9.go4
-rw-r--r--src/runtime/os3_solaris.go20
-rw-r--r--src/runtime/os_aix.go1
-rw-r--r--src/runtime/os_darwin.go5
-rw-r--r--src/runtime/os_dragonfly.go12
-rw-r--r--src/runtime/os_freebsd.go5
-rw-r--r--src/runtime/os_freebsd2.go1
-rw-r--r--src/runtime/os_freebsd_noauxv.go4
-rw-r--r--src/runtime/os_js.go11
-rw-r--r--src/runtime/os_linux.go5
-rw-r--r--src/runtime/os_linux_arm64.go1
-rw-r--r--src/runtime/os_linux_be64.go1
-rw-r--r--src/runtime/os_linux_generic.go9
-rw-r--r--src/runtime/os_linux_mips64x.go1
-rw-r--r--src/runtime/os_linux_mipsx.go1
-rw-r--r--src/runtime/os_linux_noauxv.go4
-rw-r--r--src/runtime/os_linux_novdso.go4
-rw-r--r--src/runtime/os_linux_ppc64x.go1
-rw-r--r--src/runtime/os_linux_x86.go1
-rw-r--r--src/runtime/os_netbsd.go5
-rw-r--r--src/runtime/os_nonopenbsd.go1
-rw-r--r--src/runtime/os_only_solaris.go1
-rw-r--r--src/runtime/os_openbsd_libc.go1
-rw-r--r--src/runtime/os_openbsd_syscall.go4
-rw-r--r--src/runtime/os_openbsd_syscall1.go6
-rw-r--r--src/runtime/os_openbsd_syscall2.go6
-rw-r--r--src/runtime/os_plan9.go10
-rw-r--r--src/runtime/os_windows.go76
-rw-r--r--src/runtime/os_windows_arm64.go14
-rw-r--r--src/runtime/panic.go13
-rw-r--r--src/runtime/panic32.go1
-rw-r--r--src/runtime/pprof/mprof_test.go19
-rw-r--r--src/runtime/pprof/pprof_norusage.go1
-rw-r--r--src/runtime/pprof/pprof_rusage.go1
-rw-r--r--src/runtime/pprof/pprof_test.go55
-rw-r--r--src/runtime/preempt_amd64.s10
-rw-r--r--src/runtime/preempt_nonwindows.go1
-rw-r--r--src/runtime/print.go26
-rw-r--r--src/runtime/proc.go180
-rw-r--r--src/runtime/race.go1
-rw-r--r--src/runtime/race/README1
-rw-r--r--src/runtime/race/output_test.go1
-rw-r--r--src/runtime/race/race.go3
-rw-r--r--src/runtime/race/race_linux_test.go1
-rw-r--r--src/runtime/race/race_openbsd_amd64.sysobin0 -> 688784 bytes
-rw-r--r--src/runtime/race/race_test.go1
-rw-r--r--src/runtime/race/race_unix_test.go1
-rw-r--r--src/runtime/race/race_windows_test.go1
-rw-r--r--src/runtime/race/sched_test.go1
-rw-r--r--src/runtime/race/syso_test.go1
-rw-r--r--src/runtime/race/testdata/mutex_test.go9
-rw-r--r--src/runtime/race/timer_test.go1
-rw-r--r--src/runtime/race0.go1
-rw-r--r--src/runtime/race_amd64.s36
-rw-r--r--src/runtime/relax_stub.go1
-rw-r--r--src/runtime/rt0_windows_arm64.s12
-rw-r--r--src/runtime/runtime2.go17
-rw-r--r--src/runtime/runtime_mmap_test.go1
-rw-r--r--src/runtime/runtime_test.go4
-rw-r--r--src/runtime/runtime_unix_test.go1
-rw-r--r--src/runtime/semasleep_test.go1
-rw-r--r--src/runtime/sigaction.go1
-rw-r--r--src/runtime/signal_386.go1
-rw-r--r--src/runtime/signal_aix_ppc64.go1
-rw-r--r--src/runtime/signal_amd64.go8
-rw-r--r--src/runtime/signal_arm.go1
-rw-r--r--src/runtime/signal_arm64.go3
-rw-r--r--src/runtime/signal_linux_mips64x.go1
-rw-r--r--src/runtime/signal_linux_mipsx.go1
-rw-r--r--src/runtime/signal_linux_ppc64x.go1
-rw-r--r--src/runtime/signal_mips64x.go1
-rw-r--r--src/runtime/signal_mipsx.go1
-rw-r--r--src/runtime/signal_ppc64x.go1
-rw-r--r--src/runtime/signal_riscv64.go1
-rw-r--r--src/runtime/signal_unix.go1
-rw-r--r--src/runtime/signal_windows.go64
-rw-r--r--src/runtime/signal_windows_test.go1
-rw-r--r--src/runtime/sigqueue.go1
-rw-r--r--src/runtime/sigqueue_note.go4
-rw-r--r--src/runtime/sigtab_linux_generic.go7
-rw-r--r--src/runtime/sigtab_linux_mipsx.go1
-rw-r--r--src/runtime/stack.go6
-rw-r--r--src/runtime/stubs.go62
-rw-r--r--src/runtime/stubs2.go14
-rw-r--r--src/runtime/stubs3.go8
-rw-r--r--src/runtime/stubs_386.go3
-rw-r--r--src/runtime/stubs_amd64.go5
-rw-r--r--src/runtime/stubs_arm.go5
-rw-r--r--src/runtime/stubs_arm64.go7
-rw-r--r--src/runtime/stubs_linux.go1
-rw-r--r--src/runtime/stubs_mips64x.go6
-rw-r--r--src/runtime/stubs_mipsx.go1
-rw-r--r--src/runtime/stubs_nonlinux.go1
-rw-r--r--src/runtime/stubs_ppc64x.go1
-rw-r--r--src/runtime/symtab.go49
-rw-r--r--src/runtime/sys_darwin.go8
-rw-r--r--src/runtime/sys_darwin_amd64.s96
-rw-r--r--src/runtime/sys_dragonfly_amd64.s18
-rw-r--r--src/runtime/sys_libc.go1
-rw-r--r--src/runtime/sys_linux_amd64.s17
-rw-r--r--src/runtime/sys_mips64x.go1
-rw-r--r--src/runtime/sys_mipsx.go1
-rw-r--r--src/runtime/sys_nonppc64x.go1
-rw-r--r--src/runtime/sys_openbsd.go1
-rw-r--r--src/runtime/sys_openbsd1.go6
-rw-r--r--src/runtime/sys_openbsd2.go7
-rw-r--r--src/runtime/sys_openbsd3.go1
-rw-r--r--src/runtime/sys_ppc64x.go1
-rw-r--r--src/runtime/sys_wasm.go6
-rw-r--r--src/runtime/sys_windows_386.s98
-rw-r--r--src/runtime/sys_windows_amd64.s91
-rw-r--r--src/runtime/sys_windows_arm.s208
-rw-r--r--src/runtime/sys_windows_arm64.s579
-rw-r--r--src/runtime/sys_x86.go7
-rw-r--r--src/runtime/syscall_windows.go15
-rw-r--r--src/runtime/time_fake.go4
-rw-r--r--src/runtime/time_nofake.go1
-rw-r--r--src/runtime/timeasm.go1
-rw-r--r--src/runtime/timestub.go1
-rw-r--r--src/runtime/timestub2.go8
-rw-r--r--src/runtime/tls_arm64.h12
-rw-r--r--src/runtime/tls_arm64.s8
-rw-r--r--src/runtime/traceback.go113
-rw-r--r--src/runtime/vdso_elf32.go1
-rw-r--r--src/runtime/vdso_elf64.go1
-rw-r--r--src/runtime/vdso_freebsd.go1
-rw-r--r--src/runtime/vdso_freebsd_x86.go1
-rw-r--r--src/runtime/vdso_in_none.go1
-rw-r--r--src/runtime/vdso_linux.go1
-rw-r--r--src/runtime/vdso_linux_mips64x.go1
-rw-r--r--src/runtime/vdso_linux_ppc64x.go1
-rw-r--r--src/runtime/vlrt.go1
-rw-r--r--src/runtime/wincallback.go30
-rw-r--r--src/runtime/write_err.go1
-rw-r--r--src/runtime/zcallback_windows_arm64.s4012
-rw-r--r--src/sort/genzfunc.go1
-rw-r--r--src/sort/slice_go113.go1
-rw-r--r--src/sort/slice_go14.go1
-rw-r--r--src/sort/slice_go18.go1
-rw-r--r--src/strconv/bytealg.go1
-rw-r--r--src/strconv/bytealg_bootstrap.go1
-rw-r--r--src/strconv/makeisprint.go5
-rw-r--r--src/strconv/quote.go4
-rw-r--r--src/strings/builder.go3
-rw-r--r--src/strings/builder_test.go11
-rw-r--r--src/sync/pool_test.go1
-rw-r--r--src/sync/runtime2.go1
-rw-r--r--src/sync/runtime2_lockrank.go1
-rw-r--r--src/syscall/asm_linux_386.s20
-rw-r--r--src/syscall/asm_linux_amd64.s2
-rw-r--r--src/syscall/asm_linux_arm.s21
-rw-r--r--src/syscall/asm_linux_arm64.s1
-rw-r--r--src/syscall/asm_linux_mips64x.s20
-rw-r--r--src/syscall/asm_linux_mipsx.s17
-rw-r--r--src/syscall/bpf_bsd.go1
-rw-r--r--src/syscall/creds_test.go1
-rw-r--r--src/syscall/dirent.go1
-rw-r--r--src/syscall/dirent_test.go1
-rw-r--r--src/syscall/endian_big.go1
-rw-r--r--src/syscall/endian_little.go1
-rw-r--r--src/syscall/env_unix.go1
-rw-r--r--src/syscall/exec_aix_test.go1
-rw-r--r--src/syscall/exec_bsd.go1
-rw-r--r--src/syscall/exec_libc.go1
-rw-r--r--src/syscall/exec_libc2.go1
-rw-r--r--src/syscall/exec_linux.go9
-rw-r--r--src/syscall/exec_linux_test.go1
-rw-r--r--src/syscall/exec_plan9.go5
-rw-r--r--src/syscall/exec_solaris_test.go1
-rw-r--r--src/syscall/exec_unix.go1
-rw-r--r--src/syscall/exec_unix_test.go1
-rw-r--r--src/syscall/exec_windows.go56
-rw-r--r--src/syscall/exec_windows_test.go73
-rw-r--r--src/syscall/export_unix_test.go1
-rw-r--r--src/syscall/flock.go1
-rw-r--r--src/syscall/flock_linux_32bit.go1
-rw-r--r--src/syscall/forkpipe.go3
-rw-r--r--src/syscall/forkpipe2.go3
-rw-r--r--src/syscall/fs_js.go1
-rw-r--r--src/syscall/getdirentries_test.go1
-rw-r--r--src/syscall/mkasm.go4
-rw-r--r--src/syscall/mkpost.go1
-rw-r--r--src/syscall/mksyscall_windows.go1
-rw-r--r--src/syscall/mmap_unix_test.go1
-rw-r--r--src/syscall/msan.go1
-rw-r--r--src/syscall/msan0.go1
-rw-r--r--src/syscall/net_js.go1
-rw-r--r--src/syscall/ptrace_darwin.go1
-rw-r--r--src/syscall/ptrace_ios.go3
-rw-r--r--src/syscall/route_bsd.go1
-rw-r--r--src/syscall/route_freebsd_32bit.go1
-rw-r--r--src/syscall/route_freebsd_64bit.go1
-rw-r--r--src/syscall/setuidgid_32_linux.go1
-rw-r--r--src/syscall/setuidgid_linux.go4
-rw-r--r--src/syscall/sockcmsg_unix.go1
-rw-r--r--src/syscall/sockcmsg_unix_other.go1
-rw-r--r--src/syscall/syscall_bsd.go1
-rw-r--r--src/syscall/syscall_bsd_test.go1
-rw-r--r--src/syscall/syscall_dragonfly.go13
-rw-r--r--src/syscall/syscall_dup2_linux.go1
-rw-r--r--src/syscall/syscall_dup3_linux.go1
-rw-r--r--src/syscall/syscall_freebsd_test.go1
-rw-r--r--src/syscall/syscall_illumos.go1
-rw-r--r--src/syscall/syscall_js.go1
-rw-r--r--src/syscall/syscall_linux_386.go4
-rw-r--r--src/syscall/syscall_linux_arm.go4
-rw-r--r--src/syscall/syscall_linux_mips64x.go5
-rw-r--r--src/syscall/syscall_linux_mipsx.go5
-rw-r--r--src/syscall/syscall_linux_ppc64x.go1
-rw-r--r--src/syscall/syscall_openbsd1.go1
-rw-r--r--src/syscall/syscall_openbsd_libc.go1
-rw-r--r--src/syscall/syscall_ptrace_test.go1
-rw-r--r--src/syscall/syscall_unix.go1
-rw-r--r--src/syscall/syscall_unix_test.go1
-rw-r--r--src/syscall/syscall_windows.go84
-rw-r--r--src/syscall/syscall_windows_386.go5
-rw-r--r--src/syscall/syscall_windows_amd64.go5
-rw-r--r--src/syscall/tables_js.go1
-rw-r--r--src/syscall/time_fake.go1
-rw-r--r--src/syscall/time_nofake.go1
-rw-r--r--src/syscall/timestruct.go1
-rw-r--r--src/syscall/types_aix.go1
-rw-r--r--src/syscall/types_darwin.go1
-rw-r--r--src/syscall/types_dragonfly.go1
-rw-r--r--src/syscall/types_freebsd.go1
-rw-r--r--src/syscall/types_illumos_amd64.go1
-rw-r--r--src/syscall/types_linux.go1
-rw-r--r--src/syscall/types_netbsd.go1
-rw-r--r--src/syscall/types_openbsd.go1
-rw-r--r--src/syscall/types_solaris.go1
-rw-r--r--src/syscall/types_windows.go24
-rw-r--r--src/syscall/types_windows_arm64.go22
-rw-r--r--src/syscall/zerrors_darwin_amd64.go1
-rw-r--r--src/syscall/zerrors_darwin_arm64.go1
-rw-r--r--src/syscall/zerrors_dragonfly_amd64.go1
-rw-r--r--src/syscall/zerrors_freebsd_386.go1
-rw-r--r--src/syscall/zerrors_freebsd_amd64.go1
-rw-r--r--src/syscall/zerrors_freebsd_arm.go1
-rw-r--r--src/syscall/zerrors_freebsd_arm64.go1
-rw-r--r--src/syscall/zerrors_linux_386.go1
-rw-r--r--src/syscall/zerrors_linux_amd64.go1
-rw-r--r--src/syscall/zerrors_linux_arm.go1
-rw-r--r--src/syscall/zerrors_linux_arm64.go1
-rw-r--r--src/syscall/zerrors_linux_ppc64.go1
-rw-r--r--src/syscall/zerrors_linux_ppc64le.go1
-rw-r--r--src/syscall/zerrors_netbsd_386.go1
-rw-r--r--src/syscall/zerrors_netbsd_amd64.go1
-rw-r--r--src/syscall/zerrors_netbsd_arm.go1
-rw-r--r--src/syscall/zerrors_netbsd_arm64.go1
-rw-r--r--src/syscall/zerrors_openbsd_386.go1
-rw-r--r--src/syscall/zerrors_openbsd_amd64.go1
-rw-r--r--src/syscall/zerrors_openbsd_arm.go1
-rw-r--r--src/syscall/zerrors_solaris_amd64.go1
-rw-r--r--src/syscall/zerrors_windows_amd64.go5
-rw-r--r--src/syscall/zsyscall_aix_ppc64.go1
-rw-r--r--src/syscall/zsyscall_darwin_amd64.go1
-rw-r--r--src/syscall/zsyscall_darwin_amd64.s250
-rw-r--r--src/syscall/zsyscall_darwin_arm64.go1
-rw-r--r--src/syscall/zsyscall_darwin_arm64.s250
-rw-r--r--src/syscall/zsyscall_dragonfly_amd64.go13
-rw-r--r--src/syscall/zsyscall_freebsd_386.go1
-rw-r--r--src/syscall/zsyscall_freebsd_amd64.go1
-rw-r--r--src/syscall/zsyscall_freebsd_arm.go1
-rw-r--r--src/syscall/zsyscall_freebsd_arm64.go1
-rw-r--r--src/syscall/zsyscall_linux_386.go1
-rw-r--r--src/syscall/zsyscall_linux_amd64.go1
-rw-r--r--src/syscall/zsyscall_linux_arm.go1
-rw-r--r--src/syscall/zsyscall_linux_arm64.go1
-rw-r--r--src/syscall/zsyscall_linux_mips.go1
-rw-r--r--src/syscall/zsyscall_linux_mips64.go1
-rw-r--r--src/syscall/zsyscall_linux_mips64le.go1
-rw-r--r--src/syscall/zsyscall_linux_mipsle.go1
-rw-r--r--src/syscall/zsyscall_linux_ppc64.go1
-rw-r--r--src/syscall/zsyscall_linux_ppc64le.go1
-rw-r--r--src/syscall/zsyscall_linux_riscv64.go1
-rw-r--r--src/syscall/zsyscall_linux_s390x.go1
-rw-r--r--src/syscall/zsyscall_netbsd_386.go1
-rw-r--r--src/syscall/zsyscall_netbsd_amd64.go1
-rw-r--r--src/syscall/zsyscall_netbsd_arm.go1
-rw-r--r--src/syscall/zsyscall_netbsd_arm64.go1
-rw-r--r--src/syscall/zsyscall_openbsd_386.go1
-rw-r--r--src/syscall/zsyscall_openbsd_amd64.go1
-rw-r--r--src/syscall/zsyscall_openbsd_amd64.s230
-rw-r--r--src/syscall/zsyscall_openbsd_arm.go1
-rw-r--r--src/syscall/zsyscall_openbsd_arm64.go1
-rw-r--r--src/syscall/zsyscall_openbsd_arm64.s230
-rw-r--r--src/syscall/zsyscall_openbsd_mips64.go1
-rw-r--r--src/syscall/zsyscall_plan9_386.go1
-rw-r--r--src/syscall/zsyscall_plan9_amd64.go1
-rw-r--r--src/syscall/zsyscall_plan9_arm.go1
-rw-r--r--src/syscall/zsyscall_solaris_amd64.go1
-rw-r--r--src/syscall/zsyscall_windows.go30
-rw-r--r--src/syscall/zsysnum_darwin_amd64.go1
-rw-r--r--src/syscall/zsysnum_darwin_arm64.go1
-rw-r--r--src/syscall/zsysnum_dragonfly_amd64.go2
-rw-r--r--src/syscall/zsysnum_freebsd_386.go1
-rw-r--r--src/syscall/zsysnum_freebsd_amd64.go1
-rw-r--r--src/syscall/zsysnum_freebsd_arm.go1
-rw-r--r--src/syscall/zsysnum_freebsd_arm64.go1
-rw-r--r--src/syscall/zsysnum_linux_386.go1
-rw-r--r--src/syscall/zsysnum_linux_amd64.go1
-rw-r--r--src/syscall/zsysnum_linux_arm.go1
-rw-r--r--src/syscall/zsysnum_linux_arm64.go1
-rw-r--r--src/syscall/zsysnum_linux_ppc64.go1
-rw-r--r--src/syscall/zsysnum_linux_ppc64le.go1
-rw-r--r--src/syscall/zsysnum_netbsd_386.go1
-rw-r--r--src/syscall/zsysnum_netbsd_amd64.go1
-rw-r--r--src/syscall/zsysnum_netbsd_arm.go1
-rw-r--r--src/syscall/zsysnum_netbsd_arm64.go1
-rw-r--r--src/syscall/zsysnum_openbsd_386.go1
-rw-r--r--src/syscall/zsysnum_openbsd_amd64.go1
-rw-r--r--src/syscall/zsysnum_openbsd_arm.go1
-rw-r--r--src/syscall/zsysnum_solaris_amd64.go1
-rw-r--r--src/syscall/zsysnum_windows_386.go3
-rw-r--r--src/syscall/zsysnum_windows_amd64.go3
-rw-r--r--src/syscall/ztypes_darwin_amd64.go1
-rw-r--r--src/syscall/ztypes_darwin_arm64.go1
-rw-r--r--src/syscall/ztypes_dragonfly_amd64.go1
-rw-r--r--src/syscall/ztypes_freebsd_386.go1
-rw-r--r--src/syscall/ztypes_freebsd_amd64.go1
-rw-r--r--src/syscall/ztypes_freebsd_arm.go1
-rw-r--r--src/syscall/ztypes_freebsd_arm64.go1
-rw-r--r--src/syscall/ztypes_linux_386.go1
-rw-r--r--src/syscall/ztypes_linux_amd64.go1
-rw-r--r--src/syscall/ztypes_linux_arm.go1
-rw-r--r--src/syscall/ztypes_linux_arm64.go1
-rw-r--r--src/syscall/ztypes_linux_ppc64.go1
-rw-r--r--src/syscall/ztypes_linux_ppc64le.go1
-rw-r--r--src/syscall/ztypes_netbsd_386.go1
-rw-r--r--src/syscall/ztypes_netbsd_amd64.go1
-rw-r--r--src/syscall/ztypes_netbsd_arm.go1
-rw-r--r--src/syscall/ztypes_netbsd_arm64.go1
-rw-r--r--src/syscall/ztypes_openbsd_386.go1
-rw-r--r--src/syscall/ztypes_openbsd_amd64.go1
-rw-r--r--src/syscall/ztypes_solaris_amd64.go1
-rw-r--r--src/testing/fstest/testfs.go27
-rw-r--r--src/testing/fstest/testfs_test.go40
-rw-r--r--src/testing/run_example.go1
-rw-r--r--src/testing/run_example_js.go1
-rw-r--r--src/testing/sub_test.go2
-rw-r--r--src/testing/testing.go2
-rw-r--r--src/text/template/exec.go2
-rw-r--r--src/time/embed.go1
-rw-r--r--src/time/genzabbrs.go1
-rw-r--r--src/time/sys_plan9.go1
-rw-r--r--src/time/sys_unix.go1
-rw-r--r--src/time/tzdata/generate_zipdata.go1
-rw-r--r--src/time/zoneinfo.go6
-rw-r--r--src/time/zoneinfo_ios.go1
-rw-r--r--src/time/zoneinfo_js.go1
-rw-r--r--src/time/zoneinfo_test.go60
-rw-r--r--src/time/zoneinfo_unix.go1
-rw-r--r--src/time/zoneinfo_unix_test.go1
-rw-r--r--src/unicode/letter.go6
-rw-r--r--src/unicode/letter_test.go79
-rw-r--r--src/vendor/modules.txt2
-rw-r--r--test/abi/f_ret_z_not.go33
-rw-r--r--test/abi/f_ret_z_not.out1
-rw-r--r--test/abi/regabipragma.go6
-rw-r--r--test/closure3.go2
-rw-r--r--test/codegen/bits.go9
-rw-r--r--test/codegen/floats.go4
-rw-r--r--test/codegen/math.go11
-rw-r--r--test/codegen/memcombine.go9
-rw-r--r--test/codegen/memops.go4
-rw-r--r--test/codegen/structs.go4
-rw-r--r--test/escape5.go11
-rw-r--r--test/fixedbugs/bug511.dir/a.go11
-rw-r--r--test/fixedbugs/bug511.dir/b.go (renamed from src/syscall/zerrors_windows_386.go)10
-rw-r--r--test/fixedbugs/bug511.go9
-rw-r--r--test/fixedbugs/issue16760.go2
-rw-r--r--test/fixedbugs/issue24491a.go31
-rw-r--r--test/fixedbugs/issue31747.go4
-rw-r--r--test/fixedbugs/issue38698.go23
-rw-r--r--test/fixedbugs/issue44266.go23
-rw-r--r--test/fixedbugs/issue44325.dir/a.go13
-rw-r--r--test/fixedbugs/issue44325.dir/b.go13
-rw-r--r--test/fixedbugs/issue44325.go7
-rw-r--r--test/fixedbugs/issue44330.dir/a.go21
-rw-r--r--test/fixedbugs/issue44330.dir/b.go23
-rw-r--r--test/fixedbugs/issue44330.go7
-rw-r--r--test/fixedbugs/issue44335.dir/a.go17
-rw-r--r--test/fixedbugs/issue44335.dir/b.go11
-rw-r--r--test/fixedbugs/issue44335.go7
-rw-r--r--test/fixedbugs/issue44344.go30
-rw-r--r--test/fixedbugs/issue44355.dir/a.go7
-rw-r--r--test/fixedbugs/issue44355.dir/b.go9
-rw-r--r--test/fixedbugs/issue44355.go7
-rw-r--r--test/fixedbugs/issue44370.dir/a.go20
-rw-r--r--test/fixedbugs/issue44370.dir/b.go11
-rw-r--r--test/fixedbugs/issue44370.go7
-rw-r--r--test/fixedbugs/issue44378.go40
-rw-r--r--test/fixedbugs/issue44465.go21
-rw-r--r--test/inline.go30
-rw-r--r--test/nilptr.go3
-rw-r--r--test/prove.go18
-rw-r--r--test/reflectmethod7.go24
-rw-r--r--test/run.go6
-rw-r--r--test/typeparam/combine.go65
-rw-r--r--test/typeparam/fact.go32
-rw-r--r--test/typeparam/index.go46
-rw-r--r--test/typeparam/list.go65
-rw-r--r--test/typeparam/map.go39
-rw-r--r--test/typeparam/min.go41
-rw-r--r--test/typeparam/pair.go32
-rw-r--r--test/typeparam/settable.go59
-rw-r--r--test/typeparam/smallest.go42
-rw-r--r--test/typeparam/stringable.go46
-rw-r--r--test/typeparam/stringer.go88
-rw-r--r--test/typeparam/struct.go49
-rw-r--r--test/typeparam/sum.go50
-rw-r--r--test/typeparam/value.go75
1792 files changed, 25313 insertions, 46704 deletions
diff --git a/AUTHORS b/AUTHORS
index 4828ba36cc..eb05706811 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -195,7 +195,7 @@ Ayanamist Yang <ayanamist@gmail.com>
Aymerick Jéhanne <aymerick@jehanne.org>
Azat Kaumov <kaumov.a.r@gmail.com>
Baiju Muthukadan <baiju.m.mail@gmail.com>
-Baokun Lee <nototon@gmail.com>
+Baokun Lee <nototon@gmail.com> <bk@golangcn.org>
Bartosz Grzybowski <melkorm@gmail.com>
Bastian Ike <bastian.ike@gmail.com>
Ben Burkert <ben@benburkert.com>
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index cebc92f53f..b176a03328 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -30,6 +30,7 @@ Aaron Bieber <deftly@gmail.com>
Aaron Cannon <cannona@fireantproductions.com>
Aaron France <aaron.l.france@gmail.com>
Aaron Jacobs <jacobsa@google.com>
+Aaron Jensen <jensen.aaro@gmail.com>
Aaron Kemp <kemp.aaron@gmail.com>
Aaron Patterson <tenderlove@ruby-lang.org>
Aaron Stein <aaronstein12@gmail.com>
@@ -71,9 +72,11 @@ Ahmet Alp Balkan <ahmetb@google.com>
Ahmet Soormally <ahmet@mangomm.co.uk>
Ahmy Yulrizka <yulrizka@gmail.com>
Ahsun Ahmed <ahmed.ahsun@gmail.com>
+Aidan Coyle <packrat386@gmail.com>
Aiden Scandella <ai@uber.com>
Ainar Garipov <gugl.zadolbal@gmail.com>
Aishraj Dahal <aishraj@users.noreply.github.com>
+Ajanthan Balachandran <balaajanthan@gmail.com>
Akhil Indurti <aindurti@gmail.com>
Akihiro Suda <suda.kyoto@gmail.com>
Akshat Kumar <seed@mail.nanosouffle.net>
@@ -104,9 +107,11 @@ Alex Buchanan <buchanae@gmail.com>
Alex Carol <alex.carol.c@gmail.com>
Alex Gaynor <alex@alloy.us>
Alex Harford <alex.harford@saucelabs.com>
+Alex Hays <alex.hays@leftfieldlabs.com>
Alex Jin <toalexjin@gmail.com>
Alex Kohler <alexjohnkohler@gmail.com>
Alex Myasoedov <msoedov@gmail.com>
+Alex Opie <amtopie@gmail.com>
Alex Plugaru <alex@plugaru.org> <alexandru.plugaru@gmail.com>
Alex Schroeder <alex@gnu.org>
Alex Sergeyev <abc@alexsergeyev.com>
@@ -119,6 +124,7 @@ Alexander F Rødseth <alexander.rodseth@appeartv.com>
Alexander Greim <alexxx@iltempo.de>
Alexander Guz <kalimatas@gmail.com>
Alexander Kauer <alexander@affine.space>
+Alexander Klauer <Alexander.Klauer@googlemail.com>
Alexander Kucherenko <alxkchr@gmail.com>
Alexander Larsson <alexander.larsson@gmail.com>
Alexander Lourier <aml@rulezz.ru>
@@ -150,16 +156,19 @@ Alexey Naidonov <alexey.naidyonov@gmail.com>
Alexey Neganov <neganovalexey@gmail.com>
Alexey Palazhchenko <alexey.palazhchenko@gmail.com>
Alexey Semenyuk <alexsemenyuk88@gmail.com>
+Alexey Vilenskiy <bynovhack@gmail.com>
Alexis Hildebrandt <surryhill@gmail.com>
Alexis Hunt <lexer@google.com>
Alexis Imperial-Legrand <ail@google.com>
Ali Farooq <ali.farooq0@pm.me>
Ali Rizvi-Santiago <arizvisa@gmail.com>
Aliaksandr Valialkin <valyala@gmail.com>
+Alice Merrick <amerrick@google.com>
Alif Rachmawadi <subosito@gmail.com>
Allan Simon <allan.simon@supinfo.com>
Allen Li <ayatane@google.com>
Alok Menghrajani <alok.menghrajani@gmail.com>
+Alwin Doss <alwindoss84@gmail.com>
Aman Gupta <aman@tmm1.net>
Amarjeet Anand <amarjeetanandsingh@gmail.com>
Amir Mohammad Saied <amir@gluegadget.com>
@@ -168,6 +177,8 @@ Amrut Joshi <amrut.joshi@gmail.com>
An Long <aisk1988@gmail.com>
An Xiao <hac@zju.edu.cn>
Anand K. Mistry <anand@mistry.ninja>
+Ananya Saxena <ananyasaxena1@gmail.com>
+Anatol Pomozov <anatol.pomozov@gmail.com>
Anders Pearson <anders@columbia.edu>
Anderson Queiroz <contato@andersonq.eti.br>
André Carvalho <asantostc@gmail.com>
@@ -199,6 +210,7 @@ Andrew G. Morgan <agm@google.com>
Andrew Gerrand <adg@golang.org>
Andrew Harding <andrew@spacemonkey.com>
Andrew Jackura <ajackura@google.com>
+Andrew Kemm <andrewkemm@gmail.com>
Andrew Louis <alouis@digitalocean.com>
Andrew Lutomirski <andy@luto.us>
Andrew Medvedev <andrew.y.medvedev@gmail.com>
@@ -216,6 +228,7 @@ Andrew Werner <andrew@upthere.com> <awerner32@gmail.com>
Andrew Wilkins <axwalk@gmail.com>
Andrew Williams <williams.andrew@gmail.com>
Andrew Z Allen <me@andrewzallen.com>
+Andrey Bokhanko <andreybokhanko@gmail.com>
Andrey Mirtchovski <mirtchovski@gmail.com>
Andrey Petrov <andrey.petrov@shazow.net>
Andrii Soldatenko <andrii.soldatenko@gmail.com>
@@ -230,6 +243,7 @@ Andy Maloney <asmaloney@gmail.com>
Andy Pan <panjf2000@gmail.com>
Andy Walker <walkeraj@gmail.com>
Andy Wang <cbeuw.andy@gmail.com>
+Andy Williams <andy@andy.xyz>
Andzej Maciusovic <andzej.maciusovic@gmail.com>
Anfernee Yongkun Gui <anfernee.gui@gmail.com>
Angelo Bulfone <mbulfone@gmail.com>
@@ -274,6 +288,7 @@ Arne Hormann <arnehormann@gmail.com>
Arnout Engelen <arnout@bzzt.net>
Aron Nopanen <aron.nopanen@gmail.com>
Artem Alekseev <artem.alekseev@intel.com>
+Artem Khvastunov <artem.khvastunov@jetbrains.com>
Artem Kolin <artemkaxboy@gmail.com>
Arthur Fabre <arthur@arthurfabre.com>
Arthur Khashaev <arthur@khashaev.ru>
@@ -281,8 +296,10 @@ Artyom Pervukhin <artyom.pervukhin@gmail.com>
Arvindh Rajesh Tamilmani <art@a-30.net>
Ashish Gandhi <ag@ashishgandhi.org>
Asim Shankar <asimshankar@gmail.com>
+Assel Meher <asselmeher@gmail.com>
Atin Malaviya <amalaviy@akamai.com>
Ato Araki <ato.araki@gmail.com>
+Atsushi Toyama <atsushi.tohyama.160.333@gmail.com>
Audrey Lim <audreylh@gmail.com>
Audrius Butkevicius <audrius.butkevicius@gmail.com>
Augusto Roman <aroman@gmail.com>
@@ -291,6 +308,7 @@ Aurélien Rainone <aurelien.rainone@gmail.com>
Aurélio A. Heckert <aurium@gmail.com>
Austin Clements <austin@google.com> <aclements@csail.mit.edu>
Avi Flax <avi@timehop.com>
+Aviv Klasquin Komissar <avivklas@gmail.com>
awaw fumin <awawfumin@gmail.com>
Awn Umar <awn@cryptolosophy.io>
Axel Wagner <axel.wagner.hh@googlemail.com>
@@ -298,20 +316,23 @@ Ayan George <ayan@ayan.net>
Ayanamist Yang <ayanamist@gmail.com>
Ayke van Laethem <aykevanlaethem@gmail.com>
Aymerick Jéhanne <aymerick@jehanne.org>
+Ayzat Sadykov <ayzat.ziko.93@gmail.com>
Azat Kaumov <kaumov.a.r@gmail.com>
Baiju Muthukadan <baiju.m.mail@gmail.com>
Balaram Makam <bmakam.qdt@qualcommdatacenter.com>
Balazs Lecz <leczb@google.com>
-Baokun Lee <nototon@gmail.com>
+Baokun Lee <nototon@gmail.com> <bk@golangcn.org>
Barnaby Keene <accounts@southcla.ws>
Bartosz Grzybowski <melkorm@gmail.com>
Bartosz Oler <brtsz@google.com>
Bastian Ike <bastian.ike@gmail.com>
Ben Burkert <ben@benburkert.com>
+Ben Cartwright-Cox <Ben@Benjojo.co.uk>
Ben Eitzen <eitzenb@golang.org>
Ben Fried <ben.fried@gmail.com>
Ben Haines <bhainesva@gmail.com>
Ben Hoyt <benhoyt@gmail.com>
+Ben Kraft <benkraft@khanacademy.org>
Ben Laurie <ben@links.org> <benl@google.com>
Ben Lubar <ben.lubar@gmail.com>
Ben Lynn <benlynn@gmail.com>
@@ -319,6 +340,7 @@ Ben Olive <sionide21@gmail.com>
Ben Schwartz <bemasc@google.com>
Ben Shi <powerman1st@163.com>
Ben Toews <mastahyeti@gmail.com>
+Benjamin Barenblat <bbaren@google.com>
Benjamin Black <b@b3k.us>
Benjamin Cable <cable.benjamin@gmail.com>
Benjamin Hsieh <tanookiben@users.noreply.github.com>
@@ -356,6 +378,7 @@ Bobby Powers <bobbypowers@gmail.com>
Boqin Qin <bobbqqin@gmail.com>
Boris Nagaev <nagaev@google.com>
Borja Clemente <borja.clemente@gmail.com>
+Boshi Lian <bolian@microsoft.com>
Brad Burch <brad.burch@gmail.com>
Brad Erickson <bderickson@gmail.com>
Brad Fitzpatrick <bradfitz@golang.org> <bradfitz@gmail.com>
@@ -368,10 +391,12 @@ Bradford Lamson-Scribner <brad.lamson@gmail.com>
Bradley Falzon <brad@teambrad.net>
Brady Catherman <brady@gmail.com>
Brady Sullivan <brady@bsull.com>
+Branden J. Brown <zephyrtronium@gmail.com>
Brandon Bennett <bbennett@fb.com>
Brandon Gilmore <varz@google.com>
Brandon Philips <brandon@ifup.org>
Brandon Ryan <bjryan19@gmail.com>
+Brave Cow <rsr715@gmail.com>
Brayden Cloud <bcloud@google.com>
Brendan Daniel Tracey <tracey.brendan@gmail.com>
Brendan O'Dea <bod@golang.org>
@@ -389,6 +414,7 @@ Brian Slesinsky <skybrian@google.com>
Brian Smith <ohohvi@gmail.com>
Brian Starke <brian.starke@gmail.com>
Bryan Alexander <Kozical@msn.com>
+Bryan Boreham <bjboreham@gmail.com>
Bryan C. Mills <bcmills@google.com>
Bryan Chan <bryan.chan@ca.ibm.com>
Bryan Ford <brynosaurus@gmail.com>
@@ -407,6 +433,7 @@ Carl Mastrangelo <notcarl@google.com>
Carl Shapiro <cshapiro@google.com> <cshapiro@golang.org>
Carlisia Campos <carlisia@grokkingtech.io>
Carlo Alberto Ferraris <cafxx@strayorange.com>
+Carlos Alexandro Becker <caarlos0@gmail.com>
Carlos Amedee <carlos@golang.org>
Carlos Castillo <cookieo9@gmail.com>
Carlos Cirello <uldericofilho@gmail.com>
@@ -422,6 +449,7 @@ Casey Callendrello <squeed@gmail.com>
Casey Marshall <casey.marshall@gmail.com>
Catalin Nicutar <cnicutar@google.com>
Catalin Patulea <catalinp@google.com>
+Cathal O'Callaghan <cathalsocallaghan@gmail.com>
Cedric Staub <cs@squareup.com>
Cezar Sá Espinola <cezarsa@gmail.com>
Chad Rosier <mrosier.qdt@qualcommdatacenter.com>
@@ -434,10 +462,14 @@ Charles Kenney <charlesc.kenney@gmail.com>
Charles L. Dorian <cldorian@gmail.com>
Charles Lee <zombie.fml@gmail.com>
Charles Weill <weill@google.com>
+Charlotte Brandhorst-Satzkorn <catzkorn@gmail.com>
Chauncy Cullitan <chauncyc@google.com>
+Chen Zhidong <njutczd@gmail.com>
Chen Zhihan <energiehund@gmail.com>
Cherry Zhang <cherryyz@google.com>
Chew Choon Keat <choonkeat@gmail.com>
+Chiawen Chen <golopot@gmail.com>
+Chirag Sukhala <cchirag77@gmail.com>
Cholerae Hu <choleraehyq@gmail.com>
Chotepud Teo <AlexRouSg@users.noreply.github.com>
Chris Ball <chris@printf.net>
@@ -460,6 +492,8 @@ Chris Raynor <raynor@google.com>
Chris Roche <rodaine@gmail.com>
Chris Smith <chrsmith@users.noreply.github.com>
Chris Stockton <chrisstocktonaz@gmail.com>
+Chris Taylor <taylorza@gmail.com>
+Chris Waldon <christopher.waldon.dev@gmail.com>
Chris Zou <chriszou@ca.ibm.com>
Christian Alexander <christian@linux.com>
Christian Couder <chriscool@tuxfamily.org>
@@ -467,6 +501,7 @@ Christian Himpel <chressie@googlemail.com> <chressie@gmail.com>
Christian Muehlhaeuser <muesli@gmail.com>
Christian Pellegrin <chri@evolware.org>
Christian R. Petrin <christianpetrin@gmail.com>
+Christian Svensson <blue@cmd.nu>
Christine Hansmann <chhansmann@gmail.com>
Christoffer Buchholz <christoffer.buchholz@gmail.com>
Christoph Blecker <admin@toph.ca>
@@ -474,6 +509,7 @@ Christoph Hack <christoph@tux21b.org>
Christopher Cahoon <chris.cahoon@gmail.com>
Christopher Guiney <chris@guiney.net>
Christopher Henderson <chris@chenderson.org>
+Christopher Hlubek <christopher.hlubek@networkteam.com>
Christopher Koch <chrisko@google.com>
Christopher Loessl <cloessl+github@gmail.com>
Christopher Nelson <nadiasvertex@gmail.com>
@@ -506,7 +542,10 @@ Costin Chirvasuta <ctin@google.com>
Craig Citro <craigcitro@google.com>
Cristian Staretu <unclejacksons@gmail.com>
Cuihtlauac ALVARADO <cuihtlauac.alvarado@orange.com>
+Cuong Manh Le <cuong@orijtech.com>
+Curtis La Graff <curtis@lagraff.me>
Cyrill Schumacher <cyrill@schumacher.fm>
+Dai Jie <gzdaijie@gmail.com>
Daisuke Fujita <dtanshi45@gmail.com>
Daisuke Suzuki <daisuzu@gmail.com>
Daker Fernandes Pinheiro <daker.fernandes.pinheiro@intel.com>
@@ -525,12 +564,14 @@ Dan Peterson <dpiddy@gmail.com>
Dan Pupius <dan@medium.com>
Dan Scales <danscales@google.com>
Dan Sinclair <dan.sinclair@gmail.com>
+Daniel Cohen <dcohen@gatech.edu>
Daniel Cormier <danielc@knowbe4.com>
Daniël de Kok <me@danieldk.eu>
Daniel Fleischman <danielfleischman@gmail.com>
Daniel Ingram <ingramds@appstate.edu>
Daniel Johansson <dajo2002@gmail.com>
Daniel Kerwin <d.kerwin@gini.net>
+Daniel Kessler <dkess@google.com>
Daniel Krech <eikeon@eikeon.com>
Daniel Kumor <rdkumor@gmail.com>
Daniel Langner <s8572327@gmail.com>
@@ -538,10 +579,12 @@ Daniel Lidén <daniel.liden.87@gmail.com>
Daniel Lublin <daniel@lublin.se>
Daniel Mangum <georgedanielmangum@gmail.com>
Daniel Martí <mvdan@mvdan.cc>
+Daniel McCarney <cpu@letsencrypt.org>
Daniel Morsing <daniel.morsing@gmail.com>
Daniel Nadasi <dnadasi@google.com>
Daniel Nephin <dnephin@gmail.com>
Daniel Ortiz Pereira da Silva <daniel.particular@gmail.com>
+Daniel S. Fava <danielsfava@gmail.com>
Daniel Skinner <daniel@dasa.cc>
Daniel Speichert <daniel@speichert.pl>
Daniel Theophanes <kardianos@gmail.com>
@@ -563,6 +606,7 @@ Dave Cheney <dave@cheney.net>
Dave Day <djd@golang.org>
Dave Grijalva <dgrijalva@ngmoco.com>
Dave MacFarlane <driusan@gmail.com>
+Dave Pifke <dave@pifke.org>
Dave Russell <forfuncsake@gmail.com>
David Anderson <danderson@google.com>
David Barnett <dbarnett@google.com>
@@ -593,6 +637,7 @@ David McLeish <davemc@google.com>
David Ndungu <dnjuguna@gmail.com>
David NewHamlet <david@newhamlet.com>
David Presotto <presotto@gmail.com>
+David Qu <davidqu12345@gmail.com>
David R. Jenni <david.r.jenni@gmail.com>
David Sansome <me@davidsansome.com>
David Stainton <dstainton415@gmail.com>
@@ -642,6 +687,7 @@ Diwaker Gupta <diwakergupta@gmail.com>
Dmitri Goutnik <dgoutnik@gmail.com>
Dmitri Popov <operator@cv.dp-net.com>
Dmitri Shuralyov <dmitshur@golang.org> <dmitri@shuralyov.com>
+Dmitrii Okunev <xaionaro@gmail.com>
Dmitriy Cherchenko <dcherchenko@gmail.com>
Dmitriy Dudkin <dudkin.dmitriy@gmail.com>
Dmitriy Shelenin <deemok@googlemail.com> <deemok@gmail.com>
@@ -655,6 +701,7 @@ Dmitry Yakunin <nonamezeil@gmail.com>
Doga Fincan <doga@icloud.com>
Domas Tamašauskas <puerdomus@gmail.com>
Domen Ipavec <domen@ipavec.net>
+Dominic Della Valle <ddvpublic@Gmail.com>
Dominic Green <dominicgreen1@gmail.com>
Dominik Honnef <dominik.honnef@gmail.com>
Dominik Vogt <vogt@linux.vnet.ibm.com>
@@ -696,6 +743,7 @@ Elias Naur <mail@eliasnaur.com> <elias.naur@gmail.com>
Elliot Morrison-Reed <elliotmr@gmail.com>
Ellison Leão <ellisonleao@gmail.com>
Emerson Lin <linyintor@gmail.com>
+Emil Bektimirov <lefelys@gmail.com>
Emil Hessman <emil@hessman.se>
Emil Mursalimov <mursalimovemeel@gmail.com>
Emilien Kenler <hello@emilienkenler.com>
@@ -760,6 +808,7 @@ Fatih Arslan <fatih@arslan.io>
Fazal Majid <majid@apsalar.com>
Fazlul Shahriar <fshahriar@gmail.com>
Federico Bond <federicobond@gmail.com>
+Federico Guerinoni <guerinoni.federico@gmail.com>
Federico Simoncelli <fsimonce@redhat.com>
Fedor Indutny <fedor@indutny.com>
Fedor Korotkiy <dartslon@gmail.com>
@@ -781,6 +830,7 @@ Florin Patan <florinpatan@gmail.com>
Folke Behrens <folke@google.com>
Ford Hurley <ford.hurley@gmail.com>
Francesc Campoy <campoy@golang.org>
+Francesco Guardiani <francescoguard@gmail.com>
Francesco Renzi <rentziass@gmail.com>
Francisco Claude <fclaude@recoded.cl>
Francisco Rojas <francisco.rojas.gallegos@gmail.com>
@@ -811,8 +861,10 @@ Gabriel Russell <gabriel.russell@gmail.com>
Gareth Paul Jones <gpj@foursquare.com>
Garret Kelly <gdk@google.com>
Garrick Evans <garrick@google.com>
+Garry McNulty <garrmcnu@gmail.com>
Gary Burd <gary@beagledreams.com> <gary.burd@gmail.com>
Gary Elliott <garyelliott@google.com>
+Gaurav Singh <gaurav1086@gmail.com>
Gaurish Sharma <contact@gaurishsharma.com>
Gautham Thambidorai <gautham.dorai@gmail.com>
Gauthier Jolly <gauthier.jolly@gmail.com>
@@ -827,6 +879,7 @@ Georg Reinke <guelfey@gmail.com>
George Gkirtsou <ggirtsou@gmail.com>
George Hartzell <hartzell@alerce.com>
George Shammas <george@shamm.as> <georgyo@gmail.com>
+George Tsilias <tsiliasg@gmail.com>
Gerasimos (Makis) Maropoulos <kataras2006@hotmail.com>
Gerasimos Dimitriadis <gedimitr@gmail.com>
Gergely Brautigam <skarlso777@gmail.com>
@@ -862,6 +915,7 @@ GitHub User @frennkie (6499251) <mail@rhab.de>
GitHub User @geedchin (11672310) <geedchin@gmail.com>
GitHub User @GrigoriyMikhalkin (3637857) <grigoriymikhalkin@gmail.com>
GitHub User @hengwu0 (41297446) <41297446+hengwu0@users.noreply.github.com>
+GitHub User @hitzhangjie (3725760) <hit.zhangjie@gmail.com>
GitHub User @itchyny (375258) <itchyny@hatena.ne.jp>
GitHub User @jinmiaoluo (39730824) <jinmiaoluo@icloud.com>
GitHub User @jopbrown (6345470) <msshane2008@gmail.com>
@@ -873,6 +927,7 @@ GitHub User @LotusFenn (13775899) <fenn.lotus@gmail.com>
GitHub User @ly303550688 (11519839) <yang.liu636@gmail.com>
GitHub User @madiganz (18340029) <zacharywmadigan@gmail.com>
GitHub User @maltalex (10195391) <code@bit48.net>
+GitHub User @markruler (38225900) <csu0414@gmail.com>
GitHub User @Matts966 (28551465) <Matts966@users.noreply.github.com>
GitHub User @micnncim (21333876) <micnncim@gmail.com>
GitHub User @mkishere (224617) <224617+mkishere@users.noreply.github.com>
@@ -886,6 +941,8 @@ GitHub User @ramenjuniti (32011829) <ramenjuniti@gmail.com>
GitHub User @saitarunreddy (21041941) <saitarunreddypalla@gmail.com>
GitHub User @shogo-ma (9860598) <Choroma194@gmail.com>
GitHub User @skanehira (7888591) <sho19921005@gmail.com>
+GitHub User @soolaugust (10558124) <soolaugust@gmail.com>
+GitHub User @surechen (7249331) <surechen17@gmail.com>
GitHub User @tatsumack (4510569) <tatsu.mack@gmail.com>
GitHub User @tell-k (26263) <ffk2005@gmail.com>
GitHub User @tennashi (10219626) <tennashio@gmail.com>
@@ -908,6 +965,7 @@ Gordon Tyler <gordon@doxxx.net>
Graham King <graham4king@gmail.com>
Graham Miller <graham.miller@gmail.com>
Grant Griffiths <ggp493@gmail.com>
+Green Lightning <GreenLightning.git@googlemail.com>
Greg Poirier <greg.istehbest@gmail.com>
Greg Steuck <gnezdo+github@google.com>
Greg Thelen <gthelen@google.com>
@@ -920,6 +978,7 @@ Guilherme Garnier <guilherme.garnier@gmail.com>
Guilherme Goncalves <guilhermeaugustosg@gmail.com>
Guilherme Rezende <guilhermebr@gmail.com>
Guillaume J. Charmes <guillaume@charmes.net>
+Guillaume Sottas <guillaumesottas@gmail.com>
Günther Noack <gnoack@google.com>
Guobiao Mei <meiguobiao@gmail.com>
Guoliang Wang <iamwgliang@gmail.com>
@@ -936,6 +995,8 @@ HAMANO Tsukasa <hamano@osstech.co.jp>
Han-Wen Nienhuys <hanwen@google.com>
Hang Qian <hangqian90@gmail.com>
Hanjun Kim <hallazzang@gmail.com>
+Hanlin Shi <shihanlin9@gmail.com>
+Haoran Luo <haoran.luo@chaitin.com>
Haosdent Huang <haosdent@gmail.com>
Harald Nordgren <haraldnordgren@gmail.com>
Hari haran <hariharan.uno@gmail.com>
@@ -950,9 +1011,11 @@ Håvard Haugen <havard.haugen@gmail.com>
He Liu <liulonnie@gmail.com>
Hector Chu <hectorchu@gmail.com>
Hector Martin Cantero <hector@marcansoft.com>
+Hein Khant Zaw <heinkhantzaw1@gmail.com>
Henning Schmiedehausen <henning@schmiedehausen.org>
Henrik Edwards <henrik.edwards@gmail.com>
Henrik Hodne <henrik@hodne.io>
+Henrique Vicente <henriquevicente@gmail.com>
Henry Adi Sumarto <henry.adisumarto@gmail.com>
Henry Bubert <google@mindeco.de>
Henry Chang <mr.changyuheng@gmail.com>
@@ -969,6 +1032,7 @@ Hironao OTSUBO <motemen@gmail.com>
Hiroshi Ioka <hirochachacha@gmail.com>
Hitoshi Mitake <mitake.hitoshi@gmail.com>
Holden Huang <ttyh061@gmail.com>
+Songlin Jiang <hollowman@hollowman.ml>
Hong Ruiqi <hongruiqi@gmail.com>
Hongfei Tan <feilengcui008@gmail.com>
Horacio Duran <horacio.duran@gmail.com>
@@ -990,6 +1054,7 @@ Ian Haken <ihaken@netflix.com>
Ian Kent <iankent85@gmail.com>
Ian Lance Taylor <iant@golang.org>
Ian Leue <ian@appboy.com>
+Ian Tay <iantay@google.com>
Ian Zapolsky <ianzapolsky@gmail.com>
Ibrahim AshShohail <ibra.sho@gmail.com>
Icarus Sparry <golang@icarus.freeuk.com>
@@ -997,9 +1062,11 @@ Iccha Sethi <icchasethi@gmail.com>
Idora Shinatose <idora.shinatose@gmail.com>
Ignacio Hagopian <jsign.uy@gmail.com>
Igor Bernstein <igorbernstein@google.com>
+Igor Bolotnikov <igor.v.bolotnikov@gmail.com>
Igor Dolzhikov <bluesriverz@gmail.com>
Igor Vashyst <ivashyst@gmail.com>
Igor Zhilianin <igor.zhilianin@gmail.com>
+Ikko Ashimine <eltociear@gmail.com>
Illya Yalovyy <yalovoy@gmail.com>
Ilya Sinelnikov <sidhmangh@gmail.com>
Ilya Tocar <ilya.tocar@intel.com>
@@ -1037,6 +1104,7 @@ Jacob Blain Christen <dweomer5@gmail.com>
Jacob H. Haven <jacob@cloudflare.com>
Jacob Hoffman-Andrews <github@hoffman-andrews.com>
Jacob Walker <jacobwalker0814@gmail.com>
+Jaden Teng <long.asyn@gmail.com>
Jae Kwon <jae@tendermint.com>
Jake B <doogie1012@gmail.com>
Jakob Borg <jakob@nym.se>
@@ -1044,6 +1112,7 @@ Jakob Weisblat <jakobw@mit.edu>
Jakub Čajka <jcajka@redhat.com>
Jakub Kaczmarzyk <jakubk@mit.edu>
Jakub Ryszard Czarnowicz <j.czarnowicz@gmail.com>
+Jakub Warczarek <jakub.warczarek@gmail.com>
Jamal Carvalho <jamal.a.carvalho@gmail.com>
James Aguilar <jaguilar@google.com>
James Bardin <j.bardin@gmail.com>
@@ -1056,9 +1125,11 @@ James Eady <jmeady@google.com>
James Fysh <james.fysh@gmail.com>
James Gray <james@james4k.com>
James Hartig <fastest963@gmail.com>
+James Kasten <jdkasten@google.com>
James Lawrence <jljatone@gmail.com>
James Meneghello <rawrz0r@gmail.com>
James Myers <jfmyers9@gmail.com>
+James Naftel <james.naftel@gmail.com>
James Neve <jamesoneve@gmail.com>
James Nugent <james@jen20.com>
James P. Cooper <jamespcooper@gmail.com>
@@ -1108,6 +1179,7 @@ Javier Kohen <jkohen@google.com>
Javier Revillas <jrevillas@massivedynamic.io>
Javier Segura <javism@gmail.com>
Jay Conrod <jayconrod@google.com>
+Jay Lee <BusyJayLee@gmail.com>
Jay Taylor <outtatime@gmail.com>
Jay Weisskopf <jay@jayschwa.net>
Jean de Klerk <deklerk@google.com>
@@ -1140,14 +1212,17 @@ Jeremy Jay <jeremy@pbnjay.com>
Jeremy Schlatter <jeremy.schlatter@gmail.com>
Jeroen Bobbeldijk <jerbob92@gmail.com>
Jeroen Simonetti <jeroen@simonetti.nl>
+Jérôme Doucet <jerdct@gmail.com>
Jerrin Shaji George <jerrinsg@gmail.com>
Jess Frazelle <me@jessfraz.com>
Jesse Szwedko <jesse.szwedko@gmail.com>
Jesús Espino <jespinog@gmail.com>
Jia Zhan <jzhan@uber.com>
Jiacai Liu <jiacai2050@gmail.com>
+Jiahao Lu <lujjjh@gmail.com>
Jianing Yu <jnyu@google.com>
Jianqiao Li <jianqiaoli@google.com>
+Jiayu Yi <yijiayu@gmail.com>
Jie Ma <jienius@outlook.com>
Jihyun Yu <yjh0502@gmail.com>
Jim Cote <jfcote87@gmail.com>
@@ -1183,6 +1258,7 @@ Joey Geiger <jgeiger@users.noreply.github.com>
Johan Brandhorst <johan.brandhorst@gmail.com>
Johan Euphrosine <proppy@google.com>
Johan Jansson <johan.jansson@iki.fi>
+Johan Knutzen <johan@senri.se>
Johan Sageryd <j@1616.se>
John Asmuth <jasmuth@gmail.com>
John Beisley <huin@google.com>
@@ -1210,6 +1286,7 @@ Johnny Luo <johnnyluo1980@gmail.com>
Jon Chen <jchen@justin.tv>
Jon Johnson <jonjohnson@google.com>
Jonas Bernoulli <jonas@bernoul.li>
+Jonathan Albrecht <jonathan.albrecht@ibm.com>
Jonathan Allie <jonallie@google.com>
Jonathan Amsterdam <jba@google.com>
Jonathan Boulle <jonathanboulle@gmail.com>
@@ -1223,6 +1300,7 @@ Jonathan Pentecost <pentecostjonathan@gmail.com>
Jonathan Pittman <jmpittman@google.com> <jonathan.mark.pittman@gmail.com>
Jonathan Rudenberg <jonathan@titanous.com>
Jonathan Stacks <jonstacks13@gmail.com>
+Jonathan Swinney <jswinney@amazon.com>
Jonathan Wills <runningwild@gmail.com>
Jonathon Lacher <jonathon.lacher@gmail.com>
Jongmin Kim <atomaths@gmail.com>
@@ -1233,6 +1311,7 @@ Jordan Krage <jmank88@gmail.com>
Jordan Lewis <jordanthelewis@gmail.com>
Jordan Liggitt <liggitt@google.com>
Jordan Rhee <jordanrh@microsoft.com>
+Jordan Rupprecht <rupprecht@google.com>
Jordi Martin <jordimartin@gmail.com>
Jorge Araya <jorgejavieran@yahoo.com.mx>
Jorge L. Fatta <jorge.fatta@auth0.com>
@@ -1276,6 +1355,7 @@ Julien Salleyron <julien.salleyron@gmail.com>
Julien Schmidt <google@julienschmidt.com>
Julio Montes <julio.montes@intel.com>
Jun Zhang <jim.zoumo@gmail.com>
+Junchen Li <junchen.li@arm.com>
Junda Liu <junda@celer.network>
Jungho Ahn <jhahn@google.com>
Junya Hayashi <ledmonster@gmail.com>
@@ -1287,6 +1367,7 @@ Justin Nuß <nuss.justin@gmail.com>
Justyn Temme <justyntemme@gmail.com>
Kai Backman <kaib@golang.org>
Kai Dong <dokia2357@gmail.com>
+Kai Lüke <kai@kinvolk.io>
Kai Trukenmüller <ktye78@gmail.com>
Kale Blankenship <kale@lemnisys.com>
Kaleb Elwert <kelwert@atlassian.com>
@@ -1314,6 +1395,7 @@ Kazuhiro Sera <seratch@gmail.com>
KB Sriram <kbsriram@google.com>
Keegan Carruthers-Smith <keegan.csmith@gmail.com>
Kei Son <hey.calmdown@gmail.com>
+Keiichi Hirobe <chalenge.akane@gmail.com>
Keiji Yoshida <keijiyoshida.mail@gmail.com>
Keisuke Kishimoto <keisuke.kishimoto@gmail.com>
Keith Ball <inflatablewoman@gmail.com>
@@ -1322,6 +1404,7 @@ Keith Rarick <kr@xph.us>
Kelly Heller <pestophagous@gmail.com>
Kelsey Hightower <kelsey.hightower@gmail.com>
Kelvin Foo Chuan Lyi <vmirage@gmail.com>
+Kemal Elmizan <kemalelmizan@gmail.com>
Ken Friedenbach <kenliz@cruzio.com>
Ken Rockot <ken@oz.gs> <ken.rockot@gmail.com>
Ken Sedgwick <ken@bonsai.com>
@@ -1331,6 +1414,7 @@ Kenji Kaneda <kenji.kaneda@gmail.com>
Kenji Yano <kenji.yano@gmail.com>
Kenneth Shaw <kenshaw@gmail.com>
Kenny Grant <kennygrant@gmail.com>
+Kensei Nakada <handbomusic@gmail.com>
Kenta Mori <zoncoen@gmail.com>
Kerollos Magdy <kerolloz@yahoo.com>
Ketan Parmar <ketanbparmar@gmail.com>
@@ -1342,10 +1426,12 @@ Kevin Gillette <extemporalgenome@gmail.com>
Kevin Kirsche <kev.kirsche@gmail.com>
Kevin Klues <klueska@gmail.com> <klueska@google.com>
Kevin Malachowski <chowski@google.com>
+Kevin Parsons <kevpar@microsoft.com>
Kevin Ruffin <kruffin@gmail.com>
Kevin Vu <kevin.m.vu@gmail.com>
Kevin Zita <bleedgreenandgold@gmail.com>
Keyan Pishdadian <kpishdadian@gmail.com>
+Keyuan Li <keyuanli123@gmail.com>
Kezhu Wang <kezhuw@gmail.com>
Khosrow Moossavi <khos2ow@gmail.com>
Kieran Colford <kieran@kcolford.com>
@@ -1358,6 +1444,7 @@ Kirill Smelkov <kirr@nexedi.com>
Kirill Tatchihin <kirabsuir@gmail.com>
Kirk Han <kirk91.han@gmail.com>
Kirklin McDonald <kirklin.mcdonald@gmail.com>
+KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
Klaus Post <klauspost@gmail.com>
Kodie Goodwin <kodiegoodwin@gmail.com>
Koichi Shiraishi <zchee.io@gmail.com>
@@ -1371,6 +1458,7 @@ Kris Kwiatkowski <kris@cloudflare.com>
Kris Nova <kris@nivenly.com>
Kris Rousey <krousey@google.com>
Kristopher Watts <traetox@gmail.com>
+Krzysztof Dąbrowski <krzysdabro@live.com>
Kshitij Saraogi <kshitijsaraogi@gmail.com>
Kun Li <likunarmstrong@gmail.com>
Kunpei Sakai <namusyaka@gmail.com>
@@ -1412,8 +1500,10 @@ Leonardo Comelli <leonardo.comelli@gmail.com>
Leonel Quinteros <leonel.quinteros@gmail.com>
Lev Shamardin <shamardin@gmail.com>
Lewin Bormann <lewin.bormann@gmail.com>
+Lewis Waddicor <nemesismk2@gmail.com>
Liam Haworth <liam@haworth.id.au>
Lily Chung <lilithkchung@gmail.com>
+Lingchao Xin <douglarek@gmail.com>
Lion Yang <lion@aosc.xyz>
Liz Rice <liz@lizrice.com>
Lloyd Dewolf <foolswisdom@gmail.com>
@@ -1427,6 +1517,7 @@ Luan Santos <cfcluan@gmail.com>
Lubomir I. Ivanov <neolit123@gmail.com>
Luca Bruno <luca.bruno@coreos.com>
Luca Greco <luca.greco@alcacoop.it>
+Luca Spiller <luca@stackednotion.com>
Lucas Bremgartner <lucas.bremgartner@gmail.com>
Lucas Clemente <lclemente@google.com>
Lucien Stuker <lucien.stuker@gmail.com>
@@ -1450,6 +1541,8 @@ Maarten Bezemer <maarten.bezemer@gmail.com>
Maciej Dębski <maciejd@google.com>
Madhu Rajanna <madhupr007@gmail.com>
Magnus Hiie <magnus.hiie@gmail.com>
+Mahdi Hosseini Moghaddam <seyed.mahdi.hosseini.moghaddam@ibm.com>
+Maia Lee <maia.lee@leftfieldlabs.com>
Maicon Costa <maiconscosta@gmail.com>
Mak Kolybabi <mak@kolybabi.com>
Maksym Trykur <maksym.trykur@gmail.com>
@@ -1470,6 +1563,7 @@ Marcel Edmund Franke <marcel.edmund.franke@gmail.com>
Marcel van Lohuizen <mpvl@golang.org>
Marcelo Cantos <marcelo.cantos@gmail.com>
Marcelo E. Magallon <marcelo.magallon@gmail.com>
+Marco Gazerro <gazerro@open2b.com>
Marco Hennings <marco.hennings@freiheit.com>
Marcus Weiner <marcus.weiner@gmail.com>
Marcus Willock <crazcalm@gmail.com>
@@ -1481,6 +1575,7 @@ Marius A. Eriksen <marius@grailbio.com>
Marius Nuennerich <mnu@google.com>
Mark Adams <mark@markadams.me>
Mark Bucciarelli <mkbucc@gmail.com>
+Mark Dain <mark@markdain.net>
Mark Glines <mark@glines.org>
Mark Harrison <marhar@google.com>
Mark Percival <m@mdp.im>
@@ -1533,6 +1628,7 @@ Máté Gulyás <mgulyas86@gmail.com>
Matej Baćo <matejbaco@gmail.com>
Mateus Amin <mateus.amin@gmail.com>
Mateusz Czapliński <czapkofan@gmail.com>
+Matheus Alcantara <matheusssilv97@gmail.com>
Mathias Beke <git@denbeke.be>
Mathias Hall-Andersen <mathias@hall-andersen.dk>
Mathias Leppich <mleppich@muhqu.de>
@@ -1566,6 +1662,7 @@ Matthew Waters <mwwaters@gmail.com>
Matthieu Hauglustaine <matt.hauglustaine@gmail.com>
Matthieu Olivier <olivier.matthieu@gmail.com>
Matthijs Kooijman <matthijs@stdin.nl>
+Max Drosdo.www <g1ran1q@gmail.com>
Max Riveiro <kavu13@gmail.com>
Max Schmitt <max@schmitt.mx>
Max Semenik <maxsem.wiki@gmail.com>
@@ -1603,6 +1700,7 @@ Michael Hudson-Doyle <michael.hudson@linaro.org>
Michael Kasch <michael.kasch@gmail.com>
Michael Käufl <golang@c.michael-kaeufl.de>
Michael Kelly <mjk@google.com>
+Michaël Lévesque-Dion <mlevesquedion@google.com>
Michael Lewis <mikelikespie@gmail.com>
Michael MacInnis <Michael.P.MacInnis@gmail.com>
Michael Marineau <michael.marineau@coreos.com>
@@ -1624,6 +1722,7 @@ Michael Teichgräber <mteichgraeber@gmx.de> <mt4swm@googlemail.com>
Michael Traver <mtraver@google.com>
Michael Vetter <g.bluehut@gmail.com>
Michael Vogt <mvo@ubuntu.com>
+Michail Kargakis <mkargaki@redhat.com>
Michal Bohuslávek <mbohuslavek@gmail.com>
Michal Cierniak <cierniak@google.com>
Michał Derkacz <ziutek@lnet.pl>
@@ -1633,6 +1732,7 @@ Michal Pristas <michal.pristas@gmail.com>
Michal Rostecki <mrostecki@suse.de>
Michalis Kargakis <michaliskargakis@gmail.com>
Michel Lespinasse <walken@google.com>
+Michele Di Pede <michele.di.pede@gmail.com>
Mickael Kerjean <mickael.kerjean@gmail.com>
Mickey Reiss <mickeyreiss@gmail.com>
Miek Gieben <miek@miek.nl> <remigius.gieben@gmail.com>
@@ -1670,6 +1770,7 @@ Miquel Sabaté Solà <mikisabate@gmail.com>
Mirko Hansen <baaazen@gmail.com>
Miroslav Genov <mgenov@gmail.com>
Misty De Meo <mistydemeo@gmail.com>
+Mohamed Attahri <mohamed@attahri.com>
Mohit Agarwal <mohit@sdf.org>
Mohit kumar Bajoria <mohitbajo36@gmail.com>
Mohit Verma <vmohit.93@gmail.com>
@@ -1683,6 +1784,7 @@ Môshe van der Sterre <moshevds@gmail.com>
Mostyn Bramley-Moore <mostyn@antipode.se>
Mrunal Patel <mrunalp@gmail.com>
Muhammad Falak R Wani <falakreyaz@gmail.com>
+Muhammad Hamza Farrukh <hamzafarrukh141@gmail.com>
Muhammed Uluyol <uluyol0@gmail.com>
Muir Manders <muir@mnd.rs>
Mukesh Sharma <sharma.mukesh439@gmail.com>
@@ -1692,6 +1794,7 @@ Naman Aggarwal <aggarwal.nam@gmail.com>
Nan Deng <monnand@gmail.com>
Nao Yonashiro <owan.orisano@gmail.com>
Naoki Kanatani <k12naoki@gmail.com>
+Natanael Copa <ncopa@mirantis.com>
Nate Wilkinson <nathanwilk7@gmail.com>
Nathan Cantelmo <n.cantelmo@gmail.com>
Nathan Caza <mastercactapus@gmail.com>
@@ -1708,6 +1811,7 @@ Nathaniel Cook <nvcook42@gmail.com>
Naveen Kumar Sangi <naveenkumarsangi@protonmail.com>
Neeilan Selvalingam <neeilan96@gmail.com>
Neelesh Chandola <neelesh.c98@gmail.com>
+Nehal J Wani <nehaljw.kkd1@gmail.com>
Neil Lyons <nwjlyons@googlemail.com>
Neuman Vong <neuman.vong@gmail.com>
Neven Sajko <nsajko@gmail.com>
@@ -1760,6 +1864,7 @@ Noel Georgi <git@frezbo.com>
Norberto Lopes <nlopes.ml@gmail.com>
Norman B. Lancaster <qbradq@gmail.com>
Nuno Cruces <ncruces@users.noreply.github.com>
+Obei Sideg <obei.sideg@gmail.com>
Obeyda Djeffal <djefobey@gmail.com>
Odin Ugedal <odin@ugedal.com>
Oleg Bulatov <dmage@yandex-team.ru>
@@ -1769,12 +1874,17 @@ Oling Cat <olingcat@gmail.com>
Oliver Hookins <ohookins@gmail.com>
Oliver Powell <oliverpowell84@gmail.com>
Oliver Stenbom <ostenbom@pivotal.io>
+Oliver Tan <otan@cockroachlabs.com>
Oliver Tonnhofer <olt@bogosoft.com>
Olivier Antoine <olivier.antoine@gmail.com>
Olivier Duperray <duperray.olivier@gmail.com>
Olivier Poitrey <rs@dailymotion.com>
Olivier Saingre <osaingre@gmail.com>
+Olivier Wulveryck <olivier.wulveryck@gmail.com>
Omar Jarjur <ojarjur@google.com>
+Onkar Jadhav <omjadhav2610@gmail.com>
+Ori Bernstein <ori@eigenstate.org>
+Ori Rawlings <orirawlings@gmail.com>
Oryan Moshe <iamoryanmoshe@gmail.com>
Osamu TONOMORI <osamingo@gmail.com>
Özgür Kesim <oec-go@kesim.org>
@@ -1798,7 +1908,9 @@ Pat Moroney <pat@pat.email>
Patrick Barker <barkerp@vmware.com>
Patrick Crosby <patrick@stathat.com>
Patrick Gavlin <pgavlin@gmail.com>
+Patrick Gundlach <gundlach@speedata.de>
Patrick Higgins <patrick.allen.higgins@gmail.com>
+Patrick Jones <ithuriel@google.com>
Patrick Lee <pattyshack101@gmail.com>
Patrick Mézard <patrick@mezard.eu>
Patrick Mylund Nielsen <patrick@patrickmn.com>
@@ -1811,6 +1923,9 @@ Paul Borman <borman@google.com>
Paul Boyd <boyd.paul2@gmail.com>
Paul Chang <paulchang@google.com>
Paul D. Weber <x0bdev@gmail.com>
+Paul Davis <43160081+Pawls@users.noreply.github.com>
+Paul E. Murphy <murp@ibm.com>
+Paul Forgey <paulf@tessier-ashpool.net>
Paul Hammond <paul@paulhammond.org>
Paul Hankin <paulhankin@google.com>
Paul Jolly <paul@myitcv.org.uk>
@@ -1836,7 +1951,9 @@ Pavel Zinovkin <pavel.zinovkin@gmail.com>
Pavlo Sumkin <ymkins@gmail.com>
Pawel Knap <pawelknap88@gmail.com>
Pawel Szczur <filemon@google.com>
+Paweł Szulik <pawel.szulik@intel.com>
Pei Xian Chee <luciolas1991@gmail.com>
+Pei-Ming Wu <p408865@gmail.com>
Percy Wegmann <ox.to.a.cart@gmail.com>
Perry Abbott <perry.j.abbott@gmail.com>
Petar Dambovaliev <petar.atanasov.1987@gmail.com>
@@ -1876,6 +1993,7 @@ Philip Hofer <phofer@umich.edu>
Philip K. Warren <pkwarren@gmail.com>
Philip Nelson <me@pnelson.ca>
Philipp Stephani <phst@google.com>
+Phillip Campbell <15082+phillc@users.noreply.github.com>
Pierre Carru <pierre.carru@eshard.com>
Pierre Durand <pierredurand@gmail.com>
Pierre Prinetti <pierreprinetti@gmail.com>
@@ -1885,6 +2003,7 @@ Pieter Droogendijk <pieter@binky.org.uk>
Pietro Gagliardi <pietro10@mac.com>
Piyush Mishra <piyush@codeitout.com>
Plekhanov Maxim <kishtatix@gmail.com>
+Poh Zi How <poh.zihow@gmail.com>
Polina Osadcha <polliosa@google.com>
Pontus Leitzler <leitzler@gmail.com>
Povilas Versockas <p.versockas@gmail.com>
@@ -1904,14 +2023,17 @@ Quentin Perez <qperez@ocs.online.net>
Quentin Renard <contact@asticode.com>
Quentin Smith <quentin@golang.org>
Quey-Liang Kao <s101062801@m101.nthu.edu.tw>
+Quim Muntal <quimmuntal@gmail.com>
Quinn Slack <sqs@sourcegraph.com>
Quinten Yearsley <qyearsley@chromium.org>
Quoc-Viet Nguyen <afelion@gmail.com>
+Radek Simko <radek.simko@gmail.com>
Radek Sohlich <sohlich@gmail.com>
Radu Berinde <radu@cockroachlabs.com>
Rafal Jeczalik <rjeczalik@gmail.com>
Raghavendra Nagaraj <jamdagni86@gmail.com>
Rahul Chaudhry <rahulchaudhry@chromium.org>
+Rahul Wadhwani <rahulwadhwani21@gmail.com>
Raif S. Naffah <go@naffah-raif.name>
Rajat Goel <rajat.goel2010@gmail.com>
Rajath Agasthya <rajathagasthya@gmail.com>
@@ -1935,6 +2057,7 @@ Ren Ogaki <re.yuz77777@gmail.com>
Rens Rikkerink <Ikkerens@users.noreply.github.com>
Rhys Hiltner <rhys@justin.tv>
Ricardo Padilha <ricardospadilha@gmail.com>
+Ricardo Pchevuzinske Katz <ricardo.katz@serpro.gov.br>
Ricardo Seriani <ricardo.seriani@gmail.com>
Richard Barnes <rlb@ipv.sx>
Richard Crowley <r@rcrowley.org>
@@ -1991,6 +2114,7 @@ Roman Kollár <roman.kollar.0@gmail.com>
Roman Shchekin <mrqtros@gmail.com>
Ron Hashimoto <mail@h2so5.net>
Ron Minnich <rminnich@gmail.com>
+Ronnie Ebrin <ebrin.ronnie@protonmail.com>
Ross Chater <rdchater@gmail.com>
Ross Kinsey <rossikinsey@gmail.com>
Ross Light <light@google.com> <rlight2@gmail.com>
@@ -2010,6 +2134,7 @@ Ryan Brown <ribrdb@google.com>
Ryan Canty <jrcanty@gmail.com>
Ryan Dahl <ry@tinyclouds.org>
Ryan Hitchman <hitchmanr@gmail.com>
+Ryan Kohler <ryankohler@google.com>
Ryan Lower <rpjlower@gmail.com>
Ryan Roden-Corrent <ryan@rcorre.net>
Ryan Seys <ryan@ryanseys.com>
@@ -2023,7 +2148,9 @@ S.Çağlar Onur <caglar@10ur.org>
Sabin Mihai Rapan <sabin.rapan@gmail.com>
Sad Pencil <qh06@qq.com>
Sai Cheemalapati <saicheems@google.com>
+Sai Kiran Dasika <kirandasika30@gmail.com>
Sakeven Jiang <jc5930@sina.cn>
+Salaheddin M. Mahmud <salah.mahmud@gmail.com>
Salmān Aljammāz <s@0x65.net>
Sam Arnold <sarnold64@bloomberg.net>
Sam Boyer <tech@samboyer.org>
@@ -2033,6 +2160,7 @@ Sam Ding <samding@ca.ibm.com>
Sam Hug <samuel.b.hug@gmail.com>
Sam Thorogood <thorogood@google.com> <sam.thorogood@gmail.com>
Sam Whited <sam@samwhited.com>
+Sam Xie <xsambundy@gmail.com>
Sameer Ajmani <sameer@golang.org> <ajmani@gmail.com>
Sami Commerot <samic@google.com>
Sami Pönkänen <sami.ponkanen@gmail.com>
@@ -2042,6 +2170,7 @@ Samuele Pedroni <pedronis@lucediurna.net>
Sander van Harmelen <sander@vanharmelen.nl>
Sanjay Menakuru <balasanjay@gmail.com>
Santhosh Kumar Tekuri <santhosh.tekuri@gmail.com>
+Santiago De la Cruz <51337247+xhit@users.noreply.github.com>
Sarah Adams <shadams@google.com>
Sardorbek Pulatov <sardorbek.pulatov@outlook.com>
Sascha Brawer <sascha@brawer.ch>
@@ -2062,6 +2191,7 @@ Sean Chittenden <seanc@joyent.com>
Sean Christopherson <sean.j.christopherson@intel.com>
Sean Dolphin <Sean.Dolphin@kpcompass.com>
Sean Harger <sharger@google.com>
+Sean Hildebrand <seanwhildebrand@gmail.com>
Sean Liao <seankhliao@gmail.com>
Sean Rees <sean@erifax.org>
Sebastiaan van Stijn <github@gone.nl>
@@ -2094,10 +2224,12 @@ Serhii Aheienko <serhii.aheienko@gmail.com>
Seth Hoenig <seth.a.hoenig@gmail.com>
Seth Vargo <sethvargo@gmail.com>
Shahar Kohanim <skohanim@gmail.com>
+Shailesh Suryawanshi <ss.shailesh28@gmail.com>
Shamil Garatuev <garatuev@gmail.com>
Shane Hansen <shanemhansen@gmail.com>
Shang Jian Ding <sding3@ncsu.edu>
Shaozhen Ding <dsz0111@gmail.com>
+Shaquille Que <shaquille@golang.org>
Shaquille Wyan Que <shaqqywyan@gmail.com>
Shaun Dunning <shaun.dunning@uservoice.com>
Shawn Elliott <selliott@microsoft.com>
@@ -2108,8 +2240,11 @@ Shenghou Ma <minux@golang.org> <minux.ma@gmail.com>
Shengjing Zhu <zsj950618@gmail.com>
Shengyu Zhang <shengyu.zhang@chaitin.com>
Shi Han Ng <shihanng@gmail.com>
+ShihCheng Tu <mrtoastcheng@gmail.com>
Shijie Hao <haormj@gmail.com>
+Shin Fan <shinfan@google.com>
Shinji Tanaka <shinji.tanaka@gmail.com>
+Shinnosuke Sawada <6warashi9@gmail.com>
Shintaro Kaneko <kaneshin0120@gmail.com>
Shivakumar GN <shivakumar.gn@gmail.com>
Shivani Singhal <shivani.singhal2804@gmail.com>
@@ -2121,17 +2256,21 @@ Silvan Jegen <s.jegen@gmail.com>
Simarpreet Singh <simar@linux.com>
Simon Drake <simondrake1990@gmail.com>
Simon Ferquel <simon.ferquel@docker.com>
+Simon Frei <freisim93@gmail.com>
Simon Jefford <simon.jefford@gmail.com>
Simon Rawet <simon@rawet.se>
Simon Rozman <simon@rozman.si>
+Simon Ser <contact@emersion.fr>
Simon Thulbourn <simon+github@thulbourn.com>
Simon Whitehead <chemnova@gmail.com>
Sina Siadat <siadat@gmail.com>
Sjoerd Siebinga <sjoerd.siebinga@gmail.com>
Sokolov Yura <funny.falcon@gmail.com>
Song Gao <song@gao.io>
+Songjiayang <songjiayang1@gmail.com>
Soojin Nam <jsunam@gmail.com>
Søren L. Hansen <soren@linux2go.dk>
+Sparrow Li <liyuancylx@gmail.com>
Spencer Kocot <spencerkocot@gmail.com>
Spencer Nelson <s@spenczar.com>
Spencer Tung <spencertung@google.com>
@@ -2140,12 +2279,14 @@ Srdjan Petrovic <spetrovic@google.com>
Sridhar Venkatakrishnan <sridhar@laddoo.net>
Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>
StalkR <stalkr@stalkr.net>
+Stan Hu <stanhu@gmail.com>
Stan Schwertly <stan@schwertly.com>
Stanislav Afanasev <php.progger@gmail.com>
Steeve Morin <steeve.morin@gmail.com>
Stefan Baebler <sbaebler@outbrain.com>
Stefan Nilsson <snilsson@nada.kth.se> <trolleriprofessorn@gmail.com>
Stepan Shabalin <neverliberty@gmail.com>
+Stephan Klatt <stephan.klatt@gmail.com>
Stephan Renatus <srenatus@chef.io>
Stephan Zuercher <zuercher@gmail.com>
Stéphane Travostino <stephane.travostino@gmail.com>
@@ -2163,13 +2304,16 @@ Steve Mynott <steve.mynott@gmail.com>
Steve Newman <snewman@google.com>
Steve Phillips <elimisteve@gmail.com>
Steve Streeting <steve@stevestreeting.com>
+Steve Traut <straut@google.com>
Steven Buss <sbuss@google.com>
Steven Elliot Harris <seharris@gmail.com>
Steven Erenst <stevenerenst@gmail.com>
Steven Hartland <steven.hartland@multiplay.co.uk>
Steven Littiebrant <imgroxx@gmail.com>
+Steven Maude <git@stevenmaude.co.uk>
Steven Wilkin <stevenwilkin@gmail.com>
Stuart Jansen <sjansen@buscaluz.org>
+Subham Sarkar <sarkar.subhams2@gmail.com>
Sue Spence <virtuallysue@gmail.com>
Sugu Sougoumarane <ssougou@gmail.com>
Suharsh Sivakumar <suharshs@google.com>
@@ -2193,6 +2337,7 @@ Taesu Pyo <pyotaesu@gmail.com>
Tai Le <letientai299@gmail.com>
Taj Khattra <taj.khattra@gmail.com>
Takashi Matsuo <tmatsuo@google.com>
+Takashi Mima <tks.m1205@gmail.com>
Takayoshi Nishida <takayoshi.nishida@gmail.com>
Takeshi YAMANASHI <9.nashi@gmail.com>
Takuto Ikuta <tikuta@google.com>
@@ -2221,6 +2366,7 @@ Thanatat Tamtan <acoshift@gmail.com>
The Hatsune Daishi <nao20010128@gmail.com>
Thiago Avelino <t@avelino.xxx>
Thiago Fransosi Farina <thiago.farina@gmail.com> <tfarina@chromium.org>
+Thom Wiggers <thom@thomwiggers.nl>
Thomas Alan Copeland <talan.copeland@gmail.com>
Thomas Bonfort <thomas.bonfort@gmail.com>
Thomas Bouldin <inlined@google.com>
@@ -2245,6 +2391,7 @@ Tim Ebringer <tim.ebringer@gmail.com>
Tim Heckman <t@heckman.io>
Tim Henderson <tim.tadh@gmail.com>
Tim Hockin <thockin@google.com>
+Tim King <taking@google.com>
Tim Möhlmann <muhlemmer@gmail.com>
Tim Swast <swast@google.com>
Tim Wright <tenortim@gmail.com>
@@ -2252,8 +2399,10 @@ Tim Xu <xiaoxubeii@gmail.com>
Timmy Douglas <timmyd983@gmail.com>
Timo Savola <timo.savola@gmail.com>
Timo Truyts <alkaloid.btx@gmail.com>
+Timothy Gu <timothygu99@gmail.com>
Timothy Studd <tim@timstudd.com>
Tipp Moseley <tipp@google.com>
+Tiwei Bie <tiwei.btw@antgroup.com>
Tobias Assarsson <tobias.assarsson@gmail.com>
Tobias Columbus <tobias.columbus@gmail.com> <tobias.columbus@googlemail.com>
Tobias Klauser <tklauser@distanz.ch>
@@ -2268,11 +2417,13 @@ Tom Lanyon <tomlanyon@google.com>
Tom Levy <tomlevy93@gmail.com>
Tom Limoncelli <tal@whatexit.org>
Tom Linford <tomlinford@gmail.com>
+Tom Panton <tom@tomandtally.co.uk>
Tom Parkin <tom.parkin@gmail.com>
Tom Payne <twpayne@gmail.com>
Tom Szymanski <tgs@google.com>
Tom Thorogood <me+google@tomthorogood.co.uk>
Tom Wilkie <tom@weave.works>
+Tom Zierbock <tomzierbock@gmail.com>
Tomas Dabasinskas <tomas@dabasinskas.net>
Tommy Schaefer <tommy.schaefer@teecom.com>
Tomohiro Kusumoto <zabio1192@gmail.com>
@@ -2298,6 +2449,7 @@ Tristan Colgate <tcolgate@gmail.com>
Tristan Ooohry <ooohry@gmail.com>
Tristan Rice <rice@fn.lc>
Troels Thomsen <troels@thomsen.io>
+Trong Bui <trong.buiquoc@gmail.com>
Trung Nguyen <trung.n.k@gmail.com>
Tsuji Daishiro <dram.dt.shonan@gmail.com>
Tudor Golubenco <tudor.g@gmail.com>
@@ -2308,6 +2460,7 @@ Tyler Bunnell <tylerbunnell@gmail.com>
Tyler Treat <ttreat31@gmail.com>
Tyson Andre <tysonandre775@gmail.com>
Tzach Shabtay <tzachshabtay@gmail.com>
+Tzu-Chiao Yeh <su3g4284zo6y7@gmail.com>
Tzu-Jung Lee <roylee17@currant.com>
Udalov Max <re.udalov@gmail.com>
Ugorji Nwoke <ugorji@gmail.com>
@@ -2316,6 +2469,7 @@ Ulrich Kunitz <uli.kunitz@gmail.com>
Umang Parmar <umangjparmar@gmail.com>
Uriel Mangado <uriel@berlinblue.org>
Urvil Patel <patelurvil38@gmail.com>
+Utkarsh Dixit <53217283+utkarsh-extc@users.noreply.github.com>
Uttam C Pawar <uttam.c.pawar@intel.com>
Vadim Grek <vadimprog@gmail.com>
Vadim Vygonets <unixdj@gmail.com>
@@ -2327,6 +2481,7 @@ Venil Noronha <veniln@vmware.com>
Veselkov Konstantin <kostozyb@gmail.com>
Viacheslav Poturaev <vearutop@gmail.com>
Victor Chudnovsky <vchudnov@google.com>
+Victor Michel <victor@optimyze.cloud>
Victor Vrantchan <vrancean+github@gmail.com>
Vignesh Ramachandra <vickyramachandra@gmail.com>
Vikas Kedia <vikask@google.com>
@@ -2341,6 +2496,7 @@ Visweswara R <r.visweswara@gmail.com>
Vitaly Zdanevich <zdanevich.vitaly@ya.ru>
Vitor De Mario <vitordemario@gmail.com>
Vivek Sekhar <vsekhar@google.com>
+Vivek V <iamvivekv96@gmail.com>
Vivian Liang <vliang88@gmail.com>
Vlad Krasnov <vlad@cloudflare.com>
Vladimir Evgrafov <evgrafov.vladimir@gmail.com>
@@ -2392,6 +2548,7 @@ Wu Yunzhou <yunzhouwu@gmail.com>
Xi Ruoyao <xry23333@gmail.com>
Xia Bin <snyh@snyh.org>
Xiangdong Ji <xiangdong.ji@arm.com>
+Xiaodong Liu <teaofmoli@gmail.com>
Xing Xing <mikespook@gmail.com>
Xingqang Bai <bxq2011hust@qq.com>
Xu Fei <badgangkiller@gmail.com>
@@ -2459,6 +2616,7 @@ Zhou Peng <p@ctriple.cn>
Ziad Hatahet <hatahet@gmail.com>
Ziheng Liu <lzhfromustc@gmail.com>
Zorion Arrizabalaga <zorionk@gmail.com>
+Zyad A. Ali <zyad.ali.me@gmail.com>
Максадбек Ахмедов <a.maksadbek@gmail.com>
Максим Федосеев <max.faceless.frei@gmail.com>
Роман Хавроненко <hagen1778@gmail.com>
diff --git a/README.md b/README.md
index 49231bf25d..837734b6e5 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
Go is an open source programming language that makes it easy to build simple,
reliable, and efficient software.
-![Gopher image](doc/gopher/fiveyears.jpg)
+![Gopher image](https://golang.org/doc/gopher/fiveyears.jpg)
*Gopher image by [Renee French][rf], licensed under [Creative Commons 3.0 Attributions license][cc3-by].*
Our canonical Git repository is located at https://go.googlesource.com/go.
@@ -19,22 +19,20 @@ BSD-style license found in the LICENSE file.
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install
-or load [doc/install.html](./doc/install.html) in your web browser for installation
-instructions.
+for installation instructions.
#### Install From Source
If a binary distribution is not available for your combination of
operating system and architecture, visit
-https://golang.org/doc/install/source or load [doc/install-source.html](./doc/install-source.html)
-in your web browser for source installation instructions.
+https://golang.org/doc/install/source
+for source installation instructions.
### Contributing
Go is the work of thousands of contributors. We appreciate your help!
-To contribute, please read the contribution guidelines:
- https://golang.org/doc/contribute.html
+To contribute, please read the contribution guidelines at https://golang.org/doc/contribute.html.
Note that the Go project uses the issue tracker for bug reports and
proposals only. See https://golang.org/wiki/Questions for a list of
diff --git a/doc/articles/go_command.html b/doc/articles/go_command.html
deleted file mode 100644
index 5b6fd4d24b..0000000000
--- a/doc/articles/go_command.html
+++ /dev/null
@@ -1,254 +0,0 @@
-<!--{
- "title": "About the go command"
-}-->
-
-<p>The Go distribution includes a command, named
-"<code><a href="/cmd/go/">go</a></code>", that
-automates the downloading, building, installation, and testing of Go packages
-and commands. This document talks about why we wrote a new command, what it
-is, what it's not, and how to use it.</p>
-
-<h2>Motivation</h2>
-
-<p>You might have seen early Go talks in which Rob Pike jokes that the idea
-for Go arose while waiting for a large Google server to compile. That
-really was the motivation for Go: to build a language that worked well
-for building the large software that Google writes and runs. It was
-clear from the start that such a language must provide a way to
-express dependencies between code libraries clearly, hence the package
-grouping and the explicit import blocks. It was also clear from the
-start that you might want arbitrary syntax for describing the code
-being imported; this is why import paths are string literals.</p>
-
-<p>An explicit goal for Go from the beginning was to be able to build Go
-code using only the information found in the source itself, not
-needing to write a makefile or one of the many modern replacements for
-makefiles. If Go needed a configuration file to explain how to build
-your program, then Go would have failed.</p>
-
-<p>At first, there was no Go compiler, and the initial development
-focused on building one and then building libraries for it. For
-expedience, we postponed the automation of building Go code by using
-make and writing makefiles. When compiling a single package involved
-multiple invocations of the Go compiler, we even used a program to
-write the makefiles for us. You can find it if you dig through the
-repository history.</p>
-
-<p>The purpose of the new go command is our return to this ideal, that Go
-programs should compile without configuration or additional effort on
-the part of the developer beyond writing the necessary import
-statements.</p>
-
-<h2>Configuration versus convention</h2>
-
-<p>The way to achieve the simplicity of a configuration-free system is to
-establish conventions. The system works only to the extent that those conventions
-are followed. When we first launched Go, many people published packages that
-had to be installed in certain places, under certain names, using certain build
-tools, in order to be used. That's understandable: that's the way it works in
-most other languages. Over the last few years we consistently reminded people
-about the <code>goinstall</code> command
-(now replaced by <a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies"><code>go get</code></a>)
-and its conventions: first, that the import path is derived in a known way from
-the URL of the source code; second, that the place to store the sources in
-the local file system is derived in a known way from the import path; third,
-that each directory in a source tree corresponds to a single package; and
-fourth, that the package is built using only information in the source code.
-Today, the vast majority of packages follow these conventions.
-The Go ecosystem is simpler and more powerful as a result.</p>
-
-<p>We received many requests to allow a makefile in a package directory to
-provide just a little extra configuration beyond what's in the source code.
-But that would have introduced new rules. Because we did not accede to such
-requests, we were able to write the go command and eliminate our use of make
-or any other build system.</p>
-
-<p>It is important to understand that the go command is not a general
-build tool. It cannot be configured and it does not attempt to build
-anything but Go packages. These are important simplifying
-assumptions: they simplify not only the implementation but also, more
-important, the use of the tool itself.</p>
-
-<h2>Go's conventions</h2>
-
-<p>The <code>go</code> command requires that code adheres to a few key,
-well-established conventions.</p>
-
-<p>First, the import path is derived in a known way from the URL of the
-source code. For Bitbucket, GitHub, Google Code, and Launchpad, the
-root directory of the repository is identified by the repository's
-main URL, without the <code>http://</code> prefix. Subdirectories are named by
-adding to that path.
-For example, the Go example programs are obtained by running</p>
-
-<pre>
-git clone https://github.com/golang/example
-</pre>
-
-<p>and thus the import path for the root directory of that repository is
-"<code>github.com/golang/example</code>".
-The <a href="https://godoc.org/github.com/golang/example/stringutil">stringutil</a>
-package is stored in a subdirectory, so its import path is
-"<code>github.com/golang/example/stringutil</code>".</p>
-
-<p>These paths are on the long side, but in exchange we get an
-automatically managed name space for import paths and the ability for
-a tool like the go command to look at an unfamiliar import path and
-deduce where to obtain the source code.</p>
-
-<p>Second, the place to store sources in the local file system is derived
-in a known way from the import path, specifically
-<code>$GOPATH/src/&lt;import-path&gt;</code>.
-If unset, <code>$GOPATH</code> defaults to a subdirectory
-named <code>go</code> in the user's home directory.
-If <code>$GOPATH</code> is set to a list of paths, the go command tries
-<code>&lt;dir&gt;/src/&lt;import-path&gt;</code> for each of the directories in
-that list.
-</p>
-
-<p>Each of those trees contains, by convention, a top-level directory named
-"<code>bin</code>", for holding compiled executables, and a top-level directory
-named "<code>pkg</code>", for holding compiled packages that can be imported,
-and the "<code>src</code>" directory, for holding package source files.
-Imposing this structure lets us keep each of these directory trees
-self-contained: the compiled form and the sources are always near each
-other.</p>
-
-<p>These naming conventions also let us work in the reverse direction,
-from a directory name to its import path. This mapping is important
-for many of the go command's subcommands, as we'll see below.</p>
-
-<p>Third, each directory in a source tree corresponds to a single
-package. By restricting a directory to a single package, we don't have
-to create hybrid import paths that specify first the directory and
-then the package within that directory. Also, most file management
-tools and UIs work on directories as fundamental units. Tying the
-fundamental Go unit&mdash;the package&mdash;to file system structure means
-that file system tools become Go package tools. Copying, moving, or
-deleting a package corresponds to copying, moving, or deleting a
-directory.</p>
-
-<p>Fourth, each package is built using only the information present in
-the source files. This makes it much more likely that the tool will
-be able to adapt to changing build environments and conditions. For
-example, if we allowed extra configuration such as compiler flags or
-command line recipes, then that configuration would need to be updated
-each time the build tools changed; it would also be inherently tied
-to the use of a specific toolchain.</p>
-
-<h2>Getting started with the go command</h2>
-
-<p>Finally, a quick tour of how to use the go command.
-As mentioned above, the default <code>$GOPATH</code> on Unix is <code>$HOME/go</code>.
-We'll store our programs there.
-To use a different location, you can set <code>$GOPATH</code>;
-see <a href="/doc/code.html">How to Write Go Code</a> for details.
-
-<p>We first add some source code. Suppose we want to use
-the indexing library from the codesearch project along with a left-leaning
-red-black tree. We can install both with the "<code>go get</code>"
-subcommand:</p>
-
-<pre>
-$ go get github.com/google/codesearch/index
-$ go get github.com/petar/GoLLRB/llrb
-$
-</pre>
-
-<p>Both of these projects are now downloaded and installed into <code>$HOME/go</code>,
-which contains the two directories
-<code>src/github.com/google/codesearch/index/</code> and
-<code>src/github.com/petar/GoLLRB/llrb/</code>, along with the compiled
-packages (in <code>pkg/</code>) for those libraries and their dependencies.</p>
-
-<p>Because we used version control systems (Mercurial and Git) to check
-out the sources, the source tree also contains the other files in the
-corresponding repositories, such as related packages. The "<code>go list</code>"
-subcommand lists the import paths corresponding to its arguments, and
-the pattern "<code>./...</code>" means start in the current directory
-("<code>./</code>") and find all packages below that directory
-("<code>...</code>"):</p>
-
-<pre>
-$ cd $HOME/go/src
-$ go list ./...
-github.com/google/codesearch/cmd/cgrep
-github.com/google/codesearch/cmd/cindex
-github.com/google/codesearch/cmd/csearch
-github.com/google/codesearch/index
-github.com/google/codesearch/regexp
-github.com/google/codesearch/sparse
-github.com/petar/GoLLRB/example
-github.com/petar/GoLLRB/llrb
-$
-</pre>
-
-<p>We can also test those packages:</p>
-
-<pre>
-$ go test ./...
-? github.com/google/codesearch/cmd/cgrep [no test files]
-? github.com/google/codesearch/cmd/cindex [no test files]
-? github.com/google/codesearch/cmd/csearch [no test files]
-ok github.com/google/codesearch/index 0.203s
-ok github.com/google/codesearch/regexp 0.017s
-? github.com/google/codesearch/sparse [no test files]
-? github.com/petar/GoLLRB/example [no test files]
-ok github.com/petar/GoLLRB/llrb 0.231s
-$
-</pre>
-
-<p>If a go subcommand is invoked with no paths listed, it operates on the
-current directory:</p>
-
-<pre>
-$ cd github.com/google/codesearch/regexp
-$ go list
-github.com/google/codesearch/regexp
-$ go test -v
-=== RUN TestNstateEnc
---- PASS: TestNstateEnc (0.00s)
-=== RUN TestMatch
---- PASS: TestMatch (0.00s)
-=== RUN TestGrep
---- PASS: TestGrep (0.00s)
-PASS
-ok github.com/google/codesearch/regexp 0.018s
-$ go install
-$
-</pre>
-
-<p>That "<code>go install</code>" subcommand installs the latest copy of the
-package into the pkg directory. Because the go command can analyze the
-dependency graph, "<code>go install</code>" also installs any packages that
-this package imports but that are out of date, recursively.</p>
-
-<p>Notice that "<code>go install</code>" was able to determine the name of the
-import path for the package in the current directory, because of the convention
-for directory naming. It would be a little more convenient if we could pick
-the name of the directory where we kept source code, and we probably wouldn't
-pick such a long name, but that ability would require additional configuration
-and complexity in the tool. Typing an extra directory name or two is a small
-price to pay for the increased simplicity and power.</p>
-
-<h2>Limitations</h2>
-
-<p>As mentioned above, the go command is not a general-purpose build
-tool.
-In particular, it does not have any facility for generating Go
-source files <em>during</em> a build, although it does provide
-<a href="/cmd/go/#hdr-Generate_Go_files_by_processing_source"><code>go</code>
-<code>generate</code></a>,
-which can automate the creation of Go files <em>before</em> the build.
-For more advanced build setups, you may need to write a
-makefile (or a configuration file for the build tool of your choice)
-to run whatever tool creates the Go files and then check those generated source files
-into your repository. This is more work for you, the package author,
-but it is significantly less work for your users, who can use
-"<code>go get</code>" without needing to obtain and build
-any additional tools.</p>
-
-<h2>More information</h2>
-
-<p>For more information, read <a href="/doc/code.html">How to Write Go Code</a>
-and see the <a href="/cmd/go/">go command documentation</a>.</p>
diff --git a/doc/articles/index.html b/doc/articles/index.html
deleted file mode 100644
index 9ddd669731..0000000000
--- a/doc/articles/index.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!--{
- "Title": "/doc/articles/"
-}-->
-
-<p>
-See the <a href="/doc/#articles">Documents page</a> and the
-<a href="/blog/index">Blog index</a> for a complete list of Go articles.
-</p>
diff --git a/doc/articles/race_detector.html b/doc/articles/race_detector.html
deleted file mode 100644
index 09188c15d5..0000000000
--- a/doc/articles/race_detector.html
+++ /dev/null
@@ -1,440 +0,0 @@
-<!--{
- "Title": "Data Race Detector",
- "Template": true
-}-->
-
-<h2 id="Introduction">Introduction</h2>
-
-<p>
-Data races are among the most common and hardest to debug types of bugs in concurrent systems.
-A data race occurs when two goroutines access the same variable concurrently and at least one of the accesses is a write.
-See the <a href="/ref/mem/">The Go Memory Model</a> for details.
-</p>
-
-<p>
-Here is an example of a data race that can lead to crashes and memory corruption:
-</p>
-
-<pre>
-func main() {
- c := make(chan bool)
- m := make(map[string]string)
- go func() {
- m["1"] = "a" // First conflicting access.
- c &lt;- true
- }()
- m["2"] = "b" // Second conflicting access.
- &lt;-c
- for k, v := range m {
- fmt.Println(k, v)
- }
-}
-</pre>
-
-<h2 id="Usage">Usage</h2>
-
-<p>
-To help diagnose such bugs, Go includes a built-in data race detector.
-To use it, add the <code>-race</code> flag to the go command:
-</p>
-
-<pre>
-$ go test -race mypkg // to test the package
-$ go run -race mysrc.go // to run the source file
-$ go build -race mycmd // to build the command
-$ go install -race mypkg // to install the package
-</pre>
-
-<h2 id="Report_Format">Report Format</h2>
-
-<p>
-When the race detector finds a data race in the program, it prints a report.
-The report contains stack traces for conflicting accesses, as well as stacks where the involved goroutines were created.
-Here is an example:
-</p>
-
-<pre>
-WARNING: DATA RACE
-Read by goroutine 185:
- net.(*pollServer).AddFD()
- src/net/fd_unix.go:89 +0x398
- net.(*pollServer).WaitWrite()
- src/net/fd_unix.go:247 +0x45
- net.(*netFD).Write()
- src/net/fd_unix.go:540 +0x4d4
- net.(*conn).Write()
- src/net/net.go:129 +0x101
- net.func·060()
- src/net/timeout_test.go:603 +0xaf
-
-Previous write by goroutine 184:
- net.setWriteDeadline()
- src/net/sockopt_posix.go:135 +0xdf
- net.setDeadline()
- src/net/sockopt_posix.go:144 +0x9c
- net.(*conn).SetDeadline()
- src/net/net.go:161 +0xe3
- net.func·061()
- src/net/timeout_test.go:616 +0x3ed
-
-Goroutine 185 (running) created at:
- net.func·061()
- src/net/timeout_test.go:609 +0x288
-
-Goroutine 184 (running) created at:
- net.TestProlongTimeout()
- src/net/timeout_test.go:618 +0x298
- testing.tRunner()
- src/testing/testing.go:301 +0xe8
-</pre>
-
-<h2 id="Options">Options</h2>
-
-<p>
-The <code>GORACE</code> environment variable sets race detector options.
-The format is:
-</p>
-
-<pre>
-GORACE="option1=val1 option2=val2"
-</pre>
-
-<p>
-The options are:
-</p>
-
-<ul>
-<li>
-<code>log_path</code> (default <code>stderr</code>): The race detector writes
-its report to a file named <code>log_path.<em>pid</em></code>.
-The special names <code>stdout</code>
-and <code>stderr</code> cause reports to be written to standard output and
-standard error, respectively.
-</li>
-
-<li>
-<code>exitcode</code> (default <code>66</code>): The exit status to use when
-exiting after a detected race.
-</li>
-
-<li>
-<code>strip_path_prefix</code> (default <code>""</code>): Strip this prefix
-from all reported file paths, to make reports more concise.
-</li>
-
-<li>
-<code>history_size</code> (default <code>1</code>): The per-goroutine memory
-access history is <code>32K * 2**history_size elements</code>.
-Increasing this value can avoid a "failed to restore the stack" error in reports, at the
-cost of increased memory usage.
-</li>
-
-<li>
-<code>halt_on_error</code> (default <code>0</code>): Controls whether the program
-exits after reporting first data race.
-</li>
-
-<li>
-<code>atexit_sleep_ms</code> (default <code>1000</code>): Amount of milliseconds
-to sleep in the main goroutine before exiting.
-</li>
-</ul>
-
-<p>
-Example:
-</p>
-
-<pre>
-$ GORACE="log_path=/tmp/race/report strip_path_prefix=/my/go/sources/" go test -race
-</pre>
-
-<h2 id="Excluding_Tests">Excluding Tests</h2>
-
-<p>
-When you build with <code>-race</code> flag, the <code>go</code> command defines additional
-<a href="/pkg/go/build/#hdr-Build_Constraints">build tag</a> <code>race</code>.
-You can use the tag to exclude some code and tests when running the race detector.
-Some examples:
-</p>
-
-<pre>
-// +build !race
-
-package foo
-
-// The test contains a data race. See issue 123.
-func TestFoo(t *testing.T) {
- // ...
-}
-
-// The test fails under the race detector due to timeouts.
-func TestBar(t *testing.T) {
- // ...
-}
-
-// The test takes too long under the race detector.
-func TestBaz(t *testing.T) {
- // ...
-}
-</pre>
-
-<h2 id="How_To_Use">How To Use</h2>
-
-<p>
-To start, run your tests using the race detector (<code>go test -race</code>).
-The race detector only finds races that happen at runtime, so it can't find
-races in code paths that are not executed.
-If your tests have incomplete coverage,
-you may find more races by running a binary built with <code>-race</code> under a realistic
-workload.
-</p>
-
-<h2 id="Typical_Data_Races">Typical Data Races</h2>
-
-<p>
-Here are some typical data races. All of them can be detected with the race detector.
-</p>
-
-<h3 id="Race_on_loop_counter">Race on loop counter</h3>
-
-<pre>
-func main() {
- var wg sync.WaitGroup
- wg.Add(5)
- for i := 0; i < 5; i++ {
- go func() {
- fmt.Println(i) // Not the 'i' you are looking for.
- wg.Done()
- }()
- }
- wg.Wait()
-}
-</pre>
-
-<p>
-The variable <code>i</code> in the function literal is the same variable used by the loop, so
-the read in the goroutine races with the loop increment.
-(This program typically prints 55555, not 01234.)
-The program can be fixed by making a copy of the variable:
-</p>
-
-<pre>
-func main() {
- var wg sync.WaitGroup
- wg.Add(5)
- for i := 0; i < 5; i++ {
- go func(j int) {
- fmt.Println(j) // Good. Read local copy of the loop counter.
- wg.Done()
- }(i)
- }
- wg.Wait()
-}
-</pre>
-
-<h3 id="Accidentally_shared_variable">Accidentally shared variable</h3>
-
-<pre>
-// ParallelWrite writes data to file1 and file2, returns the errors.
-func ParallelWrite(data []byte) chan error {
- res := make(chan error, 2)
- f1, err := os.Create("file1")
- if err != nil {
- res &lt;- err
- } else {
- go func() {
- // This err is shared with the main goroutine,
- // so the write races with the write below.
- _, err = f1.Write(data)
- res &lt;- err
- f1.Close()
- }()
- }
- f2, err := os.Create("file2") // The second conflicting write to err.
- if err != nil {
- res &lt;- err
- } else {
- go func() {
- _, err = f2.Write(data)
- res &lt;- err
- f2.Close()
- }()
- }
- return res
-}
-</pre>
-
-<p>
-The fix is to introduce new variables in the goroutines (note the use of <code>:=</code>):
-</p>
-
-<pre>
- ...
- _, err := f1.Write(data)
- ...
- _, err := f2.Write(data)
- ...
-</pre>
-
-<h3 id="Unprotected_global_variable">Unprotected global variable</h3>
-
-<p>
-If the following code is called from several goroutines, it leads to races on the <code>service</code> map.
-Concurrent reads and writes of the same map are not safe:
-</p>
-
-<pre>
-var service map[string]net.Addr
-
-func RegisterService(name string, addr net.Addr) {
- service[name] = addr
-}
-
-func LookupService(name string) net.Addr {
- return service[name]
-}
-</pre>
-
-<p>
-To make the code safe, protect the accesses with a mutex:
-</p>
-
-<pre>
-var (
- service map[string]net.Addr
- serviceMu sync.Mutex
-)
-
-func RegisterService(name string, addr net.Addr) {
- serviceMu.Lock()
- defer serviceMu.Unlock()
- service[name] = addr
-}
-
-func LookupService(name string) net.Addr {
- serviceMu.Lock()
- defer serviceMu.Unlock()
- return service[name]
-}
-</pre>
-
-<h3 id="Primitive_unprotected_variable">Primitive unprotected variable</h3>
-
-<p>
-Data races can happen on variables of primitive types as well (<code>bool</code>, <code>int</code>, <code>int64</code>, etc.),
-as in this example:
-</p>
-
-<pre>
-type Watchdog struct{ last int64 }
-
-func (w *Watchdog) KeepAlive() {
- w.last = time.Now().UnixNano() // First conflicting access.
-}
-
-func (w *Watchdog) Start() {
- go func() {
- for {
- time.Sleep(time.Second)
- // Second conflicting access.
- if w.last < time.Now().Add(-10*time.Second).UnixNano() {
- fmt.Println("No keepalives for 10 seconds. Dying.")
- os.Exit(1)
- }
- }
- }()
-}
-</pre>
-
-<p>
-Even such "innocent" data races can lead to hard-to-debug problems caused by
-non-atomicity of the memory accesses,
-interference with compiler optimizations,
-or reordering issues accessing processor memory .
-</p>
-
-<p>
-A typical fix for this race is to use a channel or a mutex.
-To preserve the lock-free behavior, one can also use the
-<a href="/pkg/sync/atomic/"><code>sync/atomic</code></a> package.
-</p>
-
-<pre>
-type Watchdog struct{ last int64 }
-
-func (w *Watchdog) KeepAlive() {
- atomic.StoreInt64(&amp;w.last, time.Now().UnixNano())
-}
-
-func (w *Watchdog) Start() {
- go func() {
- for {
- time.Sleep(time.Second)
- if atomic.LoadInt64(&amp;w.last) < time.Now().Add(-10*time.Second).UnixNano() {
- fmt.Println("No keepalives for 10 seconds. Dying.")
- os.Exit(1)
- }
- }
- }()
-}
-</pre>
-
-<h3 id="Unsynchronized_send_and_close_operations">Unsynchronized send and close operations</h3>
-
-<p>
-As this example demonstrates, unsynchronized send and close operations
-on the same channel can also be a race condition:
-</p>
-
-<pre>
-c := make(chan struct{}) // or buffered channel
-
-// The race detector cannot derive the happens before relation
-// for the following send and close operations. These two operations
-// are unsynchronized and happen concurrently.
-go func() { c <- struct{}{} }()
-close(c)
-</pre>
-
-<p>
-According to the Go memory model, a send on a channel happens before
-the corresponding receive from that channel completes. To synchronize
-send and close operations, use a receive operation that guarantees
-the send is done before the close:
-</p>
-
-<pre>
-c := make(chan struct{}) // or buffered channel
-
-go func() { c <- struct{}{} }()
-<-c
-close(c)
-</pre>
-
-<h2 id="Supported_Systems">Supported Systems</h2>
-
-<p>
- The race detector runs on
- <code>linux/amd64</code>, <code>linux/ppc64le</code>,
- <code>linux/arm64</code>, <code>freebsd/amd64</code>,
- <code>netbsd/amd64</code>, <code>darwin/amd64</code>,
- <code>darwin/arm64</code>, and <code>windows/amd64</code>.
-</p>
-
-<h2 id="Runtime_Overheads">Runtime Overhead</h2>
-
-<p>
-The cost of race detection varies by program, but for a typical program, memory
-usage may increase by 5-10x and execution time by 2-20x.
-</p>
-
-<p>
-The race detector currently allocates an extra 8 bytes per <code>defer</code>
-and <code>recover</code> statement. Those extra allocations <a
-href="https://golang.org/issue/26813">are not recovered until the goroutine
-exits</a>. This means that if you have a long-running goroutine that is
-periodically issuing <code>defer</code> and <code>recover</code> calls,
-the program memory usage may grow without bound. These memory allocations
-will not show up in the output of <code>runtime.ReadMemStats</code> or
-<code>runtime/pprof</code>.
-</p>
diff --git a/doc/articles/wiki/edit.html b/doc/articles/wiki/edit.html
deleted file mode 100644
index 044c3bedea..0000000000
--- a/doc/articles/wiki/edit.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<h1>Editing {{.Title}}</h1>
-
-<form action="/save/{{.Title}}" method="POST">
-<div><textarea name="body" rows="20" cols="80">{{printf "%s" .Body}}</textarea></div>
-<div><input type="submit" value="Save"></div>
-</form>
diff --git a/doc/articles/wiki/final-noclosure.go b/doc/articles/wiki/final-noclosure.go
deleted file mode 100644
index d894e7d319..0000000000
--- a/doc/articles/wiki/final-noclosure.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "errors"
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
- "regexp"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title, err := getTitle(w, r)
- if err != nil {
- return
- }
- p, err := loadPage(title)
- if err != nil {
- http.Redirect(w, r, "/edit/"+title, http.StatusFound)
- return
- }
- renderTemplate(w, "view", p)
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request) {
- title, err := getTitle(w, r)
- if err != nil {
- return
- }
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- renderTemplate(w, "edit", p)
-}
-
-func saveHandler(w http.ResponseWriter, r *http.Request) {
- title, err := getTitle(w, r)
- if err != nil {
- return
- }
- body := r.FormValue("body")
- p := &Page{Title: title, Body: []byte(body)}
- err = p.save()
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- http.Redirect(w, r, "/view/"+title, http.StatusFound)
-}
-
-func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
- t, err := template.ParseFiles(tmpl + ".html")
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- err = t.Execute(w, p)
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- }
-}
-
-var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
-
-func getTitle(w http.ResponseWriter, r *http.Request) (string, error) {
- m := validPath.FindStringSubmatch(r.URL.Path)
- if m == nil {
- http.NotFound(w, r)
- return "", errors.New("invalid Page Title")
- }
- return m[2], nil // The title is the second subexpression.
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- http.HandleFunc("/edit/", editHandler)
- http.HandleFunc("/save/", saveHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/final-noerror.go b/doc/articles/wiki/final-noerror.go
deleted file mode 100644
index 250236d42e..0000000000
--- a/doc/articles/wiki/final-noerror.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/edit/"):]
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- t, _ := template.ParseFiles("edit.html")
- t.Execute(w, p)
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/view/"):]
- p, _ := loadPage(title)
- t, _ := template.ParseFiles("view.html")
- t.Execute(w, p)
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- http.HandleFunc("/edit/", editHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/final-parsetemplate.go b/doc/articles/wiki/final-parsetemplate.go
deleted file mode 100644
index 0b90cbd3bc..0000000000
--- a/doc/articles/wiki/final-parsetemplate.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
- "regexp"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
- p, err := loadPage(title)
- if err != nil {
- http.Redirect(w, r, "/edit/"+title, http.StatusFound)
- return
- }
- renderTemplate(w, "view", p)
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request, title string) {
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- renderTemplate(w, "edit", p)
-}
-
-func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
- body := r.FormValue("body")
- p := &Page{Title: title, Body: []byte(body)}
- err := p.save()
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- http.Redirect(w, r, "/view/"+title, http.StatusFound)
-}
-
-func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
- t, err := template.ParseFiles(tmpl + ".html")
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- err = t.Execute(w, p)
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- }
-}
-
-var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
-
-func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- m := validPath.FindStringSubmatch(r.URL.Path)
- if m == nil {
- http.NotFound(w, r)
- return
- }
- fn(w, r, m[2])
- }
-}
-
-func main() {
- http.HandleFunc("/view/", makeHandler(viewHandler))
- http.HandleFunc("/edit/", makeHandler(editHandler))
- http.HandleFunc("/save/", makeHandler(saveHandler))
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/final-template.go b/doc/articles/wiki/final-template.go
deleted file mode 100644
index 5028664fe8..0000000000
--- a/doc/articles/wiki/final-template.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/edit/"):]
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- renderTemplate(w, "edit", p)
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/view/"):]
- p, _ := loadPage(title)
- renderTemplate(w, "view", p)
-}
-
-func saveHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/save/"):]
- body := r.FormValue("body")
- p := &Page{Title: title, Body: []byte(body)}
- p.save()
- http.Redirect(w, r, "/view/"+title, http.StatusFound)
-}
-
-func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
- t, _ := template.ParseFiles(tmpl + ".html")
- t.Execute(w, p)
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- http.HandleFunc("/edit/", editHandler)
- http.HandleFunc("/save/", saveHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/final.go b/doc/articles/wiki/final.go
deleted file mode 100644
index b1439b08a9..0000000000
--- a/doc/articles/wiki/final.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
- "regexp"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
- p, err := loadPage(title)
- if err != nil {
- http.Redirect(w, r, "/edit/"+title, http.StatusFound)
- return
- }
- renderTemplate(w, "view", p)
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request, title string) {
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- renderTemplate(w, "edit", p)
-}
-
-func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
- body := r.FormValue("body")
- p := &Page{Title: title, Body: []byte(body)}
- err := p.save()
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- http.Redirect(w, r, "/view/"+title, http.StatusFound)
-}
-
-var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
-
-func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
- err := templates.ExecuteTemplate(w, tmpl+".html", p)
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- }
-}
-
-var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
-
-func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- m := validPath.FindStringSubmatch(r.URL.Path)
- if m == nil {
- http.NotFound(w, r)
- return
- }
- fn(w, r, m[2])
- }
-}
-
-func main() {
- http.HandleFunc("/view/", makeHandler(viewHandler))
- http.HandleFunc("/edit/", makeHandler(editHandler))
- http.HandleFunc("/save/", makeHandler(saveHandler))
-
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/final_test.go b/doc/articles/wiki/final_test.go
deleted file mode 100644
index 764469976e..0000000000
--- a/doc/articles/wiki/final_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2019 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.
-
-// +build ignore
-
-package main
-
-import (
- "fmt"
- "log"
- "net"
- "net/http"
-)
-
-func serve() error {
- l, err := net.Listen("tcp", "127.0.0.1:0")
- if err != nil {
- log.Fatal(err)
- }
- fmt.Println(l.Addr().String())
- s := &http.Server{}
- return s.Serve(l)
-}
diff --git a/doc/articles/wiki/go.mod b/doc/articles/wiki/go.mod
deleted file mode 100644
index 38153ed79f..0000000000
--- a/doc/articles/wiki/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module doc/articles/wiki
-
-go 1.14
diff --git a/doc/articles/wiki/http-sample.go b/doc/articles/wiki/http-sample.go
deleted file mode 100644
index 803b88c4eb..0000000000
--- a/doc/articles/wiki/http-sample.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build ignore
-
-package main
-
-import (
- "fmt"
- "log"
- "net/http"
-)
-
-func handler(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintf(w, "Hi there, I love %s!", r.URL.Path[1:])
-}
-
-func main() {
- http.HandleFunc("/", handler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/index.html b/doc/articles/wiki/index.html
deleted file mode 100644
index a74a58e317..0000000000
--- a/doc/articles/wiki/index.html
+++ /dev/null
@@ -1,741 +0,0 @@
-<!--{
- "Title": "Writing Web Applications",
- "Template": true
-}-->
-
-<h2>Introduction</h2>
-
-<p>
-Covered in this tutorial:
-</p>
-<ul>
-<li>Creating a data structure with load and save methods</li>
-<li>Using the <code>net/http</code> package to build web applications
-<li>Using the <code>html/template</code> package to process HTML templates</li>
-<li>Using the <code>regexp</code> package to validate user input</li>
-<li>Using closures</li>
-</ul>
-
-<p>
-Assumed knowledge:
-</p>
-<ul>
-<li>Programming experience</li>
-<li>Understanding of basic web technologies (HTTP, HTML)</li>
-<li>Some UNIX/DOS command-line knowledge</li>
-</ul>
-
-<h2>Getting Started</h2>
-
-<p>
-At present, you need to have a FreeBSD, Linux, OS X, or Windows machine to run Go.
-We will use <code>$</code> to represent the command prompt.
-</p>
-
-<p>
-Install Go (see the <a href="/doc/install">Installation Instructions</a>).
-</p>
-
-<p>
-Make a new directory for this tutorial inside your <code>GOPATH</code> and cd to it:
-</p>
-
-<pre>
-$ mkdir gowiki
-$ cd gowiki
-</pre>
-
-<p>
-Create a file named <code>wiki.go</code>, open it in your favorite editor, and
-add the following lines:
-</p>
-
-<pre>
-package main
-
-import (
- "fmt"
- "io/ioutil"
-)
-</pre>
-
-<p>
-We import the <code>fmt</code> and <code>ioutil</code> packages from the Go
-standard library. Later, as we implement additional functionality, we will
-add more packages to this <code>import</code> declaration.
-</p>
-
-<h2>Data Structures</h2>
-
-<p>
-Let's start by defining the data structures. A wiki consists of a series of
-interconnected pages, each of which has a title and a body (the page content).
-Here, we define <code>Page</code> as a struct with two fields representing
-the title and body.
-</p>
-
-{{code "doc/articles/wiki/part1.go" `/^type Page/` `/}/`}}
-
-<p>
-The type <code>[]byte</code> means "a <code>byte</code> slice".
-(See <a href="/doc/articles/slices_usage_and_internals.html">Slices: usage and
-internals</a> for more on slices.)
-The <code>Body</code> element is a <code>[]byte</code> rather than
-<code>string</code> because that is the type expected by the <code>io</code>
-libraries we will use, as you'll see below.
-</p>
-
-<p>
-The <code>Page</code> struct describes how page data will be stored in memory.
-But what about persistent storage? We can address that by creating a
-<code>save</code> method on <code>Page</code>:
-</p>
-
-{{code "doc/articles/wiki/part1.go" `/^func.*Page.*save/` `/}/`}}
-
-<p>
-This method's signature reads: "This is a method named <code>save</code> that
-takes as its receiver <code>p</code>, a pointer to <code>Page</code> . It takes
-no parameters, and returns a value of type <code>error</code>."
-</p>
-
-<p>
-This method will save the <code>Page</code>'s <code>Body</code> to a text
-file. For simplicity, we will use the <code>Title</code> as the file name.
-</p>
-
-<p>
-The <code>save</code> method returns an <code>error</code> value because
-that is the return type of <code>WriteFile</code> (a standard library function
-that writes a byte slice to a file). The <code>save</code> method returns the
-error value, to let the application handle it should anything go wrong while
-writing the file. If all goes well, <code>Page.save()</code> will return
-<code>nil</code> (the zero-value for pointers, interfaces, and some other
-types).
-</p>
-
-<p>
-The octal integer literal <code>0600</code>, passed as the third parameter to
-<code>WriteFile</code>, indicates that the file should be created with
-read-write permissions for the current user only. (See the Unix man page
-<code>open(2)</code> for details.)
-</p>
-
-<p>
-In addition to saving pages, we will want to load pages, too:
-</p>
-
-{{code "doc/articles/wiki/part1-noerror.go" `/^func loadPage/` `/^}/`}}
-
-<p>
-The function <code>loadPage</code> constructs the file name from the title
-parameter, reads the file's contents into a new variable <code>body</code>, and
-returns a pointer to a <code>Page</code> literal constructed with the proper
-title and body values.
-</p>
-
-<p>
-Functions can return multiple values. The standard library function
-<code>io.ReadFile</code> returns <code>[]byte</code> and <code>error</code>.
-In <code>loadPage</code>, error isn't being handled yet; the "blank identifier"
-represented by the underscore (<code>_</code>) symbol is used to throw away the
-error return value (in essence, assigning the value to nothing).
-</p>
-
-<p>
-But what happens if <code>ReadFile</code> encounters an error? For example,
-the file might not exist. We should not ignore such errors. Let's modify the
-function to return <code>*Page</code> and <code>error</code>.
-</p>
-
-{{code "doc/articles/wiki/part1.go" `/^func loadPage/` `/^}/`}}
-
-<p>
-Callers of this function can now check the second parameter; if it is
-<code>nil</code> then it has successfully loaded a Page. If not, it will be an
-<code>error</code> that can be handled by the caller (see the
-<a href="/ref/spec#Errors">language specification</a> for details).
-</p>
-
-<p>
-At this point we have a simple data structure and the ability to save to and
-load from a file. Let's write a <code>main</code> function to test what we've
-written:
-</p>
-
-{{code "doc/articles/wiki/part1.go" `/^func main/` `/^}/`}}
-
-<p>
-After compiling and executing this code, a file named <code>TestPage.txt</code>
-would be created, containing the contents of <code>p1</code>. The file would
-then be read into the struct <code>p2</code>, and its <code>Body</code> element
-printed to the screen.
-</p>
-
-<p>
-You can compile and run the program like this:
-</p>
-
-<pre>
-$ go build wiki.go
-$ ./wiki
-This is a sample Page.
-</pre>
-
-<p>
-(If you're using Windows you must type "<code>wiki</code>" without the
-"<code>./</code>" to run the program.)
-</p>
-
-<p>
-<a href="part1.go">Click here to view the code we've written so far.</a>
-</p>
-
-<h2>Introducing the <code>net/http</code> package (an interlude)</h2>
-
-<p>
-Here's a full working example of a simple web server:
-</p>
-
-{{code "doc/articles/wiki/http-sample.go"}}
-
-<p>
-The <code>main</code> function begins with a call to
-<code>http.HandleFunc</code>, which tells the <code>http</code> package to
-handle all requests to the web root (<code>"/"</code>) with
-<code>handler</code>.
-</p>
-
-<p>
-It then calls <code>http.ListenAndServe</code>, specifying that it should
-listen on port 8080 on any interface (<code>":8080"</code>). (Don't
-worry about its second parameter, <code>nil</code>, for now.)
-This function will block until the program is terminated.
-</p>
-
-<p>
-<code>ListenAndServe</code> always returns an error, since it only returns when an
-unexpected error occurs.
-In order to log that error we wrap the function call with <code>log.Fatal</code>.
-</p>
-
-<p>
-The function <code>handler</code> is of the type <code>http.HandlerFunc</code>.
-It takes an <code>http.ResponseWriter</code> and an <code>http.Request</code> as
-its arguments.
-</p>
-
-<p>
-An <code>http.ResponseWriter</code> value assembles the HTTP server's response; by writing
-to it, we send data to the HTTP client.
-</p>
-
-<p>
-An <code>http.Request</code> is a data structure that represents the client
-HTTP request. <code>r.URL.Path</code> is the path component
-of the request URL. The trailing <code>[1:]</code> means
-"create a sub-slice of <code>Path</code> from the 1st character to the end."
-This drops the leading "/" from the path name.
-</p>
-
-<p>
-If you run this program and access the URL:
-</p>
-<pre>http://localhost:8080/monkeys</pre>
-<p>
-the program would present a page containing:
-</p>
-<pre>Hi there, I love monkeys!</pre>
-
-<h2>Using <code>net/http</code> to serve wiki pages</h2>
-
-<p>
-To use the <code>net/http</code> package, it must be imported:
-</p>
-
-<pre>
-import (
- "fmt"
- "io/ioutil"
- "log"
- <b>"net/http"</b>
-)
-</pre>
-
-<p>
-Let's create a handler, <code>viewHandler</code> that will allow users to
-view a wiki page. It will handle URLs prefixed with "/view/".
-</p>
-
-{{code "doc/articles/wiki/part2.go" `/^func viewHandler/` `/^}/`}}
-
-<p>
-Again, note the use of <code>_</code> to ignore the <code>error</code>
-return value from <code>loadPage</code>. This is done here for simplicity
-and generally considered bad practice. We will attend to this later.
-</p>
-
-<p>
-First, this function extracts the page title from <code>r.URL.Path</code>,
-the path component of the request URL.
-The <code>Path</code> is re-sliced with <code>[len("/view/"):]</code> to drop
-the leading <code>"/view/"</code> component of the request path.
-This is because the path will invariably begin with <code>"/view/"</code>,
-which is not part of the page's title.
-</p>
-
-<p>
-The function then loads the page data, formats the page with a string of simple
-HTML, and writes it to <code>w</code>, the <code>http.ResponseWriter</code>.
-</p>
-
-<p>
-To use this handler, we rewrite our <code>main</code> function to
-initialize <code>http</code> using the <code>viewHandler</code> to handle
-any requests under the path <code>/view/</code>.
-</p>
-
-{{code "doc/articles/wiki/part2.go" `/^func main/` `/^}/`}}
-
-<p>
-<a href="part2.go">Click here to view the code we've written so far.</a>
-</p>
-
-<p>
-Let's create some page data (as <code>test.txt</code>), compile our code, and
-try serving a wiki page.
-</p>
-
-<p>
-Open <code>test.txt</code> file in your editor, and save the string "Hello world" (without quotes)
-in it.
-</p>
-
-<pre>
-$ go build wiki.go
-$ ./wiki
-</pre>
-
-<p>
-(If you're using Windows you must type "<code>wiki</code>" without the
-"<code>./</code>" to run the program.)
-</p>
-
-<p>
-With this web server running, a visit to <code><a
-href="http://localhost:8080/view/test">http://localhost:8080/view/test</a></code>
-should show a page titled "test" containing the words "Hello world".
-</p>
-
-<h2>Editing Pages</h2>
-
-<p>
-A wiki is not a wiki without the ability to edit pages. Let's create two new
-handlers: one named <code>editHandler</code> to display an 'edit page' form,
-and the other named <code>saveHandler</code> to save the data entered via the
-form.
-</p>
-
-<p>
-First, we add them to <code>main()</code>:
-</p>
-
-{{code "doc/articles/wiki/final-noclosure.go" `/^func main/` `/^}/`}}
-
-<p>
-The function <code>editHandler</code> loads the page
-(or, if it doesn't exist, create an empty <code>Page</code> struct),
-and displays an HTML form.
-</p>
-
-{{code "doc/articles/wiki/notemplate.go" `/^func editHandler/` `/^}/`}}
-
-<p>
-This function will work fine, but all that hard-coded HTML is ugly.
-Of course, there is a better way.
-</p>
-
-<h2>The <code>html/template</code> package</h2>
-
-<p>
-The <code>html/template</code> package is part of the Go standard library.
-We can use <code>html/template</code> to keep the HTML in a separate file,
-allowing us to change the layout of our edit page without modifying the
-underlying Go code.
-</p>
-
-<p>
-First, we must add <code>html/template</code> to the list of imports. We
-also won't be using <code>fmt</code> anymore, so we have to remove that.
-</p>
-
-<pre>
-import (
- <b>"html/template"</b>
- "io/ioutil"
- "net/http"
-)
-</pre>
-
-<p>
-Let's create a template file containing the HTML form.
-Open a new file named <code>edit.html</code>, and add the following lines:
-</p>
-
-{{code "doc/articles/wiki/edit.html"}}
-
-<p>
-Modify <code>editHandler</code> to use the template, instead of the hard-coded
-HTML:
-</p>
-
-{{code "doc/articles/wiki/final-noerror.go" `/^func editHandler/` `/^}/`}}
-
-<p>
-The function <code>template.ParseFiles</code> will read the contents of
-<code>edit.html</code> and return a <code>*template.Template</code>.
-</p>
-
-<p>
-The method <code>t.Execute</code> executes the template, writing the
-generated HTML to the <code>http.ResponseWriter</code>.
-The <code>.Title</code> and <code>.Body</code> dotted identifiers refer to
-<code>p.Title</code> and <code>p.Body</code>.
-</p>
-
-<p>
-Template directives are enclosed in double curly braces.
-The <code>printf "%s" .Body</code> instruction is a function call
-that outputs <code>.Body</code> as a string instead of a stream of bytes,
-the same as a call to <code>fmt.Printf</code>.
-The <code>html/template</code> package helps guarantee that only safe and
-correct-looking HTML is generated by template actions. For instance, it
-automatically escapes any greater than sign (<code>&gt;</code>), replacing it
-with <code>&amp;gt;</code>, to make sure user data does not corrupt the form
-HTML.
-</p>
-
-<p>
-Since we're working with templates now, let's create a template for our
-<code>viewHandler</code> called <code>view.html</code>:
-</p>
-
-{{code "doc/articles/wiki/view.html"}}
-
-<p>
-Modify <code>viewHandler</code> accordingly:
-</p>
-
-{{code "doc/articles/wiki/final-noerror.go" `/^func viewHandler/` `/^}/`}}
-
-<p>
-Notice that we've used almost exactly the same templating code in both
-handlers. Let's remove this duplication by moving the templating code
-to its own function:
-</p>
-
-{{code "doc/articles/wiki/final-template.go" `/^func renderTemplate/` `/^}/`}}
-
-<p>
-And modify the handlers to use that function:
-</p>
-
-{{code "doc/articles/wiki/final-template.go" `/^func viewHandler/` `/^}/`}}
-{{code "doc/articles/wiki/final-template.go" `/^func editHandler/` `/^}/`}}
-
-<p>
-If we comment out the registration of our unimplemented save handler in
-<code>main</code>, we can once again build and test our program.
-<a href="part3.go">Click here to view the code we've written so far.</a>
-</p>
-
-<h2>Handling non-existent pages</h2>
-
-<p>
-What if you visit <a href="http://localhost:8080/view/APageThatDoesntExist">
-<code>/view/APageThatDoesntExist</code></a>? You'll see a page containing
-HTML. This is because it ignores the error return value from
-<code>loadPage</code> and continues to try and fill out the template
-with no data. Instead, if the requested Page doesn't exist, it should
-redirect the client to the edit Page so the content may be created:
-</p>
-
-{{code "doc/articles/wiki/part3-errorhandling.go" `/^func viewHandler/` `/^}/`}}
-
-<p>
-The <code>http.Redirect</code> function adds an HTTP status code of
-<code>http.StatusFound</code> (302) and a <code>Location</code>
-header to the HTTP response.
-</p>
-
-<h2>Saving Pages</h2>
-
-<p>
-The function <code>saveHandler</code> will handle the submission of forms
-located on the edit pages. After uncommenting the related line in
-<code>main</code>, let's implement the handler:
-</p>
-
-{{code "doc/articles/wiki/final-template.go" `/^func saveHandler/` `/^}/`}}
-
-<p>
-The page title (provided in the URL) and the form's only field,
-<code>Body</code>, are stored in a new <code>Page</code>.
-The <code>save()</code> method is then called to write the data to a file,
-and the client is redirected to the <code>/view/</code> page.
-</p>
-
-<p>
-The value returned by <code>FormValue</code> is of type <code>string</code>.
-We must convert that value to <code>[]byte</code> before it will fit into
-the <code>Page</code> struct. We use <code>[]byte(body)</code> to perform
-the conversion.
-</p>
-
-<h2>Error handling</h2>
-
-<p>
-There are several places in our program where errors are being ignored. This
-is bad practice, not least because when an error does occur the program will
-have unintended behavior. A better solution is to handle the errors and return
-an error message to the user. That way if something does go wrong, the server
-will function exactly how we want and the user can be notified.
-</p>
-
-<p>
-First, let's handle the errors in <code>renderTemplate</code>:
-</p>
-
-{{code "doc/articles/wiki/final-parsetemplate.go" `/^func renderTemplate/` `/^}/`}}
-
-<p>
-The <code>http.Error</code> function sends a specified HTTP response code
-(in this case "Internal Server Error") and error message.
-Already the decision to put this in a separate function is paying off.
-</p>
-
-<p>
-Now let's fix up <code>saveHandler</code>:
-</p>
-
-{{code "doc/articles/wiki/part3-errorhandling.go" `/^func saveHandler/` `/^}/`}}
-
-<p>
-Any errors that occur during <code>p.save()</code> will be reported
-to the user.
-</p>
-
-<h2>Template caching</h2>
-
-<p>
-There is an inefficiency in this code: <code>renderTemplate</code> calls
-<code>ParseFiles</code> every time a page is rendered.
-A better approach would be to call <code>ParseFiles</code> once at program
-initialization, parsing all templates into a single <code>*Template</code>.
-Then we can use the
-<a href="/pkg/html/template/#Template.ExecuteTemplate"><code>ExecuteTemplate</code></a>
-method to render a specific template.
-</p>
-
-<p>
-First we create a global variable named <code>templates</code>, and initialize
-it with <code>ParseFiles</code>.
-</p>
-
-{{code "doc/articles/wiki/final.go" `/var templates/`}}
-
-<p>
-The function <code>template.Must</code> is a convenience wrapper that panics
-when passed a non-nil <code>error</code> value, and otherwise returns the
-<code>*Template</code> unaltered. A panic is appropriate here; if the templates
-can't be loaded the only sensible thing to do is exit the program.
-</p>
-
-<p>
-The <code>ParseFiles</code> function takes any number of string arguments that
-identify our template files, and parses those files into templates that are
-named after the base file name. If we were to add more templates to our
-program, we would add their names to the <code>ParseFiles</code> call's
-arguments.
-</p>
-
-<p>
-We then modify the <code>renderTemplate</code> function to call the
-<code>templates.ExecuteTemplate</code> method with the name of the appropriate
-template:
-</p>
-
-{{code "doc/articles/wiki/final.go" `/func renderTemplate/` `/^}/`}}
-
-<p>
-Note that the template name is the template file name, so we must
-append <code>".html"</code> to the <code>tmpl</code> argument.
-</p>
-
-<h2>Validation</h2>
-
-<p>
-As you may have observed, this program has a serious security flaw: a user
-can supply an arbitrary path to be read/written on the server. To mitigate
-this, we can write a function to validate the title with a regular expression.
-</p>
-
-<p>
-First, add <code>"regexp"</code> to the <code>import</code> list.
-Then we can create a global variable to store our validation
-expression:
-</p>
-
-{{code "doc/articles/wiki/final-noclosure.go" `/^var validPath/`}}
-
-<p>
-The function <code>regexp.MustCompile</code> will parse and compile the
-regular expression, and return a <code>regexp.Regexp</code>.
-<code>MustCompile</code> is distinct from <code>Compile</code> in that it will
-panic if the expression compilation fails, while <code>Compile</code> returns
-an <code>error</code> as a second parameter.
-</p>
-
-<p>
-Now, let's write a function that uses the <code>validPath</code>
-expression to validate path and extract the page title:
-</p>
-
-{{code "doc/articles/wiki/final-noclosure.go" `/func getTitle/` `/^}/`}}
-
-<p>
-If the title is valid, it will be returned along with a <code>nil</code>
-error value. If the title is invalid, the function will write a
-"404 Not Found" error to the HTTP connection, and return an error to the
-handler. To create a new error, we have to import the <code>errors</code>
-package.
-</p>
-
-<p>
-Let's put a call to <code>getTitle</code> in each of the handlers:
-</p>
-
-{{code "doc/articles/wiki/final-noclosure.go" `/^func viewHandler/` `/^}/`}}
-{{code "doc/articles/wiki/final-noclosure.go" `/^func editHandler/` `/^}/`}}
-{{code "doc/articles/wiki/final-noclosure.go" `/^func saveHandler/` `/^}/`}}
-
-<h2>Introducing Function Literals and Closures</h2>
-
-<p>
-Catching the error condition in each handler introduces a lot of repeated code.
-What if we could wrap each of the handlers in a function that does this
-validation and error checking? Go's
-<a href="/ref/spec#Function_literals">function
-literals</a> provide a powerful means of abstracting functionality
-that can help us here.
-</p>
-
-<p>
-First, we re-write the function definition of each of the handlers to accept
-a title string:
-</p>
-
-<pre>
-func viewHandler(w http.ResponseWriter, r *http.Request, title string)
-func editHandler(w http.ResponseWriter, r *http.Request, title string)
-func saveHandler(w http.ResponseWriter, r *http.Request, title string)
-</pre>
-
-<p>
-Now let's define a wrapper function that <i>takes a function of the above
-type</i>, and returns a function of type <code>http.HandlerFunc</code>
-(suitable to be passed to the function <code>http.HandleFunc</code>):
-</p>
-
-<pre>
-func makeHandler(fn func (http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- // Here we will extract the page title from the Request,
- // and call the provided handler 'fn'
- }
-}
-</pre>
-
-<p>
-The returned function is called a closure because it encloses values defined
-outside of it. In this case, the variable <code>fn</code> (the single argument
-to <code>makeHandler</code>) is enclosed by the closure. The variable
-<code>fn</code> will be one of our save, edit, or view handlers.
-</p>
-
-<p>
-Now we can take the code from <code>getTitle</code> and use it here
-(with some minor modifications):
-</p>
-
-{{code "doc/articles/wiki/final.go" `/func makeHandler/` `/^}/`}}
-
-<p>
-The closure returned by <code>makeHandler</code> is a function that takes
-an <code>http.ResponseWriter</code> and <code>http.Request</code> (in other
-words, an <code>http.HandlerFunc</code>).
-The closure extracts the <code>title</code> from the request path, and
-validates it with the <code>validPath</code> regexp. If the
-<code>title</code> is invalid, an error will be written to the
-<code>ResponseWriter</code> using the <code>http.NotFound</code> function.
-If the <code>title</code> is valid, the enclosed handler function
-<code>fn</code> will be called with the <code>ResponseWriter</code>,
-<code>Request</code>, and <code>title</code> as arguments.
-</p>
-
-<p>
-Now we can wrap the handler functions with <code>makeHandler</code> in
-<code>main</code>, before they are registered with the <code>http</code>
-package:
-</p>
-
-{{code "doc/articles/wiki/final.go" `/func main/` `/^}/`}}
-
-<p>
-Finally we remove the calls to <code>getTitle</code> from the handler functions,
-making them much simpler:
-</p>
-
-{{code "doc/articles/wiki/final.go" `/^func viewHandler/` `/^}/`}}
-{{code "doc/articles/wiki/final.go" `/^func editHandler/` `/^}/`}}
-{{code "doc/articles/wiki/final.go" `/^func saveHandler/` `/^}/`}}
-
-<h2>Try it out!</h2>
-
-<p>
-<a href="final.go">Click here to view the final code listing.</a>
-</p>
-
-<p>
-Recompile the code, and run the app:
-</p>
-
-<pre>
-$ go build wiki.go
-$ ./wiki
-</pre>
-
-<p>
-Visiting <a href="http://localhost:8080/view/ANewPage">http://localhost:8080/view/ANewPage</a>
-should present you with the page edit form. You should then be able to
-enter some text, click 'Save', and be redirected to the newly created page.
-</p>
-
-<h2>Other tasks</h2>
-
-<p>
-Here are some simple tasks you might want to tackle on your own:
-</p>
-
-<ul>
-<li>Store templates in <code>tmpl/</code> and page data in <code>data/</code>.
-<li>Add a handler to make the web root redirect to
- <code>/view/FrontPage</code>.</li>
-<li>Spruce up the page templates by making them valid HTML and adding some
- CSS rules.</li>
-<li>Implement inter-page linking by converting instances of
- <code>[PageName]</code> to <br>
- <code>&lt;a href="/view/PageName"&gt;PageName&lt;/a&gt;</code>.
- (hint: you could use <code>regexp.ReplaceAllFunc</code> to do this)
- </li>
-</ul>
diff --git a/doc/articles/wiki/notemplate.go b/doc/articles/wiki/notemplate.go
deleted file mode 100644
index 4b358f298a..0000000000
--- a/doc/articles/wiki/notemplate.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "fmt"
- "io/ioutil"
- "log"
- "net/http"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/view/"):]
- p, _ := loadPage(title)
- fmt.Fprintf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/edit/"):]
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- fmt.Fprintf(w, "<h1>Editing %s</h1>"+
- "<form action=\"/save/%s\" method=\"POST\">"+
- "<textarea name=\"body\">%s</textarea><br>"+
- "<input type=\"submit\" value=\"Save\">"+
- "</form>",
- p.Title, p.Title, p.Body)
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- http.HandleFunc("/edit/", editHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/part1-noerror.go b/doc/articles/wiki/part1-noerror.go
deleted file mode 100644
index 913c6dce2e..0000000000
--- a/doc/articles/wiki/part1-noerror.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "fmt"
- "io/ioutil"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) *Page {
- filename := title + ".txt"
- body, _ := ioutil.ReadFile(filename)
- return &Page{Title: title, Body: body}
-}
-
-func main() {
- p1 := &Page{Title: "TestPage", Body: []byte("This is a sample page.")}
- p1.save()
- p2 := loadPage("TestPage")
- fmt.Println(string(p2.Body))
-}
diff --git a/doc/articles/wiki/part1.go b/doc/articles/wiki/part1.go
deleted file mode 100644
index 2ff1abd281..0000000000
--- a/doc/articles/wiki/part1.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "fmt"
- "io/ioutil"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func main() {
- p1 := &Page{Title: "TestPage", Body: []byte("This is a sample Page.")}
- p1.save()
- p2, _ := loadPage("TestPage")
- fmt.Println(string(p2.Body))
-}
diff --git a/doc/articles/wiki/part2.go b/doc/articles/wiki/part2.go
deleted file mode 100644
index db92f4c710..0000000000
--- a/doc/articles/wiki/part2.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "fmt"
- "io/ioutil"
- "log"
- "net/http"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/view/"):]
- p, _ := loadPage(title)
- fmt.Fprintf(w, "<h1>%s</h1><div>%s</div>", p.Title, p.Body)
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/part3-errorhandling.go b/doc/articles/wiki/part3-errorhandling.go
deleted file mode 100644
index 2c8b42d05a..0000000000
--- a/doc/articles/wiki/part3-errorhandling.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
- t, _ := template.ParseFiles(tmpl + ".html")
- t.Execute(w, p)
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/view/"):]
- p, err := loadPage(title)
- if err != nil {
- http.Redirect(w, r, "/edit/"+title, http.StatusFound)
- return
- }
- renderTemplate(w, "view", p)
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/edit/"):]
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- renderTemplate(w, "edit", p)
-}
-
-func saveHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/save/"):]
- body := r.FormValue("body")
- p := &Page{Title: title, Body: []byte(body)}
- err := p.save()
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- http.Redirect(w, r, "/view/"+title, http.StatusFound)
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- http.HandleFunc("/edit/", editHandler)
- http.HandleFunc("/save/", saveHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/part3.go b/doc/articles/wiki/part3.go
deleted file mode 100644
index 437ea336cb..0000000000
--- a/doc/articles/wiki/part3.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2010 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.
-
-// +build ignore
-
-package main
-
-import (
- "html/template"
- "io/ioutil"
- "log"
- "net/http"
-)
-
-type Page struct {
- Title string
- Body []byte
-}
-
-func (p *Page) save() error {
- filename := p.Title + ".txt"
- return ioutil.WriteFile(filename, p.Body, 0600)
-}
-
-func loadPage(title string) (*Page, error) {
- filename := title + ".txt"
- body, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return &Page{Title: title, Body: body}, nil
-}
-
-func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
- t, _ := template.ParseFiles(tmpl + ".html")
- t.Execute(w, p)
-}
-
-func viewHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/view/"):]
- p, _ := loadPage(title)
- renderTemplate(w, "view", p)
-}
-
-func editHandler(w http.ResponseWriter, r *http.Request) {
- title := r.URL.Path[len("/edit/"):]
- p, err := loadPage(title)
- if err != nil {
- p = &Page{Title: title}
- }
- renderTemplate(w, "edit", p)
-}
-
-func main() {
- http.HandleFunc("/view/", viewHandler)
- http.HandleFunc("/edit/", editHandler)
- //http.HandleFunc("/save/", saveHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
-}
diff --git a/doc/articles/wiki/test_Test.txt.good b/doc/articles/wiki/test_Test.txt.good
deleted file mode 100644
index f0eec86f61..0000000000
--- a/doc/articles/wiki/test_Test.txt.good
+++ /dev/null
@@ -1 +0,0 @@
-some content \ No newline at end of file
diff --git a/doc/articles/wiki/test_edit.good b/doc/articles/wiki/test_edit.good
deleted file mode 100644
index 36c6dbb732..0000000000
--- a/doc/articles/wiki/test_edit.good
+++ /dev/null
@@ -1,6 +0,0 @@
-<h1>Editing Test</h1>
-
-<form action="/save/Test" method="POST">
-<div><textarea name="body" rows="20" cols="80"></textarea></div>
-<div><input type="submit" value="Save"></div>
-</form>
diff --git a/doc/articles/wiki/test_view.good b/doc/articles/wiki/test_view.good
deleted file mode 100644
index 07e8edb22e..0000000000
--- a/doc/articles/wiki/test_view.good
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>Test</h1>
-
-<p>[<a href="/edit/Test">edit</a>]</p>
-
-<div>some content</div>
diff --git a/doc/articles/wiki/view.html b/doc/articles/wiki/view.html
deleted file mode 100644
index b1e87efe80..0000000000
--- a/doc/articles/wiki/view.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>{{.Title}}</h1>
-
-<p>[<a href="/edit/{{.Title}}">edit</a>]</p>
-
-<div>{{printf "%s" .Body}}</div>
diff --git a/doc/articles/wiki/wiki_test.go b/doc/articles/wiki/wiki_test.go
deleted file mode 100644
index 1d976fd77e..0000000000
--- a/doc/articles/wiki/wiki_test.go
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright 2019 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.
-
-package main_test
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "net/http"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- "testing"
-)
-
-func TestSnippetsCompile(t *testing.T) {
- if testing.Short() {
- t.Skip("skipping slow builds in short mode")
- }
-
- goFiles, err := filepath.Glob("*.go")
- if err != nil {
- t.Fatal(err)
- }
-
- for _, f := range goFiles {
- if strings.HasSuffix(f, "_test.go") {
- continue
- }
- f := f
- t.Run(f, func(t *testing.T) {
- t.Parallel()
-
- cmd := exec.Command("go", "build", "-o", os.DevNull, f)
- out, err := cmd.CombinedOutput()
- if err != nil {
- t.Errorf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, out)
- }
- })
- }
-}
-
-func TestWikiServer(t *testing.T) {
- must := func(err error) {
- if err != nil {
- t.Helper()
- t.Fatal(err)
- }
- }
-
- dir, err := ioutil.TempDir("", t.Name())
- must(err)
- defer os.RemoveAll(dir)
-
- // We're testing a walkthrough example of how to write a server.
- //
- // That server hard-codes a port number to make the walkthrough simpler, but
- // we can't assume that the hard-coded port is available on an arbitrary
- // builder. So we'll patch out the hard-coded port, and replace it with a
- // function that writes the server's address to stdout
- // so that we can read it and know where to send the test requests.
-
- finalGo, err := ioutil.ReadFile("final.go")
- must(err)
- const patchOld = `log.Fatal(http.ListenAndServe(":8080", nil))`
- patched := bytes.ReplaceAll(finalGo, []byte(patchOld), []byte(`log.Fatal(serve())`))
- if bytes.Equal(patched, finalGo) {
- t.Fatalf("Can't patch final.go: %q not found.", patchOld)
- }
- must(ioutil.WriteFile(filepath.Join(dir, "final_patched.go"), patched, 0644))
-
- // Build the server binary from the patched sources.
- // The 'go' command requires that they all be in the same directory.
- // final_test.go provides the implemtation for our serve function.
- must(copyFile(filepath.Join(dir, "final_srv.go"), "final_test.go"))
- cmd := exec.Command("go", "build",
- "-o", filepath.Join(dir, "final.exe"),
- filepath.Join(dir, "final_patched.go"),
- filepath.Join(dir, "final_srv.go"))
- out, err := cmd.CombinedOutput()
- if err != nil {
- t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, out)
- }
-
- // Run the server in our temporary directory so that it can
- // write its content there. It also needs a couple of template files,
- // and looks for them in the same directory.
- must(copyFile(filepath.Join(dir, "edit.html"), "edit.html"))
- must(copyFile(filepath.Join(dir, "view.html"), "view.html"))
- cmd = exec.Command(filepath.Join(dir, "final.exe"))
- cmd.Dir = dir
- stderr := bytes.NewBuffer(nil)
- cmd.Stderr = stderr
- stdout, err := cmd.StdoutPipe()
- must(err)
- must(cmd.Start())
-
- defer func() {
- cmd.Process.Kill()
- err := cmd.Wait()
- if stderr.Len() > 0 {
- t.Logf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, stderr)
- }
- }()
-
- var addr string
- if _, err := fmt.Fscanln(stdout, &addr); err != nil || addr == "" {
- t.Fatalf("Failed to read server address: %v", err)
- }
-
- // The server is up and has told us its address.
- // Make sure that its HTTP API works as described in the article.
-
- r, err := http.Get(fmt.Sprintf("http://%s/edit/Test", addr))
- must(err)
- responseMustMatchFile(t, r, "test_edit.good")
-
- r, err = http.Post(fmt.Sprintf("http://%s/save/Test", addr),
- "application/x-www-form-urlencoded",
- strings.NewReader("body=some%20content"))
- must(err)
- responseMustMatchFile(t, r, "test_view.good")
-
- gotTxt, err := ioutil.ReadFile(filepath.Join(dir, "Test.txt"))
- must(err)
- wantTxt, err := ioutil.ReadFile("test_Test.txt.good")
- must(err)
- if !bytes.Equal(wantTxt, gotTxt) {
- t.Fatalf("Test.txt differs from expected after posting to /save.\ngot:\n%s\nwant:\n%s", gotTxt, wantTxt)
- }
-
- r, err = http.Get(fmt.Sprintf("http://%s/view/Test", addr))
- must(err)
- responseMustMatchFile(t, r, "test_view.good")
-}
-
-func responseMustMatchFile(t *testing.T, r *http.Response, filename string) {
- t.Helper()
-
- defer r.Body.Close()
- body, err := ioutil.ReadAll(r.Body)
- if err != nil {
- t.Fatal(err)
- }
-
- wantBody, err := ioutil.ReadFile(filename)
- if err != nil {
- t.Fatal(err)
- }
-
- if !bytes.Equal(body, wantBody) {
- t.Fatalf("%v: body does not match %s.\ngot:\n%s\nwant:\n%s", r.Request.URL, filename, body, wantBody)
- }
-}
-
-func copyFile(dst, src string) error {
- buf, err := ioutil.ReadFile(src)
- if err != nil {
- return err
- }
- return ioutil.WriteFile(dst, buf, 0644)
-}
diff --git a/doc/cmd.html b/doc/cmd.html
deleted file mode 100644
index c3bd918144..0000000000
--- a/doc/cmd.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<!--{
- "Title": "Command Documentation",
- "Path": "/doc/cmd"
-}-->
-
-<p>
-There is a suite of programs to build and process Go source code.
-Instead of being run directly, programs in the suite are usually invoked
-by the <a href="/cmd/go/">go</a> program.
-</p>
-
-<p>
-The most common way to run these programs is as a subcommand of the go program,
-for instance as <code>go fmt</code>. Run like this, the command operates on
-complete packages of Go source code, with the go program invoking the
-underlying binary with arguments appropriate to package-level processing.
-</p>
-
-<p>
-The programs can also be run as stand-alone binaries, with unmodified arguments,
-using the go <code>tool</code> subcommand, such as <code>go tool cgo</code>.
-For most commands this is mainly useful for debugging.
-Some of the commands, such as <code>pprof</code>, are accessible only through
-the go <code>tool</code> subcommand.
-</p>
-
-<p>
-Finally the <code>fmt</code> and <code>godoc</code> commands are installed
-as regular binaries called <code>gofmt</code> and <code>godoc</code> because
-they are so often referenced.
-</p>
-
-<p>
-Click on the links for more documentation, invocation methods, and usage details.
-</p>
-
-<table class="dir">
-<tr>
-<th>Name</th>
-<th>&nbsp;&nbsp;&nbsp;&nbsp;</th>
-<th>Synopsis</th>
-</tr>
-
-<tr>
-<td><a href="/cmd/go/">go</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>
-The <code>go</code> program manages Go source code and runs the other
-commands listed here.
-See the command docs for usage
-details.
-</td>
-</tr>
-
-<tr>
-<td><a href="/cmd/cgo/">cgo</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>Cgo enables the creation of Go packages that call C code.</td>
-</tr>
-
-<tr>
-<td><a href="/cmd/cover/">cover</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>Cover is a program for creating and analyzing the coverage profiles
-generated by <code>"go test -coverprofile"</code>.</td>
-</tr>
-
-<tr>
-<td><a href="/cmd/fix/">fix</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>Fix finds Go programs that use old features of the language and libraries
-and rewrites them to use newer ones.</td>
-</tr>
-
-<tr>
-<td><a href="/cmd/gofmt/">fmt</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>Fmt formats Go packages, it is also available as an independent <a href="/cmd/gofmt/">
-gofmt</a> command with more general options.</td>
-</tr>
-
-<tr>
-<td><a href="//godoc.org/golang.org/x/tools/cmd/godoc/">godoc</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>Godoc extracts and generates documentation for Go packages.</td>
-</tr>
-
-<tr>
-<td><a href="/cmd/vet/">vet</a></td>
-<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
-<td>Vet examines Go source code and reports suspicious constructs, such as Printf
-calls whose arguments do not align with the format string.</td>
-</tr>
-
-</table>
-
-<p>
-This is an abridged list. See the <a href="/cmd/">full command reference</a>
-for documentation of the compilers and more.
-</p>
diff --git a/doc/codewalk/codewalk.css b/doc/codewalk/codewalk.css
deleted file mode 100644
index a0814e4d2d..0000000000
--- a/doc/codewalk/codewalk.css
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- Copyright 2010 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.
-*/
-
-#codewalk-main {
- text-align: left;
- width: 100%;
- overflow: auto;
-}
-
-#code-display {
- border: 0;
- width: 100%;
-}
-
-.setting {
- font-size: 8pt;
- color: #888888;
- padding: 5px;
-}
-
-.hotkey {
- text-decoration: underline;
-}
-
-/* Style for Comments (the left-hand column) */
-
-#comment-column {
- margin: 0pt;
- width: 30%;
-}
-
-#comment-column.right {
- float: right;
-}
-
-#comment-column.left {
- float: left;
-}
-
-#comment-area {
- overflow-x: hidden;
- overflow-y: auto;
-}
-
-.comment {
- cursor: pointer;
- font-size: 16px;
- border: 2px solid #ba9836;
- margin-bottom: 10px;
- margin-right: 10px; /* yes, for both .left and .right */
-}
-
-.comment:last-child {
- margin-bottom: 0px;
-}
-
-.right .comment {
- margin-left: 10px;
-}
-
-.right .comment.first {
-}
-
-.right .comment.last {
-}
-
-.left .comment.first {
-}
-
-.left .comment.last {
-}
-
-.comment.selected {
- border-color: #99b2cb;
-}
-
-.right .comment.selected {
- border-left-width: 12px;
- margin-left: 0px;
-}
-
-.left .comment.selected {
- border-right-width: 12px;
- margin-right: 0px;
-}
-
-.comment-link {
- display: none;
-}
-
-.comment-title {
- font-size: small;
- font-weight: bold;
- background-color: #fffff0;
- padding-right: 10px;
- padding-left: 10px;
- padding-top: 5px;
- padding-bottom: 5px;
-}
-
-.right .comment-title {
-}
-
-.left .comment-title {
-}
-
-.comment.selected .comment-title {
- background-color: #f8f8ff;
-}
-
-.comment-text {
- overflow: auto;
- padding-left: 10px;
- padding-right: 10px;
- padding-top: 10px;
- padding-bottom: 5px;
- font-size: small;
- line-height: 1.3em;
-}
-
-.comment-text p {
- margin-top: 0em;
- margin-bottom: 0.5em;
-}
-
-.comment-text p:last-child {
- margin-bottom: 0em;
-}
-
-.file-name {
- font-size: x-small;
- padding-top: 0px;
- padding-bottom: 5px;
-}
-
-.hidden-filepaths .file-name {
- display: none;
-}
-
-.path-dir {
- color: #555;
-}
-
-.path-file {
- color: #555;
-}
-
-
-/* Style for Code (the right-hand column) */
-
-/* Wrapper for the code column to make widths get calculated correctly */
-#code-column {
- display: block;
- position: relative;
- margin: 0pt;
- width: 70%;
-}
-
-#code-column.left {
- float: left;
-}
-
-#code-column.right {
- float: right;
-}
-
-#code-area {
- background-color: #f8f8ff;
- border: 2px solid #99b2cb;
- padding: 5px;
-}
-
-.left #code-area {
- margin-right: -1px;
-}
-
-.right #code-area {
- margin-left: -1px;
-}
-
-#code-header {
- margin-bottom: 5px;
-}
-
-#code {
- background-color: white;
-}
-
-code {
- font-size: 100%;
-}
-
-.codewalkhighlight {
- font-weight: bold;
- background-color: #f8f8ff;
-}
-
-#code-display {
- margin-top: 0px;
- margin-bottom: 0px;
-}
-
-#sizer {
- position: absolute;
- cursor: col-resize;
- left: 0px;
- top: 0px;
- width: 8px;
-}
-
-/* Style for options (bottom strip) */
-
-#code-options {
- display: none;
-}
-
-#code-options > span {
- padding-right: 20px;
-}
-
-#code-options .selected {
- border-bottom: 1px dotted;
-}
-
-#comment-options {
- text-align: center;
-}
-
-div#content {
- padding-bottom: 0em;
-}
diff --git a/doc/codewalk/codewalk.js b/doc/codewalk/codewalk.js
deleted file mode 100644
index 4f59a8fc89..0000000000
--- a/doc/codewalk/codewalk.js
+++ /dev/null
@@ -1,305 +0,0 @@
-// Copyright 2010 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.
-
-/**
- * A class to hold information about the Codewalk Viewer.
- * @param {jQuery} context The top element in whose context the viewer should
- * operate. It will not touch any elements above this one.
- * @constructor
- */
- var CodewalkViewer = function(context) {
- this.context = context;
-
- /**
- * The div that contains all of the comments and their controls.
- */
- this.commentColumn = this.context.find('#comment-column');
-
- /**
- * The div that contains the comments proper.
- */
- this.commentArea = this.context.find('#comment-area');
-
- /**
- * The div that wraps the iframe with the code, as well as the drop down menu
- * listing the different files.
- * @type {jQuery}
- */
- this.codeColumn = this.context.find('#code-column');
-
- /**
- * The div that contains the code but excludes the options strip.
- * @type {jQuery}
- */
- this.codeArea = this.context.find('#code-area');
-
- /**
- * The iframe that holds the code (from Sourcerer).
- * @type {jQuery}
- */
- this.codeDisplay = this.context.find('#code-display');
-
- /**
- * The overlaid div used as a grab handle for sizing the code/comment panes.
- * @type {jQuery}
- */
- this.sizer = this.context.find('#sizer');
-
- /**
- * The full-screen overlay that ensures we don't lose track of the mouse
- * while dragging.
- * @type {jQuery}
- */
- this.overlay = this.context.find('#overlay');
-
- /**
- * The hidden input field that we use to hold the focus so that we can detect
- * shortcut keypresses.
- * @type {jQuery}
- */
- this.shortcutInput = this.context.find('#shortcut-input');
-
- /**
- * The last comment that was selected.
- * @type {jQuery}
- */
- this.lastSelected = null;
-};
-
-/**
- * Minimum width of the comments or code pane, in pixels.
- * @type {number}
- */
-CodewalkViewer.MIN_PANE_WIDTH = 200;
-
-/**
- * Navigate the code iframe to the given url and update the code popout link.
- * @param {string} url The target URL.
- * @param {Object} opt_window Window dependency injection for testing only.
- */
-CodewalkViewer.prototype.navigateToCode = function(url, opt_window) {
- if (!opt_window) opt_window = window;
- // Each iframe is represented by two distinct objects in the DOM: an iframe
- // object and a window object. These do not expose the same capabilities.
- // Here we need to get the window representation to get the location member,
- // so we access it directly through window[] since jQuery returns the iframe
- // representation.
- // We replace location rather than set so as not to create a history for code
- // navigation.
- opt_window['code-display'].location.replace(url);
- var k = url.indexOf('&');
- if (k != -1) url = url.slice(0, k);
- k = url.indexOf('fileprint=');
- if (k != -1) url = url.slice(k+10, url.length);
- this.context.find('#code-popout-link').attr('href', url);
-};
-
-/**
- * Selects the first comment from the list and forces a refresh of the code
- * view.
- */
-CodewalkViewer.prototype.selectFirstComment = function() {
- // TODO(rsc): handle case where there are no comments
- var firstSourcererLink = this.context.find('.comment:first');
- this.changeSelectedComment(firstSourcererLink);
-};
-
-/**
- * Sets the target on all links nested inside comments to be _blank.
- */
-CodewalkViewer.prototype.targetCommentLinksAtBlank = function() {
- this.context.find('.comment a[href], #description a[href]').each(function() {
- if (!this.target) this.target = '_blank';
- });
-};
-
-/**
- * Installs event handlers for all the events we care about.
- */
-CodewalkViewer.prototype.installEventHandlers = function() {
- var self = this;
-
- this.context.find('.comment')
- .click(function(event) {
- if (jQuery(event.target).is('a[href]')) return true;
- self.changeSelectedComment(jQuery(this));
- return false;
- });
-
- this.context.find('#code-selector')
- .change(function() {self.navigateToCode(jQuery(this).val());});
-
- this.context.find('#description-table .quote-feet.setting')
- .click(function() {self.toggleDescription(jQuery(this)); return false;});
-
- this.sizer
- .mousedown(function(ev) {self.startSizerDrag(ev); return false;});
- this.overlay
- .mouseup(function(ev) {self.endSizerDrag(ev); return false;})
- .mousemove(function(ev) {self.handleSizerDrag(ev); return false;});
-
- this.context.find('#prev-comment')
- .click(function() {
- self.changeSelectedComment(self.lastSelected.prev()); return false;
- });
-
- this.context.find('#next-comment')
- .click(function() {
- self.changeSelectedComment(self.lastSelected.next()); return false;
- });
-
- // Workaround for Firefox 2 and 3, which steal focus from the main document
- // whenever the iframe content is (re)loaded. The input field is not shown,
- // but is a way for us to bring focus back to a place where we can detect
- // keypresses.
- this.context.find('#code-display')
- .load(function(ev) {self.shortcutInput.focus();});
-
- jQuery(document).keypress(function(ev) {
- switch(ev.which) {
- case 110: // 'n'
- self.changeSelectedComment(self.lastSelected.next());
- return false;
- case 112: // 'p'
- self.changeSelectedComment(self.lastSelected.prev());
- return false;
- default: // ignore
- }
- });
-
- window.onresize = function() {self.updateHeight();};
-};
-
-/**
- * Starts dragging the pane sizer.
- * @param {Object} ev The mousedown event that started us dragging.
- */
-CodewalkViewer.prototype.startSizerDrag = function(ev) {
- this.initialCodeWidth = this.codeColumn.width();
- this.initialCommentsWidth = this.commentColumn.width();
- this.initialMouseX = ev.pageX;
- this.overlay.show();
-};
-
-/**
- * Handles dragging the pane sizer.
- * @param {Object} ev The mousemove event updating dragging position.
- */
-CodewalkViewer.prototype.handleSizerDrag = function(ev) {
- var delta = ev.pageX - this.initialMouseX;
- if (this.codeColumn.is('.right')) delta = -delta;
- var proposedCodeWidth = this.initialCodeWidth + delta;
- var proposedCommentWidth = this.initialCommentsWidth - delta;
- var mw = CodewalkViewer.MIN_PANE_WIDTH;
- if (proposedCodeWidth < mw) delta = mw - this.initialCodeWidth;
- if (proposedCommentWidth < mw) delta = this.initialCommentsWidth - mw;
- proposedCodeWidth = this.initialCodeWidth + delta;
- proposedCommentWidth = this.initialCommentsWidth - delta;
- // If window is too small, don't even try to resize.
- if (proposedCodeWidth < mw || proposedCommentWidth < mw) return;
- this.codeColumn.width(proposedCodeWidth);
- this.commentColumn.width(proposedCommentWidth);
- this.options.codeWidth = parseInt(
- this.codeColumn.width() /
- (this.codeColumn.width() + this.commentColumn.width()) * 100);
- this.context.find('#code-column-width').text(this.options.codeWidth + '%');
-};
-
-/**
- * Ends dragging the pane sizer.
- * @param {Object} ev The mouseup event that caused us to stop dragging.
- */
-CodewalkViewer.prototype.endSizerDrag = function(ev) {
- this.overlay.hide();
- this.updateHeight();
-};
-
-/**
- * Toggles the Codewalk description between being shown and hidden.
- * @param {jQuery} target The target that was clicked to trigger this function.
- */
-CodewalkViewer.prototype.toggleDescription = function(target) {
- var description = this.context.find('#description');
- description.toggle();
- target.find('span').text(description.is(':hidden') ? 'show' : 'hide');
- this.updateHeight();
-};
-
-/**
- * Changes the side of the window on which the code is shown and saves the
- * setting in a cookie.
- * @param {string?} codeSide The side on which the code should be, either
- * 'left' or 'right'.
- */
-CodewalkViewer.prototype.changeCodeSide = function(codeSide) {
- var commentSide = codeSide == 'left' ? 'right' : 'left';
- this.context.find('#set-code-' + codeSide).addClass('selected');
- this.context.find('#set-code-' + commentSide).removeClass('selected');
- // Remove previous side class and add new one.
- this.codeColumn.addClass(codeSide).removeClass(commentSide);
- this.commentColumn.addClass(commentSide).removeClass(codeSide);
- this.sizer.css(codeSide, 'auto').css(commentSide, 0);
- this.options.codeSide = codeSide;
-};
-
-/**
- * Adds selected class to newly selected comment, removes selected style from
- * previously selected comment, changes drop down options so that the correct
- * file is selected, and updates the code popout link.
- * @param {jQuery} target The target that was clicked to trigger this function.
- */
-CodewalkViewer.prototype.changeSelectedComment = function(target) {
- var currentFile = target.find('.comment-link').attr('href');
- if (!currentFile) return;
-
- if (!(this.lastSelected && this.lastSelected.get(0) === target.get(0))) {
- if (this.lastSelected) this.lastSelected.removeClass('selected');
- target.addClass('selected');
- this.lastSelected = target;
- var targetTop = target.position().top;
- var parentTop = target.parent().position().top;
- if (targetTop + target.height() > parentTop + target.parent().height() ||
- targetTop < parentTop) {
- var delta = targetTop - parentTop;
- target.parent().animate(
- {'scrollTop': target.parent().scrollTop() + delta},
- Math.max(delta / 2, 200), 'swing');
- }
- var fname = currentFile.match(/(?:select=|fileprint=)\/[^&]+/)[0];
- fname = fname.slice(fname.indexOf('=')+2, fname.length);
- this.context.find('#code-selector').val(fname);
- this.context.find('#prev-comment').toggleClass(
- 'disabled', !target.prev().length);
- this.context.find('#next-comment').toggleClass(
- 'disabled', !target.next().length);
- }
-
- // Force original file even if user hasn't changed comments since they may
- // have navigated away from it within the iframe without us knowing.
- this.navigateToCode(currentFile);
-};
-
-/**
- * Updates the viewer by changing the height of the comments and code so that
- * they fit within the height of the window. The function is typically called
- * after the user changes the window size.
- */
-CodewalkViewer.prototype.updateHeight = function() {
- var windowHeight = jQuery(window).height() - 5 // GOK
- var areaHeight = windowHeight - this.codeArea.offset().top
- var footerHeight = this.context.find('#footer').outerHeight(true)
- this.commentArea.height(areaHeight - footerHeight - this.context.find('#comment-options').outerHeight(true))
- var codeHeight = areaHeight - footerHeight - 15 // GOK
- this.codeArea.height(codeHeight)
- this.codeDisplay.height(codeHeight - this.codeDisplay.offset().top + this.codeArea.offset().top);
- this.sizer.height(codeHeight);
-};
-
-window.initFuncs.push(function() {
- var viewer = new CodewalkViewer(jQuery('#codewalk-main'));
- viewer.selectFirstComment();
- viewer.targetCommentLinksAtBlank();
- viewer.installEventHandlers();
- viewer.updateHeight();
-});
diff --git a/doc/codewalk/codewalk.xml b/doc/codewalk/codewalk.xml
deleted file mode 100644
index 34e6e91938..0000000000
--- a/doc/codewalk/codewalk.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<codewalk title="How to Write a Codewalk">
-
-<step title="Introduction" src="doc/codewalk/codewalk.xml">
- A codewalk is a guided tour through a piece of code.
- It consists of a sequence of steps, each typically explaining
- a highlighted section of code.
- <br/><br/>
-
- The <a href="/cmd/godoc">godoc</a> web server translates
- an XML file like the one in the main window pane into the HTML
- page that you're viewing now.
- <br/><br/>
-
- The codewalk with URL path <code>/doc/codewalk/</code><i>name</i>
- is loaded from the input file <code>$GOROOT/doc/codewalk/</code><i>name</i><code>.xml</code>.
- <br/><br/>
-
- This codewalk explains how to write a codewalk by examining
- its own source code,
- <code><a href="/doc/codewalk/codewalk.xml">$GOROOT/doc/codewalk/codewalk.xml</a></code>,
- shown in the main window pane to the left.
-</step>
-
-<step title="Title" src="doc/codewalk/codewalk.xml:/title=/">
- The codewalk input file is an XML file containing a single
- <code>&lt;codewalk&gt;</code> element.
- That element's <code>title</code> attribute gives the title
- that is used both on the codewalk page and in the codewalk list.
-</step>
-
-<step title="Steps" src="doc/codewalk/codewalk.xml:/&lt;step/,/step&gt;/">
- Each step in the codewalk is a <code>&lt;step&gt;</code> element
- nested inside the main <code>&lt;codewalk&gt;</code>.
- The step element's <code>title</code> attribute gives the step's title,
- which is shown in a shaded bar above the main step text.
- The element's <code>src</code> attribute specifies the source
- code to show in the main window pane and, optionally, a range of
- lines to highlight.
- <br/><br/>
-
- The first step in this codewalk does not highlight any lines:
- its <code>src</code> is just a file name.
-</step>
-
-<step title="Specifying a source line" src='doc/codewalk/codewalk.xml:/title="Title"/'>
- The most complex part of the codewalk specification is
- saying what lines to highlight.
- Instead of ordinary line numbers,
- the codewalk uses an address syntax that makes it possible
- to describe the match by its content.
- As the file gets edited, this descriptive address has a better
- chance to continue to refer to the right section of the file.
- <br/><br/>
-
- To specify a source line, use a <code>src</code> attribute of the form
- <i>filename</i><code>:</code><i>address</i>,
- where <i>address</i> is an address in the syntax used by the text editors <i>sam</i> and <i>acme</i>.
- <br/><br/>
-
- The simplest address is a single regular expression.
- The highlighted line in the main window pane shows that the
- address for the &ldquo;Title&rdquo; step was <code>/title=/</code>,
- which matches the first instance of that <a href="/pkg/regexp">regular expression</a> (<code>title=</code>) in the file.
-</step>
-
-<step title="Specifying a source range" src='doc/codewalk/codewalk.xml:/title="Steps"/'>
- To highlight a range of source lines, the simplest address to use is
- a pair of regular expressions
- <code>/</code><i>regexp1</i><code>/,/</code><i>regexp2</i><code>/</code>.
- The highlight begins with the line containing the first match for <i>regexp1</i>
- and ends with the line containing the first match for <i>regexp2</i>
- after the end of the match for <i>regexp1</i>.
- Ignoring the HTML quoting,
- The line containing the first match for <i>regexp1</i> will be the first one highlighted,
- and the line containing the first match for <i>regexp2</i>.
- <br/><br/>
-
- The address <code>/&lt;step/,/step&gt;/</code> looks for the first instance of
- <code>&lt;step</code> in the file, and then starting after that point,
- looks for the first instance of <code>step&gt;</code>.
- (Click on the &ldquo;Steps&rdquo; step above to see the highlight in action.)
- Note that the <code>&lt;</code> and <code>&gt;</code> had to be written
- using XML escapes in order to be valid XML.
-</step>
-
-<step title="Advanced addressing" src="doc/codewalk/codewalk.xml:/Advanced/,/step&gt;/">
- The <code>/</code><i>regexp</i><code>/</code>
- and <code>/</code><i>regexp1</i><code>/,/</code><i>regexp2</i><code>/</code>
- forms suffice for most highlighting.
- <br/><br/>
-
- The full address syntax is summarized in this table
- (an excerpt of Table II from
- <a href="https://9p.io/sys/doc/sam/sam.html">The text editor <code>sam</code></a>):
- <br/><br/>
-
- <table>
- <tr><td colspan="2"><b>Simple addresses</b></td></tr>
- <tr><td><code>#</code><i>n</i></td>
- <td>The empty string after character <i>n</i></td></tr>
- <tr><td><i>n</i></td>
- <td>Line <i>n</i></td></tr>
- <tr><td><code>/</code><i>regexp</i><code>/</code></td>
- <td>The first following match of the regular expression</td></tr>
- <!-- not supported (yet?)
- <tr><td><code>–/</code><i>regexp</i><code>/</code></td>
- <td>The first previous match of the regular expression</td></tr>
- -->
- <tr><td><code>$</code></td>
- <td>The null string at the end of the file</td></tr>
-
- <tr><td colspan="2"><b>Compound addresses</b></td></tr>
- <tr><td><i>a1</i><code>+</code><i>a2</i></td>
- <td>The address <i>a2</i> evaluated starting at the right of <i>a1</i></td></tr>
- <tr><td><i>a1</i><code>-</code><i>a2</i></td>
- <td>The address <i>a2</i> evaluated in the reverse direction starting at the left of <i>a1</i></td></tr>
- <tr><td><i>a1</i><code>,</code><i>a2</i></td>
- <td>From the left of <i>a1</i> to the right of <i>a2</i> (default <code>0,$</code>).</td></tr>
- </table>
-</step>
-
-
-
-</codewalk>
diff --git a/doc/codewalk/codewalk_test.go b/doc/codewalk/codewalk_test.go
deleted file mode 100644
index 31f078ac26..0000000000
--- a/doc/codewalk/codewalk_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2019 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.
-
-package main_test
-
-import (
- "bytes"
- "os"
- "os/exec"
- "strings"
- "testing"
-)
-
-// TestMarkov tests the code dependency of markov.xml.
-func TestMarkov(t *testing.T) {
- cmd := exec.Command("go", "run", "markov.go")
- cmd.Stdin = strings.NewReader("foo")
- cmd.Stderr = bytes.NewBuffer(nil)
- out, err := cmd.Output()
- if err != nil {
- t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr)
- }
-
- if !bytes.Equal(out, []byte("foo\n")) {
- t.Fatalf(`%s with input "foo" did not output "foo":\n%s`, strings.Join(cmd.Args, " "), out)
- }
-}
-
-// TestPig tests the code dependency of functions.xml.
-func TestPig(t *testing.T) {
- cmd := exec.Command("go", "run", "pig.go")
- cmd.Stderr = bytes.NewBuffer(nil)
- out, err := cmd.Output()
- if err != nil {
- t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr)
- }
-
- const want = "Wins, losses staying at k = 100: 210/990 (21.2%), 780/990 (78.8%)\n"
- if !bytes.Contains(out, []byte(want)) {
- t.Fatalf(`%s: unexpected output\ngot:\n%s\nwant output containing:\n%s`, strings.Join(cmd.Args, " "), out, want)
- }
-}
-
-// TestURLPoll tests the code dependency of sharemem.xml.
-func TestURLPoll(t *testing.T) {
- cmd := exec.Command("go", "build", "-o", os.DevNull, "urlpoll.go")
- out, err := cmd.CombinedOutput()
- if err != nil {
- t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, out)
- }
-}
diff --git a/doc/codewalk/functions.xml b/doc/codewalk/functions.xml
deleted file mode 100644
index db518dcc06..0000000000
--- a/doc/codewalk/functions.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<codewalk title="First-Class Functions in Go">
-
-<step title="Introduction" src="doc/codewalk/pig.go">
- Go supports first class functions, higher-order functions, user-defined
- function types, function literals, closures, and multiple return values.
- <br/><br/>
-
- This rich feature set supports a functional programming style in a strongly
- typed language.
- <br/><br/>
-
- In this codewalk we will look at a simple program that simulates a dice game
- called <a href="http://en.wikipedia.org/wiki/Pig_(dice)">Pig</a> and evaluates
- basic strategies.
-</step>
-
-<step title="Game overview" src="doc/codewalk/pig.go:/\/\/ A score/,/thisTurn int\n}/">
- Pig is a two-player game played with a 6-sided die. Each turn, you may roll or stay.
- <ul>
- <li> If you roll a 1, you lose all points for your turn and play passes to
- your opponent. Any other roll adds its value to your turn score. </li>
- <li> If you stay, your turn score is added to your total score, and play passes
- to your opponent. </li>
- </ul>
-
- The first person to reach 100 total points wins.
- <br/><br/>
-
- The <code>score</code> type stores the scores of the current and opposing
- players, in addition to the points accumulated during the current turn.
-</step>
-
-<step title="User-defined function types" src="doc/codewalk/pig.go:/\/\/ An action/,/bool\)/">
- In Go, functions can be passed around just like any other value. A function's
- type signature describes the types of its arguments and return values.
- <br/><br/>
-
- The <code>action</code> type is a function that takes a <code>score</code>
- and returns the resulting <code>score</code> and whether the current turn is
- over.
- <br/><br/>
-
- If the turn is over, the <code>player</code> and <code>opponent</code> fields
- in the resulting <code>score</code> should be swapped, as it is now the other player's
- turn.
-</step>
-
-<step title="Multiple return values" src="doc/codewalk/pig.go:/\/\/ roll returns/,/true\n}/">
- Go functions can return multiple values.
- <br/><br/>
-
- The functions <code>roll</code> and <code>stay</code> each return a pair of
- values. They also match the <code>action</code> type signature. These
- <code>action</code> functions define the rules of Pig.
-</step>
-
-<step title="Higher-order functions" src="doc/codewalk/pig.go:/\/\/ A strategy/,/action\n/">
- A function can use other functions as arguments and return values.
- <br/><br/>
-
- A <code>strategy</code> is a function that takes a <code>score</code> as input
- and returns an <code>action</code> to perform. <br/>
- (Remember, an <code>action</code> is itself a function.)
-</step>
-
-<step title="Function literals and closures" src="doc/codewalk/pig.go:/return func/,/return roll\n\t}/">
- Anonymous functions can be declared in Go, as in this example. Function
- literals are closures: they inherit the scope of the function in which they
- are declared.
- <br/><br/>
-
- One basic strategy in Pig is to continue rolling until you have accumulated at
- least k points in a turn, and then stay. The argument <code>k</code> is
- enclosed by this function literal, which matches the <code>strategy</code> type
- signature.
-</step>
-
-<step title="Simulating games" src="doc/codewalk/pig.go:/\/\/ play/,/currentPlayer\n}/">
- We simulate a game of Pig by calling an <code>action</code> to update the
- <code>score</code> until one player reaches 100 points. Each
- <code>action</code> is selected by calling the <code>strategy</code> function
- associated with the current player.
-</step>
-
-<step title="Simulating a tournament" src="doc/codewalk/pig.go:/\/\/ roundRobin/,/gamesPerStrategy\n}/">
- The <code>roundRobin</code> function simulates a tournament and tallies wins.
- Each strategy plays each other strategy <code>gamesPerSeries</code> times.
-</step>
-
-<step title="Variadic function declarations" src="doc/codewalk/pig.go:/\/\/ ratioS/,/string {/">
- Variadic functions like <code>ratioString</code> take a variable number of
- arguments. These arguments are available as a slice inside the function.
-</step>
-
-<step title="Simulation results" src="doc/codewalk/pig.go:/func main/,/\n}/">
- The <code>main</code> function defines 100 basic strategies, simulates a round
- robin tournament, and then prints the win/loss record of each strategy.
- <br/><br/>
-
- Among these strategies, staying at 25 is best, but the <a
- href="http://www.google.com/search?q=optimal+play+pig">optimal strategy for
- Pig</a> is much more complex.
-</step>
-
-</codewalk>
diff --git a/doc/codewalk/markov.go b/doc/codewalk/markov.go
deleted file mode 100644
index 5f62e05144..0000000000
--- a/doc/codewalk/markov.go
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2011 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.
-
-/*
-Generating random text: a Markov chain algorithm
-
-Based on the program presented in the "Design and Implementation" chapter
-of The Practice of Programming (Kernighan and Pike, Addison-Wesley 1999).
-See also Computer Recreations, Scientific American 260, 122 - 125 (1989).
-
-A Markov chain algorithm generates text by creating a statistical model of
-potential textual suffixes for a given prefix. Consider this text:
-
- I am not a number! I am a free man!
-
-Our Markov chain algorithm would arrange this text into this set of prefixes
-and suffixes, or "chain": (This table assumes a prefix length of two words.)
-
- Prefix Suffix
-
- "" "" I
- "" I am
- I am a
- I am not
- a free man!
- am a free
- am not a
- a number! I
- number! I am
- not a number!
-
-To generate text using this table we select an initial prefix ("I am", for
-example), choose one of the suffixes associated with that prefix at random
-with probability determined by the input statistics ("a"),
-and then create a new prefix by removing the first word from the prefix
-and appending the suffix (making the new prefix is "am a"). Repeat this process
-until we can't find any suffixes for the current prefix or we exceed the word
-limit. (The word limit is necessary as the chain table may contain cycles.)
-
-Our version of this program reads text from standard input, parsing it into a
-Markov chain, and writes generated text to standard output.
-The prefix and output lengths can be specified using the -prefix and -words
-flags on the command-line.
-*/
-package main
-
-import (
- "bufio"
- "flag"
- "fmt"
- "io"
- "math/rand"
- "os"
- "strings"
- "time"
-)
-
-// Prefix is a Markov chain prefix of one or more words.
-type Prefix []string
-
-// String returns the Prefix as a string (for use as a map key).
-func (p Prefix) String() string {
- return strings.Join(p, " ")
-}
-
-// Shift removes the first word from the Prefix and appends the given word.
-func (p Prefix) Shift(word string) {
- copy(p, p[1:])
- p[len(p)-1] = word
-}
-
-// Chain contains a map ("chain") of prefixes to a list of suffixes.
-// A prefix is a string of prefixLen words joined with spaces.
-// A suffix is a single word. A prefix can have multiple suffixes.
-type Chain struct {
- chain map[string][]string
- prefixLen int
-}
-
-// NewChain returns a new Chain with prefixes of prefixLen words.
-func NewChain(prefixLen int) *Chain {
- return &Chain{make(map[string][]string), prefixLen}
-}
-
-// Build reads text from the provided Reader and
-// parses it into prefixes and suffixes that are stored in Chain.
-func (c *Chain) Build(r io.Reader) {
- br := bufio.NewReader(r)
- p := make(Prefix, c.prefixLen)
- for {
- var s string
- if _, err := fmt.Fscan(br, &s); err != nil {
- break
- }
- key := p.String()
- c.chain[key] = append(c.chain[key], s)
- p.Shift(s)
- }
-}
-
-// Generate returns a string of at most n words generated from Chain.
-func (c *Chain) Generate(n int) string {
- p := make(Prefix, c.prefixLen)
- var words []string
- for i := 0; i < n; i++ {
- choices := c.chain[p.String()]
- if len(choices) == 0 {
- break
- }
- next := choices[rand.Intn(len(choices))]
- words = append(words, next)
- p.Shift(next)
- }
- return strings.Join(words, " ")
-}
-
-func main() {
- // Register command-line flags.
- numWords := flag.Int("words", 100, "maximum number of words to print")
- prefixLen := flag.Int("prefix", 2, "prefix length in words")
-
- flag.Parse() // Parse command-line flags.
- rand.Seed(time.Now().UnixNano()) // Seed the random number generator.
-
- c := NewChain(*prefixLen) // Initialize a new Chain.
- c.Build(os.Stdin) // Build chains from standard input.
- text := c.Generate(*numWords) // Generate text.
- fmt.Println(text) // Write text to standard output.
-}
diff --git a/doc/codewalk/markov.xml b/doc/codewalk/markov.xml
deleted file mode 100644
index 7e44840dc4..0000000000
--- a/doc/codewalk/markov.xml
+++ /dev/null
@@ -1,307 +0,0 @@
-<!--
-Copyright 2011 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.
--->
-
-<codewalk title="Generating arbitrary text: a Markov chain algorithm">
-
-<step title="Introduction" src="doc/codewalk/markov.go:/Generating/,/line\./">
- This codewalk describes a program that generates random text using
- a Markov chain algorithm. The package comment describes the algorithm
- and the operation of the program. Please read it before continuing.
-</step>
-
-<step title="Modeling Markov chains" src="doc/codewalk/markov.go:/ chain/">
- A chain consists of a prefix and a suffix. Each prefix is a set
- number of words, while a suffix is a single word.
- A prefix can have an arbitrary number of suffixes.
- To model this data, we use a <code>map[string][]string</code>.
- Each map key is a prefix (a <code>string</code>) and its values are
- lists of suffixes (a slice of strings, <code>[]string</code>).
- <br/><br/>
- Here is the example table from the package comment
- as modeled by this data structure:
- <pre>
-map[string][]string{
- " ": {"I"},
- " I": {"am"},
- "I am": {"a", "not"},
- "a free": {"man!"},
- "am a": {"free"},
- "am not": {"a"},
- "a number!": {"I"},
- "number! I": {"am"},
- "not a": {"number!"},
-}</pre>
- While each prefix consists of multiple words, we
- store prefixes in the map as a single <code>string</code>.
- It would seem more natural to store the prefix as a
- <code>[]string</code>, but we can't do this with a map because the
- key type of a map must implement equality (and slices do not).
- <br/><br/>
- Therefore, in most of our code we will model prefixes as a
- <code>[]string</code> and join the strings together with a space
- to generate the map key:
- <pre>
-Prefix Map key
-
-[]string{"", ""} " "
-[]string{"", "I"} " I"
-[]string{"I", "am"} "I am"
-</pre>
-</step>
-
-<step title="The Chain struct" src="doc/codewalk/markov.go:/type Chain/,/}/">
- The complete state of the chain table consists of the table itself and
- the word length of the prefixes. The <code>Chain</code> struct stores
- this data.
-</step>
-
-<step title="The NewChain constructor function" src="doc/codewalk/markov.go:/func New/,/\n}/">
- The <code>Chain</code> struct has two unexported fields (those that
- do not begin with an upper case character), and so we write a
- <code>NewChain</code> constructor function that initializes the
- <code>chain</code> map with <code>make</code> and sets the
- <code>prefixLen</code> field.
- <br/><br/>
- This is constructor function is not strictly necessary as this entire
- program is within a single package (<code>main</code>) and therefore
- there is little practical difference between exported and unexported
- fields. We could just as easily write out the contents of this function
- when we want to construct a new Chain.
- But using these unexported fields is good practice; it clearly denotes
- that only methods of Chain and its constructor function should access
- those fields. Also, structuring <code>Chain</code> like this means we
- could easily move it into its own package at some later date.
-</step>
-
-<step title="The Prefix type" src="doc/codewalk/markov.go:/type Prefix/">
- Since we'll be working with prefixes often, we define a
- <code>Prefix</code> type with the concrete type <code>[]string</code>.
- Defining a named type clearly allows us to be explicit when we are
- working with a prefix instead of just a <code>[]string</code>.
- Also, in Go we can define methods on any named type (not just structs),
- so we can add methods that operate on <code>Prefix</code> if we need to.
-</step>
-
-<step title="The String method" src="doc/codewalk/markov.go:/func[^\n]+String/,/}/">
- The first method we define on <code>Prefix</code> is
- <code>String</code>. It returns a <code>string</code> representation
- of a <code>Prefix</code> by joining the slice elements together with
- spaces. We will use this method to generate keys when working with
- the chain map.
-</step>
-
-<step title="Building the chain" src="doc/codewalk/markov.go:/func[^\n]+Build/,/\n}/">
- The <code>Build</code> method reads text from an <code>io.Reader</code>
- and parses it into prefixes and suffixes that are stored in the
- <code>Chain</code>.
- <br/><br/>
- The <code><a href="/pkg/io/#Reader">io.Reader</a></code> is an
- interface type that is widely used by the standard library and
- other Go code. Our code uses the
- <code><a href="/pkg/fmt/#Fscan">fmt.Fscan</a></code> function, which
- reads space-separated values from an <code>io.Reader</code>.
- <br/><br/>
- The <code>Build</code> method returns once the <code>Reader</code>'s
- <code>Read</code> method returns <code>io.EOF</code> (end of file)
- or some other read error occurs.
-</step>
-
-<step title="Buffering the input" src="doc/codewalk/markov.go:/bufio\.NewReader/">
- This function does many small reads, which can be inefficient for some
- <code>Readers</code>. For efficiency we wrap the provided
- <code>io.Reader</code> with
- <code><a href="/pkg/bufio/">bufio.NewReader</a></code> to create a
- new <code>io.Reader</code> that provides buffering.
-</step>
-
-<step title="The Prefix variable" src="doc/codewalk/markov.go:/make\(Prefix/">
- At the top of the function we make a <code>Prefix</code> slice
- <code>p</code> using the <code>Chain</code>'s <code>prefixLen</code>
- field as its length.
- We'll use this variable to hold the current prefix and mutate it with
- each new word we encounter.
-</step>
-
-<step title="Scanning words" src="doc/codewalk/markov.go:/var s string/,/\n }/">
- In our loop we read words from the <code>Reader</code> into a
- <code>string</code> variable <code>s</code> using
- <code>fmt.Fscan</code>. Since <code>Fscan</code> uses space to
- separate each input value, each call will yield just one word
- (including punctuation), which is exactly what we need.
- <br/><br/>
- <code>Fscan</code> returns an error if it encounters a read error
- (<code>io.EOF</code>, for example) or if it can't scan the requested
- value (in our case, a single string). In either case we just want to
- stop scanning, so we <code>break</code> out of the loop.
-</step>
-
-<step title="Adding a prefix and suffix to the chain" src="doc/codewalk/markov.go:/ key/,/key\], s\)">
- The word stored in <code>s</code> is a new suffix. We add the new
- prefix/suffix combination to the <code>chain</code> map by computing
- the map key with <code>p.String</code> and appending the suffix
- to the slice stored under that key.
- <br/><br/>
- The built-in <code>append</code> function appends elements to a slice
- and allocates new storage when necessary. When the provided slice is
- <code>nil</code>, <code>append</code> allocates a new slice.
- This behavior conveniently ties in with the semantics of our map:
- retrieving an unset key returns the zero value of the value type and
- the zero value of <code>[]string</code> is <code>nil</code>.
- When our program encounters a new prefix (yielding a <code>nil</code>
- value in the map) <code>append</code> will allocate a new slice.
- <br/><br/>
- For more information about the <code>append</code> function and slices
- in general see the
- <a href="/doc/articles/slices_usage_and_internals.html">Slices: usage and internals</a> article.
-</step>
-
-<step title="Pushing the suffix onto the prefix" src="doc/codewalk/markov.go:/p\.Shift/">
- Before reading the next word our algorithm requires us to drop the
- first word from the prefix and push the current suffix onto the prefix.
- <br/><br/>
- When in this state
- <pre>
-p == Prefix{"I", "am"}
-s == "not" </pre>
- the new value for <code>p</code> would be
- <pre>
-p == Prefix{"am", "not"}</pre>
- This operation is also required during text generation so we put
- the code to perform this mutation of the slice inside a method on
- <code>Prefix</code> named <code>Shift</code>.
-</step>
-
-<step title="The Shift method" src="doc/codewalk/markov.go:/func[^\n]+Shift/,/\n}/">
- The <code>Shift</code> method uses the built-in <code>copy</code>
- function to copy the last len(p)-1 elements of <code>p</code> to
- the start of the slice, effectively moving the elements
- one index to the left (if you consider zero as the leftmost index).
- <pre>
-p := Prefix{"I", "am"}
-copy(p, p[1:])
-// p == Prefix{"am", "am"}</pre>
- We then assign the provided <code>word</code> to the last index
- of the slice:
- <pre>
-// suffix == "not"
-p[len(p)-1] = suffix
-// p == Prefix{"am", "not"}</pre>
-</step>
-
-<step title="Generating text" src="doc/codewalk/markov.go:/func[^\n]+Generate/,/\n}/">
- The <code>Generate</code> method is similar to <code>Build</code>
- except that instead of reading words from a <code>Reader</code>
- and storing them in a map, it reads words from the map and
- appends them to a slice (<code>words</code>).
- <br/><br/>
- <code>Generate</code> uses a conditional for loop to generate
- up to <code>n</code> words.
-</step>
-
-<step title="Getting potential suffixes" src="doc/codewalk/markov.go:/choices/,/}\n/">
- At each iteration of the loop we retrieve a list of potential suffixes
- for the current prefix. We access the <code>chain</code> map at key
- <code>p.String()</code> and assign its contents to <code>choices</code>.
- <br/><br/>
- If <code>len(choices)</code> is zero we break out of the loop as there
- are no potential suffixes for that prefix.
- This test also works if the key isn't present in the map at all:
- in that case, <code>choices</code> will be <code>nil</code> and the
- length of a <code>nil</code> slice is zero.
-</step>
-
-<step title="Choosing a suffix at random" src="doc/codewalk/markov.go:/next := choices/,/Shift/">
- To choose a suffix we use the
- <code><a href="/pkg/math/rand/#Intn">rand.Intn</a></code> function.
- It returns a random integer up to (but not including) the provided
- value. Passing in <code>len(choices)</code> gives us a random index
- into the full length of the list.
- <br/><br/>
- We use that index to pick our new suffix, assign it to
- <code>next</code> and append it to the <code>words</code> slice.
- <br/><br/>
- Next, we <code>Shift</code> the new suffix onto the prefix just as
- we did in the <code>Build</code> method.
-</step>
-
-<step title="Returning the generated text" src="doc/codewalk/markov.go:/Join\(words/">
- Before returning the generated text as a string, we use the
- <code>strings.Join</code> function to join the elements of
- the <code>words</code> slice together, separated by spaces.
-</step>
-
-<step title="Command-line flags" src="doc/codewalk/markov.go:/Register command-line flags/,/prefixLen/">
- To make it easy to tweak the prefix and generated text lengths we
- use the <code><a href="/pkg/flag/">flag</a></code> package to parse
- command-line flags.
- <br/><br/>
- These calls to <code>flag.Int</code> register new flags with the
- <code>flag</code> package. The arguments to <code>Int</code> are the
- flag name, its default value, and a description. The <code>Int</code>
- function returns a pointer to an integer that will contain the
- user-supplied value (or the default value if the flag was omitted on
- the command-line).
-</step>
-
-<step title="Program set up" src="doc/codewalk/markov.go:/flag.Parse/,/rand.Seed/">
- The <code>main</code> function begins by parsing the command-line
- flags with <code>flag.Parse</code> and seeding the <code>rand</code>
- package's random number generator with the current time.
- <br/><br/>
- If the command-line flags provided by the user are invalid the
- <code>flag.Parse</code> function will print an informative usage
- message and terminate the program.
-</step>
-
-<step title="Creating and building a new Chain" src="doc/codewalk/markov.go:/c := NewChain/,/c\.Build/">
- To create the new <code>Chain</code> we call <code>NewChain</code>
- with the value of the <code>prefix</code> flag.
- <br/><br/>
- To build the chain we call <code>Build</code> with
- <code>os.Stdin</code> (which implements <code>io.Reader</code>) so
- that it will read its input from standard input.
-</step>
-
-<step title="Generating and printing text" src="doc/codewalk/markov.go:/c\.Generate/,/fmt.Println/">
- Finally, to generate text we call <code>Generate</code> with
- the value of the <code>words</code> flag and assigning the result
- to the variable <code>text</code>.
- <br/><br/>
- Then we call <code>fmt.Println</code> to write the text to standard
- output, followed by a carriage return.
-</step>
-
-<step title="Using this program" src="doc/codewalk/markov.go">
- To use this program, first build it with the
- <a href="/cmd/go/">go</a> command:
- <pre>
-$ go build markov.go</pre>
- And then execute it while piping in some input text:
- <pre>
-$ echo "a man a plan a canal panama" \
- | ./markov -prefix=1
-a plan a man a plan a canal panama</pre>
- Here's a transcript of generating some text using the Go distribution's
- README file as source material:
- <pre>
-$ ./markov -words=10 &lt; $GOROOT/README
-This is the source code repository for the Go source
-$ ./markov -prefix=1 -words=10 &lt; $GOROOT/README
-This is the go directory (the one containing this README).
-$ ./markov -prefix=1 -words=10 &lt; $GOROOT/README
-This is the variable if you have just untarred a</pre>
-</step>
-
-<step title="An exercise for the reader" src="doc/codewalk/markov.go">
- The <code>Generate</code> function does a lot of allocations when it
- builds the <code>words</code> slice. As an exercise, modify it to
- take an <code>io.Writer</code> to which it incrementally writes the
- generated text with <code>Fprint</code>.
- Aside from being more efficient this makes <code>Generate</code>
- more symmetrical to <code>Build</code>.
-</step>
-
-</codewalk>
diff --git a/doc/codewalk/pig.go b/doc/codewalk/pig.go
deleted file mode 100644
index 941daaed16..0000000000
--- a/doc/codewalk/pig.go
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2011 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.
-
-package main
-
-import (
- "fmt"
- "math/rand"
-)
-
-const (
- win = 100 // The winning score in a game of Pig
- gamesPerSeries = 10 // The number of games per series to simulate
-)
-
-// A score includes scores accumulated in previous turns for each player,
-// as well as the points scored by the current player in this turn.
-type score struct {
- player, opponent, thisTurn int
-}
-
-// An action transitions stochastically to a resulting score.
-type action func(current score) (result score, turnIsOver bool)
-
-// roll returns the (result, turnIsOver) outcome of simulating a die roll.
-// If the roll value is 1, then thisTurn score is abandoned, and the players'
-// roles swap. Otherwise, the roll value is added to thisTurn.
-func roll(s score) (score, bool) {
- outcome := rand.Intn(6) + 1 // A random int in [1, 6]
- if outcome == 1 {
- return score{s.opponent, s.player, 0}, true
- }
- return score{s.player, s.opponent, outcome + s.thisTurn}, false
-}
-
-// stay returns the (result, turnIsOver) outcome of staying.
-// thisTurn score is added to the player's score, and the players' roles swap.
-func stay(s score) (score, bool) {
- return score{s.opponent, s.player + s.thisTurn, 0}, true
-}
-
-// A strategy chooses an action for any given score.
-type strategy func(score) action
-
-// stayAtK returns a strategy that rolls until thisTurn is at least k, then stays.
-func stayAtK(k int) strategy {
- return func(s score) action {
- if s.thisTurn >= k {
- return stay
- }
- return roll
- }
-}
-
-// play simulates a Pig game and returns the winner (0 or 1).
-func play(strategy0, strategy1 strategy) int {
- strategies := []strategy{strategy0, strategy1}
- var s score
- var turnIsOver bool
- currentPlayer := rand.Intn(2) // Randomly decide who plays first
- for s.player+s.thisTurn < win {
- action := strategies[currentPlayer](s)
- s, turnIsOver = action(s)
- if turnIsOver {
- currentPlayer = (currentPlayer + 1) % 2
- }
- }
- return currentPlayer
-}
-
-// roundRobin simulates a series of games between every pair of strategies.
-func roundRobin(strategies []strategy) ([]int, int) {
- wins := make([]int, len(strategies))
- for i := 0; i < len(strategies); i++ {
- for j := i + 1; j < len(strategies); j++ {
- for k := 0; k < gamesPerSeries; k++ {
- winner := play(strategies[i], strategies[j])
- if winner == 0 {
- wins[i]++
- } else {
- wins[j]++
- }
- }
- }
- }
- gamesPerStrategy := gamesPerSeries * (len(strategies) - 1) // no self play
- return wins, gamesPerStrategy
-}
-
-// ratioString takes a list of integer values and returns a string that lists
-// each value and its percentage of the sum of all values.
-// e.g., ratios(1, 2, 3) = "1/6 (16.7%), 2/6 (33.3%), 3/6 (50.0%)"
-func ratioString(vals ...int) string {
- total := 0
- for _, val := range vals {
- total += val
- }
- s := ""
- for _, val := range vals {
- if s != "" {
- s += ", "
- }
- pct := 100 * float64(val) / float64(total)
- s += fmt.Sprintf("%d/%d (%0.1f%%)", val, total, pct)
- }
- return s
-}
-
-func main() {
- strategies := make([]strategy, win)
- for k := range strategies {
- strategies[k] = stayAtK(k + 1)
- }
- wins, games := roundRobin(strategies)
-
- for k := range strategies {
- fmt.Printf("Wins, losses staying at k =% 4d: %s\n",
- k+1, ratioString(wins[k], games-wins[k]))
- }
-}
diff --git a/doc/codewalk/popout.png b/doc/codewalk/popout.png
deleted file mode 100644
index 9c0c23638b..0000000000
--- a/doc/codewalk/popout.png
+++ /dev/null
Binary files differ
diff --git a/doc/codewalk/sharemem.xml b/doc/codewalk/sharemem.xml
deleted file mode 100644
index 8b47f12b7a..0000000000
--- a/doc/codewalk/sharemem.xml
+++ /dev/null
@@ -1,181 +0,0 @@
-<codewalk title="Share Memory By Communicating">
-
-<step title="Introduction" src="doc/codewalk/urlpoll.go">
-Go's approach to concurrency differs from the traditional use of
-threads and shared memory. Philosophically, it can be summarized:
-<br/><br/>
-<i>Don't communicate by sharing memory; share memory by communicating.</i>
-<br/><br/>
-Channels allow you to pass references to data structures between goroutines.
-If you consider this as passing around ownership of the data (the ability to
-read and write it), they become a powerful and expressive synchronization
-mechanism.
-<br/><br/>
-In this codewalk we will look at a simple program that polls a list of
-URLs, checking their HTTP response codes and periodically printing their state.
-</step>
-
-<step title="State type" src="doc/codewalk/urlpoll.go:/State/,/}/">
-The State type represents the state of a URL.
-<br/><br/>
-The Pollers send State values to the StateMonitor,
-which maintains a map of the current state of each URL.
-</step>
-
-<step title="Resource type" src="doc/codewalk/urlpoll.go:/Resource/,/}/">
-A Resource represents the state of a URL to be polled: the URL itself
-and the number of errors encountered since the last successful poll.
-<br/><br/>
-When the program starts, it allocates one Resource for each URL.
-The main goroutine and the Poller goroutines send the Resources to
-each other on channels.
-</step>
-
-<step title="Poller function" src="doc/codewalk/urlpoll.go:/func Poller/,/\n}/">
-Each Poller receives Resource pointers from an input channel.
-In this program, the convention is that sending a Resource pointer on
-a channel passes ownership of the underlying data from the sender
-to the receiver. Because of this convention, we know that
-no two goroutines will access this Resource at the same time.
-This means we don't have to worry about locking to prevent concurrent
-access to these data structures.
-<br/><br/>
-The Poller processes the Resource by calling its Poll method.
-<br/><br/>
-It sends a State value to the status channel, to inform the StateMonitor
-of the result of the Poll.
-<br/><br/>
-Finally, it sends the Resource pointer to the out channel. This can be
-interpreted as the Poller saying &quot;I'm done with this Resource&quot; and
-returning ownership of it to the main goroutine.
-<br/><br/>
-Several goroutines run Pollers, processing Resources in parallel.
-</step>
-
-<step title="The Poll method" src="doc/codewalk/urlpoll.go:/Poll executes/,/\n}/">
-The Poll method (of the Resource type) performs an HTTP HEAD request
-for the Resource's URL and returns the HTTP response's status code.
-If an error occurs, Poll logs the message to standard error and returns the
-error string instead.
-</step>
-
-<step title="main function" src="doc/codewalk/urlpoll.go:/func main/,/\n}/">
-The main function starts the Poller and StateMonitor goroutines
-and then loops passing completed Resources back to the pending
-channel after appropriate delays.
-</step>
-
-<step title="Creating channels" src="doc/codewalk/urlpoll.go:/Create our/,/complete/">
-First, main makes two channels of *Resource, pending and complete.
-<br/><br/>
-Inside main, a new goroutine sends one Resource per URL to pending
-and the main goroutine receives completed Resources from complete.
-<br/><br/>
-The pending and complete channels are passed to each of the Poller
-goroutines, within which they are known as in and out.
-</step>
-
-<step title="Initializing StateMonitor" src="doc/codewalk/urlpoll.go:/Launch the StateMonitor/,/statusInterval/">
-StateMonitor will initialize and launch a goroutine that stores the state
-of each Resource. We will look at this function in detail later.
-<br/><br/>
-For now, the important thing to note is that it returns a channel of State,
-which is saved as status and passed to the Poller goroutines.
-</step>
-
-<step title="Launching Poller goroutines" src="doc/codewalk/urlpoll.go:/Launch some Poller/,/}/">
-Now that it has the necessary channels, main launches a number of
-Poller goroutines, passing the channels as arguments.
-The channels provide the means of communication between the main, Poller, and
-StateMonitor goroutines.
-</step>
-
-<step title="Send Resources to pending" src="doc/codewalk/urlpoll.go:/Send some Resources/,/}\(\)/">
-To add the initial work to the system, main starts a new goroutine
-that allocates and sends one Resource per URL to pending.
-<br/><br/>
-The new goroutine is necessary because unbuffered channel sends and
-receives are synchronous. That means these channel sends will block until
-the Pollers are ready to read from pending.
-<br/><br/>
-Were these sends performed in the main goroutine with fewer Pollers than
-channel sends, the program would reach a deadlock situation, because
-main would not yet be receiving from complete.
-<br/><br/>
-Exercise for the reader: modify this part of the program to read a list of
-URLs from a file. (You may want to move this goroutine into its own
-named function.)
-</step>
-
-<step title="Main Event Loop" src="doc/codewalk/urlpoll.go:/range complete/,/\n }/">
-When a Poller is done with a Resource, it sends it on the complete channel.
-This loop receives those Resource pointers from complete.
-For each received Resource, it starts a new goroutine calling
-the Resource's Sleep method. Using a new goroutine for each
-ensures that the sleeps can happen in parallel.
-<br/><br/>
-Note that any single Resource pointer may only be sent on either pending or
-complete at any one time. This ensures that a Resource is either being
-handled by a Poller goroutine or sleeping, but never both simultaneously.
-In this way, we share our Resource data by communicating.
-</step>
-
-<step title="The Sleep method" src="doc/codewalk/urlpoll.go:/Sleep/,/\n}/">
-Sleep calls time.Sleep to pause before sending the Resource to done.
-The pause will either be of a fixed length (pollInterval) plus an
-additional delay proportional to the number of sequential errors (r.errCount).
-<br/><br/>
-This is an example of a typical Go idiom: a function intended to run inside
-a goroutine takes a channel, upon which it sends its return value
-(or other indication of completed state).
-</step>
-
-<step title="StateMonitor" src="doc/codewalk/urlpoll.go:/StateMonitor/,/\n}/">
-The StateMonitor receives State values on a channel and periodically
-outputs the state of all Resources being polled by the program.
-</step>
-
-<step title="The updates channel" src="doc/codewalk/urlpoll.go:/updates :=/">
-The variable updates is a channel of State, on which the Poller goroutines
-send State values.
-<br/><br/>
-This channel is returned by the function.
-</step>
-
-<step title="The urlStatus map" src="doc/codewalk/urlpoll.go:/urlStatus/">
-The variable urlStatus is a map of URLs to their most recent status.
-</step>
-
-<step title="The Ticker object" src="doc/codewalk/urlpoll.go:/ticker/">
-A time.Ticker is an object that repeatedly sends a value on a channel at a
-specified interval.
-<br/><br/>
-In this case, ticker triggers the printing of the current state to
-standard output every updateInterval nanoseconds.
-</step>
-
-<step title="The StateMonitor goroutine" src="doc/codewalk/urlpoll.go:/go func/,/}\(\)/">
-StateMonitor will loop forever, selecting on two channels:
-ticker.C and update. The select statement blocks until one of its
-communications is ready to proceed.
-<br/><br/>
-When StateMonitor receives a tick from ticker.C, it calls logState to
-print the current state. When it receives a State update from updates,
-it records the new status in the urlStatus map.
-<br/><br/>
-Notice that this goroutine owns the urlStatus data structure,
-ensuring that it can only be accessed sequentially.
-This prevents memory corruption issues that might arise from parallel reads
-and/or writes to a shared map.
-</step>
-
-<step title="Conclusion" src="doc/codewalk/urlpoll.go">
-In this codewalk we have explored a simple example of using Go's concurrency
-primitives to share memory through communication.
-<br/><br/>
-This should provide a starting point from which to explore the ways in which
-goroutines and channels can be used to write expressive and concise concurrent
-programs.
-</step>
-
-</codewalk>
diff --git a/doc/codewalk/urlpoll.go b/doc/codewalk/urlpoll.go
deleted file mode 100644
index 1fb99581f0..0000000000
--- a/doc/codewalk/urlpoll.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2010 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.
-
-package main
-
-import (
- "log"
- "net/http"
- "time"
-)
-
-const (
- numPollers = 2 // number of Poller goroutines to launch
- pollInterval = 60 * time.Second // how often to poll each URL
- statusInterval = 10 * time.Second // how often to log status to stdout
- errTimeout = 10 * time.Second // back-off timeout on error
-)
-
-var urls = []string{
- "http://www.google.com/",
- "http://golang.org/",
- "http://blog.golang.org/",
-}
-
-// State represents the last-known state of a URL.
-type State struct {
- url string
- status string
-}
-
-// StateMonitor maintains a map that stores the state of the URLs being
-// polled, and prints the current state every updateInterval nanoseconds.
-// It returns a chan State to which resource state should be sent.
-func StateMonitor(updateInterval time.Duration) chan<- State {
- updates := make(chan State)
- urlStatus := make(map[string]string)
- ticker := time.NewTicker(updateInterval)
- go func() {
- for {
- select {
- case <-ticker.C:
- logState(urlStatus)
- case s := <-updates:
- urlStatus[s.url] = s.status
- }
- }
- }()
- return updates
-}
-
-// logState prints a state map.
-func logState(s map[string]string) {
- log.Println("Current state:")
- for k, v := range s {
- log.Printf(" %s %s", k, v)
- }
-}
-
-// Resource represents an HTTP URL to be polled by this program.
-type Resource struct {
- url string
- errCount int
-}
-
-// Poll executes an HTTP HEAD request for url
-// and returns the HTTP status string or an error string.
-func (r *Resource) Poll() string {
- resp, err := http.Head(r.url)
- if err != nil {
- log.Println("Error", r.url, err)
- r.errCount++
- return err.Error()
- }
- r.errCount = 0
- return resp.Status
-}
-
-// Sleep sleeps for an appropriate interval (dependent on error state)
-// before sending the Resource to done.
-func (r *Resource) Sleep(done chan<- *Resource) {
- time.Sleep(pollInterval + errTimeout*time.Duration(r.errCount))
- done <- r
-}
-
-func Poller(in <-chan *Resource, out chan<- *Resource, status chan<- State) {
- for r := range in {
- s := r.Poll()
- status <- State{r.url, s}
- out <- r
- }
-}
-
-func main() {
- // Create our input and output channels.
- pending, complete := make(chan *Resource), make(chan *Resource)
-
- // Launch the StateMonitor.
- status := StateMonitor(statusInterval)
-
- // Launch some Poller goroutines.
- for i := 0; i < numPollers; i++ {
- go Poller(pending, complete, status)
- }
-
- // Send some Resources to the pending queue.
- go func() {
- for _, url := range urls {
- pending <- &Resource{url: url}
- }
- }()
-
- for r := range complete {
- go r.Sleep(pending)
- }
-}
diff --git a/doc/contribute.html b/doc/contribute.html
deleted file mode 100644
index 66a47eb07e..0000000000
--- a/doc/contribute.html
+++ /dev/null
@@ -1,1294 +0,0 @@
-<!--{
- "Title": "Contribution Guide"
-}-->
-
-<p>
-The Go project welcomes all contributors.
-</p>
-
-<p>
-This document is a guide to help you through the process
-of contributing to the Go project, which is a little different
-from that used by other open source projects.
-We assume you have a basic understanding of Git and Go.
-</p>
-
-<p>
-In addition to the information here, the Go community maintains a
-<a href="https://golang.org/wiki/CodeReview">CodeReview</a> wiki page.
-Feel free to contribute to the wiki as you learn the review process.
-</p>
-
-<p>
-Note that the <code>gccgo</code> front end lives elsewhere;
-see <a href="gccgo_contribute.html">Contributing to gccgo</a>.
-</p>
-
-<h2 id="contributor">Becoming a contributor</h2>
-
-<h3 id="contrib_overview">Overview</h3>
-
-<p>
-The first step is registering as a Go contributor and configuring your environment.
-Here is a checklist of the required steps to follow:
-</p>
-
-<ul>
-<li>
-<b>Step 0</b>: Decide on a single Google Account you will be using to contribute to Go.
-Use that account for all the following steps and make sure that <code>git</code>
-is configured to create commits with that account's e-mail address.
-</li>
-<li>
-<b>Step 1</b>: <a href="https://cla.developers.google.com/clas">Sign and submit</a> a
-CLA (Contributor License Agreement).
-</li>
-<li>
-<b>Step 2</b>: Configure authentication credentials for the Go Git repository.
-Visit <a href="https://go.googlesource.com">go.googlesource.com</a>, click
-"Generate Password" in the page's top right menu bar, and follow the
-instructions.
-</li>
-<li>
-<b>Step 3</b>: Register for Gerrit, the code review tool used by the Go team,
-by <a href="https://go-review.googlesource.com/login/">visiting this page</a>.
-The CLA and the registration need to be done only once for your account.
-</li>
-<li>
-<b>Step 4</b>: Install <code>git-codereview</code> by running
-<code>go get -u golang.org/x/review/git-codereview</code>
-</li>
-</ul>
-
-<p>
-If you prefer, there is an automated tool that walks through these steps.
-Just run:
-</p>
-
-<pre>
-$ go get -u golang.org/x/tools/cmd/go-contrib-init
-$ cd /code/to/edit
-$ go-contrib-init
-</pre>
-
-<p>
-The rest of this chapter elaborates on these instructions.
-If you have completed the steps above (either manually or through the tool), jump to
-<a href="#before_contributing">Before contributing code</a>.
-</p>
-
-<h3 id="google_account">Step 0: Select a Google Account</h3>
-
-<p>
-A contribution to Go is made through a Google account with a specific
-e-mail address.
-Make sure to use the same account throughout the process and
-for all your subsequent contributions.
-You may need to decide whether to use a personal address or a corporate address.
-The choice will depend on who
-will own the copyright for the code that you will be writing
-and submitting.
-You might want to discuss this topic with your employer before deciding which
-account to use.
-</p>
-
-<p>
-Google accounts can either be Gmail e-mail accounts, G Suite organization accounts, or
-accounts associated with an external e-mail address.
-For instance, if you need to use
-an existing corporate e-mail that is not managed through G Suite, you can create
-an account associated
-<a href="https://accounts.google.com/SignUpWithoutGmail">with your existing
-e-mail address</a>.
-</p>
-
-<p>
-You also need to make sure that your Git tool is configured to create commits
-using your chosen e-mail address.
-You can either configure Git globally
-(as a default for all projects), or locally (for a single specific project).
-You can check the current configuration with this command:
-</p>
-
-<pre>
-$ git config --global user.email # check current global config
-$ git config user.email # check current local config
-</pre>
-
-<p>
-To change the configured address:
-</p>
-
-<pre>
-$ git config --global user.email name@example.com # change global config
-$ git config user.email name@example.com # change local config
-</pre>
-
-
-<h3 id="cla">Step 1: Contributor License Agreement</h3>
-
-<p>
-Before sending your first change to the Go project
-you must have completed one of the following two CLAs.
-Which CLA you should sign depends on who owns the copyright to your work.
-</p>
-
-<ul>
-<li>
-If you are the copyright holder, you will need to agree to the
-<a href="https://developers.google.com/open-source/cla/individual">individual
-contributor license agreement</a>, which can be completed online.
-</li>
-<li>
-If your organization is the copyright holder, the organization
-will need to agree to the
-<a href="https://developers.google.com/open-source/cla/corporate">corporate
-contributor license agreement</a>.<br>
-</li>
-</ul>
-
-<p>
-You can check your currently signed agreements and sign new ones at
-the <a href="https://cla.developers.google.com/clas?pli=1&amp;authuser=1">Google Developers
-Contributor License Agreements</a> website.
-If the copyright holder for your contribution has already completed the
-agreement in connection with another Google open source project,
-it does not need to be completed again.
-</p>
-
-<p>
-If the copyright holder for the code you are submitting changes&mdash;for example,
-if you start contributing code on behalf of a new company&mdash;please send mail
-to the <a href="mailto:golang-dev@googlegroups.com"><code>golang-dev</code>
-mailing list</a>.
-This will let us know the situation so we can make sure an appropriate agreement is
-completed and update the <code>AUTHORS</code> file.
-</p>
-
-
-<h3 id="config_git_auth">Step 2: Configure git authentication</h3>
-
-<p>
-The main Go repository is located at
-<a href="https://go.googlesource.com">go.googlesource.com</a>,
-a Git server hosted by Google.
-Authentication on the web server is made through your Google account, but
-you also need to configure <code>git</code> on your computer to access it.
-Follow these steps:
-</p>
-
-<ol>
-<li>
-Visit <a href="https://go.googlesource.com">go.googlesource.com</a>
-and click on "Generate Password" in the page's top right menu bar.
-You will be redirected to accounts.google.com to sign in.
-</li>
-<li>
-After signing in, you will be taken to a page with the title "Configure Git".
-This page contains a personalized script that when run locally will configure Git
-to hold your unique authentication key.
-This key is paired with one that is generated and stored on the server,
-analogous to how SSH keys work.
-</li>
-<li>
-Copy and run this script locally in your terminal to store your secret
-authentication token in a <code>.gitcookies</code> file.
-If you are using a Windows computer and running <code>cmd</code>,
-you should instead follow the instructions in the yellow box to run the command;
-otherwise run the regular script.
-</li>
-</ol>
-
-<h3 id="auth">Step 3: Create a Gerrit account </h3>
-
-<p>
-Gerrit is an open-source tool used by Go maintainers to discuss and review
-code submissions.
-</p>
-
-<p>
-To register your account, visit <a href="https://go-review.googlesource.com/login/">
-go-review.googlesource.com/login/</a> and sign in once using the same Google Account you used above.
-</p>
-
-<h3 id="git-codereview_install">Step 4: Install the git-codereview command</h3>
-
-<p>
-Changes to Go must be reviewed before they are accepted, no matter who makes the change.
-A custom <code>git</code> command called <code>git-codereview</code>
-simplifies sending changes to Gerrit.
-</p>
-
-<p>
-Install the <code>git-codereview</code> command by running,
-</p>
-
-<pre>
-$ go get -u golang.org/x/review/git-codereview
-</pre>
-
-<p>
-Make sure <code>git-codereview</code> is installed in your shell path, so that the
-<code>git</code> command can find it.
-Check that
-</p>
-
-<pre>
-$ git codereview help
-</pre>
-
-<p>
-prints help text, not an error. If it prints an error, make sure that
-<code>$GOPATH/bin</code> is in your <code>$PATH</code>.
-</p>
-
-<p>
-On Windows, when using git-bash you must make sure that
-<code>git-codereview.exe</code> is in your <code>git</code> exec-path.
-Run <code>git --exec-path</code> to discover the right location then create a
-symbolic link or just copy the executable from <code>$GOPATH/bin</code> to this
-directory.
-</p>
-
-
-<h2 id="before_contributing">Before contributing code</h2>
-
-<p>
-The project welcomes code patches, but to make sure things are well
-coordinated you should discuss any significant change before starting
-the work.
-It's recommended that you signal your intention to contribute in the
-issue tracker, either by <a href="https://golang.org/issue/new">filing
-a new issue</a> or by claiming
-an <a href="https://golang.org/issues">existing one</a>.
-</p>
-
-<h3 id="where">Where to contribute</h3>
-
-<p>
-The Go project consists of the main
-<a href="https://go.googlesource.com/go">go</a> repository, which contains the
-source code for the Go language, as well as many golang.org/x/... repostories.
-These contain the various tools and infrastructure that support Go. For
-example, <a href="https://go.googlesource.com/pkgsite">golang.org/x/pkgsite</a>
-is for <a href="https://pkg.go.dev">pkg.go.dev</a>,
-<a href="https://go.googlesource.com/playground">golang.org/x/playground</a>
-is for the Go playground, and
-<a href="https://go.googlesource.com/tools">golang.org/x/tools</a> contains
-a variety of Go tools, including the Go language server,
-<a href="https://golang.org/s/gopls">gopls</a>. You can see a
-list of all the golang.org/x/... repositories on
-<a href="https://go.googlesource.com">go.googlesource.com</a>.
-</p>
-
-<h3 id="check_tracker">Check the issue tracker</h3>
-
-<p>
-Whether you already know what contribution to make, or you are searching for
-an idea, the <a href="https://github.com/golang/go/issues">issue tracker</a> is
-always the first place to go.
-Issues are triaged to categorize them and manage the workflow.
-</p>
-
-<p>
-The majority of the golang.org/x/... repos also use the main Go
-issue tracker. However, a few of these repositories manage their issues
-separately, so please be sure to check the right tracker for the repository to
-which you would like to contribute.
-</p>
-
-<p>
-Most issues will be marked with one of the following workflow labels:
-</p>
-
-<ul>
- <li>
- <b>NeedsInvestigation</b>: The issue is not fully understood
- and requires analysis to understand the root cause.
- </li>
- <li>
- <b>NeedsDecision</b>: the issue is relatively well understood, but the
- Go team hasn't yet decided the best way to address it.
- It would be better to wait for a decision before writing code.
- If you are interested in working on an issue in this state,
- feel free to "ping" maintainers in the issue's comments
- if some time has passed without a decision.
- </li>
- <li>
- <b>NeedsFix</b>: the issue is fully understood and code can be written
- to fix it.
- </li>
-</ul>
-
-<p>
-You can use GitHub's search functionality to find issues to help out with. Examples:
-</p>
-
-<ul>
- <li>
- Issues that need investigation: <a href="https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsInvestigation"><code>is:issue is:open label:NeedsInvestigation</code></a>
- </li>
- <li>
- Issues that need a fix: <a href="https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsFix"><code>is:issue is:open label:NeedsFix</code></a>
- </li>
- <li>
- Issues that need a fix and have a CL: <a href="https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsFix+%22golang.org%2Fcl%22"><code>is:issue is:open label:NeedsFix "golang.org/cl"</code></a>
- </li>
- <li>
- Issues that need a fix and do not have a CL: <a href="https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3ANeedsFix+NOT+%22golang.org%2Fcl%22"><code>is:issue is:open label:NeedsFix NOT "golang.org/cl"</code></a>
- </li>
-</ul>
-
-<h3 id="design">Open an issue for any new problem</h3>
-
-<p>
-Excluding very trivial changes, all contributions should be connected
-to an existing issue.
-Feel free to open one and discuss your plans.
-This process gives everyone a chance to validate the design,
-helps prevent duplication of effort,
-and ensures that the idea fits inside the goals for the language and tools.
-It also checks that the design is sound before code is written;
-the code review tool is not the place for high-level discussions.
-</p>
-
-<p>
-When planning work, please note that the Go project follows a <a
-href="https://golang.org/wiki/Go-Release-Cycle">six-month development cycle</a>
-for the main Go repository. The latter half of each cycle is a three-month
-feature freeze during which only bug fixes and documentation updates are
-accepted. New contributions can be sent during a feature freeze, but they will
-not be merged until the freeze is over. The freeze applies to the entire main
-repository as well as to the code in golang.org/x/... repositories that is
-needed to build the binaries included in the release. See the lists of packages
-vendored into
-<a href="https://github.com/golang/go/blob/master/src/vendor/modules.txt">the standard library</a>
-and the <a href="https://github.com/golang/go/blob/master/src/cmd/vendor/modules.txt"><code>go</code> command</a>.
-</p>
-
-<p>
-Significant changes to the language, libraries, or tools must go
-through the
-<a href="https://golang.org/s/proposal-process">change proposal process</a>
-before they can be accepted.
-</p>
-
-<p>
-Sensitive security-related issues (only!) should be reported to <a href="mailto:security@golang.org">security@golang.org</a>.
-</p>
-
-<h2 id="sending_a_change_github">Sending a change via GitHub</h2>
-
-<p>
-First-time contributors that are already familiar with the
-<a href="https://guides.github.com/introduction/flow/">GitHub flow</a>
-are encouraged to use the same process for Go contributions.
-Even though Go
-maintainers use Gerrit for code review, a bot called Gopherbot has been created to sync
-GitHub pull requests to Gerrit.
-</p>
-
-<p>
-Open a pull request as you normally would.
-Gopherbot will create a corresponding Gerrit change and post a link to
-it on your GitHub pull request; updates to the pull request will also
-get reflected in the Gerrit change.
-When somebody comments on the change, their comment will be also
-posted in your pull request, so you will get a notification.
-</p>
-
-<p>
-Some things to keep in mind:
-</p>
-
-<ul>
-<li>
-To update the pull request with new code, just push it to the branch; you can either
-add more commits, or rebase and force-push (both styles are accepted).
-</li>
-<li>
-If the request is accepted, all commits will be squashed, and the final
-commit description will be composed by concatenating the pull request's
-title and description.
-The individual commits' descriptions will be discarded.
-See <a href="#commit_messages">Writing good commit messages</a> for some
-suggestions.
-</li>
-<li>
-Gopherbot is unable to sync line-by-line codereview into GitHub: only the
-contents of the overall comment on the request will be synced.
-Remember you can always visit Gerrit to see the fine-grained review.
-</li>
-</ul>
-
-<h2 id="sending_a_change_gerrit">Sending a change via Gerrit</h2>
-
-<p>
-It is not possible to fully sync Gerrit and GitHub, at least at the moment,
-so we recommend learning Gerrit.
-It's different but powerful and familiarity with it will help you understand
-the flow.
-</p>
-
-<h3 id="gerrit_overview">Overview</h3>
-
-<p>
-This is an overview of the overall process:
-</p>
-
-<ul>
-<li>
-<b>Step 1:</b> Clone the source code from <code>go.googlesource.com</code> and
-make sure it's stable by compiling and testing it once.
-
-<p>If you're making a change to the
-<a href="https://go.googlesource.com/go">main Go repository</a>:</p>
-
-<pre>
-$ git clone https://go.googlesource.com/go
-$ cd go/src
-$ ./all.bash # compile and test
-</pre>
-
-<p>
-If you're making a change to one of the golang.org/x/... repositories
-(<a href="https://go.googlesource.com/tools">golang.org/x/tools</a>,
-in this example):
-</p>
-
-<pre>
-$ git clone https://go.googlesource.com/tools
-$ cd tools
-$ go test ./... # compile and test
-</pre>
-</li>
-
-<li>
-<b>Step 2:</b> Prepare changes in a new branch, created from the master branch.
-To commit the changes, use <code>git</code> <code>codereview</code> <code>change</code>; that
-will create or amend a single commit in the branch.
-<pre>
-$ git checkout -b mybranch
-$ [edit files...]
-$ git add [files...]
-$ git codereview change # create commit in the branch
-$ [edit again...]
-$ git add [files...]
-$ git codereview change # amend the existing commit with new changes
-$ [etc.]
-</pre>
-</li>
-
-<li>
-<b>Step 3:</b> Test your changes, either by running the tests in the package
-you edited or by re-running <code>all.bash</code>.
-
-<p>In the main Go repository:</p>
-<pre>
-$ ./all.bash # recompile and test
-</pre>
-
-<p>In a golang.org/x/... repository:</p>
-<pre>
-$ go test ./... # recompile and test
-</pre>
-</li>
-
-<li>
-<b>Step 4:</b> Send the changes for review to Gerrit using <code>git</code>
-<code>codereview</code> <code>mail</code> (which doesn't use e-mail, despite the name).
-<pre>
-$ git codereview mail # send changes to Gerrit
-</pre>
-</li>
-
-<li>
-<b>Step 5:</b> After a review, apply changes to the same single commit
-and mail them to Gerrit again:
-<pre>
-$ [edit files...]
-$ git add [files...]
-$ git codereview change # update same commit
-$ git codereview mail # send to Gerrit again
-</pre>
-</li>
-</ul>
-
-<p>
-The rest of this section describes these steps in more detail.
-</p>
-
-
-<h3 id="checkout_go">Step 1: Clone the source code</h3>
-
-<p>
-In addition to a recent Go installation, you need to have a local copy of the source
-checked out from the correct repository.
-You can check out the Go source repo onto your local file system anywhere
-you want as long as it's outside your <code>GOPATH</code>.
-Clone from <code>go.googlesource.com</code> (not GitHub):
-</p>
-
-<p>Main Go repository:</p>
-<pre>
-$ git clone https://go.googlesource.com/go
-$ cd go
-</pre>
-
-<p>golang.org/x/... repository</p>
-(<a href="https://go.googlesource.com/tools">golang.org/x/tools</a> in this example):
-<pre>
-$ git clone https://go.googlesource.com/tools
-$ cd tools
-</pre>
-
-<h3 id="make_branch">Step 2: Prepare changes in a new branch</h3>
-
-<p>
-Each Go change must be made in a separate branch, created from the master branch.
-You can use
-the normal <code>git</code> commands to create a branch and add changes to the
-staging area:
-</p>
-
-<pre>
-$ git checkout -b mybranch
-$ [edit files...]
-$ git add [files...]
-</pre>
-
-<p>
-To commit changes, instead of <code>git commit</code>, use <code>git codereview change</code>.
-</p>
-
-<pre>
-$ git codereview change
-(open $EDITOR)
-</pre>
-
-<p>
-You can edit the commit description in your favorite editor as usual.
-The <code>git</code> <code>codereview</code> <code>change</code> command
-will automatically add a unique Change-Id line near the bottom.
-That line is used by Gerrit to match successive uploads of the same change.
-Do not edit or delete it.
-A Change-Id looks like this:
-</p>
-
-<pre>
-Change-Id: I2fbdbffb3aab626c4b6f56348861b7909e3e8990
-</pre>
-
-<p>
-The tool also checks that you've
-run <code>go</code> <code>fmt</code> over the source code, and that
-the commit message follows the <a href="#commit_messages">suggested format</a>.
-</p>
-
-<p>
-If you need to edit the files again, you can stage the new changes and
-re-run <code>git</code> <code>codereview</code> <code>change</code>: each subsequent
-run will amend the existing commit while preserving the Change-Id.
-</p>
-
-<p>
-Make sure that you always keep a single commit in each branch.
-If you add more
-commits by mistake, you can use <code>git</code> <code>rebase</code> to
-<a href="https://stackoverflow.com/questions/31668794/squash-all-your-commits-in-one-before-a-pull-request-in-github">squash them together</a>
-into a single one.
-</p>
-
-
-<h3 id="testing">Step 3: Test your changes</h3>
-
-<p>
-You've <a href="code.html">written and tested your code</a>, but
-before sending code out for review, run <i>all the tests for the whole
-tree</i> to make sure the changes don't break other packages or programs.
-</p>
-
-<h4 id="test-gorepo">In the main Go repository</h4>
-
-<p>This can be done by running <code>all.bash</code>:</p>
-
-<pre>
-$ cd go/src
-$ ./all.bash
-</pre>
-
-<p>
-(To build under Windows use <code>all.bat</code>)
-</p>
-
-<p>
-After running for a while and printing a lot of testing output, the command should finish
-by printing,
-</p>
-
-<pre>
-ALL TESTS PASSED
-</pre>
-
-<p>
-You can use <code>make.bash</code> instead of <code>all.bash</code>
-to just build the compiler and the standard library without running the test suite.
-Once the <code>go</code> tool is built, it will be installed as <code>bin/go</code>
-under the directory in which you cloned the Go repository, and you can
-run it directly from there.
-See also
-the section on how to <a href="#quick_test">test your changes quickly</a>.
-</p>
-
-<h4 id="test-xrepo">In the golang.org/x/... repositories</h4>
-
-<p>
-Run the tests for the entire repository
-(<a href="https://go.googlesource.com/tools">golang.org/x/tools</a>,
-in this example):
-</p>
-
-<pre>
-$ cd tools
-$ go test ./...
-</pre>
-
-<p>
-If you're concerned about the build status,
-you can check the <a href="https://build.golang.org">Build Dashboard</a>.
-Test failures may also be caught by the TryBots in code review.
-</p>
-
-<p>
-Some repositories, like
-<a href="https://go.googlesource.com/vscode-go">golang.org/x/vscode-go</a> will
-have different testing infrastructures, so always check the documentation
-for the repository in which you are working. The README file in the root of the
-repository will usually have this information.
-</p>
-
-<h3 id="mail">Step 4: Send changes for review</h3>
-
-<p>
-Once the change is ready and tested over the whole tree, send it for review.
-This is done with the <code>mail</code> sub-command which, despite its name, doesn't
-directly mail anything; it just sends the change to Gerrit:
-</p>
-
-<pre>
-$ git codereview mail
-</pre>
-
-<p>
-Gerrit assigns your change a number and URL, which <code>git</code> <code>codereview</code> <code>mail</code> will print, something like:
-</p>
-
-<pre>
-remote: New Changes:
-remote: https://go-review.googlesource.com/99999 math: improved Sin, Cos and Tan precision for very large arguments
-</pre>
-
-<p>
-If you get an error instead, check the
-<a href="#troubleshooting_mail">Troubleshooting mail errors</a> section.
-</p>
-
-<p>
-If your change relates to an open GitHub issue and you have followed the <a href="#commit_messages">
-suggested commit message format</a>, the issue will be updated in a few minutes by a bot,
-linking your Gerrit change to it in the comments.
-</p>
-
-
-<h3 id="revise">Step 5: Revise changes after a review</h3>
-
-<p>
-Go maintainers will review your code on Gerrit, and you will get notifications via e-mail.
-You can see the review on Gerrit and comment on them there.
-You can also reply
-<a href="https://gerrit-review.googlesource.com/Documentation/intro-user.html#reply-by-email">using e-mail</a>
-if you prefer.
-</p>
-
-<p>
-If you need to revise your change after the review, edit the files in
-the same branch you previously created, add them to the Git staging
-area, and then amend the commit with
-<code>git</code> <code>codereview</code> <code>change</code>:
-</p>
-
-<pre>
-$ git codereview change # amend current commit
-(open $EDITOR)
-$ git codereview mail # send new changes to Gerrit
-</pre>
-
-<p>
-If you don't need to change the commit description, just save and exit from the editor.
-Remember not to touch the special Change-Id line.
-</p>
-
-<p>
-Again, make sure that you always keep a single commit in each branch.
-If you add more
-commits by mistake, you can use <code>git rebase</code> to
-<a href="https://stackoverflow.com/questions/31668794/squash-all-your-commits-in-one-before-a-pull-request-in-github">squash them together</a>
-into a single one.
-</p>
-
-<h2 id="commit_messages">Good commit messages</h2>
-
-<p>
-Commit messages in Go follow a specific set of conventions,
-which we discuss in this section.
-</p>
-
-<p>
-Here is an example of a good one:
-</p>
-
-<pre>
-math: improve Sin, Cos and Tan precision for very large arguments
-
-The existing implementation has poor numerical properties for
-large arguments, so use the McGillicutty algorithm to improve
-accuracy above 1e10.
-
-The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm
-
-Fixes #159
-</pre>
-
-<h3 id="first_line">First line</h3>
-
-<p>
-The first line of the change description is conventionally a short one-line
-summary of the change, prefixed by the primary affected package.
-</p>
-
-<p>
-A rule of thumb is that it should be written so to complete the sentence
-"This change modifies Go to _____."
-That means it does not start with a capital letter, is not a complete sentence,
-and actually summarizes the result of the change.
-</p>
-
-<p>
-Follow the first line by a blank line.
-</p>
-
-<h3 id="main_content">Main content</h3>
-
-<p>
-The rest of the description elaborates and should provide context for the
-change and explain what it does.
-Write in complete sentences with correct punctuation, just like
-for your comments in Go.
-Don't use HTML, Markdown, or any other markup language.
-</p>
-
-<p>
-Add any relevant information, such as benchmark data if the change
-affects performance.
-The <a href="https://godoc.org/golang.org/x/perf/cmd/benchstat">benchstat</a>
-tool is conventionally used to format
-benchmark data for change descriptions.
-</p>
-
-<h3 id="ref_issues">Referencing issues</h3>
-
-<p>
-The special notation "Fixes #12345" associates the change with issue 12345 in the
-<a href="https://golang.org/issue/12345">Go issue tracker</a>.
-When this change is eventually applied, the issue
-tracker will automatically mark the issue as fixed.
-</p>
-
-<p>
-If the change is a partial step towards the resolution of the issue,
-write "Updates #12345" instead.
-This will leave a comment in the issue linking back to the change in
-Gerrit, but it will not close the issue when the change is applied.
-</p>
-
-<p>
-If you are sending a change against a golang.org/x/... repository, you must use
-the fully-qualified syntax supported by GitHub to make sure the change is
-linked to the issue in the main repository, not the x/ repository.
-Most issues are tracked in the main repository's issue tracker.
-The correct form is "Fixes golang/go#159".
-</p>
-
-
-<h2 id="review">The review process</h2>
-
-<p>
-This section explains the review process in detail and how to approach
-reviews after a change has been mailed.
-</p>
-
-
-<h3 id="mistakes">Common beginner mistakes</h3>
-
-<p>
-When a change is sent to Gerrit, it is usually triaged within a few days.
-A maintainer will have a look and provide some initial review that for first-time
-contributors usually focuses on basic cosmetics and common mistakes.
-These include things like:
-</p>
-
-<ul>
-<li>
-Commit message not following the <a href="#commit_messages">suggested
-format</a>.
-</li>
-
-<li>
-The lack of a linked GitHub issue.
-The vast majority of changes
-require a linked issue that describes the bug or the feature that the change
-fixes or implements, and consensus should have been reached on the tracker
-before proceeding with it.
-Gerrit reviews do not discuss the merit of the change,
-just its implementation.
-<br>
-Only trivial or cosmetic changes will be accepted without an associated issue.
-</li>
-
-<li>
-Change sent during the freeze phase of the development cycle, when the tree
-is closed for general changes.
-In this case,
-a maintainer might review the code with a line such as <code>R=go1.12</code>,
-which means that it will be reviewed later when the tree opens for a new
-development window.
-You can add <code>R=go1.XX</code> as a comment yourself
-if you know that it's not the correct time frame for the change.
-</li>
-</ul>
-
-<h3 id="trybots">Trybots</h3>
-
-<p>
-After an initial reading of your change, maintainers will trigger trybots,
-a cluster of servers that will run the full test suite on several different
-architectures.
-Most trybots complete in a few minutes, at which point a link will
-be posted in Gerrit where you can see the results.
-</p>
-
-<p>
-If the trybot run fails, follow the link and check the full logs of the
-platforms on which the tests failed.
-Try to understand what broke, update your patch to fix it, and upload again.
-Maintainers will trigger a new trybot run to see
-if the problem was fixed.
-</p>
-
-<p>
-Sometimes, the tree can be broken on some platforms for a few hours; if
-the failure reported by the trybot doesn't seem related to your patch, go to the
-<a href="https://build.golang.org">Build Dashboard</a> and check if the same
-failure appears in other recent commits on the same platform.
-In this case,
-feel free to write a comment in Gerrit to mention that the failure is
-unrelated to your change, to help maintainers understand the situation.
-</p>
-
-<h3 id="reviews">Reviews</h3>
-
-<p>
-The Go community values very thorough reviews.
-Think of each review comment like a ticket: you are expected to somehow "close" it
-by acting on it, either by implementing the suggestion or convincing the
-reviewer otherwise.
-</p>
-
-<p>
-After you update the change, go through the review comments and make sure
-to reply to every one.
-You can click the "Done" button to reply
-indicating that you've implemented the reviewer's suggestion; otherwise,
-click on "Reply" and explain why you have not, or what you have done instead.
-</p>
-
-<p>
-It is perfectly normal for changes to go through several round of reviews,
-with one or more reviewers making new comments every time
-and then waiting for an updated change before reviewing again.
-This cycle happens even for experienced contributors, so
-don't be discouraged by it.
-</p>
-
-<h3 id="votes">Voting conventions</h3>
-
-<p>
-As they near a decision, reviewers will make a "vote" on your change.
-The Gerrit voting system involves an integer in the range -2 to +2:
-</p>
-
-<ul>
- <li>
- <b>+2</b> The change is approved for being merged.
- Only Go maintainers can cast a +2 vote.
- </li>
- <li>
- <b>+1</b> The change looks good, but either the reviewer is requesting
- minor changes before approving it, or they are not a maintainer and cannot
- approve it, but would like to encourage an approval.
- </li>
- <li>
- <b>-1</b> The change is not good the way it is but might be fixable.
- A -1 vote will always have a comment explaining why the change is unacceptable.
- </li>
- <li>
- <b>-2</b> The change is blocked by a maintainer and cannot be approved.
- Again, there will be a comment explaining the decision.
- </li>
-</ul>
-
-<p>
-At least two maintainers must approve of the change, and at least one
-of those maintainers must +2 the change.
-The second maintainer may cast a vote of Trust+1, meaning that the
-change looks basically OK, but that the maintainer hasn't done the
-detailed review required for a +2 vote.
-</p>
-
-<h3 id="submit">Submitting an approved change</h3>
-
-<p>
-After the code has been +2'ed and Trust+1'ed, an approver will
-apply it to the master branch using the Gerrit user interface.
-This is called "submitting the change".
-</p>
-
-<p>
-The two steps (approving and submitting) are separate because in some cases maintainers
-may want to approve it but not to submit it right away (for instance,
-the tree could be temporarily frozen).
-</p>
-
-<p>
-Submitting a change checks it into the repository.
-The change description will include a link to the code review,
-which will be updated with a link to the change
-in the repository.
-Since the method used to integrate the changes is Git's "Cherry Pick",
-the commit hashes in the repository will be changed by
-the submit operation.
-</p>
-
-<p>
-If your change has been approved for a few days without being
-submitted, feel free to write a comment in Gerrit requesting
-submission.
-</p>
-
-
-<h3 id="more_information">More information</h3>
-
-<p>
-In addition to the information here, the Go community maintains a <a
-href="https://golang.org/wiki/CodeReview">CodeReview</a> wiki page.
-Feel free to contribute to this page as you learn more about the review process.
-</p>
-
-
-
-<h2 id="advanced_topics">Miscellaneous topics</h2>
-
-<p>
-This section collects a number of other comments that are
-outside the issue/edit/code review/submit process itself.
-</p>
-
-
-<h3 id="copyright">Copyright headers</h3>
-
-<p>
-Files in the Go repository don't list author names, both to avoid clutter
-and to avoid having to keep the lists up to date.
-Instead, your name will appear in the
-<a href="https://golang.org/change">change log</a> and in the <a
-href="/CONTRIBUTORS"><code>CONTRIBUTORS</code></a> file and perhaps the <a
-href="/AUTHORS"><code>AUTHORS</code></a> file.
-These files are automatically generated from the commit logs periodically.
-The <a href="/AUTHORS"><code>AUTHORS</code></a> file defines who &ldquo;The Go
-Authors&rdquo;&mdash;the copyright holders&mdash;are.
-</p>
-
-<p>
-New files that you contribute should use the standard copyright header:
-</p>
-
-<pre>
-// Copyright 2021 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.
-</pre>
-
-<p>
-(Use the current year if you're reading this in 2022 or beyond.)
-Files in the repository are copyrighted the year they are added.
-Do not update the copyright year on files that you change.
-</p>
-
-
-
-
-<h3 id="troubleshooting_mail">Troubleshooting mail errors</h3>
-
-<p>
-The most common way that the <code>git</code> <code>codereview</code> <code>mail</code>
-command fails is because the e-mail address in the commit does not match the one
-that you used during <a href="#google_account">the registration process</a>.
-
-<br>
-If you see something like...
-</p>
-
-<pre>
-remote: Processing changes: refs: 1, done
-remote:
-remote: ERROR: In commit ab13517fa29487dcf8b0d48916c51639426c5ee9
-remote: ERROR: author email address XXXXXXXXXXXXXXXXXXX
-remote: ERROR: does not match your user account.
-</pre>
-
-<p>
-you need to configure Git for this repository to use the
-e-mail address that you registered with.
-To change the e-mail address to ensure this doesn't happen again, run:
-</p>
-
-<pre>
-$ git config user.email email@address.com
-</pre>
-
-<p>
-Then change the commit to use this alternative e-mail address with this command:
-</p>
-
-<pre>
-$ git commit --amend --author="Author Name &lt;email@address.com&gt;"
-</pre>
-
-<p>
-Then retry by running:
-</p>
-
-<pre>
-$ git codereview mail
-</pre>
-
-
-<h3 id="quick_test">Quickly testing your changes</h3>
-
-<p>
-Running <code>all.bash</code> for every single change to the code tree
-is burdensome.
-Even though it is strongly suggested to run it before
-sending a change, during the normal development cycle you may want
-to compile and test only the package you are developing.
-</p>
-
-<ul>
-<li>
-In general, you can run <code>make.bash</code> instead of <code>all.bash</code>
-to only rebuild the Go tool chain without running the whole test suite.
-Or you
-can run <code>run.bash</code> to only run the whole test suite without rebuilding
-the tool chain.
-You can think of <code>all.bash</code> as <code>make.bash</code>
-followed by <code>run.bash</code>.
-</li>
-
-<li>
-In this section, we'll call the directory into which you cloned the Go repository <code>$GODIR</code>.
-The <code>go</code> tool built by <code>$GODIR/src/make.bash</code> will be installed
-in <code>$GODIR/bin/go</code> and you
-can invoke it to test your code.
-For instance, if you
-have modified the compiler and you want to test how it affects the
-test suite of your own project, just run <code>go</code> <code>test</code>
-using it:
-
-<pre>
-$ cd &lt;MYPROJECTDIR&gt;
-$ $GODIR/bin/go test
-</pre>
-</li>
-
-<li>
-If you're changing the standard library, you probably don't need to rebuild
-the compiler: you can just run the tests for the package you've changed.
-You can do that either with the Go version you normally use, or
-with the Go compiler built from your clone (which is
-sometimes required because the standard library code you're modifying
-might require a newer version than the stable one you have installed).
-
-<pre>
-$ cd $GODIR/src/crypto/sha1
-$ [make changes...]
-$ $GODIR/bin/go test .
-</pre>
-</li>
-
-<li>
-If you're modifying the compiler itself, you can just recompile
-the <code>compile</code> tool (which is the internal binary invoked
-by <code>go</code> <code>build</code> to compile each single package).
-After that, you will want to test it by compiling or running something.
-
-<pre>
-$ cd $GODIR/src
-$ [make changes...]
-$ $GODIR/bin/go install cmd/compile
-$ $GODIR/bin/go build [something...] # test the new compiler
-$ $GODIR/bin/go run [something...] # test the new compiler
-$ $GODIR/bin/go test [something...] # test the new compiler
-</pre>
-
-The same applies to other internal tools of the Go tool chain,
-such as <code>asm</code>, <code>cover</code>, <code>link</code>, and so on.
-Just recompile and install the tool using <code>go</code>
-<code>install</code> <code>cmd/&lt;TOOL&gt;</code> and then use
-the built Go binary to test it.
-</li>
-
-<li>
-In addition to the standard per-package tests, there is a top-level
-test suite in <code>$GODIR/test</code> that contains
-several black-box and regression tests.
-The test suite is run
-by <code>all.bash</code> but you can also run it manually:
-
-<pre>
-$ cd $GODIR/test
-$ $GODIR/bin/go run run.go
-</pre>
-</ul>
-
-
-<h3 id="cc">Specifying a reviewer / CCing others</h3>
-
-<p>
-Unless explicitly told otherwise, such as in the discussion leading
-up to sending in the change, it's better not to specify a reviewer.
-All changes are automatically CC'ed to the
-<a href="https://groups.google.com/group/golang-codereviews">golang-codereviews@googlegroups.com</a>
-mailing list.
-If this is your first ever change, there may be a moderation
-delay before it appears on the mailing list, to prevent spam.
-</p>
-
-<p>
-You can specify a reviewer or CC interested parties
-using the <code>-r</code> or <code>-cc</code> options.
-Both accept a comma-separated list of e-mail addresses:
-</p>
-
-<pre>
-$ git codereview mail -r joe@golang.org -cc mabel@example.com,math-nuts@swtch.com
-</pre>
-
-
-<h3 id="sync">Synchronize your client</h3>
-
-<p>
-While you were working, others might have submitted changes to the repository.
-To update your local branch, run
-</p>
-
-<pre>
-$ git codereview sync
-</pre>
-
-<p>
-(Under the covers this runs
-<code>git</code> <code>pull</code> <code>-r</code>.)
-</p>
-
-
-<h3 id="download">Reviewing code by others</h3>
-
-<p>
-As part of the review process reviewers can propose changes directly (in the
-GitHub workflow this would be someone else attaching commits to a pull request).
-
-You can import these changes proposed by someone else into your local Git repository.
-On the Gerrit review page, click the "Download ▼" link in the upper right
-corner, copy the "Checkout" command and run it from your local Git repo.
-It will look something like this:
-</p>
-
-<pre>
-$ git fetch https://go.googlesource.com/review refs/changes/21/13245/1 &amp;&amp; git checkout FETCH_HEAD
-</pre>
-
-<p>
-To revert, change back to the branch you were working in.
-</p>
-
-
-<h3 id="git-config">Set up git aliases</h3>
-
-<p>
-The <code>git-codereview</code> command can be run directly from the shell
-by typing, for instance,
-</p>
-
-<pre>
-$ git codereview sync
-</pre>
-
-<p>
-but it is more convenient to set up aliases for <code>git-codereview</code>'s own
-subcommands, so that the above becomes,
-</p>
-
-<pre>
-$ git sync
-</pre>
-
-<p>
-The <code>git-codereview</code> subcommands have been chosen to be distinct from
-Git's own, so it's safe to define these aliases.
-To install them, copy this text into your
-Git configuration file (usually <code>.gitconfig</code> in your home directory):
-</p>
-
-<pre>
-[alias]
- change = codereview change
- gofmt = codereview gofmt
- mail = codereview mail
- pending = codereview pending
- submit = codereview submit
- sync = codereview sync
-</pre>
-
-
-<h3 id="multiple_changes">Sending multiple dependent changes</h3>
-
-<p>
-Advanced users may want to stack up related commits in a single branch.
-Gerrit allows for changes to be dependent on each other, forming such a dependency chain.
-Each change will need to be approved and submitted separately but the dependency
-will be visible to reviewers.
-</p>
-
-<p>
-To send out a group of dependent changes, keep each change as a different commit under
-the same branch, and then run:
-</p>
-
-<pre>
-$ git codereview mail HEAD
-</pre>
-
-<p>
-Make sure to explicitly specify <code>HEAD</code>, which is usually not required when sending
-single changes. More details can be found in the <a href="https://pkg.go.dev/golang.org/x/review/git-codereview?tab=doc#hdr-Multiple_Commit_Work_Branches">git-codereview documentation</a>.
-</p>
diff --git a/doc/debugging_with_gdb.html b/doc/debugging_with_gdb.html
deleted file mode 100644
index e1fb292f06..0000000000
--- a/doc/debugging_with_gdb.html
+++ /dev/null
@@ -1,554 +0,0 @@
-<!--{
- "Title": "Debugging Go Code with GDB",
- "Path": "/doc/gdb"
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<i>
-<p>
-The following instructions apply to the standard toolchain
-(the <code>gc</code> Go compiler and tools).
-Gccgo has native gdb support.
-</p>
-<p>
-Note that
-<a href="https://github.com/go-delve/delve">Delve</a> is a better
-alternative to GDB when debugging Go programs built with the standard
-toolchain. It understands the Go runtime, data structures, and
-expressions better than GDB. Delve currently supports Linux, OSX,
-and Windows on <code>amd64</code>.
-For the most up-to-date list of supported platforms, please see
-<a href="https://github.com/go-delve/delve/tree/master/Documentation/installation">
- the Delve documentation</a>.
-</p>
-</i>
-
-<p>
-GDB does not understand Go programs well.
-The stack management, threading, and runtime contain aspects that differ
-enough from the execution model GDB expects that they can confuse
-the debugger and cause incorrect results even when the program is
-compiled with gccgo.
-As a consequence, although GDB can be useful in some situations (e.g.,
-debugging Cgo code, or debugging the runtime itself), it is not
-a reliable debugger for Go programs, particularly heavily concurrent
-ones. Moreover, it is not a priority for the Go project to address
-these issues, which are difficult.
-</p>
-
-<p>
-In short, the instructions below should be taken only as a guide to how
-to use GDB when it works, not as a guarantee of success.
-
-Besides this overview you might want to consult the
-<a href="https://sourceware.org/gdb/current/onlinedocs/gdb/">GDB manual</a>.
-</p>
-
-<p>
-</p>
-
-<h2 id="Introduction">Introduction</h2>
-
-<p>
-When you compile and link your Go programs with the <code>gc</code> toolchain
-on Linux, macOS, FreeBSD or NetBSD, the resulting binaries contain DWARFv4
-debugging information that recent versions (&ge;7.5) of the GDB debugger can
-use to inspect a live process or a core dump.
-</p>
-
-<p>
-Pass the <code>'-w'</code> flag to the linker to omit the debug information
-(for example, <code>go</code> <code>build</code> <code>-ldflags=-w</code> <code>prog.go</code>).
-</p>
-
-<p>
-The code generated by the <code>gc</code> compiler includes inlining of
-function invocations and registerization of variables. These optimizations
-can sometimes make debugging with <code>gdb</code> harder.
-If you find that you need to disable these optimizations,
-build your program using <code>go</code> <code>build</code> <code>-gcflags=all="-N -l"</code>.
-</p>
-
-<p>
-If you want to use gdb to inspect a core dump, you can trigger a dump
-on a program crash, on systems that permit it, by setting
-<code>GOTRACEBACK=crash</code> in the environment (see the
-<a href="/pkg/runtime/#hdr-Environment_Variables"> runtime package
-documentation</a> for more info).
-</p>
-
-<h3 id="Common_Operations">Common Operations</h3>
-
-<ul>
-<li>
-Show file and line number for code, set breakpoints and disassemble:
-<pre>(gdb) <b>list</b>
-(gdb) <b>list <i>line</i></b>
-(gdb) <b>list <i>file.go</i>:<i>line</i></b>
-(gdb) <b>break <i>line</i></b>
-(gdb) <b>break <i>file.go</i>:<i>line</i></b>
-(gdb) <b>disas</b></pre>
-</li>
-<li>
-Show backtraces and unwind stack frames:
-<pre>(gdb) <b>bt</b>
-(gdb) <b>frame <i>n</i></b></pre>
-</li>
-<li>
-Show the name, type and location on the stack frame of local variables,
-arguments and return values:
-<pre>(gdb) <b>info locals</b>
-(gdb) <b>info args</b>
-(gdb) <b>p variable</b>
-(gdb) <b>whatis variable</b></pre>
-</li>
-<li>
-Show the name, type and location of global variables:
-<pre>(gdb) <b>info variables <i>regexp</i></b></pre>
-</li>
-</ul>
-
-
-<h3 id="Go_Extensions">Go Extensions</h3>
-
-<p>
-A recent extension mechanism to GDB allows it to load extension scripts for a
-given binary. The toolchain uses this to extend GDB with a handful of
-commands to inspect internals of the runtime code (such as goroutines) and to
-pretty print the built-in map, slice and channel types.
-</p>
-
-<ul>
-<li>
-Pretty printing a string, slice, map, channel or interface:
-<pre>(gdb) <b>p <i>var</i></b></pre>
-</li>
-<li>
-A $len() and $cap() function for strings, slices and maps:
-<pre>(gdb) <b>p $len(<i>var</i>)</b></pre>
-</li>
-<li>
-A function to cast interfaces to their dynamic types:
-<pre>(gdb) <b>p $dtype(<i>var</i>)</b>
-(gdb) <b>iface <i>var</i></b></pre>
-<p class="detail"><b>Known issue:</b> GDB can’t automatically find the dynamic
-type of an interface value if its long name differs from its short name
-(annoying when printing stacktraces, the pretty printer falls back to printing
-the short type name and a pointer).</p>
-</li>
-<li>
-Inspecting goroutines:
-<pre>(gdb) <b>info goroutines</b>
-(gdb) <b>goroutine <i>n</i> <i>cmd</i></b>
-(gdb) <b>help goroutine</b></pre>
-For example:
-<pre>(gdb) <b>goroutine 12 bt</b></pre>
-You can inspect all goroutines by passing <code>all</code> instead of a specific goroutine's ID.
-For example:
-<pre>(gdb) <b>goroutine all bt</b></pre>
-</li>
-</ul>
-
-<p>
-If you'd like to see how this works, or want to extend it, take a look at <a
-href="/src/runtime/runtime-gdb.py">src/runtime/runtime-gdb.py</a> in
-the Go source distribution. It depends on some special magic types
-(<code>hash&lt;T,U&gt;</code>) and variables (<code>runtime.m</code> and
-<code>runtime.g</code>) that the linker
-(<a href="/src/cmd/link/internal/ld/dwarf.go">src/cmd/link/internal/ld/dwarf.go</a>) ensures are described in
-the DWARF code.
-</p>
-
-<p>
-If you're interested in what the debugging information looks like, run
-<code>objdump</code> <code>-W</code> <code>a.out</code> and browse through the <code>.debug_*</code>
-sections.
-</p>
-
-
-<h3 id="Known_Issues">Known Issues</h3>
-
-<ol>
-<li>String pretty printing only triggers for type string, not for types derived
-from it.</li>
-<li>Type information is missing for the C parts of the runtime library.</li>
-<li>GDB does not understand Go’s name qualifications and treats
-<code>"fmt.Print"</code> as an unstructured literal with a <code>"."</code>
-that needs to be quoted. It objects even more strongly to method names of
-the form <code>pkg.(*MyType).Meth</code>.
-<li>As of Go 1.11, debug information is compressed by default.
-Older versions of gdb, such as the one available by default on MacOS,
-do not understand the compression.
-You can generate uncompressed debug information by using <code>go
-build -ldflags=-compressdwarf=false</code>.
-(For convenience you can put the <code>-ldflags</code> option in
-the <a href="/cmd/go/#hdr-Environment_variables"><code>GOFLAGS</code>
-environment variable</a> so that you don't have to specify it each time.)
-</li>
-</ol>
-
-<h2 id="Tutorial">Tutorial</h2>
-
-<p>
-In this tutorial we will inspect the binary of the
-<a href="/pkg/regexp/">regexp</a> package's unit tests. To build the binary,
-change to <code>$GOROOT/src/regexp</code> and run <code>go</code> <code>test</code> <code>-c</code>.
-This should produce an executable file named <code>regexp.test</code>.
-</p>
-
-
-<h3 id="Getting_Started">Getting Started</h3>
-
-<p>
-Launch GDB, debugging <code>regexp.test</code>:
-</p>
-
-<pre>
-$ <b>gdb regexp.test</b>
-GNU gdb (GDB) 7.2-gg8
-Copyright (C) 2010 Free Software Foundation, Inc.
-License GPLv 3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
-Type "show copying" and "show warranty" for licensing/warranty details.
-This GDB was configured as "x86_64-linux".
-
-Reading symbols from /home/user/go/src/regexp/regexp.test...
-done.
-Loading Go Runtime support.
-(gdb)
-</pre>
-
-<p>
-The message "Loading Go Runtime support" means that GDB loaded the
-extension from <code>$GOROOT/src/runtime/runtime-gdb.py</code>.
-</p>
-
-<p>
-To help GDB find the Go runtime sources and the accompanying support script,
-pass your <code>$GOROOT</code> with the <code>'-d'</code> flag:
-</p>
-
-<pre>
-$ <b>gdb regexp.test -d $GOROOT</b>
-</pre>
-
-<p>
-If for some reason GDB still can't find that directory or that script, you can load
-it by hand by telling gdb (assuming you have the go sources in
-<code>~/go/</code>):
-</p>
-
-<pre>
-(gdb) <b>source ~/go/src/runtime/runtime-gdb.py</b>
-Loading Go Runtime support.
-</pre>
-
-<h3 id="Inspecting_the_source">Inspecting the source</h3>
-
-<p>
-Use the <code>"l"</code> or <code>"list"</code> command to inspect source code.
-</p>
-
-<pre>
-(gdb) <b>l</b>
-</pre>
-
-<p>
-List a specific part of the source parameterizing <code>"list"</code> with a
-function name (it must be qualified with its package name).
-</p>
-
-<pre>
-(gdb) <b>l main.main</b>
-</pre>
-
-<p>
-List a specific file and line number:
-</p>
-
-<pre>
-(gdb) <b>l regexp.go:1</b>
-(gdb) <i># Hit enter to repeat last command. Here, this lists next 10 lines.</i>
-</pre>
-
-
-<h3 id="Naming">Naming</h3>
-
-<p>
-Variable and function names must be qualified with the name of the packages
-they belong to. The <code>Compile</code> function from the <code>regexp</code>
-package is known to GDB as <code>'regexp.Compile'</code>.
-</p>
-
-<p>
-Methods must be qualified with the name of their receiver types. For example,
-the <code>*Regexp</code> type’s <code>String</code> method is known as
-<code>'regexp.(*Regexp).String'</code>.
-</p>
-
-<p>
-Variables that shadow other variables are magically suffixed with a number in the debug info.
-Variables referenced by closures will appear as pointers magically prefixed with '&amp;'.
-</p>
-
-<h3 id="Setting_breakpoints">Setting breakpoints</h3>
-
-<p>
-Set a breakpoint at the <code>TestFind</code> function:
-</p>
-
-<pre>
-(gdb) <b>b 'regexp.TestFind'</b>
-Breakpoint 1 at 0x424908: file /home/user/go/src/regexp/find_test.go, line 148.
-</pre>
-
-<p>
-Run the program:
-</p>
-
-<pre>
-(gdb) <b>run</b>
-Starting program: /home/user/go/src/regexp/regexp.test
-
-Breakpoint 1, regexp.TestFind (t=0xf8404a89c0) at /home/user/go/src/regexp/find_test.go:148
-148 func TestFind(t *testing.T) {
-</pre>
-
-<p>
-Execution has paused at the breakpoint.
-See which goroutines are running, and what they're doing:
-</p>
-
-<pre>
-(gdb) <b>info goroutines</b>
- 1 waiting runtime.gosched
-* 13 running runtime.goexit
-</pre>
-
-<p>
-the one marked with the <code>*</code> is the current goroutine.
-</p>
-
-<h3 id="Inspecting_the_stack">Inspecting the stack</h3>
-
-<p>
-Look at the stack trace for where we’ve paused the program:
-</p>
-
-<pre>
-(gdb) <b>bt</b> <i># backtrace</i>
-#0 regexp.TestFind (t=0xf8404a89c0) at /home/user/go/src/regexp/find_test.go:148
-#1 0x000000000042f60b in testing.tRunner (t=0xf8404a89c0, test=0x573720) at /home/user/go/src/testing/testing.go:156
-#2 0x000000000040df64 in runtime.initdone () at /home/user/go/src/runtime/proc.c:242
-#3 0x000000f8404a89c0 in ?? ()
-#4 0x0000000000573720 in ?? ()
-#5 0x0000000000000000 in ?? ()
-</pre>
-
-<p>
-The other goroutine, number 1, is stuck in <code>runtime.gosched</code>, blocked on a channel receive:
-</p>
-
-<pre>
-(gdb) <b>goroutine 1 bt</b>
-#0 0x000000000040facb in runtime.gosched () at /home/user/go/src/runtime/proc.c:873
-#1 0x00000000004031c9 in runtime.chanrecv (c=void, ep=void, selected=void, received=void)
- at /home/user/go/src/runtime/chan.c:342
-#2 0x0000000000403299 in runtime.chanrecv1 (t=void, c=void) at/home/user/go/src/runtime/chan.c:423
-#3 0x000000000043075b in testing.RunTests (matchString={void (struct string, struct string, bool *, error *)}
- 0x7ffff7f9ef60, tests= []testing.InternalTest = {...}) at /home/user/go/src/testing/testing.go:201
-#4 0x00000000004302b1 in testing.Main (matchString={void (struct string, struct string, bool *, error *)}
- 0x7ffff7f9ef80, tests= []testing.InternalTest = {...}, benchmarks= []testing.InternalBenchmark = {...})
-at /home/user/go/src/testing/testing.go:168
-#5 0x0000000000400dc1 in main.main () at /home/user/go/src/regexp/_testmain.go:98
-#6 0x00000000004022e7 in runtime.mainstart () at /home/user/go/src/runtime/amd64/asm.s:78
-#7 0x000000000040ea6f in runtime.initdone () at /home/user/go/src/runtime/proc.c:243
-#8 0x0000000000000000 in ?? ()
-</pre>
-
-<p>
-The stack frame shows we’re currently executing the <code>regexp.TestFind</code> function, as expected.
-</p>
-
-<pre>
-(gdb) <b>info frame</b>
-Stack level 0, frame at 0x7ffff7f9ff88:
- rip = 0x425530 in regexp.TestFind (/home/user/go/src/regexp/find_test.go:148);
- saved rip 0x430233
- called by frame at 0x7ffff7f9ffa8
- source language minimal.
- Arglist at 0x7ffff7f9ff78, args: t=0xf840688b60
- Locals at 0x7ffff7f9ff78, Previous frame's sp is 0x7ffff7f9ff88
- Saved registers:
- rip at 0x7ffff7f9ff80
-</pre>
-
-<p>
-The command <code>info</code> <code>locals</code> lists all variables local to the function and their values, but is a bit
-dangerous to use, since it will also try to print uninitialized variables. Uninitialized slices may cause gdb to try
-to print arbitrary large arrays.
-</p>
-
-<p>
-The function’s arguments:
-</p>
-
-<pre>
-(gdb) <b>info args</b>
-t = 0xf840688b60
-</pre>
-
-<p>
-When printing the argument, notice that it’s a pointer to a
-<code>Regexp</code> value. Note that GDB has incorrectly put the <code>*</code>
-on the right-hand side of the type name and made up a 'struct' keyword, in traditional C style.
-</p>
-
-<pre>
-(gdb) <b>p re</b>
-(gdb) p t
-$1 = (struct testing.T *) 0xf840688b60
-(gdb) p t
-$1 = (struct testing.T *) 0xf840688b60
-(gdb) p *t
-$2 = {errors = "", failed = false, ch = 0xf8406f5690}
-(gdb) p *t-&gt;ch
-$3 = struct hchan&lt;*testing.T&gt;
-</pre>
-
-<p>
-That <code>struct</code> <code>hchan&lt;*testing.T&gt;</code> is the
-runtime-internal representation of a channel. It is currently empty,
-or gdb would have pretty-printed its contents.
-</p>
-
-<p>
-Stepping forward:
-</p>
-
-<pre>
-(gdb) <b>n</b> <i># execute next line</i>
-149 for _, test := range findTests {
-(gdb) <i># enter is repeat</i>
-150 re := MustCompile(test.pat)
-(gdb) <b>p test.pat</b>
-$4 = ""
-(gdb) <b>p re</b>
-$5 = (struct regexp.Regexp *) 0xf84068d070
-(gdb) <b>p *re</b>
-$6 = {expr = "", prog = 0xf840688b80, prefix = "", prefixBytes = []uint8, prefixComplete = true,
- prefixRune = 0, cond = 0 '\000', numSubexp = 0, longest = false, mu = {state = 0, sema = 0},
- machine = []*regexp.machine}
-(gdb) <b>p *re->prog</b>
-$7 = {Inst = []regexp/syntax.Inst = {{Op = 5 '\005', Out = 0, Arg = 0, Rune = []int}, {Op =
- 6 '\006', Out = 2, Arg = 0, Rune = []int}, {Op = 4 '\004', Out = 0, Arg = 0, Rune = []int}},
- Start = 1, NumCap = 2}
-</pre>
-
-
-<p>
-We can step into the <code>String</code>function call with <code>"s"</code>:
-</p>
-
-<pre>
-(gdb) <b>s</b>
-regexp.(*Regexp).String (re=0xf84068d070, noname=void) at /home/user/go/src/regexp/regexp.go:97
-97 func (re *Regexp) String() string {
-</pre>
-
-<p>
-Get a stack trace to see where we are:
-</p>
-
-<pre>
-(gdb) <b>bt</b>
-#0 regexp.(*Regexp).String (re=0xf84068d070, noname=void)
- at /home/user/go/src/regexp/regexp.go:97
-#1 0x0000000000425615 in regexp.TestFind (t=0xf840688b60)
- at /home/user/go/src/regexp/find_test.go:151
-#2 0x0000000000430233 in testing.tRunner (t=0xf840688b60, test=0x5747b8)
- at /home/user/go/src/testing/testing.go:156
-#3 0x000000000040ea6f in runtime.initdone () at /home/user/go/src/runtime/proc.c:243
-....
-</pre>
-
-<p>
-Look at the source code:
-</p>
-
-<pre>
-(gdb) <b>l</b>
-92 mu sync.Mutex
-93 machine []*machine
-94 }
-95
-96 // String returns the source text used to compile the regular expression.
-97 func (re *Regexp) String() string {
-98 return re.expr
-99 }
-100
-101 // Compile parses a regular expression and returns, if successful,
-</pre>
-
-<h3 id="Pretty_Printing">Pretty Printing</h3>
-
-<p>
-GDB's pretty printing mechanism is triggered by regexp matches on type names. An example for slices:
-</p>
-
-<pre>
-(gdb) <b>p utf</b>
-$22 = []uint8 = {0 '\000', 0 '\000', 0 '\000', 0 '\000'}
-</pre>
-
-<p>
-Since slices, arrays and strings are not C pointers, GDB can't interpret the subscripting operation for you, but
-you can look inside the runtime representation to do that (tab completion helps here):
-</p>
-<pre>
-
-(gdb) <b>p slc</b>
-$11 = []int = {0, 0}
-(gdb) <b>p slc-&gt;</b><i>&lt;TAB&gt;</i>
-array slc len
-(gdb) <b>p slc->array</b>
-$12 = (int *) 0xf84057af00
-(gdb) <b>p slc->array[1]</b>
-$13 = 0</pre>
-
-
-
-<p>
-The extension functions $len and $cap work on strings, arrays and slices:
-</p>
-
-<pre>
-(gdb) <b>p $len(utf)</b>
-$23 = 4
-(gdb) <b>p $cap(utf)</b>
-$24 = 4
-</pre>
-
-<p>
-Channels and maps are 'reference' types, which gdb shows as pointers to C++-like types <code>hash&lt;int,string&gt;*</code>. Dereferencing will trigger prettyprinting
-</p>
-
-<p>
-Interfaces are represented in the runtime as a pointer to a type descriptor and a pointer to a value. The Go GDB runtime extension decodes this and automatically triggers pretty printing for the runtime type. The extension function <code>$dtype</code> decodes the dynamic type for you (examples are taken from a breakpoint at <code>regexp.go</code> line 293.)
-</p>
-
-<pre>
-(gdb) <b>p i</b>
-$4 = {str = "cbb"}
-(gdb) <b>whatis i</b>
-type = regexp.input
-(gdb) <b>p $dtype(i)</b>
-$26 = (struct regexp.inputBytes *) 0xf8400b4930
-(gdb) <b>iface i</b>
-regexp.input: struct regexp.inputBytes *
-</pre>
diff --git a/doc/diagnostics.html b/doc/diagnostics.html
deleted file mode 100644
index 438cdce45f..0000000000
--- a/doc/diagnostics.html
+++ /dev/null
@@ -1,472 +0,0 @@
-<!--{
- "Title": "Diagnostics",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<h2 id="introduction">Introduction</h2>
-
-<p>
-The Go ecosystem provides a large suite of APIs and tools to
-diagnose logic and performance problems in Go programs. This page
-summarizes the available tools and helps Go users pick the right one
-for their specific problem.
-</p>
-
-<p>
-Diagnostics solutions can be categorized into the following groups:
-</p>
-
-<ul>
-<li><strong>Profiling</strong>: Profiling tools analyze the complexity and costs of a
-Go program such as its memory usage and frequently called
-functions to identify the expensive sections of a Go program.</li>
-<li><strong>Tracing</strong>: Tracing is a way to instrument code to analyze latency
-throughout the lifecycle of a call or user request. Traces provide an
-overview of how much latency each component contributes to the overall
-latency in a system. Traces can span multiple Go processes.</li>
-<li><strong>Debugging</strong>: Debugging allows us to pause a Go program and examine
-its execution. Program state and flow can be verified with debugging.</li>
-<li><strong>Runtime statistics and events</strong>: Collection and analysis of runtime stats and events
-provides a high-level overview of the health of Go programs. Spikes/dips of metrics
-helps us to identify changes in throughput, utilization, and performance.</li>
-</ul>
-
-<p>
-Note: Some diagnostics tools may interfere with each other. For example, precise
-memory profiling skews CPU profiles and goroutine blocking profiling affects scheduler
-trace. Use tools in isolation to get more precise info.
-</p>
-
-<h2 id="profiling">Profiling</h2>
-
-<p>
-Profiling is useful for identifying expensive or frequently called sections
-of code. The Go runtime provides <a href="https://golang.org/pkg/runtime/pprof/">
-profiling data</a> in the format expected by the
-<a href="https://github.com/google/pprof/blob/master/doc/README.md">pprof visualization tool</a>.
-The profiling data can be collected during testing
-via <code>go</code> <code>test</code> or endpoints made available from the <a href="/pkg/net/http/pprof/">
-net/http/pprof</a> package. Users need to collect the profiling data and use pprof tools to filter
-and visualize the top code paths.
-</p>
-
-<p>Predefined profiles provided by the <a href="/pkg/runtime/pprof">runtime/pprof</a> package:</p>
-
-<ul>
-<li>
-<strong>cpu</strong>: CPU profile determines where a program spends
-its time while actively consuming CPU cycles (as opposed to while sleeping or waiting for I/O).
-</li>
-<li>
-<strong>heap</strong>: Heap profile reports memory allocation samples;
-used to monitor current and historical memory usage, and to check for memory leaks.
-</li>
-<li>
-<strong>threadcreate</strong>: Thread creation profile reports the sections
-of the program that lead the creation of new OS threads.
-</li>
-<li>
-<strong>goroutine</strong>: Goroutine profile reports the stack traces of all current goroutines.
-</li>
-<li>
-<strong>block</strong>: Block profile shows where goroutines block waiting on synchronization
-primitives (including timer channels). Block profile is not enabled by default;
-use <code>runtime.SetBlockProfileRate</code> to enable it.
-</li>
-<li>
-<strong>mutex</strong>: Mutex profile reports the lock contentions. When you think your
-CPU is not fully utilized due to a mutex contention, use this profile. Mutex profile
-is not enabled by default, see <code>runtime.SetMutexProfileFraction</code> to enable it.
-</li>
-</ul>
-
-
-<p><strong>What other profilers can I use to profile Go programs?</strong></p>
-
-<p>
-On Linux, <a href="https://perf.wiki.kernel.org/index.php/Tutorial">perf tools</a>
-can be used for profiling Go programs. Perf can profile
-and unwind cgo/SWIG code and kernel, so it can be useful to get insights into
-native/kernel performance bottlenecks. On macOS,
-<a href="https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/">Instruments</a>
-suite can be used profile Go programs.
-</p>
-
-<p><strong>Can I profile my production services?</strong></p>
-
-<p>Yes. It is safe to profile programs in production, but enabling
-some profiles (e.g. the CPU profile) adds cost. You should expect to
-see performance downgrade. The performance penalty can be estimated
-by measuring the overhead of the profiler before turning it on in
-production.
-</p>
-
-<p>
-You may want to periodically profile your production services.
-Especially in a system with many replicas of a single process, selecting
-a random replica periodically is a safe option.
-Select a production process, profile it for
-X seconds for every Y seconds and save the results for visualization and
-analysis; then repeat periodically. Results may be manually and/or automatically
-reviewed to find problems.
-Collection of profiles can interfere with each other,
-so it is recommended to collect only a single profile at a time.
-</p>
-
-<p>
-<strong>What are the best ways to visualize the profiling data?</strong>
-</p>
-
-<p>
-The Go tools provide text, graph, and <a href="http://valgrind.org/docs/manual/cl-manual.html">callgrind</a>
-visualization of the profile data using
-<code><a href="https://github.com/google/pprof/blob/master/doc/README.md">go tool pprof</a></code>.
-Read <a href="https://blog.golang.org/profiling-go-programs">Profiling Go programs</a>
-to see them in action.
-</p>
-
-<p>
-<img width="800" src="https://storage.googleapis.com/golangorg-assets/pprof-text.png">
-<br>
-<small>Listing of the most expensive calls as text.</small>
-</p>
-
-<p>
-<img width="800" src="https://storage.googleapis.com/golangorg-assets/pprof-dot.png">
-<br>
-<small>Visualization of the most expensive calls as a graph.</small>
-</p>
-
-<p>Weblist view displays the expensive parts of the source line by line in
-an HTML page. In the following example, 530ms is spent in the
-<code>runtime.concatstrings</code> and cost of each line is presented
-in the listing.</p>
-
-<p>
-<img width="800" src="https://storage.googleapis.com/golangorg-assets/pprof-weblist.png">
-<br>
-<small>Visualization of the most expensive calls as weblist.</small>
-</p>
-
-<p>
-Another way to visualize profile data is a <a href="http://www.brendangregg.com/flamegraphs.html">flame graph</a>.
-Flame graphs allow you to move in a specific ancestry path, so you can zoom
-in/out of specific sections of code.
-The <a href="https://github.com/google/pprof">upstream pprof</a>
-has support for flame graphs.
-</p>
-
-<p>
-<img width="800" src="https://storage.googleapis.com/golangorg-assets/flame.png">
-<br>
-<small>Flame graphs offers visualization to spot the most expensive code-paths.</small>
-</p>
-
-<p><strong>Am I restricted to the built-in profiles?</strong></p>
-
-<p>
-Additionally to what is provided by the runtime, Go users can create
-their custom profiles via <a href="/pkg/runtime/pprof/#Profile">pprof.Profile</a>
-and use the existing tools to examine them.
-</p>
-
-<p><strong>Can I serve the profiler handlers (/debug/pprof/...) on a different path and port?</strong></p>
-
-<p>
-Yes. The <code>net/http/pprof</code> package registers its handlers to the default
-mux by default, but you can also register them yourself by using the handlers
-exported from the package.
-</p>
-
-<p>
-For example, the following example will serve the pprof.Profile
-handler on :7777 at /custom_debug_path/profile:
-</p>
-
-<p>
-<pre>
-package main
-
-import (
- "log"
- "net/http"
- "net/http/pprof"
-)
-
-func main() {
- mux := http.NewServeMux()
- mux.HandleFunc("/custom_debug_path/profile", pprof.Profile)
- log.Fatal(http.ListenAndServe(":7777", mux))
-}
-</pre>
-</p>
-
-<h2 id="tracing">Tracing</h2>
-
-<p>
-Tracing is a way to instrument code to analyze latency throughout the
-lifecycle of a chain of calls. Go provides
-<a href="https://godoc.org/golang.org/x/net/trace">golang.org/x/net/trace</a>
-package as a minimal tracing backend per Go node and provides a minimal
-instrumentation library with a simple dashboard. Go also provides
-an execution tracer to trace the runtime events within an interval.
-</p>
-
-<p>Tracing enables us to:</p>
-
-<ul>
-<li>Instrument and analyze application latency in a Go process.</li>
-<li>Measure the cost of specific calls in a long chain of calls.</li>
-<li>Figure out the utilization and performance improvements.
-Bottlenecks are not always obvious without tracing data.</li>
-</ul>
-
-<p>
-In monolithic systems, it's relatively easy to collect diagnostic data
-from the building blocks of a program. All modules live within one
-process and share common resources to report logs, errors, and other
-diagnostic information. Once your system grows beyond a single process and
-starts to become distributed, it becomes harder to follow a call starting
-from the front-end web server to all of its back-ends until a response is
-returned back to the user. This is where distributed tracing plays a big
-role to instrument and analyze your production systems.
-</p>
-
-<p>
-Distributed tracing is a way to instrument code to analyze latency throughout
-the lifecycle of a user request. When a system is distributed and when
-conventional profiling and debugging tools don’t scale, you might want
-to use distributed tracing tools to analyze the performance of your user
-requests and RPCs.
-</p>
-
-<p>Distributed tracing enables us to:</p>
-
-<ul>
-<li>Instrument and profile application latency in a large system.</li>
-<li>Track all RPCs within the lifecycle of a user request and see integration issues
-that are only visible in production.</li>
-<li>Figure out performance improvements that can be applied to our systems.
-Many bottlenecks are not obvious before the collection of tracing data.</li>
-</ul>
-
-<p>The Go ecosystem provides various distributed tracing libraries per tracing system
-and backend-agnostic ones.</p>
-
-
-<p><strong>Is there a way to automatically intercept each function call and create traces?</strong></p>
-
-<p>
-Go doesn’t provide a way to automatically intercept every function call and create
-trace spans. You need to manually instrument your code to create, end, and annotate spans.
-</p>
-
-<p><strong>How should I propagate trace headers in Go libraries?</strong></p>
-
-<p>
-You can propagate trace identifiers and tags in the
-<a href="/pkg/context#Context"><code>context.Context</code></a>.
-There is no canonical trace key or common representation of trace headers
-in the industry yet. Each tracing provider is responsible for providing propagation
-utilities in their Go libraries.
-</p>
-
-<p>
-<strong>What other low-level events from the standard library or
-runtime can be included in a trace?</strong>
-</p>
-
-<p>
-The standard library and runtime are trying to expose several additional APIs
-to notify on low level internal events. For example,
-<a href="/pkg/net/http/httptrace#ClientTrace"><code>httptrace.ClientTrace</code></a>
-provides APIs to follow low-level events in the life cycle of an outgoing request.
-There is an ongoing effort to retrieve low-level runtime events from
-the runtime execution tracer and allow users to define and record their user events.
-</p>
-
-<h2 id="debugging">Debugging</h2>
-
-<p>
-Debugging is the process of identifying why a program misbehaves.
-Debuggers allow us to understand a program’s execution flow and current state.
-There are several styles of debugging; this section will only focus on attaching
-a debugger to a program and core dump debugging.
-</p>
-
-<p>Go users mostly use the following debuggers:</p>
-
-<ul>
-<li>
-<a href="https://github.com/derekparker/delve">Delve</a>:
-Delve is a debugger for the Go programming language. It has
-support for Go’s runtime concepts and built-in types. Delve is
-trying to be a fully featured reliable debugger for Go programs.
-</li>
-<li>
-<a href="https://golang.org/doc/gdb">GDB</a>:
-Go provides GDB support via the standard Go compiler and Gccgo.
-The stack management, threading, and runtime contain aspects that differ
-enough from the execution model GDB expects that they can confuse the
-debugger, even when the program is compiled with gccgo. Even though
-GDB can be used to debug Go programs, it is not ideal and may
-create confusion.
-</li>
-</ul>
-
-<p><strong>How well do debuggers work with Go programs?</strong></p>
-
-<p>
-The <code>gc</code> compiler performs optimizations such as
-function inlining and variable registerization. These optimizations
-sometimes make debugging with debuggers harder. There is an ongoing
-effort to improve the quality of the DWARF information generated for
-optimized binaries. Until those improvements are available, we recommend
-disabling optimizations when building the code being debugged. The following
-command builds a package with no compiler optimizations:
-
-<p>
-<pre>
-$ go build -gcflags=all="-N -l"
-</pre>
-</p>
-
-As part of the improvement effort, Go 1.10 introduced a new compiler
-flag <code>-dwarflocationlists</code>. The flag causes the compiler to
-add location lists that helps debuggers work with optimized binaries.
-The following command builds a package with optimizations but with
-the DWARF location lists:
-
-<p>
-<pre>
-$ go build -gcflags="-dwarflocationlists=true"
-</pre>
-</p>
-
-<p><strong>What’s the recommended debugger user interface?</strong></p>
-
-<p>
-Even though both delve and gdb provides CLIs, most editor integrations
-and IDEs provides debugging-specific user interfaces.
-</p>
-
-<p><strong>Is it possible to do postmortem debugging with Go programs?</strong></p>
-
-<p>
-A core dump file is a file that contains the memory dump of a running
-process and its process status. It is primarily used for post-mortem
-debugging of a program and to understand its state
-while it is still running. These two cases make debugging of core
-dumps a good diagnostic aid to postmortem and analyze production
-services. It is possible to obtain core files from Go programs and
-use delve or gdb to debug, see the
-<a href="https://golang.org/wiki/CoreDumpDebugging">core dump debugging</a>
-page for a step-by-step guide.
-</p>
-
-<h2 id="runtime">Runtime statistics and events</h2>
-
-<p>
-The runtime provides stats and reporting of internal events for
-users to diagnose performance and utilization problems at the
-runtime level.
-</p>
-
-<p>
-Users can monitor these stats to better understand the overall
-health and performance of Go programs.
-Some frequently monitored stats and states:
-</p>
-
-<ul>
-<li><code><a href="/pkg/runtime/#ReadMemStats">runtime.ReadMemStats</a></code>
-reports the metrics related to heap
-allocation and garbage collection. Memory stats are useful for
-monitoring how much memory resources a process is consuming,
-whether the process can utilize memory well, and to catch
-memory leaks.</li>
-<li><code><a href="/pkg/runtime/debug/#ReadGCStats">debug.ReadGCStats</a></code>
-reads statistics about garbage collection.
-It is useful to see how much of the resources are spent on GC pauses.
-It also reports a timeline of garbage collector pauses and pause time percentiles.</li>
-<li><code><a href="/pkg/runtime/debug/#Stack">debug.Stack</a></code>
-returns the current stack trace. Stack trace
-is useful to see how many goroutines are currently running,
-what they are doing, and whether they are blocked or not.</li>
-<li><code><a href="/pkg/runtime/debug/#WriteHeapDump">debug.WriteHeapDump</a></code>
-suspends the execution of all goroutines
-and allows you to dump the heap to a file. A heap dump is a
-snapshot of a Go process' memory at a given time. It contains all
-allocated objects as well as goroutines, finalizers, and more.</li>
-<li><code><a href="/pkg/runtime#NumGoroutine">runtime.NumGoroutine</a></code>
-returns the number of current goroutines.
-The value can be monitored to see whether enough goroutines are
-utilized, or to detect goroutine leaks.</li>
-</ul>
-
-<h3 id="execution-tracer">Execution tracer</h3>
-
-<p>Go comes with a runtime execution tracer to capture a wide range
-of runtime events. Scheduling, syscall, garbage collections,
-heap size, and other events are collected by runtime and available
-for visualization by the go tool trace. Execution tracer is a tool
-to detect latency and utilization problems. You can examine how well
-the CPU is utilized, and when networking or syscalls are a cause of
-preemption for the goroutines.</p>
-
-<p>Tracer is useful to:</p>
-<ul>
-<li>Understand how your goroutines execute.</li>
-<li>Understand some of the core runtime events such as GC runs.</li>
-<li>Identify poorly parallelized execution.</li>
-</ul>
-
-<p>However, it is not great for identifying hot spots such as
-analyzing the cause of excessive memory or CPU usage.
-Use profiling tools instead first to address them.</p>
-
-<p>
-<img width="800" src="https://storage.googleapis.com/golangorg-assets/tracer-lock.png">
-</p>
-
-<p>Above, the go tool trace visualization shows the execution started
-fine, and then it became serialized. It suggests that there might
-be lock contention for a shared resource that creates a bottleneck.</p>
-
-<p>See <a href="https://golang.org/cmd/trace/"><code>go</code> <code>tool</code> <code>trace</code></a>
-to collect and analyze runtime traces.
-</p>
-
-<h3 id="godebug">GODEBUG</h3>
-
-<p>Runtime also emits events and information if
-<a href="https://golang.org/pkg/runtime/#hdr-Environment_Variables">GODEBUG</a>
-environmental variable is set accordingly.</p>
-
-<ul>
-<li>GODEBUG=gctrace=1 prints garbage collector events at
-each collection, summarizing the amount of memory collected
-and the length of the pause.</li>
-<li>GODEBUG=inittrace=1 prints a summary of execution time and memory allocation
-information for completed package initialization work.</li>
-<li>GODEBUG=schedtrace=X prints scheduling events every X milliseconds.</li>
-</ul>
-
-<p>The GODEBUG environmental variable can be used to disable use of
-instruction set extensions in the standard library and runtime.</p>
-
-<ul>
-<li>GODEBUG=cpu.all=off disables the use of all optional
-instruction set extensions.</li>
-<li>GODEBUG=cpu.<em>extension</em>=off disables use of instructions from the
-specified instruction set extension.<br>
-<em>extension</em> is the lower case name for the instruction set extension
-such as <em>sse41</em> or <em>avx</em>.</li>
-</ul>
diff --git a/doc/editors.html b/doc/editors.html
deleted file mode 100644
index e0d0c530e5..0000000000
--- a/doc/editors.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!--{
- "Title": "Editor plugins and IDEs",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction</h2>
-
-<p>
- This document lists commonly used editor plugins and IDEs from the Go ecosystem
- that make Go development more productive and seamless.
- A comprehensive list of editor support and IDEs for Go development is available at
- <a href="https://golang.org/wiki/IDEsAndTextEditorPlugins">the wiki</a>.
-</p>
-
-<h2 id="options">Options</h2>
-<p>
-The Go ecosystem provides a variety of editor plugins and IDEs to enhance your day-to-day
-editing, navigation, testing, and debugging experience.
-</p>
-
-<ul>
-<li><a href="https://marketplace.visualstudio.com/items?itemName=golang.go">Visual Studio Code</a>:
-Go extension provides support for the Go programming language</li>
-<li><a href="https://www.jetbrains.com/go">GoLand</a>: GoLand is distributed either as a standalone IDE
-or as a plugin for IntelliJ IDEA Ultimate</li>
-<li><a href="https://github.com/fatih/vim-go">vim</a>: vim-go plugin provides Go programming language support</li>
-
-<p>
-Note that these are only a few top solutions; a more comprehensive
-community-maintained list of
-<a href="https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins">IDEs and text editor plugins</a>
-is available at the Wiki.
-</p>
diff --git a/doc/effective_go.html b/doc/effective_go.html
deleted file mode 100644
index 7620402984..0000000000
--- a/doc/effective_go.html
+++ /dev/null
@@ -1,3673 +0,0 @@
-<!--{
- "Title": "Effective Go",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction</h2>
-
-<p>
-Go is a new language. Although it borrows ideas from
-existing languages,
-it has unusual properties that make effective Go programs
-different in character from programs written in its relatives.
-A straightforward translation of a C++ or Java program into Go
-is unlikely to produce a satisfactory result&mdash;Java programs
-are written in Java, not Go.
-On the other hand, thinking about the problem from a Go
-perspective could produce a successful but quite different
-program.
-In other words,
-to write Go well, it's important to understand its properties
-and idioms.
-It's also important to know the established conventions for
-programming in Go, such as naming, formatting, program
-construction, and so on, so that programs you write
-will be easy for other Go programmers to understand.
-</p>
-
-<p>
-This document gives tips for writing clear, idiomatic Go code.
-It augments the <a href="/ref/spec">language specification</a>,
-the <a href="//tour.golang.org/">Tour of Go</a>,
-and <a href="/doc/code.html">How to Write Go Code</a>,
-all of which you
-should read first.
-</p>
-
-<h3 id="examples">Examples</h3>
-
-<p>
-The <a href="/src/">Go package sources</a>
-are intended to serve not
-only as the core library but also as examples of how to
-use the language.
-Moreover, many of the packages contain working, self-contained
-executable examples you can run directly from the
-<a href="//golang.org">golang.org</a> web site, such as
-<a href="//golang.org/pkg/strings/#example_Map">this one</a> (if
-necessary, click on the word "Example" to open it up).
-If you have a question about how to approach a problem or how something
-might be implemented, the documentation, code and examples in the
-library can provide answers, ideas and
-background.
-</p>
-
-
-<h2 id="formatting">Formatting</h2>
-
-<p>
-Formatting issues are the most contentious
-but the least consequential.
-People can adapt to different formatting styles
-but it's better if they don't have to, and
-less time is devoted to the topic
-if everyone adheres to the same style.
-The problem is how to approach this Utopia without a long
-prescriptive style guide.
-</p>
-
-<p>
-With Go we take an unusual
-approach and let the machine
-take care of most formatting issues.
-The <code>gofmt</code> program
-(also available as <code>go fmt</code>, which
-operates at the package level rather than source file level)
-reads a Go program
-and emits the source in a standard style of indentation
-and vertical alignment, retaining and if necessary
-reformatting comments.
-If you want to know how to handle some new layout
-situation, run <code>gofmt</code>; if the answer doesn't
-seem right, rearrange your program (or file a bug about <code>gofmt</code>),
-don't work around it.
-</p>
-
-<p>
-As an example, there's no need to spend time lining up
-the comments on the fields of a structure.
-<code>Gofmt</code> will do that for you. Given the
-declaration
-</p>
-
-<pre>
-type T struct {
- name string // name of the object
- value int // its value
-}
-</pre>
-
-<p>
-<code>gofmt</code> will line up the columns:
-</p>
-
-<pre>
-type T struct {
- name string // name of the object
- value int // its value
-}
-</pre>
-
-<p>
-All Go code in the standard packages has been formatted with <code>gofmt</code>.
-</p>
-
-
-<p>
-Some formatting details remain. Very briefly:
-</p>
-
-<dl>
- <dt>Indentation</dt>
- <dd>We use tabs for indentation and <code>gofmt</code> emits them by default.
- Use spaces only if you must.
- </dd>
- <dt>Line length</dt>
- <dd>
- Go has no line length limit. Don't worry about overflowing a punched card.
- If a line feels too long, wrap it and indent with an extra tab.
- </dd>
- <dt>Parentheses</dt>
- <dd>
- Go needs fewer parentheses than C and Java: control structures (<code>if</code>,
- <code>for</code>, <code>switch</code>) do not have parentheses in
- their syntax.
- Also, the operator precedence hierarchy is shorter and clearer, so
-<pre>
-x&lt;&lt;8 + y&lt;&lt;16
-</pre>
- means what the spacing implies, unlike in the other languages.
- </dd>
-</dl>
-
-<h2 id="commentary">Commentary</h2>
-
-<p>
-Go provides C-style <code>/* */</code> block comments
-and C++-style <code>//</code> line comments.
-Line comments are the norm;
-block comments appear mostly as package comments, but
-are useful within an expression or to disable large swaths of code.
-</p>
-
-<p>
-The program—and web server—<code>godoc</code> processes
-Go source files to extract documentation about the contents of the
-package.
-Comments that appear before top-level declarations, with no intervening newlines,
-are extracted along with the declaration to serve as explanatory text for the item.
-The nature and style of these comments determines the
-quality of the documentation <code>godoc</code> produces.
-</p>
-
-<p>
-Every package should have a <i>package comment</i>, a block
-comment preceding the package clause.
-For multi-file packages, the package comment only needs to be
-present in one file, and any one will do.
-The package comment should introduce the package and
-provide information relevant to the package as a whole.
-It will appear first on the <code>godoc</code> page and
-should set up the detailed documentation that follows.
-</p>
-
-<pre>
-/*
-Package regexp implements a simple library for regular expressions.
-
-The syntax of the regular expressions accepted is:
-
- regexp:
- concatenation { '|' concatenation }
- concatenation:
- { closure }
- closure:
- term [ '*' | '+' | '?' ]
- term:
- '^'
- '$'
- '.'
- character
- '[' [ '^' ] character-ranges ']'
- '(' regexp ')'
-*/
-package regexp
-</pre>
-
-<p>
-If the package is simple, the package comment can be brief.
-</p>
-
-<pre>
-// Package path implements utility routines for
-// manipulating slash-separated filename paths.
-</pre>
-
-<p>
-Comments do not need extra formatting such as banners of stars.
-The generated output may not even be presented in a fixed-width font, so don't depend
-on spacing for alignment&mdash;<code>godoc</code>, like <code>gofmt</code>,
-takes care of that.
-The comments are uninterpreted plain text, so HTML and other
-annotations such as <code>_this_</code> will reproduce <i>verbatim</i> and should
-not be used.
-One adjustment <code>godoc</code> does do is to display indented
-text in a fixed-width font, suitable for program snippets.
-The package comment for the
-<a href="/pkg/fmt/"><code>fmt</code> package</a> uses this to good effect.
-</p>
-
-<p>
-Depending on the context, <code>godoc</code> might not even
-reformat comments, so make sure they look good straight up:
-use correct spelling, punctuation, and sentence structure,
-fold long lines, and so on.
-</p>
-
-<p>
-Inside a package, any comment immediately preceding a top-level declaration
-serves as a <i>doc comment</i> for that declaration.
-Every exported (capitalized) name in a program should
-have a doc comment.
-</p>
-
-<p>
-Doc comments work best as complete sentences, which allow
-a wide variety of automated presentations.
-The first sentence should be a one-sentence summary that
-starts with the name being declared.
-</p>
-
-<pre>
-// Compile parses a regular expression and returns, if successful,
-// a Regexp that can be used to match against text.
-func Compile(str string) (*Regexp, error) {
-</pre>
-
-<p>
-If every doc comment begins with the name of the item it describes,
-you can use the <a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol">doc</a>
-subcommand of the <a href="/cmd/go/">go</a> tool
-and run the output through <code>grep</code>.
-Imagine you couldn't remember the name "Compile" but were looking for
-the parsing function for regular expressions, so you ran
-the command,
-</p>
-
-<pre>
-$ go doc -all regexp | grep -i parse
-</pre>
-
-<p>
-If all the doc comments in the package began, "This function...", <code>grep</code>
-wouldn't help you remember the name. But because the package starts each
-doc comment with the name, you'd see something like this,
-which recalls the word you're looking for.
-</p>
-
-<pre>
-$ go doc -all regexp | grep -i parse
- Compile parses a regular expression and returns, if successful, a Regexp
- MustCompile is like Compile but panics if the expression cannot be parsed.
- parsed. It simplifies safe initialization of global variables holding
-$
-</pre>
-
-<p>
-Go's declaration syntax allows grouping of declarations.
-A single doc comment can introduce a group of related constants or variables.
-Since the whole declaration is presented, such a comment can often be perfunctory.
-</p>
-
-<pre>
-// Error codes returned by failures to parse an expression.
-var (
- ErrInternal = errors.New("regexp: internal error")
- ErrUnmatchedLpar = errors.New("regexp: unmatched '('")
- ErrUnmatchedRpar = errors.New("regexp: unmatched ')'")
- ...
-)
-</pre>
-
-<p>
-Grouping can also indicate relationships between items,
-such as the fact that a set of variables is protected by a mutex.
-</p>
-
-<pre>
-var (
- countLock sync.Mutex
- inputCount uint32
- outputCount uint32
- errorCount uint32
-)
-</pre>
-
-<h2 id="names">Names</h2>
-
-<p>
-Names are as important in Go as in any other language.
-They even have semantic effect:
-the visibility of a name outside a package is determined by whether its
-first character is upper case.
-It's therefore worth spending a little time talking about naming conventions
-in Go programs.
-</p>
-
-
-<h3 id="package-names">Package names</h3>
-
-<p>
-When a package is imported, the package name becomes an accessor for the
-contents. After
-</p>
-
-<pre>
-import "bytes"
-</pre>
-
-<p>
-the importing package can talk about <code>bytes.Buffer</code>. It's
-helpful if everyone using the package can use the same name to refer to
-its contents, which implies that the package name should be good:
-short, concise, evocative. By convention, packages are given
-lower case, single-word names; there should be no need for underscores
-or mixedCaps.
-Err on the side of brevity, since everyone using your
-package will be typing that name.
-And don't worry about collisions <i>a priori</i>.
-The package name is only the default name for imports; it need not be unique
-across all source code, and in the rare case of a collision the
-importing package can choose a different name to use locally.
-In any case, confusion is rare because the file name in the import
-determines just which package is being used.
-</p>
-
-<p>
-Another convention is that the package name is the base name of
-its source directory;
-the package in <code>src/encoding/base64</code>
-is imported as <code>"encoding/base64"</code> but has name <code>base64</code>,
-not <code>encoding_base64</code> and not <code>encodingBase64</code>.
-</p>
-
-<p>
-The importer of a package will use the name to refer to its contents,
-so exported names in the package can use that fact
-to avoid stutter.
-(Don't use the <code>import .</code> notation, which can simplify
-tests that must run outside the package they are testing, but should otherwise be avoided.)
-For instance, the buffered reader type in the <code>bufio</code> package is called <code>Reader</code>,
-not <code>BufReader</code>, because users see it as <code>bufio.Reader</code>,
-which is a clear, concise name.
-Moreover,
-because imported entities are always addressed with their package name, <code>bufio.Reader</code>
-does not conflict with <code>io.Reader</code>.
-Similarly, the function to make new instances of <code>ring.Ring</code>&mdash;which
-is the definition of a <em>constructor</em> in Go&mdash;would
-normally be called <code>NewRing</code>, but since
-<code>Ring</code> is the only type exported by the package, and since the
-package is called <code>ring</code>, it's called just <code>New</code>,
-which clients of the package see as <code>ring.New</code>.
-Use the package structure to help you choose good names.
-</p>
-
-<p>
-Another short example is <code>once.Do</code>;
-<code>once.Do(setup)</code> reads well and would not be improved by
-writing <code>once.DoOrWaitUntilDone(setup)</code>.
-Long names don't automatically make things more readable.
-A helpful doc comment can often be more valuable than an extra long name.
-</p>
-
-<h3 id="Getters">Getters</h3>
-
-<p>
-Go doesn't provide automatic support for getters and setters.
-There's nothing wrong with providing getters and setters yourself,
-and it's often appropriate to do so, but it's neither idiomatic nor necessary
-to put <code>Get</code> into the getter's name. If you have a field called
-<code>owner</code> (lower case, unexported), the getter method should be
-called <code>Owner</code> (upper case, exported), not <code>GetOwner</code>.
-The use of upper-case names for export provides the hook to discriminate
-the field from the method.
-A setter function, if needed, will likely be called <code>SetOwner</code>.
-Both names read well in practice:
-</p>
-<pre>
-owner := obj.Owner()
-if owner != user {
- obj.SetOwner(user)
-}
-</pre>
-
-<h3 id="interface-names">Interface names</h3>
-
-<p>
-By convention, one-method interfaces are named by
-the method name plus an -er suffix or similar modification
-to construct an agent noun: <code>Reader</code>,
-<code>Writer</code>, <code>Formatter</code>,
-<code>CloseNotifier</code> etc.
-</p>
-
-<p>
-There are a number of such names and it's productive to honor them and the function
-names they capture.
-<code>Read</code>, <code>Write</code>, <code>Close</code>, <code>Flush</code>,
-<code>String</code> and so on have
-canonical signatures and meanings. To avoid confusion,
-don't give your method one of those names unless it
-has the same signature and meaning.
-Conversely, if your type implements a method with the
-same meaning as a method on a well-known type,
-give it the same name and signature;
-call your string-converter method <code>String</code> not <code>ToString</code>.
-</p>
-
-<h3 id="mixed-caps">MixedCaps</h3>
-
-<p>
-Finally, the convention in Go is to use <code>MixedCaps</code>
-or <code>mixedCaps</code> rather than underscores to write
-multiword names.
-</p>
-
-<h2 id="semicolons">Semicolons</h2>
-
-<p>
-Like C, Go's formal grammar uses semicolons to terminate statements,
-but unlike in C, those semicolons do not appear in the source.
-Instead the lexer uses a simple rule to insert semicolons automatically
-as it scans, so the input text is mostly free of them.
-</p>
-
-<p>
-The rule is this. If the last token before a newline is an identifier
-(which includes words like <code>int</code> and <code>float64</code>),
-a basic literal such as a number or string constant, or one of the
-tokens
-</p>
-<pre>
-break continue fallthrough return ++ -- ) }
-</pre>
-<p>
-the lexer always inserts a semicolon after the token.
-This could be summarized as, &ldquo;if the newline comes
-after a token that could end a statement, insert a semicolon&rdquo;.
-</p>
-
-<p>
-A semicolon can also be omitted immediately before a closing brace,
-so a statement such as
-</p>
-<pre>
- go func() { for { dst &lt;- &lt;-src } }()
-</pre>
-<p>
-needs no semicolons.
-Idiomatic Go programs have semicolons only in places such as
-<code>for</code> loop clauses, to separate the initializer, condition, and
-continuation elements. They are also necessary to separate multiple
-statements on a line, should you write code that way.
-</p>
-
-<p>
-One consequence of the semicolon insertion rules
-is that you cannot put the opening brace of a
-control structure (<code>if</code>, <code>for</code>, <code>switch</code>,
-or <code>select</code>) on the next line. If you do, a semicolon
-will be inserted before the brace, which could cause unwanted
-effects. Write them like this
-</p>
-
-<pre>
-if i &lt; f() {
- g()
-}
-</pre>
-<p>
-not like this
-</p>
-<pre>
-if i &lt; f() // wrong!
-{ // wrong!
- g()
-}
-</pre>
-
-
-<h2 id="control-structures">Control structures</h2>
-
-<p>
-The control structures of Go are related to those of C but differ
-in important ways.
-There is no <code>do</code> or <code>while</code> loop, only a
-slightly generalized
-<code>for</code>;
-<code>switch</code> is more flexible;
-<code>if</code> and <code>switch</code> accept an optional
-initialization statement like that of <code>for</code>;
-<code>break</code> and <code>continue</code> statements
-take an optional label to identify what to break or continue;
-and there are new control structures including a type switch and a
-multiway communications multiplexer, <code>select</code>.
-The syntax is also slightly different:
-there are no parentheses
-and the bodies must always be brace-delimited.
-</p>
-
-<h3 id="if">If</h3>
-
-<p>
-In Go a simple <code>if</code> looks like this:
-</p>
-<pre>
-if x &gt; 0 {
- return y
-}
-</pre>
-
-<p>
-Mandatory braces encourage writing simple <code>if</code> statements
-on multiple lines. It's good style to do so anyway,
-especially when the body contains a control statement such as a
-<code>return</code> or <code>break</code>.
-</p>
-
-<p>
-Since <code>if</code> and <code>switch</code> accept an initialization
-statement, it's common to see one used to set up a local variable.
-</p>
-
-<pre>
-if err := file.Chmod(0664); err != nil {
- log.Print(err)
- return err
-}
-</pre>
-
-<p id="else">
-In the Go libraries, you'll find that
-when an <code>if</code> statement doesn't flow into the next statement—that is,
-the body ends in <code>break</code>, <code>continue</code>,
-<code>goto</code>, or <code>return</code>—the unnecessary
-<code>else</code> is omitted.
-</p>
-
-<pre>
-f, err := os.Open(name)
-if err != nil {
- return err
-}
-codeUsing(f)
-</pre>
-
-<p>
-This is an example of a common situation where code must guard against a
-sequence of error conditions. The code reads well if the
-successful flow of control runs down the page, eliminating error cases
-as they arise. Since error cases tend to end in <code>return</code>
-statements, the resulting code needs no <code>else</code> statements.
-</p>
-
-<pre>
-f, err := os.Open(name)
-if err != nil {
- return err
-}
-d, err := f.Stat()
-if err != nil {
- f.Close()
- return err
-}
-codeUsing(f, d)
-</pre>
-
-
-<h3 id="redeclaration">Redeclaration and reassignment</h3>
-
-<p>
-An aside: The last example in the previous section demonstrates a detail of how the
-<code>:=</code> short declaration form works.
-The declaration that calls <code>os.Open</code> reads,
-</p>
-
-<pre>
-f, err := os.Open(name)
-</pre>
-
-<p>
-This statement declares two variables, <code>f</code> and <code>err</code>.
-A few lines later, the call to <code>f.Stat</code> reads,
-</p>
-
-<pre>
-d, err := f.Stat()
-</pre>
-
-<p>
-which looks as if it declares <code>d</code> and <code>err</code>.
-Notice, though, that <code>err</code> appears in both statements.
-This duplication is legal: <code>err</code> is declared by the first statement,
-but only <em>re-assigned</em> in the second.
-This means that the call to <code>f.Stat</code> uses the existing
-<code>err</code> variable declared above, and just gives it a new value.
-</p>
-
-<p>
-In a <code>:=</code> declaration a variable <code>v</code> may appear even
-if it has already been declared, provided:
-</p>
-
-<ul>
-<li>this declaration is in the same scope as the existing declaration of <code>v</code>
-(if <code>v</code> is already declared in an outer scope, the declaration will create a new variable §),</li>
-<li>the corresponding value in the initialization is assignable to <code>v</code>, and</li>
-<li>there is at least one other variable that is created by the declaration.</li>
-</ul>
-
-<p>
-This unusual property is pure pragmatism,
-making it easy to use a single <code>err</code> value, for example,
-in a long <code>if-else</code> chain.
-You'll see it used often.
-</p>
-
-<p>
-§ It's worth noting here that in Go the scope of function parameters and return values
-is the same as the function body, even though they appear lexically outside the braces
-that enclose the body.
-</p>
-
-<h3 id="for">For</h3>
-
-<p>
-The Go <code>for</code> loop is similar to&mdash;but not the same as&mdash;C's.
-It unifies <code>for</code>
-and <code>while</code> and there is no <code>do-while</code>.
-There are three forms, only one of which has semicolons.
-</p>
-<pre>
-// Like a C for
-for init; condition; post { }
-
-// Like a C while
-for condition { }
-
-// Like a C for(;;)
-for { }
-</pre>
-
-<p>
-Short declarations make it easy to declare the index variable right in the loop.
-</p>
-<pre>
-sum := 0
-for i := 0; i &lt; 10; i++ {
- sum += i
-}
-</pre>
-
-<p>
-If you're looping over an array, slice, string, or map,
-or reading from a channel, a <code>range</code> clause can
-manage the loop.
-</p>
-<pre>
-for key, value := range oldMap {
- newMap[key] = value
-}
-</pre>
-
-<p>
-If you only need the first item in the range (the key or index), drop the second:
-</p>
-<pre>
-for key := range m {
- if key.expired() {
- delete(m, key)
- }
-}
-</pre>
-
-<p>
-If you only need the second item in the range (the value), use the <em>blank identifier</em>, an underscore, to discard the first:
-</p>
-<pre>
-sum := 0
-for _, value := range array {
- sum += value
-}
-</pre>
-
-<p>
-The blank identifier has many uses, as described in <a href="#blank">a later section</a>.
-</p>
-
-<p>
-For strings, the <code>range</code> does more work for you, breaking out individual
-Unicode code points by parsing the UTF-8.
-Erroneous encodings consume one byte and produce the
-replacement rune U+FFFD.
-(The name (with associated builtin type) <code>rune</code> is Go terminology for a
-single Unicode code point.
-See <a href="/ref/spec#Rune_literals">the language specification</a>
-for details.)
-The loop
-</p>
-<pre>
-for pos, char := range "日本\x80語" { // \x80 is an illegal UTF-8 encoding
- fmt.Printf("character %#U starts at byte position %d\n", char, pos)
-}
-</pre>
-<p>
-prints
-</p>
-<pre>
-character U+65E5 '日' starts at byte position 0
-character U+672C '本' starts at byte position 3
-character U+FFFD '�' starts at byte position 6
-character U+8A9E '語' starts at byte position 7
-</pre>
-
-<p>
-Finally, Go has no comma operator and <code>++</code> and <code>--</code>
-are statements not expressions.
-Thus if you want to run multiple variables in a <code>for</code>
-you should use parallel assignment (although that precludes <code>++</code> and <code>--</code>).
-</p>
-<pre>
-// Reverse a
-for i, j := 0, len(a)-1; i &lt; j; i, j = i+1, j-1 {
- a[i], a[j] = a[j], a[i]
-}
-</pre>
-
-<h3 id="switch">Switch</h3>
-
-<p>
-Go's <code>switch</code> is more general than C's.
-The expressions need not be constants or even integers,
-the cases are evaluated top to bottom until a match is found,
-and if the <code>switch</code> has no expression it switches on
-<code>true</code>.
-It's therefore possible&mdash;and idiomatic&mdash;to write an
-<code>if</code>-<code>else</code>-<code>if</code>-<code>else</code>
-chain as a <code>switch</code>.
-</p>
-
-<pre>
-func unhex(c byte) byte {
- switch {
- case '0' &lt;= c &amp;&amp; c &lt;= '9':
- return c - '0'
- case 'a' &lt;= c &amp;&amp; c &lt;= 'f':
- return c - 'a' + 10
- case 'A' &lt;= c &amp;&amp; c &lt;= 'F':
- return c - 'A' + 10
- }
- return 0
-}
-</pre>
-
-<p>
-There is no automatic fall through, but cases can be presented
-in comma-separated lists.
-</p>
-<pre>
-func shouldEscape(c byte) bool {
- switch c {
- case ' ', '?', '&amp;', '=', '#', '+', '%':
- return true
- }
- return false
-}
-</pre>
-
-<p>
-Although they are not nearly as common in Go as some other C-like
-languages, <code>break</code> statements can be used to terminate
-a <code>switch</code> early.
-Sometimes, though, it's necessary to break out of a surrounding loop,
-not the switch, and in Go that can be accomplished by putting a label
-on the loop and "breaking" to that label.
-This example shows both uses.
-</p>
-
-<pre>
-Loop:
- for n := 0; n &lt; len(src); n += size {
- switch {
- case src[n] &lt; sizeOne:
- if validateOnly {
- break
- }
- size = 1
- update(src[n])
-
- case src[n] &lt; sizeTwo:
- if n+1 &gt;= len(src) {
- err = errShortInput
- break Loop
- }
- if validateOnly {
- break
- }
- size = 2
- update(src[n] + src[n+1]&lt;&lt;shift)
- }
- }
-</pre>
-
-<p>
-Of course, the <code>continue</code> statement also accepts an optional label
-but it applies only to loops.
-</p>
-
-<p>
-To close this section, here's a comparison routine for byte slices that uses two
-<code>switch</code> statements:
-</p>
-<pre>
-// Compare returns an integer comparing the two byte slices,
-// lexicographically.
-// The result will be 0 if a == b, -1 if a &lt; b, and +1 if a &gt; b
-func Compare(a, b []byte) int {
- for i := 0; i &lt; len(a) &amp;&amp; i &lt; len(b); i++ {
- switch {
- case a[i] &gt; b[i]:
- return 1
- case a[i] &lt; b[i]:
- return -1
- }
- }
- switch {
- case len(a) &gt; len(b):
- return 1
- case len(a) &lt; len(b):
- return -1
- }
- return 0
-}
-</pre>
-
-<h3 id="type_switch">Type switch</h3>
-
-<p>
-A switch can also be used to discover the dynamic type of an interface
-variable. Such a <em>type switch</em> uses the syntax of a type
-assertion with the keyword <code>type</code> inside the parentheses.
-If the switch declares a variable in the expression, the variable will
-have the corresponding type in each clause.
-It's also idiomatic to reuse the name in such cases, in effect declaring
-a new variable with the same name but a different type in each case.
-</p>
-<pre>
-var t interface{}
-t = functionOfSomeType()
-switch t := t.(type) {
-default:
- fmt.Printf("unexpected type %T\n", t) // %T prints whatever type t has
-case bool:
- fmt.Printf("boolean %t\n", t) // t has type bool
-case int:
- fmt.Printf("integer %d\n", t) // t has type int
-case *bool:
- fmt.Printf("pointer to boolean %t\n", *t) // t has type *bool
-case *int:
- fmt.Printf("pointer to integer %d\n", *t) // t has type *int
-}
-</pre>
-
-<h2 id="functions">Functions</h2>
-
-<h3 id="multiple-returns">Multiple return values</h3>
-
-<p>
-One of Go's unusual features is that functions and methods
-can return multiple values. This form can be used to
-improve on a couple of clumsy idioms in C programs: in-band
-error returns such as <code>-1</code> for <code>EOF</code>
-and modifying an argument passed by address.
-</p>
-
-<p>
-In C, a write error is signaled by a negative count with the
-error code secreted away in a volatile location.
-In Go, <code>Write</code>
-can return a count <i>and</i> an error: &ldquo;Yes, you wrote some
-bytes but not all of them because you filled the device&rdquo;.
-The signature of the <code>Write</code> method on files from
-package <code>os</code> is:
-</p>
-
-<pre>
-func (file *File) Write(b []byte) (n int, err error)
-</pre>
-
-<p>
-and as the documentation says, it returns the number of bytes
-written and a non-nil <code>error</code> when <code>n</code>
-<code>!=</code> <code>len(b)</code>.
-This is a common style; see the section on error handling for more examples.
-</p>
-
-<p>
-A similar approach obviates the need to pass a pointer to a return
-value to simulate a reference parameter.
-Here's a simple-minded function to
-grab a number from a position in a byte slice, returning the number
-and the next position.
-</p>
-
-<pre>
-func nextInt(b []byte, i int) (int, int) {
- for ; i &lt; len(b) &amp;&amp; !isDigit(b[i]); i++ {
- }
- x := 0
- for ; i &lt; len(b) &amp;&amp; isDigit(b[i]); i++ {
- x = x*10 + int(b[i]) - '0'
- }
- return x, i
-}
-</pre>
-
-<p>
-You could use it to scan the numbers in an input slice <code>b</code> like this:
-</p>
-
-<pre>
- for i := 0; i &lt; len(b); {
- x, i = nextInt(b, i)
- fmt.Println(x)
- }
-</pre>
-
-<h3 id="named-results">Named result parameters</h3>
-
-<p>
-The return or result "parameters" of a Go function can be given names and
-used as regular variables, just like the incoming parameters.
-When named, they are initialized to the zero values for their types when
-the function begins; if the function executes a <code>return</code> statement
-with no arguments, the current values of the result parameters are
-used as the returned values.
-</p>
-
-<p>
-The names are not mandatory but they can make code shorter and clearer:
-they're documentation.
-If we name the results of <code>nextInt</code> it becomes
-obvious which returned <code>int</code>
-is which.
-</p>
-
-<pre>
-func nextInt(b []byte, pos int) (value, nextPos int) {
-</pre>
-
-<p>
-Because named results are initialized and tied to an unadorned return, they can simplify
-as well as clarify. Here's a version
-of <code>io.ReadFull</code> that uses them well:
-</p>
-
-<pre>
-func ReadFull(r Reader, buf []byte) (n int, err error) {
- for len(buf) &gt; 0 &amp;&amp; err == nil {
- var nr int
- nr, err = r.Read(buf)
- n += nr
- buf = buf[nr:]
- }
- return
-}
-</pre>
-
-<h3 id="defer">Defer</h3>
-
-<p>
-Go's <code>defer</code> statement schedules a function call (the
-<i>deferred</i> function) to be run immediately before the function
-executing the <code>defer</code> returns. It's an unusual but
-effective way to deal with situations such as resources that must be
-released regardless of which path a function takes to return. The
-canonical examples are unlocking a mutex or closing a file.
-</p>
-
-<pre>
-// Contents returns the file's contents as a string.
-func Contents(filename string) (string, error) {
- f, err := os.Open(filename)
- if err != nil {
- return "", err
- }
- defer f.Close() // f.Close will run when we're finished.
-
- var result []byte
- buf := make([]byte, 100)
- for {
- n, err := f.Read(buf[0:])
- result = append(result, buf[0:n]...) // append is discussed later.
- if err != nil {
- if err == io.EOF {
- break
- }
- return "", err // f will be closed if we return here.
- }
- }
- return string(result), nil // f will be closed if we return here.
-}
-</pre>
-
-<p>
-Deferring a call to a function such as <code>Close</code> has two advantages. First, it
-guarantees that you will never forget to close the file, a mistake
-that's easy to make if you later edit the function to add a new return
-path. Second, it means that the close sits near the open,
-which is much clearer than placing it at the end of the function.
-</p>
-
-<p>
-The arguments to the deferred function (which include the receiver if
-the function is a method) are evaluated when the <i>defer</i>
-executes, not when the <i>call</i> executes. Besides avoiding worries
-about variables changing values as the function executes, this means
-that a single deferred call site can defer multiple function
-executions. Here's a silly example.
-</p>
-
-<pre>
-for i := 0; i &lt; 5; i++ {
- defer fmt.Printf("%d ", i)
-}
-</pre>
-
-<p>
-Deferred functions are executed in LIFO order, so this code will cause
-<code>4 3 2 1 0</code> to be printed when the function returns. A
-more plausible example is a simple way to trace function execution
-through the program. We could write a couple of simple tracing
-routines like this:
-</p>
-
-<pre>
-func trace(s string) { fmt.Println("entering:", s) }
-func untrace(s string) { fmt.Println("leaving:", s) }
-
-// Use them like this:
-func a() {
- trace("a")
- defer untrace("a")
- // do something....
-}
-</pre>
-
-<p>
-We can do better by exploiting the fact that arguments to deferred
-functions are evaluated when the <code>defer</code> executes. The
-tracing routine can set up the argument to the untracing routine.
-This example:
-</p>
-
-<pre>
-func trace(s string) string {
- fmt.Println("entering:", s)
- return s
-}
-
-func un(s string) {
- fmt.Println("leaving:", s)
-}
-
-func a() {
- defer un(trace("a"))
- fmt.Println("in a")
-}
-
-func b() {
- defer un(trace("b"))
- fmt.Println("in b")
- a()
-}
-
-func main() {
- b()
-}
-</pre>
-
-<p>
-prints
-</p>
-
-<pre>
-entering: b
-in b
-entering: a
-in a
-leaving: a
-leaving: b
-</pre>
-
-<p>
-For programmers accustomed to block-level resource management from
-other languages, <code>defer</code> may seem peculiar, but its most
-interesting and powerful applications come precisely from the fact
-that it's not block-based but function-based. In the section on
-<code>panic</code> and <code>recover</code> we'll see another
-example of its possibilities.
-</p>
-
-<h2 id="data">Data</h2>
-
-<h3 id="allocation_new">Allocation with <code>new</code></h3>
-
-<p>
-Go has two allocation primitives, the built-in functions
-<code>new</code> and <code>make</code>.
-They do different things and apply to different types, which can be confusing,
-but the rules are simple.
-Let's talk about <code>new</code> first.
-It's a built-in function that allocates memory, but unlike its namesakes
-in some other languages it does not <em>initialize</em> the memory,
-it only <em>zeros</em> it.
-That is,
-<code>new(T)</code> allocates zeroed storage for a new item of type
-<code>T</code> and returns its address, a value of type <code>*T</code>.
-In Go terminology, it returns a pointer to a newly allocated zero value of type
-<code>T</code>.
-</p>
-
-<p>
-Since the memory returned by <code>new</code> is zeroed, it's helpful to arrange
-when designing your data structures that the
-zero value of each type can be used without further initialization. This means a user of
-the data structure can create one with <code>new</code> and get right to
-work.
-For example, the documentation for <code>bytes.Buffer</code> states that
-"the zero value for <code>Buffer</code> is an empty buffer ready to use."
-Similarly, <code>sync.Mutex</code> does not
-have an explicit constructor or <code>Init</code> method.
-Instead, the zero value for a <code>sync.Mutex</code>
-is defined to be an unlocked mutex.
-</p>
-
-<p>
-The zero-value-is-useful property works transitively. Consider this type declaration.
-</p>
-
-<pre>
-type SyncedBuffer struct {
- lock sync.Mutex
- buffer bytes.Buffer
-}
-</pre>
-
-<p>
-Values of type <code>SyncedBuffer</code> are also ready to use immediately upon allocation
-or just declaration. In the next snippet, both <code>p</code> and <code>v</code> will work
-correctly without further arrangement.
-</p>
-
-<pre>
-p := new(SyncedBuffer) // type *SyncedBuffer
-var v SyncedBuffer // type SyncedBuffer
-</pre>
-
-<h3 id="composite_literals">Constructors and composite literals</h3>
-
-<p>
-Sometimes the zero value isn't good enough and an initializing
-constructor is necessary, as in this example derived from
-package <code>os</code>.
-</p>
-
-<pre>
-func NewFile(fd int, name string) *File {
- if fd &lt; 0 {
- return nil
- }
- f := new(File)
- f.fd = fd
- f.name = name
- f.dirinfo = nil
- f.nepipe = 0
- return f
-}
-</pre>
-
-<p>
-There's a lot of boiler plate in there. We can simplify it
-using a <i>composite literal</i>, which is
-an expression that creates a
-new instance each time it is evaluated.
-</p>
-
-<pre>
-func NewFile(fd int, name string) *File {
- if fd &lt; 0 {
- return nil
- }
- f := File{fd, name, nil, 0}
- return &amp;f
-}
-</pre>
-
-<p>
-Note that, unlike in C, it's perfectly OK to return the address of a local variable;
-the storage associated with the variable survives after the function
-returns.
-In fact, taking the address of a composite literal
-allocates a fresh instance each time it is evaluated,
-so we can combine these last two lines.
-</p>
-
-<pre>
- return &amp;File{fd, name, nil, 0}
-</pre>
-
-<p>
-The fields of a composite literal are laid out in order and must all be present.
-However, by labeling the elements explicitly as <i>field</i><code>:</code><i>value</i>
-pairs, the initializers can appear in any
-order, with the missing ones left as their respective zero values. Thus we could say
-</p>
-
-<pre>
- return &amp;File{fd: fd, name: name}
-</pre>
-
-<p>
-As a limiting case, if a composite literal contains no fields at all, it creates
-a zero value for the type. The expressions <code>new(File)</code> and <code>&amp;File{}</code> are equivalent.
-</p>
-
-<p>
-Composite literals can also be created for arrays, slices, and maps,
-with the field labels being indices or map keys as appropriate.
-In these examples, the initializations work regardless of the values of <code>Enone</code>,
-<code>Eio</code>, and <code>Einval</code>, as long as they are distinct.
-</p>
-
-<pre>
-a := [...]string {Enone: "no error", Eio: "Eio", Einval: "invalid argument"}
-s := []string {Enone: "no error", Eio: "Eio", Einval: "invalid argument"}
-m := map[int]string{Enone: "no error", Eio: "Eio", Einval: "invalid argument"}
-</pre>
-
-<h3 id="allocation_make">Allocation with <code>make</code></h3>
-
-<p>
-Back to allocation.
-The built-in function <code>make(T, </code><i>args</i><code>)</code> serves
-a purpose different from <code>new(T)</code>.
-It creates slices, maps, and channels only, and it returns an <em>initialized</em>
-(not <em>zeroed</em>)
-value of type <code>T</code> (not <code>*T</code>).
-The reason for the distinction
-is that these three types represent, under the covers, references to data structures that
-must be initialized before use.
-A slice, for example, is a three-item descriptor
-containing a pointer to the data (inside an array), the length, and the
-capacity, and until those items are initialized, the slice is <code>nil</code>.
-For slices, maps, and channels,
-<code>make</code> initializes the internal data structure and prepares
-the value for use.
-For instance,
-</p>
-
-<pre>
-make([]int, 10, 100)
-</pre>
-
-<p>
-allocates an array of 100 ints and then creates a slice
-structure with length 10 and a capacity of 100 pointing at the first
-10 elements of the array.
-(When making a slice, the capacity can be omitted; see the section on slices
-for more information.)
-In contrast, <code>new([]int)</code> returns a pointer to a newly allocated, zeroed slice
-structure, that is, a pointer to a <code>nil</code> slice value.
-</p>
-
-<p>
-These examples illustrate the difference between <code>new</code> and
-<code>make</code>.
-</p>
-
-<pre>
-var p *[]int = new([]int) // allocates slice structure; *p == nil; rarely useful
-var v []int = make([]int, 100) // the slice v now refers to a new array of 100 ints
-
-// Unnecessarily complex:
-var p *[]int = new([]int)
-*p = make([]int, 100, 100)
-
-// Idiomatic:
-v := make([]int, 100)
-</pre>
-
-<p>
-Remember that <code>make</code> applies only to maps, slices and channels
-and does not return a pointer.
-To obtain an explicit pointer allocate with <code>new</code> or take the address
-of a variable explicitly.
-</p>
-
-<h3 id="arrays">Arrays</h3>
-
-<p>
-Arrays are useful when planning the detailed layout of memory and sometimes
-can help avoid allocation, but primarily
-they are a building block for slices, the subject of the next section.
-To lay the foundation for that topic, here are a few words about arrays.
-</p>
-
-<p>
-There are major differences between the ways arrays work in Go and C.
-In Go,
-</p>
-<ul>
-<li>
-Arrays are values. Assigning one array to another copies all the elements.
-</li>
-<li>
-In particular, if you pass an array to a function, it
-will receive a <i>copy</i> of the array, not a pointer to it.
-<li>
-The size of an array is part of its type. The types <code>[10]int</code>
-and <code>[20]int</code> are distinct.
-</li>
-</ul>
-
-<p>
-The value property can be useful but also expensive; if you want C-like behavior and efficiency,
-you can pass a pointer to the array.
-</p>
-
-<pre>
-func Sum(a *[3]float64) (sum float64) {
- for _, v := range *a {
- sum += v
- }
- return
-}
-
-array := [...]float64{7.0, 8.5, 9.1}
-x := Sum(&amp;array) // Note the explicit address-of operator
-</pre>
-
-<p>
-But even this style isn't idiomatic Go.
-Use slices instead.
-</p>
-
-<h3 id="slices">Slices</h3>
-
-<p>
-Slices wrap arrays to give a more general, powerful, and convenient
-interface to sequences of data. Except for items with explicit
-dimension such as transformation matrices, most array programming in
-Go is done with slices rather than simple arrays.
-</p>
-<p>
-Slices hold references to an underlying array, and if you assign one
-slice to another, both refer to the same array.
-If a function takes a slice argument, changes it makes to
-the elements of the slice will be visible to the caller, analogous to
-passing a pointer to the underlying array. A <code>Read</code>
-function can therefore accept a slice argument rather than a pointer
-and a count; the length within the slice sets an upper
-limit of how much data to read. Here is the signature of the
-<code>Read</code> method of the <code>File</code> type in package
-<code>os</code>:
-</p>
-<pre>
-func (f *File) Read(buf []byte) (n int, err error)
-</pre>
-<p>
-The method returns the number of bytes read and an error value, if
-any.
-To read into the first 32 bytes of a larger buffer
-<code>buf</code>, <i>slice</i> (here used as a verb) the buffer.
-</p>
-<pre>
- n, err := f.Read(buf[0:32])
-</pre>
-<p>
-Such slicing is common and efficient. In fact, leaving efficiency aside for
-the moment, the following snippet would also read the first 32 bytes of the buffer.
-</p>
-<pre>
- var n int
- var err error
- for i := 0; i &lt; 32; i++ {
- nbytes, e := f.Read(buf[i:i+1]) // Read one byte.
- n += nbytes
- if nbytes == 0 || e != nil {
- err = e
- break
- }
- }
-</pre>
-<p>
-The length of a slice may be changed as long as it still fits within
-the limits of the underlying array; just assign it to a slice of
-itself. The <i>capacity</i> of a slice, accessible by the built-in
-function <code>cap</code>, reports the maximum length the slice may
-assume. Here is a function to append data to a slice. If the data
-exceeds the capacity, the slice is reallocated. The
-resulting slice is returned. The function uses the fact that
-<code>len</code> and <code>cap</code> are legal when applied to the
-<code>nil</code> slice, and return 0.
-</p>
-<pre>
-func Append(slice, data []byte) []byte {
- l := len(slice)
- if l + len(data) &gt; cap(slice) { // reallocate
- // Allocate double what's needed, for future growth.
- newSlice := make([]byte, (l+len(data))*2)
- // The copy function is predeclared and works for any slice type.
- copy(newSlice, slice)
- slice = newSlice
- }
- slice = slice[0:l+len(data)]
- copy(slice[l:], data)
- return slice
-}
-</pre>
-<p>
-We must return the slice afterwards because, although <code>Append</code>
-can modify the elements of <code>slice</code>, the slice itself (the run-time data
-structure holding the pointer, length, and capacity) is passed by value.
-</p>
-
-<p>
-The idea of appending to a slice is so useful it's captured by the
-<code>append</code> built-in function. To understand that function's
-design, though, we need a little more information, so we'll return
-to it later.
-</p>
-
-<h3 id="two_dimensional_slices">Two-dimensional slices</h3>
-
-<p>
-Go's arrays and slices are one-dimensional.
-To create the equivalent of a 2D array or slice, it is necessary to define an array-of-arrays
-or slice-of-slices, like this:
-</p>
-
-<pre>
-type Transform [3][3]float64 // A 3x3 array, really an array of arrays.
-type LinesOfText [][]byte // A slice of byte slices.
-</pre>
-
-<p>
-Because slices are variable-length, it is possible to have each inner
-slice be a different length.
-That can be a common situation, as in our <code>LinesOfText</code>
-example: each line has an independent length.
-</p>
-
-<pre>
-text := LinesOfText{
- []byte("Now is the time"),
- []byte("for all good gophers"),
- []byte("to bring some fun to the party."),
-}
-</pre>
-
-<p>
-Sometimes it's necessary to allocate a 2D slice, a situation that can arise when
-processing scan lines of pixels, for instance.
-There are two ways to achieve this.
-One is to allocate each slice independently; the other
-is to allocate a single array and point the individual slices into it.
-Which to use depends on your application.
-If the slices might grow or shrink, they should be allocated independently
-to avoid overwriting the next line; if not, it can be more efficient to construct
-the object with a single allocation.
-For reference, here are sketches of the two methods.
-First, a line at a time:
-</p>
-
-<pre>
-// Allocate the top-level slice.
-picture := make([][]uint8, YSize) // One row per unit of y.
-// Loop over the rows, allocating the slice for each row.
-for i := range picture {
- picture[i] = make([]uint8, XSize)
-}
-</pre>
-
-<p>
-And now as one allocation, sliced into lines:
-</p>
-
-<pre>
-// Allocate the top-level slice, the same as before.
-picture := make([][]uint8, YSize) // One row per unit of y.
-// Allocate one large slice to hold all the pixels.
-pixels := make([]uint8, XSize*YSize) // Has type []uint8 even though picture is [][]uint8.
-// Loop over the rows, slicing each row from the front of the remaining pixels slice.
-for i := range picture {
- picture[i], pixels = pixels[:XSize], pixels[XSize:]
-}
-</pre>
-
-<h3 id="maps">Maps</h3>
-
-<p>
-Maps are a convenient and powerful built-in data structure that associate
-values of one type (the <em>key</em>) with values of another type
-(the <em>element</em> or <em>value</em>).
-The key can be of any type for which the equality operator is defined,
-such as integers,
-floating point and complex numbers,
-strings, pointers, interfaces (as long as the dynamic type
-supports equality), structs and arrays.
-Slices cannot be used as map keys,
-because equality is not defined on them.
-Like slices, maps hold references to an underlying data structure.
-If you pass a map to a function
-that changes the contents of the map, the changes will be visible
-in the caller.
-</p>
-<p>
-Maps can be constructed using the usual composite literal syntax
-with colon-separated key-value pairs,
-so it's easy to build them during initialization.
-</p>
-<pre>
-var timeZone = map[string]int{
- "UTC": 0*60*60,
- "EST": -5*60*60,
- "CST": -6*60*60,
- "MST": -7*60*60,
- "PST": -8*60*60,
-}
-</pre>
-<p>
-Assigning and fetching map values looks syntactically just like
-doing the same for arrays and slices except that the index doesn't
-need to be an integer.
-</p>
-<pre>
-offset := timeZone["EST"]
-</pre>
-<p>
-An attempt to fetch a map value with a key that
-is not present in the map will return the zero value for the type
-of the entries
-in the map. For instance, if the map contains integers, looking
-up a non-existent key will return <code>0</code>.
-A set can be implemented as a map with value type <code>bool</code>.
-Set the map entry to <code>true</code> to put the value in the set, and then
-test it by simple indexing.
-</p>
-<pre>
-attended := map[string]bool{
- "Ann": true,
- "Joe": true,
- ...
-}
-
-if attended[person] { // will be false if person is not in the map
- fmt.Println(person, "was at the meeting")
-}
-</pre>
-<p>
-Sometimes you need to distinguish a missing entry from
-a zero value. Is there an entry for <code>"UTC"</code>
-or is that 0 because it's not in the map at all?
-You can discriminate with a form of multiple assignment.
-</p>
-<pre>
-var seconds int
-var ok bool
-seconds, ok = timeZone[tz]
-</pre>
-<p>
-For obvious reasons this is called the &ldquo;comma ok&rdquo; idiom.
-In this example, if <code>tz</code> is present, <code>seconds</code>
-will be set appropriately and <code>ok</code> will be true; if not,
-<code>seconds</code> will be set to zero and <code>ok</code> will
-be false.
-Here's a function that puts it together with a nice error report:
-</p>
-<pre>
-func offset(tz string) int {
- if seconds, ok := timeZone[tz]; ok {
- return seconds
- }
- log.Println("unknown time zone:", tz)
- return 0
-}
-</pre>
-<p>
-To test for presence in the map without worrying about the actual value,
-you can use the <a href="#blank">blank identifier</a> (<code>_</code>)
-in place of the usual variable for the value.
-</p>
-<pre>
-_, present := timeZone[tz]
-</pre>
-<p>
-To delete a map entry, use the <code>delete</code>
-built-in function, whose arguments are the map and the key to be deleted.
-It's safe to do this even if the key is already absent
-from the map.
-</p>
-<pre>
-delete(timeZone, "PDT") // Now on Standard Time
-</pre>
-
-<h3 id="printing">Printing</h3>
-
-<p>
-Formatted printing in Go uses a style similar to C's <code>printf</code>
-family but is richer and more general. The functions live in the <code>fmt</code>
-package and have capitalized names: <code>fmt.Printf</code>, <code>fmt.Fprintf</code>,
-<code>fmt.Sprintf</code> and so on. The string functions (<code>Sprintf</code> etc.)
-return a string rather than filling in a provided buffer.
-</p>
-<p>
-You don't need to provide a format string. For each of <code>Printf</code>,
-<code>Fprintf</code> and <code>Sprintf</code> there is another pair
-of functions, for instance <code>Print</code> and <code>Println</code>.
-These functions do not take a format string but instead generate a default
-format for each argument. The <code>Println</code> versions also insert a blank
-between arguments and append a newline to the output while
-the <code>Print</code> versions add blanks only if the operand on neither side is a string.
-In this example each line produces the same output.
-</p>
-<pre>
-fmt.Printf("Hello %d\n", 23)
-fmt.Fprint(os.Stdout, "Hello ", 23, "\n")
-fmt.Println("Hello", 23)
-fmt.Println(fmt.Sprint("Hello ", 23))
-</pre>
-<p>
-The formatted print functions <code>fmt.Fprint</code>
-and friends take as a first argument any object
-that implements the <code>io.Writer</code> interface; the variables <code>os.Stdout</code>
-and <code>os.Stderr</code> are familiar instances.
-</p>
-<p>
-Here things start to diverge from C. First, the numeric formats such as <code>%d</code>
-do not take flags for signedness or size; instead, the printing routines use the
-type of the argument to decide these properties.
-</p>
-<pre>
-var x uint64 = 1&lt;&lt;64 - 1
-fmt.Printf("%d %x; %d %x\n", x, x, int64(x), int64(x))
-</pre>
-<p>
-prints
-</p>
-<pre>
-18446744073709551615 ffffffffffffffff; -1 -1
-</pre>
-<p>
-If you just want the default conversion, such as decimal for integers, you can use
-the catchall format <code>%v</code> (for &ldquo;value&rdquo;); the result is exactly
-what <code>Print</code> and <code>Println</code> would produce.
-Moreover, that format can print <em>any</em> value, even arrays, slices, structs, and
-maps. Here is a print statement for the time zone map defined in the previous section.
-</p>
-<pre>
-fmt.Printf("%v\n", timeZone) // or just fmt.Println(timeZone)
-</pre>
-<p>
-which gives output:
-</p>
-<pre>
-map[CST:-21600 EST:-18000 MST:-25200 PST:-28800 UTC:0]
-</pre>
-<p>
-For maps, <code>Printf</code> and friends sort the output lexicographically by key.
-</p>
-<p>
-When printing a struct, the modified format <code>%+v</code> annotates the
-fields of the structure with their names, and for any value the alternate
-format <code>%#v</code> prints the value in full Go syntax.
-</p>
-<pre>
-type T struct {
- a int
- b float64
- c string
-}
-t := &amp;T{ 7, -2.35, "abc\tdef" }
-fmt.Printf("%v\n", t)
-fmt.Printf("%+v\n", t)
-fmt.Printf("%#v\n", t)
-fmt.Printf("%#v\n", timeZone)
-</pre>
-<p>
-prints
-</p>
-<pre>
-&amp;{7 -2.35 abc def}
-&amp;{a:7 b:-2.35 c:abc def}
-&amp;main.T{a:7, b:-2.35, c:"abc\tdef"}
-map[string]int{"CST":-21600, "EST":-18000, "MST":-25200, "PST":-28800, "UTC":0}
-</pre>
-<p>
-(Note the ampersands.)
-That quoted string format is also available through <code>%q</code> when
-applied to a value of type <code>string</code> or <code>[]byte</code>.
-The alternate format <code>%#q</code> will use backquotes instead if possible.
-(The <code>%q</code> format also applies to integers and runes, producing a
-single-quoted rune constant.)
-Also, <code>%x</code> works on strings, byte arrays and byte slices as well as
-on integers, generating a long hexadecimal string, and with
-a space in the format (<code>%&nbsp;x</code>) it puts spaces between the bytes.
-</p>
-<p>
-Another handy format is <code>%T</code>, which prints the <em>type</em> of a value.
-</p>
-<pre>
-fmt.Printf(&quot;%T\n&quot;, timeZone)
-</pre>
-<p>
-prints
-</p>
-<pre>
-map[string]int
-</pre>
-<p>
-If you want to control the default format for a custom type, all that's required is to define
-a method with the signature <code>String() string</code> on the type.
-For our simple type <code>T</code>, that might look like this.
-</p>
-<pre>
-func (t *T) String() string {
- return fmt.Sprintf("%d/%g/%q", t.a, t.b, t.c)
-}
-fmt.Printf("%v\n", t)
-</pre>
-<p>
-to print in the format
-</p>
-<pre>
-7/-2.35/"abc\tdef"
-</pre>
-<p>
-(If you need to print <em>values</em> of type <code>T</code> as well as pointers to <code>T</code>,
-the receiver for <code>String</code> must be of value type; this example used a pointer because
-that's more efficient and idiomatic for struct types.
-See the section below on <a href="#pointers_vs_values">pointers vs. value receivers</a> for more information.)
-</p>
-
-<p>
-Our <code>String</code> method is able to call <code>Sprintf</code> because the
-print routines are fully reentrant and can be wrapped this way.
-There is one important detail to understand about this approach,
-however: don't construct a <code>String</code> method by calling
-<code>Sprintf</code> in a way that will recur into your <code>String</code>
-method indefinitely. This can happen if the <code>Sprintf</code>
-call attempts to print the receiver directly as a string, which in
-turn will invoke the method again. It's a common and easy mistake
-to make, as this example shows.
-</p>
-
-<pre>
-type MyString string
-
-func (m MyString) String() string {
- return fmt.Sprintf("MyString=%s", m) // Error: will recur forever.
-}
-</pre>
-
-<p>
-It's also easy to fix: convert the argument to the basic string type, which does not have the
-method.
-</p>
-
-<pre>
-type MyString string
-func (m MyString) String() string {
- return fmt.Sprintf("MyString=%s", string(m)) // OK: note conversion.
-}
-</pre>
-
-<p>
-In the <a href="#initialization">initialization section</a> we'll see another technique that avoids this recursion.
-</p>
-
-<p>
-Another printing technique is to pass a print routine's arguments directly to another such routine.
-The signature of <code>Printf</code> uses the type <code>...interface{}</code>
-for its final argument to specify that an arbitrary number of parameters (of arbitrary type)
-can appear after the format.
-</p>
-<pre>
-func Printf(format string, v ...interface{}) (n int, err error) {
-</pre>
-<p>
-Within the function <code>Printf</code>, <code>v</code> acts like a variable of type
-<code>[]interface{}</code> but if it is passed to another variadic function, it acts like
-a regular list of arguments.
-Here is the implementation of the
-function <code>log.Println</code> we used above. It passes its arguments directly to
-<code>fmt.Sprintln</code> for the actual formatting.
-</p>
-<pre>
-// Println prints to the standard logger in the manner of fmt.Println.
-func Println(v ...interface{}) {
- std.Output(2, fmt.Sprintln(v...)) // Output takes parameters (int, string)
-}
-</pre>
-<p>
-We write <code>...</code> after <code>v</code> in the nested call to <code>Sprintln</code> to tell the
-compiler to treat <code>v</code> as a list of arguments; otherwise it would just pass
-<code>v</code> as a single slice argument.
-</p>
-<p>
-There's even more to printing than we've covered here. See the <code>godoc</code> documentation
-for package <code>fmt</code> for the details.
-</p>
-<p>
-By the way, a <code>...</code> parameter can be of a specific type, for instance <code>...int</code>
-for a min function that chooses the least of a list of integers:
-</p>
-<pre>
-func Min(a ...int) int {
- min := int(^uint(0) &gt;&gt; 1) // largest int
- for _, i := range a {
- if i &lt; min {
- min = i
- }
- }
- return min
-}
-</pre>
-
-<h3 id="append">Append</h3>
-<p>
-Now we have the missing piece we needed to explain the design of
-the <code>append</code> built-in function. The signature of <code>append</code>
-is different from our custom <code>Append</code> function above.
-Schematically, it's like this:
-</p>
-<pre>
-func append(slice []<i>T</i>, elements ...<i>T</i>) []<i>T</i>
-</pre>
-<p>
-where <i>T</i> is a placeholder for any given type. You can't
-actually write a function in Go where the type <code>T</code>
-is determined by the caller.
-That's why <code>append</code> is built in: it needs support from the
-compiler.
-</p>
-<p>
-What <code>append</code> does is append the elements to the end of
-the slice and return the result. The result needs to be returned
-because, as with our hand-written <code>Append</code>, the underlying
-array may change. This simple example
-</p>
-<pre>
-x := []int{1,2,3}
-x = append(x, 4, 5, 6)
-fmt.Println(x)
-</pre>
-<p>
-prints <code>[1 2 3 4 5 6]</code>. So <code>append</code> works a
-little like <code>Printf</code>, collecting an arbitrary number of
-arguments.
-</p>
-<p>
-But what if we wanted to do what our <code>Append</code> does and
-append a slice to a slice? Easy: use <code>...</code> at the call
-site, just as we did in the call to <code>Output</code> above. This
-snippet produces identical output to the one above.
-</p>
-<pre>
-x := []int{1,2,3}
-y := []int{4,5,6}
-x = append(x, y...)
-fmt.Println(x)
-</pre>
-<p>
-Without that <code>...</code>, it wouldn't compile because the types
-would be wrong; <code>y</code> is not of type <code>int</code>.
-</p>
-
-<h2 id="initialization">Initialization</h2>
-
-<p>
-Although it doesn't look superficially very different from
-initialization in C or C++, initialization in Go is more powerful.
-Complex structures can be built during initialization and the ordering
-issues among initialized objects, even among different packages, are handled
-correctly.
-</p>
-
-<h3 id="constants">Constants</h3>
-
-<p>
-Constants in Go are just that&mdash;constant.
-They are created at compile time, even when defined as
-locals in functions,
-and can only be numbers, characters (runes), strings or booleans.
-Because of the compile-time restriction, the expressions
-that define them must be constant expressions,
-evaluatable by the compiler. For instance,
-<code>1&lt;&lt;3</code> is a constant expression, while
-<code>math.Sin(math.Pi/4)</code> is not because
-the function call to <code>math.Sin</code> needs
-to happen at run time.
-</p>
-
-<p>
-In Go, enumerated constants are created using the <code>iota</code>
-enumerator. Since <code>iota</code> can be part of an expression and
-expressions can be implicitly repeated, it is easy to build intricate
-sets of values.
-</p>
-{{code "/doc/progs/eff_bytesize.go" `/^type ByteSize/` `/^\)/`}}
-<p>
-The ability to attach a method such as <code>String</code> to any
-user-defined type makes it possible for arbitrary values to format themselves
-automatically for printing.
-Although you'll see it most often applied to structs, this technique is also useful for
-scalar types such as floating-point types like <code>ByteSize</code>.
-</p>
-{{code "/doc/progs/eff_bytesize.go" `/^func.*ByteSize.*String/` `/^}/`}}
-<p>
-The expression <code>YB</code> prints as <code>1.00YB</code>,
-while <code>ByteSize(1e13)</code> prints as <code>9.09TB</code>.
-</p>
-
-<p>
-The use here of <code>Sprintf</code>
-to implement <code>ByteSize</code>'s <code>String</code> method is safe
-(avoids recurring indefinitely) not because of a conversion but
-because it calls <code>Sprintf</code> with <code>%f</code>,
-which is not a string format: <code>Sprintf</code> will only call
-the <code>String</code> method when it wants a string, and <code>%f</code>
-wants a floating-point value.
-</p>
-
-<h3 id="variables">Variables</h3>
-
-<p>
-Variables can be initialized just like constants but the
-initializer can be a general expression computed at run time.
-</p>
-<pre>
-var (
- home = os.Getenv("HOME")
- user = os.Getenv("USER")
- gopath = os.Getenv("GOPATH")
-)
-</pre>
-
-<h3 id="init">The init function</h3>
-
-<p>
-Finally, each source file can define its own niladic <code>init</code> function to
-set up whatever state is required. (Actually each file can have multiple
-<code>init</code> functions.)
-And finally means finally: <code>init</code> is called after all the
-variable declarations in the package have evaluated their initializers,
-and those are evaluated only after all the imported packages have been
-initialized.
-</p>
-<p>
-Besides initializations that cannot be expressed as declarations,
-a common use of <code>init</code> functions is to verify or repair
-correctness of the program state before real execution begins.
-</p>
-
-<pre>
-func init() {
- if user == "" {
- log.Fatal("$USER not set")
- }
- if home == "" {
- home = "/home/" + user
- }
- if gopath == "" {
- gopath = home + "/go"
- }
- // gopath may be overridden by --gopath flag on command line.
- flag.StringVar(&amp;gopath, "gopath", gopath, "override default GOPATH")
-}
-</pre>
-
-<h2 id="methods">Methods</h2>
-
-<h3 id="pointers_vs_values">Pointers vs. Values</h3>
-<p>
-As we saw with <code>ByteSize</code>,
-methods can be defined for any named type (except a pointer or an interface);
-the receiver does not have to be a struct.
-</p>
-<p>
-In the discussion of slices above, we wrote an <code>Append</code>
-function. We can define it as a method on slices instead. To do
-this, we first declare a named type to which we can bind the method, and
-then make the receiver for the method a value of that type.
-</p>
-<pre>
-type ByteSlice []byte
-
-func (slice ByteSlice) Append(data []byte) []byte {
- // Body exactly the same as the Append function defined above.
-}
-</pre>
-<p>
-This still requires the method to return the updated slice. We can
-eliminate that clumsiness by redefining the method to take a
-<i>pointer</i> to a <code>ByteSlice</code> as its receiver, so the
-method can overwrite the caller's slice.
-</p>
-<pre>
-func (p *ByteSlice) Append(data []byte) {
- slice := *p
- // Body as above, without the return.
- *p = slice
-}
-</pre>
-<p>
-In fact, we can do even better. If we modify our function so it looks
-like a standard <code>Write</code> method, like this,
-</p>
-<pre>
-func (p *ByteSlice) Write(data []byte) (n int, err error) {
- slice := *p
- // Again as above.
- *p = slice
- return len(data), nil
-}
-</pre>
-<p>
-then the type <code>*ByteSlice</code> satisfies the standard interface
-<code>io.Writer</code>, which is handy. For instance, we can
-print into one.
-</p>
-<pre>
- var b ByteSlice
- fmt.Fprintf(&amp;b, "This hour has %d days\n", 7)
-</pre>
-<p>
-We pass the address of a <code>ByteSlice</code>
-because only <code>*ByteSlice</code> satisfies <code>io.Writer</code>.
-The rule about pointers vs. values for receivers is that value methods
-can be invoked on pointers and values, but pointer methods can only be
-invoked on pointers.
-</p>
-
-<p>
-This rule arises because pointer methods can modify the receiver; invoking
-them on a value would cause the method to receive a copy of the value, so
-any modifications would be discarded.
-The language therefore disallows this mistake.
-There is a handy exception, though. When the value is addressable, the
-language takes care of the common case of invoking a pointer method on a
-value by inserting the address operator automatically.
-In our example, the variable <code>b</code> is addressable, so we can call
-its <code>Write</code> method with just <code>b.Write</code>. The compiler
-will rewrite that to <code>(&amp;b).Write</code> for us.
-</p>
-
-<p>
-By the way, the idea of using <code>Write</code> on a slice of bytes
-is central to the implementation of <code>bytes.Buffer</code>.
-</p>
-
-<h2 id="interfaces_and_types">Interfaces and other types</h2>
-
-<h3 id="interfaces">Interfaces</h3>
-<p>
-Interfaces in Go provide a way to specify the behavior of an
-object: if something can do <em>this</em>, then it can be used
-<em>here</em>. We've seen a couple of simple examples already;
-custom printers can be implemented by a <code>String</code> method
-while <code>Fprintf</code> can generate output to anything
-with a <code>Write</code> method.
-Interfaces with only one or two methods are common in Go code, and are
-usually given a name derived from the method, such as <code>io.Writer</code>
-for something that implements <code>Write</code>.
-</p>
-<p>
-A type can implement multiple interfaces.
-For instance, a collection can be sorted
-by the routines in package <code>sort</code> if it implements
-<code>sort.Interface</code>, which contains <code>Len()</code>,
-<code>Less(i, j int) bool</code>, and <code>Swap(i, j int)</code>,
-and it could also have a custom formatter.
-In this contrived example <code>Sequence</code> satisfies both.
-</p>
-{{code "/doc/progs/eff_sequence.go" `/^type/` "$"}}
-
-<h3 id="conversions">Conversions</h3>
-
-<p>
-The <code>String</code> method of <code>Sequence</code> is recreating the
-work that <code>Sprint</code> already does for slices.
-(It also has complexity O(N²), which is poor.) We can share the
-effort (and also speed it up) if we convert the <code>Sequence</code> to a plain
-<code>[]int</code> before calling <code>Sprint</code>.
-</p>
-<pre>
-func (s Sequence) String() string {
- s = s.Copy()
- sort.Sort(s)
- return fmt.Sprint([]int(s))
-}
-</pre>
-<p>
-This method is another example of the conversion technique for calling
-<code>Sprintf</code> safely from a <code>String</code> method.
-Because the two types (<code>Sequence</code> and <code>[]int</code>)
-are the same if we ignore the type name, it's legal to convert between them.
-The conversion doesn't create a new value, it just temporarily acts
-as though the existing value has a new type.
-(There are other legal conversions, such as from integer to floating point, that
-do create a new value.)
-</p>
-<p>
-It's an idiom in Go programs to convert the
-type of an expression to access a different
-set of methods. As an example, we could use the existing
-type <code>sort.IntSlice</code> to reduce the entire example
-to this:
-</p>
-<pre>
-type Sequence []int
-
-// Method for printing - sorts the elements before printing
-func (s Sequence) String() string {
- s = s.Copy()
- sort.IntSlice(s).Sort()
- return fmt.Sprint([]int(s))
-}
-</pre>
-<p>
-Now, instead of having <code>Sequence</code> implement multiple
-interfaces (sorting and printing), we're using the ability of a data item to be
-converted to multiple types (<code>Sequence</code>, <code>sort.IntSlice</code>
-and <code>[]int</code>), each of which does some part of the job.
-That's more unusual in practice but can be effective.
-</p>
-
-<h3 id="interface_conversions">Interface conversions and type assertions</h3>
-
-<p>
-<a href="#type_switch">Type switches</a> are a form of conversion: they take an interface and, for
-each case in the switch, in a sense convert it to the type of that case.
-Here's a simplified version of how the code under <code>fmt.Printf</code> turns a value into
-a string using a type switch.
-If it's already a string, we want the actual string value held by the interface, while if it has a
-<code>String</code> method we want the result of calling the method.
-</p>
-
-<pre>
-type Stringer interface {
- String() string
-}
-
-var value interface{} // Value provided by caller.
-switch str := value.(type) {
-case string:
- return str
-case Stringer:
- return str.String()
-}
-</pre>
-
-<p>
-The first case finds a concrete value; the second converts the interface into another interface.
-It's perfectly fine to mix types this way.
-</p>
-
-<p>
-What if there's only one type we care about? If we know the value holds a <code>string</code>
-and we just want to extract it?
-A one-case type switch would do, but so would a <em>type assertion</em>.
-A type assertion takes an interface value and extracts from it a value of the specified explicit type.
-The syntax borrows from the clause opening a type switch, but with an explicit
-type rather than the <code>type</code> keyword:
-</p>
-
-<pre>
-value.(typeName)
-</pre>
-
-<p>
-and the result is a new value with the static type <code>typeName</code>.
-That type must either be the concrete type held by the interface, or a second interface
-type that the value can be converted to.
-To extract the string we know is in the value, we could write:
-</p>
-
-<pre>
-str := value.(string)
-</pre>
-
-<p>
-But if it turns out that the value does not contain a string, the program will crash with a run-time error.
-To guard against that, use the "comma, ok" idiom to test, safely, whether the value is a string:
-</p>
-
-<pre>
-str, ok := value.(string)
-if ok {
- fmt.Printf("string value is: %q\n", str)
-} else {
- fmt.Printf("value is not a string\n")
-}
-</pre>
-
-<p>
-If the type assertion fails, <code>str</code> will still exist and be of type string, but it will have
-the zero value, an empty string.
-</p>
-
-<p>
-As an illustration of the capability, here's an <code>if</code>-<code>else</code>
-statement that's equivalent to the type switch that opened this section.
-</p>
-
-<pre>
-if str, ok := value.(string); ok {
- return str
-} else if str, ok := value.(Stringer); ok {
- return str.String()
-}
-</pre>
-
-<h3 id="generality">Generality</h3>
-<p>
-If a type exists only to implement an interface and will
-never have exported methods beyond that interface, there is
-no need to export the type itself.
-Exporting just the interface makes it clear the value has no
-interesting behavior beyond what is described in the
-interface.
-It also avoids the need to repeat the documentation
-on every instance of a common method.
-</p>
-<p>
-In such cases, the constructor should return an interface value
-rather than the implementing type.
-As an example, in the hash libraries
-both <code>crc32.NewIEEE</code> and <code>adler32.New</code>
-return the interface type <code>hash.Hash32</code>.
-Substituting the CRC-32 algorithm for Adler-32 in a Go program
-requires only changing the constructor call;
-the rest of the code is unaffected by the change of algorithm.
-</p>
-<p>
-A similar approach allows the streaming cipher algorithms
-in the various <code>crypto</code> packages to be
-separated from the block ciphers they chain together.
-The <code>Block</code> interface
-in the <code>crypto/cipher</code> package specifies the
-behavior of a block cipher, which provides encryption
-of a single block of data.
-Then, by analogy with the <code>bufio</code> package,
-cipher packages that implement this interface
-can be used to construct streaming ciphers, represented
-by the <code>Stream</code> interface, without
-knowing the details of the block encryption.
-</p>
-<p>
-The <code>crypto/cipher</code> interfaces look like this:
-</p>
-<pre>
-type Block interface {
- BlockSize() int
- Encrypt(dst, src []byte)
- Decrypt(dst, src []byte)
-}
-
-type Stream interface {
- XORKeyStream(dst, src []byte)
-}
-</pre>
-
-<p>
-Here's the definition of the counter mode (CTR) stream,
-which turns a block cipher into a streaming cipher; notice
-that the block cipher's details are abstracted away:
-</p>
-
-<pre>
-// NewCTR returns a Stream that encrypts/decrypts using the given Block in
-// counter mode. The length of iv must be the same as the Block's block size.
-func NewCTR(block Block, iv []byte) Stream
-</pre>
-<p>
-<code>NewCTR</code> applies not
-just to one specific encryption algorithm and data source but to any
-implementation of the <code>Block</code> interface and any
-<code>Stream</code>. Because they return
-interface values, replacing CTR
-encryption with other encryption modes is a localized change. The constructor
-calls must be edited, but because the surrounding code must treat the result only
-as a <code>Stream</code>, it won't notice the difference.
-</p>
-
-<h3 id="interface_methods">Interfaces and methods</h3>
-<p>
-Since almost anything can have methods attached, almost anything can
-satisfy an interface. One illustrative example is in the <code>http</code>
-package, which defines the <code>Handler</code> interface. Any object
-that implements <code>Handler</code> can serve HTTP requests.
-</p>
-<pre>
-type Handler interface {
- ServeHTTP(ResponseWriter, *Request)
-}
-</pre>
-<p>
-<code>ResponseWriter</code> is itself an interface that provides access
-to the methods needed to return the response to the client.
-Those methods include the standard <code>Write</code> method, so an
-<code>http.ResponseWriter</code> can be used wherever an <code>io.Writer</code>
-can be used.
-<code>Request</code> is a struct containing a parsed representation
-of the request from the client.
-</p>
-<p>
-For brevity, let's ignore POSTs and assume HTTP requests are always
-GETs; that simplification does not affect the way the handlers are set up.
-Here's a trivial implementation of a handler to count the number of times
-the page is visited.
-</p>
-<pre>
-// Simple counter server.
-type Counter struct {
- n int
-}
-
-func (ctr *Counter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- ctr.n++
- fmt.Fprintf(w, "counter = %d\n", ctr.n)
-}
-</pre>
-<p>
-(Keeping with our theme, note how <code>Fprintf</code> can print to an
-<code>http.ResponseWriter</code>.)
-In a real server, access to <code>ctr.n</code> would need protection from
-concurrent access.
-See the <code>sync</code> and <code>atomic</code> packages for suggestions.
-</p>
-<p>
-For reference, here's how to attach such a server to a node on the URL tree.
-</p>
-<pre>
-import "net/http"
-...
-ctr := new(Counter)
-http.Handle("/counter", ctr)
-</pre>
-<p>
-But why make <code>Counter</code> a struct? An integer is all that's needed.
-(The receiver needs to be a pointer so the increment is visible to the caller.)
-</p>
-<pre>
-// Simpler counter server.
-type Counter int
-
-func (ctr *Counter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- *ctr++
- fmt.Fprintf(w, "counter = %d\n", *ctr)
-}
-</pre>
-<p>
-What if your program has some internal state that needs to be notified that a page
-has been visited? Tie a channel to the web page.
-</p>
-<pre>
-// A channel that sends a notification on each visit.
-// (Probably want the channel to be buffered.)
-type Chan chan *http.Request
-
-func (ch Chan) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- ch &lt;- req
- fmt.Fprint(w, "notification sent")
-}
-</pre>
-<p>
-Finally, let's say we wanted to present on <code>/args</code> the arguments
-used when invoking the server binary.
-It's easy to write a function to print the arguments.
-</p>
-<pre>
-func ArgServer() {
- fmt.Println(os.Args)
-}
-</pre>
-<p>
-How do we turn that into an HTTP server? We could make <code>ArgServer</code>
-a method of some type whose value we ignore, but there's a cleaner way.
-Since we can define a method for any type except pointers and interfaces,
-we can write a method for a function.
-The <code>http</code> package contains this code:
-</p>
-<pre>
-// The HandlerFunc type is an adapter to allow the use of
-// ordinary functions as HTTP handlers. If f is a function
-// with the appropriate signature, HandlerFunc(f) is a
-// Handler object that calls f.
-type HandlerFunc func(ResponseWriter, *Request)
-
-// ServeHTTP calls f(w, req).
-func (f HandlerFunc) ServeHTTP(w ResponseWriter, req *Request) {
- f(w, req)
-}
-</pre>
-<p>
-<code>HandlerFunc</code> is a type with a method, <code>ServeHTTP</code>,
-so values of that type can serve HTTP requests. Look at the implementation
-of the method: the receiver is a function, <code>f</code>, and the method
-calls <code>f</code>. That may seem odd but it's not that different from, say,
-the receiver being a channel and the method sending on the channel.
-</p>
-<p>
-To make <code>ArgServer</code> into an HTTP server, we first modify it
-to have the right signature.
-</p>
-<pre>
-// Argument server.
-func ArgServer(w http.ResponseWriter, req *http.Request) {
- fmt.Fprintln(w, os.Args)
-}
-</pre>
-<p>
-<code>ArgServer</code> now has same signature as <code>HandlerFunc</code>,
-so it can be converted to that type to access its methods,
-just as we converted <code>Sequence</code> to <code>IntSlice</code>
-to access <code>IntSlice.Sort</code>.
-The code to set it up is concise:
-</p>
-<pre>
-http.Handle("/args", http.HandlerFunc(ArgServer))
-</pre>
-<p>
-When someone visits the page <code>/args</code>,
-the handler installed at that page has value <code>ArgServer</code>
-and type <code>HandlerFunc</code>.
-The HTTP server will invoke the method <code>ServeHTTP</code>
-of that type, with <code>ArgServer</code> as the receiver, which will in turn call
-<code>ArgServer</code> (via the invocation <code>f(w, req)</code>
-inside <code>HandlerFunc.ServeHTTP</code>).
-The arguments will then be displayed.
-</p>
-<p>
-In this section we have made an HTTP server from a struct, an integer,
-a channel, and a function, all because interfaces are just sets of
-methods, which can be defined for (almost) any type.
-</p>
-
-<h2 id="blank">The blank identifier</h2>
-
-<p>
-We've mentioned the blank identifier a couple of times now, in the context of
-<a href="#for"><code>for</code> <code>range</code> loops</a>
-and <a href="#maps">maps</a>.
-The blank identifier can be assigned or declared with any value of any type, with the
-value discarded harmlessly.
-It's a bit like writing to the Unix <code>/dev/null</code> file:
-it represents a write-only value
-to be used as a place-holder
-where a variable is needed but the actual value is irrelevant.
-It has uses beyond those we've seen already.
-</p>
-
-<h3 id="blank_assign">The blank identifier in multiple assignment</h3>
-
-<p>
-The use of a blank identifier in a <code>for</code> <code>range</code> loop is a
-special case of a general situation: multiple assignment.
-</p>
-
-<p>
-If an assignment requires multiple values on the left side,
-but one of the values will not be used by the program,
-a blank identifier on the left-hand-side of
-the assignment avoids the need
-to create a dummy variable and makes it clear that the
-value is to be discarded.
-For instance, when calling a function that returns
-a value and an error, but only the error is important,
-use the blank identifier to discard the irrelevant value.
-</p>
-
-<pre>
-if _, err := os.Stat(path); os.IsNotExist(err) {
- fmt.Printf("%s does not exist\n", path)
-}
-</pre>
-
-<p>
-Occasionally you'll see code that discards the error value in order
-to ignore the error; this is terrible practice. Always check error returns;
-they're provided for a reason.
-</p>
-
-<pre>
-// Bad! This code will crash if path does not exist.
-fi, _ := os.Stat(path)
-if fi.IsDir() {
- fmt.Printf("%s is a directory\n", path)
-}
-</pre>
-
-<h3 id="blank_unused">Unused imports and variables</h3>
-
-<p>
-It is an error to import a package or to declare a variable without using it.
-Unused imports bloat the program and slow compilation,
-while a variable that is initialized but not used is at least
-a wasted computation and perhaps indicative of a
-larger bug.
-When a program is under active development, however,
-unused imports and variables often arise and it can
-be annoying to delete them just to have the compilation proceed,
-only to have them be needed again later.
-The blank identifier provides a workaround.
-</p>
-<p>
-This half-written program has two unused imports
-(<code>fmt</code> and <code>io</code>)
-and an unused variable (<code>fd</code>),
-so it will not compile, but it would be nice to see if the
-code so far is correct.
-</p>
-{{code "/doc/progs/eff_unused1.go" `/package/` `$`}}
-<p>
-To silence complaints about the unused imports, use a
-blank identifier to refer to a symbol from the imported package.
-Similarly, assigning the unused variable <code>fd</code>
-to the blank identifier will silence the unused variable error.
-This version of the program does compile.
-</p>
-{{code "/doc/progs/eff_unused2.go" `/package/` `$`}}
-
-<p>
-By convention, the global declarations to silence import errors
-should come right after the imports and be commented,
-both to make them easy to find and as a reminder to clean things up later.
-</p>
-
-<h3 id="blank_import">Import for side effect</h3>
-
-<p>
-An unused import like <code>fmt</code> or <code>io</code> in the
-previous example should eventually be used or removed:
-blank assignments identify code as a work in progress.
-But sometimes it is useful to import a package only for its
-side effects, without any explicit use.
-For example, during its <code>init</code> function,
-the <code><a href="/pkg/net/http/pprof/">net/http/pprof</a></code>
-package registers HTTP handlers that provide
-debugging information. It has an exported API, but
-most clients need only the handler registration and
-access the data through a web page.
-To import the package only for its side effects, rename the package
-to the blank identifier:
-</p>
-<pre>
-import _ "net/http/pprof"
-</pre>
-<p>
-This form of import makes clear that the package is being
-imported for its side effects, because there is no other possible
-use of the package: in this file, it doesn't have a name.
-(If it did, and we didn't use that name, the compiler would reject the program.)
-</p>
-
-<h3 id="blank_implements">Interface checks</h3>
-
-<p>
-As we saw in the discussion of <a href="#interfaces_and_types">interfaces</a> above,
-a type need not declare explicitly that it implements an interface.
-Instead, a type implements the interface just by implementing the interface's methods.
-In practice, most interface conversions are static and therefore checked at compile time.
-For example, passing an <code>*os.File</code> to a function
-expecting an <code>io.Reader</code> will not compile unless
-<code>*os.File</code> implements the <code>io.Reader</code> interface.
-</p>
-
-<p>
-Some interface checks do happen at run-time, though.
-One instance is in the <code><a href="/pkg/encoding/json/">encoding/json</a></code>
-package, which defines a <code><a href="/pkg/encoding/json/#Marshaler">Marshaler</a></code>
-interface. When the JSON encoder receives a value that implements that interface,
-the encoder invokes the value's marshaling method to convert it to JSON
-instead of doing the standard conversion.
-The encoder checks this property at run time with a <a href="#interface_conversions">type assertion</a> like:
-</p>
-
-<pre>
-m, ok := val.(json.Marshaler)
-</pre>
-
-<p>
-If it's necessary only to ask whether a type implements an interface, without
-actually using the interface itself, perhaps as part of an error check, use the blank
-identifier to ignore the type-asserted value:
-</p>
-
-<pre>
-if _, ok := val.(json.Marshaler); ok {
- fmt.Printf("value %v of type %T implements json.Marshaler\n", val, val)
-}
-</pre>
-
-<p>
-One place this situation arises is when it is necessary to guarantee within the package implementing the type that
-it actually satisfies the interface.
-If a type—for example,
-<code><a href="/pkg/encoding/json/#RawMessage">json.RawMessage</a></code>—needs
-a custom JSON representation, it should implement
-<code>json.Marshaler</code>, but there are no static conversions that would
-cause the compiler to verify this automatically.
-If the type inadvertently fails to satisfy the interface, the JSON encoder will still work,
-but will not use the custom implementation.
-To guarantee that the implementation is correct,
-a global declaration using the blank identifier can be used in the package:
-</p>
-<pre>
-var _ json.Marshaler = (*RawMessage)(nil)
-</pre>
-<p>
-In this declaration, the assignment involving a conversion of a
-<code>*RawMessage</code> to a <code>Marshaler</code>
-requires that <code>*RawMessage</code> implements <code>Marshaler</code>,
-and that property will be checked at compile time.
-Should the <code>json.Marshaler</code> interface change, this package
-will no longer compile and we will be on notice that it needs to be updated.
-</p>
-
-<p>
-The appearance of the blank identifier in this construct indicates that
-the declaration exists only for the type checking,
-not to create a variable.
-Don't do this for every type that satisfies an interface, though.
-By convention, such declarations are only used
-when there are no static conversions already present in the code,
-which is a rare event.
-</p>
-
-
-<h2 id="embedding">Embedding</h2>
-
-<p>
-Go does not provide the typical, type-driven notion of subclassing,
-but it does have the ability to &ldquo;borrow&rdquo; pieces of an
-implementation by <em>embedding</em> types within a struct or
-interface.
-</p>
-<p>
-Interface embedding is very simple.
-We've mentioned the <code>io.Reader</code> and <code>io.Writer</code> interfaces before;
-here are their definitions.
-</p>
-<pre>
-type Reader interface {
- Read(p []byte) (n int, err error)
-}
-
-type Writer interface {
- Write(p []byte) (n int, err error)
-}
-</pre>
-<p>
-The <code>io</code> package also exports several other interfaces
-that specify objects that can implement several such methods.
-For instance, there is <code>io.ReadWriter</code>, an interface
-containing both <code>Read</code> and <code>Write</code>.
-We could specify <code>io.ReadWriter</code> by listing the
-two methods explicitly, but it's easier and more evocative
-to embed the two interfaces to form the new one, like this:
-</p>
-<pre>
-// ReadWriter is the interface that combines the Reader and Writer interfaces.
-type ReadWriter interface {
- Reader
- Writer
-}
-</pre>
-<p>
-This says just what it looks like: A <code>ReadWriter</code> can do
-what a <code>Reader</code> does <em>and</em> what a <code>Writer</code>
-does; it is a union of the embedded interfaces.
-Only interfaces can be embedded within interfaces.
-</p>
-<p>
-The same basic idea applies to structs, but with more far-reaching
-implications. The <code>bufio</code> package has two struct types,
-<code>bufio.Reader</code> and <code>bufio.Writer</code>, each of
-which of course implements the analogous interfaces from package
-<code>io</code>.
-And <code>bufio</code> also implements a buffered reader/writer,
-which it does by combining a reader and a writer into one struct
-using embedding: it lists the types within the struct
-but does not give them field names.
-</p>
-<pre>
-// ReadWriter stores pointers to a Reader and a Writer.
-// It implements io.ReadWriter.
-type ReadWriter struct {
- *Reader // *bufio.Reader
- *Writer // *bufio.Writer
-}
-</pre>
-<p>
-The embedded elements are pointers to structs and of course
-must be initialized to point to valid structs before they
-can be used.
-The <code>ReadWriter</code> struct could be written as
-</p>
-<pre>
-type ReadWriter struct {
- reader *Reader
- writer *Writer
-}
-</pre>
-<p>
-but then to promote the methods of the fields and to
-satisfy the <code>io</code> interfaces, we would also need
-to provide forwarding methods, like this:
-</p>
-<pre>
-func (rw *ReadWriter) Read(p []byte) (n int, err error) {
- return rw.reader.Read(p)
-}
-</pre>
-<p>
-By embedding the structs directly, we avoid this bookkeeping.
-The methods of embedded types come along for free, which means that <code>bufio.ReadWriter</code>
-not only has the methods of <code>bufio.Reader</code> and <code>bufio.Writer</code>,
-it also satisfies all three interfaces:
-<code>io.Reader</code>,
-<code>io.Writer</code>, and
-<code>io.ReadWriter</code>.
-</p>
-<p>
-There's an important way in which embedding differs from subclassing. When we embed a type,
-the methods of that type become methods of the outer type,
-but when they are invoked the receiver of the method is the inner type, not the outer one.
-In our example, when the <code>Read</code> method of a <code>bufio.ReadWriter</code> is
-invoked, it has exactly the same effect as the forwarding method written out above;
-the receiver is the <code>reader</code> field of the <code>ReadWriter</code>, not the
-<code>ReadWriter</code> itself.
-</p>
-<p>
-Embedding can also be a simple convenience.
-This example shows an embedded field alongside a regular, named field.
-</p>
-<pre>
-type Job struct {
- Command string
- *log.Logger
-}
-</pre>
-<p>
-The <code>Job</code> type now has the <code>Print</code>, <code>Printf</code>, <code>Println</code>
-and other
-methods of <code>*log.Logger</code>. We could have given the <code>Logger</code>
-a field name, of course, but it's not necessary to do so. And now, once
-initialized, we can
-log to the <code>Job</code>:
-</p>
-<pre>
-job.Println("starting now...")
-</pre>
-<p>
-The <code>Logger</code> is a regular field of the <code>Job</code> struct,
-so we can initialize it in the usual way inside the constructor for <code>Job</code>, like this,
-</p>
-<pre>
-func NewJob(command string, logger *log.Logger) *Job {
- return &amp;Job{command, logger}
-}
-</pre>
-<p>
-or with a composite literal,
-</p>
-<pre>
-job := &amp;Job{command, log.New(os.Stderr, "Job: ", log.Ldate)}
-</pre>
-<p>
-If we need to refer to an embedded field directly, the type name of the field,
-ignoring the package qualifier, serves as a field name, as it did
-in the <code>Read</code> method of our <code>ReadWriter</code> struct.
-Here, if we needed to access the
-<code>*log.Logger</code> of a <code>Job</code> variable <code>job</code>,
-we would write <code>job.Logger</code>,
-which would be useful if we wanted to refine the methods of <code>Logger</code>.
-</p>
-<pre>
-func (job *Job) Printf(format string, args ...interface{}) {
- job.Logger.Printf("%q: %s", job.Command, fmt.Sprintf(format, args...))
-}
-</pre>
-<p>
-Embedding types introduces the problem of name conflicts but the rules to resolve
-them are simple.
-First, a field or method <code>X</code> hides any other item <code>X</code> in a more deeply
-nested part of the type.
-If <code>log.Logger</code> contained a field or method called <code>Command</code>, the <code>Command</code> field
-of <code>Job</code> would dominate it.
-</p>
-<p>
-Second, if the same name appears at the same nesting level, it is usually an error;
-it would be erroneous to embed <code>log.Logger</code> if the <code>Job</code> struct
-contained another field or method called <code>Logger</code>.
-However, if the duplicate name is never mentioned in the program outside the type definition, it is OK.
-This qualification provides some protection against changes made to types embedded from outside; there
-is no problem if a field is added that conflicts with another field in another subtype if neither field
-is ever used.
-</p>
-
-
-<h2 id="concurrency">Concurrency</h2>
-
-<h3 id="sharing">Share by communicating</h3>
-
-<p>
-Concurrent programming is a large topic and there is space only for some
-Go-specific highlights here.
-</p>
-<p>
-Concurrent programming in many environments is made difficult by the
-subtleties required to implement correct access to shared variables. Go encourages
-a different approach in which shared values are passed around on channels
-and, in fact, never actively shared by separate threads of execution.
-Only one goroutine has access to the value at any given time.
-Data races cannot occur, by design.
-To encourage this way of thinking we have reduced it to a slogan:
-</p>
-<blockquote>
-Do not communicate by sharing memory;
-instead, share memory by communicating.
-</blockquote>
-<p>
-This approach can be taken too far. Reference counts may be best done
-by putting a mutex around an integer variable, for instance. But as a
-high-level approach, using channels to control access makes it easier
-to write clear, correct programs.
-</p>
-<p>
-One way to think about this model is to consider a typical single-threaded
-program running on one CPU. It has no need for synchronization primitives.
-Now run another such instance; it too needs no synchronization. Now let those
-two communicate; if the communication is the synchronizer, there's still no need
-for other synchronization. Unix pipelines, for example, fit this model
-perfectly. Although Go's approach to concurrency originates in Hoare's
-Communicating Sequential Processes (CSP),
-it can also be seen as a type-safe generalization of Unix pipes.
-</p>
-
-<h3 id="goroutines">Goroutines</h3>
-
-<p>
-They're called <em>goroutines</em> because the existing
-terms&mdash;threads, coroutines, processes, and so on&mdash;convey
-inaccurate connotations. A goroutine has a simple model: it is a
-function executing concurrently with other goroutines in the same
-address space. It is lightweight, costing little more than the
-allocation of stack space.
-And the stacks start small, so they are cheap, and grow
-by allocating (and freeing) heap storage as required.
-</p>
-<p>
-Goroutines are multiplexed onto multiple OS threads so if one should
-block, such as while waiting for I/O, others continue to run. Their
-design hides many of the complexities of thread creation and
-management.
-</p>
-<p>
-Prefix a function or method call with the <code>go</code>
-keyword to run the call in a new goroutine.
-When the call completes, the goroutine
-exits, silently. (The effect is similar to the Unix shell's
-<code>&amp;</code> notation for running a command in the
-background.)
-</p>
-<pre>
-go list.Sort() // run list.Sort concurrently; don't wait for it.
-</pre>
-<p>
-A function literal can be handy in a goroutine invocation.
-</p>
-<pre>
-func Announce(message string, delay time.Duration) {
- go func() {
- time.Sleep(delay)
- fmt.Println(message)
- }() // Note the parentheses - must call the function.
-}
-</pre>
-<p>
-In Go, function literals are closures: the implementation makes
-sure the variables referred to by the function survive as long as they are active.
-</p>
-<p>
-These examples aren't too practical because the functions have no way of signaling
-completion. For that, we need channels.
-</p>
-
-<h3 id="channels">Channels</h3>
-
-<p>
-Like maps, channels are allocated with <code>make</code>, and
-the resulting value acts as a reference to an underlying data structure.
-If an optional integer parameter is provided, it sets the buffer size for the channel.
-The default is zero, for an unbuffered or synchronous channel.
-</p>
-<pre>
-ci := make(chan int) // unbuffered channel of integers
-cj := make(chan int, 0) // unbuffered channel of integers
-cs := make(chan *os.File, 100) // buffered channel of pointers to Files
-</pre>
-<p>
-Unbuffered channels combine communication&mdash;the exchange of a value&mdash;with
-synchronization&mdash;guaranteeing that two calculations (goroutines) are in
-a known state.
-</p>
-<p>
-There are lots of nice idioms using channels. Here's one to get us started.
-In the previous section we launched a sort in the background. A channel
-can allow the launching goroutine to wait for the sort to complete.
-</p>
-<pre>
-c := make(chan int) // Allocate a channel.
-// Start the sort in a goroutine; when it completes, signal on the channel.
-go func() {
- list.Sort()
- c &lt;- 1 // Send a signal; value does not matter.
-}()
-doSomethingForAWhile()
-&lt;-c // Wait for sort to finish; discard sent value.
-</pre>
-<p>
-Receivers always block until there is data to receive.
-If the channel is unbuffered, the sender blocks until the receiver has
-received the value.
-If the channel has a buffer, the sender blocks only until the
-value has been copied to the buffer; if the buffer is full, this
-means waiting until some receiver has retrieved a value.
-</p>
-<p>
-A buffered channel can be used like a semaphore, for instance to
-limit throughput. In this example, incoming requests are passed
-to <code>handle</code>, which sends a value into the channel, processes
-the request, and then receives a value from the channel
-to ready the &ldquo;semaphore&rdquo; for the next consumer.
-The capacity of the channel buffer limits the number of
-simultaneous calls to <code>process</code>.
-</p>
-<pre>
-var sem = make(chan int, MaxOutstanding)
-
-func handle(r *Request) {
- sem &lt;- 1 // Wait for active queue to drain.
- process(r) // May take a long time.
- &lt;-sem // Done; enable next request to run.
-}
-
-func Serve(queue chan *Request) {
- for {
- req := &lt;-queue
- go handle(req) // Don't wait for handle to finish.
- }
-}
-</pre>
-
-<p>
-Once <code>MaxOutstanding</code> handlers are executing <code>process</code>,
-any more will block trying to send into the filled channel buffer,
-until one of the existing handlers finishes and receives from the buffer.
-</p>
-
-<p>
-This design has a problem, though: <code>Serve</code>
-creates a new goroutine for
-every incoming request, even though only <code>MaxOutstanding</code>
-of them can run at any moment.
-As a result, the program can consume unlimited resources if the requests come in too fast.
-We can address that deficiency by changing <code>Serve</code> to
-gate the creation of the goroutines.
-Here's an obvious solution, but beware it has a bug we'll fix subsequently:
-</p>
-
-<pre>
-func Serve(queue chan *Request) {
- for req := range queue {
- sem &lt;- 1
- go func() {
- process(req) // Buggy; see explanation below.
- &lt;-sem
- }()
- }
-}</pre>
-
-<p>
-The bug is that in a Go <code>for</code> loop, the loop variable
-is reused for each iteration, so the <code>req</code>
-variable is shared across all goroutines.
-That's not what we want.
-We need to make sure that <code>req</code> is unique for each goroutine.
-Here's one way to do that, passing the value of <code>req</code> as an argument
-to the closure in the goroutine:
-</p>
-
-<pre>
-func Serve(queue chan *Request) {
- for req := range queue {
- sem &lt;- 1
- go func(req *Request) {
- process(req)
- &lt;-sem
- }(req)
- }
-}</pre>
-
-<p>
-Compare this version with the previous to see the difference in how
-the closure is declared and run.
-Another solution is just to create a new variable with the same
-name, as in this example:
-</p>
-
-<pre>
-func Serve(queue chan *Request) {
- for req := range queue {
- req := req // Create new instance of req for the goroutine.
- sem &lt;- 1
- go func() {
- process(req)
- &lt;-sem
- }()
- }
-}</pre>
-
-<p>
-It may seem odd to write
-</p>
-
-<pre>
-req := req
-</pre>
-
-<p>
-but it's legal and idiomatic in Go to do this.
-You get a fresh version of the variable with the same name, deliberately
-shadowing the loop variable locally but unique to each goroutine.
-</p>
-
-<p>
-Going back to the general problem of writing the server,
-another approach that manages resources well is to start a fixed
-number of <code>handle</code> goroutines all reading from the request
-channel.
-The number of goroutines limits the number of simultaneous
-calls to <code>process</code>.
-This <code>Serve</code> function also accepts a channel on which
-it will be told to exit; after launching the goroutines it blocks
-receiving from that channel.
-</p>
-
-<pre>
-func handle(queue chan *Request) {
- for r := range queue {
- process(r)
- }
-}
-
-func Serve(clientRequests chan *Request, quit chan bool) {
- // Start handlers
- for i := 0; i &lt; MaxOutstanding; i++ {
- go handle(clientRequests)
- }
- &lt;-quit // Wait to be told to exit.
-}
-</pre>
-
-<h3 id="chan_of_chan">Channels of channels</h3>
-<p>
-One of the most important properties of Go is that
-a channel is a first-class value that can be allocated and passed
-around like any other. A common use of this property is
-to implement safe, parallel demultiplexing.
-</p>
-<p>
-In the example in the previous section, <code>handle</code> was
-an idealized handler for a request but we didn't define the
-type it was handling. If that type includes a channel on which
-to reply, each client can provide its own path for the answer.
-Here's a schematic definition of type <code>Request</code>.
-</p>
-<pre>
-type Request struct {
- args []int
- f func([]int) int
- resultChan chan int
-}
-</pre>
-<p>
-The client provides a function and its arguments, as well as
-a channel inside the request object on which to receive the answer.
-</p>
-<pre>
-func sum(a []int) (s int) {
- for _, v := range a {
- s += v
- }
- return
-}
-
-request := &amp;Request{[]int{3, 4, 5}, sum, make(chan int)}
-// Send request
-clientRequests &lt;- request
-// Wait for response.
-fmt.Printf("answer: %d\n", &lt;-request.resultChan)
-</pre>
-<p>
-On the server side, the handler function is the only thing that changes.
-</p>
-<pre>
-func handle(queue chan *Request) {
- for req := range queue {
- req.resultChan &lt;- req.f(req.args)
- }
-}
-</pre>
-<p>
-There's clearly a lot more to do to make it realistic, but this
-code is a framework for a rate-limited, parallel, non-blocking RPC
-system, and there's not a mutex in sight.
-</p>
-
-<h3 id="parallel">Parallelization</h3>
-<p>
-Another application of these ideas is to parallelize a calculation
-across multiple CPU cores. If the calculation can be broken into
-separate pieces that can execute independently, it can be parallelized,
-with a channel to signal when each piece completes.
-</p>
-<p>
-Let's say we have an expensive operation to perform on a vector of items,
-and that the value of the operation on each item is independent,
-as in this idealized example.
-</p>
-<pre>
-type Vector []float64
-
-// Apply the operation to v[i], v[i+1] ... up to v[n-1].
-func (v Vector) DoSome(i, n int, u Vector, c chan int) {
- for ; i &lt; n; i++ {
- v[i] += u.Op(v[i])
- }
- c &lt;- 1 // signal that this piece is done
-}
-</pre>
-<p>
-We launch the pieces independently in a loop, one per CPU.
-They can complete in any order but it doesn't matter; we just
-count the completion signals by draining the channel after
-launching all the goroutines.
-</p>
-<pre>
-const numCPU = 4 // number of CPU cores
-
-func (v Vector) DoAll(u Vector) {
- c := make(chan int, numCPU) // Buffering optional but sensible.
- for i := 0; i &lt; numCPU; i++ {
- go v.DoSome(i*len(v)/numCPU, (i+1)*len(v)/numCPU, u, c)
- }
- // Drain the channel.
- for i := 0; i &lt; numCPU; i++ {
- &lt;-c // wait for one task to complete
- }
- // All done.
-}
-</pre>
-<p>
-Rather than create a constant value for numCPU, we can ask the runtime what
-value is appropriate.
-The function <code><a href="/pkg/runtime#NumCPU">runtime.NumCPU</a></code>
-returns the number of hardware CPU cores in the machine, so we could write
-</p>
-<pre>
-var numCPU = runtime.NumCPU()
-</pre>
-<p>
-There is also a function
-<code><a href="/pkg/runtime#GOMAXPROCS">runtime.GOMAXPROCS</a></code>,
-which reports (or sets)
-the user-specified number of cores that a Go program can have running
-simultaneously.
-It defaults to the value of <code>runtime.NumCPU</code> but can be
-overridden by setting the similarly named shell environment variable
-or by calling the function with a positive number. Calling it with
-zero just queries the value.
-Therefore if we want to honor the user's resource request, we should write
-</p>
-<pre>
-var numCPU = runtime.GOMAXPROCS(0)
-</pre>
-<p>
-Be sure not to confuse the ideas of concurrency—structuring a program
-as independently executing components—and parallelism—executing
-calculations in parallel for efficiency on multiple CPUs.
-Although the concurrency features of Go can make some problems easy
-to structure as parallel computations, Go is a concurrent language,
-not a parallel one, and not all parallelization problems fit Go's model.
-For a discussion of the distinction, see the talk cited in
-<a href="//blog.golang.org/2013/01/concurrency-is-not-parallelism.html">this
-blog post</a>.
-
-<h3 id="leaky_buffer">A leaky buffer</h3>
-
-<p>
-The tools of concurrent programming can even make non-concurrent
-ideas easier to express. Here's an example abstracted from an RPC
-package. The client goroutine loops receiving data from some source,
-perhaps a network. To avoid allocating and freeing buffers, it keeps
-a free list, and uses a buffered channel to represent it. If the
-channel is empty, a new buffer gets allocated.
-Once the message buffer is ready, it's sent to the server on
-<code>serverChan</code>.
-</p>
-<pre>
-var freeList = make(chan *Buffer, 100)
-var serverChan = make(chan *Buffer)
-
-func client() {
- for {
- var b *Buffer
- // Grab a buffer if available; allocate if not.
- select {
- case b = &lt;-freeList:
- // Got one; nothing more to do.
- default:
- // None free, so allocate a new one.
- b = new(Buffer)
- }
- load(b) // Read next message from the net.
- serverChan &lt;- b // Send to server.
- }
-}
-</pre>
-<p>
-The server loop receives each message from the client, processes it,
-and returns the buffer to the free list.
-</p>
-<pre>
-func server() {
- for {
- b := &lt;-serverChan // Wait for work.
- process(b)
- // Reuse buffer if there's room.
- select {
- case freeList &lt;- b:
- // Buffer on free list; nothing more to do.
- default:
- // Free list full, just carry on.
- }
- }
-}
-</pre>
-<p>
-The client attempts to retrieve a buffer from <code>freeList</code>;
-if none is available, it allocates a fresh one.
-The server's send to <code>freeList</code> puts <code>b</code> back
-on the free list unless the list is full, in which case the
-buffer is dropped on the floor to be reclaimed by
-the garbage collector.
-(The <code>default</code> clauses in the <code>select</code>
-statements execute when no other case is ready,
-meaning that the <code>selects</code> never block.)
-This implementation builds a leaky bucket free list
-in just a few lines, relying on the buffered channel and
-the garbage collector for bookkeeping.
-</p>
-
-<h2 id="errors">Errors</h2>
-
-<p>
-Library routines must often return some sort of error indication to
-the caller.
-As mentioned earlier, Go's multivalue return makes it
-easy to return a detailed error description alongside the normal
-return value.
-It is good style to use this feature to provide detailed error information.
-For example, as we'll see, <code>os.Open</code> doesn't
-just return a <code>nil</code> pointer on failure, it also returns an
-error value that describes what went wrong.
-</p>
-
-<p>
-By convention, errors have type <code>error</code>,
-a simple built-in interface.
-</p>
-<pre>
-type error interface {
- Error() string
-}
-</pre>
-<p>
-A library writer is free to implement this interface with a
-richer model under the covers, making it possible not only
-to see the error but also to provide some context.
-As mentioned, alongside the usual <code>*os.File</code>
-return value, <code>os.Open</code> also returns an
-error value.
-If the file is opened successfully, the error will be <code>nil</code>,
-but when there is a problem, it will hold an
-<code>os.PathError</code>:
-</p>
-<pre>
-// PathError records an error and the operation and
-// file path that caused it.
-type PathError struct {
- Op string // "open", "unlink", etc.
- Path string // The associated file.
- Err error // Returned by the system call.
-}
-
-func (e *PathError) Error() string {
- return e.Op + " " + e.Path + ": " + e.Err.Error()
-}
-</pre>
-<p>
-<code>PathError</code>'s <code>Error</code> generates
-a string like this:
-</p>
-<pre>
-open /etc/passwx: no such file or directory
-</pre>
-<p>
-Such an error, which includes the problematic file name, the
-operation, and the operating system error it triggered, is useful even
-if printed far from the call that caused it;
-it is much more informative than the plain
-"no such file or directory".
-</p>
-
-<p>
-When feasible, error strings should identify their origin, such as by having
-a prefix naming the operation or package that generated the error. For example, in package
-<code>image</code>, the string representation for a decoding error due to an
-unknown format is "image: unknown format".
-</p>
-
-<p>
-Callers that care about the precise error details can
-use a type switch or a type assertion to look for specific
-errors and extract details. For <code>PathErrors</code>
-this might include examining the internal <code>Err</code>
-field for recoverable failures.
-</p>
-
-<pre>
-for try := 0; try &lt; 2; try++ {
- file, err = os.Create(filename)
- if err == nil {
- return
- }
- if e, ok := err.(*os.PathError); ok &amp;&amp; e.Err == syscall.ENOSPC {
- deleteTempFiles() // Recover some space.
- continue
- }
- return
-}
-</pre>
-
-<p>
-The second <code>if</code> statement here is another <a href="#interface_conversions">type assertion</a>.
-If it fails, <code>ok</code> will be false, and <code>e</code>
-will be <code>nil</code>.
-If it succeeds, <code>ok</code> will be true, which means the
-error was of type <code>*os.PathError</code>, and then so is <code>e</code>,
-which we can examine for more information about the error.
-</p>
-
-<h3 id="panic">Panic</h3>
-
-<p>
-The usual way to report an error to a caller is to return an
-<code>error</code> as an extra return value. The canonical
-<code>Read</code> method is a well-known instance; it returns a byte
-count and an <code>error</code>. But what if the error is
-unrecoverable? Sometimes the program simply cannot continue.
-</p>
-
-<p>
-For this purpose, there is a built-in function <code>panic</code>
-that in effect creates a run-time error that will stop the program
-(but see the next section). The function takes a single argument
-of arbitrary type&mdash;often a string&mdash;to be printed as the
-program dies. It's also a way to indicate that something impossible has
-happened, such as exiting an infinite loop.
-</p>
-
-
-<pre>
-// A toy implementation of cube root using Newton's method.
-func CubeRoot(x float64) float64 {
- z := x/3 // Arbitrary initial value
- for i := 0; i &lt; 1e6; i++ {
- prevz := z
- z -= (z*z*z-x) / (3*z*z)
- if veryClose(z, prevz) {
- return z
- }
- }
- // A million iterations has not converged; something is wrong.
- panic(fmt.Sprintf("CubeRoot(%g) did not converge", x))
-}
-</pre>
-
-<p>
-This is only an example but real library functions should
-avoid <code>panic</code>. If the problem can be masked or worked
-around, it's always better to let things continue to run rather
-than taking down the whole program. One possible counterexample
-is during initialization: if the library truly cannot set itself up,
-it might be reasonable to panic, so to speak.
-</p>
-
-<pre>
-var user = os.Getenv("USER")
-
-func init() {
- if user == "" {
- panic("no value for $USER")
- }
-}
-</pre>
-
-<h3 id="recover">Recover</h3>
-
-<p>
-When <code>panic</code> is called, including implicitly for run-time
-errors such as indexing a slice out of bounds or failing a type
-assertion, it immediately stops execution of the current function
-and begins unwinding the stack of the goroutine, running any deferred
-functions along the way. If that unwinding reaches the top of the
-goroutine's stack, the program dies. However, it is possible to
-use the built-in function <code>recover</code> to regain control
-of the goroutine and resume normal execution.
-</p>
-
-<p>
-A call to <code>recover</code> stops the unwinding and returns the
-argument passed to <code>panic</code>. Because the only code that
-runs while unwinding is inside deferred functions, <code>recover</code>
-is only useful inside deferred functions.
-</p>
-
-<p>
-One application of <code>recover</code> is to shut down a failing goroutine
-inside a server without killing the other executing goroutines.
-</p>
-
-<pre>
-func server(workChan &lt;-chan *Work) {
- for work := range workChan {
- go safelyDo(work)
- }
-}
-
-func safelyDo(work *Work) {
- defer func() {
- if err := recover(); err != nil {
- log.Println("work failed:", err)
- }
- }()
- do(work)
-}
-</pre>
-
-<p>
-In this example, if <code>do(work)</code> panics, the result will be
-logged and the goroutine will exit cleanly without disturbing the
-others. There's no need to do anything else in the deferred closure;
-calling <code>recover</code> handles the condition completely.
-</p>
-
-<p>
-Because <code>recover</code> always returns <code>nil</code> unless called directly
-from a deferred function, deferred code can call library routines that themselves
-use <code>panic</code> and <code>recover</code> without failing. As an example,
-the deferred function in <code>safelyDo</code> might call a logging function before
-calling <code>recover</code>, and that logging code would run unaffected
-by the panicking state.
-</p>
-
-<p>
-With our recovery pattern in place, the <code>do</code>
-function (and anything it calls) can get out of any bad situation
-cleanly by calling <code>panic</code>. We can use that idea to
-simplify error handling in complex software. Let's look at an
-idealized version of a <code>regexp</code> package, which reports
-parsing errors by calling <code>panic</code> with a local
-error type. Here's the definition of <code>Error</code>,
-an <code>error</code> method, and the <code>Compile</code> function.
-</p>
-
-<pre>
-// Error is the type of a parse error; it satisfies the error interface.
-type Error string
-func (e Error) Error() string {
- return string(e)
-}
-
-// error is a method of *Regexp that reports parsing errors by
-// panicking with an Error.
-func (regexp *Regexp) error(err string) {
- panic(Error(err))
-}
-
-// Compile returns a parsed representation of the regular expression.
-func Compile(str string) (regexp *Regexp, err error) {
- regexp = new(Regexp)
- // doParse will panic if there is a parse error.
- defer func() {
- if e := recover(); e != nil {
- regexp = nil // Clear return value.
- err = e.(Error) // Will re-panic if not a parse error.
- }
- }()
- return regexp.doParse(str), nil
-}
-</pre>
-
-<p>
-If <code>doParse</code> panics, the recovery block will set the
-return value to <code>nil</code>&mdash;deferred functions can modify
-named return values. It will then check, in the assignment
-to <code>err</code>, that the problem was a parse error by asserting
-that it has the local type <code>Error</code>.
-If it does not, the type assertion will fail, causing a run-time error
-that continues the stack unwinding as though nothing had interrupted
-it.
-This check means that if something unexpected happens, such
-as an index out of bounds, the code will fail even though we
-are using <code>panic</code> and <code>recover</code> to handle
-parse errors.
-</p>
-
-<p>
-With error handling in place, the <code>error</code> method (because it's a
-method bound to a type, it's fine, even natural, for it to have the same name
-as the builtin <code>error</code> type)
-makes it easy to report parse errors without worrying about unwinding
-the parse stack by hand:
-</p>
-
-<pre>
-if pos == 0 {
- re.error("'*' illegal at start of expression")
-}
-</pre>
-
-<p>
-Useful though this pattern is, it should be used only within a package.
-<code>Parse</code> turns its internal <code>panic</code> calls into
-<code>error</code> values; it does not expose <code>panics</code>
-to its client. That is a good rule to follow.
-</p>
-
-<p>
-By the way, this re-panic idiom changes the panic value if an actual
-error occurs. However, both the original and new failures will be
-presented in the crash report, so the root cause of the problem will
-still be visible. Thus this simple re-panic approach is usually
-sufficient&mdash;it's a crash after all&mdash;but if you want to
-display only the original value, you can write a little more code to
-filter unexpected problems and re-panic with the original error.
-That's left as an exercise for the reader.
-</p>
-
-
-<h2 id="web_server">A web server</h2>
-
-<p>
-Let's finish with a complete Go program, a web server.
-This one is actually a kind of web re-server.
-Google provides a service at <code>chart.apis.google.com</code>
-that does automatic formatting of data into charts and graphs.
-It's hard to use interactively, though,
-because you need to put the data into the URL as a query.
-The program here provides a nicer interface to one form of data: given a short piece of text,
-it calls on the chart server to produce a QR code, a matrix of boxes that encode the
-text.
-That image can be grabbed with your cell phone's camera and interpreted as,
-for instance, a URL, saving you typing the URL into the phone's tiny keyboard.
-</p>
-<p>
-Here's the complete program.
-An explanation follows.
-</p>
-{{code "/doc/progs/eff_qr.go" `/package/` `$`}}
-<p>
-The pieces up to <code>main</code> should be easy to follow.
-The one flag sets a default HTTP port for our server. The template
-variable <code>templ</code> is where the fun happens. It builds an HTML template
-that will be executed by the server to display the page; more about
-that in a moment.
-</p>
-<p>
-The <code>main</code> function parses the flags and, using the mechanism
-we talked about above, binds the function <code>QR</code> to the root path
-for the server. Then <code>http.ListenAndServe</code> is called to start the
-server; it blocks while the server runs.
-</p>
-<p>
-<code>QR</code> just receives the request, which contains form data, and
-executes the template on the data in the form value named <code>s</code>.
-</p>
-<p>
-The template package <code>html/template</code> is powerful;
-this program just touches on its capabilities.
-In essence, it rewrites a piece of HTML text on the fly by substituting elements derived
-from data items passed to <code>templ.Execute</code>, in this case the
-form value.
-Within the template text (<code>templateStr</code>),
-double-brace-delimited pieces denote template actions.
-The piece from <code>{{html "{{if .}}"}}</code>
-to <code>{{html "{{end}}"}}</code> executes only if the value of the current data item, called <code>.</code> (dot),
-is non-empty.
-That is, when the string is empty, this piece of the template is suppressed.
-</p>
-<p>
-The two snippets <code>{{html "{{.}}"}}</code> say to show the data presented to
-the template—the query string—on the web page.
-The HTML template package automatically provides appropriate escaping so the
-text is safe to display.
-</p>
-<p>
-The rest of the template string is just the HTML to show when the page loads.
-If this is too quick an explanation, see the <a href="/pkg/html/template/">documentation</a>
-for the template package for a more thorough discussion.
-</p>
-<p>
-And there you have it: a useful web server in a few lines of code plus some
-data-driven HTML text.
-Go is powerful enough to make a lot happen in a few lines.
-</p>
-
-<!--
-TODO
-<pre>
-verifying implementation
-type Color uint32
-
-// Check that Color implements image.Color and image.Image
-var _ image.Color = Black
-var _ image.Image = Black
-</pre>
--->
diff --git a/doc/gccgo_contribute.html b/doc/gccgo_contribute.html
deleted file mode 100644
index 395902d7cb..0000000000
--- a/doc/gccgo_contribute.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!--{
- "Title": "Contributing to the gccgo frontend"
-}-->
-
-<h2>Introduction</h2>
-
-<p>
-These are some notes on contributing to the gccgo frontend for GCC.
-For information on contributing to parts of Go other than gccgo,
-see <a href="/doc/contribute.html">Contributing to the Go project</a>. For
-information on building gccgo for yourself,
-see <a href="/doc/gccgo_install.html">Setting up and using gccgo</a>.
-For more of the gritty details on the process of doing development
-with the gccgo frontend,
-see <a href="https://go.googlesource.com/gofrontend/+/master/HACKING">the
-file HACKING</a> in the gofrontend repository.
-</p>
-
-<h2>Legal Prerequisites</h2>
-
-<p>
-You must follow the <a href="/doc/contribute.html#copyright">Go copyright
-rules</a> for all changes to the gccgo frontend and the associated
-libgo library. Code that is part of GCC rather than gccgo must follow
-the general <a href="https://gcc.gnu.org/contribute.html">GCC
-contribution rules</a>.
-</p>
-
-<h2>Code</h2>
-
-<p>
-The master sources for the gccgo frontend may be found at
-<a href="https://go.googlesource.com/gofrontend">https://go.googlesource.com/gofrontend</a>.
-They are mirrored
-at <a href="https://github.com/golang/gofrontend">https://github.com/golang/gofrontend</a>.
-The master sources are not buildable by themselves, but only in
-conjunction with GCC (in the future, other compilers may be
-supported). Changes made to the gccgo frontend are also applied to
-the GCC source code repository hosted at <code>gcc.gnu.org</code>. In
-the <code>gofrontend</code> repository, the <code>go</code> directory
-is mirrored to the <code>gcc/go/gofrontend</code> directory in the GCC
-repository, and the <code>gofrontend</code> <code>libgo</code>
-directory is mirrored to the GCC <code>libgo</code> directory. In
-addition, the <code>test</code> directory
-from <a href="//go.googlesource.com/go">the main Go repository</a>
-is mirrored to the <code>gcc/testsuite/go.test/test</code> directory
-in the GCC repository.
-</p>
-
-<p>
-Changes to these directories always flow from the master sources to
-the GCC repository. The files should never be changed in the GCC
-repository except by changing them in the master sources and mirroring
-them.
-</p>
-
-<p>
-The gccgo frontend is written in C++.
-It follows the GNU and GCC coding standards for C++.
-In writing code for the frontend, follow the formatting of the
-surrounding code.
-Almost all GCC-specific code is not in the frontend proper and is
-instead in the GCC sources in the <code>gcc/go</code> directory.
-</p>
-
-<p>
-The run-time library for gccgo is mostly the same as the library
-in <a href="//go.googlesource.com/go">the main Go repository</a>.
-The library code in the Go repository is periodically merged into
-the <code>libgo/go</code> directory of the <code>gofrontend</code> and
-then the GCC repositories, using the shell
-script <code>libgo/merge.sh</code>. Accordingly, most library changes
-should be made in the main Go repository. The files outside
-of <code>libgo/go</code> are gccgo-specific; that said, some of the
-files in <code>libgo/runtime</code> are based on files
-in <code>src/runtime</code> in the main Go repository.
-</p>
-
-<h2>Testing</h2>
-
-<p>
-All patches must be tested. A patch that introduces new failures is
-not acceptable.
-</p>
-
-<p>
-To run the gccgo test suite, run <code>make check-go</code> in your
-build directory. This will run various tests
-under <code>gcc/testsuite/go.*</code> and will also run
-the <code>libgo</code> testsuite. This copy of the tests from the
-main Go repository is run using the DejaGNU script found
-in <code>gcc/testsuite/go.test/go-test.exp</code>.
-</p>
-
-<p>
-Most new tests should be submitted to the main Go repository for later
-mirroring into the GCC repository. If there is a need for specific
-tests for gccgo, they should go in
-the <code>gcc/testsuite/go.go-torture</code>
-or <code>gcc/testsuite/go.dg</code> directories in the GCC repository.
-</p>
-
-<h2>Submitting Changes</h2>
-
-<p>
-Changes to the Go frontend should follow the same process as for the
-main Go repository, only for the <code>gofrontend</code> project and
-the <code>gofrontend-dev@googlegroups.com</code> mailing list
-rather than the <code>go</code> project and the
-<code>golang-dev@googlegroups.com</code> mailing list. Those changes
-will then be merged into the GCC sources.
-</p>
diff --git a/doc/gccgo_install.html b/doc/gccgo_install.html
deleted file mode 100644
index c478a9ea2d..0000000000
--- a/doc/gccgo_install.html
+++ /dev/null
@@ -1,533 +0,0 @@
-<!--{
- "Title": "Setting up and using gccgo",
- "Path": "/doc/install/gccgo"
-}-->
-
-<p>
-This document explains how to use gccgo, a compiler for
-the Go language. The gccgo compiler is a new frontend
-for GCC, the widely used GNU compiler. Although the
-frontend itself is under a BSD-style license, gccgo is
-normally used as part of GCC and is then covered by
-the <a href="https://www.gnu.org/licenses/gpl.html">GNU General Public
-License</a> (the license covers gccgo itself as part of GCC; it
-does not cover code generated by gccgo).
-</p>
-
-<p>
-Note that gccgo is not the <code>gc</code> compiler; see
-the <a href="/doc/install.html">Installing Go</a> instructions for that
-compiler.
-</p>
-
-<h2 id="Releases">Releases</h2>
-
-<p>
-The simplest way to install gccgo is to install a GCC binary release
-built to include Go support. GCC binary releases are available from
-<a href="https://gcc.gnu.org/install/binaries.html">various
-websites</a> and are typically included as part of GNU/Linux
-distributions. We expect that most people who build these binaries
-will include Go support.
-</p>
-
-<p>
-The GCC 4.7.1 release and all later 4.7 releases include a complete
-<a href="/doc/go1.html">Go 1</a> compiler and libraries.
-</p>
-
-<p>
-Due to timing, the GCC 4.8.0 and 4.8.1 releases are close to but not
-identical to Go 1.1. The GCC 4.8.2 release includes a complete Go
-1.1.2 implementation.
-</p>
-
-<p>
-The GCC 4.9 releases include a complete Go 1.2 implementation.
-</p>
-
-<p>
-The GCC 5 releases include a complete implementation of the Go 1.4
-user libraries. The Go 1.4 runtime is not fully merged, but that
-should not be visible to Go programs.
-</p>
-
-<p>
-The GCC 6 releases include a complete implementation of the Go 1.6.1
-user libraries. The Go 1.6 runtime is not fully merged, but that
-should not be visible to Go programs.
-</p>
-
-<p>
-The GCC 7 releases include a complete implementation of the Go 1.8.1
-user libraries. As with earlier releases, the Go 1.8 runtime is not
-fully merged, but that should not be visible to Go programs.
-</p>
-
-<p>
-The GCC 8 releases include a complete implementation of the Go 1.10.1
-release. The Go 1.10 runtime has now been fully merged into the GCC
-development sources, and concurrent garbage collection is fully
-supported.
-</p>
-
-<p>
-The GCC 9 releases include a complete implementation of the Go 1.12.2
-release.
-</p>
-
-<h2 id="Source_code">Source code</h2>
-
-<p>
-If you cannot use a release, or prefer to build gccgo for yourself, the
-gccgo source code is accessible via Git. The GCC web site has
-<a href="https://gcc.gnu.org/git.html">instructions for getting the GCC
-source code</a>. The gccgo source code is included. As a convenience, a
-stable version of the Go support is available in the
-<code>devel/gccgo</code> branch of the main GCC code repository:
-<code>git://gcc.gnu.org/git/gcc.git</code>.
-This branch is periodically updated with stable Go compiler sources.
-</p>
-
-<p>
-Note that although <code>gcc.gnu.org</code> is the most convenient way
-to get the source code for the Go frontend, it is not where the master
-sources live. If you want to contribute changes to the Go frontend
-compiler, see <a href="/doc/gccgo_contribute.html">Contributing to
-gccgo</a>.
-</p>
-
-
-<h2 id="Building">Building</h2>
-
-<p>
-Building gccgo is just like building GCC
-with one or two additional options. See
-the <a href="https://gcc.gnu.org/install/">instructions on the gcc web
-site</a>. When you run <code>configure</code>, add the
-option <code>--enable-languages=c,c++,go</code> (along with other
-languages you may want to build). If you are targeting a 32-bit x86,
-then you will want to build gccgo to default to
-supporting locked compare and exchange instructions; do this by also
-using the <code>configure</code> option <code>--with-arch=i586</code>
-(or a newer architecture, depending on where you need your programs to
-run). If you are targeting a 64-bit x86, but sometimes want to use
-the <code>-m32</code> option, then use the <code>configure</code>
-option <code>--with-arch-32=i586</code>.
-</p>
-
-<h3 id="Gold">Gold</h3>
-
-<p>
-On x86 GNU/Linux systems the gccgo compiler is able to
-use a small discontiguous stack for goroutines. This permits programs
-to run many more goroutines, since each goroutine can use a relatively
-small stack. Doing this requires using the gold linker version 2.22
-or later. You can either install GNU binutils 2.22 or later, or you
-can build gold yourself.
-</p>
-
-<p>
-To build gold yourself, build the GNU binutils,
-using <code>--enable-gold=default</code> when you run
-the <code>configure</code> script. Before building, you must install
-the flex and bison packages. A typical sequence would look like
-this (you can replace <code>/opt/gold</code> with any directory to
-which you have write access):
-</p>
-
-<pre>
-git clone git://sourceware.org/git/binutils-gdb.git
-mkdir binutils-objdir
-cd binutils-objdir
-../binutils-gdb/configure --enable-gold=default --prefix=/opt/gold
-make
-make install
-</pre>
-
-<p>
-However you install gold, when you configure gccgo, use the
-option <code>--with-ld=<var>GOLD_BINARY</var></code>.
-</p>
-
-<h3 id="Prerequisites">Prerequisites</h3>
-
-<p>
-A number of prerequisites are required to build GCC, as
-described on
-the <a href="https://gcc.gnu.org/install/prerequisites.html">gcc web
-site</a>. It is important to install all the prerequisites before
-running the gcc <code>configure</code> script.
-The prerequisite libraries can be conveniently downloaded using the
-script <code>contrib/download_prerequisites</code> in the GCC sources.
-
-<h3 id="Build_commands">Build commands</h3>
-
-<p>
-Once all the prerequisites are installed, then a typical build and
-install sequence would look like this (only use
-the <code>--with-ld</code> option if you are using the gold linker as
-described above):
-</p>
-
-<pre>
-git clone --branch devel/gccgo git://gcc.gnu.org/git/gcc.git gccgo
-mkdir objdir
-cd objdir
-../gccgo/configure --prefix=/opt/gccgo --enable-languages=c,c++,go --with-ld=/opt/gold/bin/ld
-make
-make install
-</pre>
-
-<h2 id="Using_gccgo">Using gccgo</h2>
-
-<p>
-The gccgo compiler works like other gcc frontends. As of GCC 5 the gccgo
-installation also includes a version of the <code>go</code> command,
-which may be used to build Go programs as described at
-<a href="https://golang.org/cmd/go">https://golang.org/cmd/go</a>.
-</p>
-
-<p>
-To compile a file without using the <code>go</code> command:
-</p>
-
-<pre>
-gccgo -c file.go
-</pre>
-
-<p>
-That produces <code>file.o</code>. To link files together to form an
-executable:
-</p>
-
-<pre>
-gccgo -o file file.o
-</pre>
-
-<p>
-To run the resulting file, you will need to tell the program where to
-find the compiled Go packages. There are a few ways to do this:
-</p>
-
-<ul>
-<li>
-<p>
-Set the <code>LD_LIBRARY_PATH</code> environment variable:
-</p>
-
-<pre>
-LD_LIBRARY_PATH=${prefix}/lib/gcc/MACHINE/VERSION
-[or]
-LD_LIBRARY_PATH=${prefix}/lib64/gcc/MACHINE/VERSION
-export LD_LIBRARY_PATH
-</pre>
-
-<p>
-Here <code>${prefix}</code> is the <code>--prefix</code> option used
-when building gccgo. For a binary install this is
-normally <code>/usr</code>. Whether to use <code>lib</code>
-or <code>lib64</code> depends on the target.
-Typically <code>lib64</code> is correct for x86_64 systems,
-and <code>lib</code> is correct for other systems. The idea is to
-name the directory where <code>libgo.so</code> is found.
-</p>
-
-</li>
-
-<li>
-<p>
-Passing a <code>-Wl,-R</code> option when you link (replace lib with
-lib64 if appropriate for your system):
-</p>
-
-<pre>
-go build -gccgoflags -Wl,-R,${prefix}/lib/gcc/MACHINE/VERSION
-[or]
-gccgo -o file file.o -Wl,-R,${prefix}/lib/gcc/MACHINE/VERSION
-</pre>
-</li>
-
-<li>
-<p>
-Use the <code>-static-libgo</code> option to link statically against
-the compiled packages.
-</p>
-</li>
-
-<li>
-<p>
-Use the <code>-static</code> option to do a fully static link (the
-default for the <code>gc</code> compiler).
-</p>
-</li>
-</ul>
-
-<h2 id="Options">Options</h2>
-
-<p>
-The gccgo compiler supports all GCC options
-that are language independent, notably the <code>-O</code>
-and <code>-g</code> options.
-</p>
-
-<p>
-The <code>-fgo-pkgpath=PKGPATH</code> option may be used to set a
-unique prefix for the package being compiled.
-This option is automatically used by the go command, but you may want
-to use it if you invoke gccgo directly.
-This option is intended for use with large
-programs that contain many packages, in order to allow multiple
-packages to use the same identifier as the package name.
-The <code>PKGPATH</code> may be any string; a good choice for the
-string is the path used to import the package.
-</p>
-
-<p>
-The <code>-I</code> and <code>-L</code> options, which are synonyms
-for the compiler, may be used to set the search path for finding
-imports.
-These options are not needed if you build with the go command.
-</p>
-
-<h2 id="Imports">Imports</h2>
-
-<p>
-When you compile a file that exports something, the export
-information will be stored directly in the object file.
-If you build with gccgo directly, rather than with the go command,
-then when you import a package, you must tell gccgo how to find the
-file.
-</p>
-
-<p>
-When you import the package <var>FILE</var> with gccgo,
-it will look for the import data in the following files, and use the
-first one that it finds.
-
-<ul>
-<li><code><var>FILE</var>.gox</code>
-<li><code>lib<var>FILE</var>.so</code>
-<li><code>lib<var>FILE</var>.a</code>
-<li><code><var>FILE</var>.o</code>
-</ul>
-
-<p>
-<code><var>FILE</var>.gox</code>, when used, will typically contain
-nothing but export data. This can be generated from
-<code><var>FILE</var>.o</code> via
-</p>
-
-<pre>
-objcopy -j .go_export FILE.o FILE.gox
-</pre>
-
-<p>
-The gccgo compiler will look in the current
-directory for import files. In more complex scenarios you
-may pass the <code>-I</code> or <code>-L</code> option to
-gccgo. Both options take directories to search. The
-<code>-L</code> option is also passed to the linker.
-</p>
-
-<p>
-The gccgo compiler does not currently (2015-06-15) record
-the file name of imported packages in the object file. You must
-arrange for the imported data to be linked into the program.
-Again, this is not necessary when building with the go command.
-</p>
-
-<pre>
-gccgo -c mypackage.go # Exports mypackage
-gccgo -c main.go # Imports mypackage
-gccgo -o main main.o mypackage.o # Explicitly links with mypackage.o
-</pre>
-
-<h2 id="Debugging">Debugging</h2>
-
-<p>
-If you use the <code>-g</code> option when you compile, you can run
-<code>gdb</code> on your executable. The debugger has only limited
-knowledge about Go. You can set breakpoints, single-step,
-etc. You can print variables, but they will be printed as though they
-had C/C++ types. For numeric types this doesn't matter. Go strings
-and interfaces will show up as two-element structures. Go
-maps and channels are always represented as C pointers to run-time
-structures.
-</p>
-
-<h2 id="C_Interoperability">C Interoperability</h2>
-
-<p>
-When using gccgo there is limited interoperability with C,
-or with C++ code compiled using <code>extern "C"</code>.
-</p>
-
-<h3 id="Types">Types</h3>
-
-<p>
-Basic types map directly: an <code>int32</code> in Go is
-an <code>int32_t</code> in C, an <code>int64</code> is
-an <code>int64_t</code>, etc.
-The Go type <code>int</code> is an integer that is the same size as a
-pointer, and as such corresponds to the C type <code>intptr_t</code>.
-Go <code>byte</code> is equivalent to C <code>unsigned char</code>.
-Pointers in Go are pointers in C.
-A Go <code>struct</code> is the same as C <code>struct</code> with the
-same fields and types.
-</p>
-
-<p>
-The Go <code>string</code> type is currently defined as a two-element
-structure (this is <b style="color: red;">subject to change</b>):
-</p>
-
-<pre>
-struct __go_string {
- const unsigned char *__data;
- intptr_t __length;
-};
-</pre>
-
-<p>
-You can't pass arrays between C and Go. However, a pointer to an
-array in Go is equivalent to a C pointer to the
-equivalent of the element type.
-For example, Go <code>*[10]int</code> is equivalent to C <code>int*</code>,
-assuming that the C pointer does point to 10 elements.
-</p>
-
-<p>
-A slice in Go is a structure. The current definition is
-(this is <b style="color: red;">subject to change</b>):
-</p>
-
-<pre>
-struct __go_slice {
- void *__values;
- intptr_t __count;
- intptr_t __capacity;
-};
-</pre>
-
-<p>
-The type of a Go function is a pointer to a struct (this is
-<b style="color: red;">subject to change</b>). The first field in the
-struct points to the code of the function, which will be equivalent to
-a pointer to a C function whose parameter types are equivalent, with
-an additional trailing parameter. The trailing parameter is the
-closure, and the argument to pass is a pointer to the Go function
-struct.
-
-When a Go function returns more than one value, the C function returns
-a struct. For example, these functions are roughly equivalent:
-</p>
-
-<pre>
-func GoFunction(int) (int, float64)
-struct { int i; float64 f; } CFunction(int, void*)
-</pre>
-
-<p>
-Go <code>interface</code>, <code>channel</code>, and <code>map</code>
-types have no corresponding C type (<code>interface</code> is a
-two-element struct and <code>channel</code> and <code>map</code> are
-pointers to structs in C, but the structs are deliberately undocumented). C
-<code>enum</code> types correspond to some integer type, but precisely
-which one is difficult to predict in general; use a cast. C <code>union</code>
-types have no corresponding Go type. C <code>struct</code> types containing
-bitfields have no corresponding Go type. C++ <code>class</code> types have
-no corresponding Go type.
-</p>
-
-<p>
-Memory allocation is completely different between C and Go, as Go uses
-garbage collection. The exact guidelines in this area are undetermined,
-but it is likely that it will be permitted to pass a pointer to allocated
-memory from C to Go. The responsibility of eventually freeing the pointer
-will remain with C side, and of course if the C side frees the pointer
-while the Go side still has a copy the program will fail. When passing a
-pointer from Go to C, the Go function must retain a visible copy of it in
-some Go variable. Otherwise the Go garbage collector may delete the
-pointer while the C function is still using it.
-</p>
-
-<h3 id="Function_names">Function names</h3>
-
-<p>
-Go code can call C functions directly using a Go extension implemented
-in gccgo: a function declaration may be preceded by
-<code>//extern NAME</code>. For example, here is how the C function
-<code>open</code> can be declared in Go:
-</p>
-
-<pre>
-//extern open
-func c_open(name *byte, mode int, perm int) int
-</pre>
-
-<p>
-The C function naturally expects a NUL-terminated string, which in
-Go is equivalent to a pointer to an array (not a slice!) of
-<code>byte</code> with a terminating zero byte. So a sample call
-from Go would look like (after importing the <code>syscall</code> package):
-</p>
-
-<pre>
-var name = [4]byte{'f', 'o', 'o', 0};
-i := c_open(&amp;name[0], syscall.O_RDONLY, 0);
-</pre>
-
-<p>
-(this serves as an example only, to open a file in Go please use Go's
-<code>os.Open</code> function instead).
-</p>
-
-<p>
-Note that if the C function can block, such as in a call
-to <code>read</code>, calling the C function may block the Go program.
-Unless you have a clear understanding of what you are doing, all calls
-between C and Go should be implemented through cgo or SWIG, as for
-the <code>gc</code> compiler.
-</p>
-
-<p>
-The name of Go functions accessed from C is subject to change. At present
-the name of a Go function that does not have a receiver is
-<code>prefix.package.Functionname</code>. The prefix is set by
-the <code>-fgo-prefix</code> option used when the package is compiled;
-if the option is not used, the default is <code>go</code>.
-To call the function from C you must set the name using
-a GCC extension.
-</p>
-
-<pre>
-extern int go_function(int) __asm__ ("myprefix.mypackage.Function");
-</pre>
-
-<h3 id="Automatic_generation_of_Go_declarations_from_C_source_code">
-Automatic generation of Go declarations from C source code</h3>
-
-<p>
-The Go version of GCC supports automatically generating
-Go declarations from C code. The facility is rather awkward, and most
-users should use the <a href="/cmd/cgo">cgo</a> program with
-the <code>-gccgo</code> option instead.
-</p>
-
-<p>
-Compile your C code as usual, and add the option
-<code>-fdump-go-spec=<var>FILENAME</var></code>. This will create the
-file <code><var>FILENAME</var></code> as a side effect of the
-compilation. This file will contain Go declarations for the types,
-variables and functions declared in the C code. C types that can not
-be represented in Go will be recorded as comments in the Go code. The
-generated file will not have a <code>package</code> declaration, but
-can otherwise be compiled directly by gccgo.
-</p>
-
-<p>
-This procedure is full of unstated caveats and restrictions and we make no
-guarantee that it will not change in the future. It is more useful as a
-starting point for real Go code than as a regular procedure.
-</p>
diff --git a/doc/go-logo-black.png b/doc/go-logo-black.png
deleted file mode 100644
index 3077ebdad0..0000000000
--- a/doc/go-logo-black.png
+++ /dev/null
Binary files differ
diff --git a/doc/go-logo-blue.png b/doc/go-logo-blue.png
deleted file mode 100644
index 8d43a56775..0000000000
--- a/doc/go-logo-blue.png
+++ /dev/null
Binary files differ
diff --git a/doc/go-logo-white.png b/doc/go-logo-white.png
deleted file mode 100644
index fa29169fab..0000000000
--- a/doc/go-logo-white.png
+++ /dev/null
Binary files differ
diff --git a/doc/go1.1.html b/doc/go1.1.html
deleted file mode 100644
index f615c97e81..0000000000
--- a/doc/go1.1.html
+++ /dev/null
@@ -1,1099 +0,0 @@
-<!--{
- "Title": "Go 1.1 Release Notes",
- "Path": "/doc/go1.1",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction to Go 1.1</h2>
-
-<p>
-The release of <a href="/doc/go1.html">Go version 1</a> (Go 1 or Go 1.0 for short)
-in March of 2012 introduced a new period
-of stability in the Go language and libraries.
-That stability has helped nourish a growing community of Go users
-and systems around the world.
-Several "point" releases since
-then—1.0.1, 1.0.2, and 1.0.3—have been issued.
-These point releases fixed known bugs but made
-no non-critical changes to the implementation.
-</p>
-
-<p>
-This new release, Go 1.1, keeps the <a href="/doc/go1compat.html">promise
-of compatibility</a> but adds a couple of significant
-(backwards-compatible, of course) language changes, has a long list
-of (again, compatible) library changes, and
-includes major work on the implementation of the compilers,
-libraries, and run-time.
-The focus is on performance.
-Benchmarking is an inexact science at best, but we see significant,
-sometimes dramatic speedups for many of our test programs.
-We trust that many of our users' programs will also see improvements
-just by updating their Go installation and recompiling.
-</p>
-
-<p>
-This document summarizes the changes between Go 1 and Go 1.1.
-Very little if any code will need modification to run with Go 1.1,
-although a couple of rare error cases surface with this release
-and need to be addressed if they arise.
-Details appear below; see the discussion of
-<a href="#int">64-bit ints</a> and <a href="#unicode_literals">Unicode literals</a>
-in particular.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
-<a href="/doc/go1compat.html">The Go compatibility document</a> promises
-that programs written to the Go 1 language specification will continue to operate,
-and those promises are maintained.
-In the interest of firming up the specification, though, there are
-details about some error cases that have been clarified.
-There are also some new language features.
-</p>
-
-<h3 id="divzero">Integer division by zero</h3>
-
-<p>
-In Go 1, integer division by a constant zero produced a run-time panic:
-</p>
-
-<pre>
-func f(x int) int {
- return x/0
-}
-</pre>
-
-<p>
-In Go 1.1, an integer division by constant zero is not a legal program, so it is a compile-time error.
-</p>
-
-<h3 id="unicode_literals">Surrogates in Unicode literals</h3>
-
-<p>
-The definition of string and rune literals has been refined to exclude surrogate halves from the
-set of valid Unicode code points.
-See the <a href="#unicode">Unicode</a> section for more information.
-</p>
-
-<h3 id="method_values">Method values</h3>
-
-<p>
-Go 1.1 now implements
-<a href="/ref/spec#Method_values">method values</a>,
-which are functions that have been bound to a specific receiver value.
-For instance, given a
-<a href="/pkg/bufio/#Writer"><code>Writer</code></a>
-value <code>w</code>,
-the expression
-<code>w.Write</code>,
-a method value, is a function that will always write to <code>w</code>; it is equivalent to
-a function literal closing over <code>w</code>:
-</p>
-
-<pre>
-func (p []byte) (n int, err error) {
- return w.Write(p)
-}
-</pre>
-
-<p>
-Method values are distinct from method expressions, which generate functions
-from methods of a given type; the method expression <code>(*bufio.Writer).Write</code>
-is equivalent to a function with an extra first argument, a receiver of type
-<code>(*bufio.Writer)</code>:
-</p>
-
-<pre>
-func (w *bufio.Writer, p []byte) (n int, err error) {
- return w.Write(p)
-}
-</pre>
-
-<p>
-<em>Updating</em>: No existing code is affected; the change is strictly backward-compatible.
-</p>
-
-<h3 id="return">Return requirements</h3>
-
-<p>
-Before Go 1.1, a function that returned a value needed an explicit "return"
-or call to <code>panic</code> at
-the end of the function; this was a simple way to make the programmer
-be explicit about the meaning of the function. But there are many cases
-where a final "return" is clearly unnecessary, such as a function with
-only an infinite "for" loop.
-</p>
-
-<p>
-In Go 1.1, the rule about final "return" statements is more permissive.
-It introduces the concept of a
-<a href="/ref/spec#Terminating_statements"><em>terminating statement</em></a>,
-a statement that is guaranteed to be the last one a function executes.
-Examples include
-"for" loops with no condition and "if-else"
-statements in which each half ends in a "return".
-If the final statement of a function can be shown <em>syntactically</em> to
-be a terminating statement, no final "return" statement is needed.
-</p>
-
-<p>
-Note that the rule is purely syntactic: it pays no attention to the values in the
-code and therefore requires no complex analysis.
-</p>
-
-<p>
-<em>Updating</em>: The change is backward-compatible, but existing code
-with superfluous "return" statements and calls to <code>panic</code> may
-be simplified manually.
-Such code can be identified by <code>go vet</code>.
-</p>
-
-<h2 id="impl">Changes to the implementations and tools</h2>
-
-<h3 id="gccgo">Status of gccgo</h3>
-
-<p>
-The GCC release schedule does not coincide with the Go release schedule, so some skew is inevitable in
-<code>gccgo</code>'s releases.
-The 4.8.0 version of GCC shipped in March, 2013 and includes a nearly-Go 1.1 version of <code>gccgo</code>.
-Its library is a little behind the release, but the biggest difference is that method values are not implemented.
-Sometime around July 2013, we expect 4.8.2 of GCC to ship with a <code>gccgo</code>
-providing a complete Go 1.1 implementation.
-</p>
-
-<h3 id="gc_flag">Command-line flag parsing</h3>
-
-<p>
-In the gc toolchain, the compilers and linkers now use the
-same command-line flag parsing rules as the Go flag package, a departure
-from the traditional Unix flag parsing. This may affect scripts that invoke
-the tool directly.
-For example,
-<code>go tool 6c -Fw -Dfoo</code> must now be written
-<code>go tool 6c -F -w -D foo</code>.
-</p>
-
-<h3 id="int">Size of int on 64-bit platforms</h3>
-
-<p>
-The language allows the implementation to choose whether the <code>int</code> type and
-<code>uint</code> types are 32 or 64 bits. Previous Go implementations made <code>int</code>
-and <code>uint</code> 32 bits on all systems. Both the gc and gccgo implementations
-now make
-<code>int</code> and <code>uint</code> 64 bits on 64-bit platforms such as AMD64/x86-64.
-Among other things, this enables the allocation of slices with
-more than 2 billion elements on 64-bit platforms.
-</p>
-
-<p>
-<em>Updating</em>:
-Most programs will be unaffected by this change.
-Because Go does not allow implicit conversions between distinct
-<a href="/ref/spec#Numeric_types">numeric types</a>,
-no programs will stop compiling due to this change.
-However, programs that contain implicit assumptions
-that <code>int</code> is only 32 bits may change behavior.
-For example, this code prints a positive number on 64-bit systems and
-a negative one on 32-bit systems:
-</p>
-
-<pre>
-x := ^uint32(0) // x is 0xffffffff
-i := int(x) // i is -1 on 32-bit systems, 0xffffffff on 64-bit
-fmt.Println(i)
-</pre>
-
-<p>Portable code intending 32-bit sign extension (yielding <code>-1</code> on all systems)
-would instead say:
-</p>
-
-<pre>
-i := int(int32(x))
-</pre>
-
-<h3 id="heap">Heap size on 64-bit architectures</h3>
-
-<p>
-On 64-bit architectures, the maximum heap size has been enlarged substantially,
-from a few gigabytes to several tens of gigabytes.
-(The exact details depend on the system and may change.)
-</p>
-
-<p>
-On 32-bit architectures, the heap size has not changed.
-</p>
-
-<p>
-<em>Updating</em>:
-This change should have no effect on existing programs beyond allowing them
-to run with larger heaps.
-</p>
-
-<h3 id="unicode">Unicode</h3>
-
-<p>
-To make it possible to represent code points greater than 65535 in UTF-16,
-Unicode defines <em>surrogate halves</em>,
-a range of code points to be used only in the assembly of large values, and only in UTF-16.
-The code points in that surrogate range are illegal for any other purpose.
-In Go 1.1, this constraint is honored by the compiler, libraries, and run-time:
-a surrogate half is illegal as a rune value, when encoded as UTF-8, or when
-encoded in isolation as UTF-16.
-When encountered, for example in converting from a rune to UTF-8, it is
-treated as an encoding error and will yield the replacement rune,
-<a href="/pkg/unicode/utf8/#RuneError"><code>utf8.RuneError</code></a>,
-U+FFFD.
-</p>
-
-<p>
-This program,
-</p>
-
-<pre>
-import "fmt"
-
-func main() {
- fmt.Printf("%+q\n", string(0xD800))
-}
-</pre>
-
-<p>
-printed <code>"\ud800"</code> in Go 1.0, but prints <code>"\ufffd"</code> in Go 1.1.
-</p>
-
-<p>
-Surrogate-half Unicode values are now illegal in rune and string constants, so constants such as
-<code>'\ud800'</code> and <code>"\ud800"</code> are now rejected by the compilers.
-When written explicitly as UTF-8 encoded bytes,
-such strings can still be created, as in <code>"\xed\xa0\x80"</code>.
-However, when such a string is decoded as a sequence of runes, as in a range loop, it will yield only <code>utf8.RuneError</code>
-values.
-</p>
-
-<p>
-The Unicode byte order mark U+FEFF, encoded in UTF-8, is now permitted as the first
-character of a Go source file.
-Even though its appearance in the byte-order-free UTF-8 encoding is clearly unnecessary,
-some editors add the mark as a kind of "magic number" identifying a UTF-8 encoded file.
-</p>
-
-<p>
-<em>Updating</em>:
-Most programs will be unaffected by the surrogate change.
-Programs that depend on the old behavior should be modified to avoid the issue.
-The byte-order-mark change is strictly backward-compatible.
-</p>
-
-<h3 id="race">Race detector</h3>
-
-<p>
-A major addition to the tools is a <em>race detector</em>, a way to
-find bugs in programs caused by concurrent access of the same
-variable, where at least one of the accesses is a write.
-This new facility is built into the <code>go</code> tool.
-For now, it is only available on Linux, Mac OS X, and Windows systems with
-64-bit x86 processors.
-To enable it, set the <code>-race</code> flag when building or testing your program
-(for instance, <code>go test -race</code>).
-The race detector is documented in <a href="/doc/articles/race_detector.html">a separate article</a>.
-</p>
-
-<h3 id="gc_asm">The gc assemblers</h3>
-
-<p>
-Due to the change of the <a href="#int"><code>int</code></a> to 64 bits and
-a new internal <a href="//golang.org/s/go11func">representation of functions</a>,
-the arrangement of function arguments on the stack has changed in the gc toolchain.
-Functions written in assembly will need to be revised at least
-to adjust frame pointer offsets.
-</p>
-
-<p>
-<em>Updating</em>:
-The <code>go vet</code> command now checks that functions implemented in assembly
-match the Go function prototypes they implement.
-</p>
-
-<h3 id="gocmd">Changes to the go command</h3>
-
-<p>
-The <a href="/cmd/go/"><code>go</code></a> command has acquired several
-changes intended to improve the experience for new Go users.
-</p>
-
-<p>
-First, when compiling, testing, or running Go code, the <code>go</code> command will now give more detailed error messages,
-including a list of paths searched, when a package cannot be located.
-</p>
-
-<pre>
-$ go build foo/quxx
-can't load package: package foo/quxx: cannot find package "foo/quxx" in any of:
- /home/you/go/src/pkg/foo/quxx (from $GOROOT)
- /home/you/src/foo/quxx (from $GOPATH)
-</pre>
-
-<p>
-Second, the <code>go get</code> command no longer allows <code>$GOROOT</code>
-as the default destination when downloading package source.
-To use the <code>go get</code>
-command, a <a href="/doc/code.html#GOPATH">valid <code>$GOPATH</code></a> is now required.
-</p>
-
-<pre>
-$ GOPATH= go get code.google.com/p/foo/quxx
-package code.google.com/p/foo/quxx: cannot download, $GOPATH not set. For more details see: go help gopath
-</pre>
-
-<p>
-Finally, as a result of the previous change, the <code>go get</code> command will also fail
-when <code>$GOPATH</code> and <code>$GOROOT</code> are set to the same value.
-</p>
-
-<pre>
-$ GOPATH=$GOROOT go get code.google.com/p/foo/quxx
-warning: GOPATH set to GOROOT (/home/you/go) has no effect
-package code.google.com/p/foo/quxx: cannot download, $GOPATH must not be set to $GOROOT. For more details see: go help gopath
-</pre>
-
-<h3 id="gotest">Changes to the go test command</h3>
-
-<p>
-The <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a>
-command no longer deletes the binary when run with profiling enabled,
-to make it easier to analyze the profile.
-The implementation sets the <code>-c</code> flag automatically, so after running,
-</p>
-
-<pre>
-$ go test -cpuprofile cpuprof.out mypackage
-</pre>
-
-<p>
-the file <code>mypackage.test</code> will be left in the directory where <code>go test</code> was run.
-</p>
-
-<p>
-The <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a>
-command can now generate profiling information
-that reports where goroutines are blocked, that is,
-where they tend to stall waiting for an event such as a channel communication.
-The information is presented as a
-<em>blocking profile</em>
-enabled with the
-<code>-blockprofile</code>
-option of
-<code>go test</code>.
-Run <code>go help test</code> for more information.
-</p>
-
-<h3 id="gofix">Changes to the go fix command</h3>
-
-<p>
-The <a href="/cmd/fix/"><code>fix</code></a> command, usually run as
-<code>go fix</code>, no longer applies fixes to update code from
-before Go 1 to use Go 1 APIs.
-To update pre-Go 1 code to Go 1.1, use a Go 1.0 toolchain
-to convert the code to Go 1.0 first.
-</p>
-
-<h3 id="tags">Build constraints</h3>
-
-<p>
-The "<code>go1.1</code>" tag has been added to the list of default
-<a href="/pkg/go/build/#hdr-Build_Constraints">build constraints</a>.
-This permits packages to take advantage of the new features in Go 1.1 while
-remaining compatible with earlier versions of Go.
-</p>
-
-<p>
-To build a file only with Go 1.1 and above, add this build constraint:
-</p>
-
-<pre>
-// +build go1.1
-</pre>
-
-<p>
-To build a file only with Go 1.0.x, use the converse constraint:
-</p>
-
-<pre>
-// +build !go1.1
-</pre>
-
-<h3 id="platforms">Additional platforms</h3>
-
-<p>
-The Go 1.1 toolchain adds experimental support for <code>freebsd/arm</code>,
-<code>netbsd/386</code>, <code>netbsd/amd64</code>, <code>netbsd/arm</code>,
-<code>openbsd/386</code> and <code>openbsd/amd64</code> platforms.
-</p>
-
-<p>
-An ARMv6 or later processor is required for <code>freebsd/arm</code> or
-<code>netbsd/arm</code>.
-</p>
-
-<p>
-Go 1.1 adds experimental support for <code>cgo</code> on <code>linux/arm</code>.
-</p>
-
-<h3 id="crosscompile">Cross compilation</h3>
-
-<p>
-When cross-compiling, the <code>go</code> tool will disable <code>cgo</code>
-support by default.
-</p>
-
-<p>
-To explicitly enable <code>cgo</code>, set <code>CGO_ENABLED=1</code>.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-The performance of code compiled with the Go 1.1 gc tool suite should be noticeably
-better for most Go programs.
-Typical improvements relative to Go 1.0 seem to be about 30%-40%, sometimes
-much more, but occasionally less or even non-existent.
-There are too many small performance-driven tweaks through the tools and libraries
-to list them all here, but the following major changes are worth noting:
-</p>
-
-<ul>
-<li>The gc compilers generate better code in many cases, most noticeably for
-floating point on the 32-bit Intel architecture.</li>
-<li>The gc compilers do more in-lining, including for some operations
-in the run-time such as <a href="/pkg/builtin/#append"><code>append</code></a>
-and interface conversions.</li>
-<li>There is a new implementation of Go maps with significant reduction in
-memory footprint and CPU time.</li>
-<li>The garbage collector has been made more parallel, which can reduce
-latencies for programs running on multiple CPUs.</li>
-<li>The garbage collector is also more precise, which costs a small amount of
-CPU time but can reduce the size of the heap significantly, especially
-on 32-bit architectures.</li>
-<li>Due to tighter coupling of the run-time and network libraries, fewer
-context switches are required on network operations.</li>
-</ul>
-
-<h2 id="library">Changes to the standard library</h2>
-
-<h3 id="bufio_scanner">bufio.Scanner</h3>
-
-<p>
-The various routines to scan textual input in the
-<a href="/pkg/bufio/"><code>bufio</code></a>
-package,
-<a href="/pkg/bufio/#Reader.ReadBytes"><code>ReadBytes</code></a>,
-<a href="/pkg/bufio/#Reader.ReadString"><code>ReadString</code></a>
-and particularly
-<a href="/pkg/bufio/#Reader.ReadLine"><code>ReadLine</code></a>,
-are needlessly complex to use for simple purposes.
-In Go 1.1, a new type,
-<a href="/pkg/bufio/#Scanner"><code>Scanner</code></a>,
-has been added to make it easier to do simple tasks such as
-read the input as a sequence of lines or space-delimited words.
-It simplifies the problem by terminating the scan on problematic
-input such as pathologically long lines, and having a simple
-default: line-oriented input, with each line stripped of its terminator.
-Here is code to reproduce the input a line at a time:
-</p>
-
-<pre>
-scanner := bufio.NewScanner(os.Stdin)
-for scanner.Scan() {
- fmt.Println(scanner.Text()) // Println will add back the final '\n'
-}
-if err := scanner.Err(); err != nil {
- fmt.Fprintln(os.Stderr, "reading standard input:", err)
-}
-</pre>
-
-<p>
-Scanning behavior can be adjusted through a function to control subdividing the input
-(see the documentation for <a href="/pkg/bufio/#SplitFunc"><code>SplitFunc</code></a>),
-but for tough problems or the need to continue past errors, the older interface
-may still be required.
-</p>
-
-<h3 id="net">net</h3>
-
-<p>
-The protocol-specific resolvers in the <a href="/pkg/net/"><code>net</code></a> package were formerly
-lax about the network name passed in.
-Although the documentation was clear
-that the only valid networks for
-<a href="/pkg/net/#ResolveTCPAddr"><code>ResolveTCPAddr</code></a>
-are <code>"tcp"</code>,
-<code>"tcp4"</code>, and <code>"tcp6"</code>, the Go 1.0 implementation silently accepted any string.
-The Go 1.1 implementation returns an error if the network is not one of those strings.
-The same is true of the other protocol-specific resolvers <a href="/pkg/net/#ResolveIPAddr"><code>ResolveIPAddr</code></a>,
-<a href="/pkg/net/#ResolveUDPAddr"><code>ResolveUDPAddr</code></a>, and
-<a href="/pkg/net/#ResolveUnixAddr"><code>ResolveUnixAddr</code></a>.
-</p>
-
-<p>
-The previous implementation of
-<a href="/pkg/net/#ListenUnixgram"><code>ListenUnixgram</code></a>
-returned a
-<a href="/pkg/net/#UDPConn"><code>UDPConn</code></a> as
-a representation of the connection endpoint.
-The Go 1.1 implementation instead returns a
-<a href="/pkg/net/#UnixConn"><code>UnixConn</code></a>
-to allow reading and writing
-with its
-<a href="/pkg/net/#UnixConn.ReadFrom"><code>ReadFrom</code></a>
-and
-<a href="/pkg/net/#UnixConn.WriteTo"><code>WriteTo</code></a>
-methods.
-</p>
-
-<p>
-The data structures
-<a href="/pkg/net/#IPAddr"><code>IPAddr</code></a>,
-<a href="/pkg/net/#TCPAddr"><code>TCPAddr</code></a>, and
-<a href="/pkg/net/#UDPAddr"><code>UDPAddr</code></a>
-add a new string field called <code>Zone</code>.
-Code using untagged composite literals (e.g. <code>net.TCPAddr{ip, port}</code>)
-instead of tagged literals (<code>net.TCPAddr{IP: ip, Port: port}</code>)
-will break due to the new field.
-The Go 1 compatibility rules allow this change: client code must use tagged literals to avoid such breakages.
-</p>
-
-<p>
-<em>Updating</em>:
-To correct breakage caused by the new struct field,
-<code>go fix</code> will rewrite code to add tags for these types.
-More generally, <code>go vet</code> will identify composite literals that
-should be revised to use field tags.
-</p>
-
-<h3 id="reflect">reflect</h3>
-
-<p>
-The <a href="/pkg/reflect/"><code>reflect</code></a> package has several significant additions.
-</p>
-
-<p>
-It is now possible to run a "select" statement using
-the <code>reflect</code> package; see the description of
-<a href="/pkg/reflect/#Select"><code>Select</code></a>
-and
-<a href="/pkg/reflect/#SelectCase"><code>SelectCase</code></a>
-for details.
-</p>
-
-<p>
-The new method
-<a href="/pkg/reflect/#Value.Convert"><code>Value.Convert</code></a>
-(or
-<a href="/pkg/reflect/#Type"><code>Type.ConvertibleTo</code></a>)
-provides functionality to execute a Go conversion or type assertion operation
-on a
-<a href="/pkg/reflect/#Value"><code>Value</code></a>
-(or test for its possibility).
-</p>
-
-<p>
-The new function
-<a href="/pkg/reflect/#MakeFunc"><code>MakeFunc</code></a>
-creates a wrapper function to make it easier to call a function with existing
-<a href="/pkg/reflect/#Value"><code>Values</code></a>,
-doing the standard Go conversions among the arguments, for instance
-to pass an actual <code>int</code> to a formal <code>interface{}</code>.
-</p>
-
-<p>
-Finally, the new functions
-<a href="/pkg/reflect/#ChanOf"><code>ChanOf</code></a>,
-<a href="/pkg/reflect/#MapOf"><code>MapOf</code></a>
-and
-<a href="/pkg/reflect/#SliceOf"><code>SliceOf</code></a>
-construct new
-<a href="/pkg/reflect/#Type"><code>Types</code></a>
-from existing types, for example to construct the type <code>[]T</code> given
-only <code>T</code>.
-</p>
-
-
-<h3 id="time">time</h3>
-<p>
-On FreeBSD, Linux, NetBSD, OS X and OpenBSD, previous versions of the
-<a href="/pkg/time/"><code>time</code></a> package
-returned times with microsecond precision.
-The Go 1.1 implementation on these
-systems now returns times with nanosecond precision.
-Programs that write to an external format with microsecond precision
-and read it back, expecting to recover the original value, will be affected
-by the loss of precision.
-There are two new methods of <a href="/pkg/time/#Time"><code>Time</code></a>,
-<a href="/pkg/time/#Time.Round"><code>Round</code></a>
-and
-<a href="/pkg/time/#Time.Truncate"><code>Truncate</code></a>,
-that can be used to remove precision from a time before passing it to
-external storage.
-</p>
-
-<p>
-The new method
-<a href="/pkg/time/#Time.YearDay"><code>YearDay</code></a>
-returns the one-indexed integral day number of the year specified by the time value.
-</p>
-
-<p>
-The
-<a href="/pkg/time/#Timer"><code>Timer</code></a>
-type has a new method
-<a href="/pkg/time/#Timer.Reset"><code>Reset</code></a>
-that modifies the timer to expire after a specified duration.
-</p>
-
-<p>
-Finally, the new function
-<a href="/pkg/time/#ParseInLocation"><code>ParseInLocation</code></a>
-is like the existing
-<a href="/pkg/time/#Parse"><code>Parse</code></a>
-but parses the time in the context of a location (time zone), ignoring
-time zone information in the parsed string.
-This function addresses a common source of confusion in the time API.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that needs to read and write times using an external format with
-lower precision should be modified to use the new methods.
-</p>
-
-<h3 id="exp_old">Exp and old subtrees moved to go.exp and go.text subrepositories</h3>
-
-<p>
-To make it easier for binary distributions to access them if desired, the <code>exp</code>
-and <code>old</code> source subtrees, which are not included in binary distributions,
-have been moved to the new <code>go.exp</code> subrepository at
-<code>code.google.com/p/go.exp</code>. To access the <code>ssa</code> package,
-for example, run
-</p>
-
-<pre>
-$ go get code.google.com/p/go.exp/ssa
-</pre>
-
-<p>
-and then in Go source,
-</p>
-
-<pre>
-import "code.google.com/p/go.exp/ssa"
-</pre>
-
-<p>
-The old package <code>exp/norm</code> has also been moved, but to a new repository
-<code>go.text</code>, where the Unicode APIs and other text-related packages will
-be developed.
-</p>
-
-<h3 id="new_packages">New packages</h3>
-
-<p>
-There are three new packages.
-</p>
-
-<ul>
-<li>
-The <a href="/pkg/go/format/"><code>go/format</code></a> package provides
-a convenient way for a program to access the formatting capabilities of the
-<a href="/cmd/go/#hdr-Run_gofmt_on_package_sources"><code>go fmt</code></a> command.
-It has two functions,
-<a href="/pkg/go/format/#Node"><code>Node</code></a> to format a Go parser
-<a href="/pkg/go/ast/#Node"><code>Node</code></a>,
-and
-<a href="/pkg/go/format/#Source"><code>Source</code></a>
-to reformat arbitrary Go source code into the standard format as provided by the
-<a href="/cmd/go/#hdr-Run_gofmt_on_package_sources"><code>go fmt</code></a> command.
-</li>
-
-<li>
-The <a href="/pkg/net/http/cookiejar/"><code>net/http/cookiejar</code></a> package provides the basics for managing HTTP cookies.
-</li>
-
-<li>
-The <a href="/pkg/runtime/race/"><code>runtime/race</code></a> package provides low-level facilities for data race detection.
-It is internal to the race detector and does not otherwise export any user-visible functionality.
-</li>
-</ul>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-The following list summarizes a number of minor changes to the library, mostly additions.
-See the relevant package documentation for more information about each change.
-</p>
-
-<ul>
-<li>
-The <a href="/pkg/bytes/"><code>bytes</code></a> package has two new functions,
-<a href="/pkg/bytes/#TrimPrefix"><code>TrimPrefix</code></a>
-and
-<a href="/pkg/bytes/#TrimSuffix"><code>TrimSuffix</code></a>,
-with self-evident properties.
-Also, the <a href="/pkg/bytes/#Buffer"><code>Buffer</code></a> type
-has a new method
-<a href="/pkg/bytes/#Buffer.Grow"><code>Grow</code></a> that
-provides some control over memory allocation inside the buffer.
-Finally, the
-<a href="/pkg/bytes/#Reader"><code>Reader</code></a> type now has a
-<a href="/pkg/strings/#Reader.WriteTo"><code>WriteTo</code></a> method
-so it implements the
-<a href="/pkg/io/#WriterTo"><code>io.WriterTo</code></a> interface.
-</li>
-
-<li>
-The <a href="/pkg/compress/gzip/"><code>compress/gzip</code></a> package has
-a new <a href="/pkg/compress/gzip/#Writer.Flush"><code>Flush</code></a>
-method for its
-<a href="/pkg/compress/gzip/#Writer"><code>Writer</code></a>
-type that flushes its underlying <code>flate.Writer</code>.
-</li>
-
-<li>
-The <a href="/pkg/crypto/hmac/"><code>crypto/hmac</code></a> package has a new function,
-<a href="/pkg/crypto/hmac/#Equal"><code>Equal</code></a>, to compare two MACs.
-</li>
-
-<li>
-The <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package
-now supports PEM blocks (see
-<a href="/pkg/crypto/x509/#DecryptPEMBlock"><code>DecryptPEMBlock</code></a> for instance),
-and a new function
-<a href="/pkg/crypto/x509/#ParseECPrivateKey"><code>ParseECPrivateKey</code></a> to parse elliptic curve private keys.
-</li>
-
-<li>
-The <a href="/pkg/database/sql/"><code>database/sql</code></a> package
-has a new
-<a href="/pkg/database/sql/#DB.Ping"><code>Ping</code></a>
-method for its
-<a href="/pkg/database/sql/#DB"><code>DB</code></a>
-type that tests the health of the connection.
-</li>
-
-<li>
-The <a href="/pkg/database/sql/driver/"><code>database/sql/driver</code></a> package
-has a new
-<a href="/pkg/database/sql/driver/#Queryer"><code>Queryer</code></a>
-interface that a
-<a href="/pkg/database/sql/driver/#Conn"><code>Conn</code></a>
-may implement to improve performance.
-</li>
-
-<li>
-The <a href="/pkg/encoding/json/"><code>encoding/json</code></a> package's
-<a href="/pkg/encoding/json/#Decoder"><code>Decoder</code></a>
-has a new method
-<a href="/pkg/encoding/json/#Decoder.Buffered"><code>Buffered</code></a>
-to provide access to the remaining data in its buffer,
-as well as a new method
-<a href="/pkg/encoding/json/#Decoder.UseNumber"><code>UseNumber</code></a>
-to unmarshal a value into the new type
-<a href="/pkg/encoding/json/#Number"><code>Number</code></a>,
-a string, rather than a float64.
-</li>
-
-<li>
-The <a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> package
-has a new function,
-<a href="/pkg/encoding/xml/#EscapeText"><code>EscapeText</code></a>,
-which writes escaped XML output,
-and a method on
-<a href="/pkg/encoding/xml/#Encoder"><code>Encoder</code></a>,
-<a href="/pkg/encoding/xml/#Encoder.Indent"><code>Indent</code></a>,
-to specify indented output.
-</li>
-
-<li>
-In the <a href="/pkg/go/ast/"><code>go/ast</code></a> package, a
-new type <a href="/pkg/go/ast/#CommentMap"><code>CommentMap</code></a>
-and associated methods makes it easier to extract and process comments in Go programs.
-</li>
-
-<li>
-In the <a href="/pkg/go/doc/"><code>go/doc</code></a> package,
-the parser now keeps better track of stylized annotations such as <code>TODO(joe)</code>
-throughout the code,
-information that the <a href="/cmd/godoc/"><code>godoc</code></a>
-command can filter or present according to the value of the <code>-notes</code> flag.
-</li>
-
-<li>
-The undocumented and only partially implemented "noescape" feature of the
-<a href="/pkg/html/template/"><code>html/template</code></a>
-package has been removed; programs that depend on it will break.
-</li>
-
-<li>
-The <a href="/pkg/image/jpeg/"><code>image/jpeg</code></a> package now
-reads progressive JPEG files and handles a few more subsampling configurations.
-</li>
-
-<li>
-The <a href="/pkg/io/"><code>io</code></a> package now exports the
-<a href="/pkg/io/#ByteWriter"><code>io.ByteWriter</code></a> interface to capture the common
-functionality of writing a byte at a time.
-It also exports a new error, <a href="/pkg/io/#ErrNoProgress"><code>ErrNoProgress</code></a>,
-used to indicate a <code>Read</code> implementation is looping without delivering data.
-</li>
-
-<li>
-The <a href="/pkg/log/syslog/"><code>log/syslog</code></a> package now provides better support
-for OS-specific logging features.
-</li>
-
-<li>
-The <a href="/pkg/math/big/"><code>math/big</code></a> package's
-<a href="/pkg/math/big/#Int"><code>Int</code></a> type
-now has methods
-<a href="/pkg/math/big/#Int.MarshalJSON"><code>MarshalJSON</code></a>
-and
-<a href="/pkg/math/big/#Int.UnmarshalJSON"><code>UnmarshalJSON</code></a>
-to convert to and from a JSON representation.
-Also,
-<a href="/pkg/math/big/#Int"><code>Int</code></a>
-can now convert directly to and from a <code>uint64</code> using
-<a href="/pkg/math/big/#Int.Uint64"><code>Uint64</code></a>
-and
-<a href="/pkg/math/big/#Int.SetUint64"><code>SetUint64</code></a>,
-while
-<a href="/pkg/math/big/#Rat"><code>Rat</code></a>
-can do the same with <code>float64</code> using
-<a href="/pkg/math/big/#Rat.Float64"><code>Float64</code></a>
-and
-<a href="/pkg/math/big/#Rat.SetFloat64"><code>SetFloat64</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/mime/multipart/"><code>mime/multipart</code></a> package
-has a new method for its
-<a href="/pkg/mime/multipart/#Writer"><code>Writer</code></a>,
-<a href="/pkg/mime/multipart/#Writer.SetBoundary"><code>SetBoundary</code></a>,
-to define the boundary separator used to package the output.
-The <a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a> also now
-transparently decodes any <code>quoted-printable</code> parts and removes
-the <code>Content-Transfer-Encoding</code> header when doing so.
-</li>
-
-<li>
-The
-<a href="/pkg/net/"><code>net</code></a> package's
-<a href="/pkg/net/#ListenUnixgram"><code>ListenUnixgram</code></a>
-function has changed return types: it now returns a
-<a href="/pkg/net/#UnixConn"><code>UnixConn</code></a>
-rather than a
-<a href="/pkg/net/#UDPConn"><code>UDPConn</code></a>, which was
-clearly a mistake in Go 1.0.
-Since this API change fixes a bug, it is permitted by the Go 1 compatibility rules.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package includes a new type,
-<a href="/pkg/net/#Dialer"><code>Dialer</code></a>, to supply options to
-<a href="/pkg/net/#Dialer.Dial"><code>Dial</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package adds support for
-link-local IPv6 addresses with zone qualifiers, such as <code>fe80::1%lo0</code>.
-The address structures <a href="/pkg/net/#IPAddr"><code>IPAddr</code></a>,
-<a href="/pkg/net/#UDPAddr"><code>UDPAddr</code></a>, and
-<a href="/pkg/net/#TCPAddr"><code>TCPAddr</code></a>
-record the zone in a new field, and functions that expect string forms of these addresses, such as
-<a href="/pkg/net/#Dial"><code>Dial</code></a>,
-<a href="/pkg/net/#ResolveIPAddr"><code>ResolveIPAddr</code></a>,
-<a href="/pkg/net/#ResolveUDPAddr"><code>ResolveUDPAddr</code></a>, and
-<a href="/pkg/net/#ResolveTCPAddr"><code>ResolveTCPAddr</code></a>,
-now accept the zone-qualified form.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package adds
-<a href="/pkg/net/#LookupNS"><code>LookupNS</code></a> to its suite of resolving functions.
-<code>LookupNS</code> returns the <a href="/pkg/net/#NS">NS records</a> for a host name.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package adds protocol-specific
-packet reading and writing methods to
-<a href="/pkg/net/#IPConn"><code>IPConn</code></a>
-(<a href="/pkg/net/#IPConn.ReadMsgIP"><code>ReadMsgIP</code></a>
-and <a href="/pkg/net/#IPConn.WriteMsgIP"><code>WriteMsgIP</code></a>) and
-<a href="/pkg/net/#UDPConn"><code>UDPConn</code></a>
-(<a href="/pkg/net/#UDPConn.ReadMsgUDP"><code>ReadMsgUDP</code></a> and
-<a href="/pkg/net/#UDPConn.WriteMsgUDP"><code>WriteMsgUDP</code></a>).
-These are specialized versions of <a href="/pkg/net/#PacketConn"><code>PacketConn</code></a>'s
-<code>ReadFrom</code> and <code>WriteTo</code> methods that provide access to out-of-band data associated
-with the packets.
- </li>
-
- <li>
-The <a href="/pkg/net/"><code>net</code></a> package adds methods to
-<a href="/pkg/net/#UnixConn"><code>UnixConn</code></a> to allow closing half of the connection
-(<a href="/pkg/net/#UnixConn.CloseRead"><code>CloseRead</code></a> and
-<a href="/pkg/net/#UnixConn.CloseWrite"><code>CloseWrite</code></a>),
-matching the existing methods of <a href="/pkg/net/#TCPConn"><code>TCPConn</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package includes several new additions.
-<a href="/pkg/net/http/#ParseTime"><code>ParseTime</code></a> parses a time string, trying
-several common HTTP time formats.
-The <a href="/pkg/net/http/#Request.PostFormValue"><code>PostFormValue</code></a> method of
-<a href="/pkg/net/http/#Request"><code>Request</code></a> is like
-<a href="/pkg/net/http/#Request.FormValue"><code>FormValue</code></a> but ignores URL parameters.
-The <a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a> interface provides a mechanism
-for a server handler to discover when a client has disconnected.
-The <code>ServeMux</code> type now has a
-<a href="/pkg/net/http/#ServeMux.Handler"><code>Handler</code></a> method to access a path's
-<code>Handler</code> without executing it.
-The <code>Transport</code> can now cancel an in-flight request with
-<a href="/pkg/net/http/#Transport.CancelRequest"><code>CancelRequest</code></a>.
-Finally, the Transport is now more aggressive at closing TCP connections when
-a <a href="/pkg/net/http/#Response"><code>Response.Body</code></a> is closed before
-being fully consumed.
-</li>
-
-<li>
-The <a href="/pkg/net/mail/"><code>net/mail</code></a> package has two new functions,
-<a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a> and
-<a href="/pkg/net/mail/#ParseAddressList"><code>ParseAddressList</code></a>,
-to parse RFC 5322-formatted mail addresses into
-<a href="/pkg/net/mail/#Address"><code>Address</code></a> structures.
-</li>
-
-<li>
-The <a href="/pkg/net/smtp/"><code>net/smtp</code></a> package's
-<a href="/pkg/net/smtp/#Client"><code>Client</code></a> type has a new method,
-<a href="/pkg/net/smtp/#Client.Hello"><code>Hello</code></a>,
-which transmits a <code>HELO</code> or <code>EHLO</code> message to the server.
-</li>
-
-<li>
-The <a href="/pkg/net/textproto/"><code>net/textproto</code></a> package
-has two new functions,
-<a href="/pkg/net/textproto/#TrimBytes"><code>TrimBytes</code></a> and
-<a href="/pkg/net/textproto/#TrimString"><code>TrimString</code></a>,
-which do ASCII-only trimming of leading and trailing spaces.
-</li>
-
-<li>
-The new method <a href="/pkg/os/#FileMode.IsRegular"><code>os.FileMode.IsRegular</code></a> makes it easy to ask if a file is a plain file.
-</li>
-
-<li>
-The <a href="/pkg/os/signal/"><code>os/signal</code></a> package has a new function,
-<a href="/pkg/os/signal/#Stop"><code>Stop</code></a>, which stops the package delivering
-any further signals to the channel.
-</li>
-
-<li>
-The <a href="/pkg/regexp/"><code>regexp</code></a> package
-now supports Unix-original leftmost-longest matches through the
-<a href="/pkg/regexp/#Regexp.Longest"><code>Regexp.Longest</code></a>
-method, while
-<a href="/pkg/regexp/#Regexp.Split"><code>Regexp.Split</code></a> slices
-strings into pieces based on separators defined by the regular expression.
-</li>
-
-<li>
-The <a href="/pkg/runtime/debug/"><code>runtime/debug</code></a> package
-has three new functions regarding memory usage.
-The <a href="/pkg/runtime/debug/#FreeOSMemory"><code>FreeOSMemory</code></a>
-function triggers a run of the garbage collector and then attempts to return unused
-memory to the operating system;
-the <a href="/pkg/runtime/debug/#ReadGCStats"><code>ReadGCStats</code></a>
-function retrieves statistics about the collector; and
-<a href="/pkg/runtime/debug/#SetGCPercent"><code>SetGCPercent</code></a>
-provides a programmatic way to control how often the collector runs,
-including disabling it altogether.
-</li>
-
-<li>
-The <a href="/pkg/sort/"><code>sort</code></a> package has a new function,
-<a href="/pkg/sort/#Reverse"><code>Reverse</code></a>.
-Wrapping the argument of a call to
-<a href="/pkg/sort/#Sort"><code>sort.Sort</code></a>
-with a call to <code>Reverse</code> causes the sort order to be reversed.
-</li>
-
-<li>
-The <a href="/pkg/strings/"><code>strings</code></a> package has two new functions,
-<a href="/pkg/strings/#TrimPrefix"><code>TrimPrefix</code></a>
-and
-<a href="/pkg/strings/#TrimSuffix"><code>TrimSuffix</code></a>
-with self-evident properties, and the new method
-<a href="/pkg/strings/#Reader.WriteTo"><code>Reader.WriteTo</code></a> so the
-<a href="/pkg/strings/#Reader"><code>Reader</code></a>
-type now implements the
-<a href="/pkg/io/#WriterTo"><code>io.WriterTo</code></a> interface.
-</li>
-
-<li>
-The <a href="/pkg/syscall/"><code>syscall</code></a> package's
-<a href="/pkg/syscall/#Fchflags"><code>Fchflags</code></a> function on various BSDs
-(including Darwin) has changed signature.
-It now takes an int as the first parameter instead of a string.
-Since this API change fixes a bug, it is permitted by the Go 1 compatibility rules.
-</li>
-<li>
-The <a href="/pkg/syscall/"><code>syscall</code></a> package also has received many updates
-to make it more inclusive of constants and system calls for each supported operating system.
-</li>
-
-<li>
-The <a href="/pkg/testing/"><code>testing</code></a> package now automates the generation of allocation
-statistics in tests and benchmarks using the new
-<a href="/pkg/testing/#AllocsPerRun"><code>AllocsPerRun</code></a> function. And the
-<a href="/pkg/testing/#B.ReportAllocs"><code>ReportAllocs</code></a>
-method on <a href="/pkg/testing/#B"><code>testing.B</code></a> will enable printing of
-memory allocation statistics for the calling benchmark. It also introduces the
-<a href="/pkg/testing/#BenchmarkResult.AllocsPerOp"><code>AllocsPerOp</code></a> method of
-<a href="/pkg/testing/#BenchmarkResult"><code>BenchmarkResult</code></a>.
-There is also a new
-<a href="/pkg/testing/#Verbose"><code>Verbose</code></a> function to test the state of the <code>-v</code>
-command-line flag,
-and a new
-<a href="/pkg/testing/#B.Skip"><code>Skip</code></a> method of
-<a href="/pkg/testing/#B"><code>testing.B</code></a> and
-<a href="/pkg/testing/#T"><code>testing.T</code></a>
-to simplify skipping an inappropriate test.
-</li>
-
-<li>
-In the <a href="/pkg/text/template/"><code>text/template</code></a>
-and
-<a href="/pkg/html/template/"><code>html/template</code></a> packages,
-templates can now use parentheses to group the elements of pipelines, simplifying the construction of complex pipelines.
-Also, as part of the new parser, the
-<a href="/pkg/text/template/parse/#Node"><code>Node</code></a> interface got two new methods to provide
-better error reporting.
-Although this violates the Go 1 compatibility rules,
-no existing code should be affected because this interface is explicitly intended only to be used
-by the
-<a href="/pkg/text/template/"><code>text/template</code></a>
-and
-<a href="/pkg/html/template/"><code>html/template</code></a>
-packages and there are safeguards to guarantee that.
-</li>
-
-<li>
-The implementation of the <a href="/pkg/unicode/"><code>unicode</code></a> package has been updated to Unicode version 6.2.0.
-</li>
-
-<li>
-In the <a href="/pkg/unicode/utf8/"><code>unicode/utf8</code></a> package,
-the new function <a href="/pkg/unicode/utf8/#ValidRune"><code>ValidRune</code></a> reports whether the rune is a valid Unicode code point.
-To be valid, a rune must be in range and not be a surrogate half.
-</li>
-</ul>
diff --git a/doc/go1.10.html b/doc/go1.10.html
deleted file mode 100644
index 853f874ded..0000000000
--- a/doc/go1.10.html
+++ /dev/null
@@ -1,1448 +0,0 @@
-<!--{
- "Title": "Go 1.10 Release Notes",
- "Path": "/doc/go1.10",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.10</h2>
-
-<p>
-The latest Go release, version 1.10, arrives six months after <a href="go1.9">Go 1.9</a>.
-Most of its changes are in the implementation of the toolchain, runtime, and libraries.
-As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
-We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
-This release improves <a href="#build">caching of built packages</a>,
-adds <a href="#test">caching of successful test results</a>,
-runs <a href="#test-vet">vet automatically during tests</a>,
-and
-permits <a href="#cgo">passing string values directly between Go and C using cgo</a>.
-A new <a href="#cgo">hard-coded set of safe compiler options</a> may cause
-unexpected <a href="https://golang.org/s/invalidflag"><code>invalid
-flag</code></a> errors in code that built successfully with older
-releases.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
-There are no significant changes to the language specification.
-</p>
-
-<p><!-- CL 60230 -->
-A corner case involving shifts of untyped constants has been clarified,
-and as a result the compilers have been updated to allow the index expression
-<code>x[1.0</code>&nbsp;<code>&lt;&lt;</code>&nbsp;<code>s]</code> where <code>s</code> is an unsigned integer;
-the <a href="/pkg/go/types/">go/types</a> package already did.
-</p>
-
-<p><!-- CL 73233 -->
-The grammar for method expressions has been updated to relax the
-syntax to allow any type expression as a receiver;
-this matches what the compilers were already implementing.
-For example, <code>struct{io.Reader}.Read</code> is a valid, if unusual,
-method expression that the compilers already accepted and is
-now permitted by the language grammar.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p>
-There are no new supported operating systems or processor architectures in this release.
-Most of the work has focused on strengthening the support for existing ports,
-in particular <a href="#asm">new instructions in the assembler</a>
-and improvements to the code generated by the compilers.
-</p>
-
-<p id="freebsd">
-As <a href="go1.9#freebsd">announced in the Go 1.9 release notes</a>,
-Go 1.10 now requires FreeBSD 10.3 or later;
-support for FreeBSD 9.3 has been removed.
-</p>
-
-<p id="netbsd">
-Go now runs on NetBSD again but requires the unreleased NetBSD 8.
-Only <code>GOARCH</code> <code>amd64</code> and <code>386</code> have
-been fixed. The <code>arm</code> port is still broken.
-</p>
-
-<p id="mips">
-On 32-bit MIPS systems, the new environment variable settings
-<code>GOMIPS=hardfloat</code> (the default) and
-<code>GOMIPS=softfloat</code> select whether to use
-hardware instructions or software emulation for floating-point computations.
-</p>
-
-<p id="openbsd">
-Go 1.10 is the last release that will run on OpenBSD 6.0.
-Go 1.11 will require OpenBSD 6.2.
-</p>
-
-<p id="darwin">
-Go 1.10 is the last release that will run on OS X 10.8 Mountain Lion or OS X 10.9 Mavericks.
-Go 1.11 will require OS X 10.10 Yosemite or later.
-</p>
-
-<p id="windows">
-Go 1.10 is the last release that will run on Windows XP or Windows Vista.
-Go 1.11 will require Windows 7 or later.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="goroot">Default GOROOT &amp; GOTMPDIR</h3>
-
-<p>
-If the environment variable <code>$GOROOT</code> is unset,
-the go tool previously used the default <code>GOROOT</code>
-set during toolchain compilation.
-Now, before falling back to that default, the go tool attempts to
-deduce <code>GOROOT</code> from its own executable path.
-This allows binary distributions to be unpacked anywhere in the
-file system and then be used without setting <code>GOROOT</code>
-explicitly.
-</p>
-
-<p>
-By default, the go tool creates its temporary files and directories
-in the system temporary directory (for example, <code>$TMPDIR</code> on Unix).
-If the new environment variable <code>$GOTMPDIR</code> is set,
-the go tool will creates its temporary files and directories in that directory instead.
-</p>
-
-<h3 id="build">Build &amp; Install</h3>
-
-<p>
-The <code>go</code>&nbsp;<code>build</code> command now detects out-of-date packages
-purely based on the content of source files, specified build flags, and metadata stored in the compiled packages.
-Modification times are no longer consulted or relevant.
-The old advice to add <code>-a</code> to force a rebuild in cases where
-the modification times were misleading for one reason or another
-(for example, changes in build flags) is no longer necessary:
-builds now always detect when packages must be rebuilt.
-(If you observe otherwise, please file a bug.)
-</p>
-
-<p>
-The <code>go</code>&nbsp;<code>build</code> <code>-asmflags</code>, <code>-gcflags</code>, <code>-gccgoflags</code>, and <code>-ldflags</code> options
-now apply by default only to the packages listed directly on the command line.
-For example, <code>go</code> <code>build</code> <code>-gcflags=-m</code> <code>mypkg</code>
-passes the compiler the <code>-m</code> flag when building <code>mypkg</code>
-but not its dependencies.
-The new, more general form <code>-asmflags=pattern=flags</code> (and similarly for the others)
-applies the <code>flags</code> only to the packages matching the pattern.
-For example: <code>go</code> <code>install</code> <code>-ldflags=cmd/gofmt=-X=main.version=1.2.3</code> <code>cmd/...</code>
-installs all the commands matching <code>cmd/...</code> but only applies the <code>-X</code> option
-to the linker flags for <code>cmd/gofmt</code>.
-For more details, see <a href="/cmd/go/#hdr-Compile_packages_and_dependencies"><code>go</code> <code>help</code> <code>build</code></a>.
-</p>
-
-<p>
-The <code>go</code>&nbsp;<code>build</code> command now maintains a cache of
-recently built packages, separate from the installed packages in <code>$GOROOT/pkg</code> or <code>$GOPATH/pkg</code>.
-The effect of the cache should be to speed builds that do not explicitly install packages
-or when switching between different copies of source code (for example, when changing
-back and forth between different branches in a version control system).
-The old advice to add the <code>-i</code> flag for speed, as in <code>go</code> <code>build</code> <code>-i</code>
-or <code>go</code> <code>test</code> <code>-i</code>,
-is no longer necessary: builds run just as fast without <code>-i</code>.
-For more details, see <a href="/cmd/go/#hdr-Build_and_test_caching"><code>go</code> <code>help</code> <code>cache</code></a>.
-</p>
-
-<p>
-The <code>go</code>&nbsp;<code>install</code> command now installs only the
-packages and commands listed directly on the command line.
-For example, <code>go</code> <code>install</code> <code>cmd/gofmt</code>
-installs the gofmt program but not any of the packages on which it depends.
-The new build cache makes future commands still run as quickly as if the
-dependencies had been installed.
-To force the installation of dependencies, use the new
-<code>go</code> <code>install</code> <code>-i</code> flag.
-Installing dependency packages should not be necessary in general,
-and the very concept of installed packages may disappear in a future release.
-</p>
-
-<p>
-Many details of the <code>go</code>&nbsp;<code>build</code> implementation have changed to support these improvements.
-One new requirement implied by these changes is that
-binary-only packages must now declare accurate import blocks in their
-stub source code, so that those imports can be made available when
-linking a program using the binary-only package.
-For more details, see <a href="/cmd/go/#hdr-File_types"><code>go</code> <code>help</code> <code>filetype</code></a>.
-</p>
-
-<h3 id="test">Test</h3>
-
-<p>
-The <code>go</code>&nbsp;<code>test</code> command now caches test results:
-if the test executable and command line match a previous run
-and the files and environment variables consulted by that run
-have not changed either, <code>go</code> <code>test</code> will print
-the previous test output, replacing the elapsed time with the string “(cached).”
-Test caching applies only to successful test results;
-only to <code>go</code> <code>test</code>
-commands with an explicit list of packages; and
-only to command lines using a subset of the
-<code>-cpu</code>, <code>-list</code>, <code>-parallel</code>,
-<code>-run</code>, <code>-short</code>, and <code>-v</code> test flags.
-The idiomatic way to bypass test caching is to use <code>-count=1</code>.
-</p>
-
-<p id="test-vet">
-The <code>go</code>&nbsp;<code>test</code> command now automatically runs
-<code>go</code> <code>vet</code> on the package being tested,
-to identify significant problems before running the test.
-Any such problems are treated like build errors and prevent execution of the test.
-Only a high-confidence subset of the available <code>go</code> <code>vet</code>
-checks are enabled for this automatic check.
-To disable the running of <code>go</code> <code>vet</code>, use
-<code>go</code> <code>test</code> <code>-vet=off</code>.
-</p>
-
-<p>
-The <code>go</code> <code>test</code> <code>-coverpkg</code> flag now
-interprets its argument as a comma-separated list of patterns to match against
-the dependencies of each test, not as a list of packages to load anew.
-For example, <code>go</code> <code>test</code> <code>-coverpkg=all</code>
-is now a meaningful way to run a test with coverage enabled for the test package
-and all its dependencies.
-Also, the <code>go</code> <code>test</code> <code>-coverprofile</code> option is now
-supported when running multiple tests.
-</p>
-
-<p>
-In case of failure due to timeout, tests are now more likely to write their profiles before exiting.
-</p>
-
-<p>
-The <code>go</code>&nbsp;<code>test</code> command now always
-merges the standard output and standard error from a given test binary execution
-and writes both to <code>go</code> <code>test</code>'s standard output.
-In past releases, <code>go</code> <code>test</code> only applied this
-merging most of the time.
-</p>
-
-<p>
-The <code>go</code>&nbsp;<code>test</code> <code>-v</code> output
-now includes <code>PAUSE</code> and <code>CONT</code> status update
-lines to mark when <a href="/pkg/testing/#T.Parallel">parallel tests</a> pause and continue.
-</p>
-
-<p>
-The new <code>go</code> <code>test</code> <code>-failfast</code> flag
-disables running additional tests after any test fails.
-Note that tests running in parallel with the failing test are allowed to complete.
-</p>
-
-<p>
-Finally, the new <code>go</code> <code>test</code> <code>-json</code> flag
-filters test output through the new command
-<code>go</code> <code>tool</code> <code>test2json</code>
-to produce a machine-readable JSON-formatted description of test execution.
-This allows the creation of rich presentations of test execution
-in IDEs and other tools.
-</p>
-
-
-<p>
-For more details about all these changes,
-see <a href="/cmd/go/#hdr-Test_packages"><code>go</code> <code>help</code> <code>test</code></a>
-and the <a href="/cmd/test2json/">test2json documentation</a>.
-</p>
-
-<h3 id="cgo">Cgo</h3>
-
-<p>
-Options specified by cgo using <code>#cgo CFLAGS</code> and the like
-are now checked against a list of permitted options.
-This closes a security hole in which a downloaded package uses
-compiler options like
-<span style="white-space: nowrap"><code>-fplugin</code></span>
-to run arbitrary code on the machine where it is being built.
-This can cause a build error such as <code>invalid flag in #cgo CFLAGS</code>.
-For more background, and how to handle this error, see
-<a href="https://golang.org/s/invalidflag">https://golang.org/s/invalidflag</a>.
-</p>
-
-<p>
-Cgo now implements a C typedef like “<code>typedef</code> <code>X</code> <code>Y</code>” using a Go type alias,
-so that Go code may use the types <code>C.X</code> and <code>C.Y</code> interchangeably.
-It also now supports the use of niladic function-like macros.
-Also, the documentation has been updated to clarify that
-Go structs and Go arrays are not supported in the type signatures of cgo-exported functions.
-</p>
-
-<p>
-Cgo now supports direct access to Go string values from C.
-Functions in the C preamble may use the type <code>_GoString_</code>
-to accept a Go string as an argument.
-C code may call <code>_GoStringLen</code> and <code>_GoStringPtr</code>
-for direct access to the contents of the string.
-A value of type <code>_GoString_</code>
-may be passed in a call to an exported Go function that takes an argument of Go type <code>string</code>.
-</p>
-
-<p>
-During toolchain bootstrap, the environment variables <code>CC</code> and <code>CC_FOR_TARGET</code> specify
-the default C compiler that the resulting toolchain will use for host and target builds, respectively.
-However, if the toolchain will be used with multiple targets, it may be necessary to specify a different C compiler for each
-(for example, a different compiler for <code>darwin/arm64</code> versus <code>linux/ppc64le</code>).
-The new set of environment variables <code>CC_FOR_<i>goos</i>_<i>goarch</i></code>
-allows specifying a different default C compiler for each target.
-Note that these variables only apply during toolchain bootstrap,
-to set the defaults used by the resulting toolchain.
-Later <code>go</code> <code>build</code> commands use the <code>CC</code> environment
-variable or else the built-in default.
-</p>
-
-<p>
-Cgo now translates some C types that would normally map to a pointer
-type in Go, to a <code>uintptr</code> instead. These types include
-the <code>CFTypeRef</code> hierarchy in Darwin's CoreFoundation
-framework and the <code>jobject</code> hierarchy in Java's JNI
-interface.
-</p>
-
-<p>
-These types must be <code>uintptr</code> on the Go side because they
-would otherwise confuse the Go garbage collector; they are sometimes
-not really pointers but data structures encoded in a pointer-sized integer.
-Pointers to Go memory must not be stored in these <code>uintptr</code> values.
-</p>
-
-<p>
-Because of this change, values of the affected types need to be
-zero-initialized with the constant <code>0</code> instead of the
-constant <code>nil</code>. Go 1.10 provides <code>gofix</code>
-modules to help with that rewrite:
-</p>
-
-<pre>
-go tool fix -r cftype &lt;pkg&gt;
-go tool fix -r jni &lt;pkg&gt;
-</pre>
-
-<p>
-For more details, see the <a href="/cmd/cgo/">cgo documentation</a>.
-</p>
-
-<h3 id="doc">Doc</h3>
-
-<p>
-The <code>go</code>&nbsp;<code>doc</code> tool now adds functions returning slices of <code>T</code> or <code>*T</code>
-to the display of type <code>T</code>, similar to the existing behavior for functions returning single <code>T</code> or <code>*T</code> results.
-For example:
-</p>
-
-<pre>
-$ go doc mail.Address
-package mail // import "net/mail"
-
-type Address struct {
- Name string
- Address string
-}
- Address represents a single mail address.
-
-func ParseAddress(address string) (*Address, error)
-func ParseAddressList(list string) ([]*Address, error)
-func (a *Address) String() string
-$
-</pre>
-
-<p>
-Previously, <code>ParseAddressList</code> was only shown in the package overview (<code>go</code> <code>doc</code> <code>mail</code>).
-</p>
-
-<h3 id="fix">Fix</h3>
-
-<p>
-The <code>go</code>&nbsp;<code>fix</code> tool now replaces imports of <code>"golang.org/x/net/context"</code>
-with <code>"context"</code>.
-(Forwarding aliases in the former make it completely equivalent to the latter when using Go 1.9 or later.)
-</p>
-
-<h3 id="get">Get</h3>
-
-<p>
-The <code>go</code>&nbsp;<code>get</code> command now supports Fossil source code repositories.
-</p>
-
-<h3 id="pprof">Pprof</h3>
-
-<p>
-The blocking and mutex profiles produced by the <code>runtime/pprof</code> package
-now include symbol information, so they can be viewed
-in <code>go</code> <code>tool</code> <code>pprof</code>
-without the binary that produced the profile.
-(All other profile types were changed to include symbol information in Go 1.9.)
-</p>
-
-<p>
-The <a href="/cmd/pprof/"><code>go</code>&nbsp;<code>tool</code>&nbsp;<code>pprof</code></a>
-profile visualizer has been updated to git version 9e20b5b (2017-11-08)
-from <a href="https://github.com/google/pprof">github.com/google/pprof</a>,
-which includes an updated web interface.
-</p>
-
-<h3 id="vet">Vet</h3>
-
-<p>
-The <a href="/cmd/vet/"><code>go</code>&nbsp;<code>vet</code></a> command now always has access to
-complete, up-to-date type information when checking packages, even for packages using cgo or vendored imports.
-The reports should be more accurate as a result.
-Note that only <code>go</code>&nbsp;<code>vet</code> has access to this information;
-the more low-level <code>go</code>&nbsp;<code>tool</code>&nbsp;<code>vet</code> does not
-and should be avoided except when working on <code>vet</code> itself.
-(As of Go 1.9, <code>go</code>&nbsp;<code>vet</code> provides access to all the same flags as
-<code>go</code>&nbsp;<code>tool</code>&nbsp;<code>vet</code>.)
-</p>
-
-<h3 id="diag">Diagnostics</h3>
-
-<p>
-This release includes a new <a href="/doc/diagnostics.html">overview of available Go program diagnostic tools</a>.
-</p>
-
-<h3 id="gofmt">Gofmt</h3>
-
-<p>
-Two minor details of the default formatting of Go source code have changed.
-First, certain complex three-index slice expressions previously formatted like
-<code>x[i+1</code>&nbsp;<code>:</code>&nbsp;<code>j:k]</code> and now
-format with more consistent spacing: <code>x[i+1</code>&nbsp;<code>:</code>&nbsp;<code>j</code>&nbsp;<code>:</code>&nbsp;<code>k]</code>.
-Second, single-method interface literals written on a single line,
-which are sometimes used in type assertions,
-are no longer split onto multiple lines.
-</p>
-
-<p>
-Note that these kinds of minor updates to gofmt are expected from time to time.
-In general, we recommend against building systems that check that source code
-matches the output of a specific version of gofmt.
-For example, a continuous integration test that fails if any code already checked into
-a repository is not “properly formatted” is inherently fragile and not recommended.
-</p>
-
-<p>
-If multiple programs must agree about which version of gofmt is used to format a source file,
-we recommend that they do this by arranging to invoke the same gofmt binary.
-For example, in the Go open source repository, our Git pre-commit hook is written in Go
-and could import <code>go/format</code> directly, but instead it invokes the <code>gofmt</code>
-binary found in the current path, so that the pre-commit hook need not be recompiled
-each time <code>gofmt</code> changes.
-</p>
-
-<h3 id="compiler">Compiler Toolchain</h3>
-
-<p>
-The compiler includes many improvements to the performance of generated code,
-spread fairly evenly across the supported architectures.
-</p>
-
-<p>
-The DWARF debug information recorded in binaries has been improved in a few ways:
-constant values are now recorded;
-line number information is more accurate, making source-level stepping through a program work better;
-and each package is now presented as its own DWARF compilation unit.
-</p>
-
-<p>
-The various <a href="https://docs.google.com/document/d/1nr-TQHw_er6GOQRsF6T43GGhFDelrAP0NqSS_00RgZQ/edit">build modes</a>
-have been ported to more systems.
-Specifically, <code>c-shared</code> now works on <code>linux/ppc64le</code>, <code>windows/386</code>, and <code>windows/amd64</code>;
-<code>pie</code> now works on <code>darwin/amd64</code> and also forces the use of external linking on all systems;
-and <code>plugin</code> now works on <code>linux/ppc64le</code> and <code>darwin/amd64</code>.
-</p>
-
-<p>
-The <code>linux/ppc64le</code> port now requires the use of external linking
-with any programs that use cgo, even uses by the standard library.
-</p>
-
-<h3 id="asm">Assembler</h3>
-
-<p>
-For the ARM 32-bit port, the assembler now supports the instructions
-<code><small>BFC</small></code>,
-<code><small>BFI</small></code>,
-<code><small>BFX</small></code>,
-<code><small>BFXU</small></code>,
-<code><small>FMULAD</small></code>,
-<code><small>FMULAF</small></code>,
-<code><small>FMULSD</small></code>,
-<code><small>FMULSF</small></code>,
-<code><small>FNMULAD</small></code>,
-<code><small>FNMULAF</small></code>,
-<code><small>FNMULSD</small></code>,
-<code><small>FNMULSF</small></code>,
-<code><small>MULAD</small></code>,
-<code><small>MULAF</small></code>,
-<code><small>MULSD</small></code>,
-<code><small>MULSF</small></code>,
-<code><small>NMULAD</small></code>,
-<code><small>NMULAF</small></code>,
-<code><small>NMULD</small></code>,
-<code><small>NMULF</small></code>,
-<code><small>NMULSD</small></code>,
-<code><small>NMULSF</small></code>,
-<code><small>XTAB</small></code>,
-<code><small>XTABU</small></code>,
-<code><small>XTAH</small></code>,
-and
-<code><small>XTAHU</small></code>.
-</p>
-
-<p>
-For the ARM 64-bit port, the assembler now supports the
-<code><small>VADD</small></code>,
-<code><small>VADDP</small></code>,
-<code><small>VADDV</small></code>,
-<code><small>VAND</small></code>,
-<code><small>VCMEQ</small></code>,
-<code><small>VDUP</small></code>,
-<code><small>VEOR</small></code>,
-<code><small>VLD1</small></code>,
-<code><small>VMOV</small></code>,
-<code><small>VMOVI</small></code>,
-<code><small>VMOVS</small></code>,
-<code><small>VORR</small></code>,
-<code><small>VREV32</small></code>,
-and
-<code><small>VST1</small></code>
-instructions.
-</p>
-
-<p>
-For the PowerPC 64-bit port, the assembler now supports the POWER9 instructions
-<code><small>ADDEX</small></code>,
-<code><small>CMPEQB</small></code>,
-<code><small>COPY</small></code>,
-<code><small>DARN</small></code>,
-<code><small>LDMX</small></code>,
-<code><small>MADDHD</small></code>,
-<code><small>MADDHDU</small></code>,
-<code><small>MADDLD</small></code>,
-<code><small>MFVSRLD</small></code>,
-<code><small>MTVSRDD</small></code>,
-<code><small>MTVSRWS</small></code>,
-<code><small>PASTECC</small></code>,
-<code><small>VCMPNEZB</small></code>,
-<code><small>VCMPNEZBCC</small></code>,
-and
-<code><small>VMSUMUDM</small></code>.
-</p>
-
-<p>
-For the S390X port, the assembler now supports the
-<code><small>TMHH</small></code>,
-<code><small>TMHL</small></code>,
-<code><small>TMLH</small></code>,
-and
-<code><small>TMLL</small></code>
-instructions.
-</p>
-
-<p>
-For the X86 64-bit port, the assembler now supports 359 new instructions,
-including the full AVX, AVX2, BMI, BMI2, F16C, FMA3, SSE2, SSE3, SSSE3, SSE4.1, and SSE4.2 extension sets.
-The assembler also no longer implements <code><small>MOVL</small></code>&nbsp;<code><small>$0,</small></code>&nbsp;<code><small>AX</small></code>
-as an <code><small>XORL</small></code> instruction,
-to avoid clearing the condition flags unexpectedly.
-</p>
-
-<h3 id="gccgo">Gccgo</h3>
-
-<p>
-Due to the alignment of Go's semiannual release schedule with GCC's
-annual release schedule,
-GCC release 7 contains the Go 1.8.3 version of gccgo.
-We expect that the next release, GCC 8, will contain the Go 1.10
-version of gccgo.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p>
-The behavior of nested calls to
-<a href="/pkg/runtime/#LockOSThread"><code>LockOSThread</code></a> and
-<a href="/pkg/runtime/#UnlockOSThread"><code>UnlockOSThread</code></a>
-has changed.
-These functions control whether a goroutine is locked to a specific operating system thread,
-so that the goroutine only runs on that thread, and the thread only runs that goroutine.
-Previously, calling <code>LockOSThread</code> more than once in a row
-was equivalent to calling it once, and a single <code>UnlockOSThread</code>
-always unlocked the thread.
-Now, the calls nest: if <code>LockOSThread</code> is called multiple times,
-<code>UnlockOSThread</code> must be called the same number of times
-in order to unlock the thread.
-Existing code that was careful not to nest these calls will remain correct.
-Existing code that incorrectly assumed the calls nested will become correct.
-Most uses of these functions in public Go source code falls into the second category.
-</p>
-
-<p>
-Because one common use of <code>LockOSThread</code> and <code>UnlockOSThread</code>
-is to allow Go code to reliably modify thread-local state (for example, Linux or Plan 9 name spaces),
-the runtime now treats locked threads as unsuitable for reuse or for creating new threads.
-</p>
-
-<p>
-Stack traces no longer include implicit wrapper functions (previously marked <code>&lt;autogenerated&gt;</code>),
-unless a fault or panic happens in the wrapper itself.
-As a result, skip counts passed to functions like <a href="/pkg/runtime/#Caller"><code>Caller</code></a>
-should now always match the structure of the code as written, rather than depending on
-optimization decisions and implementation details.
-</p>
-
-<p>
-The garbage collector has been modified to reduce its impact on allocation latency.
-It now uses a smaller fraction of the overall CPU when running, but it may run more of the time.
-The total CPU consumed by the garbage collector has not changed significantly.
-</p>
-
-<p>
-The <a href="/pkg/runtime/#GOROOT"><code>GOROOT</code></a> function
-now defaults (when the <code>$GOROOT</code> environment variable is not set)
-to the <code>GOROOT</code> or <code>GOROOT_FINAL</code> in effect
-at the time the calling program was compiled.
-Previously it used the <code>GOROOT</code> or <code>GOROOT_FINAL</code> in effect
-at the time the toolchain that compiled the calling program was compiled.
-</p>
-
-<p>
-There is no longer a limit on the <a href="/pkg/runtime/#GOMAXPROCS"><code>GOMAXPROCS</code></a> setting.
-(In Go 1.9 the limit was 1024.)
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-As always, the changes are so general and varied that precise
-statements about performance are difficult to make. Most programs
-should run a bit faster, due to speedups in the garbage collector,
-better generated code, and optimizations in the core library.
-</p>
-
-<h2 id="gc">Garbage Collector</h2>
-
-<p>
-Many applications should experience significantly lower allocation latency and overall performance overhead when the garbage collector is active.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<p>
-All of the changes to the standard library are minor.
-The changes in <a href="#bytes">bytes</a>
-and <a href="#net/url">net/url</a> are the most likely to require updating of existing programs.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-As always, there are various minor changes and updates to the library,
-made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
-in mind.
-</p>
-
-<dl id="archive/tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt>
-<dd>
-<p>
-In general, the handling of special header formats is significantly improved and expanded.
-</p>
-<p>
-<a href="/pkg/archive/tar/#FileInfoHeader"><code>FileInfoHeader</code></a> has always
-recorded the Unix UID and GID numbers from its <a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a> argument
-(specifically, from the system-dependent information returned by the <code>FileInfo</code>'s <code>Sys</code> method)
-in the returned <a href="/pkg/archive/tar/#Header"><code>Header</code></a>.
-Now it also records the user and group names corresponding to those IDs,
-as well as the major and minor device numbers for device files.
-</p>
-<p>
-The new <a href="/pkg/archive/tar/#Header"><code>Header.Format</code></a> field
-of type <a href="/pkg/archive/tar/#Format"><code>Format</code></a>
-controls which tar header format the <a href="/pkg/archive/tar/#Writer"><code>Writer</code></a> uses.
-The default, as before, is to select the most widely-supported header type
-that can encode the fields needed by the header (USTAR if possible, or else PAX if possible, or else GNU).
-The <a href="/pkg/archive/tar/#Reader"><code>Reader</code></a> sets <code>Header.Format</code> for each header it reads.
-</p>
-<p>
-<code>Reader</code> and the <code>Writer</code> now support arbitrary PAX records,
-using the new <a href="/pkg/archive/tar/#Header"><code>Header.PAXRecords</code></a> field,
-a generalization of the existing <code>Xattrs</code> field.
-</p>
-<p>
-The <code>Reader</code> no longer insists that the file name or link name in GNU headers
-be valid UTF-8.
-</p>
-<p>
-When writing PAX- or GNU-format headers, the <code>Writer</code> now includes
-the <code>Header.AccessTime</code> and <code>Header.ChangeTime</code> fields (if set).
-When writing PAX-format headers, the times include sub-second precision.
-</p>
-</dl>
-
-<dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
-<dd>
-<p>
-Go 1.10 adds more complete support for times and character set encodings in ZIP archives.
-</p>
-<p>
-The original ZIP format used the standard MS-DOS encoding of year, month, day, hour, minute, and second into fields in two 16-bit values.
-That encoding cannot represent time zones or odd seconds, so multiple extensions have been
-introduced to allow richer encodings.
-In Go 1.10, the <a href="/pkg/archive/zip/#Reader"><code>Reader</code></a> and <a href="/pkg/archive/zip/#Writer"><code>Writer</code></a>
-now support the widely-understood Info-Zip extension that encodes the time separately in the 32-bit Unix “seconds since epoch” form.
-The <a href="/pkg/archive/zip/#FileHeader"><code>FileHeader</code></a>'s new <code>Modified</code> field of type <a href="/pkg/time/#Time"><code>time.Time</code></a>
-obsoletes the <code>ModifiedTime</code> and <code>ModifiedDate</code> fields, which continue to hold the MS-DOS encoding.
-The <code>Reader</code> and <code>Writer</code> now adopt the common
-convention that a ZIP archive storing a time zone-independent Unix time
-also stores the local time in the MS-DOS field,
-so that the time zone offset can be inferred.
-For compatibility, the <a href="/pkg/archive/zip/#FileHeader.ModTime"><code>ModTime</code></a> and
-<a href="/pkg/archive/zip/#FileHeader.SetModTime"><code>SetModTime</code></a> methods
-behave the same as in earlier releases; new code should use <code>Modified</code> directly.
-</p>
-<p>
-The header for each file in a ZIP archive has a flag bit indicating whether
-the name and comment fields are encoded as UTF-8, as opposed to a system-specific default encoding.
-In Go 1.8 and earlier, the <code>Writer</code> never set the UTF-8 bit.
-In Go 1.9, the <code>Writer</code> changed to set the UTF-8 bit almost always.
-This broke the creation of ZIP archives containing Shift-JIS file names.
-In Go 1.10, the <code>Writer</code> now sets the UTF-8 bit only when
-both the name and the comment field are valid UTF-8 and at least one is non-ASCII.
-Because non-ASCII encodings very rarely look like valid UTF-8, the new
-heuristic should be correct nearly all the time.
-Setting a <code>FileHeader</code>'s new <code>NonUTF8</code> field to true
-disables the heuristic entirely for that file.
-</p>
-<p>
-The <code>Writer</code> also now supports setting the end-of-central-directory record's comment field,
-by calling the <code>Writer</code>'s new <a href="/pkg/archive/zip/#Writer.SetComment"><code>SetComment</code></a> method.
-</p>
-</dl>
-
-<dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt>
-<dd>
-<p>
-The new <a href="/pkg/bufio/#Reader.Size"><code>Reader.Size</code></a>
-and <a href="/pkg/bufio/#Writer.Size"><code>Writer.Size</code></a>
-methods report the <code>Reader</code> or <code>Writer</code>'s underlying buffer size.
-</p>
-</dl>
-
-<dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
-<dd>
-<p>
-The
-<a href="/pkg/bytes/#Fields"><code>Fields</code></a>,
-<a href="/pkg/bytes/#FieldsFunc"><code>FieldsFunc</code></a>,
-<a href="/pkg/bytes/#Split"><code>Split</code></a>,
-and
-<a href="/pkg/bytes/#SplitAfter"><code>SplitAfter</code></a>
-functions have always returned subslices of their inputs.
-Go 1.10 changes each returned subslice to have capacity equal to its length,
-so that appending to one cannot overwrite adjacent data in the original input.
-</p>
-</dl>
-
-<dl id="crypto/cipher"><dt><a href="/pkg/crypto/cipher/">crypto/cipher</a></dt>
-<dd>
-<p>
-<a href="/pkg/crypto/cipher/#NewOFB"><code>NewOFB</code></a> now panics if given
-an initialization vector of incorrect length, like the other constructors in the
-package always have.
-(Previously it returned a nil <code>Stream</code> implementation.)
-</p>
-</dl>
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
-<dd>
-<p>
-The TLS server now advertises support for SHA-512 signatures when using TLS 1.2.
-The server already supported the signatures, but some clients would not select
-them unless explicitly advertised.
-</p>
-</dl>
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
-<dd>
-<p>
-<a href="/pkg/crypto/x509/#Certificate.Verify"><code>Certificate.Verify</code></a>
-now enforces the name constraints for all
-names contained in the certificate, not just the one name that a client has asked about.
-Extended key usage restrictions are similarly now checked all at once.
-As a result, after a certificate has been validated, now it can be trusted in its entirety.
-It is no longer necessary to revalidate the certificate for each additional name
-or key usage.
-</p>
-
-<p>
-Parsed certificates also now report URI names and IP, email, and URI constraints, using the new
-<a href="/pkg/crypto/x509/#Certificate"><code>Certificate</code></a> fields
-<code>URIs</code>, <code>PermittedIPRanges</code>, <code>ExcludedIPRanges</code>,
-<code>PermittedEmailAddresses</code>, <code>ExcludedEmailAddresses</code>,
-<code>PermittedURIDomains</code>, and <code>ExcludedURIDomains</code>. Certificates with
-invalid values for those fields are now rejected.
-</p>
-
-<p>
-The new <a href="/pkg/crypto/x509/#MarshalPKCS1PublicKey"><code>MarshalPKCS1PublicKey</code></a>
-and <a href="/pkg/crypto/x509/#ParsePKCS1PublicKey"><code>ParsePKCS1PublicKey</code></a>
-functions convert an RSA public key to and from PKCS#1-encoded form.
-</p>
-
-<p>
-The new <a href="/pkg/crypto/x509/#MarshalPKCS8PrivateKey"><code>MarshalPKCS8PrivateKey</code></a>
-function converts a private key to PKCS#8-encoded form.
-(<a href="/pkg/crypto/x509/#ParsePKCS8PrivateKey"><code>ParsePKCS8PrivateKey</code></a>
-has existed since Go 1.)
-</p>
-</dl>
-
-<dl id="crypto/x509/pkix"><dt><a href="/pkg/crypto/x509/pkix/">crypto/x509/pkix</a></dt>
-<dd>
-<p>
-<a href="/pkg/crypto/x509/pkix/#Name"><code>Name</code></a> now implements a
-<a href="/pkg/crypto/x509/pkix/#Name.String"><code>String</code></a> method that
-formats the X.509 distinguished name in the standard RFC 2253 format.
-</p>
-</dl>
-
-<dl id="database/sql/driver"><dt><a href="/pkg/database/sql/driver/">database/sql/driver</a></dt>
-<dd>
-<p>
-Drivers that currently hold on to the destination buffer provided by
-<a href="/pkg/database/sql/driver/#Rows.Next"><code>driver.Rows.Next</code></a> should ensure they no longer
-write to a buffer assigned to the destination array outside of that call.
-Drivers must be careful that underlying buffers are not modified when closing
-<a href="/pkg/database/sql/driver/#Rows"><code>driver.Rows</code></a>.
-</p>
-<p>
-Drivers that want to construct a <a href="/pkg/database/sql/#DB"><code>sql.DB</code></a> for
-their clients can now implement the <a href="/pkg/database/sql/driver/#Connector"><code>Connector</code></a> interface
-and call the new <a href="/pkg/database/sql/#OpenDB"><code>sql.OpenDB</code></a> function,
-instead of needing to encode all configuration into a string
-passed to <a href="/pkg/database/sql/#Open"><code>sql.Open</code></a>.
-</p>
-<p>
-Drivers that want to parse the configuration string only once per <code>sql.DB</code>
-instead of once per <a href="/pkg/database/sql/#Conn"><code>sql.Conn</code></a>,
-or that want access to each <code>sql.Conn</code>'s underlying context,
-can make their <a href="/pkg/database/sql/driver/#Driver"><code>Driver</code></a>
-implementations also implement <a href="/pkg/database/sql/driver/#DriverContext"><code>DriverContext</code></a>'s
-new <code>OpenConnector</code> method.
-</p>
-<p>
-Drivers that implement <a href="/pkg/database/sql/driver/#ExecerContext"><code>ExecerContext</code></a>
-no longer need to implement <a href="/pkg/database/sql/driver/#Execer"><code>Execer</code></a>;
-similarly, drivers that implement <a href="/pkg/database/sql/driver/#QueryerContext"><code>QueryerContext</code></a>
-no longer need to implement <a href="/pkg/database/sql/driver/#Queryer"><code>Queryer</code></a>.
-Previously, even if the context-based interfaces were implemented they were ignored
-unless the non-context-based interfaces were also implemented.
-</p>
-<p>
-To allow drivers to better isolate different clients using a cached driver connection in succession,
-if a <a href="/pkg/database/sql/driver/#Conn"><code>Conn</code></a> implements the new
-<a href="/pkg/database/sql/driver/#SessionResetter"><code>SessionResetter</code></a> interface,
-<code>database/sql</code> will now call <code>ResetSession</code> before
-reusing the <code>Conn</code> for a new client.
-</p>
-</dl>
-
-<dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
-<dd>
-<p>
-This release adds 348 new relocation constants divided between the relocation types
-<a href="/pkg/debug/elf/#R_386"><code>R_386</code></a>,
-<a href="/pkg/debug/elf/#R_AARCH64"><code>R_AARCH64</code></a>,
-<a href="/pkg/debug/elf/#R_ARM"><code>R_ARM</code></a>,
-<a href="/pkg/debug/elf/#R_PPC64"><code>R_PPC64</code></a>,
-and
-<a href="/pkg/debug/elf/#R_X86_64"><code>R_X86_64</code></a>.
-</p>
-</dl>
-
-<dl id="debug/macho"><dt><a href="/pkg/debug/macho/">debug/macho</a></dt>
-<dd>
-<p>
-Go 1.10 adds support for reading relocations from Mach-O sections,
-using the <a href="/pkg/debug/macho#Section"><code>Section</code></a> struct's new <code>Relocs</code> field
-and the new <a href="/pkg/debug/macho/#Reloc"><code>Reloc</code></a>,
-<a href="/pkg/debug/macho/#RelocTypeARM"><code>RelocTypeARM</code></a>,
-<a href="/pkg/debug/macho/#RelocTypeARM64"><code>RelocTypeARM64</code></a>,
-<a href="/pkg/debug/macho/#RelocTypeGeneric"><code>RelocTypeGeneric</code></a>,
-and
-<a href="/pkg/debug/macho/#RelocTypeX86_64"><code>RelocTypeX86_64</code></a>
-types and associated constants.
-</p>
-<p>
-Go 1.10 also adds support for the <code>LC_RPATH</code> load command,
-represented by the types
-<a href="/pkg/debug/macho/#RpathCmd"><code>RpathCmd</code></a> and
-<a href="/pkg/debug/macho/#Rpath"><code>Rpath</code></a>,
-and new <a href="/pkg/debug/macho/#pkg-constants">named constants</a>
-for the various flag bits found in headers.
-</p>
-</dl>
-
-<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
-<dd>
-<p>
-<a href="/pkg/encoding/asn1/#Marshal"><code>Marshal</code></a> now correctly encodes
-strings containing asterisks as type UTF8String instead of PrintableString,
-unless the string is in a struct field with a tag forcing the use of PrintableString.
-<code>Marshal</code> also now respects struct tags containing <code>application</code> directives.
-</p>
-<p>
-The new <a href="/pkg/encoding/asn1/#MarshalWithParams"><code>MarshalWithParams</code></a>
-function marshals its argument as if the additional params were its associated
-struct field tag.
-</p>
-<p>
-<a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a> now respects
-struct field tags using the <code>explicit</code> and <code>tag</code>
-directives.
-</p>
-<p>
-Both <code>Marshal</code> and <code>Unmarshal</code> now support a new struct field tag
-<code>numeric</code>, indicating an ASN.1 NumericString.
-</p>
-</dl>
-
-<dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt>
-<dd>
-<p>
-<a href="/pkg/encoding/csv/#Reader"><code>Reader</code></a> now disallows the use of
-nonsensical <code>Comma</code> and <code>Comment</code> settings,
-such as NUL, carriage return, newline, invalid runes, and the Unicode replacement character,
-or setting <code>Comma</code> and <code>Comment</code> equal to each other.
-</p>
-<p>
-In the case of a syntax error in a CSV record that spans multiple input lines, <code>Reader</code>
-now reports the line on which the record started in the <a href="/pkg/encoding/csv/#ParseError"><code>ParseError</code></a>'s new <code>StartLine</code> field.
-</p>
-</dl>
-
-<dl id="encoding/hex"><dt><a href="/pkg/encoding/hex/">encoding/hex</a></dt>
-<dd>
-<p>
-The new functions
-<a href="/pkg/encoding/hex/#NewEncoder"><code>NewEncoder</code></a>
-and
-<a href="/pkg/encoding/hex/#NewDecoder"><code>NewDecoder</code></a>
-provide streaming conversions to and from hexadecimal,
-analogous to equivalent functions already in
-<a href="/pkg/encoding/base32/">encoding/base32</a>
-and
-<a href="/pkg/encoding/base64/">encoding/base64</a>.
-</p>
-
-<p>
-When the functions
-<a href="/pkg/encoding/hex/#Decode"><code>Decode</code></a>
-and
-<a href="/pkg/encoding/hex/#DecodeString"><code>DecodeString</code></a>
-encounter malformed input,
-they now return the number of bytes already converted
-along with the error.
-Previously they always returned a count of 0 with any error.
-</p>
-</dl>
-
-<dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
-<dd>
-<p>
-The <a href="/pkg/encoding/json/#Decoder"><code>Decoder</code></a>
-adds a new method
-<a href="/pkg/encoding/json/#Decoder.DisallowUnknownFields"><code>DisallowUnknownFields</code></a>
-that causes it to report inputs with unknown JSON fields as a decoding error.
-(The default behavior has always been to discard unknown fields.)
-</p>
-
-<p>
-As a result of <a href="#reflect">fixing a reflect bug</a>,
-<a href="/pkg/encoding/json/#Unmarshal"><code>Unmarshal</code></a>
-can no longer decode into fields inside
-embedded pointers to unexported struct types,
-because it cannot initialize the unexported embedded pointer
-to point at fresh storage.
-<code>Unmarshal</code> now returns an error in this case.
-</p>
-</dl>
-
-<dl id="encoding/pem"><dt><a href="/pkg/encoding/pem/">encoding/pem</a></dt>
-<dd>
-<p>
-<a href="/pkg/encoding/pem/#Encode"><code>Encode</code></a>
-and
-<a href="/pkg/encoding/pem/#EncodeToMemory"><code>EncodeToMemory</code></a>
-no longer generate partial output when presented with a
-block that is impossible to encode as PEM data.
-</p>
-</dl>
-
-<dl id="encoding/xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt>
-<dd>
-<p>
-The new function
-<a href="/pkg/encoding/xml/#NewTokenDecoder"><code>NewTokenDecoder</code></a>
-is like
-<a href="/pkg/encoding/xml/#NewDecoder"><code>NewDecoder</code></a>
-but creates a decoder reading from a <a href="/pkg/encoding/xml/#TokenReader"><code>TokenReader</code></a>
-instead of an XML-formatted byte stream.
-This is meant to enable the construction of XML stream transformers in client libraries.
-</p>
-</dl>
-
-<dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
-<dd>
-<p>
-The default
-<a href="/pkg/flag/#Usage"><code>Usage</code></a> function now prints
-its first line of output to
-<code>CommandLine.Output()</code>
-instead of assuming <code>os.Stderr</code>,
-so that the usage message is properly redirected for
-clients using <code>CommandLine.SetOutput</code>.
-</p>
-<p>
-<a href="/pkg/flag/#PrintDefaults"><code>PrintDefaults</code></a> now
-adds appropriate indentation after newlines in flag usage strings,
-so that multi-line usage strings display nicely.
-</p>
-<p>
-<a href="/pkg/flag/#FlagSet"><code>FlagSet</code></a> adds new methods
-<a href="/pkg/flag/#FlagSet.ErrorHandling"><code>ErrorHandling</code></a>,
-<a href="/pkg/flag/#FlagSet.Name"><code>Name</code></a>,
-and
-<a href="/pkg/flag/#FlagSet.Output"><code>Output</code></a>,
-to retrieve the settings passed to
-<a href="/pkg/flag/#NewFlagSet"><code>NewFlagSet</code></a>
-and
-<a href="/pkg/flag/#FlagSet.SetOutput"><code>FlagSet.SetOutput</code></a>.
-</p>
-</dl>
-
-<dl id="go/doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
-<dd>
-<p>
-To support the <a href="#doc">doc change</a> described above,
-functions returning slices of <code>T</code>, <code>*T</code>, <code>**T</code>, and so on
-are now reported in <code>T</code>'s <a href="/pkg/go/doc/#Type"><code>Type</code></a>'s <code>Funcs</code> list,
-instead of in the <a href="/pkg/go/doc/#Package"><code>Package</code></a>'s <code>Funcs</code> list.
-</p>
-</dl>
-
-<dl id="go/importer"><dt><a href="/pkg/go/importer/">go/importer</a></dt>
-<dd>
-<p>
-The <a href="/pkg/go/importer/#For"><code>For</code></a> function now accepts a non-nil lookup argument.
-</p>
-</dl>
-
-<dl id="go/printer"><dt><a href="/pkg/go/printer/">go/printer</a></dt>
-<dd>
-<p>
-The changes to the default formatting of Go source code
-discussed in the <a href="#gofmt">gofmt section</a> above
-are implemented in the <a href="/pkg/go/printer/">go/printer</a> package
-and also affect the output of the higher-level <a href="/pkg/go/format/">go/format</a> package.
-</p>
-</dl>
-
-<dl id="hash"><dt><a href="/pkg/hash/">hash</a></dt>
-<dd>
-<p>
-Implementations of the <a href="/pkg/hash/#Hash"><code>Hash</code></a> interface are now
-encouraged to implement <a href="/pkg/encoding/#BinaryMarshaler"><code>encoding.BinaryMarshaler</code></a>
-and <a href="/pkg/encoding/#BinaryUnmarshaler"><code>encoding.BinaryUnmarshaler</code></a>
-to allow saving and recreating their internal state,
-and all implementations in the standard library
-(<a href="/pkg/hash/crc32/">hash/crc32</a>, <a href="/pkg/crypto/sha256/">crypto/sha256</a>, and so on)
-now implement those interfaces.
-</p>
-</dl>
-
-<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
-<dd>
-<p>
-The new <a href="/pkg/html/template#Srcset"><code>Srcset</code></a> content
-type allows for proper handling of values within the
-<a href="https://w3c.github.io/html/semantics-embedded-content.html#element-attrdef-img-srcset"><code>srcset</code></a>
-attribute of <code>img</code> tags.
-</p>
-</dl>
-
-<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
-<dd>
-<p>
-<a href="/pkg/math/big/#Int"><code>Int</code></a> now supports conversions to and from bases 2 through 62
-in its <a href="/pkg/math/big/#Int.SetString"><code>SetString</code></a> and <a href="/pkg/math/big/#Text"><code>Text</code></a> methods.
-(Previously it only allowed bases 2 through 36.)
-The value of the constant <code>MaxBase</code> has been updated.
-</p>
-<p>
-<a href="/pkg/math/big/#Int"><code>Int</code></a> adds a new
-<a href="/pkg/math/big/#CmpAbs"><code>CmpAbs</code></a> method
-that is like <a href="/pkg/math/big/#Cmp"><code>Cmp</code></a> but
-compares only the absolute values (not the signs) of its arguments.
-</p>
-<p>
-<a href="/pkg/math/big/#Float"><code>Float</code></a> adds a new
-<a href="/pkg/math/big/#Float.Sqrt"><code>Sqrt</code></a> method to
-compute square roots.
-</p>
-</dl>
-
-<dl id="math/cmplx"><dt><a href="/pkg/math/cmplx/">math/cmplx</a></dt>
-<dd>
-<p>
-Branch cuts and other boundary cases in
-<a href="/pkg/math/cmplx/#Asin"><code>Asin</code></a>,
-<a href="/pkg/math/cmplx/#Asinh"><code>Asinh</code></a>,
-<a href="/pkg/math/cmplx/#Atan"><code>Atan</code></a>,
-and
-<a href="/pkg/math/cmplx/#Sqrt"><code>Sqrt</code></a>
-have been corrected to match the definitions used in the C99 standard.
-</p>
-</dl>
-
-<dl id="math/rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt>
-<dd>
-<p>
-The new <a href="/pkg/math/rand/#Shuffle"><code>Shuffle</code></a> function and corresponding
-<a href="/pkg/math/rand/#Rand.Shuffle"><code>Rand.Shuffle</code></a> method
-shuffle an input sequence.
-</p>
-</dl>
-
-<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
-<dd>
-<p>
-The new functions
-<a href="/pkg/math/#Round"><code>Round</code></a>
-and
-<a href="/pkg/math/#RoundToEven"><code>RoundToEven</code></a>
-round their arguments to the nearest floating-point integer;
-<code>Round</code> rounds a half-integer to its larger integer neighbor (away from zero)
-while <code>RoundToEven</code> rounds a half-integer to its even integer neighbor.
-</p>
-
-<p>
-The new functions
-<a href="/pkg/math/#Erfinv"><code>Erfinv</code></a>
-and
-<a href="/pkg/math/#Erfcinv"><code>Erfcinv</code></a>
-compute the inverse error function and the
-inverse complementary error function.
-</p>
-</dl>
-
-<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
-<dd>
-<p>
-<a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a>
-now accepts parts with empty filename attributes.
-</p>
-</dl>
-
-<dl id="mime"><dt><a href="/pkg/mime/">mime</a></dt>
-<dd>
-<p>
-<a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a> now discards
-invalid attribute values; previously it returned those values as empty strings.
-</p>
-</dl>
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
-<dd>
-<p>
-The <a href="/pkg/net/#Conn"><code>Conn</code></a> and
-<a href="/pkg/net/#Conn"><code>Listener</code></a> implementations
-in this package now guarantee that when <code>Close</code> returns,
-the underlying file descriptor has been closed.
-(In earlier releases, if the <code>Close</code> stopped pending I/O
-in other goroutines, the closing of the file descriptor could happen in one of those
-goroutines shortly after <code>Close</code> returned.)
-</p>
-
-<p>
-<a href="/pkg/net/#TCPListener"><code>TCPListener</code></a> and
-<a href="/pkg/net/#UnixListener"><code>UnixListener</code></a>
-now implement
-<a href="/pkg/syscall/#Conn"><code>syscall.Conn</code></a>,
-to allow setting options on the underlying file descriptor
-using <a href="/pkg/syscall/#RawConn"><code>syscall.RawConn.Control</code></a>.
-</p>
-
-<p>
-The <code>Conn</code> implementations returned by <a href="/pkg/net/#Pipe"><code>Pipe</code></a>
-now support setting read and write deadlines.
-</p>
-
-<p>
-The <a href="/pkg/net/#IPConn.ReadMsgIP"><code>IPConn.ReadMsgIP</code></a>,
-<a href="/pkg/net/#IPConn.WriteMsgIP"><code>IPConn.WriteMsgIP</code></a>,
-<a href="/pkg/net/#UDPConn.ReadMsgUDP"><code>UDPConn.ReadMsgUDP</code></a>,
-and
-<a href="/pkg/net/#UDPConn.WriteMsgUDP"><code>UDPConn.WriteMsgUDP</code></a>,
-methods are now implemented on Windows.
-</p>
-</dl>
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
-<dd>
-<p>
-On the client side, an HTTP proxy (most commonly configured by
-<a href="/pkg/net/http/#ProxyFromEnvironment"><code>ProxyFromEnvironment</code></a>)
-can now be specified as an <code>https://</code> URL,
-meaning that the client connects to the proxy over HTTPS before issuing a standard, proxied HTTP request.
-(Previously, HTTP proxy URLs were required to begin with <code>http://</code> or <code>socks5://</code>.)
-</p>
-<p>
-On the server side, <a href="/pkg/net/http/#FileServer"><code>FileServer</code></a> and its single-file equivalent <a href="/pkg/net/http/#ServeFile"><code>ServeFile</code></a>
-now apply <code>If-Range</code> checks to <code>HEAD</code> requests.
-<code>FileServer</code> also now reports directory read failures to the <a href="/pkg/net/http/#Server"><code>Server</code></a>'s <code>ErrorLog</code>.
-The content-serving handlers also now omit the <code>Content-Type</code> header when serving zero-length content.
-</p>
-<p>
-<a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>'s <code>WriteHeader</code> method now panics
-if passed an invalid (non-3-digit) status code.
-</p>
-<p>
-<!-- CL 46631 -->
-The <code>Server</code> will no longer add an implicit Content-Type when a <code>Handler</code> does not write any output.
-</p>
-<p>
-<a href="/pkg/net/http/#Redirect"><code>Redirect</code></a> now sets the <code>Content-Type</code> header before writing its HTTP response.
-</p>
-</dl>
-
-<dl id="net/mail"><dt><a href="/pkg/net/mail/">net/mail</a></dt>
-<dd>
-<p>
-<a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a> and
-<a href="/pkg/net/mail/#ParseAddressList"><code>ParseAddressList</code></a>
-now support a variety of obsolete address formats.
-</p>
-</dl>
-
-<dl id="net/smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt>
-<dd>
-<p>
-The <a href="/pkg/net/smtp/#Client"><code>Client</code></a> adds a new
-<a href="/pkg/net/smtp/#Client.Noop"><code>Noop</code></a> method,
-to test whether the server is still responding.
-It also now defends against possible SMTP injection in the inputs
-to the <a href="/pkg/net/smtp/#Client.Hello"><code>Hello</code></a>
-and <a href="/pkg/net/smtp/#Client.Verify"><code>Verify</code></a> methods.
-</p>
-</dl>
-
-<dl id="net/textproto"><dt><a href="/pkg/net/textproto/">net/textproto</a></dt>
-<dd>
-<p>
-<a href="/pkg/net/textproto/#ReadMIMEHeader"><code>ReadMIMEHeader</code></a>
-now rejects any header that begins with a continuation (indented) header line.
-Previously a header with an indented first line was treated as if the first line
-were not indented.
-</p>
-</dl>
-
-<dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt>
-<dd>
-<p>
-<a href="/pkg/net/url/#ResolveReference"><code>ResolveReference</code></a>
-now preserves multiple leading slashes in the target URL.
-Previously it rewrote multiple leading slashes to a single slash,
-which resulted in the <a href="/pkg/net/http/#Client"><code>http.Client</code></a>
-following certain redirects incorrectly.
-</p>
-<p>
-For example, this code's output has changed:
-</p>
-<pre>
-base, _ := url.Parse("http://host//path//to/page1")
-target, _ := url.Parse("page2")
-fmt.Println(base.ResolveReference(target))
-</pre>
-<p>
-Note the doubled slashes around <code>path</code>.
-In Go 1.9 and earlier, the resolved URL was <code>http://host/path//to/page2</code>:
-the doubled slash before <code>path</code> was incorrectly rewritten
-to a single slash, while the doubled slash after <code>path</code> was
-correctly preserved.
-Go 1.10 preserves both doubled slashes, resolving to <code>http://host//path//to/page2</code>
-as required by <a href="https://tools.ietf.org/html/rfc3986#section-5.2">RFC 3986</a>.
-</p>
-
-<p>This change may break existing buggy programs that unintentionally
-construct a base URL with a leading doubled slash in the path and inadvertently
-depend on <code>ResolveReference</code> to correct that mistake.
-For example, this can happen if code adds a host prefix
-like <code>http://host/</code> to a path like <code>/my/api</code>,
-resulting in a URL with a doubled slash: <code>http://host//my/api</code>.
-</p>
-
-<p>
-<a href="/pkg/net/url/#UserInfo"><code>UserInfo</code></a>'s methods
-now treat a nil receiver as equivalent to a pointer to a zero <code>UserInfo</code>.
-Previously, they panicked.
-</p>
-</dl>
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
-<dd>
-<p>
-<a href="/pkg/os/#File"><code>File</code></a> adds new methods
-<a href="/pkg/os/#File.SetDeadline"><code>SetDeadline</code></a>,
-<a href="/pkg/os/#File.SetReadDeadline"><code>SetReadDeadline</code></a>,
-and
-<a href="/pkg/os/#File.SetWriteDeadline"><code>SetWriteDeadline</code></a>
-that allow setting I/O deadlines when the
-underlying file descriptor supports non-blocking I/O operations.
-The definition of these methods matches those in <a href="/pkg/net/#Conn"><code>net.Conn</code></a>.
-If an I/O method fails due to missing a deadline, it will return a
-timeout error; the
-new <a href="/pkg/os/#IsTimeout"><code>IsTimeout</code></a> function
-reports whether an error represents a timeout.
-</p>
-
-<p>
-Also matching <code>net.Conn</code>,
-<code>File</code>'s
-<a href="/pkg/os/#File.Close"><code>Close</code></a> method
-now guarantee that when <code>Close</code> returns,
-the underlying file descriptor has been closed.
-(In earlier releases,
-if the <code>Close</code> stopped pending I/O
-in other goroutines, the closing of the file descriptor could happen in one of those
-goroutines shortly after <code>Close</code> returned.)
-</p>
-
-<p>
-On BSD, macOS, and Solaris systems,
-<a href="/pkg/os/#Chtimes"><code>Chtimes</code></a>
-now supports setting file times with nanosecond precision
-(assuming the underlying file system can represent them).
-</p>
-</dl>
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
-<dd>
-<p>
-The <a href="/pkg/reflect/#Copy"><code>Copy</code></a> function now allows copying
-from a string into a byte array or byte slice, to match the
-<a href="/pkg/builtin/#copy">built-in copy function</a>.
-</p>
-
-<p>
-In structs, embedded pointers to unexported struct types were
-previously incorrectly reported with an empty <code>PkgPath</code>
-in the corresponding <a href="/pkg/reflect/#StructField">StructField</a>,
-with the result that for those fields,
-and <a href="/pkg/reflect/#Value.CanSet"><code>Value.CanSet</code></a>
-incorrectly returned true and
-<a href="/pkg/reflect/#Value.Set"><code>Value.Set</code></a>
-incorrectly succeeded.
-The underlying metadata has been corrected;
-for those fields,
-<code>CanSet</code> now correctly returns false
-and <code>Set</code> now correctly panics.
-This may affect reflection-based unmarshalers
-that could previously unmarshal into such fields
-but no longer can.
-For example, see the <a href="#encoding/json"><code>encoding/json</code> notes</a>.
-</p>
-</dl>
-
-<dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt>
-<dd>
-<p>
-As <a href="#pprof">noted above</a>, the blocking and mutex profiles
-now include symbol information so that they can be viewed without needing
-the binary that generated them.
-</p>
-</dl>
-
-<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
-<dd>
-<p>
-<a href="/pkg/strconv/#ParseUint"><code>ParseUint</code></a> now returns
-the maximum magnitude integer of the appropriate size
-with any <code>ErrRange</code> error, as it was already documented to do.
-Previously it returned 0 with <code>ErrRange</code> errors.
-</p>
-</dl>
-
-<dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt>
-<dd>
-<p>
-A new type
-<a href="/pkg/strings/#Builder"><code>Builder</code></a> is a replacement for
-<a href="/pkg/bytes/#Buffer"><code>bytes.Buffer</code></a> for the use case of
-accumulating text into a <code>string</code> result.
-The <code>Builder</code>'s API is a restricted subset of <code>bytes.Buffer</code>'s
-that allows it to safely avoid making a duplicate copy of the data
-during the <a href="/pkg/strings/#Builder.String"><code>String</code></a> method.
-</p>
-</dl>
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
-<dd>
-<p>
-On Windows,
-the new <a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> field <code>Token</code>,
-of type <a href="/pkg/syscall/#Token"><code>Token</code></a> allows the creation of a process that
-runs as another user during <a href="/pkg/syscall/#StartProcess"><code>StartProcess</code></a>
-(and therefore also during <a href="/pkg/os/#StartProcess"><code>os.StartProcess</code></a> and
-<a href="/pkg/os/exec/#Cmd.Start"><code>exec.Cmd.Start</code></a>).
-The new function <a href="/pkg/syscall/#CreateProcessAsUser"><code>CreateProcessAsUser</code></a>
-gives access to the underlying system call.
-</p>
-
-<p>
-On BSD, macOS, and Solaris systems, <a href="/pkg/syscall/#UtimesNano"><code>UtimesNano</code></a>
-is now implemented.
-</p>
-</dl>
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
-<dd>
-<p>
-<a href="/pkg/time/#LoadLocation"><code>LoadLocation</code></a> now uses the directory
-or uncompressed zip file named by the <code>$ZONEINFO</code>
-environment variable before looking in the default system-specific list of
-known installation locations or in <code>$GOROOT/lib/time/zoneinfo.zip</code>.
-</p>
-<p>
-The new function <a href="/pkg/time/#LoadLocationFromTZData"><code>LoadLocationFromTZData</code></a>
-allows conversion of IANA time zone file data to a <a href="/pkg/time/#Location"><code>Location</code></a>.
-</p>
-</dl>
-
-<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
-<dd>
-<p>
-The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
-support throughout the system has been upgraded from Unicode 9.0 to
-<a href="http://www.unicode.org/versions/Unicode10.0.0/">Unicode 10.0</a>,
-which adds 8,518 new characters, including four new scripts, one new property,
-a Bitcoin currency symbol, and 56 new emoji.
-</p>
-</dl>
diff --git a/doc/go1.11.html b/doc/go1.11.html
deleted file mode 100644
index 483ecd872f..0000000000
--- a/doc/go1.11.html
+++ /dev/null
@@ -1,934 +0,0 @@
-<!--{
- "Title": "Go 1.11 Release Notes",
- "Path": "/doc/go1.11",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.11</h2>
-
-<p>
- The latest Go release, version 1.11, arrives six months after <a href="go1.10">Go 1.10</a>.
- Most of its changes are in the implementation of the toolchain, runtime, and libraries.
- As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
- We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- There are no changes to the language specification.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p> <!-- CL 94255, CL 115038, etc -->
- As <a href="go1.10#ports">announced in the Go 1.10 release notes</a>, Go 1.11 now requires
- OpenBSD 6.2 or later, macOS 10.10 Yosemite or later, or Windows 7 or later;
- support for previous versions of these operating systems has been removed.
-</p>
-
-<p> <!-- CL 121657 -->
- Go 1.11 supports the upcoming OpenBSD 6.4 release. Due to changes in
- the OpenBSD kernel, older versions of Go will not work on OpenBSD 6.4.
-</p>
-
-<p>
- There are <a href="https://golang.org/issue/25206">known issues</a> with NetBSD on i386 hardware.
-</p>
-
-<p><!-- CL 107935 -->
- The race detector is now supported on <code>linux/ppc64le</code>
- and, to a lesser extent, on <code>netbsd/amd64</code>. The NetBSD race detector support
- has <a href="https://golang.org/issue/26403">known issues</a>.
-</p>
-
-<p><!-- CL 109255 -->
- The memory sanitizer (<code>-msan</code>) is now supported on <code>linux/arm64</code>.
-</p>
-
-<p><!-- CL 93875 -->
- The build modes <code>c-shared</code> and <code>c-archive</code> are now supported on
- <code>freebsd/amd64</code>.
-</p>
-
-<p id="mips"><!-- CL 108475 -->
- On 64-bit MIPS systems, the new environment variable settings
- <code>GOMIPS64=hardfloat</code> (the default) and
- <code>GOMIPS64=softfloat</code> select whether to use
- hardware instructions or software emulation for floating-point computations.
- For 32-bit systems, the environment variable is still <code>GOMIPS</code>,
- as <a href="go1.10#mips">added in Go 1.10</a>.
-</p>
-
-<p><!-- CL 107475 -->
- On soft-float ARM systems (<code>GOARM=5</code>), Go now uses a more
- efficient software floating point interface. This is transparent to
- Go code, but ARM assembly that uses floating-point instructions not
- guarded on GOARM will break and must be ported to
- the <a href="https://golang.org/cl/107475">new interface</a>.
-</p>
-
-<p><!-- CL 94076 -->
- Go 1.11 on ARMv7 no longer requires a Linux kernel configured
- with <code>KUSER_HELPERS</code>. This setting is enabled in default
- kernel configurations, but is sometimes disabled in stripped-down
- configurations.
-</p>
-
-<h3 id="wasm">WebAssembly</h3>
-<p>
- Go 1.11 adds an experimental port to <a href="https://webassembly.org">WebAssembly</a>
- (<code>js/wasm</code>).
-</p>
-<p>
- Go programs currently compile to one WebAssembly module that
- includes the Go runtime for goroutine scheduling, garbage
- collection, maps, etc.
- As a result, the resulting size is at minimum around
- 2 MB, or 500 KB compressed. Go programs can call into JavaScript
- using the new experimental
- <a href="/pkg/syscall/js/"><code>syscall/js</code></a> package.
- Binary size and interop with other languages has not yet been a
- priority but may be addressed in future releases.
-</p>
-<p>
- As a result of the addition of the new <code>GOOS</code> value
- "<code>js</code>" and <code>GOARCH</code> value "<code>wasm</code>",
- Go files named <code>*_js.go</code> or <code>*_wasm.go</code> will
- now be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored by Go
- tools</a> except when those GOOS/GOARCH values are being used.
- If you have existing filenames matching those patterns, you will need to rename them.
-</p>
-<p>
- More information can be found on the
- <a href="https://golang.org/wiki/WebAssembly">WebAssembly wiki page</a>.
-</p>
-
-<h3 id="riscv">RISC-V GOARCH values reserved</h3>
-<p><!-- CL 106256 -->
- The main Go compiler does not yet support the RISC-V architecture <!-- is gonna change everything -->
- but we've reserved the <code>GOARCH</code> values
- "<code>riscv</code>" and "<code>riscv64</code>", as used by Gccgo,
- which does support RISC-V. This means that Go files
- named <code>*_riscv.go</code> will now also
- be <a href="/pkg/go/build/#hdr-Build_Constraints">ignored by Go
- tools</a> except when those GOOS/GOARCH values are being used.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="modules">Modules, package versioning, and dependency management</h3>
-<p>
- Go 1.11 adds preliminary support for a <a href="/cmd/go/#hdr-Modules__module_versions__and_more">new concept called “modules,”</a>
- an alternative to GOPATH with integrated support for versioning and
- package distribution.
- Using modules, developers are no longer confined to working inside GOPATH,
- version dependency information is explicit yet lightweight,
- and builds are more reliable and reproducible.
-</p>
-
-<p>
- Module support is considered experimental.
- Details are likely to change in response to feedback from Go 1.11 users,
- and we have more tools planned.
- Although the details of module support may change, projects that convert
- to modules using Go 1.11 will continue to work with Go 1.12 and later.
- If you encounter bugs using modules,
- please <a href="https://golang.org/issue/new">file issues</a>
- so we can fix them. For more information, see the
- <a href="/cmd/go#hdr-Modules__module_versions__and_more"><code>go</code> command documentation</a>.
-</p>
-
-<h3 id="importpath">Import path restriction</h3>
-
-<p>
- Because Go module support assigns special meaning to the
- <code>@</code> symbol in command line operations,
- the <code>go</code> command now disallows the use of
- import paths containing <code>@</code> symbols.
- Such import paths were never allowed by <code>go</code> <code>get</code>,
- so this restriction can only affect users building
- custom GOPATH trees by other means.
-</p>
-
-<h3 id="gopackages">Package loading</h3>
-
-<p>
- The new package
- <a href="https://godoc.org/golang.org/x/tools/go/packages"><code>golang.org/x/tools/go/packages</code></a>
- provides a simple API for locating and loading packages of Go source code.
- Although not yet part of the standard library, for many tasks it
- effectively replaces the <a href="/pkg/go/build"><code>go/build</code></a>
- package, whose API is unable to fully support modules.
- Because it runs an external query command such as
- <a href="/cmd/go/#hdr-List_packages"><code>go list</code></a>
- to obtain information about Go packages, it enables the construction of
- analysis tools that work equally well with alternative build systems
- such as <a href="https://bazel.build">Bazel</a>
- and <a href="https://buckbuild.com">Buck</a>.
-</p>
-
-<h3 id="gocache">Build cache requirement</h3>
-
-<p>
- Go 1.11 will be the last release to support setting the environment
- variable <code>GOCACHE=off</code> to disable the
- <a href="/cmd/go/#hdr-Build_and_test_caching">build cache</a>,
- introduced in Go 1.10.
- Starting in Go 1.12, the build cache will be required,
- as a step toward eliminating <code>$GOPATH/pkg</code>.
- The module and package loading support described above
- already require that the build cache be enabled.
- If you have disabled the build cache to avoid problems you encountered,
- please <a href="https://golang.org/issue/new">file an issue</a> to let us know about them.
-</p>
-
-<h3 id="compiler">Compiler toolchain</h3>
-
-<p><!-- CL 109918 -->
- More functions are now eligible for inlining by default, including
- functions that call <code>panic</code>.
-</p>
-
-<p><!-- CL 97375 -->
- The compiler toolchain now supports column information
- in <a href="/cmd/compile/#hdr-Compiler_Directives">line
- directives</a>.
-</p>
-
-<p><!-- CL 106797 -->
- A new package export data format has been introduced.
- This should be transparent to end users, except for speeding up
- build times for large Go projects.
- If it does cause problems, it can be turned off again by
- passing <code>-gcflags=all=-iexport=false</code> to
- the <code>go</code> tool when building a binary.
-</p>
-
-<p><!-- CL 100459 -->
- The compiler now rejects unused variables declared in a type switch
- guard, such as <code>x</code> in the following example:
-</p>
-<pre>
-func f(v interface{}) {
- switch x := v.(type) {
- }
-}
-</pre>
-<p>
- This was already rejected by both <code>gccgo</code>
- and <a href="/pkg/go/types/">go/types</a>.
-</p>
-
-<h3 id="assembler">Assembler</h3>
-
-<p><!-- CL 113315 -->
- The assembler for <code>amd64</code> now accepts AVX512 instructions.
-</p>
-
-<h3 id="debugging">Debugging</h3>
-
-<p><!-- CL 100738, CL 93664 -->
- The compiler now produces significantly more accurate debug
- information for optimized binaries, including variable location
- information, line numbers, and breakpoint locations.
-
- This should make it possible to debug binaries
- compiled <em>without</em> <code>-N</code>&nbsp;<code>-l</code>.
-
- There are still limitations to the quality of the debug information,
- some of which are fundamental, and some of which will continue to
- improve with future releases.
-</p>
-
-<p><!-- CL 118276 -->
- DWARF sections are now compressed by default because of the expanded
- and more accurate debug information produced by the compiler.
-
- This is transparent to most ELF tools (such as debuggers on Linux
- and *BSD) and is supported by the Delve debugger on all platforms,
- but has limited support in the native tools on macOS and Windows.
-
- To disable DWARF compression,
- pass <code>-ldflags=-compressdwarf=false</code> to
- the <code>go</code> tool when building a binary.
-</p>
-
-<p><!-- CL 109699 -->
- Go 1.11 adds experimental support for calling Go functions from
- within a debugger.
-
- This is useful, for example, to call <code>String</code> methods
- when paused at a breakpoint.
-
- This is currently only supported by Delve (version 1.1.0 and up).
-</p>
-
-<h3 id="test">Test</h3>
-
-<p>
- Since Go 1.10, the <code>go</code>&nbsp;<code>test</code> command runs
- <code>go</code>&nbsp;<code>vet</code> on the package being tested,
- to identify problems before running the test. Since <code>vet</code>
- typechecks the code with <a href="/pkg/go/types/">go/types</a>
- before running, tests that do not typecheck will now fail.
-
- In particular, tests that contain an unused variable inside a
- closure compiled with Go 1.10, because the Go compiler incorrectly
- accepted them (<a href="https://golang.org/issues/3059">Issue #3059</a>),
- but will now fail, since <code>go/types</code> correctly reports an
- "unused variable" error in this case.
-</p>
-
-<p><!-- CL 102696 -->
- The <code>-memprofile</code> flag
- to <code>go</code>&nbsp;<code>test</code> now defaults to the
- "allocs" profile, which records the total bytes allocated since the
- test began (including garbage-collected bytes).
-</p>
-
-<h3 id="vet">Vet</h3>
-
-<p><!-- CL 108555 -->
- The <a href="/cmd/vet/"><code>go</code>&nbsp;<code>vet</code></a>
- command now reports a fatal error when the package under analysis
- does not typecheck. Previously, a type checking error simply caused
- a warning to be printed, and <code>vet</code> to exit with status 1.
-</p>
-
-<p><!-- CL 108559 -->
- Additionally, <a href="/cmd/vet"><code>go</code>&nbsp;<code>vet</code></a>
- has become more robust when format-checking <code>printf</code> wrappers.
- Vet now detects the mistake in this example:
-</p>
-
-<pre>
-func wrapper(s string, args ...interface{}) {
- fmt.Printf(s, args...)
-}
-
-func main() {
- wrapper("%s", 42)
-}
-</pre>
-
-<h3 id="trace">Trace</h3>
-
-<p><!-- CL 63274 -->
- With the new <code>runtime/trace</code>
- package's <a href="/pkg/runtime/trace/#hdr-User_annotation">user
- annotation API</a>, users can record application-level information
- in execution traces and create groups of related goroutines.
- The <code>go</code>&nbsp;<code>tool</code>&nbsp;<code>trace</code>
- command visualizes this information in the trace view and the new
- user task/region analysis page.
-</p>
-
-<h3 id="cgo">Cgo</h3>
-
-<p>
-Since Go 1.10, cgo has translated some C pointer types to the Go
-type <code>uintptr</code>. These types include
-the <code>CFTypeRef</code> hierarchy in Darwin's CoreFoundation
-framework and the <code>jobject</code> hierarchy in Java's JNI
-interface. In Go 1.11, several improvements have been made to the code
-that detects these types. Code that uses these types may need some
-updating. See the <a href="go1.10.html#cgo">Go 1.10 release notes</a> for
-details. <!-- CL 126275, CL 127156, CL 122217, CL 122575, CL 123177 -->
-</p>
-
-<h3 id="go_command">Go command</h3>
-
-<p><!-- CL 126656 -->
- The environment variable <code>GOFLAGS</code> may now be used
- to set default flags for the <code>go</code> command.
- This is useful in certain situations.
- Linking can be noticeably slower on underpowered systems due to DWARF,
- and users may want to set <code>-ldflags=-w</code> by default.
- For modules, some users and CI systems will want vendoring always,
- so they should set <code>-mod=vendor</code> by default.
- For more information, see the <a href="/cmd/go/#hdr-Environment_variables"><code>go</code>
- command documentation</a>.
-</p>
-
-<h3 id="godoc">Godoc</h3>
-
-<p>
- Go 1.11 will be the last release to support <code>godoc</code>'s command-line interface.
- In future releases, <code>godoc</code> will only be a web server. Users should use
- <code>go</code> <code>doc</code> for command-line help output instead.
-</p>
-
-<p><!-- CL 85396, CL 124495 -->
- The <code>godoc</code> web server now shows which version of Go introduced
- new API features. The initial Go version of types, funcs, and methods are shown
- right-aligned. For example, see <a href="/pkg/os/#UserCacheDir"><code>UserCacheDir</code></a>, with "1.11"
- on the right side. For struct fields, inline comments are added when the struct field was
- added in a Go version other than when the type itself was introduced.
- For a struct field example, see
- <a href="/pkg/net/http/httptrace/#ClientTrace.Got1xxResponse"><code>ClientTrace.Got1xxResponse</code></a>.
-</p>
-
-<h3 id="gofmt">Gofmt</h3>
-
-<p>
- One minor detail of the default formatting of Go source code has changed.
- When formatting expression lists with inline comments, the comments were
- aligned according to a heuristic.
- However, in some cases the alignment would be split up too easily, or
- introduce too much whitespace.
- The heuristic has been changed to behave better for human-written code.
-</p>
-
-<p>
- Note that these kinds of minor updates to gofmt are expected from time to
- time.
- In general, systems that need consistent formatting of Go source code should
- use a specific version of the <code>gofmt</code> binary.
- See the <a href="/pkg/go/format/">go/format</a> package documentation for more
- information.
-</p>
-
-<h3 id="run">Run</h3>
-
-<p>
- <!-- CL 109341 -->
- The <a href="/cmd/go/"><code>go</code>&nbsp;<code>run</code></a>
- command now allows a single import path, a directory name or a
- pattern matching a single package.
- This allows <code>go</code>&nbsp;<code>run</code>&nbsp;<code>pkg</code> or <code>go</code>&nbsp;<code>run</code>&nbsp;<code>dir</code>, most importantly <code>go</code>&nbsp;<code>run</code>&nbsp;<code>.</code>
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p><!-- CL 85887 -->
- The runtime now uses a sparse heap layout so there is no longer a
- limit to the size of the Go heap (previously, the limit was 512GiB).
- This also fixes rare "address space conflict" failures in mixed Go/C
- binaries or binaries compiled with <code>-race</code>.
-</p>
-
-<p><!-- CL 108679, CL 106156 -->
- On macOS and iOS, the runtime now uses <code>libSystem.dylib</code> instead of
- calling the kernel directly. This should make Go binaries more
- compatible with future versions of macOS and iOS.
- The <a href="/pkg/syscall">syscall</a> package still makes direct
- system calls; fixing this is planned for a future release.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-As always, the changes are so general and varied that precise
-statements about performance are difficult to make. Most programs
-should run a bit faster, due to better generated code and
-optimizations in the core library.
-</p>
-
-<p><!-- CL 74851 -->
-There were multiple performance changes to the <code>math/big</code>
-package as well as many changes across the tree specific to <code>GOARCH=arm64</code>.
-</p>
-
-<h3 id="performance-compiler">Compiler toolchain</h3>
-
-<p><!-- CL 110055 -->
- The compiler now optimizes map clearing operations of the form:
-</p>
-<pre>
-for k := range m {
- delete(m, k)
-}
-</pre>
-
-<p><!-- CL 109517 -->
- The compiler now optimizes slice extension of the form
- <code>append(s,</code>&nbsp;<code>make([]T,</code>&nbsp;<code>n)...)</code>.
-</p>
-
-<p><!-- CL 100277, CL 105635, CL 109776 -->
- The compiler now performs significantly more aggressive bounds-check
- and branch elimination. Notably, it now recognizes transitive
- relations, so if <code>i&lt;j</code> and <code>j&lt;len(s)</code>,
- it can use these facts to eliminate the bounds check
- for <code>s[i]</code>. It also understands simple arithmetic such
- as <code>s[i-10]</code> and can recognize more inductive cases in
- loops. Furthermore, the compiler now uses bounds information to more
- aggressively optimize shift operations.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<p>
- All of the changes to the standard library are minor.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<!-- CL 115095: https://golang.org/cl/115095: yes (`go test pkg` now always builds pkg even if there are no test files): cmd/go: output coverage report even if there are no test files -->
-<!-- CL 110395: https://golang.org/cl/110395: cmd/go, cmd/compile: use Windows response files to avoid arg length limits -->
-<!-- CL 112436: https://golang.org/cl/112436: cmd/pprof: add readline support similar to upstream -->
-
-
-<dl id="crypto"><dt><a href="/pkg/crypto/">crypto</a></dt>
- <dd>
- <p><!-- CL 64451 -->
- Certain crypto operations, including
- <a href="/pkg/crypto/ecdsa/#Sign"><code>ecdsa.Sign</code></a>,
- <a href="/pkg/crypto/rsa/#EncryptPKCS1v15"><code>rsa.EncryptPKCS1v15</code></a> and
- <a href="/pkg/crypto/rsa/#GenerateKey"><code>rsa.GenerateKey</code></a>,
- now randomly read an extra byte of randomness to ensure tests don't rely on internal behavior.
- </p>
-
-</dl><!-- crypto -->
-
-<dl id="crypto/cipher"><dt><a href="/pkg/crypto/cipher/">crypto/cipher</a></dt>
- <dd>
- <p><!-- CL 48510, CL 116435 -->
- The new function <a href="/pkg/crypto/cipher/#NewGCMWithTagSize"><code>NewGCMWithTagSize</code></a>
- implements Galois Counter Mode with non-standard tag lengths for compatibility with existing cryptosystems.
- </p>
-
-</dl><!-- crypto/cipher -->
-
-<dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
- <dd>
- <p><!-- CL 103876 -->
- <a href="/pkg/crypto/rsa/#PublicKey"><code>PublicKey</code></a> now implements a
- <a href="/pkg/crypto/rsa/#PublicKey.Size"><code>Size</code></a> method that
- returns the modulus size in bytes.
- </p>
-
-</dl><!-- crypto/rsa -->
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p><!-- CL 85115 -->
- <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>'s new
- <a href="/pkg/crypto/tls/#ConnectionState.ExportKeyingMaterial"><code>ExportKeyingMaterial</code></a>
- method allows exporting keying material bound to the
- connection according to RFC 5705.
- </p>
-
-</dl><!-- crypto/tls -->
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p><!-- CL 123355, CL 123695 -->
- The deprecated, legacy behavior of treating the <code>CommonName</code> field as
- a hostname when no Subject Alternative Names are present is now disabled when the CN is not a
- valid hostname.
- The <code>CommonName</code> can be completely ignored by adding the experimental value
- <code>x509ignoreCN=1</code> to the <code>GODEBUG</code> environment variable.
- When the CN is ignored, certificates without SANs validate under chains with name constraints
- instead of returning <code>NameConstraintsWithoutSANs</code>.
- </p>
-
- <p><!-- CL 113475 -->
- Extended key usage restrictions are again checked only if they appear in the <code>KeyUsages</code>
- field of <a href="/pkg/crypto/x509/#VerifyOptions"><code>VerifyOptions</code></a>, instead of always being checked.
- This matches the behavior of Go 1.9 and earlier.
- </p>
-
- <p><!-- CL 102699 -->
- The value returned by <a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a>
- is now cached and might not reflect system changes between invocations.
- </p>
-
-</dl><!-- crypto/x509 -->
-
-<dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
- <dd>
- <p><!-- CL 112115 -->
- More <a href="/pkg/debug/elf/#ELFOSABI_NONE"><code>ELFOSABI</code></a>
- and <a href="/pkg/debug/elf/#EM_NONE"><code>EM</code></a>
- constants have been added.
- </p>
-
-</dl><!-- debug/elf -->
-
-<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
- <dd>
- <p><!-- CL 110561 -->
- <code>Marshal</code> and <code><a href="/pkg/encoding/asn1/#Unmarshal">Unmarshal</a></code>
- now support "private" class annotations for fields.
- </p>
-
-</dl><!-- encoding/asn1 -->
-
-<dl id="encoding/base32"><dt><a href="/pkg/encoding/base32/">encoding/base32</a></dt>
- <dd>
- <p><!-- CL 112516 -->
- The decoder now consistently
- returns <code>io.ErrUnexpectedEOF</code> for an incomplete
- chunk. Previously it would return <code>io.EOF</code> in some
- cases.
- </p>
-
-</dl><!-- encoding/base32 -->
-
-<dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt>
- <dd>
- <p><!-- CL 99696 -->
- The <code>Reader</code> now rejects attempts to set
- the <a href="/pkg/encoding/csv/#Reader.Comma"><code>Comma</code></a>
- field to a double-quote character, as double-quote characters
- already have a special meaning in CSV.
- </p>
-
-</dl><!-- encoding/csv -->
-
-<!-- CL 100235 was reverted -->
-
-<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
- <dd>
- <p><!-- CL 121815 -->
- The package has changed its behavior when a typed interface
- value is passed to an implicit escaper function. Previously such
- a value was written out as (an escaped form)
- of <code>&lt;nil&gt;</code>. Now such values are ignored, just
- as an untyped <code>nil</code> value is (and always has been)
- ignored.
- </p>
-
-</dl><!-- html/template -->
-
-<dl id="image/gif"><dt><a href="/pkg/image/gif/">image/gif</a></dt>
- <dd>
- <p><!-- CL 93076 -->
- Non-looping animated GIFs are now supported. They are denoted by having a
- <code><a href="/pkg/image/gif/#GIF.LoopCount">LoopCount</a></code> of -1.
- </p>
-
-</dl><!-- image/gif -->
-
-<dl id="io/ioutil"><dt><a href="/pkg/io/ioutil/">io/ioutil</a></dt>
- <dd>
- <p><!-- CL 105675 -->
- The <code><a href="/pkg/io/ioutil/#TempFile">TempFile</a></code>
- function now supports specifying where the random characters in
- the filename are placed. If the <code>prefix</code> argument
- includes a "<code>*</code>", the random string replaces the
- "<code>*</code>". For example, a <code>prefix</code> argument of "<code>myname.*.bat</code>" will
- result in a random filename such as
- "<code>myname.123456.bat</code>". If no "<code>*</code>" is
- included the old behavior is retained, and the random digits are
- appended to the end.
- </p>
-
-</dl><!-- io/ioutil -->
-
-<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
- <dd>
-
- <p><!-- CL 108996 -->
- <a href="/pkg/math/big/#Int.ModInverse"><code>ModInverse</code></a> now returns nil when g and n are not relatively prime. The result was previously undefined.
- </p>
-
-</dl><!-- math/big -->
-
-<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
- <dd>
- <p><!-- CL 121055 -->
- The handling of form-data with missing/empty file names has been
- restored to the behavior in Go 1.9: in the
- <a href="/pkg/mime/multipart/#Form"><code>Form</code></a> for
- the form-data part the value is available in
- the <code>Value</code> field rather than the <code>File</code>
- field. In Go releases 1.10 through 1.10.3 a form-data part with
- a missing/empty file name and a non-empty "Content-Type" field
- was stored in the <code>File</code> field. This change was a
- mistake in 1.10 and has been reverted to the 1.9 behavior.
- </p>
-
-</dl><!-- mime/multipart -->
-
-<dl id="mime/quotedprintable"><dt><a href="/pkg/mime/quotedprintable/">mime/quotedprintable</a></dt>
- <dd>
- <p><!-- CL 121095 -->
- To support invalid input found in the wild, the package now
- permits non-ASCII bytes but does not validate their encoding.
- </p>
-
-</dl><!-- mime/quotedprintable -->
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
- <p><!-- CL 72810 -->
- The new <a href="/pkg/net/#ListenConfig"><code>ListenConfig</code></a> type and the new
- <a href="/pkg/net/#Dialer.Control"><code>Dialer.Control</code></a> field permit
- setting socket options before accepting and creating connections, respectively.
- </p>
-
- <p><!-- CL 76391 -->
- The <a href="/pkg/syscall/#RawConn"><code>syscall.RawConn</code></a> <code>Read</code>
- and <code>Write</code> methods now work correctly on Windows.
- </p>
-
- <p><!-- CL 107715 -->
- The <code>net</code> package now automatically uses the
- <a href="http://man7.org/linux/man-pages/man2/splice.2.html"><code>splice</code> system call</a>
- on Linux when copying data between TCP connections in
- <a href="/pkg/net/#TCPConn.ReadFrom"><code>TCPConn.ReadFrom</code></a>, as called by
- <a href="/pkg/io/#Copy"><code>io.Copy</code></a>. The result is faster, more efficient TCP proxying.
- </p>
-
- <p><!-- CL 108297 -->
- The <a href="/pkg/net/#TCPConn.File"><code>TCPConn.File</code></a>,
- <a href="/pkg/net/#UDPConn.File"><code>UDPConn.File</code></a>,
- <a href="/pkg/net/#UnixCOnn.File"><code>UnixConn.File</code></a>,
- and <a href="/pkg/net/#IPConn.File"><code>IPConn.File</code></a>
- methods no longer put the returned <code>*os.File</code> into
- blocking mode.
- </p>
-
-</dl><!-- net -->
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
- <p><!-- CL 71272 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> type has a
- new <a href="/pkg/net/http/#Transport.MaxConnsPerHost"><code>MaxConnsPerHost</code></a>
- option that permits limiting the maximum number of connections
- per host.
- </p>
-
- <p><!-- CL 79919 -->
- The <a href="/pkg/net/http/#Cookie"><code>Cookie</code></a> type has a new
- <a href="/pkg/net/http/#Cookie.SameSite"><code>SameSite</code></a> field
- (of new type also named
- <a href="/pkg/net/http/#SameSite"><code>SameSite</code></a>) to represent the new cookie attribute recently supported by most browsers.
- The <code>net/http</code>'s <code>Transport</code> does not use the <code>SameSite</code>
- attribute itself, but the package supports parsing and serializing the
- attribute for browsers to use.
- </p>
-
- <p><!-- CL 81778 -->
- It is no longer allowed to reuse a <a href="/pkg/net/http/#Server"><code>Server</code></a>
- after a call to
- <a href="/pkg/net/http/#Server.Shutdown"><code>Shutdown</code></a> or
- <a href="/pkg/net/http/#Server.Close"><code>Close</code></a>. It was never officially supported
- in the past and had often surprising behavior. Now, all future calls to the server's <code>Serve</code>
- methods will return errors after a shutdown or close.
- </p>
-
- <!-- CL 89275 was reverted before Go 1.11 -->
-
- <p><!-- CL 93296 -->
- The constant <code>StatusMisdirectedRequest</code> is now defined for HTTP status code 421.
- </p>
-
- <p><!-- CL 123875 -->
- The HTTP server will no longer cancel contexts or send on
- <a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a>
- channels upon receiving pipelined HTTP/1.1 requests. Browsers do
- not use HTTP pipelining, but some clients (such as
- Debian's <code>apt</code>) may be configured to do so.
- </p>
-
- <p><!-- CL 115255 -->
- <a href="/pkg/net/http/#ProxyFromEnvironment"><code>ProxyFromEnvironment</code></a>, which is used by the
- <a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport</code></a>, now
- supports CIDR notation and ports in the <code>NO_PROXY</code> environment variable.
- </p>
-
-</dl><!-- net/http -->
-
-<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
- <dd>
- <p><!-- CL 77410 -->
- The
- <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
- has a new
- <a href="/pkg/net/http/httputil/#ReverseProxy.ErrorHandler"><code>ErrorHandler</code></a>
- option to permit changing how errors are handled.
- </p>
-
- <p><!-- CL 115135 -->
- The <code>ReverseProxy</code> now also passes
- "<code>TE:</code>&nbsp;<code>trailers</code>" request headers
- through to the backend, as required by the gRPC protocol.
- </p>
-
-</dl><!-- net/http/httputil -->
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p><!-- CL 78835 -->
- The new <a href="/pkg/os/#UserCacheDir"><code>UserCacheDir</code></a> function
- returns the default root directory to use for user-specific cached data.
- </p>
-
- <p><!-- CL 94856 -->
- The new <a href="/pkg/os/#ModeIrregular"><code>ModeIrregular</code></a>
- is a <a href="/pkg/os/#FileMode"><code>FileMode</code></a> bit to represent
- that a file is not a regular file, but nothing else is known about it, or that
- it's not a socket, device, named pipe, symlink, or other file type for which
- Go has a defined mode bit.
- </p>
-
- <p><!-- CL 99337 -->
- <a href="/pkg/os/#Symlink"><code>Symlink</code></a> now works
- for unprivileged users on Windows 10 on machines with Developer
- Mode enabled.
- </p>
-
- <p><!-- CL 100077 -->
- When a non-blocking descriptor is passed
- to <a href="/pkg/os#NewFile"><code>NewFile</code></a>, the
- resulting <code>*File</code> will be kept in non-blocking
- mode. This means that I/O for that <code>*File</code> will use
- the runtime poller rather than a separate thread, and that
- the <a href="/pkg/os/#File.SetDeadline"><code>SetDeadline</code></a>
- methods will work.
- </p>
-
-</dl><!-- os -->
-
-<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
- <dd>
- <p><!-- CL 108376 -->
- The new <a href="/pkg/os/signal/#Ignored"><code>Ignored</code></a> function reports
- whether a signal is currently ignored.
- </p>
-
-</dl><!-- os/signal -->
-
-<dl id="os/user"><dt><a href="/pkg/os/user/">os/user</a></dt>
- <dd>
- <p><!-- CL 92456 -->
- The <code>os/user</code> package can now be built in pure Go
- mode using the build tag "<code>osusergo</code>",
- independent of the use of the environment
- variable <code>CGO_ENABLED=0</code>. Previously the only way to use
- the package's pure Go implementation was to disable <code>cgo</code>
- support across the entire program.
- </p>
-
-</dl><!-- os/user -->
-
-<!-- CL 101715 was reverted -->
-
-<dl id="pkg-runtime"><dt id="runtime-again"><a href="/pkg/runtime/">runtime</a></dt>
- <dd>
-
- <p><!-- CL 70993 -->
- Setting the <code>GODEBUG=tracebackancestors=<em>N</em></code>
- environment variable now extends tracebacks with the stacks at
- which goroutines were created, where <em>N</em> limits the
- number of ancestor goroutines to report.
- </p>
-
-</dl><!-- runtime -->
-
-<dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt>
- <dd>
- <p><!-- CL 102696 -->
- This release adds a new "allocs" profile type that profiles
- total number of bytes allocated since the program began
- (including garbage-collected bytes). This is identical to the
- existing "heap" profile viewed in <code>-alloc_space</code> mode.
- Now <code>go test -memprofile=...</code> reports an "allocs" profile
- instead of "heap" profile.
- </p>
-
-</dl><!-- runtime/pprof -->
-
-<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
- <dd>
- <p><!-- CL 87095 -->
- The mutex profile now includes reader/writer contention
- for <a href="/pkg/sync/#RWMutex"><code>RWMutex</code></a>.
- Writer/writer contention was already included in the mutex
- profile.
- </p>
-
-</dl><!-- sync -->
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p><!-- CL 106275 -->
- On Windows, several fields were changed from <code>uintptr</code> to a new
- <a href="/pkg/syscall/?GOOS=windows&GOARCH=amd64#Pointer"><code>Pointer</code></a>
- type to avoid problems with Go's garbage collector. The same change was made
- to the <a href="https://godoc.org/golang.org/x/sys/windows"><code>golang.org/x/sys/windows</code></a>
- package. For any code affected, users should first migrate away from the <code>syscall</code>
- package to the <code>golang.org/x/sys/windows</code> package, and then change
- to using the <code>Pointer</code>, while obeying the
- <a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code> conversion rules</a>.
- </p>
-
- <p><!-- CL 118658 -->
- On Linux, the <code>flags</code> parameter to
- <a href="/pkg/syscall/?GOOS=linux&GOARCH=amd64#Faccessat"><code>Faccessat</code></a>
- is now implemented just as in glibc. In earlier Go releases the
- flags parameter was ignored.
- </p>
-
- <p><!-- CL 118658 -->
- On Linux, the <code>flags</code> parameter to
- <a href="/pkg/syscall/?GOOS=linux&GOARCH=amd64#Fchmodat"><code>Fchmodat</code></a>
- is now validated. Linux's <code>fchmodat</code> doesn't support the <code>flags</code> parameter
- so we now mimic glibc's behavior and return an error if it's non-zero.
- </p>
-
-</dl><!-- syscall -->
-
-<dl id="text/scanner"><dt><a href="/pkg/text/scanner/">text/scanner</a></dt>
- <dd>
- <p><!-- CL 112037 -->
- The <a href="/pkg/text/scanner/#Scanner.Scan"><code>Scanner.Scan</code></a> method now returns
- the <a href="/pkg/text/scanner/#RawString"><code>RawString</code></a> token
- instead of <a href="/pkg/text/scanner/#String"><code>String</code></a>
- for raw string literals.
- </p>
-
-</dl><!-- text/scanner -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 84480 -->
- Modifying template variables via assignments is now permitted via the <code>=</code> token:
- </p>
- <pre>
- {{"{{"}} $v := "init" {{"}}"}}
- {{"{{"}} if true {{"}}"}}
- {{"{{"}} $v = "changed" {{"}}"}}
- {{"{{"}} end {{"}}"}}
- v: {{"{{"}} $v {{"}}"}} {{"{{"}}/* "changed" */{{"}}"}}</pre>
-
- <p><!-- CL 95215 -->
- In previous versions untyped <code>nil</code> values passed to
- template functions were ignored. They are now passed as normal
- arguments.
- </p>
-
-</dl><!-- text/template -->
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
- <dd>
- <p><!-- CL 98157 -->
- Parsing of timezones denoted by sign and offset is now
- supported. In previous versions, numeric timezone names
- (such as <code>+03</code>) were not considered valid, and only
- three-letter abbreviations (such as <code>MST</code>) were accepted
- when expecting a timezone name.
- </p>
-</dl><!-- time -->
diff --git a/doc/go1.12.html b/doc/go1.12.html
deleted file mode 100644
index a8b0c87fe5..0000000000
--- a/doc/go1.12.html
+++ /dev/null
@@ -1,949 +0,0 @@
-<!--{
- "Title": "Go 1.12 Release Notes",
- "Path": "/doc/go1.12",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.12</h2>
-
-<p>
- The latest Go release, version 1.12, arrives six months after <a href="go1.11">Go 1.11</a>.
- Most of its changes are in the implementation of the toolchain, runtime, and libraries.
- As always, the release maintains the Go 1 <a href="/doc/go1compat">promise of compatibility</a>.
- We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- There are no changes to the language specification.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p><!-- CL 138675 -->
- The race detector is now supported on <code>linux/arm64</code>.
-</p>
-
-<p id="freebsd">
- Go 1.12 is the last release that is supported on FreeBSD 10.x, which has
- already reached end-of-life. Go 1.13 will require FreeBSD 11.2+ or FreeBSD
- 12.0+.
- FreeBSD 12.0+ requires a kernel with the COMPAT_FREEBSD11 option set (this is the default).
-</p>
-
-<p><!-- CL 146898 -->
- cgo is now supported on <code>linux/ppc64</code>.
-</p>
-
-<p id="hurd"><!-- CL 146023 -->
- <code>hurd</code> is now a recognized value for <code>GOOS</code>, reserved
- for the GNU/Hurd system for use with <code>gccgo</code>.
-</p>
-
-<h3 id="windows">Windows</h3>
-
-<p>
- Go's new <code>windows/arm</code> port supports running Go on Windows 10
- IoT Core on 32-bit ARM chips such as the Raspberry Pi 3.
-</p>
-
-<h3 id="aix">AIX</h3>
-
-<p>
- Go now supports AIX 7.2 and later on POWER8 architectures (<code>aix/ppc64</code>). External linking, cgo, pprof and the race detector aren't yet supported.
-</p>
-
-<h3 id="darwin">Darwin</h3>
-
-<p>
- Go 1.12 is the last release that will run on macOS 10.10 Yosemite.
- Go 1.13 will require macOS 10.11 El Capitan or later.
-</p>
-
-<p><!-- CL 141639 -->
- <code>libSystem</code> is now used when making syscalls on Darwin,
- ensuring forward-compatibility with future versions of macOS and iOS.
- <!-- CL 153338 -->
- The switch to <code>libSystem</code> triggered additional App Store
- checks for private API usage. Since it is considered private,
- <code>syscall.Getdirentries</code> now always fails with
- <code>ENOSYS</code> on iOS.
- Additionally, <a href="/pkg/syscall/#Setrlimit"><code>syscall.Setrlimit</code></a>
- reports <code>invalid</code> <code>argument</code> in places where it historically
- succeeded. These consequences are not specific to Go and users should expect
- behavioral parity with <code>libSystem</code>'s implementation going forward.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="vet"><code>go tool vet</code> no longer supported</h3>
-
-<p>
- The <code>go vet</code> command has been rewritten to serve as the
- base for a range of different source code analysis tools. See
- the <a href="https://godoc.org/golang.org/x/tools/go/analysis">golang.org/x/tools/go/analysis</a>
- package for details. A side-effect is that <code>go tool vet</code>
- is no longer supported. External tools that use <code>go tool
- vet</code> must be changed to use <code>go
- vet</code>. Using <code>go vet</code> instead of <code>go tool
- vet</code> should work with all supported versions of Go.
-</p>
-
-<p>
- As part of this change, the experimental <code>-shadow</code> option
- is no longer available with <code>go vet</code>. Checking for
- variable shadowing may now be done using
-<pre>
-go get -u golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow
-go vet -vettool=$(which shadow)
-</pre>
-</p>
-
-<h3 id="tour">Tour</h3>
-
-<p> <!-- CL 152657 -->
-The Go tour is no longer included in the main binary distribution. To
-run the tour locally, instead of running <code>go</code> <code>tool</code> <code>tour</code>,
-manually install it:
-<pre>
-go get -u golang.org/x/tour
-tour
-</pre>
-</p>
-
-<h3 id="gocache">Build cache requirement</h3>
-
-<p>
- The <a href="/cmd/go/#hdr-Build_and_test_caching">build cache</a> is now
- required as a step toward eliminating
- <code>$GOPATH/pkg</code>. Setting the environment variable
- <code>GOCACHE=off</code> will cause <code>go</code> commands that write to the
- cache to fail.
-</p>
-
-<h3 id="binary-only">Binary-only packages</h3>
-
-<p>
- Go 1.12 is the last release that will support binary-only packages.
-</p>
-
-<h3 id="cgo">Cgo</h3>
-
-<p>
- Go 1.12 will translate the C type <code>EGLDisplay</code> to the Go type <code>uintptr</code>.
- This change is similar to how Go 1.10 and newer treats Darwin's CoreFoundation
- and Java's JNI types. See the
- <a href="/cmd/cgo/#hdr-Special_cases">cgo documentation</a>
- for more information.
-</p>
-
-<p><!-- CL 152657 -->
- Mangled C names are no longer accepted in packages that use Cgo. Use the Cgo
- names instead. For example, use the documented cgo name <code>C.char</code>
- rather than the mangled name <code>_Ctype_char</code> that cgo generates.
-</p>
-
-<h3 id="modules">Modules</h3>
-
-<p><!-- CL 148517 -->
- When <code>GO111MODULE</code> is set to <code>on</code>, the <code>go</code>
- command now supports module-aware operations outside of a module directory,
- provided that those operations do not need to resolve import paths relative to
- the current directory or explicitly edit the <code>go.mod</code> file.
- Commands such as <code>go</code> <code>get</code>,
- <code>go</code> <code>list</code>, and
- <code>go</code> <code>mod</code> <code>download</code> behave as if in a
- module with initially-empty requirements.
- In this mode, <code>go</code> <code>env</code> <code>GOMOD</code> reports
- the system's null device (<code>/dev/null</code> or <code>NUL</code>).
-</p>
-
-<p><!-- CL 146382 -->
- <code>go</code> commands that download and extract modules are now safe to
- invoke concurrently.
- The module cache (<code>GOPATH/pkg/mod</code>) must reside in a filesystem that
- supports file locking.
-</p>
-
-<p><!-- CL 147282, 147281 -->
- The <code>go</code> directive in a <code>go.mod</code> file now indicates the
- version of the language used by the files within that module.
- It will be set to the current release
- (<code>go</code> <code>1.12</code>) if no existing version is
- present.
- If the <code>go</code> directive for a module specifies a
- version <em>newer</em> than the toolchain in use, the <code>go</code> command
- will attempt to build the packages regardless, and will note the mismatch only if
- that build fails.
-</p>
-
-<p><!-- CL 147282, 147281 -->
- This changed use of the <code>go</code> directive means that if you
- use Go 1.12 to build a module, thus recording <code>go 1.12</code>
- in the <code>go.mod</code> file, you will get an error when
- attempting to build the same module with Go 1.11 through Go 1.11.3.
- Go 1.11.4 or later will work fine, as will releases older than Go 1.11.
- If you must use Go 1.11 through 1.11.3, you can avoid the problem by
- setting the language version to 1.11, using the Go 1.12 go tool,
- via <code>go mod edit -go=1.11</code>.
-</p>
-
-<p><!-- CL 152739 -->
- When an import cannot be resolved using the active modules,
- the <code>go</code> command will now try to use the modules mentioned in the
- main module's <code>replace</code> directives before consulting the module
- cache and the usual network sources.
- If a matching replacement is found but the <code>replace</code> directive does
- not specify a version, the <code>go</code> command uses a pseudo-version
- derived from the zero <code>time.Time</code> (such
- as <code>v0.0.0-00010101000000-000000000000</code>).
-</p>
-
-<h3 id="compiler">Compiler toolchain</h3>
-
-<p><!-- CL 134155, 134156 -->
- The compiler's live variable analysis has improved. This may mean that
- finalizers will be executed sooner in this release than in previous
- releases. If that is a problem, consider the appropriate addition of a
- <a href="/pkg/runtime/#KeepAlive"><code>runtime.KeepAlive</code></a> call.
-</p>
-
-<p><!-- CL 147361 -->
- More functions are now eligible for inlining by default, including
- functions that do nothing but call another function.
- This extra inlining makes it additionally important to use
- <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
- instead of iterating over the result of
- <a href="/pkg/runtime/#Callers"><code>runtime.Callers</code></a> directly.
-<pre>
-// Old code which no longer works correctly (it will miss inlined call frames).
-var pcs [10]uintptr
-n := runtime.Callers(1, pcs[:])
-for _, pc := range pcs[:n] {
- f := runtime.FuncForPC(pc)
- if f != nil {
- fmt.Println(f.Name())
- }
-}
-</pre>
-<pre>
-// New code which will work correctly.
-var pcs [10]uintptr
-n := runtime.Callers(1, pcs[:])
-frames := runtime.CallersFrames(pcs[:n])
-for {
- frame, more := frames.Next()
- fmt.Println(frame.Function)
- if !more {
- break
- }
-}
-</pre>
-</p>
-
-<p><!-- CL 153477 -->
- Wrappers generated by the compiler to implement method expressions
- are no longer reported
- by <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
- and <a href="/pkg/runtime/#Stack"><code>runtime.Stack</code></a>. They
- are also not printed in panic stack traces.
-
- This change aligns the <code>gc</code> toolchain to match
- the <code>gccgo</code> toolchain, which already elided such wrappers
- from stack traces.
-
- Clients of these APIs might need to adjust for the missing
- frames. For code that must interoperate between 1.11 and 1.12
- releases, you can replace the method expression <code>x.M</code>
- with the function literal <code>func (...) { x.M(...) } </code>.
-</p>
-
-<p><!-- CL 144340 -->
- The compiler now accepts a <code>-lang</code> flag to set the Go language
- version to use. For example, <code>-lang=go1.8</code> causes the compiler to
- emit an error if the program uses type aliases, which were added in Go 1.9.
- Language changes made before Go 1.12 are not consistently enforced.
-</p>
-
-<p><!-- CL 147160 -->
- The compiler toolchain now uses different conventions to call Go
- functions and assembly functions. This should be invisible to users,
- except for calls that simultaneously cross between Go and
- assembly <em>and</em> cross a package boundary. If linking results
- in an error like "relocation target not defined for ABIInternal (but
- is defined for ABI0)", please refer to the
- <a href="https://github.com/golang/proposal/blob/master/design/27539-internal-abi.md#compatibility">compatibility section</a>
- of the ABI design document.
-</p>
-
-<p><!-- CL 145179 -->
- There have been many improvements to the DWARF debug information
- produced by the compiler, including improvements to argument
- printing and variable location information.
-</p>
-
-<p><!-- CL 61511 -->
- Go programs now also maintain stack frame pointers on <code>linux/arm64</code>
- for the benefit of profiling tools like <code>perf</code>. The frame pointer
- maintenance has a small run-time overhead that varies but averages around 3%.
- To build a toolchain that does not use frame pointers, set
- <code>GOEXPERIMENT=noframepointer</code> when running <code>make.bash</code>.
-</p>
-
-<p><!-- CL 142717 -->
- The obsolete "safe" compiler mode (enabled by the <code>-u</code> gcflag) has been removed.
-</p>
-
-<h3 id="godoc"><code>godoc</code> and <code>go</code> <code>doc</code></h3>
-
-<p>
- In Go 1.12, <code>godoc</code> no longer has a command-line interface and
- is only a web server. Users should use <code>go</code> <code>doc</code>
- for command-line help output instead. Go 1.12 is the last release that will
- include the <code>godoc</code> webserver; in Go 1.13 it will be available
- via <code>go</code> <code>get</code>.
-</p>
-
-<p><!-- CL 141977 -->
- <code>go</code> <code>doc</code> now supports the <code>-all</code> flag,
- which will cause it to print all exported APIs and their documentation,
- as the <code>godoc</code> command line used to do.
-</p>
-
-<p><!-- CL 140959 -->
- <code>go</code> <code>doc</code> also now includes the <code>-src</code> flag,
- which will show the target's source code.
-</p>
-
-<h3 id="trace">Trace</h3>
-
-<p><!-- CL 60790 -->
- The trace tool now supports plotting mutator utilization curves,
- including cross-references to the execution trace. These are useful
- for analyzing the impact of the garbage collector on application
- latency and throughput.
-</p>
-
-<h3 id="assembler">Assembler</h3>
-
-<p><!-- CL 147218 -->
- On <code>arm64</code>, the platform register was renamed from
- <code>R18</code> to <code>R18_PLATFORM</code> to prevent accidental
- use, as the OS could choose to reserve this register.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p><!-- CL 138959 -->
- Go 1.12 significantly improves the performance of sweeping when a
- large fraction of the heap remains live. This reduces allocation
- latency immediately following a garbage collection.
-</p>
-
-<p><!-- CL 139719 -->
- The Go runtime now releases memory back to the operating system more
- aggressively, particularly in response to large allocations that
- can't reuse existing heap space.
-</p>
-
-<p><!-- CL 146342, CL 146340, CL 146345, CL 146339, CL 146343, CL 146337, CL 146341, CL 146338 -->
- The Go runtime's timer and deadline code is faster and scales better
- with higher numbers of CPUs. In particular, this improves the
- performance of manipulating network connection deadlines.
-</p>
-
-<p><!-- CL 135395 -->
- On Linux, the runtime now uses <code>MADV_FREE</code> to release unused
- memory. This is more efficient but may result in higher reported
- RSS. The kernel will reclaim the unused data when it is needed.
- To revert to the Go 1.11 behavior (<code>MADV_DONTNEED</code>), set the
- environment variable <code>GODEBUG=madvdontneed=1</code>.
-</p>
-
-<p><!-- CL 149578 -->
- Adding cpu.<em>extension</em>=off to the
- <a href="/doc/diagnostics.html#godebug">GODEBUG</a> environment
- variable now disables the use of optional CPU instruction
- set extensions in the standard library and runtime. This is not
- yet supported on Windows.
-</p>
-
-<p><!-- CL 158337 -->
- Go 1.12 improves the accuracy of memory profiles by fixing
- overcounting of large heap allocations.
-</p>
-
-<p><!-- CL 159717 -->
- Tracebacks, <code>runtime.Caller</code>,
- and <code>runtime.Callers</code> no longer include
- compiler-generated initialization functions. Doing a traceback
- during the initialization of a global variable will now show a
- function named <code>PKG.init.ializers</code>.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="tls_1_3">TLS 1.3</h3>
-
-<p>
- Go 1.12 adds opt-in support for TLS 1.3 in the <code>crypto/tls</code> package as
- specified by <a href="https://www.rfc-editor.org/info/rfc8446">RFC 8446</a>. It can
- be enabled by adding the value <code>tls13=1</code> to the <code>GODEBUG</code>
- environment variable. It will be enabled by default in Go 1.13.
-</p>
-
-<p>
- To negotiate TLS 1.3, make sure you do not set an explicit <code>MaxVersion</code> in
- <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> and run your program with
- the environment variable <code>GODEBUG=tls13=1</code> set.
-</p>
-
-<p>
- All TLS 1.2 features except <code>TLSUnique</code> in
- <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
- and renegotiation are available in TLS 1.3 and provide equivalent or
- better security and performance. Note that even though TLS 1.3 is backwards
- compatible with previous versions, certain legacy systems might not work
- correctly when attempting to negotiate it. RSA certificate keys too small
- to be secure (including 512-bit keys) will not work with TLS 1.3.
-</p>
-
-<p>
- TLS 1.3 cipher suites are not configurable. All supported cipher suites are
- safe, and if <code>PreferServerCipherSuites</code> is set in
- <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> the preference order
- is based on the available hardware.
-</p>
-
-<p>
- Early data (also called "0-RTT mode") is not currently supported as a
- client or server. Additionally, a Go 1.12 server does not support skipping
- unexpected early data if a client sends it. Since TLS 1.3 0-RTT mode
- involves clients keeping state regarding which servers support 0-RTT,
- a Go 1.12 server cannot be part of a load-balancing pool where some other
- servers do support 0-RTT. If switching a domain from a server that supported
- 0-RTT to a Go 1.12 server, 0-RTT would have to be disabled for at least the
- lifetime of the issued session tickets before the switch to ensure
- uninterrupted operation.
-</p>
-
-<p>
- In TLS 1.3 the client is the last one to speak in the handshake, so if it causes
- an error to occur on the server, it will be returned on the client by the first
- <a href="/pkg/crypto/tls/#Conn.Read"><code>Read</code></a>, not by
- <a href="/pkg/crypto/tls/#Conn.Handshake"><code>Handshake</code></a>. For
- example, that will be the case if the server rejects the client certificate.
- Similarly, session tickets are now post-handshake messages, so are only
- received by the client upon its first
- <a href="/pkg/crypto/tls/#Conn.Read"><code>Read</code></a>.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<!-- TODO: CL 115677: https://golang.org/cl/115677: cmd/vet: check embedded field tags too -->
-
-<dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt>
- <dd>
- <p><!-- CL 149297 -->
- <code>Reader</code>'s <a href="/pkg/bufio/#Reader.UnreadRune"><code>UnreadRune</code></a> and
- <a href="/pkg/bufio/#Reader.UnreadByte"><code>UnreadByte</code></a> methods will now return an error
- if they are called after <a href="/pkg/bufio/#Reader.Peek"><code>Peek</code></a>.
- </p>
-
-</dl><!-- bufio -->
-
-<dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
- <dd>
- <p><!-- CL 137855 -->
- The new function <a href="/pkg/bytes/#ReplaceAll"><code>ReplaceAll</code></a> returns a copy of
- a byte slice with all non-overlapping instances of a value replaced by another.
- </p>
-
- <p><!-- CL 145098 -->
- A pointer to a zero-value <a href="/pkg/bytes/#Reader"><code>Reader</code></a> is now
- functionally equivalent to <a href="/pkg/bytes/#NewReader"><code>NewReader</code></a><code>(nil)</code>.
- Prior to Go 1.12, the former could not be used as a substitute for the latter in all cases.
- </p>
-
-</dl><!-- bytes -->
-
-<dl id="crypto/rand"><dt><a href="/pkg/crypto/rand/">crypto/rand</a></dt>
- <dd>
- <p><!-- CL 139419 -->
- A warning will now be printed to standard error the first time
- <code>Reader.Read</code> is blocked for more than 60 seconds waiting
- to read entropy from the kernel.
- </p>
-
- <p><!-- CL 120055 -->
- On FreeBSD, <code>Reader</code> now uses the <code>getrandom</code>
- system call if available, <code>/dev/urandom</code> otherwise.
- </p>
-
-</dl><!-- crypto/rand -->
-
-<dl id="crypto/rc4"><dt><a href="/pkg/crypto/rc4/">crypto/rc4</a></dt>
- <dd>
- <p><!-- CL 130397 -->
- This release removes the assembly implementations, leaving only
- the pure Go version. The Go compiler generates code that is
- either slightly better or slightly worse, depending on the exact
- CPU. RC4 is insecure and should only be used for compatibility
- with legacy systems.
- </p>
-
-</dl><!-- crypto/rc4 -->
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p><!-- CL 143177 -->
- If a client sends an initial message that does not look like TLS, the server
- will no longer reply with an alert, and it will expose the underlying
- <code>net.Conn</code> in the new field <code>Conn</code> of
- <a href="/pkg/crypto/tls/#RecordHeaderError"><code>RecordHeaderError</code></a>.
- </p>
-
-</dl><!-- crypto/tls -->
-
-<dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
- <dd>
- <p><!-- CL 145738 -->
- A query cursor can now be obtained by passing a
- <a href="/pkg/database/sql/#Rows"><code>*Rows</code></a>
- value to the <a href="/pkg/database/sql/#Row.Scan"><code>Row.Scan</code></a> method.
- </p>
-
-</dl><!-- database/sql -->
-
-<dl id="expvar"><dt><a href="/pkg/expvar/">expvar</a></dt>
- <dd>
- <p><!-- CL 139537 -->
- The new <a href="/pkg/expvar/#Map.Delete"><code>Delete</code></a> method allows
- for deletion of key/value pairs from a <a href="/pkg/expvar/#Map"><code>Map</code></a>.
- </p>
-
-</dl><!-- expvar -->
-
-<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
- <dd>
- <p><!-- CL 142737 -->
- Maps are now printed in key-sorted order to ease testing. The ordering rules are:
- <ul>
- <li>When applicable, nil compares low
- <li>ints, floats, and strings order by <
- <li>NaN compares less than non-NaN floats
- <li>bool compares false before true
- <li>Complex compares real, then imaginary
- <li>Pointers compare by machine address
- <li>Channel values compare by machine address
- <li>Structs compare each field in turn
- <li>Arrays compare each element in turn
- <li>Interface values compare first by <code>reflect.Type</code> describing the concrete type
- and then by concrete value as described in the previous rules.
- </ul>
- </p>
-
- <p><!-- CL 129777 -->
- When printing maps, non-reflexive key values like <code>NaN</code> were previously
- displayed as <code>&lt;nil&gt;</code>. As of this release, the correct values are printed.
- </p>
-
-</dl><!-- fmt -->
-
-<dl id="go/doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
- <dd>
- <p><!-- CL 140958 -->
- To address some outstanding issues in <a href="/cmd/doc/"><code>cmd/doc</code></a>,
- this package has a new <a href="/pkg/go/doc/#Mode"><code>Mode</code></a> bit,
- <code>PreserveAST</code>, which controls whether AST data is cleared.
- </p>
-
-</dl><!-- go/doc -->
-
-<dl id="go/token"><dt><a href="/pkg/go/token/">go/token</a></dt>
- <dd>
- <p><!-- CL 134075 -->
- The <a href="/pkg/go/token#File"><code>File</code></a> type has a new
- <a href="/pkg/go/token#File.LineStart"><code>LineStart</code></a> field,
- which returns the position of the start of a given line. This is especially useful
- in programs that occasionally handle non-Go files, such as assembly, but wish to use
- the <code>token.Pos</code> mechanism to identify file positions.
- </p>
-
-</dl><!-- go/token -->
-
-<dl id="image"><dt><a href="/pkg/image/">image</a></dt>
- <dd>
- <p><!-- CL 118755 -->
- The <a href="/pkg/image/#RegisterFormat"><code>RegisterFormat</code></a> function is now safe for concurrent use.
- </p>
-
-</dl><!-- image -->
-
-<dl id="image/png"><dt><a href="/pkg/image/png/">image/png</a></dt>
- <dd>
- <p><!-- CL 134235 -->
- Paletted images with fewer than 16 colors now encode to smaller outputs.
- </p>
-
-</dl><!-- image/png -->
-
-<dl id="io"><dt><a href="/pkg/io/">io</a></dt>
- <dd>
- <p><!-- CL 139457 -->
- The new <a href="/pkg/io#StringWriter"><code>StringWriter</code></a> interface wraps the
- <a href="/pkg/io/#WriteString"><code>WriteString</code></a> function.
- </p>
-
-</dl><!-- io -->
-
-<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
- <dd>
- <p><!-- CL 153059 -->
- The functions
- <a href="/pkg/math/#Sin"><code>Sin</code></a>,
- <a href="/pkg/math/#Cos"><code>Cos</code></a>,
- <a href="/pkg/math/#Tan"><code>Tan</code></a>,
- and <a href="/pkg/math/#Sincos"><code>Sincos</code></a> now
- apply Payne-Hanek range reduction to huge arguments. This
- produces more accurate answers, but they will not be bit-for-bit
- identical with the results in earlier releases.
- </p>
-</dl><!-- math -->
-
-<dl id="math/bits"><dt><a href="/pkg/math/bits/">math/bits</a></dt>
- <dd>
- <p><!-- CL 123157 -->
- New extended precision operations <a href="/pkg/math/bits/#Add"><code>Add</code></a>, <a href="/pkg/math/bits/#Sub"><code>Sub</code></a>, <a href="/pkg/math/bits/#Mul"><code>Mul</code></a>, and <a href="/pkg/math/bits/#Div"><code>Div</code></a> are available in <code>uint</code>, <code>uint32</code>, and <code>uint64</code> versions.
- </p>
-
-</dl><!-- math/bits -->
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
- <p><!-- CL 146659 -->
- The
- <a href="/pkg/net/#Dialer.DualStack"><code>Dialer.DualStack</code></a> setting is now ignored and deprecated;
- RFC 6555 Fast Fallback ("Happy Eyeballs") is now enabled by default. To disable, set
- <a href="/pkg/net/#Dialer.FallbackDelay"><code>Dialer.FallbackDelay</code></a> to a negative value.
- </p>
-
- <p><!-- CL 107196 -->
- Similarly, TCP keep-alives are now enabled by default if
- <a href="/pkg/net/#Dialer.KeepAlive"><code>Dialer.KeepAlive</code></a> is zero.
- To disable, set it to a negative value.
- </p>
-
- <p><!-- CL 113997 -->
- On Linux, the <a href="http://man7.org/linux/man-pages/man2/splice.2.html"><code>splice</code> system call</a> is now used when copying from a
- <a href="/pkg/net/#UnixConn"><code>UnixConn</code></a> to a
- <a href="/pkg/net/#TCPConn"><code>TCPConn</code></a>.
- </p>
-</dl><!-- net -->
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
- <p><!-- CL 143177 -->
- The HTTP server now rejects misdirected HTTP requests to HTTPS servers with a plaintext "400 Bad Request" response.
- </p>
-
- <p><!-- CL 130115 -->
- The new <a href="/pkg/net/http/#Client.CloseIdleConnections"><code>Client.CloseIdleConnections</code></a>
- method calls the <code>Client</code>'s underlying <code>Transport</code>'s <code>CloseIdleConnections</code>
- if it has one.
- </p>
-
- <p><!-- CL 145398 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> no longer rejects HTTP responses which declare
- HTTP Trailers but don't use chunked encoding. Instead, the declared trailers are now just ignored.
- </p>
-
- <p><!-- CL 152080 --> <!-- CL 151857 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> no longer handles <code>MAX_CONCURRENT_STREAMS</code> values
- advertised from HTTP/2 servers as strictly as it did during Go 1.10 and Go 1.11. The default behavior is now back
- to how it was in Go 1.9: each connection to a server can have up to <code>MAX_CONCURRENT_STREAMS</code> requests
- active and then new TCP connections are created as needed. In Go 1.10 and Go 1.11 the <code>http2</code> package
- would block and wait for requests to finish instead of creating new connections.
- To get the stricter behavior back, import the
- <a href="https://godoc.org/golang.org/x/net/http2"><code>golang.org/x/net/http2</code></a> package
- directly and set
- <a href="https://godoc.org/golang.org/x/net/http2#Transport.StrictMaxConcurrentStreams"><code>Transport.StrictMaxConcurrentStreams</code></a> to
- <code>true</code>.
- </p>
-
-</dl><!-- net/http -->
-
-<dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt>
- <dd>
- <p><!-- CL 159157, CL 160178 -->
- <a href="/pkg/net/url/#Parse"><code>Parse</code></a>,
- <a href="/pkg/net/url/#ParseRequestURI"><code>ParseRequestURI</code></a>,
- and
- <a href="/pkg/net/url/#URL.Parse"><code>URL.Parse</code></a>
- now return an
- error for URLs containing ASCII control characters, which includes NULL,
- tab, and newlines.
- </p>
-
-</dl><!-- net/url -->
-
-<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
- <dd>
- <p><!-- CL 146437 -->
- The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a> now automatically
- proxies WebSocket requests.
- </p>
-
-</dl><!-- net/http/httputil -->
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p><!-- CL 125443 -->
- The new <a href="/pkg/os/#ProcessState.ExitCode"><code>ProcessState.ExitCode</code></a> method
- returns the process's exit code.
- </p>
-
- <p><!-- CL 135075 -->
- <code>ModeCharDevice</code> has been added to the <code>ModeType</code> bitmask, allowing for
- <code>ModeDevice | ModeCharDevice</code> to be recovered when masking a
- <a href="/pkg/os/#FileMode"><code>FileMode</code></a> with <code>ModeType</code>.
- </p>
-
- <p><!-- CL 139418 -->
- The new function <a href="/pkg/os/#UserHomeDir"><code>UserHomeDir</code></a> returns the
- current user's home directory.
- </p>
-
- <p><!-- CL 146020 -->
- <a href="/pkg/os/#RemoveAll"><code>RemoveAll</code></a> now supports paths longer than 4096 characters
- on most Unix systems.
- </p>
-
- <p><!-- CL 130676 -->
- <a href="/pkg/os/#File.Sync"><code>File.Sync</code></a> now uses <code>F_FULLFSYNC</code> on macOS
- to correctly flush the file contents to permanent storage.
- This may cause the method to run more slowly than in previous releases.
- </p>
-
- <p><!--CL 155517 -->
- <a href="/pkg/os/#File"><code>File</code></a> now supports
- a <a href="/pkg/os/#File.SyscallConn"><code>SyscallConn</code></a>
- method returning
- a <a href="/pkg/syscall/#RawConn"><code>syscall.RawConn</code></a>
- interface value. This may be used to invoke system-specific
- operations on the underlying file descriptor.
- </p>
-
-</dl><!-- os -->
-
-<dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
- <dd>
- <p><!-- CL 145220 -->
- The <a href="/pkg/path/filepath/#IsAbs"><code>IsAbs</code></a> function now returns true when passed
- a reserved filename on Windows such as <code>NUL</code>.
- <a href="https://docs.microsoft.com/en-us/windows/desktop/fileio/naming-a-file#naming-conventions">List of reserved names.</a>
- </p>
-
-</dl><!-- path/filepath -->
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
- <dd>
- <p><!-- CL 33572 -->
- A new <a href="/pkg/reflect#MapIter"><code>MapIter</code></a> type is
- an iterator for ranging over a map. This type is exposed through the
- <a href="/pkg/reflect#Value"><code>Value</code></a> type's new
- <a href="/pkg/reflect#Value.MapRange"><code>MapRange</code></a> method.
- This follows the same iteration semantics as a range statement, with <code>Next</code>
- to advance the iterator, and <code>Key</code>/<code>Value</code> to access each entry.
- </p>
-
-</dl><!-- reflect -->
-
-<dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
- <dd>
- <p><!-- CL 139784 -->
- <a href="/pkg/regexp/#Regexp.Copy"><code>Copy</code></a> is no longer necessary
- to avoid lock contention, so it has been given a partial deprecation comment.
- <a href="/pkg/regexp/#Regexp.Copy"><code>Copy</code></a>
- may still be appropriate if the reason for its use is to make two copies with
- different <a href="/pkg/regexp/#Regexp.Longest"><code>Longest</code></a> settings.
- </p>
-
-</dl><!-- regexp -->
-
-<dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
- <dd>
- <p><!-- CL 144220 -->
- A new <a href="/pkg/runtime/debug/#BuildInfo"><code>BuildInfo</code></a> type
- exposes the build information read from the running binary, available only in
- binaries built with module support. This includes the main package path, main
- module information, and the module dependencies. This type is given through the
- <a href="/pkg/runtime/debug/#ReadBuildInfo"><code>ReadBuildInfo</code></a> function
- on <a href="/pkg/runtime/debug/#BuildInfo"><code>BuildInfo</code></a>.
- </p>
-
-</dl><!-- runtime/debug -->
-
-<dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt>
- <dd>
- <p><!-- CL 137855 -->
- The new function <a href="/pkg/strings/#ReplaceAll"><code>ReplaceAll</code></a> returns a copy of
- a string with all non-overlapping instances of a value replaced by another.
- </p>
-
- <p><!-- CL 145098 -->
- A pointer to a zero-value <a href="/pkg/strings/#Reader"><code>Reader</code></a> is now
- functionally equivalent to <a href="/pkg/strings/#NewReader"><code>NewReader</code></a><code>(nil)</code>.
- Prior to Go 1.12, the former could not be used as a substitute for the latter in all cases.
- </p>
-
- <p><!-- CL 122835 -->
- The new <a href="/pkg/strings/#Builder.Cap"><code>Builder.Cap</code></a> method returns the capacity of the builder's underlying byte slice.
- </p>
-
- <p><!-- CL 131495 -->
- The character mapping functions <a href="/pkg/strings/#Map"><code>Map</code></a>,
- <a href="/pkg/strings/#Title"><code>Title</code></a>,
- <a href="/pkg/strings/#ToLower"><code>ToLower</code></a>,
- <a href="/pkg/strings/#ToLowerSpecial"><code>ToLowerSpecial</code></a>,
- <a href="/pkg/strings/#ToTitle"><code>ToTitle</code></a>,
- <a href="/pkg/strings/#ToTitleSpecial"><code>ToTitleSpecial</code></a>,
- <a href="/pkg/strings/#ToUpper"><code>ToUpper</code></a>, and
- <a href="/pkg/strings/#ToUpperSpecial"><code>ToUpperSpecial</code></a>
- now always guarantee to return valid UTF-8. In earlier releases, if the input was invalid UTF-8 but no character replacements
- needed to be applied, these routines incorrectly returned the invalid UTF-8 unmodified.
- </p>
-
-</dl><!-- strings -->
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p><!-- CL 138595 -->
- 64-bit inodes are now supported on FreeBSD 12. Some types have been adjusted accordingly.
- </p>
-
- <p><!-- CL 125456 -->
- The Unix socket
- (<a href="https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/"><code>AF_UNIX</code></a>)
- address family is now supported for compatible versions of Windows.
- </p>
-
- <p><!-- CL 147117 -->
- The new function <a href="/pkg/syscall/?GOOS=windows&GOARCH=amd64#Syscall18"><code>Syscall18</code></a>
- has been introduced for Windows, allowing for calls with up to 18 arguments.
- </p>
-
-</dl><!-- syscall -->
-
-<dl id="syscall/js"><dt><a href="/pkg/syscall/js/">syscall/js</a></dt>
- <dd>
- <p><!-- CL 153559 -->
- <p>
- The <code>Callback</code> type and <code>NewCallback</code> function have been renamed;
- they are now called
- <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Func"><code>Func</code></a> and
- <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#FuncOf"><code>FuncOf</code></a>, respectively.
- This is a breaking change, but WebAssembly support is still experimental
- and not yet subject to the
- <a href="/doc/go1compat">Go 1 compatibility promise</a>. Any code using the
- old names will need to be updated.
- </p>
-
- <p><!-- CL 141644 -->
- If a type implements the new
- <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Wrapper"><code>Wrapper</code></a>
- interface,
- <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#ValueOf"><code>ValueOf</code></a>
- will use it to return the JavaScript value for that type.
- </p>
-
- <p><!-- CL 143137 -->
- The meaning of the zero
- <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Value"><code>Value</code></a>
- has changed. It now represents the JavaScript <code>undefined</code> value
- instead of the number zero.
- This is a breaking change, but WebAssembly support is still experimental
- and not yet subject to the
- <a href="/doc/go1compat">Go 1 compatibility promise</a>. Any code relying on
- the zero <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Value"><code>Value</code></a>
- to mean the number zero will need to be updated.
- </p>
-
- <p><!-- CL 144384 -->
- The new
- <a href="/pkg/syscall/js/?GOOS=js&GOARCH=wasm#Value.Truthy"><code>Value.Truthy</code></a>
- method reports the
- <a href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy">JavaScript "truthiness"</a>
- of a given value.
- </p>
-
-</dl><!-- syscall/js -->
-
-<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
- <dd>
- <p><!-- CL 139258 -->
- The <a href="/cmd/go/#hdr-Testing_flags"><code>-benchtime</code></a> flag now supports setting an explicit iteration count instead of a time when the value ends with an "<code>x</code>". For example, <code>-benchtime=100x</code> runs the benchmark 100 times.
- </p>
-
-</dl><!-- testing -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 142217 -->
- When executing a template, long context values are no longer truncated in errors.
- </p>
- <p>
- <code>executing "tmpl" at <.very.deep.context.v...>: map has no entry for key "notpresent"</code>
- </p>
- <p>
- is now
- </p>
- <p>
- <code>executing "tmpl" at <.very.deep.context.value.notpresent>: map has no entry for key "notpresent"</code>
- </p>
-
- <dd>
- <p><!-- CL 143097 -->
- If a user-defined function called by a template panics, the
- panic is now caught and returned as an error by
- the <code>Execute</code> or <code>ExecuteTemplate</code> method.
- </p>
-</dl><!-- text/template -->
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
- <dd>
- <p><!-- CL 151299 -->
- The time zone database in <code>$GOROOT/lib/time/zoneinfo.zip</code>
- has been updated to version 2018i. Note that this ZIP file is
- only used if a time zone database is not provided by the operating
- system.
- </p>
-
-</dl><!-- time -->
-
-<dl id="unsafe"><dt><a href="/pkg/unsafe/">unsafe</a></dt>
- <dd>
- <p><!-- CL 146058 -->
- It is invalid to convert a nil <code>unsafe.Pointer</code> to <code>uintptr</code> and back with arithmetic.
- (This was already invalid, but will now cause the compiler to misbehave.)
- </p>
-
-</dl><!-- unsafe -->
diff --git a/doc/go1.13.html b/doc/go1.13.html
deleted file mode 100644
index 8f4035d87f..0000000000
--- a/doc/go1.13.html
+++ /dev/null
@@ -1,1066 +0,0 @@
-<!--{
- "Title": "Go 1.13 Release Notes",
- "Path": "/doc/go1.13",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.13</h2>
-
-<p>
- The latest Go release, version 1.13, arrives six months after <a href="go1.12">Go 1.12</a>.
- Most of its changes are in the implementation of the toolchain, runtime, and libraries.
- As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
- We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
- As of Go 1.13, the go command by default downloads and authenticates
- modules using the Go module mirror and Go checksum database run by Google. See
- <a href="https://proxy.golang.org/privacy">https://proxy.golang.org/privacy</a>
- for privacy information about these services and the
- <a href="/cmd/go/#hdr-Module_downloading_and_verification">go command documentation</a>
- for configuration details including how to disable the use of these servers or use
- different ones. If you depend on non-public modules, see the
- <a href="/cmd/go/#hdr-Module_configuration_for_non_public_modules">documentation for configuring your environment</a>.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- Per the <a href="https://github.com/golang/proposal/blob/master/design/19308-number-literals.md">number literal proposal</a>,
- Go 1.13 supports a more uniform and modernized set of number literal prefixes.
- <ul>
- <li>
- <a href="/ref/spec#Integer_literals">Binary integer literals</a>:
- The prefix <code>0b</code> or <code>0B</code> indicates a binary integer literal
- such as <code>0b1011</code>.
- </li>
-
- <li>
- <a href="/ref/spec#Integer_literals">Octal integer literals</a>:
- The prefix <code>0o</code> or <code>0O</code> indicates an octal integer literal
- such as <code>0o660</code>.
- The existing octal notation indicated by a leading <code>0</code> followed by
- octal digits remains valid.
- </li>
-
- <li>
- <a href="/ref/spec#Floating-point_literals">Hexadecimal floating point literals</a>:
- The prefix <code>0x</code> or <code>0X</code> may now be used to express the mantissa of a
- floating-point number in hexadecimal format such as <code>0x1.0p-1021</code>.
- A hexadecimal floating-point number must always have an exponent, written as the letter
- <code>p</code> or <code>P</code> followed by an exponent in decimal. The exponent scales
- the mantissa by 2 to the power of the exponent.
- </li>
-
- <li>
- <a href="/ref/spec#Imaginary_literals">Imaginary literals</a>:
- The imaginary suffix <code>i</code> may now be used with any (binary, decimal, hexadecimal)
- integer or floating-point literal.
- </li>
-
- <li>
- Digit separators:
- The digits of any number literal may now be separated (grouped) using underscores, such as
- in <code>1_000_000</code>, <code>0b_1010_0110</code>, or <code>3.1415_9265</code>.
- An underscore may appear between any two digits or the literal prefix and the first digit.
- </li>
- </ul>
-</p>
-
-<p>
- Per the <a href="https://github.com/golang/proposal/blob/master/design/19113-signed-shift-counts.md">signed shift counts proposal</a>
- Go 1.13 removes the restriction that a <a href="/ref/spec#Operators">shift count</a>
- must be unsigned. This change eliminates the need for many artificial <code>uint</code> conversions,
- solely introduced to satisfy this (now removed) restriction of the <code>&lt;&lt;</code> and <code>&gt;&gt;</code> operators.
-</p>
-
-<p>
- These language changes were implemented by changes to the compiler, and corresponding internal changes to the library
- packages <code><a href="#go/scanner">go/scanner</a></code> and
- <code><a href="#text/scanner">text/scanner</a></code> (number literals),
- and <code><a href="#go/types">go/types</a></code> (signed shift counts).
-</p>
-
-<p>
- If your code uses modules and your <code>go.mod</code> files specifies a language version, be sure
- it is set to at least <code>1.13</code> to get access to these language changes.
- You can do this by editing the <code>go.mod</code> file directly, or you can run
- <code>go mod edit -go=1.13</code>.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p id="nacl">
- Go 1.13 is the last release that will run on Native Client (NaCl).
-</p>
-
-<p><!-- CL 170119, CL 168882 -->
- For <code>GOARCH=wasm</code>, the new environment variable <code>GOWASM</code> takes a comma-separated list of experimental features that the binary gets compiled with.
- The valid values are documented <a href="/cmd/go/#hdr-Environment_variables">here</a>.
-</p>
-
-<h3 id="aix">AIX</h3>
-
-<p><!-- CL 164003, CL 169120 -->
- AIX on PPC64 (<code>aix/ppc64</code>) now supports cgo, external
- linking, and the <code>c-archive</code> and <code>pie</code> build
- modes.
-</p>
-
-<h3 id="android">Android</h3>
-
-<p><!-- CL 170127 -->
- Go programs are now compatible with Android 10.
-</p>
-
-<h3 id="darwin">Darwin</h3>
-
-<p>
- As <a href="go1.12#darwin">announced</a> in the Go 1.12 release notes,
- Go 1.13 now requires macOS 10.11 El Capitan or later;
- support for previous versions has been discontinued.
-</p>
-
-<h3 id="freebsd">FreeBSD</h3>
-
-<p>
- As <a href="go1.12#freebsd">announced</a> in the Go 1.12 release notes,
- Go 1.13 now requires FreeBSD 11.2 or later;
- support for previous versions has been discontinued.
- FreeBSD 12.0 or later requires a kernel with the <code>COMPAT_FREEBSD11</code>
- option set (this is the default).
-</p>
-
-<h3 id="illumos">Illumos</h3>
-
-<p><!-- CL 174457 -->
- Go now supports Illumos with <code>GOOS=illumos</code>.
- The <code>illumos</code> build tag implies the <code>solaris</code>
- build tag.
-</p>
-
-<h3 id="windows">Windows</h3>
-
-<p><!-- CL 178977 -->
- The Windows version specified by internally-linked Windows binaries
- is now Windows 7 rather than NT 4.0. This was already the minimum
- required version for Go, but can affect the behavior of system calls
- that have a backwards-compatibility mode. These will now behave as
- documented. Externally-linked binaries (any program using cgo) have
- always specified a more recent Windows version.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="modules">Modules</h3>
-
-<h4 id="proxy-vars">Environment variables</h4>
-
-<p><!-- CL 176580 -->
- The <a href="/cmd/go/#hdr-Module_support"><code>GO111MODULE</code></a>
- environment variable continues to default to <code>auto</code>, but
- the <code>auto</code> setting now activates the module-aware mode of
- the <code>go</code> command whenever the current working directory contains,
- or is below a directory containing, a <code>go.mod</code> file — even if the
- current directory is within <code>GOPATH/src</code>. This change simplifies
- the migration of existing code within <code>GOPATH/src</code> and the ongoing
- maintenance of module-aware packages alongside non-module-aware importers.
-</p>
-
-<p><!-- CL 181719 -->
- The new
- <a href="/cmd/go/#hdr-Module_configuration_for_non_public_modules"><code>GOPRIVATE</code></a>
- environment variable indicates module paths that are not publicly available.
- It serves as the default value for the lower-level <code>GONOPROXY</code>
- and <code>GONOSUMDB</code> variables, which provide finer-grained control over
- which modules are fetched via proxy and verified using the checksum database.
-</p>
-
-<p><!-- CL 173441, CL 177958 -->
- The <a href="/cmd/go/#hdr-Module_downloading_and_verification"><code>GOPROXY</code>
- environment variable</a> may now be set to a comma-separated list of proxy
- URLs or the special token <code>direct</code>, and
- its <a href="#introduction">default value</a> is
- now <code>https://proxy.golang.org,direct</code>. When resolving a package
- path to its containing module, the <code>go</code> command will try all
- candidate module paths on each proxy in the list in succession. An unreachable
- proxy or HTTP status code other than 404 or 410 terminates the search without
- consulting the remaining proxies.
-</p>
-
-<p>
- The new
- <a href="/cmd/go/#hdr-Module_authentication_failures"><code>GOSUMDB</code></a>
- environment variable identifies the name, and optionally the public key and
- server URL, of the database to consult for checksums of modules that are not
- yet listed in the main module's <code>go.sum</code> file.
- If <code>GOSUMDB</code> does not include an explicit URL, the URL is chosen by
- probing the <code>GOPROXY</code> URLs for an endpoint indicating support for
- the checksum database, falling back to a direct connection to the named
- database if it is not supported by any proxy. If <code>GOSUMDB</code> is set
- to <code>off</code>, the checksum database is not consulted and only the
- existing checksums in the <code>go.sum</code> file are verified.
-</p>
-
-<p>
- Users who cannot reach the default proxy and checksum database (for example,
- due to a firewalled or sandboxed configuration) may disable their use by
- setting <code>GOPROXY</code> to <code>direct</code>, and/or
- <code>GOSUMDB</code> to <code>off</code>.
- <a href="#go-env-w"><code>go</code> <code>env</code> <code>-w</code></a>
- can be used to set the default values for these variables independent of
- platform:
-</p>
-<pre>
-go env -w GOPROXY=direct
-go env -w GOSUMDB=off
-</pre>
-
-<h4 id="go-get"><code>go</code> <code>get</code></h4>
-
-<p><!-- CL 174099 -->
- In module-aware mode,
- <a href="/cmd/go/#hdr-Add_dependencies_to_current_module_and_install_them"><code>go</code> <code>get</code></a>
- with the <code>-u</code> flag now updates a smaller set of modules that is
- more consistent with the set of packages updated by
- <code>go</code> <code>get</code> <code>-u</code> in GOPATH mode.
- <code>go</code> <code>get</code> <code>-u</code> continues to update the
- modules and packages named on the command line, but additionally updates only
- the modules containing the packages <em>imported by</em> the named packages,
- rather than the transitive module requirements of the modules containing the
- named packages.
-</p>
-
-<p>
- Note in particular that <code>go</code> <code>get</code> <code>-u</code>
- (without additional arguments) now updates only the transitive imports of the
- package in the current directory. To instead update all of the packages
- transitively imported by the main module (including test dependencies), use
- <code>go</code> <code>get</code> <code>-u</code> <code>all</code>.
-</p>
-
-<p><!-- CL 177879 -->
- As a result of the above changes to
- <code>go</code> <code>get</code> <code>-u</code>, the
- <code>go</code> <code>get</code> subcommand no longer supports
- the <code>-m</code> flag, which caused <code>go</code> <code>get</code> to
- stop before loading packages. The <code>-d</code> flag remains supported, and
- continues to cause <code>go</code> <code>get</code> to stop after downloading
- the source code needed to build dependencies of the named packages.
-</p>
-
-<p><!-- CL 177677 -->
- By default, <code>go</code> <code>get</code> <code>-u</code> in module mode
- upgrades only non-test dependencies, as in GOPATH mode. It now also accepts
- the <code>-t</code> flag, which (as in GOPATH mode)
- causes <code>go</code> <code>get</code> to include the packages imported
- by <em>tests of</em> the packages named on the command line.
-</p>
-
-<p><!-- CL 167747 -->
- In module-aware mode, the <code>go</code> <code>get</code> subcommand now
- supports the version suffix <code>@patch</code>. The <code>@patch</code>
- suffix indicates that the named module, or module containing the named
- package, should be updated to the highest patch release with the same
- major and minor versions as the version found in the build list.
-</p>
-
-<p><!-- CL 184440 -->
- If a module passed as an argument to <code>go</code> <code>get</code>
- without a version suffix is already required at a newer version than the
- latest released version, it will remain at the newer version. This is
- consistent with the behavior of the <code>-u</code> flag for module
- dependencies. This prevents unexpected downgrades from pre-release versions.
- The new version suffix <code>@upgrade</code> explicitly requests this
- behavior. <code>@latest</code> explicitly requests the latest version
- regardless of the current version.
-</p>
-
-<h4 id="version-validation">Version validation</h4><!-- CL 181881 -->
-
-<p>
- When extracting a module from a version control system, the <code>go</code>
- command now performs additional validation on the requested version string.
-</p>
-
-<p>
- The <code>+incompatible</code> version annotation bypasses the requirement
- of <a href="/cmd/go/#hdr-Module_compatibility_and_semantic_versioning">semantic
- import versioning</a> for repositories that predate the introduction of
- modules. The <code>go</code> command now verifies that such a version does not
- include an explicit <code>go.mod</code> file.
-</p>
-
-<p>
- The <code>go</code> command now verifies the mapping
- between <a href="/cmd/go/#hdr-Pseudo_versions">pseudo-versions</a> and
- version-control metadata. Specifically:
- <ul>
- <li>The version prefix must be of the form <code>vX.0.0</code>, or derived
- from a tag on an ancestor of the named revision, or derived from a tag that
- includes <a href="https://semver.org/#spec-item-10">build metadata</a> on
- the named revision itself.</li>
-
- <li>The date string must match the UTC timestamp of the revision.</li>
-
- <li>The short name of the revision must use the same number of characters as
- what the <code>go</code> command would generate. (For SHA-1 hashes as used
- by <code>git</code>, a 12-digit prefix.)</li>
- </ul>
-</p>
-
-<p>
- If a <code>require</code> directive in the
- <a href="/cmd/go/#hdr-The_main_module_and_the_build_list">main module</a> uses
- an invalid pseudo-version, it can usually be corrected by redacting the
- version to just the commit hash and re-running a <code>go</code> command, such
- as <code>go</code> <code>list</code> <code>-m</code> <code>all</code>
- or <code>go</code> <code>mod</code> <code>tidy</code>. For example,
-</p>
-<pre>require github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c</pre>
-<p>can be redacted to</p>
-<pre>require github.com/docker/docker e7b5f7dbe98c</pre>
-<p>which currently resolves to</p>
-<pre>require github.com/docker/docker v0.7.3-0.20190319215453-e7b5f7dbe98c</pre>
-
-<p>
- If one of the transitive dependencies of the main module requires an invalid
- version or pseudo-version, the invalid version can be replaced with a valid
- one using a
- <a href="/cmd/go/#hdr-The_go_mod_file"><code>replace</code> directive</a> in
- the <code>go.mod</code> file of the main module. If the replacement is a
- commit hash, it will be resolved to the appropriate pseudo-version as above.
- For example,
-</p>
-<pre>replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker e7b5f7dbe98c</pre>
-<p>currently resolves to</p>
-<pre>replace github.com/docker/docker v1.14.0-0.20190319215453-e7b5f7dbe98c => github.com/docker/docker v0.7.3-0.20190319215453-e7b5f7dbe98c</pre>
-
-<h3 id="go-command">Go command</h3>
-
-<p id="go-env-w"><!-- CL 171137 -->
- The <a href="/cmd/go/#hdr-Environment_variables"><code>go</code> <code>env</code></a>
- command now accepts a <code>-w</code> flag to set the per-user default value
- of an environment variable recognized by the
- <code>go</code> command, and a corresponding <code>-u</code> flag to unset a
- previously-set default. Defaults set via
- <code>go</code> <code>env</code> <code>-w</code> are stored in the
- <code>go/env</code> file within
- <a href="/pkg/os/#UserConfigDir"><code>os.UserConfigDir()</code></a>.
-</p>
-
-<p id="go-version-exe"><!-- CL 173343 -->
- The <a href="/cmd/go/#hdr-Print_Go_version">
- <code>go</code> <code>version</code></a> command now accepts arguments naming
- executables and directories. When invoked on an executable,
- <code>go</code> <code>version</code> prints the version of Go used to build
- the executable. If the <code>-m</code> flag is used,
- <code>go</code> <code>version</code> prints the executable's embedded module
- version information, if available. When invoked on a directory,
- <code>go</code> <code>version</code> prints information about executables
- contained in the directory and its subdirectories.
-</p>
-
-<p id="trimpath"><!-- CL 173345 -->
- The new <a href="/cmd/go/#hdr-Compile_packages_and_dependencies"><code>go</code>
- <code>build</code> flag</a> <code>-trimpath</code> removes all file system paths
- from the compiled executable, to improve build reproducibility.
-</p>
-
-<p id="o-dir"><!-- CL 167679 -->
- If the <code>-o</code> flag passed to <code>go</code> <code>build</code>
- refers to an existing directory, <code>go</code> <code>build</code> will now
- write executable files within that directory for <code>main</code> packages
- matching its package arguments.
-</p>
-
-<p id="comma-separated-tags"><!-- CL 173438 -->
- The <code>go</code> <code>build</code> flag <code>-tags</code> now takes a
- comma-separated list of build tags, to allow for multiple tags in
- <a href="/cmd/go/#hdr-Environment_variables"><code>GOFLAGS</code></a>. The
- space-separated form is deprecated but still recognized and will be maintained.
-</p>
-
-<p id="go-generate-tag"><!-- CL 175983 -->
- <a href="/cmd/go/#hdr-Generate_Go_files_by_processing_source"><code>go</code>
- <code>generate</code></a> now sets the <code>generate</code> build tag so that
- files may be searched for directives but ignored during build.
-</p>
-
-<p id="binary-only"><!-- CL 165746 -->
- As <a href="/doc/go1.12#binary-only">announced</a> in the Go 1.12 release
- notes, binary-only packages are no longer supported. Building a binary-only
- package (marked with a <code>//go:binary-only-package</code> comment) now
- results in an error.
-</p>
-
-<h3 id="compiler">Compiler toolchain</h3>
-
-<p><!-- CL 170448 -->
- The compiler has a new implementation of escape analysis that is
- more precise. For most Go code should be an improvement (in other
- words, more Go variables and expressions allocated on the stack
- instead of heap). However, this increased precision may also break
- invalid code that happened to work before (for example, code that
- violates
- the <a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code>
- safety rules</a>). If you notice any regressions that appear
- related, the old escape analysis pass can be re-enabled
- with <code>go</code> <code>build</code> <code>-gcflags=all=-newescape=false</code>.
- The option to use the old escape analysis will be removed in a
- future release.
-</p>
-
-<p><!-- CL 161904 -->
- The compiler no longer emits floating point or complex constants
- to <code>go_asm.h</code> files. These have always been emitted in a
- form that could not be used as numeric constant in assembly code.
-</p>
-
-<h3 id="assembler">Assembler</h3>
-
-<p><!-- CL 157001 -->
- The assembler now supports many of the atomic instructions
- introduced in ARM v8.1.
-</p>
-
-<h3 id="gofmt">gofmt</h3>
-
-<p>
- <code>gofmt</code> (and with that <code>go fmt</code>) now canonicalizes
- number literal prefixes and exponents to use lower-case letters, but
- leaves hexadecimal digits alone. This improves readability when using the new octal prefix
- (<code>0O</code> becomes <code>0o</code>), and the rewrite is applied consistently.
- <code>gofmt</code> now also removes unnecessary leading zeroes from a decimal integer
- imaginary literal. (For backwards-compatibility, an integer imaginary literal
- starting with <code>0</code> is considered a decimal, not an octal number.
- Removing superfluous leading zeroes avoids potential confusion.)
- For instance, <code>0B1010</code>, <code>0XabcDEF</code>, <code>0O660</code>,
- <code>1.2E3</code>, and <code>01i</code> become <code>0b1010</code>, <code>0xabcDEF</code>,
- <code>0o660</code>, <code>1.2e3</code>, and <code>1i</code> after applying <code>gofmt</code>.
-</p>
-
-<h3 id="godoc"><code>godoc</code> and <code>go</code> <code>doc</code></h3>
-
-<p><!-- CL 174322 -->
- The <code>godoc</code> webserver is no longer included in the main binary distribution.
- To run the <code>godoc</code> webserver locally, manually install it first:
-<pre>
-go get golang.org/x/tools/cmd/godoc
-godoc
-</pre>
-</p>
-
-<p><!-- CL 177797 -->
- The
- <a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol"><code>go</code> <code>doc</code></a>
- command now always includes the package clause in its output, except for
- commands. This replaces the previous behavior where a heuristic was used,
- causing the package clause to be omitted under certain conditions.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p><!-- CL 161477 -->
- Out of range panic messages now include the index that was out of
- bounds and the length (or capacity) of the slice. For
- example, <code>s[3]</code> on a slice of length 1 will panic with
- "runtime error: index out of range [3] with length 1".
-</p>
-
-<p><!-- CL 171758 -->
- This release improves performance of most uses of <code>defer</code>
- by 30%.
-</p>
-
-<p><!-- CL 142960 -->
- The runtime is now more aggressive at returning memory to the
- operating system to make it available to co-tenant applications.
- Previously, the runtime could retain memory for five or more minutes
- following a spike in the heap size. It will now begin returning it
- promptly after the heap shrinks. However, on many OSes, including
- Linux, the OS itself reclaims memory lazily, so process RSS will not
- decrease until the system is under memory pressure.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="tls_1_3">TLS 1.3</h3>
-
-<p>
- As announced in Go 1.12, Go 1.13 enables support for TLS 1.3 in the
- <code>crypto/tls</code> package by default. It can be disabled by adding the
- value <code>tls13=0</code> to the <code>GODEBUG</code>
- environment variable. The opt-out will be removed in Go 1.14.
-</p>
-
-<p>
- See <a href="/doc/go1.12#tls_1_3">the Go 1.12 release notes</a> for important
- compatibility information.
-</p>
-
-<h3 id="crypto/ed25519"><a href="/pkg/crypto/ed25519/">crypto/ed25519</a></h3>
-
-<p><!-- CL 174945, 182698 -->
- The new <a href="/pkg/crypto/ed25519/"><code>crypto/ed25519</code></a>
- package implements the Ed25519 signature
- scheme. This functionality was previously provided by the
- <a href="https://godoc.org/golang.org/x/crypto/ed25519"><code>golang.org/x/crypto/ed25519</code></a>
- package, which becomes a wrapper for
- <code>crypto/ed25519</code> when used with Go 1.13+.
-</p>
-
-<h3 id="error_wrapping">Error wrapping</h3>
-
-<p><!-- CL 163558, 176998 -->
- Go 1.13 contains support for error wrapping, as first proposed in
- the <a href="https://go.googlesource.com/proposal/+/master/design/29934-error-values.md">
- Error Values proposal</a> and discussed on <a href="https://golang.org/issue/29934">the
- associated issue</a>.
-</p>
-<p>
- An error <code>e</code> can <em>wrap</em> another error <code>w</code> by providing
- an <code>Unwrap</code> method that returns <code>w</code>. Both <code>e</code>
- and <code>w</code> are available to programs, allowing <code>e</code> to provide
- additional context to <code>w</code> or to reinterpret it while still allowing
- programs to make decisions based on <code>w</code>.
-</p>
-<p>
- To support wrapping, <a href="#fmt"><code>fmt.Errorf</code></a> now has a <code>%w</code>
- verb for creating wrapped errors, and three new functions in
- the <a href="#errors"><code>errors</code></a> package (
- <a href="/pkg/errors/#Unwrap"><code>errors.Unwrap</code></a>,
- <a href="/pkg/errors/#Is"><code>errors.Is</code></a> and
- <a href="/pkg/errors/#As"><code>errors.As</code></a>) simplify unwrapping
- and inspecting wrapped errors.
-</p>
-<p>
- For more information, read the <a href="/pkg/errors/"><code>errors</code> package
- documentation</a>, or see
- the <a href="https://golang.org/wiki/ErrorValueFAQ">Error Value FAQ</a>.
- There will soon be a blog post as well.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
- <dd>
- <p>
- The new <a href="/pkg/bytes/#ToValidUTF8"><code>ToValidUTF8</code></a> function returns a
- copy of a given byte slice with each run of invalid UTF-8 byte sequences replaced by a given slice.
- </p>
-
-</dl><!-- bytes -->
-
-<dl id="context"><dt><a href="/pkg/context/">context</a></dt>
- <dd>
- <p><!-- CL 169080 -->
- The formatting of contexts returned by <a href="/pkg/context/#WithValue"><code>WithValue</code></a> no longer depends on <code>fmt</code> and will not stringify in the same way. Code that depends on the exact previous stringification might be affected.
- </p>
-
-</dl><!-- context -->
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p>
- Support for SSL version 3.0 (SSLv3) <a href="https://golang.org/issue/32716">
- is now deprecated and will be removed in Go 1.14</a>. Note that SSLv3 is the
- <a href="https://tools.ietf.org/html/rfc7568">cryptographically broken</a>
- protocol predating TLS.
- </p>
-
- <p>
- SSLv3 was always disabled by default, other than in Go 1.12, when it was
- mistakenly enabled by default server-side. It is now again disabled by
- default. (SSLv3 was never supported client-side.)
- </p>
-
- <p><!-- CL 177698 -->
- Ed25519 certificates are now supported in TLS versions 1.2 and 1.3.
- </p>
-
-</dl><!-- crypto/tls -->
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p><!-- CL 175478 -->
- Ed25519 keys are now supported in certificates and certificate requests
- according to <a href="https://www.rfc-editor.org/info/rfc8410">RFC 8410</a>, as well as by the
- <a href="/pkg/crypto/x509/#ParsePKCS8PrivateKey"><code>ParsePKCS8PrivateKey</code></a>,
- <a href="/pkg/crypto/x509/#MarshalPKCS8PrivateKey"><code>MarshalPKCS8PrivateKey</code></a>,
- and <a href="/pkg/crypto/x509/#ParsePKIXPublicKey"><code>ParsePKIXPublicKey</code></a> functions.
- </p>
-
- <p><!-- CL 169238 -->
- The paths searched for system roots now include <code>/etc/ssl/cert.pem</code>
- to support the default location in Alpine Linux 3.7+.
- </p>
-
-</dl><!-- crypto/x509 -->
-
-<dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
- <dd>
- <p><!-- CL 170699 -->
- The new <a href="/pkg/database/sql/#NullTime"><code>NullTime</code></a> type represents a <code>time.Time</code> that may be null.
- </p>
-
- <p><!-- CL 174178 -->
- The new <a href="/pkg/database/sql/#NullInt32"><code>NullInt32</code></a> type represents an <code>int32</code> that may be null.
- </p>
-
-</dl><!-- database/sql -->
-
-<dl id="debug/dwarf"><dt><a href="/pkg/debug/dwarf/">debug/dwarf</a></dt>
- <dd>
- <p><!-- CL 158797 -->
- The <a href="/pkg/debug/dwarf/#Data.Type"><code>Data.Type</code></a>
- method no longer panics if it encounters an unknown DWARF tag in
- the type graph. Instead, it represents that component of the
- type with
- an <a href="/pkg/debug/dwarf/#UnsupportedType"><code>UnsupportedType</code></a>
- object.
- </p>
-
-</dl><!-- debug/dwarf -->
-
-<dl id="errors"><dt><a href="/pkg/errors/">errors</a></dt>
- <dd>
- <!-- CL 163558 -->
- <p>
- The new function <a href="/pkg/errors/#As"><code>As</code></a> finds the first
- error in a given error’s chain (sequence of wrapped errors)
- that matches a given target’s type, and if so, sets the target to that error value.
- </p>
- <p>
- The new function <a href="/pkg/errors/#Is"><code>Is</code></a> reports whether a given error value matches an
- error in another’s chain.
- </p>
- <p>
- The new function <a href="/pkg/errors/#Unwrap"><code>Unwrap</code></a> returns the result of calling
- <code>Unwrap</code> on a given error, if one exists.
- </p>
-
-</dl><!-- errors -->
-
-<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
- <dd>
- <!-- CL 160245 -->
- <p>
- The printing verbs <code>%x</code> and <code>%X</code> now format floating-point and
- complex numbers in hexadecimal notation, in lower-case and upper-case respectively.
- </p>
-
- <!-- CL 160246 -->
- <p>
- The new printing verb <code>%O</code> formats integers in base 8, emitting the <code>0o</code> prefix.
- </p>
-
- <!-- CL 160247 -->
- <p>
- The scanner now accepts hexadecimal floating-point values, digit-separating underscores
- and leading <code>0b</code> and <code>0o</code> prefixes.
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
- <!-- CL 176998 -->
- <p>The <a href="/pkg/fmt/#Errorf"><code>Errorf</code></a> function
- has a new verb, <code>%w</code>, whose operand must be an error.
- The error returned from <code>Errorf</code> will have an
- <code>Unwrap</code> method which returns the operand of <code>%w</code>.
- </p>
-
-</dl><!-- fmt -->
-
-
-<dl id="go/scanner"><dt><a href="/pkg/go/scanner/">go/scanner</a></dt>
- <dd>
- <p><!-- CL 175218 -->
- The scanner has been updated to recognize the new Go number literals, specifically
- binary literals with <code>0b</code>/<code>0B</code> prefix, octal literals with <code>0o</code>/<code>0O</code> prefix,
- and floating-point numbers with hexadecimal mantissa. The imaginary suffix <code>i</code> may now be used with any number
- literal, and underscores may used as digit separators for grouping.
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
- </dl><!-- go/scanner -->
-
-<dl id="go/types"><dt><a href="/pkg/go/types/">go/types</a></dt>
- <dd>
- <p>
- The type-checker has been updated to follow the new rules for integer shifts.
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
-</dl><!-- go/types -->
-
-
-
-<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
- <dd>
- <p><!-- CL 175218 -->
- When using a <code>&lt;script&gt;</code> tag with "module" set as the
- type attribute, code will now be interpreted as <a href="https://html.spec.whatwg.org/multipage/scripting.html#the-script-element:module-script-2">JavaScript module script</a>.
- </p>
-
-</dl><!-- html/template -->
-
-<dl id="log"><dt><a href="/pkg/log/">log</a></dt>
- <dd>
- <p><!-- CL 168920 -->
- The new <a href="/pkg/log/#Writer"><code>Writer</code></a> function returns the output destination for the standard logger.
- </p>
-
-</dl><!-- log -->
-
-<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
- <dd>
- <p><!-- CL 160682 -->
- The new <a href="/pkg/math/big/#Rat.SetUint64"><code>Rat.SetUint64</code></a> method sets the <code>Rat</code> to a <code>uint64</code> value.
- </p>
-
- <p><!-- CL 166157 -->
- For <a href="/pkg/math/big/#Float.Parse"><code>Float.Parse</code></a>, if base is 0, underscores
- may be used between digits for readability.
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
- <p><!-- CL 166157 -->
- For <a href="/pkg/math/big/#Int.SetString"><code>Int.SetString</code></a>, if base is 0, underscores
- may be used between digits for readability.
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
- <p><!-- CL 168237 -->
- <a href="/pkg/math/big/#Rat.SetString"><code>Rat.SetString</code></a> now accepts non-decimal floating point representations.
- </p>
-
-</dl><!-- math/big -->
-
-<dl id="math/bits"><dt><a href="/pkg/math/bits/">math/bits</a></dt>
- <dd>
- <p><!-- CL 178177 -->
- The execution time of <a href="/pkg/math/bits/#Add"><code>Add</code></a>,
- <a href="/pkg/math/bits/#Sub"><code>Sub</code></a>,
- <a href="/pkg/math/bits/#Mul"><code>Mul</code></a>,
- <a href="/pkg/math/bits/#RotateLeft"><code>RotateLeft</code></a>, and
- <a href="/pkg/math/bits/#ReverseBytes"><code>ReverseBytes</code></a> is now
- guaranteed to be independent of the inputs.
- </p>
-
-</dl><!-- math/bits -->
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
- <p><!-- CL 156366 -->
- On Unix systems where <code>use-vc</code> is set in <code>resolv.conf</code>, TCP is used for DNS resolution.
- </p>
-
- <p><!-- CL 170678 -->
- The new field <a href="/pkg/net/#ListenConfig.KeepAlive"><code>ListenConfig.KeepAlive</code></a>
- specifies the keep-alive period for network connections accepted by the listener.
- If this field is 0 (the default) TCP keep-alives will be enabled.
- To disable them, set it to a negative value.
- </p>
- <p>
- Note that the error returned from I/O on a connection that was
- closed by a keep-alive timeout will have a
- <code>Timeout</code> method that returns <code>true</code> if called.
- This can make a keep-alive error difficult to distinguish from
- an error returned due to a missed deadline as set by the
- <a href="/pkg/net/#Conn"><code>SetDeadline</code></a>
- method and similar methods.
- Code that uses deadlines and checks for them with
- the <code>Timeout</code> method or
- with <a href="/pkg/os/#IsTimeout"><code>os.IsTimeout</code></a>
- may want to disable keep-alives, or
- use <code>errors.Is(syscall.ETIMEDOUT)</code> (on Unix systems)
- which will return true for a keep-alive timeout and false for a
- deadline timeout.
- </p>
-
-</dl><!-- net -->
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
- <p><!-- CL 76410 -->
- The new fields <a href="/pkg/net/http/#Transport.WriteBufferSize"><code>Transport.WriteBufferSize</code></a>
- and <a href="/pkg/net/http/#Transport.ReadBufferSize"><code>Transport.ReadBufferSize</code></a>
- allow one to specify the sizes of the write and read buffers for a <a href="/pkg/net/http/#Transport"><code>Transport</code></a>.
- If either field is zero, a default size of 4KB is used.
- </p>
-
- <p><!-- CL 130256 -->
- The new field <a href="/pkg/net/http/#Transport.ForceAttemptHTTP2"><code>Transport.ForceAttemptHTTP2</code></a>
- controls whether HTTP/2 is enabled when a non-zero <code>Dial</code>, <code>DialTLS</code>, or <code>DialContext</code>
- func or <code>TLSClientConfig</code> is provided.
- </p>
-
- <p><!-- CL 140357 -->
- <a href="/pkg/net/http/#Transport.MaxConnsPerHost"><code>Transport.MaxConnsPerHost</code></a> now works
- properly with HTTP/2.
- </p>
-
- <p><!-- CL 154383 -->
- <a href="/pkg/net/http/#TimeoutHandler"><code>TimeoutHandler</code></a>'s
- <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a> now implements the
- <a href="/pkg/net/http/#Pusher"><code>Pusher</code></a> interface.
- </p>
-
- <p><!-- CL 157339 -->
- The <code>StatusCode</code> <code>103</code> <code>"Early Hints"</code> has been added.
- </p>
-
- <p><!-- CL 163599 -->
- <a href="/pkg/net/http/#Transport"><code>Transport</code></a> now uses the <a href="/pkg/net/http/#Request.Body"><code>Request.Body</code></a>'s
- <a href="/pkg/io/#ReaderFrom"><code>io.ReaderFrom</code></a> implementation if available, to optimize writing the body.
- </p>
-
- <p><!-- CL 167017 -->
- On encountering unsupported transfer-encodings, <a href="/pkg/net/http/#Server"><code>http.Server</code></a> now
- returns a "501 Unimplemented" status as mandated by the HTTP specification <a href="https://tools.ietf.org/html/rfc7230#section-3.3.1">RFC 7230 Section 3.3.1</a>.
- </p>
-
- <p><!-- CL 167681 -->
- The new <a href="/pkg/net/http/#Server"><code>Server</code></a> fields
- <a href="/pkg/net/http/#Server.BaseContext"><code>BaseContext</code></a> and
- <a href="/pkg/net/http/#Server.ConnContext"><code>ConnContext</code></a>
- allow finer control over the <a href="/pkg/context/#Context"><code>Context</code></a> values provided to requests and connections.
- </p>
-
- <p><!-- CL 167781 -->
- <a href="/pkg/net/http/#DetectContentType"><code>http.DetectContentType</code></a> now correctly detects RAR signatures, and can now also detect RAR v5 signatures.
- </p>
-
- <p><!-- CL 173658 -->
- The new <a href="/pkg/net/http/#Header"><code>Header</code></a> method
- <a href="/pkg/net/http/#Header.Clone"><code>Clone</code></a> returns a copy of the receiver.
- </p>
-
- <p><!-- CL 174324 -->
- A new function <a href="/pkg/net/http/#NewRequestWithContext"><code>NewRequestWithContext</code></a> has been added and it
- accepts a <a href="/pkg/context/#Context"><code>Context</code></a> that controls the entire lifetime of
- the created outgoing <a href="/pkg/net/http/#Request"><code>Request</code></a>, suitable for use with
- <a href="/pkg/net/http/#Client.Do"><code>Client.Do</code></a> and <a href="/pkg/net/http/#Transport.RoundTrip"><code>Transport.RoundTrip</code></a>.
- </p>
-
- <p><!-- CL 179457 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a> no longer logs errors when servers
- gracefully shut down idle connections using a <code>"408 Request Timeout"</code> response.
- </p>
-
-</dl><!-- net/http -->
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p><!-- CL 160877 -->
- The new <a href="/pkg/os/#UserConfigDir"><code>UserConfigDir</code></a> function
- returns the default directory to use for user-specific configuration data.
- </p>
-
- <p><!-- CL 166578 -->
- If a <a href="/pkg/os/#File"><code>File</code></a> is opened using the O_APPEND flag, its
- <a href="/pkg/os/#File.WriteAt"><code>WriteAt</code></a> method will always return an error.
- </p>
-
-</dl><!-- os -->
-
-<dl id="os/exec"><dt><a href="/pkg/os/exec/">os/exec</a></dt>
- <dd>
- <p><!-- CL 174318 -->
- On Windows, the environment for a <a href="/pkg/os/exec/#Cmd"><code>Cmd</code></a> always inherits the
- <code>%SYSTEMROOT%</code> value of the parent process unless the
- <a href="/pkg/os/exec/#Cmd.Env"><code>Cmd.Env</code></a> field includes an explicit value for it.
- </p>
-
-</dl><!-- os/exec -->
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
- <dd>
- <p><!-- CL 171337 -->
- The new <a href="/pkg/reflect/#Value.IsZero"><code>Value.IsZero</code></a> method reports whether a <code>Value</code> is the zero value for its type.
- </p>
-
- <p><!-- CL 174531 -->
- The <a href="/pkg/reflect/#MakeFunc"><code>MakeFunc</code></a> function now allows assignment conversions on returned values, instead of requiring exact type match. This is particularly useful when the type being returned is an interface type, but the value actually returned is a concrete value implementing that type.
- </p>
-
-</dl><!-- reflect -->
-
-<dl id="pkg-runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
- <dd>
- <p> <!-- CL 167780 -->
- Tracebacks, <a href="/pkg/runtime/#Caller"><code>runtime.Caller</code></a>,
- and <a href="/pkg/runtime/#Callers"><code>runtime.Callers</code></a> now refer to the function that
- initializes the global variables of <code>PKG</code>
- as <code>PKG.init</code> instead of <code>PKG.init.ializers</code>.
- </p>
-
-</dl><!-- runtime -->
-
-<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
- <dd>
- <p><!-- CL 160243 -->
- For <a href="/pkg/strconv/#ParseFloat"><code>strconv.ParseFloat</code></a>,
- <a href="/pkg/strconv/#ParseInt"><code>strconv.ParseInt</code></a>
- and <a href="/pkg/strconv/#ParseUint"><code>strconv.ParseUint</code></a>,
- if base is 0, underscores may be used between digits for readability.
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
-</dl><!-- strconv -->
-
-<dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt>
- <dd>
- <p><!-- CL 142003 -->
- The new <a href="/pkg/strings/#ToValidUTF8"><code>ToValidUTF8</code></a> function returns a
- copy of a given string with each run of invalid UTF-8 byte sequences replaced by a given string.
- </p>
-
-</dl><!-- strings -->
-
-<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
- <dd>
- <p><!-- CL 148958, CL 148959, CL 152697, CL 152698 -->
- The fast paths of <a href="/pkg/sync/#Mutex.Lock"><code>Mutex.Lock</code></a>, <a href="/pkg/sync/#Mutex.Unlock"><code>Mutex.Unlock</code></a>,
- <a href="/pkg/sync/#RWMutex.Lock"><code>RWMutex.Lock</code></a>, <a href="/pkg/sync/#Mutex.RUnlock"><code>RWMutex.RUnlock</code></a>, and
- <a href="/pkg/sync/#Once.Do"><code>Once.Do</code></a> are now inlined in their callers.
- For the uncontended cases on amd64, these changes make <a href="/pkg/sync/#Once.Do"><code>Once.Do</code></a> twice as fast, and the
- <a href="/pkg/sync/#Mutex"><code>Mutex</code></a>/<a href="/pkg/sync/#RWMutex"><code>RWMutex</code></a> methods up to 10% faster.
- </p>
-
- <p><!-- CL 166960 -->
- Large <a href="/pkg/sync/#Pool"><code>Pool</code></a> no longer increase stop-the-world pause times.
- </p>
-
- <p><!-- CL 166961 -->
- <code>Pool</code> no longer needs to be completely repopulated after every GC. It now retains some objects across GCs,
- as opposed to releasing all objects, reducing load spikes for heavy users of <code>Pool</code>.
- </p>
-
-</dl><!-- sync -->
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p><!-- CL 168479 -->
- Uses of <code>_getdirentries64</code> have been removed from
- Darwin builds, to allow Go binaries to be uploaded to the macOS
- App Store.
- </p>
-
- <p><!-- CL 174197 -->
- The new <code>ProcessAttributes</code> and <code>ThreadAttributes</code> fields in
- <a href="/pkg/syscall/?GOOS=windows#SysProcAttr"><code>SysProcAttr</code></a> have been introduced for Windows,
- exposing security settings when creating new processes.
- </p>
-
- <p><!-- CL 174320 -->
- <code>EINVAL</code> is no longer returned in zero
- <a href="/pkg/syscall/?GOOS=windows#Chmod"><code>Chmod</code></a> mode on Windows.
- </p>
-
- <p><!-- CL 191337 -->
- Values of type <code>Errno</code> can be tested against error values in
- the <code>os</code> package,
- like <a href="/pkg/os/#ErrExist"><code>ErrExist</code></a>, using
- <a href="/pkg/errors/#Is"><code>errors.Is</code></a>.
- </p>
-
-</dl><!-- syscall -->
-
-<dl id="syscall/js"><dt><a href="/pkg/syscall/js/">syscall/js</a></dt>
- <dd>
- <p><!-- CL 177537 -->
- <code>TypedArrayOf</code> has been replaced by
- <a href="/pkg/syscall/js/#CopyBytesToGo"><code>CopyBytesToGo</code></a> and
- <a href="/pkg/syscall/js/#CopyBytesToJS"><code>CopyBytesToJS</code></a> for copying bytes
- between a byte slice and a <code>Uint8Array</code>.
- </p>
-
-</dl><!-- syscall/js -->
-
-<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
- <dd>
- <p><!-- CL 112155 -->
- When running benchmarks, <a href="/pkg/testing/#B.N"><code>B.N</code></a> is no longer rounded.
- </p>
-
- <p><!-- CL 166717 -->
- The new method <a href="/pkg/testing/#B.ReportMetric"><code>B.ReportMetric</code></a> lets users report
- custom benchmark metrics and override built-in metrics.
- </p>
-
- <p><!-- CL 173722 -->
- Testing flags are now registered in the new <a href="/pkg/testing/#Init"><code>Init</code></a> function,
- which is invoked by the generated <code>main</code> function for the test.
- As a result, testing flags are now only registered when running a test binary,
- and packages that call <code>flag.Parse</code> during package initialization may cause tests to fail.
- </p>
-
-</dl><!-- testing -->
-
-<dl id="text/scanner"><dt><a href="/pkg/text/scanner/">text/scanner</a></dt>
- <dd>
- <p><!-- CL 183077 -->
- The scanner has been updated to recognize the new Go number literals, specifically
- binary literals with <code>0b</code>/<code>0B</code> prefix, octal literals with <code>0o</code>/<code>0O</code> prefix,
- and floating-point numbers with hexadecimal mantissa.
- Also, the new <a href="/pkg/text/scanner/#AllowDigitSeparators"><code>AllowDigitSeparators</code></a>
- mode allows number literals to contain underscores as digit separators (off by default for backwards-compatibility).
- See the <a href="#language">Changes to the language</a> for details.
- </p>
-
-</dl><!-- text/scanner -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 161762 -->
- The new <a href="/pkg/text/template/#hdr-Functions">slice function</a>
- returns the result of slicing its first argument by the following arguments.
- </p>
-
-</dl><!-- text/template -->
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
- <dd>
- <p><!-- CL 122876 -->
- Day-of-year is now supported by <a href="/pkg/time/#Time.Format"><code>Format</code></a>
- and <a href="/pkg/time/#Parse"><code>Parse</code></a>.
- </p>
-
- <p><!-- CL 167387 -->
- The new <a href="/pkg/time/#Duration"><code>Duration</code></a> methods
- <a href="/pkg/time/#Duration.Microseconds"><code>Microseconds</code></a> and
- <a href="/pkg/time/#Duration.Milliseconds"><code>Milliseconds</code></a> return
- the duration as an integer count of their respectively named units.
- </p>
-
-</dl><!-- time -->
-
-<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
- <dd>
- <p>
- The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
- support throughout the system has been upgraded from Unicode 10.0 to
- <a href="http://www.unicode.org/versions/Unicode11.0.0/">Unicode 11.0</a>,
- which adds 684 new characters, including seven new scripts, and 66 new emoji.
- </p>
-
-</dl><!-- unicode -->
diff --git a/doc/go1.14.html b/doc/go1.14.html
deleted file mode 100644
index 410e0cbf7c..0000000000
--- a/doc/go1.14.html
+++ /dev/null
@@ -1,924 +0,0 @@
-<!--{
- "Title": "Go 1.14 Release Notes",
- "Path": "/doc/go1.14"
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.14</h2>
-
-<p>
- The latest Go release, version 1.14, arrives six months after <a href="go1.13">Go 1.13</a>.
- Most of its changes are in the implementation of the toolchain, runtime, and libraries.
- As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
- We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
- Module support in the <code>go</code> command is now ready for production use,
- and we encourage all users to <a href="https://blog.golang.org/migrating-to-go-modules">migrate to Go
- modules for dependency management</a>. If you are unable to migrate due to a problem in the Go
- toolchain, please ensure that the problem has an
- <a href="https://golang.org/issue?q=is%3Aissue+is%3Aopen+label%3Amodules">open issue</a>
- filed. (If the issue is not on the <code>Go1.15</code> milestone, please let us
- know why it prevents you from migrating so that we can prioritize it
- appropriately.)
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- Per the <a href="https://github.com/golang/proposal/blob/master/design/6977-overlapping-interfaces.md">overlapping interfaces proposal</a>,
- Go 1.14 now permits embedding of interfaces with overlapping method sets:
- methods from an embedded interface may have the same names and identical signatures
- as methods already present in the (embedding) interface. This solves problems that typically
- (but not exclusively) occur with diamond-shaped embedding graphs.
- Explicitly declared methods in an interface must remain
- <a href="https://tip.golang.org/ref/spec#Uniqueness_of_identifiers">unique</a>, as before.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<h3 id="darwin">Darwin</h3>
-
-<p>
- Go 1.14 is the last release that will run on macOS 10.11 El Capitan.
- Go 1.15 will require macOS 10.12 Sierra or later.
-</p>
-
-<p><!-- golang.org/issue/34749 -->
- Go 1.14 is the last Go release to support 32-bit binaries on
- macOS (the <code>darwin/386</code> port). They are no longer
- supported by macOS, starting with macOS 10.15 (Catalina).
- Go continues to support the 64-bit <code>darwin/amd64</code> port.
-</p>
-
-<p><!-- golang.org/issue/34751 -->
- Go 1.14 will likely be the last Go release to support 32-bit
- binaries on iOS, iPadOS, watchOS, and tvOS
- (the <code>darwin/arm</code> port). Go continues to support the
- 64-bit <code>darwin/arm64</code> port.
-</p>
-
-<h3 id="windows">Windows</h3>
-
-<p><!-- CL 203601 -->
- Go binaries on Windows now
- have <a href="https://docs.microsoft.com/en-us/windows/win32/memory/data-execution-prevention">DEP
- (Data Execution Prevention)</a> enabled.
-</p>
-
-<p><!-- CL 202439 -->
- On Windows, creating a file
- via <a href="/pkg/os#CreateFile"><code>os.OpenFile</code></a> with
- the <a href="/pkg/os/#O_CREATE"><code>os.O_CREATE</code></a> flag, or
- via <a href="/pkg/syscall#Open"><code>syscall.Open</code></a> with
- the <a href="/pkg/syscall#O_CREAT"><code>syscall.O_CREAT</code></a>
- flag, will now create the file as read-only if the
- bit <code>0o200</code> (owner write permission) is not set in the
- permission argument. This makes the behavior on Windows more like
- that on Unix systems.
-</p>
-
-<h3 id="wasm">WebAssembly</h3>
-
-<p><!-- CL 203600 -->
- JavaScript values referenced from Go via <code>js.Value</code>
- objects can now be garbage collected.
-</p>
-
-<p><!-- CL 203600 -->
- <code>js.Value</code> values can no longer be compared using
- the <code>==</code> operator, and instead must be compared using
- their <code>Equal</code> method.
-</p>
-
-<p><!-- CL 203600 -->
- <code>js.Value</code> now
- has <code>IsUndefined</code>, <code>IsNull</code>,
- and <code>IsNaN</code> methods.
-</p>
-
-<h3 id="riscv">RISC-V</h3>
-
-<p><!-- Issue 27532 -->
- Go 1.14 contains experimental support for 64-bit RISC-V on Linux
- (<code>GOOS=linux</code>, <code>GOARCH=riscv64</code>). Be aware
- that performance, assembly syntax stability, and possibly
- correctness are a work in progress.
-</p>
-
-<h3 id="freebsd">FreeBSD</h3>
-
-<p><!-- CL 199919 -->
- Go now supports the 64-bit ARM architecture on FreeBSD 12.0 or later (the
- <code>freebsd/arm64</code> port).
-</p>
-
-<h3 id="nacl">Native Client (NaCl)</h3>
-
-<p><!-- golang.org/issue/30439 -->
- As <a href="go1.13#ports">announced</a> in the Go 1.13 release notes,
- Go 1.14 drops support for the Native Client platform (<code>GOOS=nacl</code>).
-</p>
-
-<h3 id="illumos">Illumos</h3>
-
-<p><!-- CL 203758 -->
- The runtime now respects zone CPU caps
- (the <code>zone.cpu-cap</code> resource control)
- for <code>runtime.NumCPU</code> and the default value
- of <code>GOMAXPROCS</code>.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="go-command">Go command</h3>
-
-<h4 id="vendor">Vendoring</h4>
-<!-- golang.org/issue/33848 -->
-
-<p>
- When the main module contains a top-level <code>vendor</code> directory and
- its <code>go.mod</code> file specifies <code>go</code> <code>1.14</code> or
- higher, the <code>go</code> command now defaults to <code>-mod=vendor</code>
- for operations that accept that flag. A new value for that flag,
- <code>-mod=mod</code>, causes the <code>go</code> command to instead load
- modules from the module cache (as when no <code>vendor</code> directory is
- present).
-</p>
-
-<p>
- When <code>-mod=vendor</code> is set (explicitly or by default), the
- <code>go</code> command now verifies that the main module's
- <code>vendor/modules.txt</code> file is consistent with its
- <code>go.mod</code> file.
-</p>
-
-<p>
- <code>go</code> <code>list</code> <code>-m</code> no longer silently omits
- transitive dependencies that do not provide packages in
- the <code>vendor</code> directory. It now fails explicitly if
- <code>-mod=vendor</code> is set and information is requested for a module not
- mentioned in <code>vendor/modules.txt</code>.
-</p>
-
-<h4 id="go-flags">Flags</h4>
-
-<p><!-- golang.org/issue/32502, golang.org/issue/30345 -->
- The <code>go</code> <code>get</code> command no longer accepts
- the <code>-mod</code> flag. Previously, the flag's setting either
- <a href="https://golang.org/issue/30345">was ignored</a> or
- <a href="https://golang.org/issue/32502">caused the build to fail</a>.
-</p>
-
-<p><!-- golang.org/issue/33326 -->
- <code>-mod=readonly</code> is now set by default when the <code>go.mod</code>
- file is read-only and no top-level <code>vendor</code> directory is present.
-</p>
-
-<p><!-- golang.org/issue/31481 -->
- <code>-modcacherw</code> is a new flag that instructs the <code>go</code>
- command to leave newly-created directories in the module cache at their
- default permissions rather than making them read-only.
- The use of this flag makes it more likely that tests or other tools will
- accidentally add files not included in the module's verified checksum.
- However, it allows the use of <code>rm</code> <code>-rf</code>
- (instead of <code>go</code> <code>clean</code> <code>-modcache</code>)
- to remove the module cache.
-</p>
-
-<p><!-- golang.org/issue/34506 -->
- <code>-modfile=file</code> is a new flag that instructs the <code>go</code>
- command to read (and possibly write) an alternate <code>go.mod</code> file
- instead of the one in the module root directory. A file
- named <code>go.mod</code> must still be present in order to determine the
- module root directory, but it is not accessed. When <code>-modfile</code> is
- specified, an alternate <code>go.sum</code> file is also used: its path is
- derived from the <code>-modfile</code> flag by trimming the <code>.mod</code>
- extension and appending <code>.sum</code>.
-</p>
-
-<h4 id="go-env-vars">Environment variables</h4>
-
-<p><!-- golang.org/issue/32966 -->
- <code>GOINSECURE</code> is a new environment variable that instructs
- the <code>go</code> command to not require an HTTPS connection, and to skip
- certificate validation, when fetching certain modules directly from their
- origins. Like the existing <code>GOPRIVATE</code> variable, the value
- of <code>GOINSECURE</code> is a comma-separated list of glob patterns.
-</p>
-
-<h4 id="commands-outside-modules">Commands outside modules</h4>
-
-<p><!-- golang.org/issue/32027 -->
- When module-aware mode is enabled explicitly (by setting
- <code>GO111MODULE=on</code>), most module commands have more
- limited functionality if no <code>go.mod</code> file is present. For
- example, <code>go</code> <code>build</code>,
- <code>go</code> <code>run</code>, and other build commands can only build
- packages in the standard library and packages specified as <code>.go</code>
- files on the command line.
-</p>
-
-<p>
- Previously, the <code>go</code> command would resolve each package path
- to the latest version of a module but would not record the module path
- or version. This resulted in <a href="https://golang.org/issue/32027">slow,
- non-reproducible builds</a>.
-</p>
-
-<p>
- <code>go</code> <code>get</code> continues to work as before, as do
- <code>go</code> <code>mod</code> <code>download</code> and
- <code>go</code> <code>list</code> <code>-m</code> with explicit versions.
-</p>
-
-<h4 id="incompatible-versions"><code>+incompatible</code> versions</h4>
-<!-- golang.org/issue/34165 -->
-
-<p>
- If the latest version of a module contains a <code>go.mod</code> file,
- <code>go</code> <code>get</code> will no longer upgrade to an
- <a href="/cmd/go/#hdr-Module_compatibility_and_semantic_versioning">incompatible</a>
- major version of that module unless such a version is requested explicitly
- or is already required.
- <code>go</code> <code>list</code> also omits incompatible major versions
- for such a module when fetching directly from version control, but may
- include them if reported by a proxy.
-</p>
-
-
-<h4 id="go.mod"><code>go.mod</code> file maintenance</h4>
-<!-- golang.org/issue/34822 -->
-
-<p>
- <code>go</code> commands other than
- <code>go</code> <code>mod</code> <code>tidy</code> no longer
- remove a <code>require</code> directive that specifies a version of an indirect dependency
- that is already implied by other (transitive) dependencies of the main
- module.
-</p>
-
-<p>
- <code>go</code> commands other than
- <code>go</code> <code>mod</code> <code>tidy</code> no longer
- edit the <code>go.mod</code> file if the changes are only cosmetic.
-</p>
-
-<p>
- When <code>-mod=readonly</code> is set, <code>go</code> commands will no
- longer fail due to a missing <code>go</code> directive or an erroneous
- <code>//&nbsp;indirect</code> comment.
-</p>
-
-<h4 id="module-downloading">Module downloading</h4>
-
-<p><!-- golang.org/issue/26092 -->
- The <code>go</code> command now supports Subversion repositories in module mode.
-</p>
-
-<p><!-- golang.org/issue/30748 -->
- The <code>go</code> command now includes snippets of plain-text error messages
- from module proxies and other HTTP servers.
- An error message will only be shown if it is valid UTF-8 and consists of only
- graphic characters and spaces.
-</p>
-
-<h4 id="go-test">Testing</h4>
-
-<p><!-- golang.org/issue/24929 -->
- <code>go test -v</code> now streams <code>t.Log</code> output as it happens,
- rather than at the end of all tests.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p><!-- CL 190098 -->
- This release improves the performance of most uses
- of <code>defer</code> to incur almost zero overhead compared to
- calling the deferred function directly.
- As a result, <code>defer</code> can now be used in
- performance-critical code without overhead concerns.
-</p>
-
-<p><!-- CL 201760, CL 201762 and many others -->
- Goroutines are now asynchronously preemptible.
- As a result, loops without function calls no longer potentially
- deadlock the scheduler or significantly delay garbage collection.
- This is supported on all platforms except <code>windows/arm</code>,
- <code>darwin/arm</code>, <code>js/wasm</code>, and
- <code>plan9/*</code>.
-</p>
-
-<p>
- A consequence of the implementation of preemption is that on Unix
- systems, including Linux and macOS systems, programs built with Go
- 1.14 will receive more signals than programs built with earlier
- releases.
- This means that programs that use packages
- like <a href="/pkg/syscall/"><code>syscall</code></a>
- or <a href="https://godoc.org/golang.org/x/sys/unix"><code>golang.org/x/sys/unix</code></a>
- will see more slow system calls fail with <code>EINTR</code> errors.
- Those programs will have to handle those errors in some way, most
- likely looping to try the system call again. For more
- information about this
- see <a href="http://man7.org/linux/man-pages/man7/signal.7.html"><code>man
- 7 signal</code></a> for Linux systems or similar documentation for
- other systems.
-</p>
-
-<p><!-- CL 201765, CL 195701 and many others -->
- The page allocator is more efficient and incurs significantly less
- lock contention at high values of <code>GOMAXPROCS</code>.
- This is most noticeable as lower latency and higher throughput for
- large allocations being done in parallel and at a high rate.
-</p>
-
-<p><!-- CL 171844 and many others -->
- Internal timers, used by
- <a href="/pkg/time/#After"><code>time.After</code></a>,
- <a href="/pkg/time/#Tick"><code>time.Tick</code></a>,
- <a href="/pkg/net/#Conn"><code>net.Conn.SetDeadline</code></a>,
- and friends, are more efficient, with less lock contention and fewer
- context switches.
- This is a performance improvement that should not cause any user
- visible changes.
-</p>
-
-<h2 id="compiler">Compiler</h2>
-
-<p><!-- CL 162237 -->
- This release adds <code>-d=checkptr</code> as a compile-time option
- for adding instrumentation to check that Go code is following
- <code>unsafe.Pointer</code> safety rules dynamically.
- This option is enabled by default (except on Windows) with
- the <code>-race</code> or <code>-msan</code> flags, and can be
- disabled with <code>-gcflags=all=-d=checkptr=0</code>.
- Specifically, <code>-d=checkptr</code> checks the following:
-</p>
-
-<ol>
- <li>
- When converting <code>unsafe.Pointer</code> to <code>*T</code>,
- the resulting pointer must be aligned appropriately
- for <code>T</code>.
- </li>
- <li>
- If the result of pointer arithmetic points into a Go heap object,
- one of the <code>unsafe.Pointer</code>-typed operands must point
- into the same object.
- </li>
-</ol>
-
-<p>
- Using <code>-d=checkptr</code> is not currently recommended on
- Windows because it causes false alerts in the standard library.
-</p>
-
-<p><!-- CL 204338 -->
- The compiler can now emit machine-readable logs of key optimizations
- using the <code>-json</code> flag, including inlining, escape
- analysis, bounds-check elimination, and nil-check elimination.
-</p>
-
-<p><!-- CL 196959 -->
- Detailed escape analysis diagnostics (<code>-m=2</code>) now work again.
- This had been dropped from the new escape analysis implementation in
- the previous release.
-</p>
-
-<p><!-- CL 196217 -->
- All Go symbols in macOS binaries now begin with an underscore,
- following platform conventions.
-</p>
-
-<p><!-- CL 202117 -->
- This release includes experimental support for compiler-inserted
- coverage instrumentation for fuzzing.
- See <a href="https://golang.org/issue/14565">issue 14565</a> for more
- details.
- This API may change in future releases.
-</p>
-
-<p><!-- CL 174704 --><!-- CL 196784 -->
- Bounds check elimination now uses information from slice creation and can
- eliminate checks for indexes with types smaller than <code>int</code>.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="hash/maphash">New byte sequence hashing package</h3>
-
-<p> <!-- golang.org/issue/28322, CL 186877 -->
- Go 1.14 includes a new package,
- <a href="/pkg/hash/maphash/"><code>hash/maphash</code></a>,
- which provides hash functions on byte sequences.
- These hash functions are intended to be used to implement hash tables or
- other data structures that need to map arbitrary strings or byte
- sequences to a uniform distribution on unsigned 64-bit integers.
-</p>
-<p>
- The hash functions are collision-resistant but not cryptographically secure.
-</p>
-<p>
- The hash value of a given byte sequence is consistent within a
- single process, but will be different in different processes.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p><!-- CL 191976 -->
- Support for SSL version 3.0 (SSLv3) has been removed. Note that SSLv3 is the
- <a href="https://tools.ietf.org/html/rfc7568">cryptographically broken</a>
- protocol predating TLS.
- </p>
-
- <p><!-- CL 191999 -->
- TLS 1.3 can't be disabled via the <code>GODEBUG</code> environment
- variable anymore. Use the
- <a href="/pkg/crypto/tls/#Config.MaxVersion"><code>Config.MaxVersion</code></a>
- field to configure TLS versions.
- </p>
-
- <p><!-- CL 205059 -->
- When multiple certificate chains are provided through the
- <a href="/pkg/crypto/tls/#Config.Certificates"><code>Config.Certificates</code></a>
- field, the first one compatible with the peer is now automatically
- selected. This allows for example providing an ECDSA and an RSA
- certificate, and letting the package automatically select the best one.
- Note that the performance of this selection is going to be poor unless the
- <a href="/pkg/crypto/tls/#Certificate.Leaf"><code>Certificate.Leaf</code></a>
- field is set. The
- <a href="/pkg/crypto/tls/#Config.NameToCertificate"><code>Config.NameToCertificate</code></a>
- field, which only supports associating a single certificate with
- a give name, is now deprecated and should be left as <code>nil</code>.
- Similarly the
- <a href="/pkg/crypto/tls/#Config.BuildNameToCertificate"><code>Config.BuildNameToCertificate</code></a>
- method, which builds the <code>NameToCertificate</code> field
- from the leaf certificates, is now deprecated and should not be
- called.
- </p>
-
- <p><!-- CL 175517 -->
- The new <a href="/pkg/crypto/tls/#CipherSuites"><code>CipherSuites</code></a>
- and <a href="/pkg/crypto/tls/#InsecureCipherSuites"><code>InsecureCipherSuites</code></a>
- functions return a list of currently implemented cipher suites.
- The new <a href="/pkg/crypto/tls/#CipherSuiteName"><code>CipherSuiteName</code></a>
- function returns a name for a cipher suite ID.
- </p>
-
- <p><!-- CL 205058, 205057 -->
- The new <a href="/pkg/crypto/tls/#ClientHelloInfo.SupportsCertificate">
- <code>(*ClientHelloInfo).SupportsCertificate</code></a> and
- <a href="/pkg/crypto/tls/#CertificateRequestInfo.SupportsCertificate">
- <code>(*CertificateRequestInfo).SupportsCertificate</code></a>
- methods expose whether a peer supports a certain certificate.
- </p>
-
- <p><!-- CL 174329 -->
- The <code>tls</code> package no longer supports the legacy Next Protocol
- Negotiation (NPN) extension and now only supports ALPN. In previous
- releases it supported both. There are no API changes and applications
- should function identically as before. Most other clients and servers have
- already removed NPN support in favor of the standardized ALPN.
- </p>
-
- <p><!-- CL 205063, 205062 -->
- RSA-PSS signatures are now used when supported in TLS 1.2 handshakes. This
- won't affect most applications, but custom
- <a href="/pkg/crypto/tls/#Certificate.PrivateKey"><code>Certificate.PrivateKey</code></a>
- implementations that don't support RSA-PSS signatures will need to use the new
- <a href="/pkg/crypto/tls/#Certificate.SupportedSignatureAlgorithms">
- <code>Certificate.SupportedSignatureAlgorithms</code></a>
- field to disable them.
- </p>
-
- <p><!-- CL 205059, 205059 -->
- <a href="/pkg/crypto/tls/#Config.Certificates"><code>Config.Certificates</code></a> and
- <a href="/pkg/crypto/tls/#Config.GetCertificate"><code>Config.GetCertificate</code></a>
- can now both be nil if
- <a href="/pkg/crypto/tls/#Config.GetConfigForClient"><code>Config.GetConfigForClient</code></a>
- is set. If the callbacks return neither certificates nor an error, the
- <code>unrecognized_name</code> is now sent.
- </p>
-
- <p><!-- CL 205058 -->
- The new <a href="/pkg/crypto/tls/#CertificateRequestInfo.Version"><code>CertificateRequestInfo.Version</code></a>
- field provides the TLS version to client certificates callbacks.
- </p>
-
- <p><!-- CL 205068 -->
- The new <code>TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256</code> and
- <code>TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256</code> constants use
- the final names for the cipher suites previously referred to as
- <code>TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305</code> and
- <code>TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305</code>.
- </p>
- </dd>
-</dl><!-- crypto/tls -->
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p><!-- CL 204046 -->
- <a href="/pkg/crypto/x509/#Certificate.CreateCRL"><code>Certificate.CreateCRL</code></a>
- now supports Ed25519 issuers.
- </p>
- </dd>
-</dl>
-
-<dl id="debug/dwarf"><dt><a href="/pkg/debug/dwarf/">debug/dwarf</a></dt>
- <dd>
- <p><!-- CL 175138 -->
- The <code>debug/dwarf</code> package now supports reading DWARF
- version 5.
- </p>
- <p>
- The new
- method <a href="/pkg/debug/dwarf/#Data.AddSection"><code>(*Data).AddSection</code></a>
- supports adding arbitrary new DWARF sections from the input file
- to the DWARF <code>Data</code>.
- </p>
-
- <p><!-- CL 192698 -->
- The new
- method <a href="/pkg/debug/dwarf/#Reader.ByteOrder"><code>(*Reader).ByteOrder</code></a>
- returns the byte order of the current compilation unit.
- This may be used to interpret attributes that are encoded in the
- native ordering, such as location descriptions.
- </p>
-
- <p><!-- CL 192699 -->
- The new
- method <a href="/pkg/debug/dwarf/#LineReader.Files"><code>(*LineReader).Files</code></a>
- returns the file name table from a line reader.
- This may be used to interpret the value of DWARF attributes such
- as <code>AttrDeclFile</code>.
- </p>
- </dd>
-</dl><!-- debug/dwarf -->
-
-<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
- <dd>
- <p><!-- CL 126624 -->
- <a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a>
- now supports ASN.1 string type BMPString, represented by the new
- <a href="/pkg/encoding/asn1/#TagBMPString"><code>TagBMPString</code></a>
- constant.
- </p>
- </dd>
-</dl><!-- encoding/asn1 -->
-
-<dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
- <dd>
- <p><!-- CL 200677 -->
- The <a href="/pkg/encoding/json/#Decoder"><code>Decoder</code></a>
- type supports a new
- method <a href="/pkg/encoding/json/#Decoder.InputOffset"><code>InputOffset</code></a>
- that returns the input stream byte offset of the current
- decoder position.
- </p>
-
- <p><!-- CL 200217 -->
- <a href="/pkg/encoding/json/#Compact"><code>Compact</code></a> no longer
- escapes the <code>U+2028</code> and <code>U+2029</code> characters, which
- was never a documented feature. For proper escaping, see <a
- href="/pkg/encoding/json/#HTMLEscape"><code>HTMLEscape</code></a>.
- </p>
-
- <p><!-- CL 195045 -->
- <a href="/pkg/encoding/json/#Number"><code>Number</code></a> no longer
- accepts invalid numbers, to follow the documented behavior more closely.
- If a program needs to accept invalid numbers like the empty string,
- consider wrapping the type with <a href="/pkg/encoding/json/#Unmarshaler"><code>Unmarshaler</code></a>.
- </p>
-
- <p><!-- CL 200237 -->
- <a href="/pkg/encoding/json/#Unmarshal"><code>Unmarshal</code></a>
- can now support map keys with string underlying type which implement
- <a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>.
- </p>
- </dd>
-</dl><!-- encoding/json -->
-
-<dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
- <dd>
- <p><!-- CL 203820, 211657 -->
- The <a href="/pkg/go/build/#Context"><code>Context</code></a>
- type has a new field <code>Dir</code> which may be used to set
- the working directory for the build.
- The default is the current directory of the running process.
- In module mode, this is used to locate the main module.
- </p>
- </dd>
-</dl><!-- go/build -->
-
-<dl id="go/doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
- <dd>
- <p><!-- CL 204830 -->
- The new
- function <a href="/pkg/go/doc/#NewFromFiles"><code>NewFromFiles</code></a>
- computes package documentation from a list
- of <code>*ast.File</code>'s and associates examples with the
- appropriate package elements.
- The new information is available in a new <code>Examples</code>
- field
- in the <a href="/pkg/go/doc/#Package"><code>Package</code></a>, <a href="/pkg/go/doc/#Type"><code>Type</code></a>,
- and <a href="/pkg/go/doc/#Func"><code>Func</code></a> types, and a
- new <a href="/pkg/go/doc/#Example.Suffix"><code>Suffix</code></a>
- field in
- the <a href="/pkg/go/doc/#Example"><code>Example</code></a>
- type.
- </p>
- </dd>
-</dl><!-- go/doc -->
-
-<dl id="io/ioutil"><dt><a href="/pkg/io/ioutil/">io/ioutil</a></dt>
- <dd>
- <p><!-- CL 198488 -->
- <a href="/pkg/io/ioutil/#TempDir"><code>TempDir</code></a> can now create directories
- whose names have predictable prefixes and suffixes.
- As with <a href="/pkg/io/ioutil/#TempFile"><code>TempFile</code></a>, if the pattern
- contains a '*', the random string replaces the last '*'.
- </p>
- </dd>
-</dl>
-
-<dl id="log"><dt><a href="/pkg/log/">log</a></dt>
- <dd>
- <p><!-- CL 186182 -->
- The
- new <a href="https://tip.golang.org/pkg/log/#pkg-constants"><code>Lmsgprefix</code></a>
- flag may be used to tell the logging functions to emit the
- optional output prefix immediately before the log message rather
- than at the start of the line.
- </p>
- </dd>
-</dl><!-- log -->
-
-<dl id="math"><dt><a href="/pkg/math/">math</a></dt>
- <dd>
- <p><!-- CL 127458 -->
- The new <a href="/pkg/math/#FMA"><code>FMA</code></a> function
- computes <code>x*y+z</code> in floating point with no
- intermediate rounding of the <code>x*y</code>
- computation. Several architectures implement this computation
- using dedicated hardware instructions for additional performance.
- </p>
- </dd>
-</dl><!-- math -->
-
-<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
- <dd>
- <p><!-- CL 164972 -->
- The <a href="/pkg/math/big/#Int.GCD"><code>GCD</code></a> method
- now allows the inputs <code>a</code> and <code>b</code> to be
- zero or negative.
- </p>
- </dd>
-</dl><!-- math/big -->
-
-<dl id="math/bits"><dt><a href="/pkg/math/bits/">math/bits</a></dt>
- <dd>
- <p><!-- CL 197838 -->
- The new functions
- <a href="/pkg/math/bits/#Rem"><code>Rem</code></a>,
- <a href="/pkg/math/bits/#Rem32"><code>Rem32</code></a>, and
- <a href="/pkg/math/bits/#Rem64"><code>Rem64</code></a>
- support computing a remainder even when the quotient overflows.
- </p>
- </dd>
-</dl><!-- math/bits -->
-
-<dl id="mime"><dt><a href="/pkg/mime/">mime</a></dt>
- <dd>
- <p><!-- CL 186927 -->
- The default type of <code>.js</code> and <code>.mjs</code> files
- is now <code>text/javascript</code> rather
- than <code>application/javascript</code>.
- This is in accordance
- with <a href="https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/">an
- IETF draft</a> that treats <code>application/javascript</code> as obsolete.
- </p>
- </dd>
-</dl><!-- mime -->
-
-<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
- <dd>
- <p>
- The
- new <a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a>
- method <a href="/pkg/mime/multipart/#Reader.NextRawPart"><code>NextRawPart</code></a>
- supports fetching the next MIME part without transparently
- decoding <code>quoted-printable</code> data.
- </p>
- </dd>
-</dl><!-- mime/multipart -->
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
- <p><!-- CL 200760 -->
- The new <a href="/pkg/net/http/#Header"><code>Header</code></a>
- method <a href="/pkg/net/http/#Header.Values"><code>Values</code></a>
- can be used to fetch all values associated with a
- canonicalized key.
- </p>
-
- <p><!-- CL 61291 -->
- The
- new <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
- field <a href="/pkg/net/http/#Transport.DialTLSContext"><code>DialTLSContext</code></a>
- can be used to specify an optional dial function for creating
- TLS connections for non-proxied HTTPS requests.
- This new field can be used instead
- of <a href="/pkg/net/http/#Transport.DialTLS"><code>DialTLS</code></a>,
- which is now considered deprecated; <code>DialTLS</code> will
- continue to work, but new code should
- use <code>DialTLSContext</code>, which allows the transport to
- cancel dials as soon as they are no longer needed.
- </p>
-
- <p><!-- CL 192518, CL 194218 -->
- On Windows, <a href="/pkg/net/http/#ServeFile"><code>ServeFile</code></a> now correctly
- serves files larger than 2GB.
- </p>
- </dd>
-</dl><!-- net/http -->
-
-<dl id="net/http/httptest"><dt><a href="/pkg/net/http/httptest/">net/http/httptest</a></dt>
- <dd>
- <p><!-- CL 201557 -->
- The
- new <a href="/pkg/net/http/httptest/#Server"><code>Server</code></a>
- field <a href="/pkg/net/http/httptest/#Server.EnableHTTP2"><code>EnableHTTP2</code></a>
- supports enabling HTTP/2 on the test server.
- </p>
- </dd>
-</dl><!-- net/http/httptest -->
-
-<dl id="net/textproto"><dt><a href="/pkg/net/textproto/">net/textproto</a></dt>
- <dd>
- <p><!-- CL 200760 -->
- The
- new <a href="/pkg/net/textproto/#MIMEHeader"><code>MIMEHeader</code></a>
- method <a href="/pkg/net/textproto/#MIMEHeader.Values"><code>Values</code></a>
- can be used to fetch all values associated with a canonicalized
- key.
- </p>
- </dd>
-</dl><!-- net/textproto -->
-
-<dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt>
- <dd>
- <p><!-- CL 185117 -->
- When parsing of a URL fails
- (for example by <a href="/pkg/net/url/#Parse"><code>Parse</code></a>
- or <a href="/pkg/net/url/#ParseRequestURI"><code>ParseRequestURI</code></a>),
- the resulting <a href="/pkg/net/url/#Error.Error"><code>Error</code></a> message
- will now quote the unparsable URL.
- This provides clearer structure and consistency with other parsing errors.
- </p>
- </dd>
-</dl><!-- net/url -->
-
-<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
- <dd>
- <p><!-- CL 187739 -->
- On Windows,
- the <code>CTRL_CLOSE_EVENT</code>, <code>CTRL_LOGOFF_EVENT</code>,
- and <code>CTRL_SHUTDOWN_EVENT</code> events now generate
- a <code>syscall.SIGTERM</code> signal, similar to how Control-C
- and Control-Break generate a <code>syscall.SIGINT</code> signal.
- </p>
- </dd>
-</dl><!-- os/signal -->
-
-<dl id="plugin"><dt><a href="/pkg/plugin/">plugin</a></dt>
- <dd>
- <p><!-- CL 191617 -->
- The <code>plugin</code> package now supports <code>freebsd/amd64</code>.
- </p>
- </dd>
-</dl><!-- plugin -->
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
- <dd>
- <p><!-- CL 85661 -->
- <a href="/pkg/reflect#StructOf"><code>StructOf</code></a> now
- supports creating struct types with unexported fields, by
- setting the <code>PkgPath</code> field in
- a <code>StructField</code> element.
- </p>
- </dd>
-</dl><!-- reflect -->
-
-<dl id="pkg-runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
- <dd>
- <p><!-- CL 200081 -->
- <code>runtime.Goexit</code> can no longer be aborted by a
- recursive <code>panic</code>/<code>recover</code>.
- </p>
-
- <p><!-- CL 188297, CL 191785 -->
- On macOS, <code>SIGPIPE</code> is no longer forwarded to signal
- handlers installed before the Go runtime is initialized.
- This is necessary because macOS delivers <code>SIGPIPE</code>
- <a href="https://golang.org/issue/33384">to the main thread</a>
- rather than the thread writing to the closed pipe.
- </p>
- </dd>
-</dl><!-- runtime -->
-
-<dl id="runtime/pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt>
- <dd>
- <p><!-- CL 204636, 205097 -->
- The generated profile no longer includes the pseudo-PCs used for inline
- marks. Symbol information of inlined functions is encoded in
- <a href="https://github.com/google/pprof/blob/5e96527/proto/profile.proto#L177-L184">the format</a>
- the pprof tool expects. This is a fix for the regression introduced
- during recent releases.
- </p>
- </dd>
-</dl><!-- runtime/pprof -->
-
-<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
- <dd>
- <p>
- The <a href="/pkg/strconv/#NumError"><code>NumError</code></a>
- type now has
- an <a href="/pkg/strconv/#NumError.Unwrap"><code>Unwrap</code></a>
- method that may be used to retrieve the reason that a conversion
- failed.
- This supports using <code>NumError</code> values
- with <a href="/pkg/errors/#Is"><code>errors.Is</code></a> to see
- if the underlying error
- is <a href="/pkg/strconv/#pkg-variables"><code>strconv.ErrRange</code></a>
- or <a href="/pkg/strconv/#pkg-variables"><code>strconv.ErrSyntax</code></a>.
- </p>
- </dd>
-</dl><!-- strconv -->
-
-<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
- <dd>
- <p><!-- CL 200577 -->
- Unlocking a highly contended <code>Mutex</code> now directly
- yields the CPU to the next goroutine waiting for
- that <code>Mutex</code>. This significantly improves the
- performance of highly contended mutexes on high CPU count
- machines.
- </p>
- </dd>
-</dl><!-- sync -->
-
-<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
- <dd>
- <p><!-- CL 201359 -->
- The testing package now supports cleanup functions, called after
- a test or benchmark has finished, by calling
- <a href="/pkg/testing#T.Cleanup"><code>T.Cleanup</code></a> or
- <a href="/pkg/testing#B.Cleanup"><code>B.Cleanup</code></a> respectively.
- </p>
- </dd>
-</dl><!-- testing -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 206124 -->
- The text/template package now correctly reports errors when a
- parenthesized argument is used as a function.
- This most commonly shows up in erroneous cases like
- <code>{{if (eq .F "a") or (eq .F "b")}}</code>.
- This should be written as <code>{{if or (eq .F "a") (eq .F "b")}}</code>.
- The erroneous case never worked as expected, and will now be
- reported with an error <code>can't give argument to non-function</code>.
- </p>
- </dd>
-</dl><!-- text/template -->
-
-<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
- <dd>
- <p>
- The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
- support throughout the system has been upgraded from Unicode 11.0 to
- <a href="https://www.unicode.org/versions/Unicode12.0.0/">Unicode 12.0</a>,
- which adds 554 new characters, including four new scripts, and 61 new emoji.
- </p>
- </dd>
-</dl><!-- unicode -->
diff --git a/doc/go1.15.html b/doc/go1.15.html
deleted file mode 100644
index c9997c0ca3..0000000000
--- a/doc/go1.15.html
+++ /dev/null
@@ -1,1064 +0,0 @@
-<!--{
- "Title": "Go 1.15 Release Notes",
- "Path": "/doc/go1.15"
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.15</h2>
-
-<p>
- The latest Go release, version 1.15, arrives six months after <a href="go1.14">Go 1.14</a>.
- Most of its changes are in the implementation of the toolchain, runtime, and libraries.
- As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
- We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
- Go 1.15 includes <a href="#linker">substantial improvements to the linker</a>,
- improves <a href="#runtime">allocation for small objects at high core counts</a>, and
- deprecates <a href="#commonname">X.509 CommonName</a>.
- <code>GOPROXY</code> now supports skipping proxies that return errors and
- a new <a href="#time/tzdata">embedded tzdata package</a> has been added.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- There are no changes to the language.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<h3 id="darwin">Darwin</h3>
-
-<p>
- As <a href="go1.14#darwin">announced</a> in the Go 1.14 release
- notes, Go 1.15 requires macOS 10.12 Sierra or later; support for
- previous versions has been discontinued.
-</p>
-
-<p> <!-- golang.org/issue/37610, golang.org/issue/37611, CL 227582, and CL 227198 -->
- As <a href="/doc/go1.14#darwin">announced</a> in the Go 1.14 release
- notes, Go 1.15 drops support for 32-bit binaries on macOS, iOS,
- iPadOS, watchOS, and tvOS (the <code>darwin/386</code>
- and <code>darwin/arm</code> ports). Go continues to support the
- 64-bit <code>darwin/amd64</code> and <code>darwin/arm64</code> ports.
-</p>
-
-<h3 id="windows">Windows</h3>
-
-<p> <!-- CL 214397 and CL 230217 -->
- Go now generates Windows ASLR executables when <code>-buildmode=pie</code>
- cmd/link flag is provided. Go command uses <code>-buildmode=pie</code>
- by default on Windows.
-</p>
-
-<p><!-- CL 227003 -->
- The <code>-race</code> and <code>-msan</code> flags now always
- enable <code>-d=checkptr</code>, which checks uses
- of <code>unsafe.Pointer</code>. This was previously the case on all
- OSes except Windows.
-</p>
-
-<p><!-- CL 211139 -->
- Go-built DLLs no longer cause the process to exit when it receives a
- signal (such as Ctrl-C at a terminal).
-</p>
-
-<h3 id="android">Android</h3>
-
-<p> <!-- CL 235017, golang.org/issue/38838 -->
- When linking binaries for Android, Go 1.15 explicitly selects
- the <code>lld</code> linker available in recent versions of the NDK.
- The <code>lld</code> linker avoids crashes on some devices, and is
- planned to become the default NDK linker in a future NDK version.
-</p>
-
-<h3 id="openbsd">OpenBSD</h3>
-
-<p><!-- CL 234381 -->
- Go 1.15 adds support for OpenBSD 6.7 on <code>GOARCH=arm</code>
- and <code>GOARCH=arm64</code>. Previous versions of Go already
- supported OpenBSD 6.7 on <code>GOARCH=386</code>
- and <code>GOARCH=amd64</code>.
-</p>
-
-<h3 id="riscv">RISC-V</h3>
-
-<p> <!-- CL 226400, CL 226206, and others -->
- There has been progress in improving the stability and performance
- of the 64-bit RISC-V port on Linux (<code>GOOS=linux</code>,
- <code>GOARCH=riscv64</code>). It also now supports asynchronous
- preemption.
-</p>
-
-<h3 id="386">386</h3>
-
-<p><!-- golang.org/issue/40255 -->
- Go 1.15 is the last release to support x87-only floating-point
- hardware (<code>GO386=387</code>). Future releases will require at
- least SSE2 support on 386, raising Go's
- minimum <code>GOARCH=386</code> requirement to the Intel Pentium 4
- (released in 2000) or AMD Opteron/Athlon 64 (released in 2003).
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="go-command">Go command</h3>
-
-<p><!-- golang.org/issue/37367 -->
- The <code>GOPROXY</code> environment variable now supports skipping proxies
- that return errors. Proxy URLs may now be separated with either commas
- (<code>,</code>) or pipe characters (<code>|</code>). If a proxy URL is
- followed by a comma, the <code>go</code> command will only try the next proxy
- in the list after a 404 or 410 HTTP response. If a proxy URL is followed by a
- pipe character, the <code>go</code> command will try the next proxy in the
- list after any error. Note that the default value of <code>GOPROXY</code>
- remains <code>https://proxy.golang.org,direct</code>, which does not fall
- back to <code>direct</code> in case of errors.
-</p>
-
-<h4 id="go-test"><code>go</code> <code>test</code></h4>
-
-<p><!-- https://golang.org/issue/36134 -->
- Changing the <code>-timeout</code> flag now invalidates cached test results. A
- cached result for a test run with a long timeout will no longer count as
- passing when <code>go</code> <code>test</code> is re-invoked with a short one.
-</p>
-
-<h4 id="go-flag-parsing">Flag parsing</h4>
-
-<p><!-- https://golang.org/cl/211358 -->
- Various flag parsing issues in <code>go</code> <code>test</code> and
- <code>go</code> <code>vet</code> have been fixed. Notably, flags specified
- in <code>GOFLAGS</code> are handled more consistently, and
- the <code>-outputdir</code> flag now interprets relative paths relative to the
- working directory of the <code>go</code> command (rather than the working
- directory of each individual test).
-</p>
-
-<h4 id="module-cache">Module cache</h4>
-
-<p><!-- https://golang.org/cl/219538 -->
- The location of the module cache may now be set with
- the <code>GOMODCACHE</code> environment variable. The default value of
- <code>GOMODCACHE</code> is <code>GOPATH[0]/pkg/mod</code>, the location of the
- module cache before this change.
-</p>
-
-<p><!-- https://golang.org/cl/221157 -->
- A workaround is now available for Windows "Access is denied" errors in
- <code>go</code> commands that access the module cache, caused by external
- programs concurrently scanning the file system (see
- <a href="https://golang.org/issue/36568">issue #36568</a>). The workaround is
- not enabled by default because it is not safe to use when Go versions lower
- than 1.14.2 and 1.13.10 are running concurrently with the same module cache.
- It can be enabled by explicitly setting the environment variable
- <code>GODEBUG=modcacheunzipinplace=1</code>.
-</p>
-
-<h3 id="vet">Vet</h3>
-
-<h4 id="vet-string-int">New warning for string(x)</h4>
-
-<p><!-- CL 212919, 232660 -->
- The vet tool now warns about conversions of the
- form <code>string(x)</code> where <code>x</code> has an integer type
- other than <code>rune</code> or <code>byte</code>.
- Experience with Go has shown that many conversions of this form
- erroneously assume that <code>string(x)</code> evaluates to the
- string representation of the integer <code>x</code>.
- It actually evaluates to a string containing the UTF-8 encoding of
- the value of <code>x</code>.
- For example, <code>string(9786)</code> does not evaluate to the
- string <code>"9786"</code>; it evaluates to the
- string <code>"\xe2\x98\xba"</code>, or <code>"☺"</code>.
-</p>
-
-<p>
- Code that is using <code>string(x)</code> correctly can be rewritten
- to <code>string(rune(x))</code>.
- Or, in some cases, calling <code>utf8.EncodeRune(buf, x)</code> with
- a suitable byte slice <code>buf</code> may be the right solution.
- Other code should most likely use <code>strconv.Itoa</code>
- or <code>fmt.Sprint</code>.
-</p>
-
-<p>
- This new vet check is enabled by default when
- using <code>go</code> <code>test</code>.
-</p>
-
-<p>
- We are considering prohibiting the conversion in a future release of Go.
- That is, the language would change to only
- permit <code>string(x)</code> for integer <code>x</code> when the
- type of <code>x</code> is <code>rune</code> or <code>byte</code>.
- Such a language change would not be backward compatible.
- We are using this vet check as a first trial step toward changing
- the language.
-</p>
-
-<h4 id="vet-impossible-interface">New warning for impossible interface conversions</h4>
-
-<p><!-- CL 218779, 232660 -->
- The vet tool now warns about type assertions from one interface type
- to another interface type when the type assertion will always fail.
- This will happen if both interface types implement a method with the
- same name but with a different type signature.
-</p>
-
-<p>
- There is no reason to write a type assertion that always fails, so
- any code that triggers this vet check should be rewritten.
-</p>
-
-<p>
- This new vet check is enabled by default when
- using <code>go</code> <code>test</code>.
-</p>
-
-<p>
- We are considering prohibiting impossible interface type assertions
- in a future release of Go.
- Such a language change would not be backward compatible.
- We are using this vet check as a first trial step toward changing
- the language.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p><!-- CL 221779 -->
- If <code>panic</code> is invoked with a value whose type is derived from any
- of: <code>bool</code>, <code>complex64</code>, <code>complex128</code>, <code>float32</code>, <code>float64</code>,
- <code>int</code>, <code>int8</code>, <code>int16</code>, <code>int32</code>, <code>int64</code>, <code>string</code>,
- <code>uint</code>, <code>uint8</code>, <code>uint16</code>, <code>uint32</code>, <code>uint64</code>, <code>uintptr</code>,
- then the value will be printed, instead of just its address.
- Previously, this was only true for values of exactly these types.
-</p>
-
-<p><!-- CL 228900 -->
- On a Unix system, if the <code>kill</code> command
- or <code>kill</code> system call is used to send
- a <code>SIGSEGV</code>, <code>SIGBUS</code>,
- or <code>SIGFPE</code> signal to a Go program, and if the signal
- is not being handled via
- <a href="/pkg/os/signal/#Notify"><code>os/signal.Notify</code></a>,
- the Go program will now reliably crash with a stack trace.
- In earlier releases the behavior was unpredictable.
-</p>
-
-<p><!-- CL 221182, CL 229998 -->
- Allocation of small objects now performs much better at high core
- counts, and has lower worst-case latency.
-</p>
-
-<p><!-- CL 216401 -->
- Converting a small integer value into an interface value no longer
- causes allocation.
-</p>
-
-<p><!-- CL 216818 -->
- Non-blocking receives on closed channels now perform as well as
- non-blocking receives on open channels.
-</p>
-
-<h2 id="compiler">Compiler</h2>
-
-<p><!-- CL 229578 -->
- Package <code>unsafe</code>'s <a href="/pkg/unsafe/#Pointer">safety
- rules</a> allow converting an <code>unsafe.Pointer</code>
- into <code>uintptr</code> when calling certain
- functions. Previously, in some cases, the compiler allowed multiple
- chained conversions (for example, <code>syscall.Syscall(…,</code>
- <code>uintptr(uintptr(ptr)),</code> <code>…)</code>). The compiler
- now requires exactly one conversion. Code that used multiple
- conversions should be updated to satisfy the safety rules.
-</p>
-
-<p><!-- CL 230544, CL 231397 -->
- Go 1.15 reduces typical binary sizes by around 5% compared to Go
- 1.14 by eliminating certain types of GC metadata and more
- aggressively eliminating unused type metadata.
-</p>
-
-<p><!-- CL 219357, CL 231600 -->
- The toolchain now mitigates
- <a href="https://www.intel.com/content/www/us/en/support/articles/000055650/processors.html">Intel
- CPU erratum SKX102</a> on <code>GOARCH=amd64</code> by aligning
- functions to 32 byte boundaries and padding jump instructions. While
- this padding increases binary sizes, this is more than made up for
- by the binary size improvements mentioned above.
-</p>
-
-<p><!-- CL 222661 -->
- Go 1.15 adds a <code>-spectre</code> flag to both the
- compiler and the assembler, to allow enabling Spectre mitigations.
- These should almost never be needed and are provided mainly as a
- “defense in depth” mechanism.
- See the <a href="https://github.com/golang/go/wiki/Spectre">Spectre wiki page</a> for details.
-</p>
-
-<p><!-- CL 228578 -->
- The compiler now rejects <code>//go:</code> compiler directives that
- have no meaning for the declaration they are applied to with a
- "misplaced compiler directive" error. Such misapplied directives
- were broken before, but were silently ignored by the compiler.
-</p>
-
-<p><!-- CL 206658, CL 205066 -->
- The compiler's <code>-json</code> optimization logging now reports
- large (>= 128 byte) copies and includes explanations of escape
- analysis decisions.
-</p>
-
-<h2 id="linker">Linker</h2>
-
-<p>
- This release includes substantial improvements to the Go linker,
- which reduce linker resource usage (both time and memory) and
- improve code robustness/maintainability.
-</p>
-
-<p>
- For a representative set of large Go programs, linking is 20% faster
- and requires 30% less memory on average, for <code>ELF</code>-based
- OSes (Linux, FreeBSD, NetBSD, OpenBSD, Dragonfly, and Solaris)
- running on <code>amd64</code> architectures, with more modest
- improvements for other architecture/OS combinations.
-</p>
-
-<p>
- The key contributors to better linker performance are a newly
- redesigned object file format, and a revamping of internal
- phases to increase concurrency (for example, applying relocations to
- symbols in parallel). Object files in Go 1.15 are slightly larger
- than their 1.14 equivalents.
-</p>
-
-<p>
- These changes are part of a multi-release project
- to <a href="https://golang.org/s/better-linker">modernize the Go
- linker</a>, meaning that there will be additional linker
- improvements expected in future releases.
-</p>
-
-<p><!-- CL 207877 -->
- The linker now defaults to internal linking mode
- for <code>-buildmode=pie</code> on
- <code>linux/amd64</code> and <code>linux/arm64</code>, so these
- configurations no longer require a C linker. External linking
- mode (which was the default in Go 1.14 for
- <code>-buildmode=pie</code>) can still be requested with
- <code>-ldflags=-linkmode=external</code> flag.
-</p>
-
-<h2 id="objdump">Objdump</h2>
-
-<p><!-- CL 225459 -->
- The <a href="/cmd/objdump/">objdump</a> tool now supports
- disassembling in GNU assembler syntax with the <code>-gnu</code>
- flag.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="time/tzdata">New embedded tzdata package</h3>
-
-<p> <!-- CL 224588 -->
- Go 1.15 includes a new package,
- <a href="/pkg/time/tzdata/"><code>time/tzdata</code></a>,
- that permits embedding the timezone database into a program.
- Importing this package (as <code>import _ "time/tzdata"</code>)
- permits the program to find timezone information even if the
- timezone database is not available on the local system.
- You can also embed the timezone database by building
- with <code>-tags timetzdata</code>.
- Either approach increases the size of the program by about 800 KB.
-</p>
-
-<h3 id="cgo">Cgo</h3>
-
-<p><!-- CL 235817 -->
- Go 1.15 will translate the C type <code>EGLConfig</code> to the
- Go type <code>uintptr</code>. This change is similar to how Go
- 1.12 and newer treats <code>EGLDisplay</code>, Darwin's CoreFoundation and
- Java's JNI types. See the <a href="/cmd/cgo/#hdr-Special_cases">cgo
- documentation</a> for more information.
-</p>
-
-<p><!-- CL 250940 -->
- In Go 1.15.3 and later, cgo will not permit Go code to allocate an
- undefined struct type (a C struct defined as just <code>struct
- S;</code> or similar) on the stack or heap.
- Go code will only be permitted to use pointers to those types.
- Allocating an instance of such a struct and passing a pointer, or a
- full struct value, to C code was always unsafe and unlikely to work
- correctly; it is now forbidden.
- The fix is to either rewrite the Go code to use only pointers, or to
- ensure that the Go code sees the full definition of the struct by
- including the appropriate C header file.
-</p>
-
-<h3 id="commonname">X.509 CommonName deprecation</h3>
-
-<p><!-- CL 231379 -->
- The deprecated, legacy behavior of treating the <code>CommonName</code>
- field on X.509 certificates as a host name when no Subject Alternative Names
- are present is now disabled by default. It can be temporarily re-enabled by
- adding the value <code>x509ignoreCN=0</code> to the <code>GODEBUG</code>
- environment variable.
-</p>
-
-<p>
- Note that if the <code>CommonName</code> is an invalid host name, it's always
- ignored, regardless of <code>GODEBUG</code> settings. Invalid names include
- those with any characters other than letters, digits, hyphens and underscores,
- and those with empty labels or trailing dots.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt>
- <dd>
- <p><!-- CL 225357, CL 225557 -->
- When a <a href="/pkg/bufio/#Scanner"><code>Scanner</code></a> is
- used with an invalid
- <a href="/pkg/io/#Reader"><code>io.Reader</code></a> that
- incorrectly returns a negative number from <code>Read</code>,
- the <code>Scanner</code> will no longer panic, but will instead
- return the new error
- <a href="/pkg/bufio/#ErrBadReadCount"><code>ErrBadReadCount</code></a>.
- </p>
- </dd>
-</dl><!-- bufio -->
-
-<dl id="context"><dt><a href="/pkg/context/">context</a></dt>
- <dd>
- <p><!-- CL 223777 -->
- Creating a derived <code>Context</code> using a nil parent is now explicitly
- disallowed. Any attempt to do so with the
- <a href="/pkg/context/#WithValue"><code>WithValue</code></a>,
- <a href="/pkg/context/#WithDeadline"><code>WithDeadline</code></a>, or
- <a href="/pkg/context/#WithCancel"><code>WithCancel</code></a> functions
- will cause a panic.
- </p>
- </dd>
-</dl><!-- context -->
-
-<dl id="crypto"><dt><a href="/pkg/crypto/">crypto</a></dt>
- <dd>
- <p><!-- CL 231417, CL 225460 -->
- The <code>PrivateKey</code> and <code>PublicKey</code> types in the
- <a href="/pkg/crypto/rsa/"><code>crypto/rsa</code></a>,
- <a href="/pkg/crypto/ecdsa/"><code>crypto/ecdsa</code></a>, and
- <a href="/pkg/crypto/ed25519/"><code>crypto/ed25519</code></a> packages
- now have an <code>Equal</code> method to compare keys for equivalence
- or to make type-safe interfaces for public keys. The method signature
- is compatible with
- <a href="https://pkg.go.dev/github.com/google/go-cmp/cmp#Equal"><code>go-cmp</code>'s
- definition of equality</a>.
- </p>
-
- <p><!-- CL 224937 -->
- <a href="/pkg/crypto/#Hash"><code>Hash</code></a> now implements
- <a href="/pkg/fmt/#Stringer"><code>fmt.Stringer</code></a>.
- </p>
- </dd>
-</dl><!-- crypto -->
-
-<dl id="crypto/ecdsa"><dt><a href="/pkg/crypto/ecdsa/">crypto/ecdsa</a></dt>
- <dd>
- <p><!-- CL 217940 -->
- The new <a href="/pkg/crypto/ecdsa/#SignASN1"><code>SignASN1</code></a>
- and <a href="/pkg/crypto/ecdsa/#VerifyASN1"><code>VerifyASN1</code></a>
- functions allow generating and verifying ECDSA signatures in the standard
- ASN.1 DER encoding.
- </p>
- </dd>
-</dl><!-- crypto/ecdsa -->
-
-<dl id="crypto/elliptic"><dt><a href="/pkg/crypto/elliptic/">crypto/elliptic</a></dt>
- <dd>
- <p><!-- CL 202819 -->
- The new <a href="/pkg/crypto/elliptic/#MarshalCompressed"><code>MarshalCompressed</code></a>
- and <a href="/pkg/crypto/elliptic/#UnmarshalCompressed"><code>UnmarshalCompressed</code></a>
- functions allow encoding and decoding NIST elliptic curve points in compressed format.
- </p>
- </dd>
-</dl><!-- crypto/elliptic -->
-
-<dl id="crypto/rsa"><dt><a href="/pkg/crypto/rsa/">crypto/rsa</a></dt>
- <dd>
- <p><!-- CL 226203 -->
- <a href="/pkg/crypto/rsa/#VerifyPKCS1v15"><code>VerifyPKCS1v15</code></a>
- now rejects invalid short signatures with missing leading zeroes, according to RFC 8017.
- </p>
- </dd>
-</dl><!-- crypto/rsa -->
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p><!-- CL 214977 -->
- The new
- <a href="/pkg/crypto/tls/#Dialer"><code>Dialer</code></a>
- type and its
- <a href="/pkg/crypto/tls/#Dialer.DialContext"><code>DialContext</code></a>
- method permit using a context to both connect and handshake with a TLS server.
- </p>
-
- <p><!-- CL 229122 -->
- The new
- <a href="/pkg/crypto/tls/#Config.VerifyConnection"><code>VerifyConnection</code></a>
- callback on the <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> type
- allows custom verification logic for every connection. It has access to the
- <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
- which includes peer certificates, SCTs, and stapled OCSP responses.
- </p>
-
- <p><!-- CL 230679 -->
- Auto-generated session ticket keys are now automatically rotated every 24 hours,
- with a lifetime of 7 days, to limit their impact on forward secrecy.
- </p>
-
- <p><!-- CL 231317 -->
- Session ticket lifetimes in TLS 1.2 and earlier, where the session keys
- are reused for resumed connections, are now limited to 7 days, also to
- limit their impact on forward secrecy.
- </p>
-
- <p><!-- CL 231038 -->
- The client-side downgrade protection checks specified in RFC 8446 are now
- enforced. This has the potential to cause connection errors for clients
- encountering middleboxes that behave like unauthorized downgrade attacks.
- </p>
-
- <p><!-- CL 208226 -->
- <a href="/pkg/crypto/tls/#SignatureScheme"><code>SignatureScheme</code></a>,
- <a href="/pkg/crypto/tls/#CurveID"><code>CurveID</code></a>, and
- <a href="/pkg/crypto/tls/#ClientAuthType"><code>ClientAuthType</code></a>
- now implement <a href="/pkg/fmt/#Stringer"><code>fmt.Stringer</code></a>.
- </p>
-
- <p><!-- CL 236737 -->
- The <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
- fields <code>OCSPResponse</code> and <code>SignedCertificateTimestamps</code>
- are now repopulated on client-side resumed connections.
- </p>
-
- <p><!-- CL 227840 -->
- <a href="/pkg/crypto/tls/#Conn"><code>tls.Conn</code></a>
- now returns an opaque error on permanently broken connections, wrapping
- the temporary
- <a href="/pkg/net/http/#Error"><code>net.Error</code></a>. To access the
- original <code>net.Error</code>, use
- <a href="/pkg/errors/#As"><code>errors.As</code></a> (or
- <a href="/pkg/errors/#Unwrap"><code>errors.Unwrap</code></a>) instead of a
- type assertion.
- </p>
- </dd>
-</dl><!-- crypto/tls -->
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p><!-- CL 231378, CL 231380, CL 231381 -->
- If either the name on the certificate or the name being verified (with
- <a href="/pkg/crypto/x509/#VerifyOptions.DNSName"><code>VerifyOptions.DNSName</code></a>
- or <a href="/pkg/crypto/x509/#Certificate.VerifyHostname"><code>VerifyHostname</code></a>)
- are invalid, they will now be compared case-insensitively without further
- processing (without honoring wildcards or stripping trailing dots).
- Invalid names include those with any characters other than letters,
- digits, hyphens and underscores, those with empty labels, and names on
- certificates with trailing dots.
- </p>
-
- <p><!-- CL 217298 -->
- The new <a href="/pkg/crypto/x509/#CreateRevocationList"><code>CreateRevocationList</code></a>
- function and <a href="/pkg/crypto/x509/#RevocationList"><code>RevocationList</code></a> type
- allow creating RFC 5280-compliant X.509 v2 Certificate Revocation Lists.
- </p>
-
- <p><!-- CL 227098 -->
- <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
- now automatically generates the <code>SubjectKeyId</code> if the template
- is a CA and doesn't explicitly specify one.
- </p>
-
- <p><!-- CL 228777 -->
- <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
- now returns an error if the template specifies <code>MaxPathLen</code> but is not a CA.
- </p>
-
- <p><!-- CL 205237 -->
- On Unix systems other than macOS, the <code>SSL_CERT_DIR</code>
- environment variable can now be a colon-separated list.
- </p>
-
- <p><!-- CL 227037 -->
- On macOS, binaries are now always linked against
- <code>Security.framework</code> to extract the system trust roots,
- regardless of whether cgo is available. The resulting behavior should be
- more consistent with the OS verifier.
- </p>
- </dd>
-</dl><!-- crypto/x509 -->
-
-<dl id="crypto/x509/pkix"><dt><a href="/pkg/crypto/x509/pkix/">crypto/x509/pkix</a></dt>
- <dd>
- <p><!-- CL 229864, CL 240543 -->
- <a href="/pkg/crypto/x509/pkix/#Name.String"><code>Name.String</code></a>
- now prints non-standard attributes from
- <a href="/pkg/crypto/x509/pkix/#Name.Names"><code>Names</code></a> if
- <a href="/pkg/crypto/x509/pkix/#Name.ExtraNames"><code>ExtraNames</code></a> is nil.
- </p>
- </dd>
-</dl><!-- crypto/x509/pkix -->
-
-<dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
- <dd>
- <p><!-- CL 145758 -->
- The new <a href="/pkg/database/sql/#DB.SetConnMaxIdleTime"><code>DB.SetConnMaxIdleTime</code></a>
- method allows removing a connection from the connection pool after
- it has been idle for a period of time, without regard to the total
- lifespan of the connection. The <a href="/pkg/database/sql/#DBStats.MaxIdleTimeClosed"><code>DBStats.MaxIdleTimeClosed</code></a>
- field shows the total number of connections closed due to
- <code>DB.SetConnMaxIdleTime</code>.
- </p>
-
- <p><!-- CL 214317 -->
- The new <a href="/pkg/database/sql/#Row.Err"><code>Row.Err</code></a> getter
- allows checking for query errors without calling
- <code>Row.Scan</code>.
- </p>
- </dd>
-</dl><!-- database/sql -->
-
-<dl id="database/sql/driver"><dt><a href="/pkg/database/sql/driver/">database/sql/driver</a></dt>
- <dd>
- <p><!-- CL 174122 -->
- The new <a href="/pkg/database/sql/driver/#Validator"><code>Validator</code></a>
- interface may be implemented by <code>Conn</code> to allow drivers
- to signal if a connection is valid or if it should be discarded.
- </p>
- </dd>
-</dl><!-- database/sql/driver -->
-
-<dl id="debug/pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
- <dd>
- <p><!-- CL 222637 -->
- The package now defines the
- <code>IMAGE_FILE</code>, <code>IMAGE_SUBSYSTEM</code>,
- and <code>IMAGE_DLLCHARACTERISTICS</code> constants used by the
- PE file format.
- </p>
- </dd>
-</dl><!-- debug/pe -->
-
-<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
- <dd>
- <p><!-- CL 226984 -->
- <a href="/pkg/encoding/asn1/#Marshal"><code>Marshal</code></a> now sorts the components
- of SET OF according to X.690 DER.
- </p>
-
- <p><!-- CL 227320 -->
- <a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a> now rejects tags and
- Object Identifiers which are not minimally encoded according to X.690 DER.
- </p>
- </dd>
-</dl><!-- encoding/asn1 -->
-
-<dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
- <dd>
- <p><!-- CL 199837 -->
- The package now has an internal limit to the maximum depth of
- nesting when decoding. This reduces the possibility that a
- deeply nested input could use large quantities of stack memory,
- or even cause a "goroutine stack exceeds limit" panic.
- </p>
- </dd>
-</dl><!-- encoding/json -->
-
-<dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
- <dd>
- <p><!-- CL 221427 -->
- When the <code>flag</code> package sees <code>-h</code> or <code>-help</code>,
- and those flags are not defined, it now prints a usage message.
- If the <a href="/pkg/flag/#FlagSet"><code>FlagSet</code></a> was created with
- <a href="/pkg/flag/#ExitOnError"><code>ExitOnError</code></a>,
- <a href="/pkg/flag/#FlagSet.Parse"><code>FlagSet.Parse</code></a> would then
- exit with a status of 2. In this release, the exit status for <code>-h</code>
- or <code>-help</code> has been changed to 0. In particular, this applies to
- the default handling of command line flags.
- </p>
- </dd>
-</dl>
-
-<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
- <dd>
- <p><!-- CL 215001 -->
- The printing verbs <code>%#g</code> and <code>%#G</code> now preserve
- trailing zeros for floating-point values.
- </p>
- </dd>
-</dl><!-- fmt -->
-
-<dl id="go/format"><dt><a href="/pkg/go/format/">go/format</a></dt>
- <dd>
- <p><!-- golang.org/issue/37476, CL 231461, CL 240683 -->
- The <a href="/pkg/go/format/#Source"><code>Source</code></a> and
- <a href="/pkg/go/format/#Node"><code>Node</code></a> functions
- now canonicalize number literal prefixes and exponents as part
- of formatting Go source code. This matches the behavior of the
- <a href="/pkg/cmd/gofmt/"><code>gofmt</code></a> command as it
- was implemented <a href="/doc/go1.13#gofmt">since Go 1.13</a>.
- </p>
- </dd>
-</dl><!-- go/format -->
-
-<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
- <dd>
- <p><!-- CL 226097 -->
- The package now uses Unicode escapes (<code>\uNNNN</code>) in all
- JavaScript and JSON contexts. This fixes escaping errors in
- <code>application/ld+json</code> and <code>application/json</code>
- contexts.
- </p>
- </dd>
-</dl><!-- html/template -->
-
-<dl id="io/ioutil"><dt><a href="/pkg/io/ioutil/">io/ioutil</a></dt>
- <dd>
- <p><!-- CL 212597 -->
- <a href="/pkg/io/ioutil/#TempDir"><code>TempDir</code></a> and
- <a href="/pkg/io/ioutil/#TempFile"><code>TempFile</code></a>
- now reject patterns that contain path separators.
- That is, calls such as <code>ioutil.TempFile("/tmp",</code> <code>"../base*")</code> will no longer succeed.
- This prevents unintended directory traversal.
- </p>
- </dd>
-</dl><!-- io/ioutil -->
-
-<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
- <dd>
- <p><!-- CL 230397 -->
- The new <a href="/pkg/math/big/#Int.FillBytes"><code>Int.FillBytes</code></a>
- method allows serializing to fixed-size pre-allocated byte slices.
- </p>
- </dd>
-</dl><!-- math/big -->
-
-<dl id="math/cmplx"><dt><a href="/pkg/math/cmplx/">math/cmplx</a></dt>
- <dd>
- <p><!-- CL 220689 -->
- The functions in this package were updated to conform to the C99 standard
- (Annex G IEC 60559-compatible complex arithmetic) with respect to handling
- of special arguments such as infinity, NaN and signed zero.
- </p>
- </dd>
-</dl><!-- math/cmplx-->
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
- <p><!-- CL 228645 -->
- If an I/O operation exceeds a deadline set by
- the <a href="/pkg/net/#Conn"><code>Conn.SetDeadline</code></a>,
- <code>Conn.SetReadDeadline</code>,
- or <code>Conn.SetWriteDeadline</code> methods, it will now
- return an error that is or wraps
- <a href="/pkg/os/#ErrDeadlineExceeded"><code>os.ErrDeadlineExceeded</code></a>.
- This may be used to reliably detect whether an error is due to
- an exceeded deadline.
- Earlier releases recommended calling the <code>Timeout</code>
- method on the error, but I/O operations can return errors for
- which <code>Timeout</code> returns <code>true</code> although a
- deadline has not been exceeded.
- </p>
-
- <p><!-- CL 228641 -->
- The new <a href="/pkg/net/#Resolver.LookupIP"><code>Resolver.LookupIP</code></a>
- method supports IP lookups that are both network-specific and accept a context.
- </p>
- </dd>
-</dl>
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
- <p><!-- CL 231418, CL 231419 -->
- Parsing is now stricter as a hardening measure against request smuggling attacks:
- non-ASCII white space is no longer trimmed like SP and HTAB, and support for the
- "<code>identity</code>" <code>Transfer-Encoding</code> was dropped.
- </p>
- </dd>
-</dl><!-- net/http -->
-
-<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
- <dd>
- <p><!-- CL 230937 -->
- <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
- now supports not modifying the <code>X-Forwarded-For</code>
- header when the incoming <code>Request.Header</code> map entry
- for that field is <code>nil</code>.
- </p>
-
- <p><!-- CL 224897 -->
- When a Switching Protocol (like WebSocket) request handled by
- <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
- is canceled, the backend connection is now correctly closed.
- </p>
- </dd>
-</dl>
-
-<dl id="net/http/pprof"><dt><a href="/pkg/net/http/pprof/">net/http/pprof</a></dt>
- <dd>
- <p><!-- CL 147598, CL 229537 -->
- All profile endpoints now support a "<code>seconds</code>" parameter. When present,
- the endpoint profiles for the specified number of seconds and reports the difference.
- The meaning of the "<code>seconds</code>" parameter in the <code>cpu</code> profile and
- the trace endpoints is unchanged.
- </p>
- </dd>
-</dl>
-
-<dl id="net/url"><dt><a href="/pkg/net/url/">net/url</a></dt>
- <dd>
- <p><!-- CL 227645 -->
- The new <a href="/pkg/net/url/#URL"><code>URL</code></a> field
- <code>RawFragment</code> and method <a href="/pkg/net/url/#URL.EscapedFragment"><code>EscapedFragment</code></a>
- provide detail about and control over the exact encoding of a particular fragment.
- These are analogous to
- <code>RawPath</code> and <a href="/pkg/net/url/#URL.EscapedPath"><code>EscapedPath</code></a>.
- </p>
- <p><!-- CL 207082 -->
- The new <a href="/pkg/net/url/#URL"><code>URL</code></a>
- method <a href="/pkg/net/url/#URL.Redacted"><code>Redacted</code></a>
- returns the URL in string form with any password replaced with <code>xxxxx</code>.
- </p>
- </dd>
-</dl>
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p><!-- CL -->
- If an I/O operation exceeds a deadline set by
- the <a href="/pkg/os/#File.SetDeadline"><code>File.SetDeadline</code></a>,
- <a href="/pkg/os/#File.SetReadDeadline"><code>File.SetReadDeadline</code></a>,
- or <a href="/pkg/os/#File.SetWriteDeadline"><code>File.SetWriteDeadline</code></a>
- methods, it will now return an error that is or wraps
- <a href="/pkg/os/#ErrDeadlineExceeded"><code>os.ErrDeadlineExceeded</code></a>.
- This may be used to reliably detect whether an error is due to
- an exceeded deadline.
- Earlier releases recommended calling the <code>Timeout</code>
- method on the error, but I/O operations can return errors for
- which <code>Timeout</code> returns <code>true</code> although a
- deadline has not been exceeded.
- </p>
-
- <p><!-- CL 232862 -->
- Packages <code>os</code> and <code>net</code> now automatically
- retry system calls that fail with <code>EINTR</code>. Previously
- this led to spurious failures, which became more common in Go
- 1.14 with the addition of asynchronous preemption. Now this is
- handled transparently.
- </p>
-
- <p><!-- CL 229101 -->
- The <a href="/pkg/os/#File"><code>os.File</code></a> type now
- supports a <a href="/pkg/os/#File.ReadFrom"><code>ReadFrom</code></a>
- method. This permits the use of the <code>copy_file_range</code>
- system call on some systems when using
- <a href="/pkg/io/#Copy"><code>io.Copy</code></a> to copy data
- from one <code>os.File</code> to another. A consequence is that
- <a href="/pkg/io/#CopyBuffer"><code>io.CopyBuffer</code></a>
- will not always use the provided buffer when copying to a
- <code>os.File</code>. If a program wants to force the use of
- the provided buffer, it can be done by writing
- <code>io.CopyBuffer(struct{ io.Writer }{dst}, src, buf)</code>.
- </p>
- </dd>
-</dl>
-
-<dl id="plugin"><dt><a href="/pkg/plugin/">plugin</a></dt>
- <dd>
- <p><!-- CL 182959 -->
- DWARF generation is now supported (and enabled by default) for <code>-buildmode=plugin</code> on macOS.
- </p>
- </dd>
- <dd>
- <p><!-- CL 191617 -->
- Building with <code>-buildmode=plugin</code> is now supported on <code>freebsd/amd64</code>.
- </p>
- </dd>
-</dl>
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
- <dd>
- <p><!-- CL 228902 -->
- Package <code>reflect</code> now disallows accessing methods of all
- non-exported fields, whereas previously it allowed accessing
- those of non-exported, embedded fields. Code that relies on the
- previous behavior should be updated to instead access the
- corresponding promoted method of the enclosing variable.
- </p>
- </dd>
-</dl>
-
-<dl id="regexp"><dt><a href="/pkg/regexp/">regexp</a></dt>
- <dd>
- <p><!-- CL 187919 -->
- The new <a href="/pkg/regexp/#Regexp.SubexpIndex"><code>Regexp.SubexpIndex</code></a>
- method returns the index of the first subexpression with the given name
- within the regular expression.
- </p>
- </dd>
-</dl><!-- regexp -->
-
-<dl id="pkg-runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
- <dd>
- <p><!-- CL 216557 -->
- Several functions, including
- <a href="/pkg/runtime/#ReadMemStats"><code>ReadMemStats</code></a>
- and
- <a href="/pkg/runtime/#GoroutineProfile"><code>GoroutineProfile</code></a>,
- no longer block if a garbage collection is in progress.
- </p>
- </dd>
-</dl>
-
-<dl id="pkg-runtime-pprof"><dt><a href="/pkg/runtime/pprof/">runtime/pprof</a></dt>
- <dd>
- <p><!-- CL 189318 -->
- The goroutine profile now includes the profile labels associated with each
- goroutine at the time of profiling. This feature is not yet implemented for
- the profile reported with <code>debug=2</code>.
- </p>
- </dd>
-</dl>
-
-<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
- <dd>
- <p><!-- CL 216617 -->
- <a href="/pkg/strconv/#FormatComplex"><code>FormatComplex</code></a> and <a href="/pkg/strconv/#ParseComplex"><code>ParseComplex</code></a> are added for working with complex numbers.
- </p>
- <p>
- <a href="/pkg/strconv/#FormatComplex"><code>FormatComplex</code></a> converts a complex number into a string of the form (a+bi), where a and b are the real and imaginary parts.
- </p>
- <p>
- <a href="/pkg/strconv/#ParseComplex"><code>ParseComplex</code></a> converts a string into a complex number of a specified precision. <code>ParseComplex</code> accepts complex numbers in the format <code>N+Ni</code>.
- </p>
- </dd>
-</dl><!-- strconv -->
-
-<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
- <dd>
- <p><!-- CL 205899, golang.org/issue/33762 -->
- The new method
- <a href="/pkg/sync/#Map.LoadAndDelete"><code>Map.LoadAndDelete</code></a>
- atomically deletes a key and returns the previous value if present.
- </p>
- <p><!-- CL 205899 -->
- The method
- <a href="/pkg/sync/#Map.Delete"><code>Map.Delete</code></a>
- is more efficient.
- </p>
- </dd>
-</dl><!-- sync -->
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p><!-- CL 231638 -->
- On Unix systems, functions that use
- <a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a>
- will now reject attempts to set both the <code>Setctty</code>
- and <code>Foreground</code> fields, as they both use
- the <code>Ctty</code> field but do so in incompatible ways.
- We expect that few existing programs set both fields.
- </p>
- <p>
- Setting the <code>Setctty</code> field now requires that the
- <code>Ctty</code> field be set to a file descriptor number in the
- child process, as determined by the <code>ProcAttr.Files</code> field.
- Using a child descriptor always worked, but there were certain
- cases where using a parent file descriptor also happened to work.
- Some programs that set <code>Setctty</code> will need to change
- the value of <code>Ctty</code> to use a child descriptor number.
- </p>
-
- <p><!-- CL 220578 -->
- It is <a href="/pkg/syscall/#Proc.Call">now possible</a> to call
- system calls that return floating point values
- on <code>windows/amd64</code>.
- </p>
- </dd>
-</dl>
-
-<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
- <dd>
- <p><!-- golang.org/issue/28135 -->
- The <code>testing.T</code> type now has a
- <a href="/pkg/testing/#T.Deadline"><code>Deadline</code></a> method
- that reports the time at which the test binary will have exceeded its
- timeout.
- </p>
-
- <p><!-- golang.org/issue/34129 -->
- A <code>TestMain</code> function is no longer required to call
- <code>os.Exit</code>. If a <code>TestMain</code> function returns,
- the test binary will call <code>os.Exit</code> with the value returned
- by <code>m.Run</code>.
- </p>
-
- <p><!-- CL 226877, golang.org/issue/35998 -->
- The new methods
- <a href="/pkg/testing/#T.TempDir"><code>T.TempDir</code></a> and
- <a href="/pkg/testing/#B.TempDir"><code>B.TempDir</code></a>
- return temporary directories that are automatically cleaned up
- at the end of the test.
- </p>
-
- <p><!-- CL 229085 -->
- <code>go</code> <code>test</code> <code>-v</code> now groups output by
- test name, rather than printing the test name on each line.
- </p>
- </dd>
-</dl><!-- testing -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 226097 -->
- <a href="/pkg/text/template/#JSEscape"><code>JSEscape</code></a> now
- consistently uses Unicode escapes (<code>\u00XX</code>), which are
- compatible with JSON.
- </p>
- </dd>
-</dl><!-- text/template -->
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
- <dd>
- <p><!-- CL 220424, CL 217362, golang.org/issue/33184 -->
- The new method
- <a href="/pkg/time/#Ticker.Reset"><code>Ticker.Reset</code></a>
- supports changing the duration of a ticker.
- </p>
-
- <p><!-- CL 227878 -->
- When returning an error, <a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a> now quotes the original value.
- </p>
- </dd>
-</dl><!-- time -->
diff --git a/doc/go1.16.html b/doc/go1.16.html
deleted file mode 100644
index 8d31f63fa2..0000000000
--- a/doc/go1.16.html
+++ /dev/null
@@ -1,1206 +0,0 @@
-<!--{
- "Title": "Go 1.16 Release Notes",
- "Path": "/doc/go1.16"
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.16</h2>
-
-<p>
- <strong>
- Go 1.16 is not yet released. These are work-in-progress
- release notes. Go 1.16 is expected to be released in February 2021.
- </strong>
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- There are no changes to the language.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<h3 id="darwin">Darwin and iOS</h3>
-
-<p><!-- golang.org/issue/38485, golang.org/issue/41385, CL 266373, more CLs -->
- Go 1.16 adds support of 64-bit ARM architecture on macOS (also known as
- Apple Silicon) with <code>GOOS=darwin</code>, <code>GOARCH=arm64</code>.
- Like the <code>darwin/amd64</code> port, the <code>darwin/arm64</code>
- port supports cgo, internal and external linking, <code>c-archive</code>,
- <code>c-shared</code>, and <code>pie</code> build modes, and the race
- detector.
-</p>
-
-<p><!-- CL 254740 -->
- The iOS port, which was previously <code>darwin/arm64</code>, has
- been renamed to <code>ios/arm64</code>. <code>GOOS=ios</code>
- implies the
- <code>darwin</code> build tag, just as <code>GOOS=android</code>
- implies the <code>linux</code> build tag. This change should be
- transparent to anyone using gomobile to build iOS apps.
-</p>
-
-<p><!-- golang.org/issue/42100, CL 263798 -->
- Go 1.16 adds an <code>ios/amd64</code> port, which targets the iOS
- simulator running on AMD64-based macOS. Previously this was
- unofficially supported through <code>darwin/amd64</code> with
- the <code>ios</code> build tag set. See also
- <a href="/misc/ios/README"><code>misc/ios/README</code></a> for
- details about how to build programs for iOS and iOS simulator.
-</p>
-
-<p><!-- golang.org/issue/23011 -->
- Go 1.16 is the last release that will run on macOS 10.12 Sierra.
- Go 1.17 will require macOS 10.13 High Sierra or later.
-</p>
-
-<h3 id="netbsd">NetBSD</h3>
-
-<p><!-- golang.org/issue/30824 -->
- Go now supports the 64-bit ARM architecture on NetBSD (the
- <code>netbsd/arm64</code> port).
-</p>
-
-<h3 id="openbsd">OpenBSD</h3>
-
-<p><!-- golang.org/issue/40995 -->
- Go now supports the MIPS64 architecture on OpenBSD
- (the <code>openbsd/mips64</code> port). This port does not yet
- support cgo.
-</p>
-
-<p><!-- golang.org/issue/36435, many CLs -->
- On the 64-bit x86 and 64-bit ARM architectures on OpenBSD (the
- <code>openbsd/amd64</code> and <code>openbsd/arm64</code> ports), system
- calls are now made through <code>libc</code>, instead of directly using
- the <code>SYSCALL</code>/<code>SVC</code> instruction. This ensures
- forward-compatibility with future versions of OpenBSD. In particular,
- OpenBSD 6.9 onwards will require system calls to be made through
- <code>libc</code> for non-static Go binaries.
-</p>
-
-<h3 id="386">386</h3>
-
-<p><!-- golang.org/issue/40255, golang.org/issue/41848, CL 258957, and CL 260017 -->
- As <a href="go1.15#386">announced</a> in the Go 1.15 release notes,
- Go 1.16 drops support for x87 mode compilation (<code>GO386=387</code>).
- Support for non-SSE2 processors is now available using soft float
- mode (<code>GO386=softfloat</code>).
- Users running on non-SSE2 processors should replace <code>GO386=387</code>
- with <code>GO386=softfloat</code>.
-</p>
-
-<h3 id="riscv">RISC-V</h3>
-
-<p><!-- golang.org/issue/36641, CL 267317 -->
- The <code>linux/riscv64</code> port now supports cgo and
- <code>-buildmode=pie</code>. This release also includes performance
- optimizations and code generation improvements for RISC-V.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="go-command">Go command</h3>
-
-<h4 id="modules">Modules</h4>
-
-<p><!-- golang.org/issue/41330 -->
- Module-aware mode is enabled by default, regardless of whether a
- <code>go.mod</code> file is present in the current working directory or a
- parent directory. More precisely, the <code>GO111MODULE</code> environment
- variable now defaults to <code>on</code>. To switch to the previous behavior,
- set <code>GO111MODULE</code> to <code>auto</code>.
-</p>
-
-<p><!-- golang.org/issue/40728 -->
- Build commands like <code>go</code> <code>build</code> and <code>go</code>
- <code>test</code> no longer modify <code>go.mod</code> and <code>go.sum</code>
- by default. Instead, they report an error if a module requirement or checksum
- needs to be added or updated (as if the <code>-mod=readonly</code> flag were
- used). Module requirements and sums may be adjusted with <code>go</code>
- <code>mod</code> <code>tidy</code> or <code>go</code> <code>get</code>.
-</p>
-
-<p><!-- golang.org/issue/40276 -->
- <code>go</code> <code>install</code> now accepts arguments with
- version suffixes (for example, <code>go</code> <code>install</code>
- <code>example.com/cmd@v1.0.0</code>). This causes <code>go</code>
- <code>install</code> to build and install packages in module-aware mode,
- ignoring the <code>go.mod</code> file in the current directory or any parent
- directory, if there is one. This is useful for installing executables without
- affecting the dependencies of the main module.
-</p>
-
-<p><!-- golang.org/issue/40276 -->
- <code>go</code> <code>install</code>, with or without a version suffix (as
- described above), is now the recommended way to build and install packages in
- module mode. <code>go</code> <code>get</code> should be used with the
- <code>-d</code> flag to adjust the current module's dependencies without
- building packages, and use of <code>go</code> <code>get</code> to build and
- install packages is deprecated. In a future release, the <code>-d</code> flag
- will always be enabled.
-</p>
-
-<p><!-- golang.org/issue/24031 -->
- <code>retract</code> directives may now be used in a <code>go.mod</code> file
- to indicate that certain published versions of the module should not be used
- by other modules. A module author may retract a version after a severe problem
- is discovered or if the version was published unintentionally.
-</p>
-
-<p><!-- golang.org/issue/26603 -->
- The <code>go</code> <code>mod</code> <code>vendor</code>
- and <code>go</code> <code>mod</code> <code>tidy</code> subcommands now accept
- the <code>-e</code> flag, which instructs them to proceed despite errors in
- resolving missing packages.
-</p>
-
-<p><!-- golang.org/issue/36465 -->
- The <code>go</code> command now ignores requirements on module versions
- excluded by <code>exclude</code> directives in the main module. Previously,
- the <code>go</code> command used the next version higher than an excluded
- version, but that version could change over time, resulting in
- non-reproducible builds.
-</p>
-
-<p><!-- golang.org/issue/43052 -->
- The <code>go</code> command now disallows non-ASCII import paths in module
- mode. Non-ASCII module paths have already been disallowed so this change
- affects module subdirectory paths that contain non-ASCII characters.
-</p>
-
-<h4 id="embed">Embedding Files</h4>
-
-<p>
- The <code>go</code> command now supports including
- static files and file trees as part of the final executable,
- using the new <code>//go:embed</code> directive.
- See the documentation for the new
- <a href="/pkg/embed/"><code>embed</code></a>
- package for details.
-</p>
-
-<h4 id="go-test"><code>go</code> <code>test</code></h4>
-
-<p><!-- golang.org/issue/29062 -->
- When using <code>go</code> <code>test</code>, a test that
- calls <code>os.Exit(0)</code> during execution of a test function
- will now be considered to fail.
- This will help catch cases in which a test calls code that calls
- <code>os.Exit(0)</code> and thereby stops running all future tests.
- If a <code>TestMain</code> function calls <code>os.Exit(0)</code>
- that is still considered to be a passing test.
-</p>
-
-<p><!-- golang.org/issue/39484 -->
- <code>go</code> <code>test</code> reports an error when the <code>-c</code>
- or <code>-i</code> flags are used together with unknown flags. Normally,
- unknown flags are passed to tests, but when <code>-c</code> or <code>-i</code>
- are used, tests are not run.
-</p>
-
-<h4 id="go-get"><code>go</code> <code>get</code></h4>
-
-<p><!-- golang.org/issue/37519 -->
- The <code>go</code> <code>get</code> <code>-insecure</code> flag is
- deprecated and will be removed in a future version. This flag permits
- fetching from repositories and resolving custom domains using insecure
- schemes such as HTTP, and also bypasses module sum validation using the
- checksum database. To permit the use of insecure schemes, use the
- <code>GOINSECURE</code> environment variable instead. To bypass module
- sum validation, use <code>GOPRIVATE</code> or <code>GONOSUMDB</code>.
- See <code>go</code> <code>help</code> <code>environment</code> for details.
-</p>
-
-<p><!-- golang.org/cl/263267 -->
- <code>go</code> <code>get</code> <code>example.com/mod@patch</code> now
- requires that some version of <code>example.com/mod</code> already be
- required by the main module.
- (However, <code>go</code> <code>get</code> <code>-u=patch</code> continues
- to patch even newly-added dependencies.)
-</p>
-
-<h4 id="govcs"><code>GOVCS</code> environment variable</h4>
-
-<p><!-- golang.org/issue/266420 -->
- <code>GOVCS</code> is a new environment variable that limits which version
- control tools the <code>go</code> command may use to download source code.
- This mitigates security issues with tools that are typically used in trusted,
- authenticated environments. By default, <code>git</code> and <code>hg</code>
- may be used to download code from any repository. <code>svn</code>,
- <code>bzr</code>, and <code>fossil</code> may only be used to download code
- from repositories with module paths or package paths matching patterns in
- the <code>GOPRIVATE</code> environment variable. See
- <a href="/cmd/go/#hdr-Controlling_version_control_with_GOVCS"><code>go</code>
- <code>help</code> <code>vcs</code></a> for details.
-</p>
-
-<h4 id="all-pattern">The <code>all</code> pattern</h4>
-
-<p><!-- golang.org/cl/240623 -->
- When the main module's <code>go.mod</code> file
- declares <code>go</code> <code>1.16</code> or higher, the <code>all</code>
- package pattern now matches only those packages that are transitively imported
- by a package or test found in the main module. (Packages imported by <em>tests
- of</em> packages imported by the main module are no longer included.) This is
- the same set of packages retained
- by <code>go</code> <code>mod</code> <code>vendor</code> since Go 1.11.
-</p>
-
-<h4 id="toolexec">The <code>-toolexec</code> build flag</h4>
-
-<p><!-- golang.org/cl/263357 -->
- When the <code>-toolexec</code> build flag is specified to use a program when
- invoking toolchain programs like compile or asm, the environment variable
- <code>TOOLEXEC_IMPORTPATH</code> is now set to the import path of the package
- being built.
-</p>
-
-<h4 id="i-flag">The <code>-i</code> build flag</h4>
-
-<p><!-- golang.org/issue/41696 -->
- The <code>-i</code> flag accepted by <code>go</code> <code>build</code>,
- <code>go</code> <code>install</code>, and <code>go</code> <code>test</code> is
- now deprecated. The <code>-i</code> flag instructs the <code>go</code> command
- to install packages imported by packages named on the command line. Since
- the build cache was introduced in Go 1.10, the <code>-i</code> flag no longer
- has a significant effect on build times, and it causes errors when the install
- directory is not writable.
-</p>
-
-<h4 id="list-buildid">The <code>list</code> command</h4>
-
-<p><!-- golang.org/cl/263542 -->
- When the <code>-export</code> flag is specified, the <code>BuildID</code>
- field is now set to the build ID of the compiled package. This is equivalent
- to running <code>go</code> <code>tool</code> <code>buildid</code> on
- <code>go</code> <code>list</code> <code>-exported</code> <code>-f</code> <code>{{.Export}}</code>,
- but without the extra step.
-</p>
-
-<h4 id="overlay-flag">The <code>-overlay</code> flag</h4>
-
-<p><!-- golang.org/issue/39958 -->
- The <code>-overlay</code> flag specifies a JSON configuration file containing
- a set of file path replacements. The <code>-overlay</code> flag may be used
- with all build commands and <code>go</code> <code>mod</code> subcommands.
- It is primarily intended to be used by editor tooling such as gopls to
- understand the effects of unsaved changes to source files. The config file
- maps actual file paths to replacement file paths and the <code>go</code>
- command and its builds will run as if the actual file paths exist with the
- contents given by the replacement file paths, or don't exist if the replacement
- file paths are empty.
-</p>
-
-<h3 id="cgo">Cgo</h3>
-
-<p><!-- CL 252378 -->
- The <a href="/cmd/cgo">cgo</a> tool will no longer try to translate
- C struct bitfields into Go struct fields, even if their size can be
- represented in Go. The order in which C bitfields appear in memory
- is implementation dependent, so in some cases the cgo tool produced
- results that were silently incorrect.
-</p>
-
-<h3 id="vet">Vet</h3>
-
-<h4 id="vet-string-int">New warning for invalid testing.T use in
-goroutines</h4>
-
-<p><!-- CL 235677 -->
- The vet tool now warns about invalid calls to the <code>testing.T</code>
- method <code>Fatal</code> from within a goroutine created during the test.
- This also warns on calls to <code>Fatalf</code>, <code>FailNow</code>, and
- <code>Skip{,f,Now}</code> methods on <code>testing.T</code> tests or
- <code>testing.B</code> benchmarks.
-</p>
-
-<p>
- Calls to these methods stop the execution of the created goroutine and not
- the <code>Test*</code> or <code>Benchmark*</code> function. So these are
- <a href="/pkg/testing/#T.FailNow">required</a> to be called by the goroutine
- running the test or benchmark function. For example:
-</p>
-
-<pre>
-func TestFoo(t *testing.T) {
- go func() {
- if condition() {
- t.Fatal("oops") // This exits the inner func instead of TestFoo.
- }
- ...
- }()
-}
-</pre>
-
-<p>
- Code calling <code>t.Fatal</code> (or a similar method) from a created
- goroutine should be rewritten to signal the test failure using
- <code>t.Error</code> and exit the goroutine early using an alternative
- method, such as using a <code>return</code> statement. The previous example
- could be rewritten as:
-</p>
-
-<pre>
-func TestFoo(t *testing.T) {
- go func() {
- if condition() {
- t.Error("oops")
- return
- }
- ...
- }()
-}
-</pre>
-
-<p><!-- CL 248686, CL 276372 -->
- The vet tool now warns about amd64 assembly that clobbers the BP
- register (the frame pointer) without saving and restoring it,
- contrary to the calling convention. Code that doesn't preserve the
- BP register must be modified to either not use BP at all or preserve
- BP by saving and restoring it. An easy way to preserve BP is to set
- the frame size to a nonzero value, which causes the generated
- prologue and epilogue to preserve the BP register for you.
- See <a href="https://golang.org/cl/248260">CL 248260</a> for example
- fixes.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<p>
- The new <a href="/pkg/runtime/metrics/"><code>runtime/metrics</code></a> package
- introduces a stable interface for reading
- implementation-defined metrics from the Go runtime.
- It supersedes existing functions like
- <a href="/pkg/runtime/#ReadMemStats"><code>runtime.ReadMemStats</code></a>
- and
- <a href="/pkg/runtime/debug/#GCStats"><code>debug.GCStats</code></a>
- and is significantly more general and efficient.
- See the package documentation for more details.
-</p>
-
-<p><!-- CL 254659 -->
- Setting the <code>GODEBUG</code> environment variable
- to <code>inittrace=1</code> now causes the runtime to emit a single
- line to standard error for each package <code>init</code>,
- summarizing its execution time and memory allocation. This trace can
- be used to find bottlenecks or regressions in Go startup
- performance.
- The <a href="/pkg/runtime/#hdr-Environment_Variables"><code>GODEBUG</code>
- documentation</a> describes the format.
-</p>
-
-<p><!-- CL 267100 -->
- On Linux, the runtime now defaults to releasing memory to the
- operating system promptly (using <code>MADV_DONTNEED</code>), rather
- than lazily when the operating system is under memory pressure
- (using <code>MADV_FREE</code>). This means process-level memory
- statistics like RSS will more accurately reflect the amount of
- physical memory being used by Go processes. Systems that are
- currently using <code>GODEBUG=madvdontneed=1</code> to improve
- memory monitoring behavior no longer need to set this environment
- variable.
-</p>
-
-<p><!-- CL 220419, CL 271987 -->
- Go 1.16 fixes a discrepancy between the race detector and
- the <a href="/ref/mem">Go memory model</a>. The race detector now
- more precisely follows the channel synchronization rules of the
- memory model. As a result, the detector may now report races it
- previously missed.
-</p>
-
-<h2 id="compiler">Compiler</h2>
-
-<p><!-- CL 256459, CL 264837, CL 266203, CL 256460 -->
- The compiler can now inline functions with
- non-labeled <code>for</code> loops, method values, and type
- switches. The inliner can also detect more indirect calls where
- inlining is possible.
-</p>
-
-<h2 id="linker">Linker</h2>
-
-<p><!-- CL 248197 -->
- This release includes additional improvements to the Go linker,
- reducing linker resource usage (both time and memory) and improving
- code robustness/maintainability. These changes form the second half
- of a two-release project to
- <a href="https://golang.org/s/better-linker">modernize the Go
- linker</a>.
-</p>
-
-<p>
- The linker changes in 1.16 extend the 1.15 improvements to all
- supported architecture/OS combinations (the 1.15 performance improvements
- were primarily focused on <code>ELF</code>-based OSes and
- <code>amd64</code> architectures). For a representative set of
- large Go programs, linking is 20-25% faster than 1.15 and requires
- 5-15% less memory on average for <code>linux/amd64</code>, with larger
- improvements for other architectures and OSes. Most binaries are
- also smaller as a result of more aggressive symbol pruning.
-</p>
-
-<p><!-- CL 255259 -->
- On Windows, <code>go build -buildmode=c-shared</code> now generates Windows
- ASLR DLLs by default. ASLR can be disabled with <code>--ldflags=-aslr=false</code>.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="library-embed">Embedded Files</h3>
-
-<p>
- The new <a href="/pkg/embed/"><code>embed</code></a> package
- provides access to files embedded in the program during compilation
- using the new <a href="#embed"><code>//go:embed</code> directive</a>.
-</p>
-
-<h3 id="fs">File Systems</h3>
-
-<p>
- The new <a href="/pkg/io/fs/"><code>io/fs</code></a> package
- defines the <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a> interface,
- an abstraction for read-only trees of files.
- The standard library packages have been adapted to make use
- of the interface as appropriate.
-</p>
-
-<p>
- On the producer side of the interface,
- the new <a href="/pkg/embed/#FS"><code>embed.FS</code></a> type
- implements <code>fs.FS</code>, as does
- <a href="/pkg/archive/zip/#Reader"><code>zip.Reader</code></a>.
- The new <a href="/pkg/os/#DirFS"><code>os.DirFS</code></a> function
- provides an implementation of <code>fs.FS</code> backed by a tree
- of operating system files.
-</p>
-
-<p>
- On the consumer side,
- the new <a href="/pkg/net/http/#FS"><code>http.FS</code></a>
- function converts an <code>fs.FS</code> to an
- <a href="/pkg/net/http/#Handler"><code>http.Handler</code></a>.
- Also, the <a href="/pkg/html/template/"><code>html/template</code></a>
- and <a href="/pkg/text/template/"><code>text/template</code></a>
- packages’ <a href="/pkg/html/template/#ParseFS"><code>ParseFS</code></a>
- functions and methods read templates from an <code>fs.FS</code>.
-</p>
-
-<p>
- For testing code that implements <code>fs.FS</code>,
- the new <a href="/pkg/testing/fstest/"><code>testing/fstest</code></a>
- package provides a <a href="/pkg/testing/fstest/#TestFS"><code>TestFS</code></a>
- function that checks for and reports common mistakes.
- It also provides a simple in-memory file system implementation,
- <a href="/pkg/testing/fstest/#MapFS"><code>MapFS</code></a>,
- which can be useful for testing code that accepts <code>fs.FS</code>
- implementations.
-</p>
-
-<h3 id="ioutil">Deprecation of io/ioutil</h3>
-
-<p>
- The <a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package has
- turned out to be a poorly defined and hard to understand collection
- of things. All functionality provided by the package has been moved
- to other packages. The <code>io/ioutil</code> package remains and
- will continue to work as before, but we encourage new code to use
- the new definitions in the <a href="/pkg/io/"><code>io</code></a> and
- <a href="/pkg/os/"><code>os</code></a> packages.
-
- Here is a list of the new locations of the names exported
- by <code>io/ioutil</code>:
- <ul>
- <li><a href="/pkg/io/ioutil/#Discard"><code>Discard</code></a>
- => <a href="/pkg/io/#Discard"><code>io.Discard</code></a></li>
- <li><a href="/pkg/io/ioutil/#NopCloser"><code>NopCloser</code></a>
- => <a href="/pkg/io/#NopCloser"><code>io.NopCloser</code></a></li>
- <li><a href="/pkg/io/ioutil/#ReadAll"><code>ReadAll</code></a>
- => <a href="/pkg/io/#ReadAll"><code>io.ReadAll</code></a></li>
- <li><a href="/pkg/io/ioutil/#ReadDir"><code>ReadDir</code></a>
- => <a href="/pkg/os/#ReadDir"><code>os.ReadDir</code></a>
- (note: returns a slice of
- <a href="/pkg/os/#DirEntry"><code>os.DirEntry</code></a>
- rather than a slice of
- <a href="/pkg/fs/#FileInfo"><code>fs.FileInfo</code></a>)
- </li>
- <li><a href="/pkg/io/ioutil/#ReadFile"><code>ReadFile</code></a>
- => <a href="/pkg/os/#ReadFile"><code>os.ReadFile</code></a></li>
- <li><a href="/pkg/io/ioutil/#TempDir"><code>TempDir</code></a>
- => <a href="/pkg/os/#MkdirTemp"><code>os.MkdirTemp</code></a></li>
- <li><a href="/pkg/io/ioutil/#TempFile"><code>TempFile</code></a>
- => <a href="/pkg/os/#CreateTemp"><code>os.CreateTemp</code></a></li>
- <li><a href="/pkg/io/ioutil/#WriteFile"><code>WriteFile</code></a>
- => <a href="/pkg/os/#WriteFile"><code>os.WriteFile</code></a></li>
- </ul>
-</p>
-
-<!-- okay-after-beta1
- TODO: decide if any additional changes are worth factoring out from
- "Minor changes to the library" and highlighting in "Core library"
--->
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
- <dd>
- <p><!-- CL 243937 -->
- The new <a href="/pkg/archive/zip/#Reader.Open"><code>Reader.Open</code></a>
- method implements the <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a>
- interface.
- </p>
- </dd>
-</dl>
-
-<dl id="crypto/dsa"><dt><a href="/pkg/crypto/dsa/">crypto/dsa</a></dt>
- <dd>
- <p><!-- CL 257939 -->
- The <a href="/pkg/crypto/dsa/"><code>crypto/dsa</code></a> package is now deprecated.
- See <a href="https://golang.org/issue/40337">issue #40337</a>.
- </p>
- </dd>
-</dl><!-- crypto/dsa -->
-
-<dl id="crypto/hmac"><dt><a href="/pkg/crypto/hmac/">crypto/hmac</a></dt>
- <dd>
- <p><!-- CL 261960 -->
- <a href="/pkg/crypto/hmac/#New"><code>New</code></a> will now panic if
- separate calls to the hash generation function fail to return new values.
- Previously, the behavior was undefined and invalid outputs were sometimes
- generated.
- </p>
- </dd>
-</dl><!-- crypto/hmac -->
-
-<dl id="crypto/tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p><!-- CL 256897 -->
- I/O operations on closing or closed TLS connections can now be detected
- using the new <a href="/pkg/net/#ErrClosed"><code>net.ErrClosed</code></a>
- error. A typical use would be <code>errors.Is(err, net.ErrClosed)</code>.
- </p>
-
- <p><!-- CL 266037 -->
- A default write deadline is now set in
- <a href="/pkg/crypto/tls/#Conn.Close"><code>Conn.Close</code></a>
- before sending the "close notify" alert, in order to prevent blocking
- indefinitely.
- </p>
-
- <p><!-- CL 239748 -->
- Clients now return a handshake error if the server selects
- <a href="/pkg/crypto/tls/#ConnectionState.NegotiatedProtocol">
- an ALPN protocol</a> that was not in
- <a href="/pkg/crypto/tls/#Config.NextProtos">
- the list advertised by the client</a>.
- </p>
-
- <p><!-- CL 262857 -->
- Servers will now prefer other available AEAD cipher suites (such as ChaCha20Poly1305)
- over AES-GCM cipher suites if either the client or server doesn't have AES hardware
- support, unless both <a href="/pkg/crypto/tls/#Config.PreferServerCipherSuites">
- <code>Config.PreferServerCipherSuites</code></a>
- and <a href="/pkg/crypto/tls/#Config.CipherSuites"><code>Config.CipherSuites</code></a>
- are set. The client is assumed not to have AES hardware support if it does
- not signal a preference for AES-GCM cipher suites.
- </p>
-
- <p><!-- CL 246637 -->
- <a href="/pkg/crypto/tls/#Config.Clone"><code>Config.Clone</code></a> now
- returns nil if the receiver is nil, rather than panicking.
- </p>
- </dd>
-</dl><!-- crypto/tls -->
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p>
- The <code>GODEBUG=x509ignoreCN=0</code> flag will be removed in Go 1.17.
- It enables the legacy behavior of treating the <code>CommonName</code>
- field on X.509 certificates as a host name when no Subject Alternative
- Names are present.
- </p>
-
- <p><!-- CL 235078 -->
- <a href="/pkg/crypto/x509/#ParseCertificate"><code>ParseCertificate</code></a> and
- <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
- now enforce string encoding restrictions for the <code>DNSNames</code>,
- <code>EmailAddresses</code>, and <code>URIs</code> fields. These fields
- can only contain strings with characters within the ASCII range.
- </p>
-
- <p><!-- CL 259697 -->
- <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
- now verifies the generated certificate's signature using the signer's
- public key. If the signature is invalid, an error is returned, instead of
- a malformed certificate.
- </p>
-
- <p><!-- CL 257939 -->
- DSA signature verification is no longer supported. Note that DSA signature
- generation was never supported.
- See <a href="https://golang.org/issue/40337">issue #40337</a>.
- </p>
-
- <p><!-- CL 257257 -->
- On Windows, <a href="/pkg/crypto/x509/#Certificate.Verify"><code>Certificate.Verify</code></a>
- will now return all certificate chains that are built by the platform
- certificate verifier, instead of just the highest ranked chain.
- </p>
-
- <p><!-- CL 262343 -->
- The new <a href="/pkg/crypto/x509/#SystemRootsError.Unwrap"><code>SystemRootsError.Unwrap</code></a>
- method allows accessing the <a href="/pkg/crypto/x509/#SystemRootsError.Err"><code>Err</code></a>
- field through the <a href="/pkg/errors"><code>errors</code></a> package functions.
- </p>
-
- <p><!-- CL 230025 -->
- On Unix systems, the <code>crypto/x509</code> package is now more
- efficient in how it stores its copy of the system cert pool.
- Programs that use only a small number of roots will use around a
- half megabyte less memory.
- </p>
-
- </dd>
-</dl><!-- crypto/x509 -->
-
-<dl id="debug/elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
- <dd>
- <p><!-- CL 255138 -->
- More <a href="/pkg/debug/elf/#DT_NULL"><code>DT</code></a>
- and <a href="/pkg/debug/elf/#PT_NULL"><code>PT</code></a>
- constants have been added.
- </p>
- </dd>
-</dl><!-- debug/elf -->
-
-<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1">encoding/asn1</a></dt>
- <dd>
- <p><!-- CL 255881 -->
- <a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a> and
- <a href="/pkg/encoding/asn1/#UnmarshalWithParams"><code>UnmarshalWithParams</code></a>
- now return an error instead of panicking when the argument is not
- a pointer or is nil. This change matches the behavior of other
- encoding packages such as <a href="/pkg/encoding/json"><code>encoding/json</code></a>.
- </p>
- </dd>
-</dl>
-
-<dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
- <dd>
- <p><!-- CL 234818 -->
- The <code>json</code> struct field tags understood by
- <a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a>,
- <a href="/pkg/encoding/json/#Unmarshal"><code>Unmarshal</code></a>,
- and related functionality now permit semicolon characters within
- a JSON object name for a Go struct field.
- </p>
- </dd>
-</dl><!-- encoding/json -->
-
-<dl id="encoding/xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt>
- <dd>
- <p><!-- CL 264024 -->
- The encoder has always taken care to avoid using namespace prefixes
- beginning with <code>xml</code>, which are reserved by the XML
- specification.
- Now, following the specification more closely, that check is
- case-insensitive, so that prefixes beginning
- with <code>XML</code>, <code>XmL</code>, and so on are also
- avoided.
- </p>
- </dd>
-</dl><!-- encoding/xml -->
-
-<dl id="flag"><dt><a href="/pkg/flag/">flag</a></dt>
- <dd>
- <p><!-- CL 240014 -->
- The new <a href="/pkg/flag/#Func"><code>Func</code></a> function
- allows registering a flag implemented by calling a function,
- as a lighter-weight alternative to implementing the
- <a href="/pkg/flag/#Value"><code>Value</code></a> interface.
- </p>
- </dd>
-</dl><!-- flag -->
-
-<dl id="go/build"><dt><a href="/pkg/go/build/">go/build</a></dt>
- <dd>
- <p><!-- CL 243941, CL 283636 -->
- The <a href="/pkg/go/build/#Package"><code>Package</code></a>
- struct has new fields that report information
- about <code>//go:embed</code> directives in the package:
- <a href="/pkg/go/build/#Package.EmbedPatterns"><code>EmbedPatterns</code></a>,
- <a href="/pkg/go/build/#Package.EmbedPatternPos"><code>EmbedPatternPos</code></a>,
- <a href="/pkg/go/build/#Package.TestEmbedPatterns"><code>TestEmbedPatterns</code></a>,
- <a href="/pkg/go/build/#Package.TestEmbedPatternPos"><code>TestEmbedPatternPos</code></a>,
- <a href="/pkg/go/build/#Package.XTestEmbedPatterns"><code>XTestEmbedPatterns</code></a>,
- <a href="/pkg/go/build/#Package.XTestEmbedPatternPos"><code>XTestEmbedPatternPos</code></a>.
- </p>
-
- <p><!-- CL 240551 -->
- The <a href="/pkg/go/build/#Package"><code>Package</code></a> field
- <a href="/pkg/go/build/#Package.IgnoredGoFiles"><code>IgnoredGoFiles</code></a>
- will no longer include files that start with "_" or ".",
- as those files are always ignored.
- <code>IgnoredGoFiles</code> is for files ignored because of
- build constraints.
- </p>
-
- <p><!-- CL 240551 -->
- The new <a href="/pkg/go/build/#Package"><code>Package</code></a>
- field <a href="/pkg/go/build/#Package.IgnoredOtherFiles"><code>IgnoredOtherFiles</code></a>
- has a list of non-Go files ignored because of build constraints.
- </p>
- </dd>
-</dl><!-- go/build -->
-
-<dl id="go/build/constraint"><dt><a href="/pkg/go/build/constraint/">go/build/constraint</a></dt>
- <dd>
- <p><!-- CL 240604 -->
- The new
- <a href="/pkg/go/build/constraint/"><code>go/build/constraint</code></a>
- package parses build constraint lines, both the original
- <code>// +build</code> syntax and the <code>//go:build</code>
- syntax that will be introduced in Go 1.17.
- This package exists so that tools built with Go 1.16 will be able
- to process Go 1.17 source code.
- See <a href="https://golang.org/design/draft-gobuild">https://golang.org/design/draft-gobuild</a>
- for details about the build constraint syntaxes and the planned
- transition to the <code>//go:build</code> syntax.
- Note that <code>//go:build</code> lines are <b>not</b> supported
- in Go 1.16 and should not be introduced into Go programs yet.
- </p>
- </dd>
-</dl><!-- go/build/constraint -->
-
-<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
- <dd>
- <p><!-- CL 243938 -->
- The new <a href="/pkg/html/template/#ParseFS"><code>template.ParseFS</code></a>
- function and <a href="/pkg/html/template/#Template.ParseFS"><code>template.Template.ParseFS</code></a>
- method are like <a href="/pkg/html/template/#ParseGlob"><code>template.ParseGlob</code></a>
- and <a href="/pkg/html/template/#Template.ParseGlob"><code>template.Template.ParseGlob</code></a>,
- but read the templates from an <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a>.
- </p>
- </dd>
-</dl><!-- html/template -->
-
-<dl id="io"><dt><a href="/pkg/io/">io</a></dt>
- <dd>
- <p><!-- CL 261577 -->
- The package now defines a
- <a href="/pkg/io/#ReadSeekCloser"><code>ReadSeekCloser</code></a> interface.
- </p>
-
- <p><!-- CL 263141 -->
- The package now defines
- <a href="/pkg/io/#Discard"><code>Discard</code></a>,
- <a href="/pkg/io/#NopCloser"><code>NopCloser</code></a>, and
- <a href="/pkg/io/#ReadAll"><code>ReadAll</code></a>,
- to be used instead of the same names in the
- <a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package.
- </p>
- </dd>
-</dl><!-- io -->
-
-<dl id="log"><dt><a href="/pkg/log/">log</a></dt>
- <dd>
- <p><!-- CL 264460 -->
- The new <a href="/pkg/log/#Default"><code>Default</code></a> function
- provides access to the default <a href="/pkg/log/#Logger"><code>Logger</code></a>.
- </p>
- </dd>
-</dl><!-- log -->
-
-<dl id="log/syslog"><dt><a href="/pkg/log/syslog/">log/syslog</a></dt>
- <dd>
- <p><!-- CL 264297 -->
- The <a href="/pkg/log/syslog/#Writer"><code>Writer</code></a>
- now uses the local message format
- (omitting the host name and using a shorter time stamp)
- when logging to custom Unix domain sockets,
- matching the format already used for the default log socket.
- </p>
- </dd>
-</dl><!-- log/syslog -->
-
-<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
- <dd>
- <p><!-- CL 247477 -->
- The <a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a>'s
- <a href="/pkg/mime/multipart/#Reader.ReadForm"><code>ReadForm</code></a>
- method no longer rejects form data
- when passed the maximum int64 value as a limit.
- </p>
- </dd>
-</dl><!-- mime/multipart -->
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
- <p><!-- CL 250357 -->
- The case of I/O on a closed network connection, or I/O on a network
- connection that is closed before any of the I/O completes, can now
- be detected using the new <a href="/pkg/net/#ErrClosed"><code>ErrClosed</code></a>
- error. A typical use would be <code>errors.Is(err, net.ErrClosed)</code>.
- In earlier releases the only way to reliably detect this case was to
- match the string returned by the <code>Error</code> method
- with <code>"use of closed network connection"</code>.
- </p>
-
- <p><!-- CL 255898 -->
- In previous Go releases the default TCP listener backlog size on Linux systems,
- set by <code>/proc/sys/net/core/somaxconn</code>, was limited to a maximum of <code>65535</code>.
- On Linux kernel version 4.1 and above, the maximum is now <code>4294967295</code>.
- </p>
-
- <p><!-- CL 238629 -->
- On Linux, host name lookups no longer use DNS before checking
- <code>/etc/hosts</code> when <code>/etc/nsswitch.conf</code>
- is missing; this is common on musl-based systems and makes
- Go programs match the behavior of C programs on those systems.
- </p>
- </dd>
-</dl><!-- net -->
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
- <p><!-- CL 233637 -->
- In the <a href="/pkg/net/http/"><code>net/http</code></a> package, the
- behavior of <a href="/pkg/net/http/#StripPrefix"><code>StripPrefix</code></a>
- has been changed to strip the prefix from the request URL's
- <code>RawPath</code> field in addition to its <code>Path</code> field.
- In past releases, only the <code>Path</code> field was trimmed, and so if the
- request URL contained any escaped characters the URL would be modified to
- have mismatched <code>Path</code> and <code>RawPath</code> fields.
- In Go 1.16, <code>StripPrefix</code> trims both fields.
- If there are escaped characters in the prefix part of the request URL the
- handler serves a 404 instead of its previous behavior of invoking the
- underlying handler with a mismatched <code>Path</code>/<code>RawPath</code> pair.
- </p>
-
- <p><!-- CL 252497 -->
- The <a href="/pkg/net/http/"><code>net/http</code></a> package now rejects HTTP range requests
- of the form <code>"Range": "bytes=--N"</code> where <code>"-N"</code> is a negative suffix length, for
- example <code>"Range": "bytes=--2"</code>. It now replies with a <code>416 "Range Not Satisfiable"</code> response.
- </p>
-
- <p><!-- CL 256498, golang.org/issue/36990 -->
- Cookies set with <a href="/pkg/net/http/#SameSiteDefaultMode"><code>SameSiteDefaultMode</code></a>
- now behave according to the current spec (no attribute is set) instead of
- generating a SameSite key without a value.
- </p>
-
- <p><!-- CL 250039 -->
- The <a href="/pkg/net/http/#Client"><code>Client</code></a> now sends
- an explicit <code>Content-Length:</code> <code>0</code>
- header in <code>PATCH</code> requests with empty bodies,
- matching the existing behavior of <code>POST</code> and <code>PUT</code>.
- </p>
-
- <p><!-- CL 249440 -->
- The <a href="/pkg/net/http/#ProxyFromEnvironment"><code>ProxyFromEnvironment</code></a>
- function no longer returns the setting of the <code>HTTP_PROXY</code>
- environment variable for <code>https://</code> URLs when
- <code>HTTPS_PROXY</code> is unset.
- </p>
-
- <p><!-- 259917 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
- type has a new field
- <a href="/pkg/net/http/#Transport.GetProxyConnectHeader"><code>GetProxyConnectHeader</code></a>
- which may be set to a function that returns headers to send to a
- proxy during a <code>CONNECT</code> request.
- In effect <code>GetProxyConnectHeader</code> is a dynamic
- version of the existing field
- <a href="/pkg/net/http/#Transport.ProxyConnectHeader"><code>ProxyConnectHeader</code></a>;
- if <code>GetProxyConnectHeader</code> is not <code>nil</code>,
- then <code>ProxyConnectHeader</code> is ignored.
- </p>
-
- <p><!-- CL 243939 -->
- The new <a href="/pkg/net/http/#FS"><code>http.FS</code></a>
- function converts an <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a>
- to an <a href="/pkg/net/http/#Handler"><code>http.Handler</code></a>.
- </p>
- </dd>
-</dl><!-- net/http -->
-
-<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
- <dd>
- <p><!-- CL 260637 -->
- <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
- now flushes buffered data more aggressively when proxying
- streamed responses with unknown body lengths.
- </p>
- </dd>
-</dl><!-- net/http/httputil -->
-
-<dl id="net/smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt>
- <dd>
- <p><!-- CL 247257 -->
- The <a href="/pkg/net/smtp/#Client"><code>Client</code></a>'s
- <a href="/pkg/net/smtp/#Client.Mail"><code>Mail</code></a>
- method now sends the <code>SMTPUTF8</code> directive to
- servers that support it, signaling that addresses are encoded in UTF-8.
- </p>
- </dd>
-</dl><!-- net/smtp -->
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p><!-- CL 242998 -->
- <a href="/pkg/os/#Process.Signal"><code>Process.Signal</code></a> now
- returns <a href="/pkg/os/#ErrProcessDone"><code>ErrProcessDone</code></a>
- instead of the unexported <code>errFinished</code> when the process has
- already finished.
- </p>
-
- <p><!-- CL 261540 -->
- The package defines a new type
- <a href="/pkg/os/#DirEntry"><code>DirEntry</code></a>
- as an alias for <a href="/pkg/io/fs/#DirEntry"><code>fs.DirEntry</code></a>.
- The new <a href="/pkg/os/#ReadDir"><code>ReadDir</code></a>
- function and the new
- <a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>
- method can be used to read the contents of a directory into a
- slice of <a href="/pkg/os/#DirEntry"><code>DirEntry</code></a>.
- The <a href="/pkg/os/#File.Readdir"><code>File.Readdir</code></a>
- method (note the lower case <code>d</code> in <code>dir</code>)
- still exists, returning a slice of
- <a href="/pkg/os/#FileInfo"><code>FileInfo</code></a>, but for
- most programs it will be more efficient to switch to
- <a href="/pkg/os/#File.ReadDir"><code>File.ReadDir</code></a>.
- </p>
-
- <p><!-- CL 263141 -->
- The package now defines
- <a href="/pkg/os/#CreateTemp"><code>CreateTemp</code></a>,
- <a href="/pkg/os/#MkdirTemp"><code>MkdirTemp</code></a>,
- <a href="/pkg/os/#ReadFile"><code>ReadFile</code></a>, and
- <a href="/pkg/os/#WriteFile"><code>WriteFile</code></a>,
- to be used instead of functions defined in the
- <a href="/pkg/io/ioutil/"><code>io/ioutil</code></a> package.
- </p>
-
- <p><!-- CL 243906 -->
- The types <a href="/pkg/os/#FileInfo"><code>FileInfo</code></a>,
- <a href="/pkg/os/#FileMode"><code>FileMode</code></a>, and
- <a href="/pkg/os/#PathError"><code>PathError</code></a>
- are now aliases for types of the same name in the
- <a href="/pkg/io/fs/"><code>io/fs</code></a> package.
- Function signatures in the <a href="/pkg/os/"><code>os</code></a>
- package have been updated to refer to the names in the
- <a href="/pkg/io/fs/"><code>io/fs</code></a> package.
- This should not affect any existing code.
- </p>
-
- <p><!-- CL 243911 -->
- The new <a href="/pkg/os/#DirFS"><code>DirFS</code></a> function
- provides an implementation of
- <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a> backed by a tree
- of operating system files.
- </p>
- </dd>
-</dl><!-- os -->
-
-<dl id="os/signal"><dt><a href="/pkg/os/signal/">os/signal</a></dt>
- <dd>
- <p><!-- CL 219640 -->
- The new
- <a href="/pkg/os/signal/#NotifyContext"><code>NotifyContext</code></a>
- function allows creating contexts that are canceled upon arrival of
- specific signals.
- </p>
- </dd>
-</dl><!-- os/signal -->
-
-<dl id="path"><dt><a href="/pkg/path/">path</a></dt>
- <dd>
- <p><!-- CL 264397, golang.org/issues/28614 -->
- The <a href="/pkg/path/#Match"><code>Match</code></a> function now
- returns an error if the unmatched part of the pattern has a
- syntax error. Previously, the function returned early on a failed
- match, and thus did not report any later syntax error in the
- pattern.
- </p>
- </dd>
-</dl><!-- path -->
-
-<dl id="path/filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
- <dd>
- <p><!-- CL 267887 -->
- The new function
- <a href="/pkg/path/filepath/#WalkDir"><code>WalkDir</code></a>
- is similar to
- <a href="/pkg/path/filepath/#Walk"><code>Walk</code></a>,
- but is typically more efficient.
- The function passed to <code>WalkDir</code> receives a
- <a href="/pkg/io/fs/#DirEntry"><code>fs.DirEntry</code></a>
- instead of a
- <a href="/pkg/io/fs/#FileInfo"><code>fs.FileInfo</code></a>.
- (To clarify for those who recall the <code>Walk</code> function
- as taking an <a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a>,
- <code>os.FileInfo</code> is now an alias for <code>fs.FileInfo</code>.)
- </p>
-
- <p><!-- CL 264397, golang.org/issues/28614 -->
- The <a href="/pkg/path/filepath#Match"><code>Match</code></a> and
- <a href="/pkg/path/filepath#Glob"><code>Glob</code></a> functions now
- return an error if the unmatched part of the pattern has a
- syntax error. Previously, the functions returned early on a failed
- match, and thus did not report any later syntax error in the
- pattern.
- </p>
- </dd>
-</dl><!-- path/filepath -->
-
-<dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
- <dd>
- <p><!-- CL 249677 -->
- The <a href="/pkg/runtime#Error"><code>runtime.Error</code></a> values
- used when <code>SetPanicOnFault</code> is enabled may now have an
- <code>Addr</code> method. If that method exists, it returns the memory
- address that triggered the fault.
- </p>
- </dd>
-</dl><!-- runtime/debug -->
-
-<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
- <dd>
- <p><!-- CL 260858 -->
- <a href="/pkg/strconv/#ParseFloat"><code>ParseFloat</code></a> now uses
- the <a
- href="https://nigeltao.github.io/blog/2020/eisel-lemire.html">Eisel-Lemire
- algorithm</a>, improving performance by up to a factor of 2. This can
- also speed up decoding textual formats like <a
- href="/pkg/encoding/json/"><code>encoding/json</code></a>.
- </p>
- </dd>
-</dl><!-- strconv -->
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p><!-- CL 263271 -->
- <a href="/pkg/syscall/?GOOS=windows#NewCallback"><code>NewCallback</code></a>
- and
- <a href="/pkg/syscall/?GOOS=windows#NewCallbackCDecl"><code>NewCallbackCDecl</code></a>
- now correctly support callback functions with multiple
- sub-<code>uintptr</code>-sized arguments in a row. This may
- require changing uses of these functions to eliminate manual
- padding between small arguments.
- </p>
-
- <p><!-- CL 261917 -->
- <a href="/pkg/syscall/?GOOS=windows#SysProcAttr"><code>SysProcAttr</code></a> on Windows has a new <code>NoInheritHandles</code> field that disables inheriting handles when creating a new process.
- </p>
-
- <p><!-- CL 269761, golang.org/issue/42584 -->
- <a href="/pkg/syscall/?GOOS=windows#DLLError"><code>DLLError</code></a> on Windows now has an <code>Unwrap</code> method for unwrapping its underlying error.
- </p>
-
- <p><!-- CL 210639 -->
- On Linux,
- <a href="/pkg/syscall/#Setgid"><code>Setgid</code></a>,
- <a href="/pkg/syscall/#Setuid"><code>Setuid</code></a>,
- and related calls are now implemented.
- Previously, they returned an <code>syscall.EOPNOTSUPP</code> error.
- </p>
-
- <p><!-- CL 210639 -->
- On Linux, the new functions
- <a href="/pkg/syscall/#AllThreadsSyscall"><code>AllThreadsSyscall</code></a>
- and <a href="/pkg/syscall/#AllThreadsSyscall6"><code>AllThreadsSyscall6</code></a>
- may be used to make a system call on all Go threads in the process.
- These functions may only be used by programs that do not use cgo;
- if a program uses cgo, they will always return
- <a href="/pkg/syscall/#ENOTSUP"><code>syscall.ENOTSUP</code></a>.
- </p>
- </dd>
-</dl><!-- syscall -->
-
-<dl id="testing/iotest"><dt><a href="/pkg/testing/iotest/">testing/iotest</a></dt>
- <dd>
- <p><!-- CL 199501 -->
- The new
- <a href="/pkg/testing/iotest/#ErrReader"><code>ErrReader</code></a>
- function returns an
- <a href="/pkg/io/#Reader"><code>io.Reader</code></a> that always
- returns an error.
- </p>
-
- <p><!-- CL 243909 -->
- The new
- <a href="/pkg/testing/iotest/#TestReader"><code>TestReader</code></a>
- function tests that an <a href="/pkg/io/#Reader"><code>io.Reader</code></a>
- behaves correctly.
- </p>
- </dd>
-</dl><!-- testing/iotest -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 254257, golang.org/issue/29770 -->
- Newlines characters are now allowed inside action delimiters,
- permitting actions to span multiple lines.
- </p>
-
- <p><!-- CL 243938 -->
- The new <a href="/pkg/text/template/#ParseFS"><code>template.ParseFS</code></a>
- function and <a href="/pkg/text/template/#Template.ParseFS"><code>template.Template.ParseFS</code></a>
- method are like <a href="/pkg/text/template/#ParseGlob"><code>template.ParseGlob</code></a>
- and <a href="/pkg/text/template/#Template.ParseGlob"><code>template.Template.ParseGlob</code></a>,
- but read the templates from an <a href="/pkg/io/fs/#FS"><code>fs.FS</code></a>.
- </p>
- </dd>
-</dl><!-- text/template -->
-
-<dl id="text/template/parse"><dt><a href="/pkg/text/template/parse/">text/template/parse</a></dt>
- <dd>
- <p><!-- CL 229398, golang.org/issue/34652 -->
- A new <a href="/pkg/text/template/parse/#CommentNode"><code>CommentNode</code></a>
- was added to the parse tree. The <a href="/pkg/text/template/parse/#Mode"><code>Mode</code></a>
- field in the <code>parse.Tree</code> enables access to it.
- </p>
- </dd>
-</dl><!-- text/template/parse -->
-
-<dl id="time/tzdata"><dt><a href="/pkg/time/tzdata/">time/tzdata</a></dt>
- <dd>
- <p><!-- CL 261877 -->
- The slim timezone data format is now used for the timezone database in
- <code>$GOROOT/lib/time/zoneinfo.zip</code> and the embedded copy in this
- package. This reduces the size of the timezone database by about 350 KB.
- </p>
- </dd>
-</dl><!-- time/tzdata -->
-
-<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
- <dd>
- <p><!-- CL 248765 -->
- The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
- support throughout the system has been upgraded from Unicode 12.0.0 to
- <a href="https://www.unicode.org/versions/Unicode13.0.0/">Unicode 13.0.0</a>,
- which adds 5,930 new characters, including four new scripts, and 55 new emoji.
- Unicode 13.0.0 also designates plane 3 (U+30000-U+3FFFF) as the tertiary
- ideographic plane.
- </p>
- </dd>
-</dl><!-- unicode -->
diff --git a/doc/go1.17.html b/doc/go1.17.html
new file mode 100644
index 0000000000..a07290714f
--- /dev/null
+++ b/doc/go1.17.html
@@ -0,0 +1,92 @@
+<!--{
+ "Title": "Go 1.17 Release Notes",
+ "Path": "/doc/go1.17"
+}-->
+
+<!--
+NOTE: In this document and others in this directory, the convention is to
+set fixed-width phrases with non-fixed-width spaces, as in
+<code>hello</code> <code>world</code>.
+Do not send CLs removing the interior tags from such phrases.
+-->
+
+<style>
+ main ul li { margin: 0.5em 0; }
+</style>
+
+<h2 id="introduction">DRAFT RELEASE NOTES — Introduction to Go 1.17</h2>
+
+<p>
+ <strong>
+ Go 1.17 is not yet released. These are work-in-progress
+ release notes. Go 1.17 is expected to be released in August 2021.
+ </strong>
+</p>
+
+<h2 id="language">Changes to the language</h2>
+
+<p>
+ TODO: complete this section
+</p>
+
+<h2 id="ports">Ports</h2>
+
+<p>
+ TODO: complete this section, or delete if not needed
+</p>
+
+<h2 id="tools">Tools</h2>
+
+<p>
+ TODO: complete this section, or delete if not needed
+</p>
+
+<h3 id="go-command">Go command</h3>
+
+<h4 id="go-get"><code>go</code> <code>get</code></h4>
+
+<p><!-- golang.org/issue/37519 -->
+ The <code>go</code> <code>get</code> <code>-insecure</code> flag is
+ deprecated and has been removed. To permit the use of insecure schemes
+ when fetching dependencies, please use the <code>GOINSECURE</code>
+ environment variable. The <code>-insecure</code> flag also bypassed module
+ sum validation, use <code>GOPRIVATE</code> or <code>GONOSUMDB</code> if
+ you need that functionality. See <code>go</code> <code>help</code>
+ <code>environment</code> for details.
+</p>
+
+<h2 id="runtime">Runtime</h2>
+
+<p>
+ TODO: complete this section, or delete if not needed
+</p>
+
+<h2 id="compiler">Compiler</h2>
+
+<p>
+ TODO: complete this section, or delete if not needed
+</p>
+
+<h2 id="linker">Linker</h2>
+
+<p>
+ TODO: complete this section, or delete if not needed
+</p>
+
+<h2 id="library">Core library</h2>
+
+<p>
+ TODO: complete this section
+</p>
+
+<h3 id="minor_library_changes">Minor changes to the library</h3>
+
+<p>
+ As always, there are various minor changes and updates to the library,
+ made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
+ in mind.
+</p>
+
+<p>
+ TODO: complete this section
+</p>
diff --git a/doc/go1.2.html b/doc/go1.2.html
deleted file mode 100644
index 1f6051418c..0000000000
--- a/doc/go1.2.html
+++ /dev/null
@@ -1,979 +0,0 @@
-<!--{
- "Title": "Go 1.2 Release Notes",
- "Path": "/doc/go1.2",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction to Go 1.2</h2>
-
-<p>
-Since the release of <a href="/doc/go1.1.html">Go version 1.1</a> in April, 2013,
-the release schedule has been shortened to make the release process more efficient.
-This release, Go version 1.2 or Go 1.2 for short, arrives roughly six months after 1.1,
-while 1.1 took over a year to appear after 1.0.
-Because of the shorter time scale, 1.2 is a smaller delta than the step from 1.0 to 1.1,
-but it still has some significant developments, including
-a better scheduler and one new language feature.
-Of course, Go 1.2 keeps the <a href="/doc/go1compat.html">promise
-of compatibility</a>.
-The overwhelming majority of programs built with Go 1.1 (or 1.0 for that matter)
-will run without any changes whatsoever when moved to 1.2,
-although the introduction of one restriction
-to a corner of the language may expose already-incorrect code
-(see the discussion of the <a href="#use_of_nil">use of nil</a>).
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
-In the interest of firming up the specification, one corner case has been clarified,
-with consequences for programs.
-There is also one new language feature.
-</p>
-
-<h3 id="use_of_nil">Use of nil</h3>
-
-<p>
-The language now specifies that, for safety reasons,
-certain uses of nil pointers are guaranteed to trigger a run-time panic.
-For instance, in Go 1.0, given code like
-</p>
-
-<pre>
-type T struct {
- X [1<<24]byte
- Field int32
-}
-
-func main() {
- var x *T
- ...
-}
-</pre>
-
-<p>
-the <code>nil</code> pointer <code>x</code> could be used to access memory incorrectly:
-the expression <code>x.Field</code> could access memory at address <code>1<<24</code>.
-To prevent such unsafe behavior, in Go 1.2 the compilers now guarantee that any indirection through
-a nil pointer, such as illustrated here but also in nil pointers to arrays, nil interface values,
-nil slices, and so on, will either panic or return a correct, safe non-nil value.
-In short, any expression that explicitly or implicitly requires evaluation of a nil address is an error.
-The implementation may inject extra tests into the compiled program to enforce this behavior.
-</p>
-
-<p>
-Further details are in the
-<a href="//golang.org/s/go12nil">design document</a>.
-</p>
-
-<p>
-<em>Updating</em>:
-Most code that depended on the old behavior is erroneous and will fail when run.
-Such programs will need to be updated by hand.
-</p>
-
-<h3 id="three_index">Three-index slices</h3>
-
-<p>
-Go 1.2 adds the ability to specify the capacity as well as the length when using a slicing operation
-on an existing array or slice.
-A slicing operation creates a new slice by describing a contiguous section of an already-created array or slice:
-</p>
-
-<pre>
-var array [10]int
-slice := array[2:4]
-</pre>
-
-<p>
-The capacity of the slice is the maximum number of elements that the slice may hold, even after reslicing;
-it reflects the size of the underlying array.
-In this example, the capacity of the <code>slice</code> variable is 8.
-</p>
-
-<p>
-Go 1.2 adds new syntax to allow a slicing operation to specify the capacity as well as the length.
-A second
-colon introduces the capacity value, which must be less than or equal to the capacity of the
-source slice or array, adjusted for the origin. For instance,
-</p>
-
-<pre>
-slice = array[2:4:7]
-</pre>
-
-<p>
-sets the slice to have the same length as in the earlier example but its capacity is now only 5 elements (7-2).
-It is impossible to use this new slice value to access the last three elements of the original array.
-</p>
-
-<p>
-In this three-index notation, a missing first index (<code>[:i:j]</code>) defaults to zero but the other
-two indices must always be specified explicitly.
-It is possible that future releases of Go may introduce default values for these indices.
-</p>
-
-<p>
-Further details are in the
-<a href="//golang.org/s/go12slice">design document</a>.
-</p>
-
-<p>
-<em>Updating</em>:
-This is a backwards-compatible change that affects no existing programs.
-</p>
-
-<h2 id="impl">Changes to the implementations and tools</h2>
-
-<h3 id="preemption">Pre-emption in the scheduler</h3>
-
-<p>
-In prior releases, a goroutine that was looping forever could starve out other
-goroutines on the same thread, a serious problem when GOMAXPROCS
-provided only one user thread.
-In Go 1.2, this is partially addressed: The scheduler is invoked occasionally
-upon entry to a function.
-This means that any loop that includes a (non-inlined) function call can
-be pre-empted, allowing other goroutines to run on the same thread.
-</p>
-
-<h3 id="thread_limit">Limit on the number of threads</h3>
-
-<p>
-Go 1.2 introduces a configurable limit (default 10,000) to the total number of threads
-a single program may have in its address space, to avoid resource starvation
-issues in some environments.
-Note that goroutines are multiplexed onto threads so this limit does not directly
-limit the number of goroutines, only the number that may be simultaneously blocked
-in a system call.
-In practice, the limit is hard to reach.
-</p>
-
-<p>
-The new <a href="/pkg/runtime/debug/#SetMaxThreads"><code>SetMaxThreads</code></a> function in the
-<a href="/pkg/runtime/debug/"><code>runtime/debug</code></a> package controls the thread count limit.
-</p>
-
-<p>
-<em>Updating</em>:
-Few functions will be affected by the limit, but if a program dies because it hits the
-limit, it could be modified to call <code>SetMaxThreads</code> to set a higher count.
-Even better would be to refactor the program to need fewer threads, reducing consumption
-of kernel resources.
-</p>
-
-<h3 id="stack_size">Stack size</h3>
-
-<p>
-In Go 1.2, the minimum size of the stack when a goroutine is created has been lifted from 4KB to 8KB.
-Many programs were suffering performance problems with the old size, which had a tendency
-to introduce expensive stack-segment switching in performance-critical sections.
-The new number was determined by empirical testing.
-</p>
-
-<p>
-At the other end, the new function <a href="/pkg/runtime/debug/#SetMaxStack"><code>SetMaxStack</code></a>
-in the <a href="/pkg/runtime/debug"><code>runtime/debug</code></a> package controls
-the <em>maximum</em> size of a single goroutine's stack.
-The default is 1GB on 64-bit systems and 250MB on 32-bit systems.
-Before Go 1.2, it was too easy for a runaway recursion to consume all the memory on a machine.
-</p>
-
-<p>
-<em>Updating</em>:
-The increased minimum stack size may cause programs with many goroutines to use
-more memory. There is no workaround, but plans for future releases
-include new stack management technology that should address the problem better.
-</p>
-
-<h3 id="cgo_and_cpp">Cgo and C++</h3>
-
-<p>
-The <a href="/cmd/cgo/"><code>cgo</code></a> command will now invoke the C++
-compiler to build any pieces of the linked-to library that are written in C++;
-<a href="/cmd/cgo/">the documentation</a> has more detail.
-</p>
-
-<h3 id="go_tools_godoc">Godoc and vet moved to the go.tools subrepository</h3>
-
-<p>
-Both binaries are still included with the distribution, but the source code for the
-godoc and vet commands has moved to the
-<a href="//code.google.com/p/go.tools">go.tools</a> subrepository.
-</p>
-
-<p>
-Also, the core of the godoc program has been split into a
-<a href="https://code.google.com/p/go/source/browse/?repo=tools#hg%2Fgodoc">library</a>,
-while the command itself is in a separate
-<a href="https://code.google.com/p/go/source/browse/?repo=tools#hg%2Fcmd%2Fgodoc">directory</a>.
-The move allows the code to be updated easily and the separation into a library and command
-makes it easier to construct custom binaries for local sites and different deployment methods.
-</p>
-
-<p>
-<em>Updating</em>:
-Since godoc and vet are not part of the library,
-no client Go code depends on the their source and no updating is required.
-</p>
-
-<p>
-The binary distributions available from <a href="//golang.org">golang.org</a>
-include these binaries, so users of these distributions are unaffected.
-</p>
-
-<p>
-When building from source, users must use "go get" to install godoc and vet.
-(The binaries will continue to be installed in their usual locations, not
-<code>$GOPATH/bin</code>.)
-</p>
-
-<pre>
-$ go get code.google.com/p/go.tools/cmd/godoc
-$ go get code.google.com/p/go.tools/cmd/vet
-</pre>
-
-<h3 id="gccgo">Status of gccgo</h3>
-
-<p>
-We expect the future GCC 4.9 release to include gccgo with full
-support for Go 1.2.
-In the current (4.8.2) release of GCC, gccgo implements Go 1.1.2.
-</p>
-
-<h3 id="gc_changes">Changes to the gc compiler and linker</h3>
-
-<p>
-Go 1.2 has several semantic changes to the workings of the gc compiler suite.
-Most users will be unaffected by them.
-</p>
-
-<p>
-The <a href="/cmd/cgo/"><code>cgo</code></a> command now
-works when C++ is included in the library being linked against.
-See the <a href="/cmd/cgo/"><code>cgo</code></a> documentation
-for details.
-</p>
-
-<p>
-The gc compiler displayed a vestigial detail of its origins when
-a program had no <code>package</code> clause: it assumed
-the file was in package <code>main</code>.
-The past has been erased, and a missing <code>package</code> clause
-is now an error.
-</p>
-
-<p>
-On the ARM, the toolchain supports "external linking", which
-is a step towards being able to build shared libraries with the gc
-toolchain and to provide dynamic linking support for environments
-in which that is necessary.
-</p>
-
-<p>
-In the runtime for the ARM, with <code>5a</code>, it used to be possible to refer
-to the runtime-internal <code>m</code> (machine) and <code>g</code>
-(goroutine) variables using <code>R9</code> and <code>R10</code> directly.
-It is now necessary to refer to them by their proper names.
-</p>
-
-<p>
-Also on the ARM, the <code>5l</code> linker (sic) now defines the
-<code>MOVBS</code> and <code>MOVHS</code> instructions
-as synonyms of <code>MOVB</code> and <code>MOVH</code>,
-to make clearer the separation between signed and unsigned
-sub-word moves; the unsigned versions already existed with a
-<code>U</code> suffix.
-</p>
-
-<h3 id="cover">Test coverage</h3>
-
-<p>
-One major new feature of <a href="/pkg/go/"><code>go test</code></a> is
-that it can now compute and, with help from a new, separately installed
-"go tool cover" program, display test coverage results.
-</p>
-
-<p>
-The cover tool is part of the
-<a href="https://code.google.com/p/go/source/checkout?repo=tools"><code>go.tools</code></a>
-subrepository.
-It can be installed by running
-</p>
-
-<pre>
-$ go get code.google.com/p/go.tools/cmd/cover
-</pre>
-
-<p>
-The cover tool does two things.
-First, when "go test" is given the <code>-cover</code> flag, it is run automatically
-to rewrite the source for the package and insert instrumentation statements.
-The test is then compiled and run as usual, and basic coverage statistics are reported:
-</p>
-
-<pre>
-$ go test -cover fmt
-ok fmt 0.060s coverage: 91.4% of statements
-$
-</pre>
-
-<p>
-Second, for more detailed reports, different flags to "go test" can create a coverage profile file,
-which the cover program, invoked with "go tool cover", can then analyze.
-</p>
-
-<p>
-Details on how to generate and analyze coverage statistics can be found by running the commands
-</p>
-
-<pre>
-$ go help testflag
-$ go tool cover -help
-</pre>
-
-<h3 id="go_doc">The go doc command is deleted</h3>
-
-<p>
-The "go doc" command is deleted.
-Note that the <a href="/cmd/godoc/"><code>godoc</code></a> tool itself is not deleted,
-just the wrapping of it by the <a href="/cmd/go/"><code>go</code></a> command.
-All it did was show the documents for a package by package path,
-which godoc itself already does with more flexibility.
-It has therefore been deleted to reduce the number of documentation tools and,
-as part of the restructuring of godoc, encourage better options in future.
-</p>
-
-<p>
-<em>Updating</em>: For those who still need the precise functionality of running
-</p>
-
-<pre>
-$ go doc
-</pre>
-
-<p>
-in a directory, the behavior is identical to running
-</p>
-
-<pre>
-$ godoc .
-</pre>
-
-<h3 id="gocmd">Changes to the go command</h3>
-
-<p>
-The <a href="/cmd/go/"><code>go get</code></a> command
-now has a <code>-t</code> flag that causes it to download the dependencies
-of the tests run by the package, not just those of the package itself.
-By default, as before, dependencies of the tests are not downloaded.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-There are a number of significant performance improvements in the standard library; here are a few of them.
-</p>
-
-<ul>
-
-<li>
-The <a href="/pkg/compress/bzip2/"><code>compress/bzip2</code></a>
-decompresses about 30% faster.
-</li>
-
-<li>
-The <a href="/pkg/crypto/des/"><code>crypto/des</code></a> package
-is about five times faster.
-</li>
-
-<li>
-The <a href="/pkg/encoding/json/"><code>encoding/json</code></a> package
-encodes about 30% faster.
-</li>
-
-<li>
-Networking performance on Windows and BSD systems is about 30% faster through the use
-of an integrated network poller in the runtime, similar to what was done for Linux and OS X
-in Go 1.1.
-</li>
-
-</ul>
-
-<h2 id="library">Changes to the standard library</h2>
-
-
-<h3 id="archive_tar_zip">The archive/tar and archive/zip packages</h3>
-
-<p>
-The
-<a href="/pkg/archive/tar/"><code>archive/tar</code></a>
-and
-<a href="/pkg/archive/zip/"><code>archive/zip</code></a>
-packages have had a change to their semantics that may break existing programs.
-The issue is that they both provided an implementation of the
-<a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a>
-interface that was not compliant with the specification for that interface.
-In particular, their <code>Name</code> method returned the full
-path name of the entry, but the interface specification requires that
-the method return only the base name (final path element).
-</p>
-
-<p>
-<em>Updating</em>: Since this behavior was newly implemented and
-a bit obscure, it is possible that no code depends on the broken behavior.
-If there are programs that do depend on it, they will need to be identified
-and fixed manually.
-</p>
-
-<h3 id="encoding">The new encoding package</h3>
-
-<p>
-There is a new package, <a href="/pkg/encoding/"><code>encoding</code></a>,
-that defines a set of standard encoding interfaces that may be used to
-build custom marshalers and unmarshalers for packages such as
-<a href="/pkg/encoding/xml/"><code>encoding/xml</code></a>,
-<a href="/pkg/encoding/json/"><code>encoding/json</code></a>,
-and
-<a href="/pkg/encoding/binary/"><code>encoding/binary</code></a>.
-These new interfaces have been used to tidy up some implementations in
-the standard library.
-</p>
-
-<p>
-The new interfaces are called
-<a href="/pkg/encoding/#BinaryMarshaler"><code>BinaryMarshaler</code></a>,
-<a href="/pkg/encoding/#BinaryUnmarshaler"><code>BinaryUnmarshaler</code></a>,
-<a href="/pkg/encoding/#TextMarshaler"><code>TextMarshaler</code></a>,
-and
-<a href="/pkg/encoding/#TextUnmarshaler"><code>TextUnmarshaler</code></a>.
-Full details are in the <a href="/pkg/encoding/">documentation</a> for the package
-and a separate <a href="//golang.org/s/go12encoding">design document</a>.
-</p>
-
-<h3 id="fmt_indexed_arguments">The fmt package</h3>
-
-<p>
-The <a href="/pkg/fmt/"><code>fmt</code></a> package's formatted print
-routines such as <a href="/pkg/fmt/#Printf"><code>Printf</code></a>
-now allow the data items to be printed to be accessed in arbitrary order
-by using an indexing operation in the formatting specifications.
-Wherever an argument is to be fetched from the argument list for formatting,
-either as the value to be formatted or as a width or specification integer,
-a new optional indexing notation <code>[</code><em>n</em><code>]</code>
-fetches argument <em>n</em> instead.
-The value of <em>n</em> is 1-indexed.
-After such an indexing operating, the next argument to be fetched by normal
-processing will be <em>n</em>+1.
-</p>
-
-<p>
-For example, the normal <code>Printf</code> call
-</p>
-
-<pre>
-fmt.Sprintf("%c %c %c\n", 'a', 'b', 'c')
-</pre>
-
-<p>
-would create the string <code>"a b c"</code>, but with indexing operations like this,
-</p>
-
-<pre>
-fmt.Sprintf("%[3]c %[1]c %c\n", 'a', 'b', 'c')
-</pre>
-
-<p>
-the result is "<code>"c a b"</code>. The <code>[3]</code> index accesses the third formatting
-argument, which is <code>'c'</code>, <code>[1]</code> accesses the first, <code>'a'</code>,
-and then the next fetch accesses the argument following that one, <code>'b'</code>.
-</p>
-
-<p>
-The motivation for this feature is programmable format statements to access
-the arguments in different order for localization, but it has other uses:
-</p>
-
-<pre>
-log.Printf("trace: value %v of type %[1]T\n", expensiveFunction(a.b[c]))
-</pre>
-
-<p>
-<em>Updating</em>: The change to the syntax of format specifications
-is strictly backwards compatible, so it affects no working programs.
-</p>
-
-<h3 id="text_template">The text/template and html/template packages</h3>
-
-<p>
-The
-<a href="/pkg/text/template/"><code>text/template</code></a> package
-has a couple of changes in Go 1.2, both of which are also mirrored in the
-<a href="/pkg/html/template/"><code>html/template</code></a> package.
-</p>
-
-<p>
-First, there are new default functions for comparing basic types.
-The functions are listed in this table, which shows their names and
-the associated familiar comparison operator.
-</p>
-
-<table cellpadding="0" summary="Template comparison functions">
-<tr>
-<th width="50"></th><th width="100">Name</th> <th width="50">Operator</th>
-</tr>
-<tr>
-<td></td><td><code>eq</code></td> <td><code>==</code></td>
-</tr>
-<tr>
-<td></td><td><code>ne</code></td> <td><code>!=</code></td>
-</tr>
-<tr>
-<td></td><td><code>lt</code></td> <td><code>&lt;</code></td>
-</tr>
-<tr>
-<td></td><td><code>le</code></td> <td><code>&lt;=</code></td>
-</tr>
-<tr>
-<td></td><td><code>gt</code></td> <td><code>&gt;</code></td>
-</tr>
-<tr>
-<td></td><td><code>ge</code></td> <td><code>&gt;=</code></td>
-</tr>
-</table>
-
-<p>
-These functions behave slightly differently from the corresponding Go operators.
-First, they operate only on basic types (<code>bool</code>, <code>int</code>,
-<code>float64</code>, <code>string</code>, etc.).
-(Go allows comparison of arrays and structs as well, under some circumstances.)
-Second, values can be compared as long as they are the same sort of value:
-any signed integer value can be compared to any other signed integer value for example. (Go
-does not permit comparing an <code>int8</code> and an <code>int16</code>).
-Finally, the <code>eq</code> function (only) allows comparison of the first
-argument with one or more following arguments. The template in this example,
-</p>
-
-<pre>
-{{"{{"}}if eq .A 1 2 3 {{"}}"}} equal {{"{{"}}else{{"}}"}} not equal {{"{{"}}end{{"}}"}}
-</pre>
-
-<p>
-reports "equal" if <code>.A</code> is equal to <em>any</em> of 1, 2, or 3.
-</p>
-
-<p>
-The second change is that a small addition to the grammar makes "if else if" chains easier to write.
-Instead of writing,
-</p>
-
-<pre>
-{{"{{"}}if eq .A 1{{"}}"}} X {{"{{"}}else{{"}}"}} {{"{{"}}if eq .A 2{{"}}"}} Y {{"{{"}}end{{"}}"}} {{"{{"}}end{{"}}"}}
-</pre>
-
-<p>
-one can fold the second "if" into the "else" and have only one "end", like this:
-</p>
-
-<pre>
-{{"{{"}}if eq .A 1{{"}}"}} X {{"{{"}}else if eq .A 2{{"}}"}} Y {{"{{"}}end{{"}}"}}
-</pre>
-
-<p>
-The two forms are identical in effect; the difference is just in the syntax.
-</p>
-
-<p>
-<em>Updating</em>: Neither the "else if" change nor the comparison functions
-affect existing programs. Those that
-already define functions called <code>eq</code> and so on through a function
-map are unaffected because the associated function map will override the new
-default function definitions.
-</p>
-
-<h3 id="new_packages">New packages</h3>
-
-<p>
-There are two new packages.
-</p>
-
-<ul>
-<li>
-The <a href="/pkg/encoding/"><code>encoding</code></a> package is
-<a href="#encoding">described above</a>.
-</li>
-<li>
-The <a href="/pkg/image/color/palette/"><code>image/color/palette</code></a> package
-provides standard color palettes.
-</li>
-</ul>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-The following list summarizes a number of minor changes to the library, mostly additions.
-See the relevant package documentation for more information about each change.
-</p>
-
-<ul>
-
-<li>
-The <a href="/pkg/archive/zip/"><code>archive/zip</code></a> package
-adds the
-<a href="/pkg/archive/zip/#File.DataOffset"><code>DataOffset</code></a> accessor
-to return the offset of a file's (possibly compressed) data within the archive.
-</li>
-
-<li>
-The <a href="/pkg/bufio/"><code>bufio</code></a> package
-adds <a href="/pkg/bufio/#Reader.Reset"><code>Reset</code></a>
-methods to <a href="/pkg/bufio/#Reader"><code>Reader</code></a> and
-<a href="/pkg/bufio/#Writer"><code>Writer</code></a>.
-These methods allow the <a href="/pkg/io/#Reader"><code>Readers</code></a>
-and <a href="/pkg/io/#Writer"><code>Writers</code></a>
-to be re-used on new input and output readers and writers, saving
-allocation overhead.
-</li>
-
-<li>
-The <a href="/pkg/compress/bzip2/"><code>compress/bzip2</code></a>
-can now decompress concatenated archives.
-</li>
-
-<li>
-The <a href="/pkg/compress/flate/"><code>compress/flate</code></a>
-package adds a <a href="/pkg/compress/flate/#Writer.Reset"><code>Reset</code></a>
-method on the <a href="/pkg/compress/flate/#Writer"><code>Writer</code></a>,
-to make it possible to reduce allocation when, for instance, constructing an
-archive to hold multiple compressed files.
-</li>
-
-<li>
-The <a href="/pkg/compress/gzip/"><code>compress/gzip</code></a> package's
-<a href="/pkg/compress/gzip/#Writer"><code>Writer</code></a> type adds a
-<a href="/pkg/compress/gzip/#Writer.Reset"><code>Reset</code></a>
-so it may be reused.
-</li>
-
-<li>
-The <a href="/pkg/compress/zlib/"><code>compress/zlib</code></a> package's
-<a href="/pkg/compress/zlib/#Writer"><code>Writer</code></a> type adds a
-<a href="/pkg/compress/zlib/#Writer.Reset"><code>Reset</code></a>
-so it may be reused.
-</li>
-
-<li>
-The <a href="/pkg/container/heap/"><code>container/heap</code></a> package
-adds a <a href="/pkg/container/heap/#Fix"><code>Fix</code></a>
-method to provide a more efficient way to update an item's position in the heap.
-</li>
-
-<li>
-The <a href="/pkg/container/list/"><code>container/list</code></a> package
-adds the <a href="/pkg/container/list/#List.MoveBefore"><code>MoveBefore</code></a>
-and
-<a href="/pkg/container/list/#List.MoveAfter"><code>MoveAfter</code></a>
-methods, which implement the obvious rearrangement.
-</li>
-
-<li>
-The <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a> package
-adds the a new GCM mode (Galois Counter Mode), which is almost always
-used with AES encryption.
-</li>
-
-<li>
-The
-<a href="/pkg/crypto/md5/"><code>crypto/md5</code></a> package
-adds a new <a href="/pkg/crypto/md5/#Sum"><code>Sum</code></a> function
-to simplify hashing without sacrificing performance.
-</li>
-
-<li>
-Similarly, the
-<a href="/pkg/crypto/md5/"><code>crypto/sha1</code></a> package
-adds a new <a href="/pkg/crypto/sha1/#Sum"><code>Sum</code></a> function.
-</li>
-
-<li>
-Also, the
-<a href="/pkg/crypto/sha256/"><code>crypto/sha256</code></a> package
-adds <a href="/pkg/crypto/sha256/#Sum256"><code>Sum256</code></a>
-and <a href="/pkg/crypto/sha256/#Sum224"><code>Sum224</code></a> functions.
-</li>
-
-<li>
-Finally, the <a href="/pkg/crypto/sha512/"><code>crypto/sha512</code></a> package
-adds <a href="/pkg/crypto/sha512/#Sum512"><code>Sum512</code></a> and
-<a href="/pkg/crypto/sha512/#Sum384"><code>Sum384</code></a> functions.
-</li>
-
-<li>
-The <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package
-adds support for reading and writing arbitrary extensions.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package adds
-support for TLS 1.1, 1.2 and AES-GCM.
-</li>
-
-<li>
-The <a href="/pkg/database/sql/"><code>database/sql</code></a> package adds a
-<a href="/pkg/database/sql/#DB.SetMaxOpenConns"><code>SetMaxOpenConns</code></a>
-method on <a href="/pkg/database/sql/#DB"><code>DB</code></a> to limit the
-number of open connections to the database.
-</li>
-
-<li>
-The <a href="/pkg/encoding/csv/"><code>encoding/csv</code></a> package
-now always allows trailing commas on fields.
-</li>
-
-<li>
-The <a href="/pkg/encoding/gob/"><code>encoding/gob</code></a> package
-now treats channel and function fields of structures as if they were unexported,
-even if they are not. That is, it ignores them completely. Previously they would
-trigger an error, which could cause unexpected compatibility problems if an
-embedded structure added such a field.
-The package also now supports the generic <code>BinaryMarshaler</code> and
-<code>BinaryUnmarshaler</code> interfaces of the
-<a href="/pkg/encoding/"><code>encoding</code></a> package
-described above.
-</li>
-
-<li>
-The <a href="/pkg/encoding/json/"><code>encoding/json</code></a> package
-now will always escape ampersands as "\u0026" when printing strings.
-It will now accept but correct invalid UTF-8 in
-<a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a>
-(such input was previously rejected).
-Finally, it now supports the generic encoding interfaces of the
-<a href="/pkg/encoding/"><code>encoding</code></a> package
-described above.
-</li>
-
-<li>
-The <a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> package
-now allows attributes stored in pointers to be marshaled.
-It also supports the generic encoding interfaces of the
-<a href="/pkg/encoding/"><code>encoding</code></a> package
-described above through the new
-<a href="/pkg/encoding/xml/#Marshaler"><code>Marshaler</code></a>,
-<a href="/pkg/encoding/xml/#Unmarshaler"><code>Unmarshaler</code></a>,
-and related
-<a href="/pkg/encoding/xml/#MarshalerAttr"><code>MarshalerAttr</code></a> and
-<a href="/pkg/encoding/xml/#UnmarshalerAttr"><code>UnmarshalerAttr</code></a>
-interfaces.
-The package also adds a
-<a href="/pkg/encoding/xml/#Encoder.Flush"><code>Flush</code></a> method
-to the
-<a href="/pkg/encoding/xml/#Encoder"><code>Encoder</code></a>
-type for use by custom encoders. See the documentation for
-<a href="/pkg/encoding/xml/#Encoder.EncodeToken"><code>EncodeToken</code></a>
-to see how to use it.
-</li>
-
-<li>
-The <a href="/pkg/flag/"><code>flag</code></a> package now
-has a <a href="/pkg/flag/#Getter"><code>Getter</code></a> interface
-to allow the value of a flag to be retrieved. Due to the
-Go 1 compatibility guidelines, this method cannot be added to the existing
-<a href="/pkg/flag/#Value"><code>Value</code></a>
-interface, but all the existing standard flag types implement it.
-The package also now exports the <a href="/pkg/flag/#CommandLine"><code>CommandLine</code></a>
-flag set, which holds the flags from the command line.
-</li>
-
-<li>
-The <a href="/pkg/go/ast/"><code>go/ast</code></a> package's
-<a href="/pkg/go/ast/#SliceExpr"><code>SliceExpr</code></a> struct
-has a new boolean field, <code>Slice3</code>, which is set to true
-when representing a slice expression with three indices (two colons).
-The default is false, representing the usual two-index form.
-</li>
-
-<li>
-The <a href="/pkg/go/build/"><code>go/build</code></a> package adds
-the <code>AllTags</code> field
-to the <a href="/pkg/go/build/#Package"><code>Package</code></a> type,
-to make it easier to process build tags.
-</li>
-
-<li>
-The <a href="/pkg/image/draw/"><code>image/draw</code></a> package now
-exports an interface, <a href="/pkg/image/draw/#Drawer"><code>Drawer</code></a>,
-that wraps the standard <a href="/pkg/image/draw/#Draw"><code>Draw</code></a> method.
-The Porter-Duff operators now implement this interface, in effect binding an operation to
-the draw operator rather than providing it explicitly.
-Given a paletted image as its destination, the new
-<a href="/pkg/image/draw/#FloydSteinberg"><code>FloydSteinberg</code></a>
-implementation of the
-<a href="/pkg/image/draw/#Drawer"><code>Drawer</code></a>
-interface will use the Floyd-Steinberg error diffusion algorithm to draw the image.
-To create palettes suitable for such processing, the new
-<a href="/pkg/image/draw/#Quantizer"><code>Quantizer</code></a> interface
-represents implementations of quantization algorithms that choose a palette
-given a full-color image.
-There are no implementations of this interface in the library.
-</li>
-
-<li>
-The <a href="/pkg/image/gif/"><code>image/gif</code></a> package
-can now create GIF files using the new
-<a href="/pkg/image/gif/#Encode"><code>Encode</code></a>
-and <a href="/pkg/image/gif/#EncodeAll"><code>EncodeAll</code></a>
-functions.
-Their options argument allows specification of an image
-<a href="/pkg/image/draw/#Quantizer"><code>Quantizer</code></a> to use;
-if it is <code>nil</code>, the generated GIF will use the
-<a href="/pkg/image/color/palette/#Plan9"><code>Plan9</code></a>
-color map (palette) defined in the new
-<a href="/pkg/image/color/palette/"><code>image/color/palette</code></a> package.
-The options also specify a
-<a href="/pkg/image/draw/#Drawer"><code>Drawer</code></a>
-to use to create the output image;
-if it is <code>nil</code>, Floyd-Steinberg error diffusion is used.
-</li>
-
-<li>
-The <a href="/pkg/io/#Copy"><code>Copy</code></a> method of the
-<a href="/pkg/io/"><code>io</code></a> package now prioritizes its
-arguments differently.
-If one argument implements <a href="/pkg/io/#WriterTo"><code>WriterTo</code></a>
-and the other implements <a href="/pkg/io/#ReaderFrom"><code>ReaderFrom</code></a>,
-<a href="/pkg/io/#Copy"><code>Copy</code></a> will now invoke
-<a href="/pkg/io/#WriterTo"><code>WriterTo</code></a> to do the work,
-so that less intermediate buffering is required in general.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package requires cgo by default
-because the host operating system must in general mediate network call setup.
-On some systems, though, it is possible to use the network without cgo, and useful
-to do so, for instance to avoid dynamic linking.
-The new build tag <code>netgo</code> (off by default) allows the construction of a
-<code>net</code> package in pure Go on those systems where it is possible.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package adds a new field
-<code>DualStack</code> to the <a href="/pkg/net/#Dialer"><code>Dialer</code></a>
-struct for TCP connection setup using a dual IP stack as described in
-<a href="https://tools.ietf.org/html/rfc6555">RFC 6555</a>.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package will no longer
-transmit cookies that are incorrect according to
-<a href="https://tools.ietf.org/html/rfc6265">RFC 6265</a>.
-It just logs an error and sends nothing.
-Also,
-the <a href="/pkg/net/http/"><code>net/http</code></a> package's
-<a href="/pkg/net/http/#ReadResponse"><code>ReadResponse</code></a>
-function now permits the <code>*Request</code> parameter to be <code>nil</code>,
-whereupon it assumes a GET request.
-Finally, an HTTP server will now serve HEAD
-requests transparently, without the need for special casing in handler code.
-While serving a HEAD request, writes to a
-<a href="/pkg/net/http/#Handler"><code>Handler</code></a>'s
-<a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>
-are absorbed by the
-<a href="/pkg/net/http/#Server"><code>Server</code></a>
-and the client receives an empty body as required by the HTTP specification.
-</li>
-
-<li>
-The <a href="/pkg/os/exec/"><code>os/exec</code></a> package's
-<a href="/pkg/os/exec/#Cmd.StdinPipe"><code>Cmd.StdinPipe</code></a> method
-returns an <code>io.WriteCloser</code>, but has changed its concrete
-implementation from <code>*os.File</code> to an unexported type that embeds
-<code>*os.File</code>, and it is now safe to close the returned value.
-Before Go 1.2, there was an unavoidable race that this change fixes.
-Code that needs access to the methods of <code>*os.File</code> can use an
-interface type assertion, such as <code>wc.(interface{ Sync() error })</code>.
-</li>
-
-<li>
-The <a href="/pkg/runtime/"><code>runtime</code></a> package relaxes
-the constraints on finalizer functions in
-<a href="/pkg/runtime/#SetFinalizer"><code>SetFinalizer</code></a>: the
-actual argument can now be any type that is assignable to the formal type of
-the function, as is the case for any normal function call in Go.
-</li>
-
-<li>
-The <a href="/pkg/sort/"><code>sort</code></a> package has a new
-<a href="/pkg/sort/#Stable"><code>Stable</code></a> function that implements
-stable sorting. It is less efficient than the normal sort algorithm, however.
-</li>
-
-<li>
-The <a href="/pkg/strings/"><code>strings</code></a> package adds
-an <a href="/pkg/strings/#IndexByte"><code>IndexByte</code></a>
-function for consistency with the <a href="/pkg/bytes/"><code>bytes</code></a> package.
-</li>
-
-<li>
-The <a href="/pkg/sync/atomic/"><code>sync/atomic</code></a> package
-adds a new set of swap functions that atomically exchange the argument with the
-value stored in the pointer, returning the old value.
-The functions are
-<a href="/pkg/sync/atomic/#SwapInt32"><code>SwapInt32</code></a>,
-<a href="/pkg/sync/atomic/#SwapInt64"><code>SwapInt64</code></a>,
-<a href="/pkg/sync/atomic/#SwapUint32"><code>SwapUint32</code></a>,
-<a href="/pkg/sync/atomic/#SwapUint64"><code>SwapUint64</code></a>,
-<a href="/pkg/sync/atomic/#SwapUintptr"><code>SwapUintptr</code></a>,
-and
-<a href="/pkg/sync/atomic/#SwapPointer"><code>SwapPointer</code></a>,
-which swaps an <code>unsafe.Pointer</code>.
-</li>
-
-<li>
-The <a href="/pkg/syscall/"><code>syscall</code></a> package now implements
-<a href="/pkg/syscall/#Sendfile"><code>Sendfile</code></a> for Darwin.
-</li>
-
-<li>
-The <a href="/pkg/testing/"><code>testing</code></a> package
-now exports the <a href="/pkg/testing/#TB"><code>TB</code></a> interface.
-It records the methods in common with the
-<a href="/pkg/testing/#T"><code>T</code></a>
-and
-<a href="/pkg/testing/#B"><code>B</code></a> types,
-to make it easier to share code between tests and benchmarks.
-Also, the
-<a href="/pkg/testing/#AllocsPerRun"><code>AllocsPerRun</code></a>
-function now quantizes the return value to an integer (although it
-still has type <code>float64</code>), to round off any error caused by
-initialization and make the result more repeatable.
-</li>
-
-<li>
-The <a href="/pkg/text/template/"><code>text/template</code></a> package
-now automatically dereferences pointer values when evaluating the arguments
-to "escape" functions such as "html", to bring the behavior of such functions
-in agreement with that of other printing functions such as "printf".
-</li>
-
-<li>
-In the <a href="/pkg/time/"><code>time</code></a> package, the
-<a href="/pkg/time/#Parse"><code>Parse</code></a> function
-and
-<a href="/pkg/time/#Time.Format"><code>Format</code></a>
-method
-now handle time zone offsets with seconds, such as in the historical
-date "1871-01-01T05:33:02+00:34:08".
-Also, pattern matching in the formats for those routines is stricter: a non-lowercase letter
-must now follow the standard words such as "Jan" and "Mon".
-</li>
-
-<li>
-The <a href="/pkg/unicode/"><code>unicode</code></a> package
-adds <a href="/pkg/unicode/#In"><code>In</code></a>,
-a nicer-to-use but equivalent version of the original
-<a href="/pkg/unicode/#IsOneOf"><code>IsOneOf</code></a>,
-to see whether a character is a member of a Unicode category.
-</li>
-
-</ul>
diff --git a/doc/go1.3.html b/doc/go1.3.html
deleted file mode 100644
index 18b3ec65d2..0000000000
--- a/doc/go1.3.html
+++ /dev/null
@@ -1,608 +0,0 @@
-<!--{
- "Title": "Go 1.3 Release Notes",
- "Path": "/doc/go1.3",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction to Go 1.3</h2>
-
-<p>
-The latest Go release, version 1.3, arrives six months after 1.2,
-and contains no language changes.
-It focuses primarily on implementation work, providing
-precise garbage collection,
-a major refactoring of the compiler toolchain that results in
-faster builds, especially for large projects,
-significant performance improvements across the board,
-and support for DragonFly BSD, Solaris, Plan 9 and Google's Native Client architecture (NaCl).
-It also has an important refinement to the memory model regarding synchronization.
-As always, Go 1.3 keeps the <a href="/doc/go1compat.html">promise
-of compatibility</a>,
-and almost everything
-will continue to compile and run without change when moved to 1.3.
-</p>
-
-<h2 id="os">Changes to the supported operating systems and architectures</h2>
-
-<h3 id="win2000">Removal of support for Windows 2000</h3>
-
-<p>
-Microsoft stopped supporting Windows 2000 in 2010.
-Since it has <a href="https://codereview.appspot.com/74790043">implementation difficulties</a>
-regarding exception handling (signals in Unix terminology),
-as of Go 1.3 it is not supported by Go either.
-</p>
-
-<h3 id="dragonfly">Support for DragonFly BSD</h3>
-
-<p>
-Go 1.3 now includes experimental support for DragonFly BSD on the <code>amd64</code> (64-bit x86) and <code>386</code> (32-bit x86) architectures.
-It uses DragonFly BSD 3.6 or above.
-</p>
-
-<h3 id="freebsd">Support for FreeBSD</h3>
-
-<p>
-It was not announced at the time, but since the release of Go 1.2, support for Go on FreeBSD
-requires FreeBSD 8 or above.
-</p>
-
-<p>
-As of Go 1.3, support for Go on FreeBSD requires that the kernel be compiled with the
-<code>COMPAT_FREEBSD32</code> flag configured.
-</p>
-
-<p>
-In concert with the switch to EABI syscalls for ARM platforms, Go 1.3 will run only on FreeBSD 10.
-The x86 platforms, 386 and amd64, are unaffected.
-</p>
-
-<h3 id="nacl">Support for Native Client</h3>
-
-<p>
-Support for the Native Client virtual machine architecture has returned to Go with the 1.3 release.
-It runs on the 32-bit Intel architectures (<code>GOARCH=386</code>) and also on 64-bit Intel, but using
-32-bit pointers (<code>GOARCH=amd64p32</code>).
-There is not yet support for Native Client on ARM.
-Note that this is Native Client (NaCl), not Portable Native Client (PNaCl).
-Details about Native Client are <a href="https://developers.google.com/native-client/dev/">here</a>;
-how to set up the Go version is described <a href="//golang.org/wiki/NativeClient">here</a>.
-</p>
-
-<h3 id="netbsd">Support for NetBSD</h3>
-
-<p>
-As of Go 1.3, support for Go on NetBSD requires NetBSD 6.0 or above.
-</p>
-
-<h3 id="openbsd">Support for OpenBSD</h3>
-
-<p>
-As of Go 1.3, support for Go on OpenBSD requires OpenBSD 5.5 or above.
-</p>
-
-<h3 id="plan9">Support for Plan 9</h3>
-
-<p>
-Go 1.3 now includes experimental support for Plan 9 on the <code>386</code> (32-bit x86) architecture.
-It requires the <code>Tsemacquire</code> syscall, which has been in Plan 9 since June, 2012.
-</p>
-
-<h3 id="solaris">Support for Solaris</h3>
-
-<p>
-Go 1.3 now includes experimental support for Solaris on the <code>amd64</code> (64-bit x86) architecture.
-It requires illumos, Solaris 11 or above.
-</p>
-
-<h2 id="memory">Changes to the memory model</h2>
-
-<p>
-The Go 1.3 memory model <a href="https://codereview.appspot.com/75130045">adds a new rule</a>
-concerning sending and receiving on buffered channels,
-to make explicit that a buffered channel can be used as a simple
-semaphore, using a send into the
-channel to acquire and a receive from the channel to release.
-This is not a language change, just a clarification about an expected property of communication.
-</p>
-
-<h2 id="impl">Changes to the implementations and tools</h2>
-
-<h3 id="stacks">Stack</h3>
-
-<p>
-Go 1.3 has changed the implementation of goroutine stacks away from the old,
-"segmented" model to a contiguous model.
-When a goroutine needs more stack
-than is available, its stack is transferred to a larger single block of memory.
-The overhead of this transfer operation amortizes well and eliminates the old "hot spot"
-problem when a calculation repeatedly steps across a segment boundary.
-Details including performance numbers are in this
-<a href="//golang.org/s/contigstacks">design document</a>.
-</p>
-
-<h3 id="garbage_collector">Changes to the garbage collector</h3>
-
-<p>
-For a while now, the garbage collector has been <em>precise</em> when examining
-values in the heap; the Go 1.3 release adds equivalent precision to values on the stack.
-This means that a non-pointer Go value such as an integer will never be mistaken for a
-pointer and prevent unused memory from being reclaimed.
-</p>
-
-<p>
-Starting with Go 1.3, the runtime assumes that values with pointer type
-contain pointers and other values do not.
-This assumption is fundamental to the precise behavior of both stack expansion
-and garbage collection.
-Programs that use <a href="/pkg/unsafe/">package unsafe</a>
-to store integers in pointer-typed values are illegal and will crash if the runtime detects the behavior.
-Programs that use <a href="/pkg/unsafe/">package unsafe</a> to store pointers
-in integer-typed values are also illegal but more difficult to diagnose during execution.
-Because the pointers are hidden from the runtime, a stack expansion or garbage collection
-may reclaim the memory they point at, creating
-<a href="//en.wikipedia.org/wiki/Dangling_pointer">dangling pointers</a>.
-</p>
-
-<p>
-<em>Updating</em>: Code that uses <code>unsafe.Pointer</code> to convert
-an integer-typed value held in memory into a pointer is illegal and must be rewritten.
-Such code can be identified by <code>go vet</code>.
-</p>
-
-<h3 id="map">Map iteration</h3>
-
-<p>
-Iterations over small maps no longer happen in a consistent order.
-Go 1 defines that &ldquo;<a href="//golang.org/ref/spec#For_statements">The iteration order over maps
-is not specified and is not guaranteed to be the same from one iteration to the next.</a>&rdquo;
-To keep code from depending on map iteration order,
-Go 1.0 started each map iteration at a random index in the map.
-A new map implementation introduced in Go 1.1 neglected to randomize
-iteration for maps with eight or fewer entries, although the iteration order
-can still vary from system to system.
-This has allowed people to write Go 1.1 and Go 1.2 programs that
-depend on small map iteration order and therefore only work reliably on certain systems.
-Go 1.3 reintroduces random iteration for small maps in order to flush out these bugs.
-</p>
-
-<p>
-<em>Updating</em>: If code assumes a fixed iteration order for small maps,
-it will break and must be rewritten not to make that assumption.
-Because only small maps are affected, the problem arises most often in tests.
-</p>
-
-<h3 id="liblink">The linker</h3>
-
-<p>
-As part of the general <a href="//golang.org/s/go13linker">overhaul</a> to
-the Go linker, the compilers and linkers have been refactored.
-The linker is still a C program, but now the instruction selection phase that
-was part of the linker has been moved to the compiler through the creation of a new
-library called <code>liblink</code>.
-By doing instruction selection only once, when the package is first compiled,
-this can speed up compilation of large projects significantly.
-</p>
-
-<p>
-<em>Updating</em>: Although this is a major internal change, it should have no
-effect on programs.
-</p>
-
-<h3 id="gccgo">Status of gccgo</h3>
-
-<p>
-GCC release 4.9 will contain the Go 1.2 (not 1.3) version of gccgo.
-The release schedules for the GCC and Go projects do not coincide,
-which means that 1.3 will be available in the development branch but
-that the next GCC release, 4.10, will likely have the Go 1.4 version of gccgo.
-</p>
-
-<h3 id="gocmd">Changes to the go command</h3>
-
-<p>
-The <a href="/cmd/go/"><code>cmd/go</code></a> command has several new
-features.
-The <a href="/cmd/go/"><code>go run</code></a> and
-<a href="/cmd/go/"><code>go test</code></a> subcommands
-support a new <code>-exec</code> option to specify an alternate
-way to run the resulting binary.
-Its immediate purpose is to support NaCl.
-</p>
-
-<p>
-The test coverage support of the <a href="/cmd/go/"><code>go test</code></a>
-subcommand now automatically sets the coverage mode to <code>-atomic</code>
-when the race detector is enabled, to eliminate false reports about unsafe
-access to coverage counters.
-</p>
-
-<p>
-The <a href="/cmd/go/"><code>go test</code></a> subcommand
-now always builds the package, even if it has no test files.
-Previously, it would do nothing if no test files were present.
-</p>
-
-<p>
-The <a href="/cmd/go/"><code>go build</code></a> subcommand
-supports a new <code>-i</code> option to install dependencies
-of the specified target, but not the target itself.
-</p>
-
-<p>
-Cross compiling with <a href="/cmd/cgo/"><code>cgo</code></a> enabled
-is now supported.
-The CC_FOR_TARGET and CXX_FOR_TARGET environment
-variables are used when running all.bash to specify the cross compilers
-for C and C++ code, respectively.
-</p>
-
-<p>
-Finally, the go command now supports packages that import Objective-C
-files (suffixed <code>.m</code>) through cgo.
-</p>
-
-<h3 id="cgo">Changes to cgo</h3>
-
-<p>
-The <a href="/cmd/cgo/"><code>cmd/cgo</code></a> command,
-which processes <code>import "C"</code> declarations in Go packages,
-has corrected a serious bug that may cause some packages to stop compiling.
-Previously, all pointers to incomplete struct types translated to the Go type <code>*[0]byte</code>,
-with the effect that the Go compiler could not diagnose passing one kind of struct pointer
-to a function expecting another.
-Go 1.3 corrects this mistake by translating each different
-incomplete struct to a different named type.
-</p>
-
-<p>
-Given the C declaration <code>typedef struct S T</code> for an incomplete <code>struct S</code>,
-some Go code used this bug to refer to the types <code>C.struct_S</code> and <code>C.T</code> interchangeably.
-Cgo now explicitly allows this use, even for completed struct types.
-However, some Go code also used this bug to pass (for example) a <code>*C.FILE</code>
-from one package to another.
-This is not legal and no longer works: in general Go packages
-should avoid exposing C types and names in their APIs.
-</p>
-
-<p>
-<em>Updating</em>: Code confusing pointers to incomplete types or
-passing them across package boundaries will no longer compile
-and must be rewritten.
-If the conversion is correct and must be preserved,
-use an explicit conversion via <a href="/pkg/unsafe/#Pointer"><code>unsafe.Pointer</code></a>.
-</p>
-
-<h3 id="swig">SWIG 3.0 required for programs that use SWIG</h3>
-
-<p>
-For Go programs that use SWIG, SWIG version 3.0 is now required.
-The <a href="/cmd/go"><code>cmd/go</code></a> command will now link the
-SWIG generated object files directly into the binary, rather than
-building and linking with a shared library.
-</p>
-
-<h3 id="gc_flag">Command-line flag parsing</h3>
-
-<p>
-In the gc toolchain, the assemblers now use the
-same command-line flag parsing rules as the Go flag package, a departure
-from the traditional Unix flag parsing.
-This may affect scripts that invoke the tool directly.
-For example,
-<code>go tool 6a -SDfoo</code> must now be written
-<code>go tool 6a -S -D foo</code>.
-(The same change was made to the compilers and linkers in <a href="/doc/go1.1#gc_flag">Go 1.1</a>.)
-</p>
-
-<h3 id="godoc">Changes to godoc</h3>
-<p>
-When invoked with the <code>-analysis</code> flag,
-<a href="//godoc.org/golang.org/x/tools/cmd/godoc">godoc</a>
-now performs sophisticated <a href="/lib/godoc/analysis/help.html">static
-analysis</a> of the code it indexes.
-The results of analysis are presented in both the source view and the
-package documentation view, and include the call graph of each package
-and the relationships between
-definitions and references,
-types and their methods,
-interfaces and their implementations,
-send and receive operations on channels,
-functions and their callers, and
-call sites and their callees.
-</p>
-
-<h3 id="misc">Miscellany</h3>
-
-<p>
-The program <code>misc/benchcmp</code> that compares
-performance across benchmarking runs has been rewritten.
-Once a shell and awk script in the main repository, it is now a Go program in the <code>go.tools</code> repo.
-Documentation is <a href="//godoc.org/golang.org/x/tools/cmd/benchcmp">here</a>.
-</p>
-
-<p>
-For the few of us that build Go distributions, the tool <code>misc/dist</code> has been
-moved and renamed; it now lives in <code>misc/makerelease</code>, still in the main repository.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-The performance of Go binaries for this release has improved in many cases due to changes
-in the runtime and garbage collection, plus some changes to libraries.
-Significant instances include:
-</p>
-
-<ul>
-
-<li>
-The runtime handles defers more efficiently, reducing the memory footprint by about two kilobytes
-per goroutine that calls defer.
-</li>
-
-<li>
-The garbage collector has been sped up, using a concurrent sweep algorithm,
-better parallelization, and larger pages.
-The cumulative effect can be a 50-70% reduction in collector pause time.
-</li>
-
-<li>
-The race detector (see <a href="/doc/articles/race_detector.html">this guide</a>)
-is now about 40% faster.
-</li>
-
-<li>
-The regular expression package <a href="/pkg/regexp/"><code>regexp</code></a>
-is now significantly faster for certain simple expressions due to the implementation of
-a second, one-pass execution engine.
-The choice of which engine to use is automatic;
-the details are hidden from the user.
-</li>
-
-</ul>
-
-<p>
-Also, the runtime now includes in stack dumps how long a goroutine has been blocked,
-which can be useful information when debugging deadlocks or performance issues.
-</p>
-
-<h2 id="library">Changes to the standard library</h2>
-
-<h3 id="new_packages">New packages</h3>
-
-<p>
-A new package <a href="/pkg/debug/plan9obj/"><code>debug/plan9obj</code></a> was added to the standard library.
-It implements access to Plan 9 <a href="https://9p.io/magic/man2html/6/a.out">a.out</a> object files.
-</p>
-
-<h3 id="major_library_changes">Major changes to the library</h3>
-
-<p>
-A previous bug in <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a>
-made it possible to skip verification in TLS inadvertently.
-In Go 1.3, the bug is fixed: one must specify either ServerName or
-InsecureSkipVerify, and if ServerName is specified it is enforced.
-This may break existing code that incorrectly depended on insecure
-behavior.
-</p>
-
-<p>
-There is an important new type added to the standard library: <a href="/pkg/sync/#Pool"><code>sync.Pool</code></a>.
-It provides an efficient mechanism for implementing certain types of caches whose memory
-can be reclaimed automatically by the system.
-</p>
-
-<p>
-The <a href="/pkg/testing/"><code>testing</code></a> package's benchmarking helper,
-<a href="/pkg/testing/#B"><code>B</code></a>, now has a
-<a href="/pkg/testing/#B.RunParallel"><code>RunParallel</code></a> method
-to make it easier to run benchmarks that exercise multiple CPUs.
-</p>
-
-<p>
-<em>Updating</em>: The crypto/tls fix may break existing code, but such
-code was erroneous and should be updated.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-The following list summarizes a number of minor changes to the library, mostly additions.
-See the relevant package documentation for more information about each change.
-</p>
-
-<ul>
-
-<li> In the <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package,
-a new <a href="/pkg/crypto/tls/#DialWithDialer"><code>DialWithDialer</code></a>
-function lets one establish a TLS connection using an existing dialer, making it easier
-to control dial options such as timeouts.
-The package also now reports the TLS version used by the connection in the
-<a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a>
-struct.
-</li>
-
-<li> The <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
-function of the <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-now supports parsing (and elsewhere, serialization) of PKCS #10 certificate
-signature requests.
-</li>
-
-<li>
-The formatted print functions of the <code>fmt</code> package now define <code>%F</code>
-as a synonym for <code>%f</code> when printing floating-point values.
-</li>
-
-<li>
-The <a href="/pkg/math/big/"><code>math/big</code></a> package's
-<a href="/pkg/math/big/#Int"><code>Int</code></a> and
-<a href="/pkg/math/big/#Rat"><code>Rat</code></a> types
-now implement
-<a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a> and
-<a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>.
-</li>
-
-<li>
-The complex power function, <a href="/pkg/math/cmplx/#Pow"><code>Pow</code></a>,
-now specifies the behavior when the first argument is zero.
-It was undefined before.
-The details are in the <a href="/pkg/math/cmplx/#Pow">documentation for the function</a>.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package now exposes the
-properties of a TLS connection used to make a client request in the new
-<a href="/pkg/net/http/#Response"><code>Response.TLS</code></a> field.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package now
-allows setting an optional server error logger
-with <a href="/pkg/net/http/#Server"><code>Server.ErrorLog</code></a>.
-The default is still that all errors go to stderr.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package now
-supports disabling HTTP keep-alive connections on the server
-with <a href="/pkg/net/http/#Server.SetKeepAlivesEnabled"><code>Server.SetKeepAlivesEnabled</code></a>.
-The default continues to be that the server does keep-alive (reuses
-connections for multiple requests) by default.
-Only resource-constrained servers or those in the process of graceful
-shutdown will want to disable them.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package adds an optional
-<a href="/pkg/net/http/#Transport"><code>Transport.TLSHandshakeTimeout</code></a>
-setting to cap the amount of time HTTP client requests will wait for
-TLS handshakes to complete.
-It's now also set by default
-on <a href="/pkg/net/http#DefaultTransport"><code>DefaultTransport</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package's
-<a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport</code></a>,
-used by the HTTP client code, now
-enables <a href="http://en.wikipedia.org/wiki/Keepalive#TCP_keepalive">TCP
-keep-alives</a> by default.
-Other <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
-values with a nil <code>Dial</code> field continue to function the same
-as before: no TCP keep-alives are used.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package
-now enables <a href="http://en.wikipedia.org/wiki/Keepalive#TCP_keepalive">TCP
-keep-alives</a> for incoming server requests when
-<a href="/pkg/net/http/#ListenAndServe"><code>ListenAndServe</code></a>
-or
-<a href="/pkg/net/http/#ListenAndServeTLS"><code>ListenAndServeTLS</code></a>
-are used.
-When a server is started otherwise, TCP keep-alives are not enabled.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package now
-provides an
-optional <a href="/pkg/net/http/#Server"><code>Server.ConnState</code></a>
-callback to hook various phases of a server connection's lifecycle
-(see <a href="/pkg/net/http/#ConnState"><code>ConnState</code></a>).
-This can be used to implement rate limiting or graceful shutdown.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package's HTTP
-client now has an
-optional <a href="/pkg/net/http/#Client"><code>Client.Timeout</code></a>
-field to specify an end-to-end timeout on requests made using the
-client.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package's
-<a href="/pkg/net/http/#Request.ParseMultipartForm"><code>Request.ParseMultipartForm</code></a>
-method will now return an error if the body's <code>Content-Type</code>
-is not <code>multipart/form-data</code>.
-Prior to Go 1.3 it would silently fail and return <code>nil</code>.
-Code that relies on the previous behavior should be updated.
-</li>
-
-<li> In the <a href="/pkg/net/"><code>net</code></a> package,
-the <a href="/pkg/net/#Dialer"><code>Dialer</code></a> struct now
-has a <code>KeepAlive</code> option to specify a keep-alive period for the connection.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package's
-<a href="/pkg/net/http/#Transport"><code>Transport</code></a>
-now closes <a href="/pkg/net/http/#Request"><code>Request.Body</code></a>
-consistently, even on error.
-</li>
-
-<li>
-The <a href="/pkg/os/exec/"><code>os/exec</code></a> package now implements
-what the documentation has always said with regard to relative paths for the binary.
-In particular, it only calls <a href="/pkg/os/exec/#LookPath"><code>LookPath</code></a>
-when the binary's file name contains no path separators.
-</li>
-
-<li>
-The <a href="/pkg/reflect/#Value.SetMapIndex"><code>SetMapIndex</code></a>
-function in the <a href="/pkg/reflect/"><code>reflect</code></a> package
-no longer panics when deleting from a <code>nil</code> map.
-</li>
-
-<li>
-If the main goroutine calls
-<a href="/pkg/runtime/#Goexit"><code>runtime.Goexit</code></a>
-and all other goroutines finish execution, the program now always crashes,
-reporting a detected deadlock.
-Earlier versions of Go handled this situation inconsistently: most instances
-were reported as deadlocks, but some trivial cases exited cleanly instead.
-</li>
-
-<li>
-The runtime/debug package now has a new function
-<a href="/pkg/runtime/debug/#WriteHeapDump"><code>debug.WriteHeapDump</code></a>
-that writes out a description of the heap.
-</li>
-
-<li>
-The <a href="/pkg/strconv/#CanBackquote"><code>CanBackquote</code></a>
-function in the <a href="/pkg/strconv/"><code>strconv</code></a> package
-now considers the <code>DEL</code> character, <code>U+007F</code>, to be
-non-printing.
-</li>
-
-<li>
-The <a href="/pkg/syscall/"><code>syscall</code></a> package now provides
-<a href="/pkg/syscall/#SendmsgN"><code>SendmsgN</code></a>
-as an alternate version of
-<a href="/pkg/syscall/#Sendmsg"><code>Sendmsg</code></a>
-that returns the number of bytes written.
-</li>
-
-<li>
-On Windows, the <a href="/pkg/syscall/"><code>syscall</code></a> package now
-supports the cdecl calling convention through the addition of a new function
-<a href="/pkg/syscall/#NewCallbackCDecl"><code>NewCallbackCDecl</code></a>
-alongside the existing function
-<a href="/pkg/syscall/#NewCallback"><code>NewCallback</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/testing/"><code>testing</code></a> package now
-diagnoses tests that call <code>panic(nil)</code>, which are almost always erroneous.
-Also, tests now write profiles (if invoked with profiling flags) even on failure.
-</li>
-
-<li>
-The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
-support throughout the system has been upgraded from
-Unicode 6.2.0 to <a href="http://www.unicode.org/versions/Unicode6.3.0/">Unicode 6.3.0</a>.
-</li>
-
-</ul>
diff --git a/doc/go1.4.html b/doc/go1.4.html
deleted file mode 100644
index c8f7c9c525..0000000000
--- a/doc/go1.4.html
+++ /dev/null
@@ -1,896 +0,0 @@
-<!--{
- "Title": "Go 1.4 Release Notes",
- "Path": "/doc/go1.4",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction to Go 1.4</h2>
-
-<p>
-The latest Go release, version 1.4, arrives as scheduled six months after 1.3.
-</p>
-
-<p>
-It contains only one tiny language change,
-in the form of a backwards-compatible simple variant of <code>for</code>-<code>range</code> loop,
-and a possibly breaking change to the compiler involving methods on pointers-to-pointers.
-</p>
-
-<p>
-The release focuses primarily on implementation work, improving the garbage collector
-and preparing the ground for a fully concurrent collector to be rolled out in the
-next few releases.
-Stacks are now contiguous, reallocated when necessary rather than linking on new
-"segments";
-this release therefore eliminates the notorious "hot stack split" problem.
-There are some new tools available including support in the <code>go</code> command
-for build-time source code generation.
-The release also adds support for ARM processors on Android and Native Client (NaCl)
-and for AMD64 on Plan 9.
-</p>
-
-<p>
-As always, Go 1.4 keeps the <a href="/doc/go1compat.html">promise
-of compatibility</a>,
-and almost everything
-will continue to compile and run without change when moved to 1.4.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<h3 id="forrange">For-range loops</h3>
-<p>
-Up until Go 1.3, <code>for</code>-<code>range</code> loop had two forms
-</p>
-
-<pre>
-for i, v := range x {
- ...
-}
-</pre>
-
-<p>
-and
-</p>
-
-<pre>
-for i := range x {
- ...
-}
-</pre>
-
-<p>
-If one was not interested in the loop values, only the iteration itself, it was still
-necessary to mention a variable (probably the <a href="/ref/spec#Blank_identifier">blank identifier</a>, as in
-<code>for</code> <code>_</code> <code>=</code> <code>range</code> <code>x</code>), because
-the form
-</p>
-
-<pre>
-for range x {
- ...
-}
-</pre>
-
-<p>
-was not syntactically permitted.
-</p>
-
-<p>
-This situation seemed awkward, so as of Go 1.4 the variable-free form is now legal.
-The pattern arises rarely but the code can be cleaner when it does.
-</p>
-
-<p>
-<em>Updating</em>: The change is strictly backwards compatible to existing Go
-programs, but tools that analyze Go parse trees may need to be modified to accept
-this new form as the
-<code>Key</code> field of <a href="/pkg/go/ast/#RangeStmt"><code>RangeStmt</code></a>
-may now be <code>nil</code>.
-</p>
-
-<h3 id="methodonpointertopointer">Method calls on **T</h3>
-
-<p>
-Given these declarations,
-</p>
-
-<pre>
-type T int
-func (T) M() {}
-var x **T
-</pre>
-
-<p>
-both <code>gc</code> and <code>gccgo</code> accepted the method call
-</p>
-
-<pre>
-x.M()
-</pre>
-
-<p>
-which is a double dereference of the pointer-to-pointer <code>x</code>.
-The Go specification allows a single dereference to be inserted automatically,
-but not two, so this call is erroneous according to the language definition.
-It has therefore been disallowed in Go 1.4, which is a breaking change,
-although very few programs will be affected.
-</p>
-
-<p>
-<em>Updating</em>: Code that depends on the old, erroneous behavior will no longer
-compile but is easy to fix by adding an explicit dereference.
-</p>
-
-<h2 id="os">Changes to the supported operating systems and architectures</h2>
-
-<h3 id="android">Android</h3>
-
-<p>
-Go 1.4 can build binaries for ARM processors running the Android operating system.
-It can also build a <code>.so</code> library that can be loaded by an Android application
-using the supporting packages in the <a href="https://golang.org/x/mobile">mobile</a> subrepository.
-A brief description of the plans for this experimental port are available
-<a href="https://golang.org/s/go14android">here</a>.
-</p>
-
-<h3 id="naclarm">NaCl on ARM</h3>
-
-<p>
-The previous release introduced Native Client (NaCl) support for the 32-bit x86
-(<code>GOARCH=386</code>)
-and 64-bit x86 using 32-bit pointers (GOARCH=amd64p32).
-The 1.4 release adds NaCl support for ARM (GOARCH=arm).
-</p>
-
-<h3 id="plan9amd64">Plan9 on AMD64</h3>
-
-<p>
-This release adds support for the Plan 9 operating system on AMD64 processors,
-provided the kernel supports the <code>nsec</code> system call and uses 4K pages.
-</p>
-
-<h2 id="compatibility">Changes to the compatibility guidelines</h2>
-
-<p>
-The <a href="/pkg/unsafe/"><code>unsafe</code></a> package allows one
-to defeat Go's type system by exploiting internal details of the implementation
-or machine representation of data.
-It was never explicitly specified what use of <code>unsafe</code> meant
-with respect to compatibility as specified in the
-<a href="go1compat.html">Go compatibility guidelines</a>.
-The answer, of course, is that we can make no promise of compatibility
-for code that does unsafe things.
-</p>
-
-<p>
-We have clarified this situation in the documentation included in the release.
-The <a href="go1compat.html">Go compatibility guidelines</a> and the
-docs for the <a href="/pkg/unsafe/"><code>unsafe</code></a> package
-are now explicit that unsafe code is not guaranteed to remain compatible.
-</p>
-
-<p>
-<em>Updating</em>: Nothing technical has changed; this is just a clarification
-of the documentation.
-</p>
-
-
-<h2 id="impl">Changes to the implementations and tools</h2>
-
-<h3 id="runtime">Changes to the runtime</h3>
-
-<p>
-Prior to Go 1.4, the runtime (garbage collector, concurrency support, interface management,
-maps, slices, strings, ...) was mostly written in C, with some assembler support.
-In 1.4, much of the code has been translated to Go so that the garbage collector can scan
-the stacks of programs in the runtime and get accurate information about what variables
-are active.
-This change was large but should have no semantic effect on programs.
-</p>
-
-<p>
-This rewrite allows the garbage collector in 1.4 to be fully precise,
-meaning that it is aware of the location of all active pointers in the program.
-This means the heap will be smaller as there will be no false positives keeping non-pointers alive.
-Other related changes also reduce the heap size, which is smaller by 10%-30% overall
-relative to the previous release.
-</p>
-
-<p>
-A consequence is that stacks are no longer segmented, eliminating the "hot split" problem.
-When a stack limit is reached, a new, larger stack is allocated, all active frames for
-the goroutine are copied there, and any pointers into the stack are updated.
-Performance can be noticeably better in some cases and is always more predictable.
-Details are available in <a href="https://golang.org/s/contigstacks">the design document</a>.
-</p>
-
-<p>
-The use of contiguous stacks means that stacks can start smaller without triggering performance issues,
-so the default starting size for a goroutine's stack in 1.4 has been reduced from 8192 bytes to 2048 bytes.
-</p>
-
-<p>
-As preparation for the concurrent garbage collector scheduled for the 1.5 release,
-writes to pointer values in the heap are now done by a function call,
-called a write barrier, rather than directly from the function updating the value.
-In this next release, this will permit the garbage collector to mediate writes to the heap while it is running.
-This change has no semantic effect on programs in 1.4, but was
-included in the release to test the compiler and the resulting performance.
-</p>
-
-<p>
-The implementation of interface values has been modified.
-In earlier releases, the interface contained a word that was either a pointer or a one-word
-scalar value, depending on the type of the concrete object stored.
-This implementation was problematical for the garbage collector,
-so as of 1.4 interface values always hold a pointer.
-In running programs, most interface values were pointers anyway,
-so the effect is minimal, but programs that store integers (for example) in
-interfaces will see more allocations.
-</p>
-
-<p>
-As of Go 1.3, the runtime crashes if it finds a memory word that should contain
-a valid pointer but instead contains an obviously invalid pointer (for example, the value 3).
-Programs that store integers in pointer values may run afoul of this check and crash.
-In Go 1.4, setting the <a href="/pkg/runtime/"><code>GODEBUG</code></a> variable
-<code>invalidptr=0</code> disables
-the crash as a workaround, but we cannot guarantee that future releases will be
-able to avoid the crash; the correct fix is to rewrite code not to alias integers and pointers.
-</p>
-
-<h3 id="asm">Assembly</h3>
-
-<p>
-The language accepted by the assemblers <code>cmd/5a</code>, <code>cmd/6a</code>
-and <code>cmd/8a</code> has had several changes,
-mostly to make it easier to deliver type information to the runtime.
-</p>
-
-<p>
-First, the <code>textflag.h</code> file that defines flags for <code>TEXT</code> directives
-has been copied from the linker source directory to a standard location so it can be
-included with the simple directive
-</p>
-
-<pre>
-#include "textflag.h"
-</pre>
-
-<p>
-The more important changes are in how assembler source can define the necessary
-type information.
-For most programs it will suffice to move data
-definitions (<code>DATA</code> and <code>GLOBL</code> directives)
-out of assembly into Go files
-and to write a Go declaration for each assembly function.
-The <a href="/doc/asm#runtime">assembly document</a> describes what to do.
-</p>
-
-<p>
-<em>Updating</em>:
-Assembly files that include <code>textflag.h</code> from its old
-location will still work, but should be updated.
-For the type information, most assembly routines will need no change,
-but all should be examined.
-Assembly source files that define data,
-functions with non-empty stack frames, or functions that return pointers
-need particular attention.
-A description of the necessary (but simple) changes
-is in the <a href="/doc/asm#runtime">assembly document</a>.
-</p>
-
-<p>
-More information about these changes is in the <a href="/doc/asm">assembly document</a>.
-</p>
-
-<h3 id="gccgo">Status of gccgo</h3>
-
-<p>
-The release schedules for the GCC and Go projects do not coincide.
-GCC release 4.9 contains the Go 1.2 version of gccgo.
-The next release, GCC 5, will likely have the Go 1.4 version of gccgo.
-</p>
-
-<h3 id="internalpackages">Internal packages</h3>
-
-<p>
-Go's package system makes it easy to structure programs into components with clean boundaries,
-but there are only two forms of access: local (unexported) and global (exported).
-Sometimes one wishes to have components that are not exported,
-for instance to avoid acquiring clients of interfaces to code that is part of a public repository
-but not intended for use outside the program to which it belongs.
-</p>
-
-<p>
-The Go language does not have the power to enforce this distinction, but as of Go 1.4 the
-<a href="/cmd/go/"><code>go</code></a> command introduces
-a mechanism to define "internal" packages that may not be imported by packages outside
-the source subtree in which they reside.
-</p>
-
-<p>
-To create such a package, place it in a directory named <code>internal</code> or in a subdirectory of a directory
-named internal.
-When the <code>go</code> command sees an import of a package with <code>internal</code> in its path,
-it verifies that the package doing the import
-is within the tree rooted at the parent of the <code>internal</code> directory.
-For example, a package <code>.../a/b/c/internal/d/e/f</code>
-can be imported only by code in the directory tree rooted at <code>.../a/b/c</code>.
-It cannot be imported by code in <code>.../a/b/g</code> or in any other repository.
-</p>
-
-<p>
-For Go 1.4, the internal package mechanism is enforced for the main Go repository;
-from 1.5 and onward it will be enforced for any repository.
-</p>
-
-<p>
-Full details of the mechanism are in
-<a href="https://golang.org/s/go14internal">the design document</a>.
-</p>
-
-<h3 id="canonicalimports">Canonical import paths</h3>
-
-<p>
-Code often lives in repositories hosted by public services such as <code>github.com</code>,
-meaning that the import paths for packages begin with the name of the hosting service,
-<code>github.com/rsc/pdf</code> for example.
-One can use
-<a href="/cmd/go/#hdr-Remote_import_paths">an existing mechanism</a>
-to provide a "custom" or "vanity" import path such as
-<code>rsc.io/pdf</code>, but
-that creates two valid import paths for the package.
-That is a problem: one may inadvertently import the package through the two
-distinct paths in a single program, which is wasteful;
-miss an update to a package because the path being used is not recognized to be
-out of date;
-or break clients using the old path by moving the package to a different hosting service.
-</p>
-
-<p>
-Go 1.4 introduces an annotation for package clauses in Go source that identify a canonical
-import path for the package.
-If an import is attempted using a path that is not canonical,
-the <a href="/cmd/go/"><code>go</code></a> command
-will refuse to compile the importing package.
-</p>
-
-<p>
-The syntax is simple: put an identifying comment on the package line.
-For our example, the package clause would read:
-</p>
-
-<pre>
-package pdf // import "rsc.io/pdf"
-</pre>
-
-<p>
-With this in place,
-the <code>go</code> command will
-refuse to compile a package that imports <code>github.com/rsc/pdf</code>,
-ensuring that the code can be moved without breaking users.
-</p>
-
-<p>
-The check is at build time, not download time, so if <code>go</code> <code>get</code>
-fails because of this check, the mis-imported package has been copied to the local machine
-and should be removed manually.
-</p>
-
-<p>
-To complement this new feature, a check has been added at update time to verify
-that the local package's remote repository matches that of its custom import.
-The <code>go</code> <code>get</code> <code>-u</code> command will fail to
-update a package if its remote repository has changed since it was first
-downloaded.
-The new <code>-f</code> flag overrides this check.
-</p>
-
-<p>
-Further information is in
-<a href="https://golang.org/s/go14customimport">the design document</a>.
-</p>
-
-<h3 id="subrepo">Import paths for the subrepositories</h3>
-
-<p>
-The Go project subrepositories (<code>code.google.com/p/go.tools</code> and so on)
-are now available under custom import paths replacing <code>code.google.com/p/go.</code> with <code>golang.org/x/</code>,
-as in <code>golang.org/x/tools</code>.
-We will add canonical import comments to the code around June 1, 2015,
-at which point Go 1.4 and later will stop accepting the old <code>code.google.com</code> paths.
-</p>
-
-<p>
-<em>Updating</em>: All code that imports from subrepositories should change
-to use the new <code>golang.org</code> paths.
-Go 1.0 and later can resolve and import the new paths, so updating will not break
-compatibility with older releases.
-Code that has not updated will stop compiling with Go 1.4 around June 1, 2015.
-</p>
-
-<h3 id="gogenerate">The go generate subcommand</h3>
-
-<p>
-The <a href="/cmd/go/"><code>go</code></a> command has a new subcommand,
-<a href="/cmd/go/#hdr-Generate_Go_files_by_processing_source"><code>go generate</code></a>,
-to automate the running of tools to generate source code before compilation.
-For example, it can be used to run the <a href="/cmd/yacc"><code>yacc</code></a>
-compiler-compiler on a <code>.y</code> file to produce the Go source file implementing the grammar,
-or to automate the generation of <code>String</code> methods for typed constants using the new
-<a href="https://godoc.org/golang.org/x/tools/cmd/stringer">stringer</a>
-tool in the <code>golang.org/x/tools</code> subrepository.
-</p>
-
-<p>
-For more information, see the
-<a href="https://golang.org/s/go1.4-generate">design document</a>.
-</p>
-
-<h3 id="filenames">Change to file name handling</h3>
-
-<p>
-Build constraints, also known as build tags, control compilation by including or excluding files
-(see the documentation <a href="/pkg/go/build/"><code>/go/build</code></a>).
-Compilation can also be controlled by the name of the file itself by "tagging" the file with
-a suffix (before the <code>.go</code> or <code>.s</code> extension) with an underscore
-and the name of the architecture or operating system.
-For instance, the file <code>gopher_arm.go</code> will only be compiled if the target
-processor is an ARM.
-</p>
-
-<p>
-Before Go 1.4, a file called just <code>arm.go</code> was similarly tagged, but this behavior
-can break sources when new architectures are added, causing files to suddenly become tagged.
-In 1.4, therefore, a file will be tagged in this manner only if the tag (architecture or operating
-system name) is preceded by an underscore.
-</p>
-
-<p>
-<em>Updating</em>: Packages that depend on the old behavior will no longer compile correctly.
-Files with names like <code>windows.go</code> or <code>amd64.go</code> should either
-have explicit build tags added to the source or be renamed to something like
-<code>os_windows.go</code> or <code>support_amd64.go</code>.
-</p>
-
-<h3 id="gocmd">Other changes to the go command</h3>
-
-<p>
-There were a number of minor changes to the
-<a href="/cmd/go/"><code>cmd/go</code></a>
-command worth noting.
-</p>
-
-<ul>
-
-<li>
-Unless <a href="/cmd/cgo/"><code>cgo</code></a> is being used to build the package,
-the <code>go</code> command now refuses to compile C source files,
-since the relevant C compilers
-(<a href="/cmd/6c/"><code>6c</code></a> etc.)
-are intended to be removed from the installation in some future release.
-(They are used today only to build part of the runtime.)
-It is difficult to use them correctly in any case, so any extant uses are likely incorrect,
-so we have disabled them.
-</li>
-
-<li>
-The <a href="/cmd/go/#hdr-Test_packages"><code>go</code> <code>test</code></a>
-subcommand has a new flag, <code>-o</code>, to set the name of the resulting binary,
-corresponding to the same flag in other subcommands.
-The non-functional <code>-file</code> flag has been removed.
-</li>
-
-<li>
-The <a href="/cmd/go/#hdr-Test_packages"><code>go</code> <code>test</code></a>
-subcommand will compile and link all <code>*_test.go</code> files in the package,
-even when there are no <code>Test</code> functions in them.
-It previously ignored such files.
-</li>
-
-<li>
-The behavior of the
-<a href="/cmd/go/#hdr-Test_packages"><code>go</code> <code>build</code></a>
-subcommand's
-<code>-a</code> flag has been changed for non-development installations.
-For installations running a released distribution, the <code>-a</code> flag will no longer
-rebuild the standard library and commands, to avoid overwriting the installation's files.
-</li>
-
-</ul>
-
-<h3 id="pkg">Changes to package source layout</h3>
-
-<p>
-In the main Go source repository, the source code for the packages was kept in
-the directory <code>src/pkg</code>, which made sense but differed from
-other repositories, including the Go subrepositories.
-In Go 1.4, the<code> pkg</code> level of the source tree is now gone, so for example
-the <a href="/pkg/fmt/"><code>fmt</code></a> package's source, once kept in
-directory <code>src/pkg/fmt</code>, now lives one level higher in <code>src/fmt</code>.
-</p>
-
-<p>
-<em>Updating</em>: Tools like <code>godoc</code> that discover source code
-need to know about the new location. All tools and services maintained by the Go team
-have been updated.
-</p>
-
-
-<h3 id="swig">SWIG</h3>
-
-<p>
-Due to runtime changes in this release, Go 1.4 requires SWIG 3.0.3.
-</p>
-
-<h3 id="misc">Miscellany</h3>
-
-<p>
-The standard repository's top-level <code>misc</code> directory used to contain
-Go support for editors and IDEs: plugins, initialization scripts and so on.
-Maintaining these was becoming time-consuming
-and needed external help because many of the editors listed were not used by
-members of the core team.
-It also required us to make decisions about which plugin was best for a given
-editor, even for editors we do not use.
-</p>
-
-<p>
-The Go community at large is much better suited to managing this information.
-In Go 1.4, therefore, this support has been removed from the repository.
-Instead, there is a curated, informative list of what's available on
-a <a href="//golang.org/wiki/IDEsAndTextEditorPlugins">wiki page</a>.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-Most programs will run about the same speed or slightly faster in 1.4 than in 1.3;
-some will be slightly slower.
-There are many changes, making it hard to be precise about what to expect.
-</p>
-
-<p>
-As mentioned above, much of the runtime was translated to Go from C,
-which led to some reduction in heap sizes.
-It also improved performance slightly because the Go compiler is better
-at optimization, due to things like inlining, than the C compiler used to build
-the runtime.
-</p>
-
-<p>
-The garbage collector was sped up, leading to measurable improvements for
-garbage-heavy programs.
-On the other hand, the new write barriers slow things down again, typically
-by about the same amount but, depending on their behavior, some programs
-may be somewhat slower or faster.
-</p>
-
-<p>
-Library changes that affect performance are documented below.
-</p>
-
-<h2 id="library">Changes to the standard library</h2>
-
-<h3 id="new_packages">New packages</h3>
-
-<p>
-There are no new packages in this release.
-</p>
-
-<h3 id="major_library_changes">Major changes to the library</h3>
-
-<h4 id="scanner">bufio.Scanner</h4>
-
-<p>
-The <a href="/pkg/bufio/#Scanner"><code>Scanner</code></a> type in the
-<a href="/pkg/bufio/"><code>bufio</code></a> package
-has had a bug fixed that may require changes to custom
-<a href="/pkg/bufio/#SplitFunc"><code>split functions</code></a>.
-The bug made it impossible to generate an empty token at EOF; the fix
-changes the end conditions seen by the split function.
-Previously, scanning stopped at EOF if there was no more data.
-As of 1.4, the split function will be called once at EOF after input is exhausted,
-so the split function can generate a final empty token
-as the documentation already promised.
-</p>
-
-<p>
-<em>Updating</em>: Custom split functions may need to be modified to
-handle empty tokens at EOF as desired.
-</p>
-
-<h4 id="syscall">syscall</h4>
-
-<p>
-The <a href="/pkg/syscall/"><code>syscall</code></a> package is now frozen except
-for changes needed to maintain the core repository.
-In particular, it will no longer be extended to support new or different system calls
-that are not used by the core.
-The reasons are described at length in <a href="https://golang.org/s/go1.4-syscall">a
-separate document</a>.
-</p>
-
-<p>
-A new subrepository, <a href="https://golang.org/x/sys">golang.org/x/sys</a>,
-has been created to serve as the location for new developments to support system
-calls on all kernels.
-It has a nicer structure, with three packages that each hold the implementation of
-system calls for one of
-<a href="https://godoc.org/golang.org/x/sys/unix">Unix</a>,
-<a href="https://godoc.org/golang.org/x/sys/windows">Windows</a> and
-<a href="https://godoc.org/golang.org/x/sys/plan9">Plan 9</a>.
-These packages will be curated more generously, accepting all reasonable changes
-that reflect kernel interfaces in those operating systems.
-See the documentation and the article mentioned above for more information.
-</p>
-
-<p>
-<em>Updating</em>: Existing programs are not affected as the <code>syscall</code>
-package is largely unchanged from the 1.3 release.
-Future development that requires system calls not in the <code>syscall</code> package
-should build on <code>golang.org/x/sys</code> instead.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-The following list summarizes a number of minor changes to the library, mostly additions.
-See the relevant package documentation for more information about each change.
-</p>
-
-<ul>
-
-<li>
-The <a href="/pkg/archive/zip/"><code>archive/zip</code></a> package's
-<a href="/pkg/archive/zip/#Writer"><code>Writer</code></a> now supports a
-<a href="/pkg/archive/zip/#Writer.Flush"><code>Flush</code></a> method.
-</li>
-
-<li>
-The <a href="/pkg/compress/flate/"><code>compress/flate</code></a>,
-<a href="/pkg/compress/gzip/"><code>compress/gzip</code></a>,
-and <a href="/pkg/compress/zlib/"><code>compress/zlib</code></a>
-packages now support a <code>Reset</code> method
-for the decompressors, allowing them to reuse buffers and improve performance.
-The <a href="/pkg/compress/gzip/"><code>compress/gzip</code></a> package also has a
-<a href="/pkg/compress/gzip/#Reader.Multistream"><code>Multistream</code></a> method to control support
-for multistream files.
-</li>
-
-<li>
-The <a href="/pkg/crypto/"><code>crypto</code></a> package now has a
-<a href="/pkg/crypto/#Signer"><code>Signer</code></a> interface, implemented by the
-<code>PrivateKey</code> types in
-<a href="/pkg/crypto/ecdsa"><code>crypto/ecdsa</code></a> and
-<a href="/pkg/crypto/rsa"><code>crypto/rsa</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-now supports ALPN as defined in <a href="https://tools.ietf.org/html/rfc7301">RFC 7301</a>.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-now supports programmatic selection of server certificates
-through the new <a href="/pkg/crypto/tls/#Config.CertificateForName"><code>CertificateForName</code></a> function
-of the <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> struct.
-</li>
-
-<li>
-Also in the crypto/tls package, the server now supports
-<a href="https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00">TLS_FALLBACK_SCSV</a>
-to help clients detect fallback attacks.
-(The Go client does not support fallback at all, so it is not vulnerable to
-those attacks.)
-</li>
-
-<li>
-The <a href="/pkg/database/sql/"><code>database/sql</code></a> package can now list all registered
-<a href="/pkg/database/sql/#Drivers"><code>Drivers</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/debug/dwarf/"><code>debug/dwarf</code></a> package now supports
-<a href="/pkg/debug/dwarf/#UnspecifiedType"><code>UnspecifiedType</code></a>s.
-</li>
-
-<li>
-In the <a href="/pkg/encoding/asn1/"><code>encoding/asn1</code></a> package,
-optional elements with a default value will now only be omitted if they have that value.
-</li>
-
-<li>
-The <a href="/pkg/encoding/csv/"><code>encoding/csv</code></a> package no longer
-quotes empty strings but does quote the end-of-data marker <code>\.</code> (backslash dot).
-This is permitted by the definition of CSV and allows it to work better with Postgres.
-</li>
-
-<li>
-The <a href="/pkg/encoding/gob/"><code>encoding/gob</code></a> package has been rewritten to eliminate
-the use of unsafe operations, allowing it to be used in environments that do not permit use of the
-<a href="/pkg/unsafe/"><code>unsafe</code></a> package.
-For typical uses it will be 10-30% slower, but the delta is dependent on the type of the data and
-in some cases, especially involving arrays, it can be faster.
-There is no functional change.
-</li>
-
-<li>
-The <a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> package's
-<a href="/pkg/encoding/xml/#Decoder"><code>Decoder</code></a> can now report its input offset.
-</li>
-
-<li>
-In the <a href="/pkg/fmt/"><code>fmt</code></a> package,
-formatting of pointers to maps has changed to be consistent with that of pointers
-to structs, arrays, and so on.
-For instance, <code>&amp;map[string]int{"one":</code> <code>1}</code> now prints by default as
-<code>&amp;map[one:</code> <code>1]</code> rather than as a hexadecimal pointer value.
-</li>
-
-<li>
-The <a href="/pkg/image/"><code>image</code></a> package's
-<a href="/pkg/image/#Image"><code>Image</code></a>
-implementations like
-<a href="/pkg/image/#RGBA"><code>RGBA</code></a> and
-<a href="/pkg/image/#Gray"><code>Gray</code></a> have specialized
-<a href="/pkg/image/#RGBA.RGBAAt"><code>RGBAAt</code></a> and
-<a href="/pkg/image/#Gray.GrayAt"><code>GrayAt</code></a> methods alongside the general
-<a href="/pkg/image/#Image.At"><code>At</code></a> method.
-</li>
-
-<li>
-The <a href="/pkg/image/png/"><code>image/png</code></a> package now has an
-<a href="/pkg/image/png/#Encoder"><code>Encoder</code></a>
-type to control the compression level used for encoding.
-</li>
-
-<li>
-The <a href="/pkg/math/"><code>math</code></a> package now has a
-<a href="/pkg/math/#Nextafter32"><code>Nextafter32</code><a/> function.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package's
-<a href="/pkg/net/http/#Request"><code>Request</code></a> type
-has a new <a href="/pkg/net/http/#Request.BasicAuth"><code>BasicAuth</code></a> method
-that returns the username and password from authenticated requests using the
-HTTP Basic Authentication
-Scheme.
-</li>
-
-<li>The <a href="/pkg/net/http/"><code>net/http</code></a> package's
-<a href="/pkg/net/http/#Request"><code>Transport</code></a> type
-has a new <a href="/pkg/net/http/#Transport.DialTLS"><code>DialTLS</code></a> hook
-that allows customizing the behavior of outbound TLS connections.
-</li>
-
-<li>
-The <a href="/pkg/net/http/httputil/"><code>net/http/httputil</code></a> package's
-<a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a> type
-has a new field,
-<a href="/pkg/net/http/#ReverseProxy.ErrorLog"><code>ErrorLog</code></a>, that
-provides user control of logging.
-</li>
-
-<li>
-The <a href="/pkg/os/"><code>os</code></a> package
-now implements symbolic links on the Windows operating system
-through the <a href="/pkg/os/#Symlink"><code>Symlink</code></a> function.
-Other operating systems already have this functionality.
-There is also a new <a href="/pkg/os/#Unsetenv"><code>Unsetenv</code></a> function.
-</li>
-
-<li>
-The <a href="/pkg/reflect/"><code>reflect</code></a> package's
-<a href="/pkg/reflect/#Type"><code>Type</code></a> interface
-has a new method, <a href="/pkg/reflect/#type.Comparable"><code>Comparable</code></a>,
-that reports whether the type implements general comparisons.
-</li>
-
-<li>
-Also in the <a href="/pkg/reflect/"><code>reflect</code></a> package, the
-<a href="/pkg/reflect/#Value"><code>Value</code></a> interface is now three instead of four words
-because of changes to the implementation of interfaces in the runtime.
-This saves memory but has no semantic effect.
-</li>
-
-<li>
-The <a href="/pkg/runtime/"><code>runtime</code></a> package
-now implements monotonic clocks on Windows,
-as it already did for the other systems.
-</li>
-
-<li>
-The <a href="/pkg/runtime/"><code>runtime</code></a> package's
-<a href="/pkg/runtime/#MemStats.Mallocs"><code>Mallocs</code></a> counter
-now counts very small allocations that were missed in Go 1.3.
-This may break tests using <a href="/pkg/runtime/#ReadMemStats"><code>ReadMemStats</code></a>
-or <a href="/pkg/testing/#AllocsPerRun"><code>AllocsPerRun</code></a>
-due to the more accurate answer.
-</li>
-
-<li>
-In the <a href="/pkg/runtime/"><code>runtime</code></a> package,
-an array <a href="/pkg/runtime/#MemStats.PauseEnd"><code>PauseEnd</code></a>
-has been added to the
-<a href="/pkg/runtime/#MemStats"><code>MemStats</code></a>
-and <a href="/pkg/runtime/#GCStats"><code>GCStats</code></a> structs.
-This array is a circular buffer of times when garbage collection pauses ended.
-The corresponding pause durations are already recorded in
-<a href="/pkg/runtime/#MemStats.PauseNs"><code>PauseNs</code></a>
-</li>
-
-<li>
-The <a href="/pkg/runtime/race/"><code>runtime/race</code></a> package
-now supports FreeBSD, which means the
-<a href="/pkg/cmd/go/"><code>go</code></a> command's <code>-race</code>
-flag now works on FreeBSD.
-</li>
-
-<li>
-The <a href="/pkg/sync/atomic/"><code>sync/atomic</code></a> package
-has a new type, <a href="/pkg/sync/atomic/#Value"><code>Value</code></a>.
-<code>Value</code> provides an efficient mechanism for atomic loads and
-stores of values of arbitrary type.
-</li>
-
-<li>
-In the <a href="/pkg/syscall/"><code>syscall</code></a> package's
-implementation on Linux, the
-<a href="/pkg/syscall/#Setuid"><code>Setuid</code></a>
-and <a href="/pkg/syscall/#Setgid"><code>Setgid</code></a> have been disabled
-because those system calls operate on the calling thread, not the whole process, which is
-different from other platforms and not the expected result.
-</li>
-
-<li>
-The <a href="/pkg/testing/"><code>testing</code></a> package
-has a new facility to provide more control over running a set of tests.
-If the test code contains a function
-<pre>
-func TestMain(m *<a href="/pkg/testing/#M"><code>testing.M</code></a>)
-</pre>
-
-that function will be called instead of running the tests directly.
-The <code>M</code> struct contains methods to access and run the tests.
-</li>
-
-<li>
-Also in the <a href="/pkg/testing/"><code>testing</code></a> package,
-a new <a href="/pkg/testing/#Coverage"><code>Coverage</code></a>
-function reports the current test coverage fraction,
-enabling individual tests to report how much they are contributing to the
-overall coverage.
-</li>
-
-<li>
-The <a href="/pkg/text/scanner/"><code>text/scanner</code></a> package's
-<a href="/pkg/text/scanner/#Scanner"><code>Scanner</code></a> type
-has a new function,
-<a href="/pkg/text/scanner/#Scanner.IsIdentRune"><code>IsIdentRune</code></a>,
-allowing one to control the definition of an identifier when scanning.
-</li>
-
-<li>
-The <a href="/pkg/text/template/"><code>text/template</code></a> package's boolean
-functions <code>eq</code>, <code>lt</code>, and so on have been generalized to allow comparison
-of signed and unsigned integers, simplifying their use in practice.
-(Previously one could only compare values of the same signedness.)
-All negative values compare less than all unsigned values.
-</li>
-
-<li>
-The <code>time</code> package now uses the standard symbol for the micro prefix,
-the micro symbol (U+00B5 'µ'), to print microsecond durations.
-<a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a> still accepts <code>us</code>
-but the package no longer prints microseconds as <code>us</code>.
-<br>
-<em>Updating</em>: Code that depends on the output format of durations
-but does not use ParseDuration will need to be updated.
-</li>
-
-</ul>
diff --git a/doc/go1.5.html b/doc/go1.5.html
deleted file mode 100644
index 2c77cf4169..0000000000
--- a/doc/go1.5.html
+++ /dev/null
@@ -1,1310 +0,0 @@
-<!--{
- "Title": "Go 1.5 Release Notes",
- "Path": "/doc/go1.5",
- "Template": true
-}-->
-
-
-<h2 id="introduction">Introduction to Go 1.5</h2>
-
-<p>
-The latest Go release, version 1.5,
-is a significant release, including major architectural changes to the implementation.
-Despite that, we expect almost all Go programs to continue to compile and run as before,
-because the release still maintains the Go 1 <a href="/doc/go1compat.html">promise
-of compatibility</a>.
-</p>
-
-<p>
-The biggest developments in the implementation are:
-</p>
-
-<ul>
-
-<li>
-The compiler and runtime are now written entirely in Go (with a little assembler).
-C is no longer involved in the implementation, and so the C compiler that was
-once necessary for building the distribution is gone.
-</li>
-
-<li>
-The garbage collector is now <a href="https://golang.org/s/go14gc">concurrent</a> and provides dramatically lower
-pause times by running, when possible, in parallel with other goroutines.
-</li>
-
-<li>
-By default, Go programs run with <code>GOMAXPROCS</code> set to the
-number of cores available; in prior releases it defaulted to 1.
-</li>
-
-<li>
-Support for <a href="https://golang.org/s/go14internal">internal packages</a>
-is now provided for all repositories, not just the Go core.
-</li>
-
-<li>
-The <code>go</code> command now provides <a href="https://golang.org/s/go15vendor">experimental
-support</a> for "vendoring" external dependencies.
-</li>
-
-<li>
-A new <code>go tool trace</code> command supports fine-grained
-tracing of program execution.
-</li>
-
-<li>
-A new <code>go doc</code> command (distinct from <code>godoc</code>)
-is customized for command-line use.
-</li>
-
-</ul>
-
-<p>
-These and a number of other changes to the implementation and tools
-are discussed below.
-</p>
-
-<p>
-The release also contains one small language change involving map literals.
-</p>
-
-<p>
-Finally, the timing of the <a href="https://golang.org/s/releasesched">release</a>
-strays from the usual six-month interval,
-both to provide more time to prepare this major release and to shift the schedule thereafter to
-time the release dates more conveniently.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<h3 id="map_literals">Map literals</h3>
-
-<p>
-Due to an oversight, the rule that allowed the element type to be elided from slice literals was not
-applied to map keys.
-This has been <a href="/cl/2591">corrected</a> in Go 1.5.
-An example will make this clear.
-As of Go 1.5, this map literal,
-</p>
-
-<pre>
-m := map[Point]string{
- Point{29.935523, 52.891566}: "Persepolis",
- Point{-25.352594, 131.034361}: "Uluru",
- Point{37.422455, -122.084306}: "Googleplex",
-}
-</pre>
-
-<p>
-may be written as follows, without the <code>Point</code> type listed explicitly:
-</p>
-
-<pre>
-m := map[Point]string{
- {29.935523, 52.891566}: "Persepolis",
- {-25.352594, 131.034361}: "Uluru",
- {37.422455, -122.084306}: "Googleplex",
-}
-</pre>
-
-<h2 id="implementation">The Implementation</h2>
-
-<h3 id="c">No more C</h3>
-
-<p>
-The compiler and runtime are now implemented in Go and assembler, without C.
-The only C source left in the tree is related to testing or to <code>cgo</code>.
-There was a C compiler in the tree in 1.4 and earlier.
-It was used to build the runtime; a custom compiler was necessary in part to
-guarantee the C code would work with the stack management of goroutines.
-Since the runtime is in Go now, there is no need for this C compiler and it is gone.
-Details of the process to eliminate C are discussed <a href="https://golang.org/s/go13compiler">elsewhere</a>.
-</p>
-
-<p>
-The conversion from C was done with the help of custom tools created for the job.
-Most important, the compiler was actually moved by automatic translation of
-the C code into Go.
-It is in effect the same program in a different language.
-It is not a new implementation
-of the compiler so we expect the process will not have introduced new compiler
-bugs.
-An overview of this process is available in the slides for
-<a href="https://talks.golang.org/2015/gogo.slide">this presentation</a>.
-</p>
-
-<h3 id="compiler_and_tools">Compiler and tools</h3>
-
-<p>
-Independent of but encouraged by the move to Go, the names of the tools have changed.
-The old names <code>6g</code>, <code>8g</code> and so on are gone; instead there
-is just one binary, accessible as <code>go</code> <code>tool</code> <code>compile</code>,
-that compiles Go source into binaries suitable for the architecture and operating system
-specified by <code>$GOARCH</code> and <code>$GOOS</code>.
-Similarly, there is now one linker (<code>go</code> <code>tool</code> <code>link</code>)
-and one assembler (<code>go</code> <code>tool</code> <code>asm</code>).
-The linker was translated automatically from the old C implementation,
-but the assembler is a new native Go implementation discussed
-in more detail below.
-</p>
-
-<p>
-Similar to the drop of the names <code>6g</code>, <code>8g</code>, and so on,
-the output of the compiler and assembler are now given a plain <code>.o</code> suffix
-rather than <code>.8</code>, <code>.6</code>, etc.
-</p>
-
-
-<h3 id="gc">Garbage collector</h3>
-
-<p>
-The garbage collector has been re-engineered for 1.5 as part of the development
-outlined in the <a href="https://golang.org/s/go14gc">design document</a>.
-Expected latencies are much lower than with the collector
-in prior releases, through a combination of advanced algorithms,
-better <a href="https://golang.org/s/go15gcpacing">scheduling</a> of the collector,
-and running more of the collection in parallel with the user program.
-The "stop the world" phase of the collector
-will almost always be under 10 milliseconds and usually much less.
-</p>
-
-<p>
-For systems that benefit from low latency, such as user-responsive web sites,
-the drop in expected latency with the new collector may be important.
-</p>
-
-<p>
-Details of the new collector were presented in a
-<a href="https://talks.golang.org/2015/go-gc.pdf">talk</a> at GopherCon 2015.
-</p>
-
-<h3 id="runtime">Runtime</h3>
-
-<p>
-In Go 1.5, the order in which goroutines are scheduled has been changed.
-The properties of the scheduler were never defined by the language,
-but programs that depend on the scheduling order may be broken
-by this change.
-We have seen a few (erroneous) programs affected by this change.
-If you have programs that implicitly depend on the scheduling
-order, you will need to update them.
-</p>
-
-<p>
-Another potentially breaking change is that the runtime now
-sets the default number of threads to run simultaneously,
-defined by <code>GOMAXPROCS</code>, to the number
-of cores available on the CPU.
-In prior releases the default was 1.
-Programs that do not expect to run with multiple cores may
-break inadvertently.
-They can be updated by removing the restriction or by setting
-<code>GOMAXPROCS</code> explicitly.
-For a more detailed discussion of this change, see
-the <a href="https://golang.org/s/go15gomaxprocs">design document</a>.
-</p>
-
-<h3 id="build">Build</h3>
-
-<p>
-Now that the Go compiler and runtime are implemented in Go, a Go compiler
-must be available to compile the distribution from source.
-Thus, to build the Go core, a working Go distribution must already be in place.
-(Go programmers who do not work on the core are unaffected by this change.)
-Any Go 1.4 or later distribution (including <code>gccgo</code>) will serve.
-For details, see the <a href="https://golang.org/s/go15bootstrap">design document</a>.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p>
-Due mostly to the industry's move away from the 32-bit x86 architecture,
-the set of binary downloads provided is reduced in 1.5.
-A distribution for the OS X operating system is provided only for the
-<code>amd64</code> architecture, not <code>386</code>.
-Similarly, the ports for Snow Leopard (Apple OS X 10.6) still work but are no
-longer released as a download or maintained since Apple no longer maintains that version
-of the operating system.
-Also, the <code>dragonfly/386</code> port is no longer supported at all
-because DragonflyBSD itself no longer supports the 32-bit 386 architecture.
-</p>
-
-<p>
-There are however several new ports available to be built from source.
-These include <code>darwin/arm</code> and <code>darwin/arm64</code>.
-The new port <code>linux/arm64</code> is mostly in place, but <code>cgo</code>
-is only supported using external linking.
-</p>
-
-<p>
-Also available as experiments are <code>ppc64</code>
-and <code>ppc64le</code> (64-bit PowerPC, big- and little-endian).
-Both these ports support <code>cgo</code> but
-only with internal linking.
-</p>
-
-<p>
-On FreeBSD, Go 1.5 requires FreeBSD 8-STABLE+ because of its new use of the <code>SYSCALL</code> instruction.
-</p>
-
-<p>
-On NaCl, Go 1.5 requires SDK version pepper-41. Later pepper versions are not
-compatible due to the removal of the sRPC subsystem from the NaCl runtime.
-</p>
-
-<p>
-On Darwin, the use of the system X.509 certificate interface can be disabled
-with the <code>ios</code> build tag.
-</p>
-
-<p>
-The Solaris port now has full support for cgo and the packages
-<a href="/pkg/net/"><code>net</code></a> and
-<a href="/pkg/crypto/x509/"><code>crypto/x509</code></a>,
-as well as a number of other fixes and improvements.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="translate">Translating</h3>
-
-<p>
-As part of the process to eliminate C from the tree, the compiler and
-linker were translated from C to Go.
-It was a genuine (machine assisted) translation, so the new programs are essentially
-the old programs translated rather than new ones with new bugs.
-We are confident the translation process has introduced few if any new bugs,
-and in fact uncovered a number of previously unknown bugs, now fixed.
-</p>
-
-<p>
-The assembler is a new program, however; it is described below.
-</p>
-
-<h3 id="rename">Renaming</h3>
-
-<p>
-The suites of programs that were the compilers (<code>6g</code>, <code>8g</code>, etc.),
-the assemblers (<code>6a</code>, <code>8a</code>, etc.),
-and the linkers (<code>6l</code>, <code>8l</code>, etc.)
-have each been consolidated into a single tool that is configured
-by the environment variables <code>GOOS</code> and <code>GOARCH</code>.
-The old names are gone; the new tools are available through the <code>go</code> <code>tool</code>
-mechanism as <code>go tool compile</code>,
-<code>go tool asm</code>,
-<code>and go tool link</code>.
-Also, the file suffixes <code>.6</code>, <code>.8</code>, etc. for the
-intermediate object files are also gone; now they are just plain <code>.o</code> files.
-</p>
-
-<p>
-For example, to build and link a program on amd64 for Darwin
-using the tools directly, rather than through <code>go build</code>,
-one would run:
-</p>
-
-<pre>
-$ export GOOS=darwin GOARCH=amd64
-$ go tool compile program.go
-$ go tool link program.o
-</pre>
-
-<h3 id="moving">Moving</h3>
-
-<p>
-Because the <a href="/pkg/go/types/"><code>go/types</code></a> package
-has now moved into the main repository (see below),
-the <a href="/cmd/vet"><code>vet</code></a> and
-<a href="/cmd/cover"><code>cover</code></a>
-tools have also been moved.
-They are no longer maintained in the external <code>golang.org/x/tools</code> repository,
-although (deprecated) source still resides there for compatibility with old releases.
-</p>
-
-<h3 id="compiler">Compiler</h3>
-
-<p>
-As described above, the compiler in Go 1.5 is a single Go program,
-translated from the old C source, that replaces <code>6g</code>, <code>8g</code>,
-and so on.
-Its target is configured by the environment variables <code>GOOS</code> and <code>GOARCH</code>.
-</p>
-
-<p>
-The 1.5 compiler is mostly equivalent to the old,
-but some internal details have changed.
-One significant change is that evaluation of constants now uses
-the <a href="/pkg/math/big/"><code>math/big</code></a> package
-rather than a custom (and less well tested) implementation of high precision
-arithmetic.
-We do not expect this to affect the results.
-</p>
-
-<p>
-For the amd64 architecture only, the compiler has a new option, <code>-dynlink</code>,
-that assists dynamic linking by supporting references to Go symbols
-defined in external shared libraries.
-</p>
-
-<h3 id="assembler">Assembler</h3>
-
-<p>
-Like the compiler and linker, the assembler in Go 1.5 is a single program
-that replaces the suite of assemblers (<code>6a</code>,
-<code>8a</code>, etc.) and the environment variables
-<code>GOARCH</code> and <code>GOOS</code>
-configure the architecture and operating system.
-Unlike the other programs, the assembler is a wholly new program
-written in Go.
-</p>
-
- <p>
-The new assembler is very nearly compatible with the previous
-ones, but there are a few changes that may affect some
-assembler source files.
-See the updated <a href="/doc/asm">assembler guide</a>
-for more specific information about these changes. In summary:
-
-</p>
-
-<p>
-First, the expression evaluation used for constants is a little
-different.
-It now uses unsigned 64-bit arithmetic and the precedence
-of operators (<code>+</code>, <code>-</code>, <code><<</code>, etc.)
-comes from Go, not C.
-We expect these changes to affect very few programs but
-manual verification may be required.
-</p>
-
-<p>
-Perhaps more important is that on machines where
-<code>SP</code> or <code>PC</code> is only an alias
-for a numbered register,
-such as <code>R13</code> for the stack pointer and
-<code>R15</code> for the hardware program counter
-on ARM,
-a reference to such a register that does not include a symbol
-is now illegal.
-For example, <code>SP</code> and <code>4(SP)</code> are
-illegal but <code>sym+4(SP)</code> is fine.
-On such machines, to refer to the hardware register use its
-true <code>R</code> name.
-</p>
-
-<p>
-One minor change is that some of the old assemblers
-permitted the notation
-</p>
-
-<pre>
-constant=value
-</pre>
-
-<p>
-to define a named constant.
-Since this is always possible to do with the traditional
-C-like <code>#define</code> notation, which is still
-supported (the assembler includes an implementation
-of a simplified C preprocessor), the feature was removed.
-</p>
-
-<h3 id="link">Linker</h3>
-
-<p>
-The linker in Go 1.5 is now one Go program,
-that replaces <code>6l</code>, <code>8l</code>, etc.
-Its operating system and instruction set are specified
-by the environment variables <code>GOOS</code> and <code>GOARCH</code>.
-</p>
-
-<p>
-There are several other changes.
-The most significant is the addition of a <code>-buildmode</code> option that
-expands the style of linking; it now supports
-situations such as building shared libraries and allowing other languages
-to call into Go libraries.
-Some of these were outlined in a <a href="https://golang.org/s/execmodes">design document</a>.
-For a list of the available build modes and their use, run
-</p>
-
-<pre>
-$ go help buildmode
-</pre>
-
-<p>
-Another minor change is that the linker no longer records build time stamps in
-the header of Windows executables.
-Also, although this may be fixed, Windows cgo executables are missing some
-DWARF information.
-</p>
-
-<p>
-Finally, the <code>-X</code> flag, which takes two arguments,
-as in
-</p>
-
-<pre>
--X importpath.name value
-</pre>
-
-<p>
-now also accepts a more common Go flag style with a single argument
-that is itself a <code>name=value</code> pair:
-</p>
-
-<pre>
--X importpath.name=value
-</pre>
-
-<p>
-Although the old syntax still works, it is recommended that uses of this
-flag in scripts and the like be updated to the new form.
-</p>
-
-<h3 id="go_command">Go command</h3>
-
-<p>
-The <a href="/cmd/go"><code>go</code></a> command's basic operation
-is unchanged, but there are a number of changes worth noting.
-</p>
-
-<p>
-The previous release introduced the idea of a directory internal to a package
-being unimportable through the <code>go</code> command.
-In 1.4, it was tested with the introduction of some internal elements
-in the core repository.
-As suggested in the <a href="https://golang.org/s/go14internal">design document</a>,
-that change is now being made available to all repositories.
-The rules are explained in the design document, but in summary any
-package in or under a directory named <code>internal</code> may
-be imported by packages rooted in the same subtree.
-Existing packages with directory elements named <code>internal</code> may be
-inadvertently broken by this change, which was why it was advertised
-in the last release.
-</p>
-
-<p>
-Another change in how packages are handled is the experimental
-addition of support for "vendoring".
-For details, see the documentation for the <a href="/cmd/go/#hdr-Vendor_Directories"><code>go</code> command</a>
-and the <a href="https://golang.org/s/go15vendor">design document</a>.
-</p>
-
-<p>
-There have also been several minor changes.
-Read the <a href="/cmd/go">documentation</a> for full details.
-</p>
-
-<ul>
-
-<li>
-SWIG support has been updated such that
-<code>.swig</code> and <code>.swigcxx</code>
-now require SWIG 3.0.6 or later.
-</li>
-
-<li>
-The <code>install</code> subcommand now removes the
-binary created by the <code>build</code> subcommand
-in the source directory, if present,
-to avoid problems having two binaries present in the tree.
-</li>
-
-<li>
-The <code>std</code> (standard library) wildcard package name
-now excludes commands.
-A new <code>cmd</code> wildcard covers the commands.
-</li>
-
-<li>
-A new <code>-asmflags</code> build option
-sets flags to pass to the assembler.
-However,
-the <code>-ccflags</code> build option has been dropped;
-it was specific to the old, now deleted C compiler .
-</li>
-
-<li>
-A new <code>-buildmode</code> build option
-sets the build mode, described above.
-</li>
-
-<li>
-A new <code>-pkgdir</code> build option
-sets the location of installed package archives,
-to help isolate custom builds.
-</li>
-
-<li>
-A new <code>-toolexec</code> build option
-allows substitution of a different command to invoke
-the compiler and so on.
-This acts as a custom replacement for <code>go tool</code>.
-</li>
-
-<li>
-The <code>test</code> subcommand now has a <code>-count</code>
-flag to specify how many times to run each test and benchmark.
-The <a href="/pkg/testing/"><code>testing</code></a> package
-does the work here, through the <code>-test.count</code> flag.
-</li>
-
-<li>
-The <code>generate</code> subcommand has a couple of new features.
-The <code>-run</code> option specifies a regular expression to select which directives
-to execute; this was proposed but never implemented in 1.4.
-The executing pattern now has access to two new environment variables:
-<code>$GOLINE</code> returns the source line number of the directive
-and <code>$DOLLAR</code> expands to a dollar sign.
-</li>
-
-<li>
-The <code>get</code> subcommand now has a <code>-insecure</code>
-flag that must be enabled if fetching from an insecure repository, one that
-does not encrypt the connection.
-</li>
-
-</ul>
-
-<h3 id="vet_command">Go vet command</h3>
-
-<p>
-The <a href="/cmd/vet"><code>go tool vet</code></a> command now does
-more thorough validation of struct tags.
-</p>
-
-<h3 id="trace_command">Trace command</h3>
-
-<p>
-A new tool is available for dynamic execution tracing of Go programs.
-The usage is analogous to how the test coverage tool works.
-Generation of traces is integrated into <code>go test</code>,
-and then a separate execution of the tracing tool itself analyzes the results:
-</p>
-
-<pre>
-$ go test -trace=trace.out path/to/package
-$ go tool trace [flags] pkg.test trace.out
-</pre>
-
-<p>
-The flags enable the output to be displayed in a browser window.
-For details, run <code>go tool trace -help</code>.
-There is also a description of the tracing facility in this
-<a href="https://talks.golang.org/2015/dynamic-tools.slide">talk</a>
-from GopherCon 2015.
-</p>
-
-<h3 id="doc_command">Go doc command</h3>
-
-<p>
-A few releases back, the <code>go doc</code>
-command was deleted as being unnecessary.
-One could always run "<code>godoc .</code>" instead.
-The 1.5 release introduces a new <a href="/cmd/doc"><code>go doc</code></a>
-command with a more convenient command-line interface than
-<code>godoc</code>'s.
-It is designed for command-line usage specifically, and provides a more
-compact and focused presentation of the documentation for a package
-or its elements, according to the invocation.
-It also provides case-insensitive matching and
-support for showing the documentation for unexported symbols.
-For details run "<code>go help doc</code>".
-</p>
-
-<h3 id="cgo">Cgo</h3>
-
-<p>
-When parsing <code>#cgo</code> lines,
-the invocation <code>${SRCDIR}</code> is now
-expanded into the path to the source directory.
-This allows options to be passed to the
-compiler and linker that involve file paths relative to the
-source code directory. Without the expansion the paths would be
-invalid when the current working directory changes.
-</p>
-
-<p>
-Solaris now has full cgo support.
-</p>
-
-<p>
-On Windows, cgo now uses external linking by default.
-</p>
-
-<p>
-When a C struct ends with a zero-sized field, but the struct itself is
-not zero-sized, Go code can no longer refer to the zero-sized field.
-Any such references will have to be rewritten.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-As always, the changes are so general and varied that precise statements
-about performance are difficult to make.
-The changes are even broader ranging than usual in this release, which
-includes a new garbage collector and a conversion of the runtime to Go.
-Some programs may run faster, some slower.
-On average the programs in the Go 1 benchmark suite run a few percent faster in Go 1.5
-than they did in Go 1.4,
-while as mentioned above the garbage collector's pauses are
-dramatically shorter, and almost always under 10 milliseconds.
-</p>
-
-<p>
-Builds in Go 1.5 will be slower by a factor of about two.
-The automatic translation of the compiler and linker from C to Go resulted in
-unidiomatic Go code that performs poorly compared to well-written Go.
-Analysis tools and refactoring helped to improve the code, but much remains to be done.
-Further profiling and optimization will continue in Go 1.6 and future releases.
-For more details, see these <a href="https://talks.golang.org/2015/gogo.slide">slides</a>
-and associated <a href="https://www.youtube.com/watch?v=cF1zJYkBW4A">video</a>.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="flag">Flag</h3>
-
-<p>
-The flag package's
-<a href="/pkg/flag/#PrintDefaults"><code>PrintDefaults</code></a>
-function, and method on <a href="/pkg/flag/#FlagSet"><code>FlagSet</code></a>,
-have been modified to create nicer usage messages.
-The format has been changed to be more human-friendly and in the usage
-messages a word quoted with `backquotes` is taken to be the name of the
-flag's operand to display in the usage message.
-For instance, a flag created with the invocation,
-</p>
-
-<pre>
-cpuFlag = flag.Int("cpu", 1, "run `N` processes in parallel")
-</pre>
-
-<p>
-will show the help message,
-</p>
-
-<pre>
--cpu N
- run N processes in parallel (default 1)
-</pre>
-
-<p>
-Also, the default is now listed only when it is not the zero value for the type.
-</p>
-
-<h3 id="math_big">Floats in math/big</h3>
-
-<p>
-The <a href="/pkg/math/big/"><code>math/big</code></a> package
-has a new, fundamental data type,
-<a href="/pkg/math/big/#Float"><code>Float</code></a>,
-which implements arbitrary-precision floating-point numbers.
-A <code>Float</code> value is represented by a boolean sign,
-a variable-length mantissa, and a 32-bit fixed-size signed exponent.
-The precision of a <code>Float</code> (the mantissa size in bits)
-can be specified explicitly or is otherwise determined by the first
-operation that creates the value.
-Once created, the size of a <code>Float</code>'s mantissa may be modified with the
-<a href="/pkg/math/big/#Float.SetPrec"><code>SetPrec</code></a> method.
-<code>Floats</code> support the concept of infinities, such as are created by
-overflow, but values that would lead to the equivalent of IEEE 754 NaNs
-trigger a panic.
-<code>Float</code> operations support all IEEE-754 rounding modes.
-When the precision is set to 24 (53) bits,
-operations that stay within the range of normalized <code>float32</code>
-(<code>float64</code>)
-values produce the same results as the corresponding IEEE-754
-arithmetic on those values.
-</p>
-
-<h3 id="go_types">Go types</h3>
-
-<p>
-The <a href="/pkg/go/types/"><code>go/types</code></a> package
-up to now has been maintained in the <code>golang.org/x</code>
-repository; as of Go 1.5 it has been relocated to the main repository.
-The code at the old location is now deprecated.
-There is also a modest API change in the package, discussed below.
-</p>
-
-<p>
-Associated with this move, the
-<a href="/pkg/go/constant/"><code>go/constant</code></a>
-package also moved to the main repository;
-it was <code>golang.org/x/tools/exact</code> before.
-The <a href="/pkg/go/importer/"><code>go/importer</code></a> package
-also moved to the main repository,
-as well as some tools described above.
-</p>
-
-<h3 id="net">Net</h3>
-
-<p>
-The DNS resolver in the net package has almost always used <code>cgo</code> to access
-the system interface.
-A change in Go 1.5 means that on most Unix systems DNS resolution
-will no longer require <code>cgo</code>, which simplifies execution
-on those platforms.
-Now, if the system's networking configuration permits, the native Go resolver
-will suffice.
-The important effect of this change is that each DNS resolution occupies a goroutine
-rather than a thread,
-so a program with multiple outstanding DNS requests will consume fewer operating
-system resources.
-</p>
-
-<p>
-The decision of how to run the resolver applies at run time, not build time.
-The <code>netgo</code> build tag that has been used to enforce the use
-of the Go resolver is no longer necessary, although it still works.
-A new <code>netcgo</code> build tag forces the use of the <code>cgo</code> resolver at
-build time.
-To force <code>cgo</code> resolution at run time set
-<code>GODEBUG=netdns=cgo</code> in the environment.
-More debug options are documented <a href="https://golang.org/cl/11584">here</a>.
-</p>
-
-<p>
-This change applies to Unix systems only.
-Windows, Mac OS X, and Plan 9 systems behave as before.
-</p>
-
-<h3 id="reflect">Reflect</h3>
-
-<p>
-The <a href="/pkg/reflect/"><code>reflect</code></a> package
-has two new functions: <a href="/pkg/reflect/#ArrayOf"><code>ArrayOf</code></a>
-and <a href="/pkg/reflect/#FuncOf"><code>FuncOf</code></a>.
-These functions, analogous to the extant
-<a href="/pkg/reflect/#SliceOf"><code>SliceOf</code></a> function,
-create new types at runtime to describe arrays and functions.
-</p>
-
-<h3 id="hardening">Hardening</h3>
-
-<p>
-Several dozen bugs were found in the standard library
-through randomized testing with the
-<a href="https://github.com/dvyukov/go-fuzz"><code>go-fuzz</code></a> tool.
-Bugs were fixed in the
-<a href="/pkg/archive/tar/"><code>archive/tar</code></a>,
-<a href="/pkg/archive/zip/"><code>archive/zip</code></a>,
-<a href="/pkg/compress/flate/"><code>compress/flate</code></a>,
-<a href="/pkg/encoding/gob/"><code>encoding/gob</code></a>,
-<a href="/pkg/fmt/"><code>fmt</code></a>,
-<a href="/pkg/html/template/"><code>html/template</code></a>,
-<a href="/pkg/image/gif/"><code>image/gif</code></a>,
-<a href="/pkg/image/jpeg/"><code>image/jpeg</code></a>,
-<a href="/pkg/image/png/"><code>image/png</code></a>, and
-<a href="/pkg/text/template/"><code>text/template</code></a>,
-packages.
-The fixes harden the implementation against incorrect and malicious inputs.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<ul>
-
-<li>
-The <a href="/pkg/archive/zip/"><code>archive/zip</code></a> package's
-<a href="/pkg/archive/zip/#Writer"><code>Writer</code></a> type now has a
-<a href="/pkg/archive/zip/#Writer.SetOffset"><code>SetOffset</code></a>
-method to specify the location within the output stream at which to write the archive.
-</li>
-
-<li>
-The <a href="/pkg/bufio/#Reader"><code>Reader</code></a> in the
-<a href="/pkg/bufio/"><code>bufio</code></a> package now has a
-<a href="/pkg/bufio/#Reader.Discard"><code>Discard</code></a>
-method to discard data from the input.
-</li>
-
-<li>
-In the <a href="/pkg/bytes/"><code>bytes</code></a> package,
-the <a href="/pkg/bytes/#Buffer"><code>Buffer</code></a> type
-now has a <a href="/pkg/bytes/#Buffer.Cap"><code>Cap</code></a> method
-that reports the number of bytes allocated within the buffer.
-Similarly, in both the <a href="/pkg/bytes/"><code>bytes</code></a>
-and <a href="/pkg/strings/"><code>strings</code></a> packages,
-the <a href="/pkg/bytes/#Reader"><code>Reader</code></a>
-type now has a <a href="/pkg/bytes/#Reader.Size"><code>Size</code></a>
-method that reports the original length of the underlying slice or string.
-</li>
-
-<li>
-Both the <a href="/pkg/bytes/"><code>bytes</code></a> and
-<a href="/pkg/strings/"><code>strings</code></a> packages
-also now have a <a href="/pkg/bytes/#LastIndexByte"><code>LastIndexByte</code></a>
-function that locates the rightmost byte with that value in the argument.
-</li>
-
-<li>
-The <a href="/pkg/crypto/"><code>crypto</code></a> package
-has a new interface, <a href="/pkg/crypto/#Decrypter"><code>Decrypter</code></a>,
-that abstracts the behavior of a private key used in asymmetric decryption.
-</li>
-
-<li>
-In the <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a> package,
-the documentation for the <a href="/pkg/crypto/cipher/#Stream"><code>Stream</code></a>
-interface has been clarified regarding the behavior when the source and destination are
-different lengths.
-If the destination is shorter than the source, the method will panic.
-This is not a change in the implementation, only the documentation.
-</li>
-
-<li>
-Also in the <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a> package,
-there is now support for nonce lengths other than 96 bytes in AES's Galois/Counter mode (GCM),
-which some protocols require.
-</li>
-
-<li>
-In the <a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a> package,
-there is now a <code>Name</code> field in the
-<a href="/pkg/crypto/elliptic/#CurveParams"><code>CurveParams</code></a> struct,
-and the curves implemented in the package have been given names.
-These names provide a safer way to select a curve, as opposed to
-selecting its bit size, for cryptographic systems that are curve-dependent.
-</li>
-
-<li>
-Also in the <a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a> package,
-the <a href="/pkg/crypto/elliptic/#Unmarshal"><code>Unmarshal</code></a> function
-now verifies that the point is actually on the curve.
-(If it is not, the function returns nils).
-This change guards against certain attacks.
-</li>
-
-<li>
-The <a href="/pkg/crypto/sha512/"><code>crypto/sha512</code></a>
-package now has support for the two truncated versions of
-the SHA-512 hash algorithm, SHA-512/224 and SHA-512/256.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-minimum protocol version now defaults to TLS 1.0.
-The old default, SSLv3, is still available through <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> if needed.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-now supports Signed Certificate Timestamps (SCTs) as specified in RFC 6962.
-The server serves them if they are listed in the
-<a href="/pkg/crypto/tls/#Certificate"><code>Certificate</code></a> struct,
-and the client requests them and exposes them, if present,
-in its <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a> struct.
-
-<li>
-The stapled OCSP response to a <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> client connection,
-previously only available via the
-<a href="/pkg/crypto/tls/#Conn.OCSPResponse"><code>OCSPResponse</code></a> method,
-is now exposed in the <a href="/pkg/crypto/tls/#ConnectionState"><code>ConnectionState</code></a> struct.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> server implementation
-will now always call the
-<code>GetCertificate</code> function in
-the <a href="/pkg/crypto/tls/#Config"><code>Config</code></a> struct
-to select a certificate for the connection when none is supplied.
-</li>
-
-<li>
-Finally, the session ticket keys in the
-<a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-can now be changed while the server is running.
-This is done through the new
-<a href="/pkg/crypto/tls/#Config.SetSessionTicketKeys"><code>SetSessionTicketKeys</code></a>
-method of the
-<a href="/pkg/crypto/tls/#Config"><code>Config</code></a> type.
-</li>
-
-<li>
-In the <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package,
-wildcards are now accepted only in the leftmost label as defined in
-<a href="https://tools.ietf.org/html/rfc6125#section-6.4.3">the specification</a>.
-</li>
-
-<li>
-Also in the <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package,
-the handling of unknown critical extensions has been changed.
-They used to cause parse errors but now they are parsed and caused errors only
-in <a href="/pkg/crypto/x509/#Certificate.Verify"><code>Verify</code></a>.
-The new field <code>UnhandledCriticalExtensions</code> of
-<a href="/pkg/crypto/x509/#Certificate"><code>Certificate</code></a> records these extensions.
-</li>
-
-<li>
-The <a href="/pkg/database/sql/#DB"><code>DB</code></a> type of the
-<a href="/pkg/database/sql/"><code>database/sql</code></a> package
-now has a <a href="/pkg/database/sql/#DB.Stats"><code>Stats</code></a> method
-to retrieve database statistics.
-</li>
-
-<li>
-The <a href="/pkg/debug/dwarf/"><code>debug/dwarf</code></a>
-package has extensive additions to better support DWARF version 4.
-See for example the definition of the new type
-<a href="/pkg/debug/dwarf/#Class"><code>Class</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/debug/dwarf/"><code>debug/dwarf</code></a> package
-also now supports decoding of DWARF line tables.
-</li>
-
-<li>
-The <a href="/pkg/debug/elf/"><code>debug/elf</code></a>
-package now has support for the 64-bit PowerPC architecture.
-</li>
-
-<li>
-The <a href="/pkg/encoding/base64/"><code>encoding/base64</code></a> package
-now supports unpadded encodings through two new encoding variables,
-<a href="/pkg/encoding/base64/#RawStdEncoding"><code>RawStdEncoding</code></a> and
-<a href="/pkg/encoding/base64/#RawURLEncoding"><code>RawURLEncoding</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/encoding/json/"><code>encoding/json</code></a> package
-now returns an <a href="/pkg/encoding/json/#UnmarshalTypeError"><code>UnmarshalTypeError</code></a>
-if a JSON value is not appropriate for the target variable or component
-to which it is being unmarshaled.
-</li>
-
-<li>
-The <code>encoding/json</code>'s
-<a href="/pkg/encoding/json/#Decoder"><code>Decoder</code></a>
-type has a new method that provides a streaming interface for decoding
-a JSON document:
-<a href="/pkg/encoding/json/#Decoder.Token"><code>Token</code></a>.
-It also interoperates with the existing functionality of <code>Decode</code>,
-which will continue a decode operation already started with <code>Decoder.Token</code>.
-</li>
-
-<li>
-The <a href="/pkg/flag/"><code>flag</code></a> package
-has a new function, <a href="/pkg/flag/#UnquoteUsage"><code>UnquoteUsage</code></a>,
-to assist in the creation of usage messages using the new convention
-described above.
-</li>
-
-<li>
-In the <a href="/pkg/fmt/"><code>fmt</code></a> package,
-a value of type <a href="/pkg/reflect/#Value"><code>Value</code></a> now
-prints what it holds, rather than use the <code>reflect.Value</code>'s <code>Stringer</code>
-method, which produces things like <code>&lt;int Value&gt;</code>.
-</li>
-
-<li>
-The <a href="/pkg/ast/#EmptyStmt"><code>EmptyStmt</code></a> type
-in the <a href="/pkg/go/ast/"><code>go/ast</code></a> package now
-has a boolean <code>Implicit</code> field that records whether the
-semicolon was implicitly added or was present in the source.
-</li>
-
-<li>
-For forward compatibility the <a href="/pkg/go/build/"><code>go/build</code></a> package
-reserves <code>GOARCH</code> values for a number of architectures that Go might support one day.
-This is not a promise that it will.
-Also, the <a href="/pkg/go/build/#Package"><code>Package</code></a> struct
-now has a <code>PkgTargetRoot</code> field that stores the
-architecture-dependent root directory in which to install, if known.
-</li>
-
-<li>
-The (newly migrated) <a href="/pkg/go/types/"><code>go/types</code></a>
-package allows one to control the prefix attached to package-level names using
-the new <a href="/pkg/go/types/#Qualifier"><code>Qualifier</code></a>
-function type as an argument to several functions. This is an API change for
-the package, but since it is new to the core, it is not breaking the Go 1 compatibility
-rules since code that uses the package must explicitly ask for it at its new location.
-To update, run
-<a href="https://golang.org/cmd/go/#hdr-Run_go_tool_fix_on_packages"><code>go fix</code></a> on your package.
-</li>
-
-<li>
-In the <a href="/pkg/image/"><code>image</code></a> package,
-the <a href="/pkg/image/#Rectangle"><code>Rectangle</code></a> type
-now implements the <a href="/pkg/image/#Image"><code>Image</code></a> interface,
-so a <code>Rectangle</code> can serve as a mask when drawing.
-</li>
-
-<li>
-Also in the <a href="/pkg/image/"><code>image</code></a> package,
-to assist in the handling of some JPEG images,
-there is now support for 4:1:1 and 4:1:0 YCbCr subsampling and basic
-CMYK support, represented by the new <code>image.CMYK</code> struct.
-</li>
-
-<li>
-The <a href="/pkg/image/color/"><code>image/color</code></a> package
-adds basic CMYK support, through the new
-<a href="/pkg/image/color/#CMYK"><code>CMYK</code></a> struct,
-the <a href="/pkg/image/color/#CMYKModel"><code>CMYKModel</code></a> color model, and the
-<a href="/pkg/image/color/#CMYKToRGB"><code>CMYKToRGB</code></a> function, as
-needed by some JPEG images.
-</li>
-
-<li>
-Also in the <a href="/pkg/image/color/"><code>image/color</code></a> package,
-the conversion of a <a href="/pkg/image/color/#YCbCr"><code>YCbCr</code></a>
-value to <code>RGBA</code> has become more precise.
-Previously, the low 8 bits were just an echo of the high 8 bits;
-now they contain more accurate information.
-Because of the echo property of the old code, the operation
-<code>uint8(r)</code> to extract an 8-bit red value worked, but is incorrect.
-In Go 1.5, that operation may yield a different value.
-The correct code is, and always was, to select the high 8 bits:
-<code>uint8(r&gt;&gt;8)</code>.
-Incidentally, the <code>image/draw</code> package
-provides better support for such conversions; see
-<a href="https://blog.golang.org/go-imagedraw-package">this blog post</a>
-for more information.
-</li>
-
-<li>
-Finally, as of Go 1.5 the closest match check in
-<a href="/pkg/image/color/#Palette.Index"><code>Index</code></a>
-now honors the alpha channel.
-</li>
-
-<li>
-The <a href="/pkg/image/gif/"><code>image/gif</code></a> package
-includes a couple of generalizations.
-A multiple-frame GIF file can now have an overall bounds different
-from all the contained single frames' bounds.
-Also, the <a href="/pkg/image/gif/#GIF"><code>GIF</code></a> struct
-now has a <code>Disposal</code> field
-that specifies the disposal method for each frame.
-</li>
-
-<li>
-The <a href="/pkg/io/"><code>io</code></a> package
-adds a <a href="/pkg/io/#CopyBuffer"><code>CopyBuffer</code></a> function
-that is like <a href="/pkg/io/#Copy"><code>Copy</code></a> but
-uses a caller-provided buffer, permitting control of allocation and buffer size.
-</li>
-
-<li>
-The <a href="/pkg/log/"><code>log</code></a> package
-has a new <a href="/pkg/log/#LUTC"><code>LUTC</code></a> flag
-that causes time stamps to be printed in the UTC time zone.
-It also adds a <a href="/pkg/log/#Logger.SetOutput"><code>SetOutput</code></a> method
-for user-created loggers.
-</li>
-
-<li>
-In Go 1.4, <a href="/pkg/math/#Max"><code>Max</code></a> was not detecting all possible NaN bit patterns.
-This is fixed in Go 1.5, so programs that use <code>math.Max</code> on data including NaNs may behave differently,
-but now correctly according to the IEEE754 definition of NaNs.
-</li>
-
-<li>
-The <a href="/pkg/math/big/"><code>math/big</code></a> package
-adds a new <a href="/pkg/math/big/#Jacobi"><code>Jacobi</code></a>
-function for integers and a new
-<a href="/pkg/math/big/#Int.ModSqrt"><code>ModSqrt</code></a>
-method for the <a href="/pkg/math/big/#Int"><code>Int</code></a> type.
-</li>
-
-<li>
-The mime package
-adds a new <a href="/pkg/mime/#WordDecoder"><code>WordDecoder</code></a> type
-to decode MIME headers containing RFC 204-encoded words.
-It also provides <a href="/pkg/mime/#BEncoding"><code>BEncoding</code></a> and
-<a href="/pkg/mime/#QEncoding"><code>QEncoding</code></a>
-as implementations of the encoding schemes of RFC 2045 and RFC 2047.
-</li>
-
-<li>
-The <a href="/pkg/mime/"><code>mime</code></a> package also adds an
-<a href="/pkg/mime/#ExtensionsByType"><code>ExtensionsByType</code></a>
-function that returns the MIME extensions know to be associated with a given MIME type.
-</li>
-
-<li>
-There is a new <a href="/pkg/mime/quotedprintable/"><code>mime/quotedprintable</code></a>
-package that implements the quoted-printable encoding defined by RFC 2045.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package will now
-<a href="/pkg/net/#Dial"><code>Dial</code></a> hostnames by trying each
-IP address in order until one succeeds.
-The <code><a href="/pkg/net/#Dialer">Dialer</a>.DualStack</code>
-mode now implements Happy Eyeballs
-(<a href="https://tools.ietf.org/html/rfc6555">RFC 6555</a>) by giving the
-first address family a 300ms head start; this value can be overridden by
-the new <code>Dialer.FallbackDelay</code>.
-</li>
-
-<li>
-A number of inconsistencies in the types returned by errors in the
-<a href="/pkg/net/"><code>net</code></a> package have been
-tidied up.
-Most now return an
-<a href="/pkg/net/#OpError"><code>OpError</code></a> value
-with more information than before.
-Also, the <a href="/pkg/net/#OpError"><code>OpError</code></a>
-type now includes a <code>Source</code> field that holds the local
-network address.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package now
-has support for setting trailers from a server <a href="/pkg/net/http/#Handler"><code>Handler</code></a>.
-For details, see the documentation for
-<a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>.
-</li>
-
-<li>
-There is a new method to cancel a <a href="/pkg/net/http/"><code>net/http</code></a>
-<code>Request</code> by setting the new
-<a href="/pkg/net/http/#Request"><code>Request.Cancel</code></a>
-field.
-It is supported by <code>http.Transport</code>.
-The <code>Cancel</code> field's type is compatible with the
-<a href="https://godoc.org/golang.org/x/net/context"><code>context.Context.Done</code></a>
-return value.
-</li>
-
-<li>
-Also in the <a href="/pkg/net/http/"><code>net/http</code></a> package,
-there is code to ignore the zero <a href="/pkg/time/#Time"><code>Time</code></a> value
-in the <a href="/pkg/net/#ServeContent"><code>ServeContent</code></a> function.
-As of Go 1.5, it now also ignores a time value equal to the Unix epoch.
-</li>
-
-<li>
-The <a href="/pkg/net/http/fcgi/"><code>net/http/fcgi</code></a> package
-exports two new errors,
-<a href="/pkg/net/http/fcgi/#ErrConnClosed"><code>ErrConnClosed</code></a> and
-<a href="/pkg/net/http/fcgi/#ErrRequestAborted"><code>ErrRequestAborted</code></a>,
-to report the corresponding error conditions.
-</li>
-
-<li>
-The <a href="/pkg/net/http/cgi/"><code>net/http/cgi</code></a> package
-had a bug that mishandled the values of the environment variables
-<code>REMOTE_ADDR</code> and <code>REMOTE_HOST</code>.
-This has been fixed.
-Also, starting with Go 1.5 the package sets the <code>REMOTE_PORT</code>
-variable.
-</li>
-
-<li>
-The <a href="/pkg/net/mail/"><code>net/mail</code></a> package
-adds an <a href="/pkg/net/mail/#AddressParser"><code>AddressParser</code></a>
-type that can parse mail addresses.
-</li>
-
-<li>
-The <a href="/pkg/net/smtp/"><code>net/smtp</code></a> package
-now has a <a href="/pkg/net/smtp/#Client.TLSConnectionState"><code>TLSConnectionState</code></a>
-accessor to the <a href="/pkg/net/smtp/#Client"><code>Client</code></a>
-type that returns the client's TLS state.
-</li>
-
-<li>
-The <a href="/pkg/os/"><code>os</code></a> package
-has a new <a href="/pkg/os/#LookupEnv"><code>LookupEnv</code></a> function
-that is similar to <a href="/pkg/os/#Getenv"><code>Getenv</code></a>
-but can distinguish between an empty environment variable and a missing one.
-</li>
-
-<li>
-The <a href="/pkg/os/signal/"><code>os/signal</code></a> package
-adds new <a href="/pkg/os/signal/#Ignore"><code>Ignore</code></a> and
-<a href="/pkg/os/signal/#Reset"><code>Reset</code></a> functions.
-</li>
-
-<li>
-The <a href="/pkg/runtime/"><code>runtime</code></a>,
-<a href="/pkg/runtime/trace/"><code>runtime/trace</code></a>,
-and <a href="/pkg/net/http/pprof/"><code>net/http/pprof</code></a> packages
-each have new functions to support the tracing facilities described above:
-<a href="/pkg/runtime/#ReadTrace"><code>ReadTrace</code></a>,
-<a href="/pkg/runtime/#StartTrace"><code>StartTrace</code></a>,
-<a href="/pkg/runtime/#StopTrace"><code>StopTrace</code></a>,
-<a href="/pkg/runtime/trace/#Start"><code>Start</code></a>,
-<a href="/pkg/runtime/trace/#Stop"><code>Stop</code></a>, and
-<a href="/pkg/net/http/pprof/#Trace"><code>Trace</code></a>.
-See the respective documentation for details.
-</li>
-
-<li>
-The <a href="/pkg/runtime/pprof/"><code>runtime/pprof</code></a> package
-by default now includes overall memory statistics in all memory profiles.
-</li>
-
-<li>
-The <a href="/pkg/strings/"><code>strings</code></a> package
-has a new <a href="/pkg/strings/#Compare"><code>Compare</code></a> function.
-This is present to provide symmetry with the <a href="/pkg/bytes/"><code>bytes</code></a> package
-but is otherwise unnecessary as strings support comparison natively.
-</li>
-
-<li>
-The <a href="/pkg/sync/#WaitGroup"><code>WaitGroup</code></a> implementation in
-package <a href="/pkg/sync/"><code>sync</code></a>
-now diagnoses code that races a call to <a href="/pkg/sync/#WaitGroup.Add"><code>Add</code></a>
-against a return from <a href="/pkg/sync/#WaitGroup.Wait"><code>Wait</code></a>.
-If it detects this condition, the implementation panics.
-</li>
-
-<li>
-In the <a href="/pkg/syscall/"><code>syscall</code></a> package,
-the Linux <code>SysProcAttr</code> struct now has a
-<code>GidMappingsEnableSetgroups</code> field, made necessary
-by security changes in Linux 3.19.
-On all Unix systems, the struct also has new <code>Foreground</code> and <code>Pgid</code> fields
-to provide more control when exec'ing.
-On Darwin, there is now a <code>Syscall9</code> function
-to support calls with too many arguments.
-</li>
-
-<li>
-The <a href="/pkg/testing/quick/"><code>testing/quick</code></a> will now
-generate <code>nil</code> values for pointer types,
-making it possible to use with recursive data structures.
-Also, the package now supports generation of array types.
-</li>
-
-<li>
-In the <a href="/pkg/text/template/"><code>text/template</code></a> and
-<a href="/pkg/html/template/"><code>html/template</code></a> packages,
-integer constants too large to be represented as a Go integer now trigger a
-parse error. Before, they were silently converted to floating point, losing
-precision.
-</li>
-
-<li>
-Also in the <a href="/pkg/text/template/"><code>text/template</code></a> and
-<a href="/pkg/html/template/"><code>html/template</code></a> packages,
-a new <a href="/pkg/text/template/#Template.Option"><code>Option</code></a> method
-allows customization of the behavior of the template during execution.
-The sole implemented option allows control over how a missing key is
-handled when indexing a map.
-The default, which can now be overridden, is as before: to continue with an invalid value.
-</li>
-
-<li>
-The <a href="/pkg/time/"><code>time</code></a> package's
-<code>Time</code> type has a new method
-<a href="/pkg/time/#Time.AppendFormat"><code>AppendFormat</code></a>,
-which can be used to avoid allocation when printing a time value.
-</li>
-
-<li>
-The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
-support throughout the system has been upgraded from version 7.0 to
-<a href="http://www.unicode.org/versions/Unicode8.0.0/">Unicode 8.0</a>.
-</li>
-
-</ul>
diff --git a/doc/go1.6.html b/doc/go1.6.html
deleted file mode 100644
index c8ec7e7991..0000000000
--- a/doc/go1.6.html
+++ /dev/null
@@ -1,923 +0,0 @@
-<!--{
- "Title": "Go 1.6 Release Notes",
- "Path": "/doc/go1.6",
- "Template": true
-}-->
-
-<!--
-Edit .,s;^PKG:([a-z][A-Za-z0-9_/]+);<a href="/pkg/\1/"><code>\1</code></a>;g
-Edit .,s;^([a-z][A-Za-z0-9_/]+)\.([A-Z][A-Za-z0-9_]+\.)?([A-Z][A-Za-z0-9_]+)([ .',]|$);<a href="/pkg/\1/#\2\3"><code>\3</code></a>\4;g
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.6</h2>
-
-<p>
-The latest Go release, version 1.6, arrives six months after 1.5.
-Most of its changes are in the implementation of the language, runtime, and libraries.
-There are no changes to the language specification.
-As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
-We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
-The release adds new ports to <a href="#ports">Linux on 64-bit MIPS and Android on 32-bit x86</a>;
-defined and enforced <a href="#cgo">rules for sharing Go pointers with C</a>;
-transparent, automatic <a href="#http2">support for HTTP/2</a>;
-and a new mechanism for <a href="#template">template reuse</a>.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
-There are no language changes in this release.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p>
-Go 1.6 adds experimental ports to
-Linux on 64-bit MIPS (<code>linux/mips64</code> and <code>linux/mips64le</code>).
-These ports support <code>cgo</code> but only with internal linking.
-</p>
-
-<p>
-Go 1.6 also adds an experimental port to Android on 32-bit x86 (<code>android/386</code>).
-</p>
-
-<p>
-On FreeBSD, Go 1.6 defaults to using <code>clang</code>, not <code>gcc</code>, as the external C compiler.
-</p>
-
-<p>
-On Linux on little-endian 64-bit PowerPC (<code>linux/ppc64le</code>),
-Go 1.6 now supports <code>cgo</code> with external linking and
-is roughly feature complete.
-</p>
-
-<p>
-On NaCl, Go 1.5 required SDK version pepper-41.
-Go 1.6 adds support for later SDK versions.
-</p>
-
-<p>
-On 32-bit x86 systems using the <code>-dynlink</code> or <code>-shared</code> compilation modes,
-the register CX is now overwritten by certain memory references and should
-be avoided in hand-written assembly.
-See the <a href="/doc/asm#x86">assembly documentation</a> for details.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="cgo">Cgo</h3>
-
-<p>
-There is one major change to <a href="/cmd/cgo/"><code>cgo</code></a>, along with one minor change.
-</p>
-
-<p>
-The major change is the definition of rules for sharing Go pointers with C code,
-to ensure that such C code can coexist with Go's garbage collector.
-Briefly, Go and C may share memory allocated by Go
-when a pointer to that memory is passed to C as part of a <code>cgo</code> call,
-provided that the memory itself contains no pointers to Go-allocated memory,
-and provided that C does not retain the pointer after the call returns.
-These rules are checked by the runtime during program execution:
-if the runtime detects a violation, it prints a diagnosis and crashes the program.
-The checks can be disabled by setting the environment variable
-<code>GODEBUG=cgocheck=0</code>, but note that the vast majority of
-code identified by the checks is subtly incompatible with garbage collection
-in one way or another.
-Disabling the checks will typically only lead to more mysterious failure modes.
-Fixing the code in question should be strongly preferred
-over turning off the checks.
-See the <a href="/cmd/cgo/#hdr-Passing_pointers"><code>cgo</code> documentation</a> for more details.
-</p>
-
-<p>
-The minor change is
-the addition of explicit <code>C.complexfloat</code> and <code>C.complexdouble</code> types,
-separate from Go's <code>complex64</code> and <code>complex128</code>.
-Matching the other numeric types, C's complex types and Go's complex type are
-no longer interchangeable.
-</p>
-
-<h3 id="compiler">Compiler Toolchain</h3>
-
-<p>
-The compiler toolchain is mostly unchanged.
-Internally, the most significant change is that the parser is now hand-written
-instead of generated from <a href="/cmd/yacc/">yacc</a>.
-</p>
-
-<p>
-The compiler, linker, and <code>go</code> command have a new flag <code>-msan</code>,
-analogous to <code>-race</code> and only available on linux/amd64,
-that enables interoperation with the <a href="https://clang.llvm.org/docs/MemorySanitizer.html">Clang MemorySanitizer</a>.
-Such interoperation is useful mainly for testing a program containing suspect C or C++ code.
-</p>
-
-<p>
-The linker has a new option <code>-libgcc</code> to set the expected location
-of the C compiler support library when linking <a href="/cmd/cgo/"><code>cgo</code></a> code.
-The option is only consulted when using <code>-linkmode=internal</code>,
-and it may be set to <code>none</code> to disable the use of a support library.
-</p>
-
-<p>
-The implementation of <a href="/doc/go1.5#link">build modes started in Go 1.5</a> has been expanded to more systems.
-This release adds support for the <code>c-shared</code> mode on <code>android/386</code>, <code>android/amd64</code>,
-<code>android/arm64</code>, <code>linux/386</code>, and <code>linux/arm64</code>;
-for the <code>shared</code> mode on <code>linux/386</code>, <code>linux/arm</code>, <code>linux/amd64</code>, and <code>linux/ppc64le</code>;
-and for the new <code>pie</code> mode (generating position-independent executables) on
-<code>android/386</code>, <code>android/amd64</code>, <code>android/arm</code>, <code>android/arm64</code>, <code>linux/386</code>,
-<code>linux/amd64</code>, <code>linux/arm</code>, <code>linux/arm64</code>, and <code>linux/ppc64le</code>.
-See the <a href="https://golang.org/s/execmodes">design document</a> for details.
-</p>
-
-<p>
-As a reminder, the linker's <code>-X</code> flag changed in Go 1.5.
-In Go 1.4 and earlier, it took two arguments, as in
-</p>
-
-<pre>
--X importpath.name value
-</pre>
-
-<p>
-Go 1.5 added an alternative syntax using a single argument
-that is itself a <code>name=value</code> pair:
-</p>
-
-<pre>
--X importpath.name=value
-</pre>
-
-<p>
-In Go 1.5 the old syntax was still accepted, after printing a warning
-suggesting use of the new syntax instead.
-Go 1.6 continues to accept the old syntax and print the warning.
-Go 1.7 will remove support for the old syntax.
-</p>
-
-<h3 id="gccgo">Gccgo</h3>
-
-<p>
-The release schedules for the GCC and Go projects do not coincide.
-GCC release 5 contains the Go 1.4 version of gccgo.
-The next release, GCC 6, will have the Go 1.6.1 version of gccgo.
-</p>
-
-<h3 id="go_command">Go command</h3>
-
-<p>
-The <a href="/cmd/go"><code>go</code></a> command's basic operation
-is unchanged, but there are a number of changes worth noting.
-</p>
-
-<p>
-Go 1.5 introduced experimental support for vendoring,
-enabled by setting the <code>GO15VENDOREXPERIMENT</code> environment variable to <code>1</code>.
-Go 1.6 keeps the vendoring support, no longer considered experimental,
-and enables it by default.
-It can be disabled explicitly by setting
-the <code>GO15VENDOREXPERIMENT</code> environment variable to <code>0</code>.
-Go 1.7 will remove support for the environment variable.
-</p>
-
-<p>
-The most likely problem caused by enabling vendoring by default happens
-in source trees containing an existing directory named <code>vendor</code> that
-does not expect to be interpreted according to new vendoring semantics.
-In this case, the simplest fix is to rename the directory to anything other
-than <code>vendor</code> and update any affected import paths.
-</p>
-
-<p>
-For details about vendoring,
-see the documentation for the <a href="/cmd/go/#hdr-Vendor_Directories"><code>go</code> command</a>
-and the <a href="https://golang.org/s/go15vendor">design document</a>.
-</p>
-
-<p>
-There is a new build flag, <code>-msan</code>,
-that compiles Go with support for the LLVM memory sanitizer.
-This is intended mainly for use when linking against C or C++ code
-that is being checked with the memory sanitizer.
-</p>
-
-<h3 id="doc_command">Go doc command</h3>
-
-<p>
-Go 1.5 introduced the
-<a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol"><code>go doc</code></a> command,
-which allows references to packages using only the package name, as in
-<code>go</code> <code>doc</code> <code>http</code>.
-In the event of ambiguity, the Go 1.5 behavior was to use the package
-with the lexicographically earliest import path.
-In Go 1.6, ambiguity is resolved by preferring import paths with
-fewer elements, breaking ties using lexicographic comparison.
-An important effect of this change is that original copies of packages
-are now preferred over vendored copies.
-Successful searches also tend to run faster.
-</p>
-
-<h3 id="vet_command">Go vet command</h3>
-
-<p>
-The <a href="/cmd/vet"><code>go vet</code></a> command now diagnoses
-passing function or method values as arguments to <code>Printf</code>,
-such as when passing <code>f</code> where <code>f()</code> was intended.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-As always, the changes are so general and varied that precise statements
-about performance are difficult to make.
-Some programs may run faster, some slower.
-On average the programs in the Go 1 benchmark suite run a few percent faster in Go 1.6
-than they did in Go 1.5.
-The garbage collector's pauses are even lower than in Go 1.5,
-especially for programs using
-a large amount of memory.
-</p>
-
-<p>
-There have been significant optimizations bringing more than 10% improvements
-to implementations of the
-<a href="/pkg/compress/bzip2/"><code>compress/bzip2</code></a>,
-<a href="/pkg/compress/gzip/"><code>compress/gzip</code></a>,
-<a href="/pkg/crypto/aes/"><code>crypto/aes</code></a>,
-<a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a>,
-<a href="/pkg/crypto/ecdsa/"><code>crypto/ecdsa</code></a>, and
-<a href="/pkg/sort/"><code>sort</code></a> packages.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="http2">HTTP/2</h3>
-
-<p>
-Go 1.6 adds transparent support in the
-<a href="/pkg/net/http/"><code>net/http</code></a> package
-for the new <a href="https://http2.github.io/">HTTP/2 protocol</a>.
-Go clients and servers will automatically use HTTP/2 as appropriate when using HTTPS.
-There is no exported API specific to details of the HTTP/2 protocol handling,
-just as there is no exported API specific to HTTP/1.1.
-</p>
-
-<p>
-Programs that must disable HTTP/2 can do so by setting
-<a href="/pkg/net/http/#Transport"><code>Transport.TLSNextProto</code></a> (for clients)
-or
-<a href="/pkg/net/http/#Server"><code>Server.TLSNextProto</code></a> (for servers)
-to a non-nil, empty map.
-</p>
-
-<p>
-Programs that must adjust HTTP/2 protocol-specific details can import and use
-<a href="https://golang.org/x/net/http2"><code>golang.org/x/net/http2</code></a>,
-in particular its
-<a href="https://godoc.org/golang.org/x/net/http2/#ConfigureServer">ConfigureServer</a>
-and
-<a href="https://godoc.org/golang.org/x/net/http2/#ConfigureTransport">ConfigureTransport</a>
-functions.
-</p>
-
-<h3 id="runtime">Runtime</h3>
-
-<p>
-The runtime has added lightweight, best-effort detection of concurrent misuse of maps.
-As always, if one goroutine is writing to a map, no other goroutine should be
-reading or writing the map concurrently.
-If the runtime detects this condition, it prints a diagnosis and crashes the program.
-The best way to find out more about the problem is to run the program
-under the
-<a href="https://blog.golang.org/race-detector">race detector</a>,
-which will more reliably identify the race
-and give more detail.
-</p>
-
-<p>
-For program-ending panics, the runtime now by default
-prints only the stack of the running goroutine,
-not all existing goroutines.
-Usually only the current goroutine is relevant to a panic,
-so omitting the others significantly reduces irrelevant output
-in a crash message.
-To see the stacks from all goroutines in crash messages, set the environment variable
-<code>GOTRACEBACK</code> to <code>all</code>
-or call
-<a href="/pkg/runtime/debug/#SetTraceback"><code>debug.SetTraceback</code></a>
-before the crash, and rerun the program.
-See the <a href="/pkg/runtime/#hdr-Environment_Variables">runtime documentation</a> for details.
-</p>
-
-<p>
-<em>Updating</em>:
-Uncaught panics intended to dump the state of the entire program,
-such as when a timeout is detected or when explicitly handling a received signal,
-should now call <code>debug.SetTraceback("all")</code> before panicking.
-Searching for uses of
-<a href="/pkg/os/signal/#Notify"><code>signal.Notify</code></a> may help identify such code.
-</p>
-
-<p>
-On Windows, Go programs in Go 1.5 and earlier forced
-the global Windows timer resolution to 1ms at startup
-by calling <code>timeBeginPeriod(1)</code>.
-Go no longer needs this for good scheduler performance,
-and changing the global timer resolution caused problems on some systems,
-so the call has been removed.
-</p>
-
-<p>
-When using <code>-buildmode=c-archive</code> or
-<code>-buildmode=c-shared</code> to build an archive or a shared
-library, the handling of signals has changed.
-In Go 1.5 the archive or shared library would install a signal handler
-for most signals.
-In Go 1.6 it will only install a signal handler for the
-synchronous signals needed to handle run-time panics in Go code:
-SIGBUS, SIGFPE, SIGSEGV.
-See the <a href="/pkg/os/signal">os/signal</a> package for more
-details.
-</p>
-
-<h3 id="reflect">Reflect</h3>
-
-<p>
-The
-<a href="/pkg/reflect/"><code>reflect</code></a> package has
-<a href="https://golang.org/issue/12367">resolved a long-standing incompatibility</a>
-between the gc and gccgo toolchains
-regarding embedded unexported struct types containing exported fields.
-Code that walks data structures using reflection, especially to implement
-serialization in the spirit
-of the
-<a href="/pkg/encoding/json/"><code>encoding/json</code></a> and
-<a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> packages,
-may need to be updated.
-</p>
-
-<p>
-The problem arises when using reflection to walk through
-an embedded unexported struct-typed field
-into an exported field of that struct.
-In this case, <code>reflect</code> had incorrectly reported
-the embedded field as exported, by returning an empty <code>Field.PkgPath</code>.
-Now it correctly reports the field as unexported
-but ignores that fact when evaluating access to exported fields
-contained within the struct.
-</p>
-
-<p>
-<em>Updating</em>:
-Typically, code that previously walked over structs and used
-</p>
-
-<pre>
-f.PkgPath != ""
-</pre>
-
-<p>
-to exclude inaccessible fields
-should now use
-</p>
-
-<pre>
-f.PkgPath != "" &amp;&amp; !f.Anonymous
-</pre>
-
-<p>
-For example, see the changes to the implementations of
-<a href="https://go-review.googlesource.com/#/c/14011/2/src/encoding/json/encode.go"><code>encoding/json</code></a> and
-<a href="https://go-review.googlesource.com/#/c/14012/2/src/encoding/xml/typeinfo.go"><code>encoding/xml</code></a>.
-</p>
-
-<h3 id="sort">Sorting</h3>
-
-<p>
-In the
-<a href="/pkg/sort/"><code>sort</code></a>
-package,
-the implementation of
-<a href="/pkg/sort/#Sort"><code>Sort</code></a>
-has been rewritten to make about 10% fewer calls to the
-<a href="/pkg/sort/#Interface"><code>Interface</code></a>'s
-<code>Less</code> and <code>Swap</code>
-methods, with a corresponding overall time savings.
-The new algorithm does choose a different ordering than before
-for values that compare equal (those pairs for which <code>Less(i,</code> <code>j)</code> and <code>Less(j,</code> <code>i)</code> are false).
-</p>
-
-<p>
-<em>Updating</em>:
-The definition of <code>Sort</code> makes no guarantee about the final order of equal values,
-but the new behavior may still break programs that expect a specific order.
-Such programs should either refine their <code>Less</code> implementations
-to report the desired order
-or should switch to
-<a href="/pkg/sort/#Stable"><code>Stable</code></a>,
-which preserves the original input order
-of equal values.
-</p>
-
-<h3 id="template">Templates</h3>
-
-<p>
-In the
-<a href="/pkg/text/template/">text/template</a> package,
-there are two significant new features to make writing templates easier.
-</p>
-
-<p>
-First, it is now possible to <a href="/pkg/text/template/#hdr-Text_and_spaces">trim spaces around template actions</a>,
-which can make template definitions more readable.
-A minus sign at the beginning of an action says to trim space before the action,
-and a minus sign at the end of an action says to trim space after the action.
-For example, the template
-</p>
-
-<pre>
-{{"{{"}}23 -}}
- &lt;
-{{"{{"}}- 45}}
-</pre>
-
-<p>
-formats as <code>23&lt;45</code>.
-</p>
-
-<p>
-Second, the new <a href="/pkg/text/template/#hdr-Actions"><code>{{"{{"}}block}}</code> action</a>,
-combined with allowing redefinition of named templates,
-provides a simple way to define pieces of a template that
-can be replaced in different instantiations.
-There is <a href="/pkg/text/template/#example_Template_block">an example</a>
-in the <code>text/template</code> package that demonstrates this new feature.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<ul>
-
-<li>
-The <a href="/pkg/archive/tar/"><code>archive/tar</code></a> package's
-implementation corrects many bugs in rare corner cases of the file format.
-One visible change is that the
-<a href="/pkg/archive/tar/#Reader"><code>Reader</code></a> type's
-<a href="/pkg/archive/tar/#Reader.Read"><code>Read</code></a> method
-now presents the content of special file types as being empty,
-returning <code>io.EOF</code> immediately.
-</li>
-
-<li>
-In the <a href="/pkg/archive/zip/"><code>archive/zip</code></a> package, the
-<a href="/pkg/archive/zip/#Reader"><code>Reader</code></a> type now has a
-<a href="/pkg/archive/zip/#Reader.RegisterDecompressor"><code>RegisterDecompressor</code></a> method,
-and the
-<a href="/pkg/archive/zip/#Writer"><code>Writer</code></a> type now has a
-<a href="/pkg/archive/zip/#Writer.RegisterCompressor"><code>RegisterCompressor</code></a> method,
-enabling control over compression options for individual zip files.
-These take precedence over the pre-existing global
-<a href="/pkg/archive/zip/#RegisterDecompressor"><code>RegisterDecompressor</code></a> and
-<a href="/pkg/archive/zip/#RegisterCompressor"><code>RegisterCompressor</code></a> functions.
-</li>
-
-<li>
-The <a href="/pkg/bufio/"><code>bufio</code></a> package's
-<a href="/pkg/bufio/#Scanner"><code>Scanner</code></a> type now has a
-<a href="/pkg/bufio/#Scanner.Buffer"><code>Buffer</code></a> method,
-to specify an initial buffer and maximum buffer size to use during scanning.
-This makes it possible, when needed, to scan tokens larger than
-<code>MaxScanTokenSize</code>.
-Also for the <code>Scanner</code>, the package now defines the
-<a href="/pkg/bufio/#ErrFinalToken"><code>ErrFinalToken</code></a> error value, for use by
-<a href="/pkg/bufio/#SplitFunc">split functions</a> to abort processing or to return a final empty token.
-</li>
-
-<li>
-The <a href="/pkg/compress/flate/"><code>compress/flate</code></a> package
-has deprecated its
-<a href="/pkg/compress/flate/#ReadError"><code>ReadError</code></a> and
-<a href="/pkg/compress/flate/#WriteError"><code>WriteError</code></a> error implementations.
-In Go 1.5 they were only rarely returned when an error was encountered;
-now they are never returned, although they remain defined for compatibility.
-</li>
-
-<li>
-The <a href="/pkg/compress/flate/"><code>compress/flate</code></a>,
-<a href="/pkg/compress/gzip/"><code>compress/gzip</code></a>, and
-<a href="/pkg/compress/zlib/"><code>compress/zlib</code></a> packages
-now report
-<a href="/pkg/io/#ErrUnexpectedEOF"><code>io.ErrUnexpectedEOF</code></a> for truncated input streams, instead of
-<a href="/pkg/io/#EOF"><code>io.EOF</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a> package now
-overwrites the destination buffer in the event of a GCM decryption failure.
-This is to allow the AESNI code to avoid using a temporary buffer.
-</li>
-
-<li>
-The <a href="/pkg/crypto/tls/"><code>crypto/tls</code></a> package
-has a variety of minor changes.
-It now allows
-<a href="/pkg/crypto/tls/#Listen"><code>Listen</code></a>
-to succeed when the
-<a href="/pkg/crypto/tls/#Config"><code>Config</code></a>
-has a nil <code>Certificates</code>, as long as the <code>GetCertificate</code> callback is set,
-it adds support for RSA with AES-GCM cipher suites,
-and
-it adds a
-<a href="/pkg/crypto/tls/#RecordHeaderError"><code>RecordHeaderError</code></a>
-to allow clients (in particular, the <a href="/pkg/net/http/"><code>net/http</code></a> package)
-to report a better error when attempting a TLS connection to a non-TLS server.
-</li>
-
-<li>
-The <a href="/pkg/crypto/x509/"><code>crypto/x509</code></a> package
-now permits certificates to contain negative serial numbers
-(technically an error, but unfortunately common in practice),
-and it defines a new
-<a href="/pkg/crypto/x509/#InsecureAlgorithmError"><code>InsecureAlgorithmError</code></a>
-to give a better error message when rejecting a certificate
-signed with an insecure algorithm like MD5.
-</li>
-
-<li>
-The <a href="/pkg/debug/dwarf"><code>debug/dwarf</code></a> and
-<a href="/pkg/debug/elf/"><code>debug/elf</code></a> packages
-together add support for compressed DWARF sections.
-User code needs no updating: the sections are decompressed automatically when read.
-</li>
-
-<li>
-The <a href="/pkg/debug/elf/"><code>debug/elf</code></a> package
-adds support for general compressed ELF sections.
-User code needs no updating: the sections are decompressed automatically when read.
-However, compressed
-<a href="/pkg/debug/elf/#Section"><code>Sections</code></a> do not support random access:
-they have a nil <code>ReaderAt</code> field.
-</li>
-
-<li>
-The <a href="/pkg/encoding/asn1/"><code>encoding/asn1</code></a> package
-now exports
-<a href="/pkg/encoding/asn1/#pkg-constants">tag and class constants</a>
-useful for advanced parsing of ASN.1 structures.
-</li>
-
-<li>
-Also in the <a href="/pkg/encoding/asn1/"><code>encoding/asn1</code></a> package,
-<a href="/pkg/encoding/asn1/#Unmarshal"><code>Unmarshal</code></a> now rejects various non-standard integer and length encodings.
-</li>
-
-<li>
-The <a href="/pkg/encoding/base64"><code>encoding/base64</code></a> package's
-<a href="/pkg/encoding/base64/#Decoder"><code>Decoder</code></a> has been fixed
-to process the final bytes of its input. Previously it processed as many four-byte tokens as
-possible but ignored the remainder, up to three bytes.
-The <code>Decoder</code> therefore now handles inputs in unpadded encodings (like
-<a href="/pkg/encoding/base64/#RawURLEncoding">RawURLEncoding</a>) correctly,
-but it also rejects inputs in padded encodings that are truncated or end with invalid bytes,
-such as trailing spaces.
-</li>
-
-<li>
-The <a href="/pkg/encoding/json/"><code>encoding/json</code></a> package
-now checks the syntax of a
-<a href="/pkg/encoding/json/#Number"><code>Number</code></a>
-before marshaling it, requiring that it conforms to the JSON specification for numeric values.
-As in previous releases, the zero <code>Number</code> (an empty string) is marshaled as a literal 0 (zero).
-</li>
-
-<li>
-The <a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> package's
-<a href="/pkg/encoding/xml/#Marshal"><code>Marshal</code></a>
-function now supports a <code>cdata</code> attribute, such as <code>chardata</code>
-but encoding its argument in one or more <code>&lt;![CDATA[ ... ]]&gt;</code> tags.
-</li>
-
-<li>
-Also in the <a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> package,
-<a href="/pkg/encoding/xml/#Decoder"><code>Decoder</code></a>'s
-<a href="/pkg/encoding/xml/#Decoder.Token"><code>Token</code></a> method
-now reports an error when encountering EOF before seeing all open tags closed,
-consistent with its general requirement that tags in the input be properly matched.
-To avoid that requirement, use
-<a href="/pkg/encoding/xml/#Decoder.RawToken"><code>RawToken</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/fmt/"><code>fmt</code></a> package now allows
-any integer type as an argument to
-<a href="/pkg/fmt/#Printf"><code>Printf</code></a>'s <code>*</code> width and precision specification.
-In previous releases, the argument to <code>*</code> was required to have type <code>int</code>.
-</li>
-
-<li>
-Also in the <a href="/pkg/fmt/"><code>fmt</code></a> package,
-<a href="/pkg/fmt/#Scanf"><code>Scanf</code></a> can now scan hexadecimal strings using %X, as an alias for %x.
-Both formats accept any mix of upper- and lower-case hexadecimal.
-</li>
-
-<li>
-The <a href="/pkg/image/"><code>image</code></a>
-and
-<a href="/pkg/image/color/"><code>image/color</code></a> packages
-add
-<a href="/pkg/image/#NYCbCrA"><code>NYCbCrA</code></a>
-and
-<a href="/pkg/image/color/#NYCbCrA"><code>NYCbCrA</code></a>
-types, to support Y'CbCr images with non-premultiplied alpha.
-</li>
-
-<li>
-The <a href="/pkg/io/"><code>io</code></a> package's
-<a href="/pkg/io/#MultiWriter"><code>MultiWriter</code></a>
-implementation now implements a <code>WriteString</code> method,
-for use by
-<a href="/pkg/io/#WriteString"><code>WriteString</code></a>.
-</li>
-
-<li>
-In the <a href="/pkg/math/big/"><code>math/big</code></a> package,
-<a href="/pkg/math/big/#Int"><code>Int</code></a> adds
-<a href="/pkg/math/big/#Int.Append"><code>Append</code></a>
-and
-<a href="/pkg/math/big/#Int.Text"><code>Text</code></a>
-methods to give more control over printing.
-</li>
-
-<li>
-Also in the <a href="/pkg/math/big/"><code>math/big</code></a> package,
-<a href="/pkg/math/big/#Float"><code>Float</code></a> now implements
-<a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a> and
-<a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>,
-allowing it to be serialized in a natural form by the
-<a href="/pkg/encoding/json/"><code>encoding/json</code></a> and
-<a href="/pkg/encoding/xml/"><code>encoding/xml</code></a> packages.
-</li>
-
-<li>
-Also in the <a href="/pkg/math/big/"><code>math/big</code></a> package,
-<a href="/pkg/math/big/#Float"><code>Float</code></a>'s
-<a href="/pkg/math/big/#Float.Append"><code>Append</code></a> method now supports the special precision argument -1.
-As in
-<a href="/pkg/strconv/#ParseFloat"><code>strconv.ParseFloat</code></a>,
-precision -1 means to use the smallest number of digits necessary such that
-<a href="/pkg/math/big/#Float.Parse"><code>Parse</code></a>
-reading the result into a <code>Float</code> of the same precision
-will yield the original value.
-</li>
-
-<li>
-The <a href="/pkg/math/rand/"><code>math/rand</code></a> package
-adds a
-<a href="/pkg/math/rand/#Read"><code>Read</code></a>
-function, and likewise
-<a href="/pkg/math/rand/#Rand"><code>Rand</code></a> adds a
-<a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> method.
-These make it easier to generate pseudorandom test data.
-Note that, like the rest of the package,
-these should not be used in cryptographic settings;
-for such purposes, use the <a href="/pkg/crypto/rand/"><code>crypto/rand</code></a> package instead.
-</li>
-
-<li>
-The <a href="/pkg/net/"><code>net</code></a> package's
-<a href="/pkg/net/#ParseMAC"><code>ParseMAC</code></a> function now accepts 20-byte IP-over-InfiniBand (IPoIB) link-layer addresses.
-</li>
-
-
-<li>
-Also in the <a href="/pkg/net/"><code>net</code></a> package,
-there have been a few changes to DNS lookups.
-First, the
-<a href="/pkg/net/#DNSError"><code>DNSError</code></a> error implementation now implements
-<a href="/pkg/net/#Error"><code>Error</code></a>,
-and in particular its new
-<a href="/pkg/net/#DNSError.IsTemporary"><code>IsTemporary</code></a>
-method returns true for DNS server errors.
-Second, DNS lookup functions such as
-<a href="/pkg/net/#LookupAddr"><code>LookupAddr</code></a>
-now return rooted domain names (with a trailing dot)
-on Plan 9 and Windows, to match the behavior of Go on Unix systems.
-</li>
-
-<li>
-The <a href="/pkg/net/http/"><code>net/http</code></a> package has
-a number of minor additions beyond the HTTP/2 support already discussed.
-First, the
-<a href="/pkg/net/http/#FileServer"><code>FileServer</code></a> now sorts its generated directory listings by file name.
-Second, the
-<a href="/pkg/net/http/#ServeFile"><code>ServeFile</code></a> function now refuses to serve a result
-if the request's URL path contains &ldquo;..&rdquo; (dot-dot) as a path element.
-Programs should typically use <code>FileServer</code> and
-<a href="/pkg/net/http/#Dir"><code>Dir</code></a>
-instead of calling <code>ServeFile</code> directly.
-Programs that need to serve file content in response to requests for URLs containing dot-dot can
-still call <a href="/pkg/net/http/#ServeContent"><code>ServeContent</code></a>.
-Third, the
-<a href="/pkg/net/http/#Client"><code>Client</code></a> now allows user code to set the
-<code>Expect:</code> <code>100-continue</code> header (see
-<a href="/pkg/net/http/#Transport"><code>Transport.ExpectContinueTimeout</code></a>).
-Fourth, there are
-<a href="/pkg/net/http/#pkg-constants">five new error codes</a>:
-<code>StatusPreconditionRequired</code> (428),
-<code>StatusTooManyRequests</code> (429),
-<code>StatusRequestHeaderFieldsTooLarge</code> (431), and
-<code>StatusNetworkAuthenticationRequired</code> (511) from RFC 6585,
-as well as the recently-approved
-<code>StatusUnavailableForLegalReasons</code> (451).
-Fifth, the implementation and documentation of
-<a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a>
-has been substantially changed.
-The <a href="/pkg/net/http/#Hijacker"><code>Hijacker</code></a>
-interface now works correctly on connections that have previously
-been used with <code>CloseNotifier</code>.
-The documentation now describes when <code>CloseNotifier</code>
-is expected to work.
-</li>
-
-<li>
-Also in the <a href="/pkg/net/http/"><code>net/http</code></a> package,
-there are a few changes related to the handling of a
-<a href="/pkg/net/http/#Request"><code>Request</code></a> data structure with its <code>Method</code> field set to the empty string.
-An empty <code>Method</code> field has always been documented as an alias for <code>"GET"</code>
-and it remains so.
-However, Go 1.6 fixes a few routines that did not treat an empty
-<code>Method</code> the same as an explicit <code>"GET"</code>.
-Most notably, in previous releases
-<a href="/pkg/net/http/#Client"><code>Client</code></a> followed redirects only with
-<code>Method</code> set explicitly to <code>"GET"</code>;
-in Go 1.6 <code>Client</code> also follows redirects for the empty <code>Method</code>.
-Finally,
-<a href="/pkg/net/http/#NewRequest"><code>NewRequest</code></a> accepts a <code>method</code> argument that has not been
-documented as allowed to be empty.
-In past releases, passing an empty <code>method</code> argument resulted
-in a <code>Request</code> with an empty <code>Method</code> field.
-In Go 1.6, the resulting <code>Request</code> always has an initialized
-<code>Method</code> field: if its argument is an empty string, <code>NewRequest</code>
-sets the <code>Method</code> field in the returned <code>Request</code> to <code>"GET"</code>.
-</li>
-
-<li>
-The <a href="/pkg/net/http/httptest/"><code>net/http/httptest</code></a> package's
-<a href="/pkg/net/http/httptest/#ResponseRecorder"><code>ResponseRecorder</code></a> now initializes a default Content-Type header
-using the same content-sniffing algorithm as in
-<a href="/pkg/net/http/#Server"><code>http.Server</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/net/url/"><code>net/url</code></a> package's
-<a href="/pkg/net/url/#Parse"><code>Parse</code></a> is now stricter and more spec-compliant regarding the parsing
-of host names.
-For example, spaces in the host name are no longer accepted.
-</li>
-
-<li>
-Also in the <a href="/pkg/net/url/"><code>net/url</code></a> package,
-the <a href="/pkg/net/url/#Error"><code>Error</code></a> type now implements
-<a href="/pkg/net/#Error"><code>net.Error</code></a>.
-</li>
-
-<li>
-The <a href="/pkg/os/"><code>os</code></a> package's
-<a href="/pkg/os/#IsExist"><code>IsExist</code></a>,
-<a href="/pkg/os/#IsNotExist"><code>IsNotExist</code></a>,
-and
-<a href="/pkg/os/#IsPermission"><code>IsPermission</code></a>
-now return correct results when inquiring about an
-<a href="/pkg/os/#SyscallError"><code>SyscallError</code></a>.
-</li>
-
-<li>
-On Unix-like systems, when a write
-to <a href="/pkg/os/#pkg-variables"><code>os.Stdout</code>
-or <code>os.Stderr</code></a> (more precisely, an <code>os.File</code>
-opened for file descriptor 1 or 2) fails due to a broken pipe error,
-the program will raise a <code>SIGPIPE</code> signal.
-By default this will cause the program to exit; this may be changed by
-calling the
-<a href="/pkg/os/signal"><code>os/signal</code></a>
-<a href="/pkg/os/signal/#Notify"><code>Notify</code></a> function
-for <code>syscall.SIGPIPE</code>.
-A write to a broken pipe on a file descriptor other 1 or 2 will simply
-return <code>syscall.EPIPE</code> (possibly wrapped in
-<a href="/pkg/os#PathError"><code>os.PathError</code></a>
-and/or <a href="/pkg/os#SyscallError"><code>os.SyscallError</code></a>)
-to the caller.
-The old behavior of raising an uncatchable <code>SIGPIPE</code> signal
-after 10 consecutive writes to a broken pipe no longer occurs.
-</li>
-
-<li>
-In the <a href="/pkg/os/exec/"><code>os/exec</code></a> package,
-<a href="/pkg/os/exec/#Cmd"><code>Cmd</code></a>'s
-<a href="/pkg/os/exec/#Cmd.Output"><code>Output</code></a> method continues to return an
-<a href="/pkg/os/exec/#ExitError"><code>ExitError</code></a> when a command exits with an unsuccessful status.
-If standard error would otherwise have been discarded,
-the returned <code>ExitError</code> now holds a prefix and suffix
-(currently 32 kB) of the failed command's standard error output,
-for debugging or for inclusion in error messages.
-The <code>ExitError</code>'s
-<a href="/pkg/os/exec/#ExitError.String"><code>String</code></a>
-method does not show the captured standard error;
-programs must retrieve it from the data structure
-separately.
-</li>
-
-<li>
-On Windows, the <a href="/pkg/path/filepath/"><code>path/filepath</code></a> package's
-<a href="/pkg/path/filepath/#Join"><code>Join</code></a> function now correctly handles the case when the base is a relative drive path.
-For example, <code>Join(`c:`,</code> <code>`a`)</code> now
-returns <code>`c:a`</code> instead of <code>`c:\a`</code> as in past releases.
-This may affect code that expects the incorrect result.
-</li>
-
-<li>
-In the <a href="/pkg/regexp/"><code>regexp</code></a> package,
-the
-<a href="/pkg/regexp/#Regexp"><code>Regexp</code></a> type has always been safe for use by
-concurrent goroutines.
-It uses a <a href="/pkg/sync/#Mutex"><code>sync.Mutex</code></a> to protect
-a cache of scratch spaces used during regular expression searches.
-Some high-concurrency servers using the same <code>Regexp</code> from many goroutines
-have seen degraded performance due to contention on that mutex.
-To help such servers, <code>Regexp</code> now has a
-<a href="/pkg/regexp/#Regexp.Copy"><code>Copy</code></a> method,
-which makes a copy of a <code>Regexp</code> that shares most of the structure
-of the original but has its own scratch space cache.
-Two goroutines can use different copies of a <code>Regexp</code>
-without mutex contention.
-A copy does have additional space overhead, so <code>Copy</code>
-should only be used when contention has been observed.
-</li>
-
-<li>
-The <a href="/pkg/strconv/"><code>strconv</code></a> package adds
-<a href="/pkg/strconv/#IsGraphic"><code>IsGraphic</code></a>,
-similar to <a href="/pkg/strconv/#IsPrint"><code>IsPrint</code></a>.
-It also adds
-<a href="/pkg/strconv/#QuoteToGraphic"><code>QuoteToGraphic</code></a>,
-<a href="/pkg/strconv/#QuoteRuneToGraphic"><code>QuoteRuneToGraphic</code></a>,
-<a href="/pkg/strconv/#AppendQuoteToGraphic"><code>AppendQuoteToGraphic</code></a>,
-and
-<a href="/pkg/strconv/#AppendQuoteRuneToGraphic"><code>AppendQuoteRuneToGraphic</code></a>,
-analogous to
-<a href="/pkg/strconv/#QuoteToASCII"><code>QuoteToASCII</code></a>,
-<a href="/pkg/strconv/#QuoteRuneToASCII"><code>QuoteRuneToASCII</code></a>,
-and so on.
-The <code>ASCII</code> family escapes all space characters except ASCII space (U+0020).
-In contrast, the <code>Graphic</code> family does not escape any Unicode space characters (category Zs).
-</li>
-
-<li>
-In the <a href="/pkg/testing/"><code>testing</code></a> package,
-when a test calls
-<a href="/pkg/testing/#T.Parallel">t.Parallel</a>,
-that test is paused until all non-parallel tests complete, and then
-that test continues execution with all other parallel tests.
-Go 1.6 changes the time reported for such a test:
-previously the time counted only the parallel execution,
-but now it also counts the time from the start of testing
-until the call to <code>t.Parallel</code>.
-</li>
-
-<li>
-The <a href="/pkg/text/template/"><code>text/template</code></a> package
-contains two minor changes, in addition to the <a href="#template">major changes</a>
-described above.
-First, it adds a new
-<a href="/pkg/text/template/#ExecError"><code>ExecError</code></a> type
-returned for any error during
-<a href="/pkg/text/template/#Template.Execute"><code>Execute</code></a>
-that does not originate in a <code>Write</code> to the underlying writer.
-Callers can distinguish template usage errors from I/O errors by checking for
-<code>ExecError</code>.
-Second, the
-<a href="/pkg/text/template/#Template.Funcs"><code>Funcs</code></a> method
-now checks that the names used as keys in the
-<a href="/pkg/text/template/#FuncMap"><code>FuncMap</code></a>
-are identifiers that can appear in a template function invocation.
-If not, <code>Funcs</code> panics.
-</li>
-
-<li>
-The <a href="/pkg/time/"><code>time</code></a> package's
-<a href="/pkg/time/#Parse"><code>Parse</code></a> function has always rejected any day of month larger than 31,
-such as January 32.
-In Go 1.6, <code>Parse</code> now also rejects February 29 in non-leap years,
-February 30, February 31, April 31, June 31, September 31, and November 31.
-</li>
-
-</ul>
-
diff --git a/doc/go1.7.html b/doc/go1.7.html
deleted file mode 100644
index 61076fd091..0000000000
--- a/doc/go1.7.html
+++ /dev/null
@@ -1,1281 +0,0 @@
-<!--{
- "Title": "Go 1.7 Release Notes",
- "Path": "/doc/go1.7",
- "Template": true
-}-->
-
-<!--
-for acme:
-Edit .,s;^PKG:([a-z][A-Za-z0-9_/]+);<a href="/pkg/\1/"><code>\1</code></a>;g
-Edit .,s;^([a-z][A-Za-z0-9_/]+)\.([A-Z][A-Za-z0-9_]+\.)?([A-Z][A-Za-z0-9_]+)([ .',)]|$);<a href="/pkg/\1/#\2\3"><code>\3</code></a>\4;g
-Edit .,s;^FULL:([a-z][A-Za-z0-9_/]+)\.([A-Z][A-Za-z0-9_]+\.)?([A-Z][A-Za-z0-9_]+)([ .',)]|$);<a href="/pkg/\1/#\2\3"><code>\1.\2\3</code></a>\4;g
-Edit .,s;^DPKG:([a-z][A-Za-z0-9_/]+);<dl id="\1"><a href="/pkg/\1/">\1</a></dl>;g
-
-rsc last updated through 6729576
--->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.7</h2>
-
-<p>
-The latest Go release, version 1.7, arrives six months after 1.6.
-Most of its changes are in the implementation of the toolchain, runtime, and libraries.
-There is one minor change to the language specification.
-As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
-We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
-The release <a href="#ports">adds a port to IBM LinuxOne</a>;
-<a href="#compiler">updates the x86-64 compiler back end</a> to generate more efficient code;
-includes the <a href="#context">context package</a>, promoted from the
-<a href="https://golang.org/x/net/context">x/net subrepository</a>
-and now used in the standard library;
-and <a href="#testing">adds support in the testing package</a> for
-creating hierarchies of tests and benchmarks.
-The release also <a href="#cmd_go">finalizes the vendoring support</a>
-started in Go 1.5, making it a standard feature.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
-There is one tiny language change in this release.
-The section on <a href="/ref/spec#Terminating_statements">terminating statements</a>
-clarifies that to determine whether a statement list ends in a terminating statement,
-the “final non-empty statement” is considered the end,
-matching the existing behavior of the gc and gccgo compiler toolchains.
-In earlier releases the definition referred only to the “final statement,”
-leaving the effect of trailing empty statements at the least unclear.
-The <a href="/pkg/go/types/"><code>go/types</code></a>
-package has been updated to match the gc and gccgo compiler toolchains
-in this respect.
-This change has no effect on the correctness of existing programs.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p>
-Go 1.7 adds support for macOS 10.12 Sierra.
-Binaries built with versions of Go before 1.7 will not work
-correctly on Sierra.
-</p>
-
-<p>
-Go 1.7 adds an experimental port to <a href="https://en.wikipedia.org/wiki/Linux_on_z_Systems">Linux on z Systems</a> (<code>linux/s390x</code>)
-and the beginning of a port to Plan 9 on ARM (<code>plan9/arm</code>).
-</p>
-
-<p>
-The experimental ports to Linux on 64-bit MIPS (<code>linux/mips64</code> and <code>linux/mips64le</code>)
-added in Go 1.6 now have full support for cgo and external linking.
-</p>
-
-<p>
-The experimental port to Linux on little-endian 64-bit PowerPC (<code>linux/ppc64le</code>)
-now requires the POWER8 architecture or later.
-Big-endian 64-bit PowerPC (<code>linux/ppc64</code>) only requires the
-POWER5 architecture.
-</p>
-
-<p>
-The OpenBSD port now requires OpenBSD 5.6 or later, for access to the <a href="https://man.openbsd.org/getentropy.2"><i>getentropy</i>(2)</a> system call.
-</p>
-
-<h3 id="known_issues">Known Issues</h3>
-
-<p>
-There are some instabilities on FreeBSD that are known but not understood.
-These can lead to program crashes in rare cases.
-See <a href="https://golang.org/issue/16136">issue 16136</a>,
-<a href="https://golang.org/issue/15658">issue 15658</a>,
-and <a href="https://golang.org/issue/16396">issue 16396</a>.
-Any help in solving these FreeBSD-specific issues would be appreciated.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="cmd_asm">Assembler</h3>
-
-<p>
-For 64-bit ARM systems, the vector register names have been
-corrected to <code>V0</code> through <code>V31</code>;
-previous releases incorrectly referred to them as <code>V32</code> through <code>V63</code>.
-</p>
-
-<p>
-For 64-bit x86 systems, the following instructions have been added:
-<code>PCMPESTRI</code>,
-<code>RORXL</code>,
-<code>RORXQ</code>,
-<code>VINSERTI128</code>,
-<code>VPADDD</code>,
-<code>VPADDQ</code>,
-<code>VPALIGNR</code>,
-<code>VPBLENDD</code>,
-<code>VPERM2F128</code>,
-<code>VPERM2I128</code>,
-<code>VPOR</code>,
-<code>VPSHUFB</code>,
-<code>VPSHUFD</code>,
-<code>VPSLLD</code>,
-<code>VPSLLDQ</code>,
-<code>VPSLLQ</code>,
-<code>VPSRLD</code>,
-<code>VPSRLDQ</code>,
-and
-<code>VPSRLQ</code>.
-</p>
-
-<h3 id="compiler">Compiler Toolchain</h3>
-
-<p>
-This release includes a new code generation back end for 64-bit x86 systems,
-following a <a href="https://golang.org/s/go17ssa">proposal from 2015</a>
-that has been under development since then.
-The new back end, based on
-<a href="https://en.wikipedia.org/wiki/Static_single_assignment_form">SSA</a>,
-generates more compact, more efficient code
-and provides a better platform for optimizations
-such as bounds check elimination.
-The new back end reduces the CPU time required by
-<a href="https://golang.org/test/bench/go1/">our benchmark programs</a> by 5-35%.
-</p>
-
-<p>
-For this release, the new back end can be disabled by passing
-<code>-ssa=0</code> to the compiler.
-If you find that your program compiles or runs successfully
-only with the new back end disabled, please
-<a href="https://golang.org/issue/new">file a bug report</a>.
-</p>
-
-<p>
-The format of exported metadata written by the compiler in package archives has changed:
-the old textual format has been replaced by a more compact binary format.
-This results in somewhat smaller package archives and fixes a few
-long-standing corner case bugs.
-</p>
-
-<p>
-For this release, the new export format can be disabled by passing
-<code>-newexport=0</code> to the compiler.
-If you find that your program compiles or runs successfully
-only with the new export format disabled, please
-<a href="https://golang.org/issue/new">file a bug report</a>.
-</p>
-
-<p>
-The linker's <code>-X</code> option no longer supports the unusual two-argument form
-<code>-X</code> <code>name</code> <code>value</code>,
-as <a href="/doc/go1.6#compiler">announced</a> in the Go 1.6 release
-and in warnings printed by the linker.
-Use <code>-X</code> <code>name=value</code> instead.
-</p>
-
-<p>
-The compiler and linker have been optimized and run significantly faster in this release than in Go 1.6,
-although they are still slower than we would like and will continue to be optimized in future releases.
-</p>
-
-<p>
-Due to changes across the compiler toolchain and standard library,
-binaries built with this release should typically be smaller than binaries
-built with Go 1.6,
-sometimes by as much as 20-30%.
-</p>
-
-<p>
-On x86-64 systems, Go programs now maintain stack frame pointers
-as expected by profiling tools like Linux's perf and Intel's VTune,
-making it easier to analyze and optimize Go programs using these tools.
-The frame pointer maintenance has a small run-time overhead that varies
-but averages around 2%. We hope to reduce this cost in future releases.
-To build a toolchain that does not use frame pointers, set
-<code>GOEXPERIMENT=noframepointer</code> when running
-<code>make.bash</code>, <code>make.bat</code>, or <code>make.rc</code>.
-</p>
-
-<h3 id="cmd_cgo">Cgo</h3>
-
-<p>
-Packages using <a href="/cmd/cgo/">cgo</a> may now include
-Fortran source files (in addition to C, C++, Objective C, and SWIG),
-although the Go bindings must still use C language APIs.
-</p>
-
-<p>
-Go bindings may now use a new helper function <code>C.CBytes</code>.
-In contrast to <code>C.CString</code>, which takes a Go <code>string</code>
-and returns a <code>*C.byte</code> (a C <code>char*</code>),
-<code>C.CBytes</code> takes a Go <code>[]byte</code>
-and returns an <code>unsafe.Pointer</code> (a C <code>void*</code>).
-</p>
-
-<p>
-Packages and binaries built using <code>cgo</code> have in past releases
-produced different output on each build,
-due to the embedding of temporary directory names.
-When using this release with
-new enough versions of GCC or Clang
-(those that support the <code>-fdebug-prefix-map</code> option),
-those builds should finally be deterministic.
-</p>
-
-<h3 id="gccgo">Gccgo</h3>
-
-<p>
-Due to the alignment of Go's semiannual release schedule with GCC's annual release schedule,
-GCC release 6 contains the Go 1.6.1 version of gccgo.
-The next release, GCC 7, will likely have the Go 1.8 version of gccgo.
-</p>
-
-<h3 id="cmd_go">Go command</h3>
-
-<p>
-The <a href="/cmd/go/"><code>go</code></a> command's basic operation
-is unchanged, but there are a number of changes worth noting.
-</p>
-
-<p>
-This release removes support for the <code>GO15VENDOREXPERIMENT</code> environment variable,
-as <a href="/doc/go1.6#go_command">announced</a> in the Go 1.6 release.
-<a href="https://golang.org/s/go15vendor">Vendoring support</a>
-is now a standard feature of the <code>go</code> command and toolchain.
-</p>
-
-<p>
-The <code>Package</code> data structure made available to
-“<code>go</code> <code>list</code>” now includes a
-<code>StaleReason</code> field explaining why a particular package
-is or is not considered stale (in need of rebuilding).
-This field is available to the <code>-f</code> or <code>-json</code>
-options and is useful for understanding why a target is being rebuilt.
-</p>
-
-<p>
-The “<code>go</code> <code>get</code>” command now supports
-import paths referring to <code>git.openstack.org</code>.
-</p>
-
-<p>
-This release adds experimental, minimal support for building programs using
-<a href="/pkg/go/build#hdr-Binary_Only_Packages">binary-only packages</a>,
-packages distributed in binary form
-without the corresponding source code.
-This feature is needed in some commercial settings
-but is not intended to be fully integrated into the rest of the toolchain.
-For example, tools that assume access to complete source code
-will not work with such packages, and there are no plans to support
-such packages in the “<code>go</code> <code>get</code>” command.
-</p>
-
-<h3 id="cmd_doc">Go doc</h3>
-
-<p>
-The “<code>go</code> <code>doc</code>” command
-now groups constructors with the type they construct,
-following <a href="/cmd/godoc/"><code>godoc</code></a>.
-</p>
-
-<h3 id="cmd_vet">Go vet</h3>
-
-<p>
-The “<code>go</code> <code>vet</code>” command
-has more accurate analysis in its <code>-copylock</code> and <code>-printf</code> checks,
-and a new <code>-tests</code> check that checks the name and signature of likely test functions.
-To avoid confusion with the new <code>-tests</code> check, the old, unadvertised
-<code>-test</code> option has been removed; it was equivalent to <code>-all</code> <code>-shadow</code>.
-</p>
-
-<p id="vet_lostcancel">
-The <code>vet</code> command also has a new check,
-<code>-lostcancel</code>, which detects failure to call the
-cancelation function returned by the <code>WithCancel</code>,
-<code>WithTimeout</code>, and <code>WithDeadline</code> functions in
-Go 1.7's new <code>context</code> package (see <a
-href='#context'>below</a>).
-Failure to call the function prevents the new <code>Context</code>
-from being reclaimed until its parent is cancelled.
-(The background context is never cancelled.)
-</p>
-
-<h3 id="cmd_dist">Go tool dist</h3>
-
-<p>
-The new subcommand “<code>go</code> <code>tool</code> <code>dist</code> <code>list</code>”
-prints all supported operating system/architecture pairs.
-</p>
-
-<h3 id="cmd_trace">Go tool trace</h3>
-
-<p>
-The “<code>go</code> <code>tool</code> <code>trace</code>” command,
-<a href="/doc/go1.5#trace_command">introduced in Go 1.5</a>,
-has been refined in various ways.
-</p>
-
-<p>
-First, collecting traces is significantly more efficient than in past releases.
-In this release, the typical execution-time overhead of collecting a trace is about 25%;
-in past releases it was at least 400%.
-Second, trace files now include file and line number information,
-making them more self-contained and making the
-original executable optional when running the trace tool.
-Third, the trace tool now breaks up large traces to avoid limits
-in the browser-based viewer.
-</p>
-
-<p>
-Although the trace file format has changed in this release,
-the Go 1.7 tools can still read traces from earlier releases.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-As always, the changes are so general and varied that precise statements
-about performance are difficult to make.
-Most programs should run a bit faster,
-due to speedups in the garbage collector and
-optimizations in the core library.
-On x86-64 systems, many programs will run significantly faster,
-due to improvements in generated code brought by the
-new compiler back end.
-As noted above, in our own benchmarks,
-the code generation changes alone typically reduce program CPU time by 5-35%.
-</p>
-
-<p>
-<!-- git log -''-grep '-[0-9][0-9]\.[0-9][0-9]%' go1.6.. -->
-There have been significant optimizations bringing more than 10% improvements
-to implementations in the
-<a href="/pkg/crypto/sha1/"><code>crypto/sha1</code></a>,
-<a href="/pkg/crypto/sha256/"><code>crypto/sha256</code></a>,
-<a href="/pkg/encoding/binary/"><code>encoding/binary</code></a>,
-<a href="/pkg/fmt/"><code>fmt</code></a>,
-<a href="/pkg/hash/adler32/"><code>hash/adler32</code></a>,
-<a href="/pkg/hash/crc32/"><code>hash/crc32</code></a>,
-<a href="/pkg/hash/crc64/"><code>hash/crc64</code></a>,
-<a href="/pkg/image/color/"><code>image/color</code></a>,
-<a href="/pkg/math/big/"><code>math/big</code></a>,
-<a href="/pkg/strconv/"><code>strconv</code></a>,
-<a href="/pkg/strings/"><code>strings</code></a>,
-<a href="/pkg/unicode/"><code>unicode</code></a>,
-and
-<a href="/pkg/unicode/utf16/"><code>unicode/utf16</code></a>
-packages.
-</p>
-
-<p>
-Garbage collection pauses should be significantly shorter than they
-were in Go 1.6 for programs with large numbers of idle goroutines,
-substantial stack size fluctuation, or large package-level variables.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="context">Context</h3>
-
-<p>
-Go 1.7 moves the <code>golang.org/x/net/context</code> package
-into the standard library as <a href="/pkg/context/"><code>context</code></a>.
-This allows the use of contexts for cancelation, timeouts, and passing
-request-scoped data in other standard library packages,
-including
-<a href="#net">net</a>,
-<a href="#net_http">net/http</a>,
-and
-<a href="#os_exec">os/exec</a>,
-as noted below.
-</p>
-
-<p>
-For more information about contexts, see the
-<a href="/pkg/context/">package documentation</a>
-and the Go blog post
-“<a href="https://blog.golang.org/context">Go Concurrent Patterns: Context</a>.”
-</p>
-
-<h3 id="httptrace">HTTP Tracing</h3>
-
-<p>
-Go 1.7 introduces <a href="/pkg/net/http/httptrace/"><code>net/http/httptrace</code></a>,
-a package that provides mechanisms for tracing events within HTTP requests.
-</p>
-
-<h3 id="testing">Testing</h3>
-
-<p>
-The <code>testing</code> package now supports the definition
-of tests with subtests and benchmarks with sub-benchmarks.
-This support makes it easy to write table-driven benchmarks
-and to create hierarchical tests.
-It also provides a way to share common setup and tear-down code.
-See the <a href="/pkg/testing/#hdr-Subtests_and_Sub_benchmarks">package documentation</a> for details.
-</p>
-
-<h3 id="runtime">Runtime</h3>
-
-<p>
-All panics started by the runtime now use panic values
-that implement both the
-builtin <a href="/ref/spec#Errors"><code>error</code></a>,
-and
-<a href="/pkg/runtime/#Error"><code>runtime.Error</code></a>,
-as
-<a href="/ref/spec#Run_time_panics">required by the language specification</a>.
-</p>
-
-<p>
-During panics, if a signal's name is known, it will be printed in the stack trace.
-Otherwise, the signal's number will be used, as it was before Go1.7.
-</p>
-
-<p>
-The new function
-<a href="/pkg/runtime/#KeepAlive"><code>KeepAlive</code></a>
-provides an explicit mechanism for declaring
-that an allocated object must be considered reachable
-at a particular point in a program,
-typically to delay the execution of an associated finalizer.
-</p>
-
-<p>
-The new function
-<a href="/pkg/runtime/#CallersFrames"><code>CallersFrames</code></a>
-translates a PC slice obtained from
-<a href="/pkg/runtime/#Callers"><code>Callers</code></a>
-into a sequence of frames corresponding to the call stack.
-This new API should be preferred instead of direct use of
-<a href="/pkg/runtime/#FuncForPC"><code>FuncForPC</code></a>,
-because the frame sequence can more accurately describe
-call stacks with inlined function calls.
-</p>
-
-<p>
-The new function
-<a href="/pkg/runtime/#SetCgoTraceback"><code>SetCgoTraceback</code></a>
-facilitates tighter integration between Go and C code executing
-in the same process called using cgo.
-</p>
-
-<p>
-On 32-bit systems, the runtime can now use memory allocated
-by the operating system anywhere in the address space,
-eliminating the
-“memory allocated by OS not in usable range” failure
-common in some environments.
-</p>
-
-<p>
-The runtime can now return unused memory to the operating system on
-all architectures.
-In Go 1.6 and earlier, the runtime could not
-release memory on ARM64, 64-bit PowerPC, or MIPS.
-</p>
-
-<p>
-On Windows, Go programs in Go 1.5 and earlier forced
-the global Windows timer resolution to 1ms at startup
-by calling <code>timeBeginPeriod(1)</code>.
-Changing the global timer resolution caused problems on some systems,
-and testing suggested that the call was not needed for good scheduler performance,
-so Go 1.6 removed the call.
-Go 1.7 brings the call back: under some workloads the call
-is still needed for good scheduler performance.
-</p>
-
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-As always, there are various minor changes and updates to the library,
-made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
-in mind.
-</p>
-
-<dl id="bufio"><dt><a href="/pkg/bufio/">bufio</a></dt>
-
-<dd>
-<p>
-In previous releases of Go, if
-<a href="/pkg/bufio/#Reader"><code>Reader</code></a>'s
-<a href="/pkg/bufio/#Reader.Peek"><code>Peek</code></a> method
-were asked for more bytes than fit in the underlying buffer,
-it would return an empty slice and the error <code>ErrBufferFull</code>.
-Now it returns the entire underlying buffer, still accompanied by the error <code>ErrBufferFull</code>.
-</p>
-</dd>
-</dl>
-
-<dl id="bytes"><dt><a href="/pkg/bytes/">bytes</a></dt>
-
-<dd>
-<p>
-The new functions
-<a href="/pkg/bytes/#ContainsAny"><code>ContainsAny</code></a> and
-<a href="/pkg/bytes/#ContainsRune"><code>ContainsRune</code></a>
-have been added for symmetry with
-the <a href="/pkg/strings/"><code>strings</code></a> package.
-</p>
-
-<p>
-In previous releases of Go, if
-<a href="/pkg/bytes/#Reader"><code>Reader</code></a>'s
-<a href="/pkg/bytes/#Reader.Read"><code>Read</code></a> method
-were asked for zero bytes with no data remaining, it would
-return a count of 0 and no error.
-Now it returns a count of 0 and the error
-<a href="/pkg/io/#EOF"><code>io.EOF</code></a>.
-</p>
-
-<p>
-The
-<a href="/pkg/bytes/#Reader"><code>Reader</code></a> type has a new method
-<a href="/pkg/bytes/#Reader.Reset"><code>Reset</code></a> to allow reuse of a <code>Reader</code>.
-</p>
-</dd>
-</dl>
-
-<dl id="compress_flate"><dt><a href="/pkg/compress/flate/">compress/flate</a></dt>
-
-<dd>
-<p>
-There are many performance optimizations throughout the package.
-Decompression speed is improved by about 10%,
-while compression for <code>DefaultCompression</code> is twice as fast.
-</p>
-
-<p>
-In addition to those general improvements,
-the
-<code>BestSpeed</code>
-compressor has been replaced entirely and uses an
-algorithm similar to <a href="https://github.com/google/snappy">Snappy</a>,
-resulting in about a 2.5X speed increase,
-although the output can be 5-10% larger than with the previous algorithm.
-</p>
-
-<p>
-There is also a new compression level
-<code>HuffmanOnly</code>
-that applies Huffman but not Lempel-Ziv encoding.
-<a href="https://blog.klauspost.com/constant-time-gzipzip-compression/">Forgoing Lempel-Ziv encoding</a> means that
-<code>HuffmanOnly</code> runs about 3X faster than the new <code>BestSpeed</code>
-but at the cost of producing compressed outputs that are 20-40% larger than those
-generated by the new <code>BestSpeed</code>.
-</p>
-
-<p>
-It is important to note that both
-<code>BestSpeed</code> and <code>HuffmanOnly</code> produce a compressed output that is
-<a href="https://tools.ietf.org/html/rfc1951">RFC 1951</a> compliant.
-In other words, any valid DEFLATE decompressor will continue to be able to decompress these outputs.
-</p>
-
-<p>
-Lastly, there is a minor change to the decompressor's implementation of
-<a href="/pkg/io/#Reader"><code>io.Reader</code></a>. In previous versions,
-the decompressor deferred reporting
-<a href="/pkg/io/#EOF"><code>io.EOF</code></a> until exactly no more bytes could be read.
-Now, it reports
-<a href="/pkg/io/#EOF"><code>io.EOF</code></a> more eagerly when reading the last set of bytes.
-</p>
-</dd>
-</dl>
-
-<dl id="crypto_tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
-
-<dd>
-<p>
-The TLS implementation sends the first few data packets on each connection
-using small record sizes, gradually increasing to the TLS maximum record size.
-This heuristic reduces the amount of data that must be received before
-the first packet can be decrypted, improving communication latency over
-low-bandwidth networks.
-Setting
-<a href="/pkg/crypto/tls/#Config"><code>Config</code></a>'s
-<code>DynamicRecordSizingDisabled</code> field to true
-forces the behavior of Go 1.6 and earlier, where packets are
-as large as possible from the start of the connection.
-</p>
-
-<p>
-The TLS client now has optional, limited support for server-initiated renegotiation,
-enabled by setting the
-<a href="/pkg/crypto/tls/#Config"><code>Config</code></a>'s
-<code>Renegotiation</code> field.
-This is needed for connecting to many Microsoft Azure servers.
-</p>
-
-<p>
-The errors returned by the package now consistently begin with a
-<code>tls:</code> prefix.
-In past releases, some errors used a <code>crypto/tls:</code> prefix,
-some used a <code>tls:</code> prefix, and some had no prefix at all.
-</p>
-
-<p>
-When generating self-signed certificates, the package no longer sets the
-“Authority Key Identifier” field by default.
-</p>
-</dd>
-</dl>
-
-<dl id="crypto_x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
-
-<dd>
-<p>
-The new function
-<a href="/pkg/crypto/x509/#SystemCertPool"><code>SystemCertPool</code></a>
-provides access to the entire system certificate pool if available.
-There is also a new associated error type
-<a href="/pkg/crypto/x509/#SystemRootsError"><code>SystemRootsError</code></a>.
-</p>
-</dd>
-</dl>
-
-<dl id="debug_dwarf"><dt><a href="/pkg/debug/dwarf/">debug/dwarf</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/debug/dwarf/#Reader"><code>Reader</code></a> type's new
-<a href="/pkg/debug/dwarf/#Reader.SeekPC"><code>SeekPC</code></a> method and the
-<a href="/pkg/debug/dwarf/#Data"><code>Data</code></a> type's new
-<a href="/pkg/debug/dwarf/#Ranges"><code>Ranges</code></a> method
-help to find the compilation unit to pass to a
-<a href="/pkg/debug/dwarf/#LineReader"><code>LineReader</code></a>
-and to identify the specific function for a given program counter.
-</p>
-</dd>
-</dl>
-
-<dl id="debug_elf"><dt><a href="/pkg/debug/elf/">debug/elf</a></dt>
-
-<dd>
-<p>
-The new
-<a href="/pkg/debug/elf/#R_390"><code>R_390</code></a> relocation type
-and its many predefined constants
-support the S390 port.
-</p>
-</dd>
-</dl>
-
-<dl id="encoding_asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
-
-<dd>
-<p>
-The ASN.1 decoder now rejects non-minimal integer encodings.
-This may cause the package to reject some invalid but formerly accepted ASN.1 data.
-</p>
-</dd>
-</dl>
-
-<dl id="encoding_json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/encoding/json/#Encoder"><code>Encoder</code></a>'s new
-<a href="/pkg/encoding/json/#Encoder.SetIndent"><code>SetIndent</code></a> method
-sets the indentation parameters for JSON encoding,
-like in the top-level
-<a href="/pkg/encoding/json/#Indent"><code>Indent</code></a> function.
-</p>
-
-<p>
-The
-<a href="/pkg/encoding/json/#Encoder"><code>Encoder</code></a>'s new
-<a href="/pkg/encoding/json/#Encoder.SetEscapeHTML"><code>SetEscapeHTML</code></a> method
-controls whether the
-<code>&#x26;</code>, <code>&#x3c;</code>, and <code>&#x3e;</code>
-characters in quoted strings should be escaped as
-<code>\u0026</code>, <code>\u003c</code>, and <code>\u003e</code>,
-respectively.
-As in previous releases, the encoder defaults to applying this escaping,
-to avoid certain problems that can arise when embedding JSON in HTML.
-</p>
-
-<p>
-In earlier versions of Go, this package only supported encoding and decoding
-maps using keys with string types.
-Go 1.7 adds support for maps using keys with integer types:
-the encoding uses a quoted decimal representation as the JSON key.
-Go 1.7 also adds support for encoding maps using non-string keys that implement
-the <code>MarshalText</code>
-(see
-<a href="/pkg/encoding/#TextMarshaler"><code>encoding.TextMarshaler</code></a>)
-method,
-as well as support for decoding maps using non-string keys that implement
-the <code>UnmarshalText</code>
-(see
-<a href="/pkg/encoding/#TextUnmarshaler"><code>encoding.TextUnmarshaler</code></a>)
-method.
-These methods are ignored for keys with string types in order to preserve
-the encoding and decoding used in earlier versions of Go.
-</p>
-
-<p>
-When encoding a slice of typed bytes,
-<a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a>
-now generates an array of elements encoded using
-that byte type's
-<code>MarshalJSON</code>
-or
-<code>MarshalText</code>
-method if present,
-only falling back to the default base64-encoded string data if neither method is available.
-Earlier versions of Go accept both the original base64-encoded string encoding
-and the array encoding (assuming the byte type also implements
-<code>UnmarshalJSON</code>
-or
-<code>UnmarshalText</code>
-as appropriate),
-so this change should be semantically backwards compatible with earlier versions of Go,
-even though it does change the chosen encoding.
-</p>
-</dd>
-</dl>
-
-<dl id="go_build"><dt><a href="/pkg/go/build/">go/build</a></dt>
-
-<dd>
-<p>
-To implement the go command's new support for binary-only packages
-and for Fortran code in cgo-based packages,
-the
-<a href="/pkg/go/build/#Package"><code>Package</code></a> type
-adds new fields <code>BinaryOnly</code>, <code>CgoFFLAGS</code>, and <code>FFiles</code>.
-</p>
-</dd>
-</dl>
-
-<dl id="go_doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
-
-<dd>
-<p>
-To support the corresponding change in <code>go</code> <code>test</code> described above,
-<a href="/pkg/go/doc/#Example"><code>Example</code></a> struct adds a Unordered field
-indicating whether the example may generate its output lines in any order.
-</p>
-</dd>
-</dl>
-
-<dl id="io"><dt><a href="/pkg/io/">io</a></dt>
-
-<dd>
-<p>
-The package adds new constants
-<code>SeekStart</code>, <code>SeekCurrent</code>, and <code>SeekEnd</code>,
-for use with
-<a href="/pkg/io/#Seeker"><code>Seeker</code></a>
-implementations.
-These constants are preferred over <code>os.SEEK_SET</code>, <code>os.SEEK_CUR</code>, and <code>os.SEEK_END</code>,
-but the latter will be preserved for compatibility.
-</p>
-</dd>
-</dl>
-
-<dl id="math_big"><dt><a href="/pkg/math/big/">math/big</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/math/big/#Float"><code>Float</code></a> type adds
-<a href="/pkg/math/big/#Float.GobEncode"><code>GobEncode</code></a> and
-<a href="/pkg/math/big/#Float.GobDecode"><code>GobDecode</code></a> methods,
-so that values of type <code>Float</code> can now be encoded and decoded using the
-<a href="/pkg/encoding/gob/"><code>encoding/gob</code></a>
-package.
-</p>
-</dd>
-</dl>
-
-<dl id="math_rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/math/rand/#Read"><code>Read</code></a> function and
-<a href="/pkg/math/rand/#Rand"><code>Rand</code></a>'s
-<a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> method
-now produce a pseudo-random stream of bytes that is consistent and not
-dependent on the size of the input buffer.
-</p>
-
-<p>
-The documentation clarifies that
-Rand's <a href="/pkg/math/rand/#Rand.Seed"><code>Seed</code></a>
-and <a href="/pkg/math/rand/#Rand.Read"><code>Read</code></a> methods
-are not safe to call concurrently, though the global
-functions <a href="/pkg/math/rand/#Seed"><code>Seed</code></a>
-and <a href="/pkg/math/rand/#Read"><code>Read</code></a> are (and have
-always been) safe.
-</p>
-</dd>
-</dl>
-
-<dl id="mime_multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/mime/multipart/#Writer"><code>Writer</code></a>
-implementation now emits each multipart section's header sorted by key.
-Previously, iteration over a map caused the section header to use a
-non-deterministic order.
-</p>
-</dd>
-</dl>
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
-
-<dd>
-<p>
-As part of the introduction of <a href="#context">context</a>, the
-<a href="/pkg/net/#Dialer"><code>Dialer</code></a> type has a new method
-<a href="/pkg/net/#Dialer.DialContext"><code>DialContext</code></a>, like
-<a href="/pkg/net/#Dialer.Dial"><code>Dial</code></a> but adding the
-<a href="/pkg/context/#Context"><code>context.Context</code></a>
-for the dial operation.
-The context is intended to obsolete the <code>Dialer</code>'s
-<code>Cancel</code> and <code>Deadline</code> fields,
-but the implementation continues to respect them,
-for backwards compatibility.
-</p>
-
-<p>
-The
-<a href="/pkg/net/#IP"><code>IP</code></a> type's
-<a href="/pkg/net/#IP.String"><code>String</code></a> method has changed its result for invalid <code>IP</code> addresses.
-In past releases, if an <code>IP</code> byte slice had length other than 0, 4, or 16, <code>String</code>
-returned <code>"?"</code>.
-Go 1.7 adds the hexadecimal encoding of the bytes, as in <code>"?12ab"</code>.
-</p>
-
-<p>
-The pure Go <a href="/pkg/net/#hdr-Name_Resolution">name resolution</a>
-implementation now respects <code>nsswitch.conf</code>'s
-stated preference for the priority of DNS lookups compared to
-local file (that is, <code>/etc/hosts</code>) lookups.
-</p>
-</dd>
-</dl>
-
-<dl id="net_http"><dt><a href="/pkg/net/http/">net/http</a></dt>
-
-<dd>
-<p>
-<a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>'s
-documentation now makes clear that beginning to write the response
-may prevent future reads on the request body.
-For maximal compatibility, implementations are encouraged to
-read the request body completely before writing any part of the response.
-</p>
-
-<p>
-As part of the introduction of <a href="#context">context</a>, the
-<a href="/pkg/net/http/#Request"><code>Request</code></a> has a new methods
-<a href="/pkg/net/http/#Request.Context"><code>Context</code></a>, to retrieve the associated context, and
-<a href="/pkg/net/http/#Request.WithContext"><code>WithContext</code></a>, to construct a copy of <code>Request</code>
-with a modified context.
-</p>
-
-<p>
-In the
-<a href="/pkg/net/http/#Server"><code>Server</code></a> implementation,
-<a href="/pkg/net/http/#Server.Serve"><code>Serve</code></a> records in the request context
-both the underlying <code>*Server</code> using the key <code>ServerContextKey</code>
-and the local address on which the request was received (a
-<a href="/pkg/net/#Addr"><code>Addr</code></a>) using the key <code>LocalAddrContextKey</code>.
-For example, the address on which a request received is
-<code>req.Context().Value(http.LocalAddrContextKey).(net.Addr)</code>.
-</p>
-
-<p>
-The server's <a href="/pkg/net/http/#Server.Serve"><code>Serve</code></a> method
-now only enables HTTP/2 support if the <code>Server.TLSConfig</code> field is <code>nil</code>
-or includes <code>"h2"</code> in its <code>TLSConfig.NextProtos</code>.
-</p>
-
-<p>
-The server implementation now
-pads response codes less than 100 to three digits
-as required by the protocol,
-so that <code>w.WriteHeader(5)</code> uses the HTTP response
-status <code>005</code>, not just <code>5</code>.
-</p>
-
-<p>
-The server implementation now correctly sends only one "Transfer-Encoding" header when "chunked"
-is set explicitly, following <a href="https://tools.ietf.org/html/rfc7230#section-3.3.1">RFC 7230</a>.
-</p>
-
-<p>
-The server implementation is now stricter about rejecting requests with invalid HTTP versions.
-Invalid requests claiming to be HTTP/0.x are now rejected (HTTP/0.9 was never fully supported),
-and plaintext HTTP/2 requests other than the "PRI * HTTP/2.0" upgrade request are now rejected as well.
-The server continues to handle encrypted HTTP/2 requests.
-</p>
-
-<p>
-In the server, a 200 status code is sent back by the timeout handler on an empty
-response body, instead of sending back 0 as the status code.
-</p>
-
-<p>
-In the client, the
-<a href="/pkg/net/http/#Transport"><code>Transport</code></a> implementation passes the request context
-to any dial operation connecting to the remote server.
-If a custom dialer is needed, the new <code>Transport</code> field
-<code>DialContext</code> is preferred over the existing <code>Dial</code> field,
-to allow the transport to supply a context.
-</p>
-
-<p>
-The
-<a href="/pkg/net/http/#Transport"><code>Transport</code></a> also adds fields
-<code>IdleConnTimeout</code>,
-<code>MaxIdleConns</code>,
-and
-<code>MaxResponseHeaderBytes</code>
-to help control client resources consumed
-by idle or chatty servers.
-</p>
-
-<p>
-A
-<a href="/pkg/net/http/#Client"><code>Client</code></a>'s configured <code>CheckRedirect</code> function can now
-return <code>ErrUseLastResponse</code> to indicate that the
-most recent redirect response should be returned as the
-result of the HTTP request.
-That response is now available to the <code>CheckRedirect</code> function
-as <code>req.Response</code>.
-</p>
-
-<p>
-Since Go 1, the default behavior of the HTTP client is
-to request server-side compression
-using the <code>Accept-Encoding</code> request header
-and then to decompress the response body transparently,
-and this behavior is adjustable using the
-<a href="/pkg/net/http/#Transport"><code>Transport</code></a>'s <code>DisableCompression</code> field.
-In Go 1.7, to aid the implementation of HTTP proxies, the
-<a href="/pkg/net/http/#Response"><code>Response</code></a>'s new
-<code>Uncompressed</code> field reports whether
-this transparent decompression took place.
-</p>
-
-<p>
-<a href="/pkg/net/http/#DetectContentType"><code>DetectContentType</code></a>
-adds support for a few new audio and video content types.
-</p>
-</dd>
-</dl>
-
-<dl id="net_http_cgi"><dt><a href="/pkg/net/http/cgi/">net/http/cgi</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/net/http/cgi/#Handler"><code>Handler</code></a>
-adds a new field
-<code>Stderr</code>
-that allows redirection of the child process's
-standard error away from the host process's
-standard error.
-</p>
-</dd>
-</dl>
-
-<dl id="net_http_httptest"><dt><a href="/pkg/net/http/httptest/">net/http/httptest</a></dt>
-
-<dd>
-<p>
-The new function
-<a href="/pkg/net/http/httptest/#NewRequest"><code>NewRequest</code></a>
-prepares a new
-<a href="/pkg/net/http/#Request"><code>http.Request</code></a>
-suitable for passing to an
-<a href="/pkg/net/http/#Handler"><code>http.Handler</code></a> during a test.
-</p>
-
-<p>
-The
-<a href="/pkg/net/http/httptest/#ResponseRecorder"><code>ResponseRecorder</code></a>'s new
-<a href="/pkg/net/http/httptest/#ResponseRecorder.Result"><code>Result</code></a> method
-returns the recorded
-<a href="/pkg/net/http/#Response"><code>http.Response</code></a>.
-Tests that need to check the response's headers or trailers
-should call <code>Result</code> and inspect the response fields
-instead of accessing
-<code>ResponseRecorder</code>'s <code>HeaderMap</code> directly.
-</p>
-</dd>
-</dl>
-
-<dl id="net_http_httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a> implementation now responds with “502 Bad Gateway”
-when it cannot reach a back end; in earlier releases it responded with “500 Internal Server Error.”
-</p>
-
-<p>
-Both
-<a href="/pkg/net/http/httputil/#ClientConn"><code>ClientConn</code></a> and
-<a href="/pkg/net/http/httputil/#ServerConn"><code>ServerConn</code></a> have been documented as deprecated.
-They are low-level, old, and unused by Go's current HTTP stack
-and will no longer be updated.
-Programs should use
-<a href="/pkg/net/http/#Client"><code>http.Client</code></a>,
-<a href="/pkg/net/http/#Transport"><code>http.Transport</code></a>,
-and
-<a href="/pkg/net/http/#Server"><code>http.Server</code></a>
-instead.
-</p>
-</dd>
-</dl>
-
-<dl id="net_http_pprof"><dt><a href="/pkg/net/http/pprof/">net/http/pprof</a></dt>
-
-<dd>
-<p>
-The runtime trace HTTP handler, installed to handle the path <code>/debug/pprof/trace</code>,
-now accepts a fractional number in its <code>seconds</code> query parameter,
-allowing collection of traces for intervals smaller than one second.
-This is especially useful on busy servers.
-</p>
-</dd>
-</dl>
-
-<dl><dt><a href="/pkg/net/mail/">net/mail</a></dt>
-
-<dd>
-<p>
-The address parser now allows unescaped UTF-8 text in addresses
-following <a href="https://tools.ietf.org/html/rfc6532">RFC 6532</a>,
-but it does not apply any normalization to the result.
-For compatibility with older mail parsers,
-the address encoder, namely
-<a href="/pkg/net/mail/#Address"><code>Address</code></a>'s
-<a href="/pkg/net/mail/#Address.String"><code>String</code></a> method,
-continues to escape all UTF-8 text following <a href="https://tools.ietf.org/html/rfc5322">RFC 5322</a>.
-</p>
-
-<p>
-The <a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a>
-function and
-the <a href="/pkg/net/mail/#AddressParser.Parse"><code>AddressParser.Parse</code></a>
-method are stricter.
-They used to ignore any characters following an e-mail address, but
-will now return an error for anything other than whitespace.
-</p>
-</dd>
-</dl>
-
-<dl id="net_url"><dt><a href="/pkg/net/url/">net/url</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/net/url/#URL"><code>URL</code></a>'s
-new <code>ForceQuery</code> field
-records whether the URL must have a query string,
-in order to distinguish URLs without query strings (like <code>/search</code>)
-from URLs with empty query strings (like <code>/search?</code>).
-</p>
-</dd>
-</dl>
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
-
-<dd>
-<p>
-<a href="/pkg/os/#IsExist"><code>IsExist</code></a> now returns true for <code>syscall.ENOTEMPTY</code>,
-on systems where that error exists.
-</p>
-
-<p>
-On Windows,
-<a href="/pkg/os/#Remove"><code>Remove</code></a> now removes read-only files when possible,
-making the implementation behave as on
-non-Windows systems.
-</p>
-</dd>
-</dl>
-
-<dl id="os_exec"><dt><a href="/pkg/os/exec/">os/exec</a></dt>
-
-<dd>
-<p>
-As part of the introduction of <a href="#context">context</a>,
-the new constructor
-<a href="/pkg/os/exec/#CommandContext"><code>CommandContext</code></a>
-is like
-<a href="/pkg/os/exec/#Command"><code>Command</code></a> but includes a context that can be used to cancel the command execution.
-</p>
-</dd>
-</dl>
-
-<dl id="os_user"><dt><a href="/pkg/os/user/">os/user</a></dt>
-
-<dd>
-<p>
-The
-<a href="/pkg/os/user/#Current"><code>Current</code></a>
-function is now implemented even when cgo is not available.
-</p>
-
-<p>
-The new
-<a href="/pkg/os/user/#Group"><code>Group</code></a> type,
-along with the lookup functions
-<a href="/pkg/os/user/#LookupGroup"><code>LookupGroup</code></a> and
-<a href="/pkg/os/user/#LookupGroupId"><code>LookupGroupId</code></a>
-and the new field <code>GroupIds</code> in the <code>User</code> struct,
-provides access to system-specific user group information.
-</p>
-</dd>
-</dl>
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
-
-<dd>
-<p>
-Although
-<a href="/pkg/reflect/#Value"><code>Value</code></a>'s
-<a href="/pkg/reflect/#Value.Field"><code>Field</code></a> method has always been documented to panic
-if the given field number <code>i</code> is out of range, it has instead
-silently returned a zero
-<a href="/pkg/reflect/#Value"><code>Value</code></a>.
-Go 1.7 changes the method to behave as documented.
-</p>
-
-<p>
-The new
-<a href="/pkg/reflect/#StructOf"><code>StructOf</code></a>
-function constructs a struct type at run time.
-It completes the set of type constructors, joining
-<a href="/pkg/reflect/#ArrayOf"><code>ArrayOf</code></a>,
-<a href="/pkg/reflect/#ChanOf"><code>ChanOf</code></a>,
-<a href="/pkg/reflect/#FuncOf"><code>FuncOf</code></a>,
-<a href="/pkg/reflect/#MapOf"><code>MapOf</code></a>,
-<a href="/pkg/reflect/#PtrTo"><code>PtrTo</code></a>,
-and
-<a href="/pkg/reflect/#SliceOf"><code>SliceOf</code></a>.
-</p>
-
-<p>
-<a href="/pkg/reflect/#StructTag"><code>StructTag</code></a>'s
-new method
-<a href="/pkg/reflect/#StructTag.Lookup"><code>Lookup</code></a>
-is like
-<a href="/pkg/reflect/#StructTag.Get"><code>Get</code></a>
-but distinguishes the tag not containing the given key
-from the tag associating an empty string with the given key.
-</p>
-
-<p>
-The
-<a href="/pkg/reflect/#Type.Method"><code>Method</code></a> and
-<a href="/pkg/reflect/#Type.NumMethod"><code>NumMethod</code></a>
-methods of
-<a href="/pkg/reflect/#Type"><code>Type</code></a> and
-<a href="/pkg/reflect/#Value"><code>Value</code></a>
-no longer return or count unexported methods.
-</p>
-</dd>
-</dl>
-
-<dl id="strings"><dt><a href="/pkg/strings/">strings</a></dt>
-
-<dd>
-<p>
-In previous releases of Go, if
-<a href="/pkg/strings/#Reader"><code>Reader</code></a>'s
-<a href="/pkg/strings/#Reader.Read"><code>Read</code></a> method
-were asked for zero bytes with no data remaining, it would
-return a count of 0 and no error.
-Now it returns a count of 0 and the error
-<a href="/pkg/io/#EOF"><code>io.EOF</code></a>.
-</p>
-
-<p>
-The
-<a href="/pkg/strings/#Reader"><code>Reader</code></a> type has a new method
-<a href="/pkg/strings/#Reader.Reset"><code>Reset</code></a> to allow reuse of a <code>Reader</code>.
-</p>
-</dd>
-</dl>
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
-
-<dd>
-<p>
-<a href="/pkg/time/#Duration"><code>Duration</code></a>'s
-time.Duration.String method now reports the zero duration as <code>"0s"</code>, not <code>"0"</code>.
-<a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a> continues to accept both forms.
-</p>
-
-<p>
-The method call <code>time.Local.String()</code> now returns <code>"Local"</code> on all systems;
-in earlier releases, it returned an empty string on Windows.
-</p>
-
-<p>
-The time zone database in
-<code>$GOROOT/lib/time</code> has been updated
-to IANA release 2016d.
-This fallback database is only used when the system time zone database
-cannot be found, for example on Windows.
-The Windows time zone abbreviation list has also been updated.
-</p>
-</dd>
-</dl>
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
-
-<dd>
-<p>
-On Linux, the
-<a href="/pkg/syscall/#SysProcAttr"><code>SysProcAttr</code></a> struct
-(as used in
-<a href="/pkg/os/exec/#Cmd"><code>os/exec.Cmd</code></a>'s <code>SysProcAttr</code> field)
-has a new <code>Unshareflags</code> field.
-If the field is nonzero, the child process created by
-<a href="/pkg/syscall/#ForkExec"><code>ForkExec</code></a>
-(as used in <code>exec.Cmd</code>'s <code>Run</code> method)
-will call the
-<a href="http://man7.org/linux/man-pages/man2/unshare.2.html"><i>unshare</i>(2)</a>
-system call before executing the new program.
-</p>
-</dd>
-</dl>
-
-
-<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
-
-<dd>
-<p>
-The <a href="/pkg/unicode/"><code>unicode</code></a> package and associated
-support throughout the system has been upgraded from version 8.0 to
-<a href="http://www.unicode.org/versions/Unicode9.0.0/">Unicode 9.0</a>.
-</p>
-</dd>
-</dl>
diff --git a/doc/go1.8.html b/doc/go1.8.html
deleted file mode 100644
index 2a47fac420..0000000000
--- a/doc/go1.8.html
+++ /dev/null
@@ -1,1666 +0,0 @@
-<!--{
- "Title": "Go 1.8 Release Notes",
- "Path": "/doc/go1.8",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.8</h2>
-
-<p>
-The latest Go release, version 1.8, arrives six months after <a href="go1.7">Go 1.7</a>.
-Most of its changes are in the implementation of the toolchain, runtime, and libraries.
-There are <a href="#language">two minor changes</a> to the language specification.
-As always, the release maintains the Go 1 <a href="/doc/go1compat.html">promise of compatibility</a>.
-We expect almost all Go programs to continue to compile and run as before.
-</p>
-
-<p>
-The release <a href="#ports">adds support for 32-bit MIPS</a>,
-<a href="#compiler">updates the compiler back end</a> to generate more efficient code,
-<a href="#gc">reduces GC pauses</a> by eliminating stop-the-world stack rescanning,
-<a href="#h2push">adds HTTP/2 Push support</a>,
-<a href="#http_shutdown">adds HTTP graceful shutdown</a>,
-<a href="#more_context">adds more context support</a>,
-<a href="#mutex_prof">enables profiling mutexes</a>,
-and <a href="#sort_slice">simplifies sorting slices</a>.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- When explicitly converting a value from one struct type to another,
- as of Go 1.8 the tags are ignored. Thus two structs that differ
- only in their tags may be converted from one to the other:
-</p>
-
-<pre>
-func example() {
- type T1 struct {
- X int `json:"foo"`
- }
- type T2 struct {
- X int `json:"bar"`
- }
- var v1 T1
- var v2 T2
- v1 = T1(v2) // now legal
-}
-</pre>
-
-
-<p> <!-- CL 17711 -->
- The language specification now only requires that implementations
- support up to 16-bit exponents in floating-point constants. This does not affect
- either the “<a href="/cmd/compile/"><code>gc</code></a>” or
- <code>gccgo</code> compilers, both of
- which still support 32-bit exponents.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p>
-Go now supports 32-bit MIPS on Linux for both big-endian
-(<code>linux/mips</code>) and little-endian machines
-(<code>linux/mipsle</code>) that implement the MIPS32r1 instruction set with FPU
-or kernel FPU emulation. Note that many common MIPS-based routers lack an FPU and
-have firmware that doesn't enable kernel FPU emulation; Go won't run on such machines.
-</p>
-
-<p>
-On DragonFly BSD, Go now requires DragonFly 4.4.4 or later. <!-- CL 29491, CL 29971 -->
-</p>
-
-<p>
-On OpenBSD, Go now requires OpenBSD 5.9 or later. <!-- CL 34093 -->
-</p>
-
-<p>
-The Plan 9 port's networking support is now much more complete
-and matches the behavior of Unix and Windows with respect to deadlines
-and cancelation. For Plan 9 kernel requirements, see the
-<a href="https://golang.org/wiki/Plan9">Plan 9 wiki page</a>.
-</p>
-
-<p>
- Go 1.8 now only supports OS X 10.8 or later. This is likely the last
- Go release to support 10.8. Compiling Go or running
- binaries on older OS X versions is untested.
-</p>
-
-<p>
- Go 1.8 will be the last release to support Linux on ARMv5E and ARMv6 processors:
- Go 1.9 will likely require the ARMv6K (as found in the Raspberry Pi 1) or later.
- To identify whether a Linux system is ARMv6K or later, run
- “<code>go</code> <code>tool</code> <code>dist</code> <code>-check-armv6k</code>”
- (to facilitate testing, it is also possible to just copy the <code>dist</code> command to the
- system without installing a full copy of Go 1.8)
- and if the program terminates with output "ARMv6K supported." then the system
- implements ARMv6K or later.
- Go on non-Linux ARM systems already requires ARMv6K or later.
-</p>
-
-
-<h3 id="known_issues">Known Issues</h3>
-
-<p>
-There are some instabilities on FreeBSD and NetBSD that are known but not understood.
-These can lead to program crashes in rare cases.
-See
-<a href="https://golang.org/issue/15658">issue 15658</a> and
-<a href="https://golang.org/issue/16511">issue 16511</a>.
-Any help in solving these issues would be appreciated.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="cmd_asm">Assembler</h3>
-
-<p>
-For 64-bit x86 systems, the following instructions have been added:
-<code>VBROADCASTSD</code>,
-<code>BROADCASTSS</code>,
-<code>MOVDDUP</code>,
-<code>MOVSHDUP</code>,
-<code>MOVSLDUP</code>,
-<code>VMOVDDUP</code>,
-<code>VMOVSHDUP</code>, and
-<code>VMOVSLDUP</code>.
-</p>
-
-<p>
-For 64-bit PPC systems, the common vector scalar instructions have been
-added:
-<code>LXS</code>,
-<code>LXSDX</code>,
-<code>LXSI</code>,
-<code>LXSIWAX</code>,
-<code>LXSIWZX</code>,
-<code>LXV</code>,
-<code>LXVD2X</code>,
-<code>LXVDSX</code>,
-<code>LXVW4X</code>,
-<code>MFVSR</code>,
-<code>MFVSRD</code>,
-<code>MFVSRWZ</code>,
-<code>MTVSR</code>,
-<code>MTVSRD</code>,
-<code>MTVSRWA</code>,
-<code>MTVSRWZ</code>,
-<code>STXS</code>,
-<code>STXSDX</code>,
-<code>STXSI</code>,
-<code>STXSIWX</code>,
-<code>STXV</code>,
-<code>STXVD2X</code>,
-<code>STXVW4X</code>,
-<code>XSCV</code>,
-<code>XSCVDPSP</code>,
-<code>XSCVDPSPN</code>,
-<code>XSCVDPSXDS</code>,
-<code>XSCVDPSXWS</code>,
-<code>XSCVDPUXDS</code>,
-<code>XSCVDPUXWS</code>,
-<code>XSCVSPDP</code>,
-<code>XSCVSPDPN</code>,
-<code>XSCVSXDDP</code>,
-<code>XSCVSXDSP</code>,
-<code>XSCVUXDDP</code>,
-<code>XSCVUXDSP</code>,
-<code>XSCVX</code>,
-<code>XSCVXP</code>,
-<code>XVCV</code>,
-<code>XVCVDPSP</code>,
-<code>XVCVDPSXDS</code>,
-<code>XVCVDPSXWS</code>,
-<code>XVCVDPUXDS</code>,
-<code>XVCVDPUXWS</code>,
-<code>XVCVSPDP</code>,
-<code>XVCVSPSXDS</code>,
-<code>XVCVSPSXWS</code>,
-<code>XVCVSPUXDS</code>,
-<code>XVCVSPUXWS</code>,
-<code>XVCVSXDDP</code>,
-<code>XVCVSXDSP</code>,
-<code>XVCVSXWDP</code>,
-<code>XVCVSXWSP</code>,
-<code>XVCVUXDDP</code>,
-<code>XVCVUXDSP</code>,
-<code>XVCVUXWDP</code>,
-<code>XVCVUXWSP</code>,
-<code>XVCVX</code>,
-<code>XVCVXP</code>,
-<code>XXLAND</code>,
-<code>XXLANDC</code>,
-<code>XXLANDQ</code>,
-<code>XXLEQV</code>,
-<code>XXLNAND</code>,
-<code>XXLNOR</code>,
-<code>XXLOR</code>,
-<code>XXLORC</code>,
-<code>XXLORQ</code>,
-<code>XXLXOR</code>,
-<code>XXMRG</code>,
-<code>XXMRGHW</code>,
-<code>XXMRGLW</code>,
-<code>XXPERM</code>,
-<code>XXPERMDI</code>,
-<code>XXSEL</code>,
-<code>XXSI</code>,
-<code>XXSLDWI</code>,
-<code>XXSPLT</code>, and
-<code>XXSPLTW</code>.
-</p>
-
-<h3 id="tool_yacc">Yacc</h3>
-
-<p> <!-- CL 27324, CL 27325 -->
-The <code>yacc</code> tool (previously available by running
-“<code>go</code> <code>tool</code> <code>yacc</code>”) has been removed.
-As of Go 1.7 it was no longer used by the Go compiler.
-It has moved to the “tools” repository and is now available at
-<code><a href="https://godoc.org/golang.org/x/tools/cmd/goyacc">golang.org/x/tools/cmd/goyacc</a></code>.
-</p>
-
-<h3 id="tool_fix">Fix</h3>
-
-<p> <!-- CL 28872 -->
- The <code>fix</code> tool has a new “<code>context</code>”
- fix to change imports from “<code>golang.org/x/net/context</code>”
- to “<a href="/pkg/context/"><code>context</code></a>”.
-</p>
-
-<h3 id="tool_pprof">Pprof</h3>
-
-<p> <!-- CL 33157 -->
- The <code>pprof</code> tool can now profile TLS servers
- and skip certificate validation by using the “<code>https+insecure</code>”
- URL scheme.
-</p>
-
-<p> <!-- CL 23781 -->
- The callgrind output now has instruction-level granularity.
-</p>
-
-<h3 id="tool_trace">Trace</h3>
-
-<p> <!-- CL 23324 -->
- The <code>trace</code> tool has a new <code>-pprof</code> flag for
- producing pprof-compatible blocking and latency profiles from an
- execution trace.
-</p>
-
-<p> <!-- CL 30017, CL 30702 -->
- Garbage collection events are now shown more clearly in the
- execution trace viewer. Garbage collection activity is shown on its
- own row and GC helper goroutines are annotated with their roles.
-</p>
-
-<h3 id="tool_vet">Vet</h3>
-
-<p>Vet is stricter in some ways and looser where it
- previously caused false positives.</p>
-
-<p>Vet now checks for copying an array of locks,
- duplicate JSON and XML struct field tags,
- non-space-separated struct tags,
- deferred calls to HTTP <code>Response.Body.Close</code>
- before checking errors, and
- indexed arguments in <code>Printf</code>.
- It also improves existing checks.</p>
-</p>
-
-<h3 id="compiler">Compiler Toolchain</h3>
-
-<p>
-Go 1.7 introduced a new compiler back end for 64-bit x86 systems.
-In Go 1.8, that back end has been developed further and is now used for
-all architectures.
-</p>
-
-<p>
-The new back end, based on
-<a href="https://en.wikipedia.org/wiki/Static_single_assignment_form">static single assignment form</a> (SSA),
-generates more compact, more efficient code
-and provides a better platform for optimizations
-such as bounds check elimination.
-The new back end reduces the CPU time required by
-<a href="https://golang.org/test/bench/go1/">our benchmark programs</a> by 20-30%
-on 32-bit ARM systems. For 64-bit x86 systems, which already used the SSA back end in
-Go 1.7, the gains are a more modest 0-10%. Other architectures will likely
-see improvements closer to the 32-bit ARM numbers.
-</p>
-
-<p>
- The temporary <code>-ssa=0</code> compiler flag introduced in Go 1.7
- to disable the new back end has been removed in Go 1.8.
-</p>
-
-<p>
- In addition to enabling the new compiler back end for all systems,
- Go 1.8 also introduces a new compiler front end. The new compiler
- front end should not be noticeable to users but is the foundation for
- future performance work.
-</p>
-
-<p>
- The compiler and linker have been optimized and run faster in this
- release than in Go 1.7, although they are still slower than we would
- like and will continue to be optimized in future releases.
- Compared to the previous release, Go 1.8 is
- <a href="https://dave.cheney.net/2016/11/19/go-1-8-toolchain-improvements">about 15% faster</a>.
-</p>
-
-<h3 id="cmd_cgo">Cgo</h3>
-
-<p> <!-- CL 31141 -->
-The Go tool now remembers the value of the <code>CGO_ENABLED</code> environment
-variable set during <code>make.bash</code> and applies it to all future compilations
-by default to fix issue <a href="https://golang.org/issue/12808">#12808</a>.
-When doing native compilation, it is rarely necessary to explicitly set
-the <code>CGO_ENABLED</code> environment variable as <code>make.bash</code>
-will detect the correct setting automatically. The main reason to explicitly
-set the <code>CGO_ENABLED</code> environment variable is when your environment
-supports cgo, but you explicitly do not want cgo support, in which case, set
-<code>CGO_ENABLED=0</code> during <code>make.bash</code> or <code>all.bash</code>.
-</p>
-
-<p> <!-- CL 29991 -->
-The environment variable <code>PKG_CONFIG</code> may now be used to
-set the program to run to handle <code>#cgo</code> <code>pkg-config</code>
-directives. The default is <code>pkg-config</code>, the program
-always used by earlier releases. This is intended to make it easier
-to cross-compile
-<a href="/cmd/cgo/">cgo</a> code.
-</p>
-
-<p> <!-- CL 32354 -->
-The <a href="/cmd/cgo/">cgo</a> tool now supports a <code>-srcdir</code>
-option, which is used by the <a href="/cmd/go/">go</a> command.
-</p>
-
-<p> <!-- CL 31768, 31811 -->
-If <a href="/cmd/cgo/">cgo</a> code calls <code>C.malloc</code>, and
-<code>malloc</code> returns <code>NULL</code>, the program will now
-crash with an out of memory error.
-<code>C.malloc</code> will never return <code>nil</code>.
-Unlike most C functions, <code>C.malloc</code> may not be used in a
-two-result form returning an errno value.
-</p>
-
-<p> <!-- CL 33237 -->
-If <a href="/cmd/cgo/">cgo</a> is used to call a C function passing a
-pointer to a C union, and if the C union can contain any pointer
-values, and if <a href="/cmd/cgo/#hdr-Passing_pointers">cgo pointer
-checking</a> is enabled (as it is by default), the union value is now
-checked for Go pointers.
-</p>
-
-<h3 id="gccgo">Gccgo</h3>
-
-<p>
-Due to the alignment of Go's semiannual release schedule with GCC's
-annual release schedule,
-GCC release 6 contains the Go 1.6.1 version of gccgo.
-We expect that the next release, GCC 7, will contain the Go 1.8
-version of gccgo.
-</p>
-
-<h3 id="gopath">Default GOPATH</h3>
-
-<p>
- The
- <a href="/cmd/go/#hdr-GOPATH_environment_variable"><code>GOPATH</code>
- environment variable</a> now has a default value if it
- is unset. It defaults to
- <code>$HOME/go</code> on Unix and
- <code>%USERPROFILE%/go</code> on Windows.
-</p>
-
-<h3 id="go_get">Go get</h3>
-
-<p> <!-- CL 34818 -->
- The “<code>go</code> <code>get</code>” command now always respects
- HTTP proxy environment variables, regardless of whether
- the <code style='white-space:nowrap'>-insecure</code> flag is used. In previous releases, the
- <code style='white-space:nowrap'>-insecure</code> flag had the side effect of not using proxies.
-</p>
-
-<h3 id="go_bug">Go bug</h3>
-
-<p>
- The new
- “<a href="/cmd/go/#hdr-Print_information_for_bug_reports"><code>go</code> <code>bug</code></a>”
- command starts a bug report on GitHub, prefilled
- with information about the current system.
-</p>
-
-<h3 id="cmd_doc">Go doc</h3>
-
-<p> <!-- CL 25419 -->
- The
- “<a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol"><code>go</code> <code>doc</code></a>”
- command now groups constants and variables with their type,
- following the behavior of
- <a href="/cmd/godoc/"><code>godoc</code></a>.
-</p>
-
-<p> <!-- CL 25420 -->
- In order to improve the readability of <code>doc</code>'s
- output, each summary of the first-level items is guaranteed to
- occupy a single line.
-</p>
-
-<p> <!-- CL 31852 -->
- Documentation for a specific method in an interface definition can
- now be requested, as in
- “<code>go</code> <code>doc</code> <code>net.Conn.SetDeadline</code>”.
-</p>
-
-<h3 id="plugin">Plugins</h3>
-
-<p>
- Go now provides early support for plugins with a “<code>plugin</code>”
- build mode for generating plugins written in Go, and a
- new <a href="/pkg/plugin/"><code>plugin</code></a> package for
- loading such plugins at run time. Plugin support is currently only
- available on Linux. Please report any issues.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<h3 id="liveness">Argument Liveness</h3>
-
-<p>
- <!-- Issue 15843 --> The garbage collector no longer considers
- arguments live throughout the entirety of a function. For more
- information, and for how to force a variable to remain live, see
- the <a href="/pkg/runtime/#KeepAlive"><code>runtime.KeepAlive</code></a>
- function added in Go 1.7.
-</p>
-
-<p>
- <i>Updating:</i>
- Code that sets a finalizer on an allocated object may need to add
- calls to <code>runtime.KeepAlive</code> in functions or methods
- using that object.
- Read the
- <a href="/pkg/runtime/#KeepAlive"><code>KeepAlive</code>
- documentation</a> and its example for more details.
-</p>
-
-<h3 id="mapiter">Concurrent Map Misuse</h3>
-
-<p>
-In Go 1.6, the runtime
-<a href="/doc/go1.6#runtime">added lightweight,
-best-effort detection of concurrent misuse of maps</a>. This release
-improves that detector with support for detecting programs that
-concurrently write to and iterate over a map.
-</p>
-<p>
-As always, if one goroutine is writing to a map, no other goroutine should be
-reading (which includes iterating) or writing the map concurrently.
-If the runtime detects this condition, it prints a diagnosis and crashes the program.
-The best way to find out more about the problem is to run the program
-under the
-<a href="https://blog.golang.org/race-detector">race detector</a>,
-which will more reliably identify the race
-and give more detail.
-</p>
-
-<h3 id="memstats">MemStats Documentation</h3>
-
-<p> <!-- CL 28972 -->
- The <a href="/pkg/runtime/#MemStats"><code>runtime.MemStats</code></a>
- type has been more thoroughly documented.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
-As always, the changes are so general and varied that precise statements
-about performance are difficult to make.
-Most programs should run a bit faster,
-due to speedups in the garbage collector and
-optimizations in the standard library.
-</p>
-
-<p>
-There have been optimizations to implementations in the
-<a href="/pkg/bytes/"><code>bytes</code></a>,
-<a href="/pkg/crypto/aes/"><code>crypto/aes</code></a>,
-<a href="/pkg/crypto/cipher/"><code>crypto/cipher</code></a>,
-<a href="/pkg/crypto/elliptic/"><code>crypto/elliptic</code></a>,
-<a href="/pkg/crypto/sha256/"><code>crypto/sha256</code></a>,
-<a href="/pkg/crypto/sha512/"><code>crypto/sha512</code></a>,
-<a href="/pkg/encoding/asn1/"><code>encoding/asn1</code></a>,
-<a href="/pkg/encoding/csv/"><code>encoding/csv</code></a>,
-<a href="/pkg/encoding/hex/"><code>encoding/hex</code></a>,
-<a href="/pkg/encoding/json/"><code>encoding/json</code></a>,
-<a href="/pkg/hash/crc32/"><code>hash/crc32</code></a>,
-<a href="/pkg/image/color/"><code>image/color</code></a>,
-<a href="/pkg/image/draw/"><code>image/draw</code></a>,
-<a href="/pkg/math/"><code>math</code></a>,
-<a href="/pkg/math/big/"><code>math/big</code></a>,
-<a href="/pkg/reflect/"><code>reflect</code></a>,
-<a href="/pkg/regexp/"><code>regexp</code></a>,
-<a href="/pkg/runtime/"><code>runtime</code></a>,
-<a href="/pkg/strconv/"><code>strconv</code></a>,
-<a href="/pkg/strings/"><code>strings</code></a>,
-<a href="/pkg/syscall/"><code>syscall</code></a>,
-<a href="/pkg/text/template/"><code>text/template</code></a>, and
-<a href="/pkg/unicode/utf8/"><code>unicode/utf8</code></a>
-packages.
-</p>
-
-<h3 id="gc">Garbage Collector</h3>
-
-<p>
- Garbage collection pauses should be significantly shorter than they
- were in Go 1.7, usually under 100 microseconds and often as low as
- 10 microseconds.
- See the
- <a href="https://github.com/golang/proposal/blob/master/design/17503-eliminate-rescan.md"
- >document on eliminating stop-the-world stack re-scanning</a>
- for details. More work remains for Go 1.9.
-</p>
-
-<h3 id="defer">Defer</h3>
-
-<!-- CL 29656, CL 29656 -->
-<p>
- The overhead of <a href="/ref/spec/#Defer_statements">deferred
- function calls</a> has been reduced by about half.
-</p>
-
-<h3 id="cgoperf">Cgo</h3>
-
-<p>The overhead of calls from Go into C has been reduced by about half.</p>
-
-<h2 id="library">Standard library</h2>
-
-<h3 id="examples">Examples</h3>
-
-<p>
-Examples have been added to the documentation across many packages.
-</p>
-
-<h3 id="sort_slice">Sort</h3>
-
-<p>
-The <a href="/pkg/sort/">sort</a> package
-now includes a convenience function
-<a href="/pkg/sort/#Slice"><code>Slice</code></a> to sort a
-slice given a <em>less</em> function.
-
-In many cases this means that writing a new sorter type is not
-necessary.
-</p>
-
-<p>
-Also new are
-<a href="/pkg/sort/#SliceStable"><code>SliceStable</code></a> and
-<a href="/pkg/sort/#SliceIsSorted"><code>SliceIsSorted</code></a>.
-</p>
-
-<h3 id="h2push">HTTP/2 Push</h3>
-
-<p>
-The <a href="/pkg/net/http/">net/http</a> package now includes a
-mechanism to
-send HTTP/2 server pushes from a
-<a href="/pkg/net/http/#Handler"><code>Handler</code></a>.
-Similar to the existing <code>Flusher</code> and <code>Hijacker</code>
-interfaces, an HTTP/2
-<a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>
-now implements the new
-<a href="/pkg/net/http/#Pusher"><code>Pusher</code></a> interface.
-</p>
-
-<h3 id="http_shutdown">HTTP Server Graceful Shutdown</h3>
-
-<p> <!-- CL 32329 -->
- The HTTP Server now has support for graceful shutdown using the new
- <a href="/pkg/net/http/#Server.Shutdown"><code>Server.Shutdown</code></a>
- method and abrupt shutdown using the new
- <a href="/pkg/net/http/#Server.Close"><code>Server.Close</code></a>
- method.
-</p>
-
-<h3 id="more_context">More Context Support</h3>
-
-<p>
- Continuing <a href="/doc/go1.7#context">Go 1.7's adoption</a>
- of <a href="/pkg/context/#Context"><code>context.Context</code></a>
- into the standard library, Go 1.8 adds more context support
- to existing packages:
-</p>
-
-<ul>
- <li>The new <a href="/pkg/net/http/#Server.Shutdown"><code>Server.Shutdown</code></a>
- takes a context argument.</li>
- <li>There have been <a href="#database_sql">significant additions</a> to the
- <a href="/pkg/database/sql/">database/sql</a> package with context support.</li>
- <li>All nine of the new <code>Lookup</code> methods on the new
- <a href="/pkg/net/#Resolver"><code>net.Resolver</code></a> now
- take a context.</li>
- </ul>
-
-<h3 id="mutex_prof">Mutex Contention Profiling</h3>
-
-<p>
- The runtime and tools now support profiling contended mutexes.
-</p>
-
-<p>
- Most users will want to use the new <code>-mutexprofile</code>
- flag with “<a href="/cmd/go/#hdr-Description_of_testing_flags"><code>go</code> <code>test</code></a>”,
- and then use <a href="/cmd/pprof/">pprof</a> on the resultant file.
-</p>
-
-<p>
- Lower-level support is also available via the new
- <a href="/pkg/runtime/#MutexProfile"><code>MutexProfile</code></a>
- and
- <a href="/pkg/runtime/#SetMutexProfileFraction"><code>SetMutexProfileFraction</code></a>.
-</p>
-
-<p>
- A known limitation for Go 1.8 is that the profile only reports contention for
- <a href="/pkg/sync/#Mutex"><code>sync.Mutex</code></a>,
- not
- <a href="/pkg/sync/#RWMutex"><code>sync.RWMutex</code></a>.
-</p>
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
-As always, there are various minor changes and updates to the library,
-made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
-in mind. The following sections list the user visible changes and additions.
-Optimizations and minor bug fixes are not listed.
-</p>
-
-<dl id="archive_tar"><dt><a href="/pkg/archive/tar/">archive/tar</a></dt>
- <dd>
-
- <p> <!-- CL 28471, CL 31440, CL 31441, CL 31444, CL 28418, CL 31439 -->
- The tar implementation corrects many bugs in corner cases of the file format.
- The <a href="/pkg/archive/tar/#Reader"><code>Reader</code></a>
- is now able to process tar files in the PAX format with entries larger than 8GB.
- The <a href="/pkg/archive/tar/#Writer"><code>Writer</code></a>
- no longer produces invalid tar files in some situations involving long pathnames.
- </p>
-
- </dd>
-</dl>
-
-<dl id="compress_flate"><dt><a href="/pkg/compress/flate/">compress/flate</a></dt>
- <dd>
-
- <p> <!-- CL 31640, CL 31174, CL 32149 -->
- There have been some minor fixes to the encoder to improve the
- compression ratio in certain situations. As a result, the exact
- encoded output of <code>DEFLATE</code> may be different from Go 1.7. Since
- <code>DEFLATE</code> is the underlying compression of gzip, png, zlib, and zip,
- those formats may have changed outputs.
- </p>
-
- <p> <!-- CL 31174 -->
- The encoder, when operating in
- <a href="/pkg/compress/flate/#NoCompression"><code>NoCompression</code></a>
- mode, now produces a consistent output that is not dependent on
- the size of the slices passed to the
- <a href="/pkg/compress/flate/#Writer.Write"><code>Write</code></a>
- method.
- </p>
-
- <p> <!-- CL 28216 -->
- The decoder, upon encountering an error, now returns any
- buffered data it had uncompressed along with the error.
- </p>
-
- </dd>
-</dl>
-
-
-<dl id="compress_gzip"><dt><a href="/pkg/compress/gzip/">compress/gzip</a></dt>
- <dd>
-
- <p>
- The <a href="/pkg/compress/gzip/#Writer"><code>Writer</code></a>
- now encodes a zero <code>MTIME</code> field when
- the <a href="/pkg/compress/gzip/#Header"><code>Header.ModTime</code></a>
- field is the zero value.
-
- In previous releases of Go, the <code>Writer</code> would encode
- a nonsensical value.
-
- Similarly,
- the <a href="/pkg/compress/gzip/#Reader"><code>Reader</code></a>
- now reports a zero encoded <code>MTIME</code> field as a zero
- <code>Header.ModTime</code>.
- </p>
-
- </dd>
-</dl>
-
-<dl id="context"><dt><a href="/pkg/context/">context</a></dt>
- <dd>
- <p> <!-- CL 30370 -->
- The <a href="/pkg/context#DeadlineExceeded"><code>DeadlineExceeded</code></a>
- error now implements
- <a href="/pkg/net/#Error"><code>net.Error</code></a>
- and reports true for both the <code>Timeout</code> and
- <code>Temporary</code> methods.
- </p>
- </dd>
-</dl>
-
-<dl id="crypto_tls"><dt><a href="/pkg/crypto/tls/">crypto/tls</a></dt>
- <dd>
- <p> <!-- CL 25159, CL 31318 -->
- The new method
- <a href="/pkg/crypto/tls/#Conn.CloseWrite"><code>Conn.CloseWrite</code></a>
- allows TLS connections to be half closed.
- </p>
-
- <p> <!-- CL 28075 -->
- The new method
- <a href="/pkg/crypto/tls/#Config.Clone"><code>Config.Clone</code></a>
- clones a TLS configuration.
- </p>
-
- <p>
- <!-- CL 30790 -->
- The new <a href="/pkg/crypto/tls/#Config.GetConfigForClient"><code>Config.GetConfigForClient</code></a>
- callback allows selecting a configuration for a client dynamically, based
- on the client's
- <a href="/pkg/crypto/tls/#ClientHelloInfo"><code>ClientHelloInfo</code></a>.
-
- <!-- CL 31391, CL 32119 -->
- The <a href="/pkg/crypto/tls/#ClientHelloInfo"><code>ClientHelloInfo</code></a>
- struct now has new
- fields <code>Conn</code>, <code>SignatureSchemes</code> (using
- the new
- type <a href="/kg/crypto/tls/#SignatureScheme"><code>SignatureScheme</code></a>),
- <code>SupportedProtos</code>, and <code>SupportedVersions</code>.
- </p>
-
- <p> <!-- CL 32115 -->
- The new <a href="/pkg/crypto/tls/#Config.GetClientCertificate"><code>Config.GetClientCertificate</code></a>
- callback allows selecting a client certificate based on the server's
- TLS <code>CertificateRequest</code> message, represented by the new
- <a href="/pkg/crypto/tls/#CertificateRequestInfo"><code>CertificateRequestInfo</code></a>.
- </p>
-
- <p> <!-- CL 27434 -->
- The new
- <a href="/pkg/crypto/tls/#Config.KeyLogWriter"><code>Config.KeyLogWriter</code></a>
- allows debugging TLS connections
- in <a href="https://www.wireshark.org/">WireShark</a> and
- similar tools.
- </p>
-
- <p> <!-- CL 32115 -->
- The new
- <a href="/pkg/crypto/tls/#Config.VerifyPeerCertificate"><code>Config.VerifyPeerCertificate</code></a>
- callback allows additional validation of a peer's presented certificate.
- </p>
-
- <p> <!-- CL 18130 -->
- The <code>crypto/tls</code> package now implements basic
- countermeasures against CBC padding oracles. There should be
- no explicit secret-dependent timings, but it does not attempt to
- normalize memory accesses to prevent cache timing leaks.
- </p>
-
- <p>
- The <code>crypto/tls</code> package now supports
- X25519 and <!-- CL 30824, CL 30825 -->
- ChaCha20-Poly1305. <!-- CL 30957, CL 30958 -->
- ChaCha20-Poly1305 is now prioritized unless <!-- CL 32871 -->
- hardware support for AES-GCM is present.
- </p>
-
- <p> <!-- CL 27315, CL 35290 -->
- AES-128-CBC cipher suites with SHA-256 are also
- now supported, but disabled by default.
- </p>
-
- </dd>
-</dl>
-
-<dl id="crypto_x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p> <!-- CL 24743 -->
- PSS signatures are now supported.
- </p>
-
- <p> <!-- CL 32644 -->
- <a href="/pkg/crypto/x509/#UnknownAuthorityError"><code>UnknownAuthorityError</code></a>
- now has a <code>Cert</code> field, reporting the untrusted
- certificate.
- </p>
-
- <p>
- Certificate validation is more permissive in a few cases and
- stricter in a few other cases.
- <!--
-crypto/x509: allow a leaf certificate to be specified directly as root (CL 27393)
-crypto/x509: check that the issuer name matches the issuer's subject name (CL 23571)
-crypto/x509: don't accept a root that already appears in a chain. (CL 32121)
-crypto/x509: fix name constraints handling (CL 30155)
-crypto/x509: parse all names in an RDN (CL 30810)
-crypto/x509: recognise ISO OID for RSA+SHA1 (CL 27394)
-crypto/x509: require a NULL parameters for RSA public keys (CL 16166, CL 27312)
-crypto/x509: return error for missing SerialNumber (CL 27238)
--->
- </p>
-
- <p><!-- CL 30375 -->
- Root certificates will now also be looked for
- at <code>/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem</code>
- on Linux, to support RHEL and CentOS.
- </p>
-
- </dd>
-</dl>
-
-<dl id="database_sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
- <dd>
- <p>
- The package now supports <code>context.Context</code>. There are new methods
- ending in <code>Context</code> such as
- <a href="/pkg/database/sql/#DB.QueryContext"><code>DB.QueryContext</code></a> and
- <a href="/pkg/database/sql/#DB.PrepareContext"><code>DB.PrepareContext</code></a>
- that take context arguments. Using the new <code>Context</code> methods ensures that
- connections are closed and returned to the connection pool when the
- request is done; enables canceling in-progress queries
- should the driver support that; and allows the database
- pool to cancel waiting for the next available connection.
- </p>
- <p>
- The <a href="/pkg/database/sql#IsolationLevel"><code>IsolationLevel</code></a>
- can now be set when starting a transaction by setting the isolation level
- on <a href="/pkg/database/sql#TxOptions.Isolation"><code>TxOptions.Isolation</code></a> and passing
- it to <a href="/pkg/database/sql#DB.BeginTx"><code>DB.BeginTx</code></a>.
- An error will be returned if an isolation level is selected that the driver
- does not support. A read-only attribute may also be set on the transaction
- by setting <a href="/pkg/database/sql/#TxOptions.ReadOnly"><code>TxOptions.ReadOnly</code></a>
- to true.
- </p>
- <p>
- Queries now expose the SQL column type information for drivers that support it.
- Rows can return <a href="/pkg/database/sql#Rows.ColumnTypes"><code>ColumnTypes</code></a>
- which can include SQL type information, column type lengths, and the Go type.
- </p>
- <p>
- A <a href="/pkg/database/sql/#Rows"><code>Rows</code></a>
- can now represent multiple result sets. After
- <a href="/pkg/database/sql/#Rows.Next"><code>Rows.Next</code></a> returns false,
- <a href="/pkg/database/sql/#Rows.NextResultSet"><code>Rows.NextResultSet</code></a>
- may be called to advance to the next result set. The existing <code>Rows</code>
- should continue to be used after it advances to the next result set.
- </p>
- <p>
- <a href="/pkg/database/sql/#NamedArg"><code>NamedArg</code></a> may be used
- as query arguments. The new function <a href="/pkg/database/sql/#Named"><code>Named</code></a>
- helps create a <a href="/pkg/database/sql/#NamedArg"><code>NamedArg</code></a>
- more succinctly.
- <p>
- If a driver supports the new
- <a href="/pkg/database/sql/driver/#Pinger"><code>Pinger</code></a>
- interface, the
- <a href="/pkg/database/sql/#DB.Ping"><code>DB.Ping</code></a>
- and
- <a href="/pkg/database/sql/#DB.PingContext"><code>DB.PingContext</code></a>
- methods will use that interface to check whether a
- database connection is still valid.
- </p>
- <p>
- The new <code>Context</code> query methods work for all drivers, but
- <code>Context</code> cancelation is not responsive unless the driver has been
- updated to use them. The other features require driver support in
- <a href="/pkg/database/sql/driver"><code>database/sql/driver</code></a>.
- Driver authors should review the new interfaces. Users of existing
- driver should review the driver documentation to see what
- it supports and any system specific documentation on each feature.
- </p>
- </dd>
-</dl>
-
-<dl id="debug_pe"><dt><a href="/pkg/debug/pe/">debug/pe</a></dt>
- <dd>
- <p> <!-- CL 22720, CL 27212, CL 22181, CL 22332, CL 22336, Issue 15345 -->
- The package has been extended and is now used by
- <a href="/cmd/link/">the Go linker</a> to read <code>gcc</code>-generated object files.
- The new
- <a href="/pkg/debug/pe/#File.StringTable"><code>File.StringTable</code></a>
- and
- <a href="/pkg/debug/pe/#Section.Relocs"><code>Section.Relocs</code></a>
- fields provide access to the COFF string table and COFF relocations.
- The new
- <a href="/pkg/debug/pe/#File.COFFSymbols"><code>File.COFFSymbols</code></a>
- allows low-level access to the COFF symbol table.
- </p>
- </dd>
-</dl>
-
-<dl id="encoding_base64"><dt><a href="/pkg/encoding/base64/">encoding/base64</a></dt>
- <dd>
- <p> <!-- CL 24964 -->
- The new
- <a href="/pkg/encoding/base64/#Encoding.Strict"><code>Encoding.Strict</code></a>
- method returns an <code>Encoding</code> that causes the decoder
- to return an error when the trailing padding bits are not zero.
- </p>
- </dd>
-</dl>
-
-<dl id="encoding_binary"><dt><a href="/pkg/encoding/binary/">encoding/binary</a></dt>
- <dd>
- <p> <!-- CL 28514 -->
- <a href="/pkg/encoding/binary/#Read"><code>Read</code></a>
- and
- <a href="/pkg/encoding/binary/#Write"><code>Write</code></a>
- now support booleans.
- </p>
- </dd>
-</dl>
-
-<dl id="encoding_json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
- <dd>
-
- <p> <!-- CL 18692 -->
- <a href="/pkg/encoding/json/#UnmarshalTypeError"><code>UnmarshalTypeError</code></a>
- now includes the struct and field name.
- </p>
-
- <p> <!-- CL 31932 -->
- A nil <a href="/pkg/encoding/json/#Marshaler"><code>Marshaler</code></a>
- now marshals as a JSON <code>null</code> value.
- </p>
-
- <p> <!-- CL 21811 -->
- A <a href="/pkg/encoding/json/#RawMessage"><code>RawMessage</code></a> value now
- marshals the same as its pointer type.
- </p>
-
- <p> <!-- CL 30371 -->
- <a href="/pkg/encoding/json/#Marshal"><code>Marshal</code></a>
- encodes floating-point numbers using the same format as in ES6,
- preferring decimal (not exponential) notation for a wider range of values.
- In particular, all floating-point integers up to 2<sup>64</sup> format the
- same as the equivalent <code>int64</code> representation.
- </p>
-
- <p> <!-- CL 30944 -->
- In previous versions of Go, unmarshaling a JSON <code>null</code> into an
- <a href="/pkg/encoding/json/#Unmarshaler"><code>Unmarshaler</code></a>
- was considered a no-op; now the <code>Unmarshaler</code>'s
- <code>UnmarshalJSON</code> method is called with the JSON literal
- <code>null</code> and can define the semantics of that case.
- </p>
-
- </dd>
-</dl>
-
-<dl id="encoding_pem"><dt><a href="/pkg/encoding/pem/">encoding/pem</a></dt>
- <dd>
- <p> <!-- CL 27391 -->
- <a href="/pkg/encoding/pem/#Decode"><code>Decode</code></a>
- is now strict about the format of the ending line.
- </p>
- </dd>
-</dl>
-
-<dl id="encoding_xml"><dt><a href="/pkg/encoding/xml/">encoding/xml</a></dt>
- <dd>
- <p> <!-- CL 30946 -->
- <a href="/pkg/encoding/xml/#Unmarshal"><code>Unmarshal</code></a>
- now has wildcard support for collecting all attributes using
- the new <code>",any,attr"</code> struct tag.
- </p>
- </dd>
-</dl>
-
-<dl id="expvar"><dt><a href="/pkg/expvar/">expvar</a></dt>
- <dd>
- <p> <!-- CL 30917 -->
- The new methods
- <a href="/pkg/expvar/#Int.Value"><code>Int.Value</code></a>,
- <a href="/pkg/expvar/#String.Value"><code>String.Value</code></a>,
- <a href="/pkg/expvar/#Float.Value"><code>Float.Value</code></a>, and
- <a href="/pkg/expvar/#Func.Value"><code>Func.Value</code></a>
- report the current value of an exported variable.
- </p>
-
- <p> <!-- CL 24722 -->
- The new
- function <a href="/pkg/expvar/#Handler"><code>Handler</code></a>
- returns the package's HTTP handler, to enable installing it in
- non-standard locations.
- </p>
- </dd>
-</dl>
-
-<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
- <dd>
- <p><!-- CL 30611 -->
- <a href="/pkg/fmt/#Scanf"><code>Scanf</code></a>,
- <a href="/pkg/fmt/#Fscanf"><code>Fscanf</code></a>, and
- <a href="/pkg/fmt/#Sscanf"><code>Sscanf</code></a> now
- handle spaces differently and more consistently than
- previous releases. See the
- <a href="/pkg/fmt/#hdr-Scanning">scanning documentation</a>
- for details.
- </p>
- </dd>
-</dl>
-
-<dl id="go_doc"><dt><a href="/pkg/go/doc/">go/doc</a></dt>
- <dd>
- <p><!-- CL 29870 -->
- The new <a href="/pkg/go/doc/#IsPredeclared"><code>IsPredeclared</code></a>
- function reports whether a string is a predeclared identifier.
- </p>
- </dd>
-</dl>
-
-<dl id="go_types"><dt><a href="/pkg/go/types/">go/types</a></dt>
- <dd>
- <p><!-- CL 30715 -->
- The new function
- <a href="/pkg/go/types/#Default"><code>Default</code></a>
- returns the default "typed" type for an "untyped" type.
- </p>
-
- <p><!-- CL 31939 -->
- The alignment of <code>complex64</code> now matches
- the <a href="/cmd/compile/">Go compiler</a>.
- </p>
- </dd>
-</dl>
-
-<dl id="html_template"><dt><a href="/pkg/html/template/">html/template</a></dt>
- <dd>
- <p><!-- CL 14336 -->
- The package now validates
- the <code>"type"</code> attribute on
- a <code>&lt;script&gt;</code> tag.
- </p>
- </dd>
-</dl>
-
-<dl id="image_png"><dt><a href="/pkg/image/png/">image/png</a></dt>
- <dd>
- <p> <!-- CL 32143, CL 32140 -->
- <a href="/pkg/image/png/#Decode"><code>Decode</code></a>
- (and <code>DecodeConfig</code>)
- now supports True Color and grayscale transparency.
- </p>
- <p> <!-- CL 29872 -->
- <a href="/pkg/image/png/#Encoder"><code>Encoder</code></a>
- is now faster and creates smaller output
- when encoding paletted images.
- </p>
- </dd>
-</dl>
-
-<dl id="math_big"><dt><a href="/pkg/math/big/">math/big</a></dt>
- <dd>
- <p><!-- CL 30706 -->
- The new method
- <a href="/pkg/math/big/#Int.Sqrt"><code>Int.Sqrt</code></a>
- calculates ⌊√x⌋.
- </p>
-
- <p>
- The new method
- <a href="/pkg/math/big/#Float.Scan"><code>Float.Scan</code></a>
- is a support routine for
- <a href="/pkg/fmt/#Scanner"><code>fmt.Scanner</code></a>.
- </p>
-
- <p>
- <a href="/pkg/math/big/#Int.ModInverse"><code>Int.ModInverse</code></a>
- now supports negative numbers.
- </p>
-
- </dd>
-</dl>
-
-<dl id="math_rand"><dt><a href="/pkg/math/rand/">math/rand</a></dt>
- <dd>
-
- <p><!-- CL 27253, CL 33456 -->
- The new <a href="/pkg/math/rand/#Rand.Uint64"><code>Rand.Uint64</code></a>
- method returns <code>uint64</code> values. The
- new <a href="/pkg/math/rand/#Source64"><code>Source64</code></a>
- interface describes sources capable of generating such values
- directly; otherwise the <code>Rand.Uint64</code> method
- constructs a <code>uint64</code> from two calls
- to <a href="/pkg/math/rand/#Source"><code>Source</code></a>'s
- <code>Int63</code> method.
- </p>
-
- </dd>
-</dl>
-
-<dl id="mime"><dt><a href="/pkg/mime/">mime</a></dt>
- <dd>
- <p> <!-- CL 32175 -->
- <a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a>
- now preserves unnecessary backslash escapes as literals,
- in order to support MSIE.
- When MSIE sends a full file path (in “intranet mode”), it does not
- escape backslashes: “<code>C:\dev\go\foo.txt</code>”, not
- “<code>C:\\dev\\go\\foo.txt</code>”.
- If we see an unnecessary backslash escape, we now assume it is from MSIE
- and intended as a literal backslash.
- No known MIME generators emit unnecessary backslash escapes
- for simple token characters like numbers and letters.
- </p>
- </dd>
-</dl>
-
-<dl id="mime_quotedprintable"><dt><a href="/pkg/mime/quotedprintable/">mime/quotedprintable</a></dt>
- <dd>
-
- <p>
- The
- <a href="/pkg/mime/quotedprintable/#Reader"><code>Reader</code></a>'s
- parsing has been relaxed in two ways to accept
- more input seen in the wild.
-
- <!-- CL 32174 -->
- First, it accepts an equals sign (<code>=</code>) not followed
- by two hex digits as a literal equal sign.
-
- <!-- CL 27530 -->
- Second, it silently ignores a trailing equals sign at the end of
- an encoded input.
- </p>
-
- </dd>
-</dl>
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
-
- <p><!-- CL 30164, CL 33473 -->
- The <a href="/pkg/net/#Conn"><code>Conn</code></a> documentation
- has been updated to clarify expectations of an interface
- implementation. Updates in the <code>net/http</code> packages
- depend on implementations obeying the documentation.
- </p>
- <p><i>Updating:</i> implementations of the <code>Conn</code> interface should verify
- they implement the documented semantics. The
- <a href="https://godoc.org/golang.org/x/net/nettest">golang.org/x/net/nettest</a>
- package will exercise a <code>Conn</code> and validate it behaves properly.
- </p>
-
- <p><!-- CL 32099 -->
- The new method
- <a href="/pkg/net/#UnixListener.SetUnlinkOnClose"><code>UnixListener.SetUnlinkOnClose</code></a>
- sets whether the underlying socket file should be removed from the file system when
- the listener is closed.
- </p>
-
- <p><!-- CL 29951 -->
- The new <a href="/pkg/net/#Buffers"><code>Buffers</code></a> type permits
- writing to the network more efficiently from multiple discontiguous buffers
- in memory. On certain machines, for certain types of connections,
- this is optimized into an OS-specific batch write operation (such as <code>writev</code>).
- </p>
-
- <p><!-- CL 29440 -->
- The new <a href="/pkg/net/#Resolver"><code>Resolver</code></a> looks up names and numbers
- and supports <a href="/pkg/context/#Context"><code>context.Context</code></a>.
- The <a href="/pkg/net/#Dialer"><code>Dialer</code></a> now has an optional
- <a href="/pkg/net/#Dialer.Resolver"><code>Resolver</code> field</a>.
- </p>
-
- <p><!-- CL 29892 -->
- <a href="/pkg/net/#Interfaces"><code>Interfaces</code></a> is now supported on Solaris.
- </p>
-
- <p><!-- CL 29233, CL 24901 -->
- The Go DNS resolver now supports <code>resolv.conf</code>'s “<code>rotate</code>”
- and “<code>option</code> <code>ndots:0</code>” options. The “<code>ndots</code>” option is
- now respected in the same way as <code>libresolve</code>.
- </p>
-
- </dd>
-</dl>
-
-<dl id="net_http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
-
- <p>Server changes:</p>
- <ul>
- <li>The server now supports graceful shutdown support, <a href="#http_shutdown">mentioned above</a>.</li>
-
- <li> <!-- CL 32024 -->
- The <a href="/pkg/net/http/#Server"><code>Server</code></a>
- adds configuration options
- <code>ReadHeaderTimeout</code> and <code>IdleTimeout</code>
- and documents <code>WriteTimeout</code>.
- </li>
-
- <li> <!-- CL 32014 -->
- <a href="/pkg/net/http/#FileServer"><code>FileServer</code></a>
- and
- <a href="/pkg/net/http/#ServeContent"><code>ServeContent</code></a>
- now support HTTP <code>If-Match</code> conditional requests,
- in addition to the previous <code>If-None-Match</code>
- support for ETags properly formatted according to RFC 7232, section 2.3.
- </li>
- </ul>
-
- <p>
- There are several additions to what a server's <code>Handler</code> can do:
- </p>
-
- <ul>
- <li><!-- CL 31173 -->
- The <a href="/pkg/context/#Context"><code>Context</code></a>
- returned
- by <a href="/pkg/net/http/#Request.Context"><code>Request.Context</code></a>
- is canceled if the underlying <code>net.Conn</code>
- closes. For instance, if the user closes their browser in the
- middle of a slow request, the <code>Handler</code> can now
- detect that the user is gone. This complements the
- existing <a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a>
- support. This functionality requires that the underlying
- <a href="/pkg/net/#Conn"><code>net.Conn</code></a> implements
- <a href="#net">recently clarified interface documentation</a>.
- </li>
-
- <li><!-- CL 32479 -->
- To serve trailers produced after the header has already been written,
- see the new
- <a href="/pkg/net/http/#TrailerPrefix"><code>TrailerPrefix</code></a>
- mechanism.
- </li>
-
- <li><!-- CL 33099 -->
- A <code>Handler</code> can now abort a response by panicking
- with the error
- <a href="/pkg/net/http/#ErrAbortHandler"><code>ErrAbortHandler</code></a>.
- </li>
-
- <li><!-- CL 30812 -->
- A <code>Write</code> of zero bytes to a
- <a href="/pkg/net/http/#ResponseWriter"><code>ResponseWriter</code></a>
- is now defined as a
- way to test whether a <code>ResponseWriter</code> has been hijacked:
- if so, the <code>Write</code> returns
- <a href="/pkg/net/http/#ErrHijacked"><code>ErrHijacked</code></a>
- without printing an error
- to the server's error log.
- </li>
-
- </ul>
-
- <p>Client &amp; Transport changes:</p>
- <ul>
- <li><!-- CL 28930, CL 31435 -->
- The <a href="/pkg/net/http/#Client"><code>Client</code></a>
- now copies most request headers on redirect. See
- <a href="/pkg/net/http/#Client">the documentation</a>
- on the <code>Client</code> type for details.
- </li>
-
- <li><!-- CL 29072 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
- now supports international domain names. Consequently, so do
- <a href="/pkg/net/http/#Get">Get</a> and other helpers.
- </li>
-
- <li><!-- CL 31733, CL 29852 -->
- The <code>Client</code> now supports 301, 307, and 308 redirects.
-
- For example, <code>Client.Post</code> now follows 301
- redirects, converting them to <code>GET</code> requests
- without bodies, like it did for 302 and 303 redirect responses
- previously.
-
- The <code>Client</code> now also follows 307 and 308
- redirects, preserving the original request method and body, if
- any. If the redirect requires resending the request body, the
- request must have the new
- <a href="/pkg/net/http/#Request"><code>Request.GetBody</code></a>
- field defined.
- <a href="/pkg/net/http/#NewRequest"><code>NewRequest</code></a>
- sets <code>Request.GetBody</code> automatically for common
- body types.
- </li>
-
- <li><!-- CL 32482 -->
- The <code>Transport</code> now rejects requests for URLs with
- ports containing non-digit characters.
- </li>
-
- <li><!-- CL 27117 -->
- The <code>Transport</code> will now retry non-idempotent
- requests if no bytes were written before a network failure
- and the request has no body.
- </li>
-
- <li><!-- CL 32481 -->
- The
- new <a href="/pkg/net/http/#Transport"><code>Transport.ProxyConnectHeader</code></a>
- allows configuration of header values to send to a proxy
- during a <code>CONNECT</code> request.
- </li>
-
- <li> <!-- CL 28077 -->
- The <a href="/pkg/net/http/#DefaultTransport"><code>DefaultTransport.Dialer</code></a>
- now enables <code>DualStack</code> ("<a href="https://tools.ietf.org/html/rfc6555">Happy Eyeballs</a>") support,
- allowing the use of IPv4 as a backup if it looks like IPv6 might be
- failing.
- </li>
-
- <li> <!-- CL 31726 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
- no longer reads a byte of a non-nil
- <a href="/pkg/net/http/#Request.Body"><code>Request.Body</code></a>
- when the
- <a href="/pkg/net/http/#Request.ContentLength"><code>Request.ContentLength</code></a>
- is zero to determine whether the <code>ContentLength</code>
- is actually zero or just undefined.
- To explicitly signal that a body has zero length,
- either set it to <code>nil</code>, or set it to the new value
- <a href="/pkg/net/http/#NoBody"><code>NoBody</code></a>.
- The new <code>NoBody</code> value is intended for use by <code>Request</code>
- constructor functions; it is used by
- <a href="/pkg/net/http/#NewRequest"><code>NewRequest</code></a>.
- </li>
- </ul>
-
- </dd>
-</dl>
-
-<dl id="net_http_httptrace"><dt><a href="/pkg/net/http/httptrace/">net/http/httptrace</a></dt>
- <dd>
- <p> <!-- CL 30359 -->
- There is now support for tracing a client request's TLS handshakes with
- the new
- <a href="/pkg/net/http/httptrace/#ClientTrace.TLSHandshakeStart"><code>ClientTrace.TLSHandshakeStart</code></a>
- and
- <a href="/pkg/net/http/httptrace/#ClientTrace.TLSHandshakeDone"><code>ClientTrace.TLSHandshakeDone</code></a>.
- </p>
- </dd>
-</dl>
-
-<dl id="net_http_httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
- <dd>
- <p> <!-- CL 32356 -->
- The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
- has a new optional hook,
- <a href="/pkg/net/http/httputil/#ReverseProxy.ModifyResponse"><code>ModifyResponse</code></a>,
- for modifying the response from the back end before proxying it to the client.
- </p>
-
- </dd>
-</dl>
-
-<dl id="net_mail"><dt><a href="/pkg/net/mail/">net/mail</a></dt>
- <dd>
-
- <p> <!-- CL 32176 -->
- Empty quoted strings are once again allowed in the name part of
- an address. That is, Go 1.4 and earlier accepted
- <code>""</code> <code>&lt;gopher@example.com&gt;</code>,
- but Go 1.5 introduced a bug that rejected this address.
- The address is recognized again.
- </p>
-
- <p> <!-- CL 31581 -->
- The
- <a href="/pkg/net/mail/#Header.Date"><code>Header.Date</code></a>
- method has always provided a way to parse
- the <code>Date:</code> header.
- A new function
- <a href="/pkg/net/mail/#ParseDate"><code>ParseDate</code></a>
- allows parsing dates found in other
- header lines, such as the <code>Resent-Date:</code> header.
- </p>
-
- </dd>
-</dl>
-
-<dl id="net_smtp"><dt><a href="/pkg/net/smtp/">net/smtp</a></dt>
- <dd>
-
- <p> <!-- CL 33143 -->
- If an implementation of the
- <a href="/pkg/net/smtp/#Auth"><code>Auth.Start</code></a>
- method returns an empty <code>toServer</code> value,
- the package no longer sends
- trailing whitespace in the SMTP <code>AUTH</code> command,
- which some servers rejected.
- </p>
-
- </dd>
-</dl>
-
-<dl id="net_url"><dt><a href="/pkg/net/url/">net/url</a></dt>
- <dd>
-
- <p> <!-- CL 31322 -->
- The new functions
- <a href="/pkg/net/url/#PathEscape"><code>PathEscape</code></a>
- and
- <a href="/pkg/net/url/#PathUnescape"><code>PathUnescape</code></a>
- are similar to the query escaping and unescaping functions but
- for path elements.
- </p>
-
- <p> <!-- CL 28933 -->
- The new methods
- <a href="/pkg/net/url/#URL.Hostname"><code>URL.Hostname</code></a>
- and
- <a href="/pkg/net/url/#URL.Port"><code>URL.Port</code></a>
- return the hostname and port fields of a URL,
- correctly handling the case where the port may not be present.
- </p>
-
- <p> <!-- CL 28343 -->
- The existing method
- <a href="/pkg/net/url/#URL.ResolveReference"><code>URL.ResolveReference</code></a>
- now properly handles paths with escaped bytes without losing
- the escaping.
- </p>
-
- <p> <!-- CL 31467 -->
- The <code>URL</code> type now implements
- <a href="/pkg/encoding/#BinaryMarshaler"><code>encoding.BinaryMarshaler</code></a> and
- <a href="/pkg/encoding/#BinaryUnmarshaler"><code>encoding.BinaryUnmarshaler</code></a>,
- making it possible to process URLs in <a href="/pkg/encoding/gob/">gob data</a>.
- </p>
-
- <p> <!-- CL 29610, CL 31582 -->
- Following RFC 3986,
- <a href="/pkg/net/url/#Parse"><code>Parse</code></a>
- now rejects URLs like <code>this_that:other/thing</code> instead of
- interpreting them as relative paths (<code>this_that</code> is not a valid scheme).
- To force interpretation as a relative path,
- such URLs should be prefixed with “<code>./</code>”.
- The <code>URL.String</code> method now inserts this prefix as needed.
- </p>
-
- </dd>
-</dl>
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p> <!-- CL 16551 -->
- The new function
- <a href="/pkg/os/#Executable"><code>Executable</code></a> returns
- the path name of the running executable.
- </p>
-
- <p> <!-- CL 30614 -->
- An attempt to call a method on
- an <a href="/pkg/os/#File"><code>os.File</code></a> that has
- already been closed will now return the new error
- value <a href="/pkg/os/#ErrClosed"><code>os.ErrClosed</code></a>.
- Previously it returned a system-specific error such
- as <code>syscall.EBADF</code>.
- </p>
-
- <p> <!-- CL 31358 -->
- On Unix systems, <a href="/pkg/os/#Rename"><code>os.Rename</code></a>
- will now return an error when used to rename a directory to an
- existing empty directory.
- Previously it would fail when renaming to a non-empty directory
- but succeed when renaming to an empty directory.
- This makes the behavior on Unix correspond to that of other systems.
- </p>
-
- <p> <!-- CL 32451 -->
- On Windows, long absolute paths are now transparently converted to
- extended-length paths (paths that start with “<code>\\?\</code>”).
- This permits the package to work with files whose path names are
- longer than 260 characters.
- </p>
-
- <p> <!-- CL 29753 -->
- On Windows, <a href="/pkg/os/#IsExist"><code>os.IsExist</code></a>
- will now return <code>true</code> for the system
- error <code>ERROR_DIR_NOT_EMPTY</code>.
- This roughly corresponds to the existing handling of the Unix
- error <code>ENOTEMPTY</code>.
- </p>
-
- <p> <!-- CL 32152 -->
- On Plan 9, files that are not served by <code>#M</code> will now
- have <a href="/pkg/os/#ModeDevice"><code>ModeDevice</code></a> set in
- the value returned
- by <a href="/pkg/os/#FileInfo"><code>FileInfo.Mode</code></a>.
- </p>
- </dd>
-</dl>
-
-<dl id="path_filepath"><dt><a href="/pkg/path/filepath/">path/filepath</a></dt>
- <dd>
- <p>
- A number of bugs and corner cases on Windows were fixed:
- <a href="/pkg/path/filepath/#Abs"><code>Abs</code></a> now calls <code>Clean</code> as documented,
- <a href="/pkg/path/filepath/#Glob"><code>Glob</code></a> now matches
- “<code>\\?\c:\*</code>”,
- <a href="/pkg/path/filepath/#EvalSymlinks"><code>EvalSymlinks</code></a> now
- correctly handles “<code>C:.</code>”, and
- <a href="/pkg/path/filepath/#Clean"><code>Clean</code></a> now properly
- handles a leading “<code>..</code>” in the path.
- </p>
- </dd>
-</dl>
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
- <dd>
- <p> <!-- CL 30088 -->
- The new function
- <a href="/pkg/reflect/#Swapper"><code>Swapper</code></a> was
- added to support <a href="#sortslice"><code>sort.Slice</code></a>.
- </p>
- </dd>
-</dl>
-
-<dl id="strconv"><dt><a href="/pkg/strconv/">strconv</a></dt>
- <dd>
- <p> <!-- CL 31210 -->
- The <a href="/pkg/strconv/#Unquote"><code>Unquote</code></a>
- function now strips carriage returns (<code>\r</code>) in
- backquoted raw strings, following the
- <a href="/ref/spec#String_literals">Go language semantics</a>.
- </p>
- </dd>
-</dl>
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p> <!-- CL 25050, CL 25022 -->
- The <a href="/pkg/syscall/#Getpagesize"><code>Getpagesize</code></a>
- now returns the system's size, rather than a constant value.
- Previously it always returned 4KB.
- </p>
-
- <p> <!-- CL 31446 -->
- The signature
- of <a href="/pkg/syscall/#Utimes"><code>Utimes</code></a> has
- changed on Solaris to match all the other Unix systems'
- signature. Portable code should continue to use
- <a href="/pkg/os/#Chtimes"><code>os.Chtimes</code></a> instead.
- </p>
-
- <p> <!-- CL 32319 -->
- The <code>X__cmsg_data</code> field has been removed from
- <a href="/pkg/syscall/#Cmsghdr"><code>Cmsghdr</code></a>.
- </p>
- </dd>
-</dl>
-
-<dl id="text_template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p> <!-- CL 31462 -->
- <a href="/pkg/text/template/#Template.Execute"><code>Template.Execute</code></a>
- can now take a
- <a href="/pkg/reflect/#Value"><code>reflect.Value</code></a> as its data
- argument, and
- <a href="/pkg/text/template/#FuncMap"><code>FuncMap</code></a>
- functions can also accept and return <code>reflect.Value</code>.
- </p>
-
- </dd>
-</dl>
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
- <dd>
-
- <p> <!-- CL 20118 --> The new function
- <a href="/pkg/time/#Until"><code>Until</code></a> complements
- the analogous <code>Since</code> function.
- </p>
-
- <p> <!-- CL 29338 -->
- <a href="/pkg/time/#ParseDuration"><code>ParseDuration</code></a>
- now accepts long fractional parts.
- </p>
-
- <p> <!-- CL 33429 -->
- <a href="/pkg/time/#Parse"><code>Parse</code></a>
- now rejects dates before the start of a month, such as June 0;
- it already rejected dates beyond the end of the month, such as
- June 31 and July 32.
- </p>
-
- <p> <!-- CL 33029 --> <!-- CL 34816 -->
- The <code>tzdata</code> database has been updated to version
- 2016j for systems that don't already have a local time zone
- database.
- </p>
-
- <p>
- </dd>
-</dl>
-
-<dl id="testing"><dt><a href="/pkg/testing/">testing</a></dt>
- <dd>
- <p><!-- CL 29970 -->
- The new method
- <a href="/pkg/testing/#T.Name"><code>T.Name</code></a>
- (and <code>B.Name</code>) returns the name of the current
- test or benchmark.
- </p>
-
- <p><!-- CL 32483 -->
- The new function
- <a href="/pkg/testing/#CoverMode"><code>CoverMode</code></a>
- reports the test coverage mode.
- </p>
-
- <p><!-- CL 32615 -->
- Tests and benchmarks are now marked as failed if the race
- detector is enabled and a data race occurs during execution.
- Previously, individual test cases would appear to pass,
- and only the overall execution of the test binary would fail.
- </p>
-
- <p><!-- CL 32455 -->
- The signature of the
- <a href="/pkg/testing/#MainStart"><code>MainStart</code></a>
- function has changed, as allowed by the documentation. It is an
- internal detail and not part of the Go 1 compatibility promise.
- If you're not calling <code>MainStart</code> directly but see
- errors, that likely means you set the
- normally-empty <code>GOROOT</code> environment variable and it
- doesn't match the version of your <code>go</code> command's binary.
- </p>
-
- </dd>
-</dl>
-
-<dl id="unicode"><dt><a href="/pkg/unicode/">unicode</a></dt>
- <dd>
- <p><!-- CL 30935 -->
- <a href="/pkg/unicode/#SimpleFold"><code>SimpleFold</code></a>
- now returns its argument unchanged if the provided input was an invalid rune.
- Previously, the implementation failed with an index bounds check panic.
- </p>
- </dd>
-</dl>
diff --git a/doc/go1.9.html b/doc/go1.9.html
deleted file mode 100644
index 86ee257d03..0000000000
--- a/doc/go1.9.html
+++ /dev/null
@@ -1,1024 +0,0 @@
-<!--{
- "Title": "Go 1.9 Release Notes",
- "Path": "/doc/go1.9",
- "Template": true
-}-->
-
-<!--
-NOTE: In this document and others in this directory, the convention is to
-set fixed-width phrases with non-fixed-width spaces, as in
-<code>hello</code> <code>world</code>.
-Do not send CLs removing the interior tags from such phrases.
--->
-
-<style>
- main ul li { margin: 0.5em 0; }
-</style>
-
-<h2 id="introduction">Introduction to Go 1.9</h2>
-
-<p>
- The latest Go release, version 1.9, arrives six months
- after <a href="go1.8">Go 1.8</a> and is the tenth release in
- the <a href="https://golang.org/doc/devel/release.html">Go 1.x
- series</a>.
- There are two <a href="#language">changes to the language</a>:
- adding support for type aliases and defining when implementations
- may fuse floating point operations.
- Most of the changes are in the implementation of the toolchain,
- runtime, and libraries.
- As always, the release maintains the Go 1
- <a href="/doc/go1compat.html">promise of compatibility</a>.
- We expect almost all Go programs to continue to compile and run as
- before.
-</p>
-
-<p>
- The release
- adds <a href="#monotonic-time">transparent monotonic time support</a>,
- <a href="#parallel-compile">parallelizes compilation of functions</a> within a package,
- better supports <a href="#test-helper">test helper functions</a>,
- includes a new <a href="#math-bits">bit manipulation package</a>,
- and has a new <a href="#sync-map">concurrent map type</a>.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<p>
- There are two changes to the language.
-</p>
-<p>
- Go now supports type aliases to support gradual code repair while
- moving a type between packages.
- The <a href="https://golang.org/design/18130-type-alias">type alias
- design document</a>
- and <a href="https://talks.golang.org/2016/refactor.article">an
- article on refactoring</a> cover the problem in detail.
- In short, a type alias declaration has the form:
-</p>
-
-<pre>
-type T1 = T2
-</pre>
-
-<p>
- This declaration introduces an alias name <code>T1</code>—an
- alternate spelling—for the type denoted by <code>T2</code>; that is,
- both <code>T1</code> and <code>T2</code> denote the same type.
-</p>
-
-<p> <!-- CL 40391 -->
- A smaller language change is that the
- <a href="/ref/spec#Floating_point_operators">language specification
- now states</a> when implementations are allowed to fuse floating
- point operations together, such as by using an architecture's "fused
- multiply and add" (FMA) instruction to compute <code>x*y</code>&nbsp;<code>+</code>&nbsp;<code>z</code>
- without rounding the intermediate result <code>x*y</code>.
- To force the intermediate rounding, write <code>float64(x*y)</code>&nbsp;<code>+</code>&nbsp;<code>z</code>.
-</p>
-
-<h2 id="ports">Ports</h2>
-
-<p>
- There are no new supported operating systems or processor
- architectures in this release.
-</p>
-
-<h3 id="power8">ppc64x requires POWER8</h3>
-
-<p> <!-- CL 36725, CL 36832 -->
- Both <code>GOARCH=ppc64</code> and <code>GOARCH=ppc64le</code> now
- require at least POWER8 support. In previous releases,
- only <code>GOARCH=ppc64le</code> required POWER8 and the big
- endian <code>ppc64</code> architecture supported older
- hardware.
-<p>
-
-<h3 id="freebsd">FreeBSD</h3>
-
-<p>
- Go 1.9 is the last release that will run on FreeBSD 9.3,
- which is already
- <a href="https://www.freebsd.org/security/unsupported.html">unsupported by FreeBSD</a>.
- Go 1.10 will require FreeBSD 10.3+.
-</p>
-
-<h3 id="openbsd">OpenBSD 6.0</h3>
-
-<p> <!-- CL 40331 -->
- Go 1.9 now enables PT_TLS generation for cgo binaries and thus
- requires OpenBSD 6.0 or newer. Go 1.9 no longer supports
- OpenBSD 5.9.
-<p>
-
-<h3 id="known_issues">Known Issues</h3>
-
-<p>
- There are some instabilities on FreeBSD that are known but not understood.
- These can lead to program crashes in rare cases.
- See <a href="https://golang.org/issue/15658">issue 15658</a>.
- Any help in solving this FreeBSD-specific issue would be appreciated.
-</p>
-
-<p>
- Go stopped running NetBSD builders during the Go 1.9 development
- cycle due to NetBSD kernel crashes, up to and including NetBSD 7.1.
- As Go 1.9 is being released, NetBSD 7.1.1 is being released with a fix.
- However, at this time we have no NetBSD builders passing our test suite.
- Any help investigating the
- <a href="https://github.com/golang/go/labels/OS-NetBSD">various NetBSD issues</a>
- would be appreciated.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<h3 id="parallel-compile">Parallel Compilation</h3>
-
-<p>
- The Go compiler now supports compiling a package's functions in parallel, taking
- advantage of multiple cores. This is in addition to the <code>go</code> command's
- existing support for parallel compilation of separate packages.
- Parallel compilation is on by default, but it can be disabled by setting the
- environment variable <code>GO19CONCURRENTCOMPILATION</code> to <code>0</code>.
-</p>
-
-<h3 id="vendor-dotdotdot">Vendor matching with ./...</h3>
-
-<p><!-- CL 38745 -->
- By popular request, <code>./...</code> no longer matches packages
- in <code>vendor</code> directories in tools accepting package names,
- such as <code>go</code> <code>test</code>. To match vendor
- directories, write <code>./vendor/...</code>.
-</p>
-
-<h3 id="goroot">Moved GOROOT</h3>
-
-<p><!-- CL 42533 -->
- The <a href="/cmd/go/">go tool</a> will now use the path from which it
- was invoked to attempt to locate the root of the Go install tree.
- This means that if the entire Go installation is moved to a new
- location, the go tool should continue to work as usual.
- This may be overridden by setting <code>GOROOT</code> in the environment,
- which should only be done in unusual circumstances.
- Note that this does not affect the result of
- the <a href="/pkg/runtime/#GOROOT">runtime.GOROOT</a> function, which
- will continue to report the original installation location;
- this may be fixed in later releases.
-</p>
-
-<h3 id="compiler">Compiler Toolchain</h3>
-
-<p><!-- CL 37441 -->
- Complex division is now C99-compatible. This has always been the
- case in gccgo and is now fixed in the gc toolchain.
-</p>
-
-<p> <!-- CL 36983 -->
- The linker will now generate DWARF information for cgo executables on Windows.
-</p>
-
-<p> <!-- CL 44210, CL 40095 -->
- The compiler now includes lexical scopes in the generated DWARF if the
- <code>-N -l</code> flags are provided, allowing
- debuggers to hide variables that are not in scope. The <code>.debug_info</code>
- section is now DWARF version 4.
-</p>
-
-<p> <!-- CL 43855 -->
- The values of <code>GOARM</code> and <code>GO386</code> now affect a
- compiled package's build ID, as used by the <code>go</code> tool's
- dependency caching.
-</p>
-
-<h3 id="asm">Assembler</h3>
-
-<p> <!-- CL 42028 -->
- The four-operand ARM <code>MULA</code> instruction is now assembled correctly,
- with the addend register as the third argument and the result
- register as the fourth and final argument.
- In previous releases, the two meanings were reversed.
- The three-operand form, in which the fourth argument is implicitly
- the same as the third, is unaffected.
- Code using four-operand <code>MULA</code> instructions
- will need to be updated, but we believe this form is very rarely used.
- <code>MULAWT</code> and <code>MULAWB</code> were already
- using the correct order in all forms and are unchanged.
-</p>
-
-<p> <!-- CL 42990 -->
- The assembler now supports <code>ADDSUBPS/PD</code>, completing the
- two missing x86 SSE3 instructions.
-</p>
-
-<h3 id="go-doc">Doc</h3>
-
-<p><!-- CL 36031 -->
- Long lists of arguments are now truncated. This improves the readability
- of <code>go</code> <code>doc</code> on some generated code.
-</p>
-
-<p><!-- CL 38438 -->
- Viewing documentation on struct fields is now supported.
- For example, <code>go</code> <code>doc</code> <code>http.Client.Jar</code>.
-</p>
-
-<h3 id="go-env-json">Env</h3>
-
-<p> <!-- CL 38757 -->
- The new <code>go</code> <code>env</code> <code>-json</code> flag
- enables JSON output, instead of the default OS-specific output
- format.
-</p>
-
-<h3 id="go-test-list">Test</h3>
-
-<p> <!-- CL 41195 -->
- The <a href="/cmd/go/#hdr-Description_of_testing_flags"><code>go</code> <code>test</code></a>
- command accepts a new <code>-list</code> flag, which takes a regular
- expression as an argument and prints to stdout the name of any
- tests, benchmarks, or examples that match it, without running them.
-</p>
-
-
-<h3 id="go-tool-pprof">Pprof</h3>
-
-<p> <!-- CL 34192 -->
- Profiles produced by the <code>runtime/pprof</code> package now
- include symbol information, so they can be viewed
- in <code>go</code> <code>tool</code> <code>pprof</code>
- without the binary that produced the profile.
-</p>
-
-<p> <!-- CL 38343 -->
- The <code>go</code> <code>tool</code> <code>pprof</code> command now
- uses the HTTP proxy information defined in the environment, using
- <a href="/pkg/net/http/#ProxyFromEnvironment"><code>http.ProxyFromEnvironment</code></a>.
-</p>
-
-<h3 id="vet">Vet</h3>
-
-<!-- CL 40112 -->
-<p>
- The <a href="/cmd/vet/"><code>vet</code> command</a>
- has been better integrated into the
- <a href="/cmd/go/"><code>go</code> tool</a>,
- so <code>go</code> <code>vet</code> now supports all standard build
- flags while <code>vet</code>'s own flags are now available
- from <code>go</code> <code>vet</code> as well as
- from <code>go</code> <code>tool</code> <code>vet</code>.
-</p>
-
-<h3 id="gccgo">Gccgo</h3>
-
-<p>
-Due to the alignment of Go's semiannual release schedule with GCC's
-annual release schedule,
-GCC release 7 contains the Go 1.8.3 version of gccgo.
-We expect that the next release, GCC 8, will contain the Go 1.10
-version of gccgo.
-</p>
-
-<h2 id="runtime">Runtime</h2>
-
-<h3 id="callersframes">Call stacks with inlined frames</h3>
-
-<p>
- Users of
- <a href="/pkg/runtime#Callers"><code>runtime.Callers</code></a>
- should avoid directly inspecting the resulting PC slice and instead use
- <a href="/pkg/runtime#CallersFrames"><code>runtime.CallersFrames</code></a>
- to get a complete view of the call stack, or
- <a href="/pkg/runtime#Caller"><code>runtime.Caller</code></a>
- to get information about a single caller.
- This is because an individual element of the PC slice cannot account
- for inlined frames or other nuances of the call stack.
-</p>
-
-<p>
- Specifically, code that directly iterates over the PC slice and uses
- functions such as
- <a href="/pkg/runtime#FuncForPC"><code>runtime.FuncForPC</code></a>
- to resolve each PC individually will miss inlined frames.
- To get a complete view of the stack, such code should instead use
- <code>CallersFrames</code>.
- Likewise, code should not assume that the length returned by
- <code>Callers</code> is any indication of the call depth.
- It should instead count the number of frames returned by
- <code>CallersFrames</code>.
-</p>
-
-<p>
- Code that queries a single caller at a specific depth should use
- <code>Caller</code> rather than passing a slice of length 1 to
- <code>Callers</code>.
-</p>
-
-<p>
- <a href="/pkg/runtime#CallersFrames"><code>runtime.CallersFrames</code></a>
- has been available since Go 1.7, so code can be updated prior to
- upgrading to Go 1.9.
-</p>
-
-<h2 id="performance">Performance</h2>
-
-<p>
- As always, the changes are so general and varied that precise
- statements about performance are difficult to make. Most programs
- should run a bit faster, due to speedups in the garbage collector,
- better generated code, and optimizations in the core library.
-</p>
-
-<h3 id="gc">Garbage Collector</h3>
-
-<p> <!-- CL 37520 -->
- Library functions that used to trigger stop-the-world garbage
- collection now trigger concurrent garbage collection.
-
- Specifically, <a href="/pkg/runtime/#GC"><code>runtime.GC</code></a>,
- <a href="/pkg/runtime/debug/#SetGCPercent"><code>debug.SetGCPercent</code></a>,
- and
- <a href="/pkg/runtime/debug/#FreeOSMemory"><code>debug.FreeOSMemory</code></a>,
- now trigger concurrent garbage collection, blocking only the calling
- goroutine until the garbage collection is done.
-</p>
-
-<p> <!-- CL 34103, CL 39835 -->
- The
- <a href="/pkg/runtime/debug/#SetGCPercent"><code>debug.SetGCPercent</code></a>
- function only triggers a garbage collection if one is immediately
- necessary because of the new GOGC value.
- This makes it possible to adjust GOGC on-the-fly.
-</p>
-
-<p> <!-- CL 38732 -->
- Large object allocation performance is significantly improved in
- applications using large (&gt;50GB) heaps containing many large
- objects.
-</p>
-
-<p> <!-- CL 34937 -->
- The <a href="/pkg/runtime/#ReadMemStats"><code>runtime.ReadMemStats</code></a>
- function now takes less than 100µs even for very large heaps.
-</p>
-
-<h2 id="library">Core library</h2>
-
-<h3 id="monotonic-time">Transparent Monotonic Time support</h3>
-
-<p> <!-- CL 36255 -->
- The <a href="/pkg/time/"><code>time</code></a> package now transparently
- tracks monotonic time in each <a href="/pkg/time/#Time"><code>Time</code></a>
- value, making computing durations between two <code>Time</code> values
- a safe operation in the presence of wall clock adjustments.
- See the <a href="/pkg/time/#hdr-Monotonic_Clocks">package docs</a> and
- <a href="https://golang.org/design/12914-monotonic">design document</a>
- for details.
-</p>
-
-<h3 id="math-bits">New bit manipulation package</h3>
-
-<p> <!-- CL 36315 -->
- Go 1.9 includes a new package,
- <a href="/pkg/math/bits/"><code>math/bits</code></a>, with optimized
- implementations for manipulating bits. On most architectures,
- functions in this package are additionally recognized by the
- compiler and treated as intrinsics for additional performance.
-</p>
-
-<h3 id="test-helper">Test Helper Functions</h3>
-
-<p> <!-- CL 38796 -->
- The
- new <a href="/pkg/testing/#T.Helper"><code>(*T).Helper</code></a>
- and <a href="/pkg/testing/#B.Helper"><code>(*B).Helper</code></a>
- methods mark the calling function as a test helper function. When
- printing file and line information, that function will be skipped.
- This permits writing test helper functions while still having useful
- line numbers for users.
-</p>
-
-<h3 id="sync-map">Concurrent Map</h3>
-
-<p> <!-- CL 36617 -->
- The new <a href="/pkg/sync/#Map"><code>Map</code></a> type
- in the <a href="/pkg/sync/"><code>sync</code></a> package
- is a concurrent map with amortized-constant-time loads, stores, and
- deletes. It is safe for multiple goroutines to call a <code>Map</code>'s methods
- concurrently.
-</p>
-
-<h3 id="pprof-labels">Profiler Labels</h3>
-
-<p><!-- CL 34198 -->
- The <a href="/pkg/runtime/pprof"><code>runtime/pprof</code> package</a>
- now supports adding labels to <code>pprof</code> profiler records.
- Labels form a key-value map that is used to distinguish calls of the
- same function in different contexts when looking at profiles
- with the <a href="/cmd/pprof/"><code>pprof</code> command</a>.
- The <code>pprof</code> package's
- new <a href="/pkg/runtime/pprof/#Do"><code>Do</code> function</a>
- runs code associated with some provided labels. Other new functions
- in the package help work with labels.
-</p>
-
-</dl><!-- runtime/pprof -->
-
-
-<h3 id="minor_library_changes">Minor changes to the library</h3>
-
-<p>
- As always, there are various minor changes and updates to the library,
- made with the Go 1 <a href="/doc/go1compat">promise of compatibility</a>
- in mind.
-</p>
-
-<dl id="archive/zip"><dt><a href="/pkg/archive/zip/">archive/zip</a></dt>
- <dd>
- <p><!-- CL 39570 -->
- The
- ZIP <a href="/pkg/archive/zip/#Writer"><code>Writer</code></a>
- now sets the UTF-8 bit in
- the <a href="/pkg/archive/zip/#FileHeader.Flags"><code>FileHeader.Flags</code></a>
- when appropriate.
- </p>
-
-</dl><!-- archive/zip -->
-
-<dl id="crypto/rand"><dt><a href="/pkg/crypto/rand/">crypto/rand</a></dt>
- <dd>
- <p><!-- CL 43852 -->
- On Linux, Go now calls the <code>getrandom</code> system call
- without the <code>GRND_NONBLOCK</code> flag; it will now block
- until the kernel has sufficient randomness. On kernels predating
- the <code>getrandom</code> system call, Go continues to read
- from <code>/dev/urandom</code>.
- </p>
-
-</dl><!-- crypto/rand -->
-
-<dl id="crypto/x509"><dt><a href="/pkg/crypto/x509/">crypto/x509</a></dt>
- <dd>
- <p><!-- CL 36093 -->
-
- On Unix systems the environment
- variables <code>SSL_CERT_FILE</code>
- and <code>SSL_CERT_DIR</code> can now be used to override the
- system default locations for the SSL certificate file and SSL
- certificate files directory, respectively.
- </p>
-
- <p>The FreeBSD file <code>/usr/local/etc/ssl/cert.pem</code> is
- now included in the certificate search path.
- </p>
-
- <p><!-- CL 36900 -->
-
- The package now supports excluded domains in name constraints.
- In addition to enforcing such constraints,
- <a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
- will create certificates with excluded name constraints
- if the provided template certificate has the new
- field
- <a href="/pkg/crypto/x509/#Certificate.ExcludedDNSDomains"><code>ExcludedDNSDomains</code></a>
- populated.
- </p>
-
- <p><!-- CL 36696 -->
-
- If any SAN extension, including with no DNS names, is present
- in the certificate, then the Common Name from
- <a href="/pkg/crypto/x509/#Certificate.Subject"><code>Subject</code></a> is ignored.
- In previous releases, the code tested only whether DNS-name SANs were
- present in a certificate.
- </p>
-
-</dl><!-- crypto/x509 -->
-
-<dl id="database/sql"><dt><a href="/pkg/database/sql/">database/sql</a></dt>
- <dd>
- <p><!-- CL 35476 -->
- The package will now use a cached <a href="/pkg/database/sql/#Stmt"><code>Stmt</code></a> if
- available in <a href="/pkg/database/sql/#Tx.Stmt"><code>Tx.Stmt</code></a>.
- This prevents statements from being re-prepared each time
- <a href="/pkg/database/sql/#Tx.Stmt"><code>Tx.Stmt</code></a> is called.
- </p>
-
- <p><!-- CL 38533 -->
- The package now allows drivers to implement their own argument checkers by implementing
- <a href="/pkg/database/sql/driver/#NamedValueChecker"><code>driver.NamedValueChecker</code></a>.
- This also allows drivers to support <code>OUTPUT</code> and <code>INOUT</code> parameter types.
- <a href="/pkg/database/sql/#Out"><code>Out</code></a> should be used to return output parameters
- when supported by the driver.
- </p>
-
- <p><!-- CL 39031 -->
- <a href="/pkg/database/sql/#Rows.Scan"><code>Rows.Scan</code></a> can now scan user-defined string types.
- Previously the package supported scanning into numeric types like <code>type</code> <code>Int</code> <code>int64</code>. It now also supports
- scanning into string types like <code>type</code> <code>String</code> <code>string</code>.
- </p>
-
- <p><!-- CL 40694 -->
- The new <a href="/pkg/database/sql/#DB.Conn"><code>DB.Conn</code></a> method returns the new
- <a href="/pkg/database/sql/#Conn"><code>Conn</code></a> type representing an
- exclusive connection to the database from the connection pool. All queries run on
- a <a href="/pkg/database/sql/#Conn"><code>Conn</code></a> will use the same underlying
- connection until <a href="/pkg/database/sql/#Conn.Close"><code>Conn.Close</code></a> is called
- to return the connection to the connection pool.
- </p>
-
-</dl><!-- database/sql -->
-
-<dl id="encoding/asn1"><dt><a href="/pkg/encoding/asn1/">encoding/asn1</a></dt>
- <dd>
- <p><!-- CL 38660 -->
- The new
- <a href="/pkg/encoding/asn1/#NullBytes"><code>NullBytes</code></a>
- and
- <a href="/pkg/encoding/asn1/#NullRawValue"><code>NullRawValue</code></a>
- represent the ASN.1 NULL type.
- </p>
-
-</dl><!-- encoding/asn1 -->
-
-<dl id="encoding/base32"><dt><a href="/pkg/encoding/base32/">encoding/base32</a></dt>
- <dd>
- <p><!-- CL 38634 -->
- The new <a href="/pkg/encoding/base32/#Encoding.WithPadding">Encoding.WithPadding</a>
- method adds support for custom padding characters and disabling padding.
- </p>
-
-</dl><!-- encoding/base32 -->
-
-<dl id="encoding/csv"><dt><a href="/pkg/encoding/csv/">encoding/csv</a></dt>
- <dd>
- <p><!-- CL 41730 -->
- The new field
- <a href="/pkg/encoding/csv/#Reader.ReuseRecord"><code>Reader.ReuseRecord</code></a>
- controls whether calls to
- <a href="/pkg/encoding/csv/#Reader.Read"><code>Read</code></a>
- may return a slice sharing the backing array of the previous
- call's returned slice for improved performance.
- </p>
-
-</dl><!-- encoding/csv -->
-
-<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
- <dd>
- <p><!-- CL 37051 -->
- The sharp flag ('<code>#</code>') is now supported when printing
- floating point and complex numbers. It will always print a
- decimal point
- for <code>%e</code>, <code>%E</code>, <code>%f</code>, <code>%F</code>, <code>%g</code>
- and <code>%G</code>; it will not remove trailing zeros
- for <code>%g</code> and <code>%G</code>.
- </p>
-
-</dl><!-- fmt -->
-
-<dl id="hash/fnv"><dt><a href="/pkg/hash/fnv/">hash/fnv</a></dt>
- <dd>
- <p><!-- CL 38356 -->
- The package now includes 128-bit FNV-1 and FNV-1a hash support with
- <a href="/pkg/hash/fnv/#New128"><code>New128</code></a> and
- <a href="/pkg/hash/fnv/#New128a"><code>New128a</code></a>, respectively.
- </p>
-
-</dl><!-- hash/fnv -->
-
-<dl id="html/template"><dt><a href="/pkg/html/template/">html/template</a></dt>
- <dd>
- <p><!-- CL 37880, CL 40936 -->
- The package now reports an error if a predefined escaper (one of
- "html", "urlquery" and "js") is found in a pipeline and does not match
- what the auto-escaper would have decided on its own.
- This avoids certain security or correctness issues.
- Now use of one of these escapers is always either a no-op or an error.
- (The no-op case eases migration from <a href="/pkg/text/template/">text/template</a>.)
- </p>
-
-</dl><!-- html/template -->
-
-<dl id="image"><dt><a href="/pkg/image/">image</a></dt>
- <dd>
- <p><!-- CL 36734 -->
- The <a href="/pkg/image/#Rectangle.Intersect"><code>Rectangle.Intersect</code></a>
- method now returns a zero <code>Rectangle</code> when called on
- adjacent but non-overlapping rectangles, as documented. In
- earlier releases it would incorrectly return an empty but
- non-zero <code>Rectangle</code>.
- </p>
-
-</dl><!-- image -->
-
-<dl id="image/color"><dt><a href="/pkg/image/color/">image/color</a></dt>
- <dd>
- <p><!-- CL 36732 -->
- The YCbCr to RGBA conversion formula has been tweaked to ensure
- that rounding adjustments span the complete [0, 0xffff] RGBA
- range.
- </p>
-
-</dl><!-- image/color -->
-
-<dl id="image/png"><dt><a href="/pkg/image/png/">image/png</a></dt>
- <dd>
- <p><!-- CL 34150 -->
- The new <a href="/pkg/image/png/#Encoder.BufferPool"><code>Encoder.BufferPool</code></a>
- field allows specifying an <a href="/pkg/image/png/#EncoderBufferPool"><code>EncoderBufferPool</code></a>,
- that will be used by the encoder to get temporary <code>EncoderBuffer</code>
- buffers when encoding a PNG image.
-
- The use of a <code>BufferPool</code> reduces the number of
- memory allocations performed while encoding multiple images.
- </p>
-
- <p><!-- CL 38271 -->
- The package now supports the decoding of transparent 8-bit
- grayscale ("Gray8") images.
- </p>
-
-</dl><!-- image/png -->
-
-<dl id="math/big"><dt><a href="/pkg/math/big/">math/big</a></dt>
- <dd>
- <p><!-- CL 36487 -->
- The new
- <a href="/pkg/math/big/#Int.IsInt64"><code>IsInt64</code></a>
- and
- <a href="/pkg/math/big/#Int.IsUint64"><code>IsUint64</code></a>
- methods report whether an <code>Int</code>
- may be represented as an <code>int64</code> or <code>uint64</code>
- value.
- </p>
-
-</dl><!-- math/big -->
-
-<dl id="mime/multipart"><dt><a href="/pkg/mime/multipart/">mime/multipart</a></dt>
- <dd>
- <p><!-- CL 39223 -->
- The new
- <a href="/pkg/mime/multipart/#FileHeader.Size"><code>FileHeader.Size</code></a>
- field describes the size of a file in a multipart message.
- </p>
-
-</dl><!-- mime/multipart -->
-
-<dl id="net"><dt><a href="/pkg/net/">net</a></dt>
- <dd>
- <p><!-- CL 32572 -->
- The new
- <a href="/pkg/net/#Resolver.StrictErrors"><code>Resolver.StrictErrors</code></a>
- provides control over how Go's built-in DNS resolver handles
- temporary errors during queries composed of multiple sub-queries,
- such as an A+AAAA address lookup.
- </p>
-
- <p><!-- CL 37260 -->
- The new
- <a href="/pkg/net/#Resolver.Dial"><code>Resolver.Dial</code></a>
- allows a <code>Resolver</code> to use a custom dial function.
- </p>
-
- <p><!-- CL 40510 -->
- <a href="/pkg/net/#JoinHostPort"><code>JoinHostPort</code></a> now only places an address in square brackets if the host contains a colon.
- In previous releases it would also wrap addresses in square brackets if they contained a percent ('<code>%</code>') sign.
- </p>
-
- <p><!-- CL 37913 -->
- The new methods
- <a href="/pkg/net/#TCPConn.SyscallConn"><code>TCPConn.SyscallConn</code></a>,
- <a href="/pkg/net/#IPConn.SyscallConn"><code>IPConn.SyscallConn</code></a>,
- <a href="/pkg/net/#UDPConn.SyscallConn"><code>UDPConn.SyscallConn</code></a>,
- and
- <a href="/pkg/net/#UnixConn.SyscallConn"><code>UnixConn.SyscallConn</code></a>
- provide access to the connections' underlying file descriptors.
- </p>
-
- <p><!-- 45088 -->
- It is now safe to call <a href="/pkg/net/#Dial"><code>Dial</code></a> with the address obtained from
- <code>(*TCPListener).String()</code> after creating the listener with
- <code><a href="/pkg/net/#Listen">Listen</a>("tcp", ":0")</code>.
- Previously it failed on some machines with half-configured IPv6 stacks.
- </p>
-
-</dl><!-- net -->
-
-<dl id="net/http"><dt><a href="/pkg/net/http/">net/http</a></dt>
- <dd>
-
- <p><!-- CL 37328 -->
- The <a href="/pkg/net/http/#Cookie.String"><code>Cookie.String</code></a> method, used for
- <code>Cookie</code> and <code>Set-Cookie</code> headers, now encloses values in double quotes
- if the value contains either a space or a comma.
- </p>
-
- <p>Server changes:</p>
- <ul>
- <li><!-- CL 38194 -->
- <a href="/pkg/net/http/#ServeMux"><code>ServeMux</code></a> now ignores ports in the host
- header when matching handlers. The host is matched unmodified for <code>CONNECT</code> requests.
- </li>
-
- <li><!-- CL 44074 -->
- The new <a href="/pkg/net/http/#Server.ServeTLS"><code>Server.ServeTLS</code></a> method wraps
- <a href="/pkg/net/http/#Server.Serve"><code>Server.Serve</code></a> with added TLS support.
- </li>
-
- <li><!-- CL 34727 -->
- <a href="/pkg/net/http/#Server.WriteTimeout"><code>Server.WriteTimeout</code></a>
- now applies to HTTP/2 connections and is enforced per-stream.
- </li>
-
- <li><!-- CL 43231 -->
- HTTP/2 now uses the priority write scheduler by default.
- Frames are scheduled by following HTTP/2 priorities as described in
- <a href="https://tools.ietf.org/html/rfc7540#section-5.3">RFC 7540 Section 5.3</a>.
- </li>
-
- <li><!-- CL 36483 -->
- The HTTP handler returned by <a href="/pkg/net/http/#StripPrefix"><code>StripPrefix</code></a>
- now calls its provided handler with a modified clone of the original <code>*http.Request</code>.
- Any code storing per-request state in maps keyed by <code>*http.Request</code> should
- use
- <a href="/pkg/net/http/#Request.Context"><code>Request.Context</code></a>,
- <a href="/pkg/net/http/#Request.WithContext"><code>Request.WithContext</code></a>,
- and
- <a href="/pkg/context/#WithValue"><code>context.WithValue</code></a> instead.
- </li>
-
- <li><!-- CL 35490 -->
- <a href="/pkg/net/http/#LocalAddrContextKey"><code>LocalAddrContextKey</code></a> now contains
- the connection's actual network address instead of the interface address used by the listener.
- </li>
- </ul>
-
- <p>Client &amp; Transport changes:</p>
- <ul>
- <li><!-- CL 35488 -->
- The <a href="/pkg/net/http/#Transport"><code>Transport</code></a>
- now supports making requests via SOCKS5 proxy when the URL returned by
- <a href="/pkg/net/http/#Transport.Proxy"><code>Transport.Proxy</code></a>
- has the scheme <code>socks5</code>.
- </li>
- </ul>
-
-</dl><!-- net/http -->
-
-<dl id="net/http/fcgi"><dt><a href="/pkg/net/http/fcgi/">net/http/fcgi</a></dt>
- <dd>
- <p><!-- CL 40012 -->
- The new
- <a href="/pkg/net/http/fcgi/#ProcessEnv"><code>ProcessEnv</code></a>
- function returns FastCGI environment variables associated with an HTTP request
- for which there are no appropriate
- <a href="/pkg/net/http/#Request"><code>http.Request</code></a>
- fields, such as <code>REMOTE_USER</code>.
- </p>
-
-</dl><!-- net/http/fcgi -->
-
-<dl id="net/http/httptest"><dt><a href="/pkg/net/http/httptest/">net/http/httptest</a></dt>
- <dd>
- <p><!-- CL 34639 -->
- The new
- <a href="/pkg/net/http/httptest/#Server.Client"><code>Server.Client</code></a>
- method returns an HTTP client configured for making requests to the test server.
- </p>
-
- <p>
- The new
- <a href="/pkg/net/http/httptest/#Server.Certificate"><code>Server.Certificate</code></a>
- method returns the test server's TLS certificate, if any.
- </p>
-
-</dl><!-- net/http/httptest -->
-
-<dl id="net/http/httputil"><dt><a href="/pkg/net/http/httputil/">net/http/httputil</a></dt>
- <dd>
- <p><!-- CL 43712 -->
- The <a href="/pkg/net/http/httputil/#ReverseProxy"><code>ReverseProxy</code></a>
- now proxies all HTTP/2 response trailers, even those not declared in the initial response
- header. Such undeclared trailers are used by the gRPC protocol.
- </p>
-
-</dl><!-- net/http/httputil -->
-
-<dl id="os"><dt><a href="/pkg/os/">os</a></dt>
- <dd>
- <p><!-- CL 36800 -->
- The <code>os</code> package now uses the internal runtime poller
- for file I/O.
- This reduces the number of threads required for read/write
- operations on pipes, and it eliminates races when one goroutine
- closes a file while another is using the file for I/O.
- </p>
-
- <dd>
- <p><!-- CL 37915 -->
- On Windows,
- <a href="/pkg/os/#Args"><code>Args</code></a>
- is now populated without <code>shell32.dll</code>, improving process start-up time by 1-7 ms.
- </p>
-
-</dl><!-- os -->
-
-<dl id="os/exec"><dt><a href="/pkg/os/exec/">os/exec</a></dt>
- <dd>
- <p><!-- CL 37586 -->
- The <code>os/exec</code> package now prevents child processes from being created with
- any duplicate environment variables.
- If <a href="/pkg/os/exec/#Cmd.Env"><code>Cmd.Env</code></a>
- contains duplicate environment keys, only the last
- value in the slice for each duplicate key is used.
- </p>
-
-</dl><!-- os/exec -->
-
-<dl id="os/user"><dt><a href="/pkg/os/user/">os/user</a></dt>
- <dd>
- <p><!-- CL 37664 -->
- <a href="/pkg/os/user/#Lookup"><code>Lookup</code></a> and
- <a href="/pkg/os/user/#LookupId"><code>LookupId</code></a> now
- work on Unix systems when <code>CGO_ENABLED=0</code> by reading
- the <code>/etc/passwd</code> file.
- </p>
-
- <p><!-- CL 33713 -->
- <a href="/pkg/os/user/#LookupGroup"><code>LookupGroup</code></a> and
- <a href="/pkg/os/user/#LookupGroupId"><code>LookupGroupId</code></a> now
- work on Unix systems when <code>CGO_ENABLED=0</code> by reading
- the <code>/etc/group</code> file.
- </p>
-
-</dl><!-- os/user -->
-
-<dl id="reflect"><dt><a href="/pkg/reflect/">reflect</a></dt>
- <dd>
- <p><!-- CL 38335 -->
- The new
- <a href="/pkg/reflect/#MakeMapWithSize"><code>MakeMapWithSize</code></a>
- function creates a map with a capacity hint.
- </p>
-
-</dl><!-- reflect -->
-
-<dl id="pkg-runtime"><dt><a href="/pkg/runtime/">runtime</a></dt>
- <dd>
- <p><!-- CL 37233, CL 37726 -->
- Tracebacks generated by the runtime and recorded in profiles are
- now accurate in the presence of inlining.
- To retrieve tracebacks programmatically, applications should use
- <a href="/pkg/runtime/#CallersFrames"><code>runtime.CallersFrames</code></a>
- rather than directly iterating over the results of
- <a href="/pkg/runtime/#Callers"><code>runtime.Callers</code></a>.
- </p>
-
- <p><!-- CL 38403 -->
- On Windows, Go no longer forces the system timer to run at high
- resolution when the program is idle.
- This should reduce the impact of Go programs on battery life.
- </p>
-
- <p><!-- CL 29341 -->
- On FreeBSD, <code>GOMAXPROCS</code> and
- <a href="/pkg/runtime/#NumCPU"><code>runtime.NumCPU</code></a>
- are now based on the process' CPU mask, rather than the total
- number of CPUs.
- </p>
-
- <p><!-- CL 43641 -->
- The runtime has preliminary support for Android O.
- </p>
-
-</dl><!-- runtime -->
-
-<dl id="runtime/debug"><dt><a href="/pkg/runtime/debug/">runtime/debug</a></dt>
- <dd>
- <p><!-- CL 34013 -->
- Calling
- <a href="/pkg/runtime/debug/#SetGCPercent"><code>SetGCPercent</code></a>
- with a negative value no longer runs an immediate garbage collection.
- </p>
-
-</dl><!-- runtime/debug -->
-
-<dl id="runtime/trace"><dt><a href="/pkg/runtime/trace/">runtime/trace</a></dt>
- <dd>
- <p><!-- CL 36015 -->
- The execution trace now displays mark assist events, which
- indicate when an application goroutine is forced to assist
- garbage collection because it is allocating too quickly.
- </p>
-
- <p><!-- CL 40810 -->
- "Sweep" events now encompass the entire process of finding free
- space for an allocation, rather than recording each individual
- span that is swept.
- This reduces allocation latency when tracing allocation-heavy
- programs.
- The sweep event shows how many bytes were swept and how many
- were reclaimed.
- </p>
-
-</dl><!-- runtime/trace -->
-
-<dl id="sync"><dt><a href="/pkg/sync/">sync</a></dt>
- <dd>
- <p><!-- CL 34310 -->
- <a href="/pkg/sync/#Mutex"><code>Mutex</code></a> is now more fair.
- </p>
-
-</dl><!-- sync -->
-
-<dl id="syscall"><dt><a href="/pkg/syscall/">syscall</a></dt>
- <dd>
- <p><!-- CL 36697 -->
- The new field
- <a href="/pkg/syscall/#Credential.NoSetGroups"><code>Credential.NoSetGroups</code></a>
- controls whether Unix systems make a <code>setgroups</code> system call
- to set supplementary groups when starting a new process.
- </p>
-
- <p><!-- CL 43512 -->
- The new field
- <a href="/pkg/syscall/#SysProcAttr.AmbientCaps"><code>SysProcAttr.AmbientCaps</code></a>
- allows setting ambient capabilities on Linux 4.3+ when creating
- a new process.
- </p>
-
- <p><!-- CL 37439 -->
- On 64-bit x86 Linux, process creation latency has been optimized with
- use of <code>CLONE_VFORK</code> and <code>CLONE_VM</code>.
- </p>
-
- <p><!-- CL 37913 -->
- The new
- <a href="/pkg/syscall/#Conn"><code>Conn</code></a>
- interface describes some types in the
- <a href="/pkg/net/"><code>net</code></a>
- package that can provide access to their underlying file descriptor
- using the new
- <a href="/pkg/syscall/#RawConn"><code>RawConn</code></a>
- interface.
- </p>
-
-</dl><!-- syscall -->
-
-
-<dl id="testing/quick"><dt><a href="/pkg/testing/quick/">testing/quick</a></dt>
- <dd>
- <p><!-- CL 39152 -->
- The package now chooses values in the full range when
- generating <code>int64</code> and <code>uint64</code> random
- numbers; in earlier releases generated values were always
- limited to the [-2<sup>62</sup>, 2<sup>62</sup>) range.
- </p>
-
- <p>
- In previous releases, using a nil
- <a href="/pkg/testing/quick/#Config.Rand"><code>Config.Rand</code></a>
- value caused a fixed deterministic random number generator to be used.
- It now uses a random number generator seeded with the current time.
- For the old behavior, set <code>Config.Rand</code> to <code>rand.New(rand.NewSource(0))</code>.
- </p>
-
-</dl><!-- testing/quick -->
-
-<dl id="text/template"><dt><a href="/pkg/text/template/">text/template</a></dt>
- <dd>
- <p><!-- CL 38420 -->
- The handling of empty blocks, which was broken by a Go 1.8
- change that made the result dependent on the order of templates,
- has been fixed, restoring the old Go 1.7 behavior.
- </p>
-
-</dl><!-- text/template -->
-
-<dl id="time"><dt><a href="/pkg/time/">time</a></dt>
- <dd>
- <p><!-- CL 36615 -->
- The new methods
- <a href="/pkg/time/#Duration.Round"><code>Duration.Round</code></a>
- and
- <a href="/pkg/time/#Duration.Truncate"><code>Duration.Truncate</code></a>
- handle rounding and truncating durations to multiples of a given duration.
- </p>
-
- <p><!-- CL 35710 -->
- Retrieving the time and sleeping now work correctly under Wine.
- </p>
-
- <p>
- If a <code>Time</code> value has a monotonic clock reading, its
- string representation (as returned by <code>String</code>) now includes a
- final field <code>"m=±value"</code>, where <code>value</code> is the
- monotonic clock reading formatted as a decimal number of seconds.
- </p>
-
- <p><!-- CL 44832 -->
- The included <code>tzdata</code> timezone database has been
- updated to version 2017b. As always, it is only used if the
- system does not already have the database available.
- </p>
-
-</dl><!-- time -->
diff --git a/doc/go1.html b/doc/go1.html
deleted file mode 100644
index 939ee24df5..0000000000
--- a/doc/go1.html
+++ /dev/null
@@ -1,2038 +0,0 @@
-<!--{
- "Title": "Go 1 Release Notes",
- "Path": "/doc/go1",
- "Template": true
-}-->
-
-<h2 id="introduction">Introduction to Go 1</h2>
-
-<p>
-Go version 1, Go 1 for short, defines a language and a set of core libraries
-that provide a stable foundation for creating reliable products, projects, and
-publications.
-</p>
-
-<p>
-The driving motivation for Go 1 is stability for its users. People should be able to
-write Go programs and expect that they will continue to compile and run without
-change, on a time scale of years, including in production environments such as
-Google App Engine. Similarly, people should be able to write books about Go, be
-able to say which version of Go the book is describing, and have that version
-number still be meaningful much later.
-</p>
-
-<p>
-Code that compiles in Go 1 should, with few exceptions, continue to compile and
-run throughout the lifetime of that version, even as we issue updates and bug
-fixes such as Go version 1.1, 1.2, and so on. Other than critical fixes, changes
-made to the language and library for subsequent releases of Go 1 may
-add functionality but will not break existing Go 1 programs.
-<a href="go1compat.html">The Go 1 compatibility document</a>
-explains the compatibility guidelines in more detail.
-</p>
-
-<p>
-Go 1 is a representation of Go as it used today, not a wholesale rethinking of
-the language. We avoided designing new features and instead focused on cleaning
-up problems and inconsistencies and improving portability. There are a number
-changes to the Go language and packages that we had considered for some time and
-prototyped but not released primarily because they are significant and
-backwards-incompatible. Go 1 was an opportunity to get them out, which is
-helpful for the long term, but also means that Go 1 introduces incompatibilities
-for old programs. Fortunately, the <code>go</code> <code>fix</code> tool can
-automate much of the work needed to bring programs up to the Go 1 standard.
-</p>
-
-<p>
-This document outlines the major changes in Go 1 that will affect programmers
-updating existing code; its reference point is the prior release, r60 (tagged as
-r60.3). It also explains how to update code from r60 to run under Go 1.
-</p>
-
-<h2 id="language">Changes to the language</h2>
-
-<h3 id="append">Append</h3>
-
-<p>
-The <code>append</code> predeclared variadic function makes it easy to grow a slice
-by adding elements to the end.
-A common use is to add bytes to the end of a byte slice when generating output.
-However, <code>append</code> did not provide a way to append a string to a <code>[]byte</code>,
-which is another common case.
-</p>
-
-{{code "/doc/progs/go1.go" `/greeting := ..byte/` `/append.*hello/`}}
-
-<p>
-By analogy with the similar property of <code>copy</code>, Go 1
-permits a string to be appended (byte-wise) directly to a byte
-slice, reducing the friction between strings and byte slices.
-The conversion is no longer necessary:
-</p>
-
-{{code "/doc/progs/go1.go" `/append.*world/`}}
-
-<p>
-<em>Updating</em>:
-This is a new feature, so existing code needs no changes.
-</p>
-
-<h3 id="close">Close</h3>
-
-<p>
-The <code>close</code> predeclared function provides a mechanism
-for a sender to signal that no more values will be sent.
-It is important to the implementation of <code>for</code> <code>range</code>
-loops over channels and is helpful in other situations.
-Partly by design and partly because of race conditions that can occur otherwise,
-it is intended for use only by the goroutine sending on the channel,
-not by the goroutine receiving data.
-However, before Go 1 there was no compile-time checking that <code>close</code>
-was being used correctly.
-</p>
-
-<p>
-To close this gap, at least in part, Go 1 disallows <code>close</code> on receive-only channels.
-Attempting to close such a channel is a compile-time error.
-</p>
-
-<pre>
- var c chan int
- var csend chan&lt;- int = c
- var crecv &lt;-chan int = c
- close(c) // legal
- close(csend) // legal
- close(crecv) // illegal
-</pre>
-
-<p>
-<em>Updating</em>:
-Existing code that attempts to close a receive-only channel was
-erroneous even before Go 1 and should be fixed. The compiler will
-now reject such code.
-</p>
-
-<h3 id="literals">Composite literals</h3>
-
-<p>
-In Go 1, a composite literal of array, slice, or map type can elide the
-type specification for the elements' initializers if they are of pointer type.
-All four of the initializations in this example are legal; the last one was illegal before Go 1.
-</p>
-
-{{code "/doc/progs/go1.go" `/type Date struct/` `/STOP/`}}
-
-<p>
-<em>Updating</em>:
-This change has no effect on existing code, but the command
-<code>gofmt</code> <code>-s</code> applied to existing source
-will, among other things, elide explicit element types wherever permitted.
-</p>
-
-
-<h3 id="init">Goroutines during init</h3>
-
-<p>
-The old language defined that <code>go</code> statements executed during initialization created goroutines but that they did not begin to run until initialization of the entire program was complete.
-This introduced clumsiness in many places and, in effect, limited the utility
-of the <code>init</code> construct:
-if it was possible for another package to use the library during initialization, the library
-was forced to avoid goroutines.
-This design was done for reasons of simplicity and safety but,
-as our confidence in the language grew, it seemed unnecessary.
-Running goroutines during initialization is no more complex or unsafe than running them during normal execution.
-</p>
-
-<p>
-In Go 1, code that uses goroutines can be called from
-<code>init</code> routines and global initialization expressions
-without introducing a deadlock.
-</p>
-
-{{code "/doc/progs/go1.go" `/PackageGlobal/` `/^}/`}}
-
-<p>
-<em>Updating</em>:
-This is a new feature, so existing code needs no changes,
-although it's possible that code that depends on goroutines not starting before <code>main</code> will break.
-There was no such code in the standard repository.
-</p>
-
-<h3 id="rune">The rune type</h3>
-
-<p>
-The language spec allows the <code>int</code> type to be 32 or 64 bits wide, but current implementations set <code>int</code> to 32 bits even on 64-bit platforms.
-It would be preferable to have <code>int</code> be 64 bits on 64-bit platforms.
-(There are important consequences for indexing large slices.)
-However, this change would waste space when processing Unicode characters with
-the old language because the <code>int</code> type was also used to hold Unicode code points: each code point would waste an extra 32 bits of storage if <code>int</code> grew from 32 bits to 64.
-</p>
-
-<p>
-To make changing to 64-bit <code>int</code> feasible,
-Go 1 introduces a new basic type, <code>rune</code>, to represent
-individual Unicode code points.
-It is an alias for <code>int32</code>, analogous to <code>byte</code>
-as an alias for <code>uint8</code>.
-</p>
-
-<p>
-Character literals such as <code>'a'</code>, <code>'語'</code>, and <code>'\u0345'</code>
-now have default type <code>rune</code>,
-analogous to <code>1.0</code> having default type <code>float64</code>.
-A variable initialized to a character constant will therefore
-have type <code>rune</code> unless otherwise specified.
-</p>
-
-<p>
-Libraries have been updated to use <code>rune</code> rather than <code>int</code>
-when appropriate. For instance, the functions <code>unicode.ToLower</code> and
-relatives now take and return a <code>rune</code>.
-</p>
-
-{{code "/doc/progs/go1.go" `/STARTRUNE/` `/ENDRUNE/`}}
-
-<p>
-<em>Updating</em>:
-Most source code will be unaffected by this because the type inference from
-<code>:=</code> initializers introduces the new type silently, and it propagates
-from there.
-Some code may get type errors that a trivial conversion will resolve.
-</p>
-
-<h3 id="error">The error type</h3>
-
-<p>
-Go 1 introduces a new built-in type, <code>error</code>, which has the following definition:
-</p>
-
-<pre>
- type error interface {
- Error() string
- }
-</pre>
-
-<p>
-Since the consequences of this type are all in the package library,
-it is discussed <a href="#errors">below</a>.
-</p>
-
-<h3 id="delete">Deleting from maps</h3>
-
-<p>
-In the old language, to delete the entry with key <code>k</code> from map <code>m</code>, one wrote the statement,
-</p>
-
-<pre>
- m[k] = value, false
-</pre>
-
-<p>
-This syntax was a peculiar special case, the only two-to-one assignment.
-It required passing a value (usually ignored) that is evaluated but discarded,
-plus a boolean that was nearly always the constant <code>false</code>.
-It did the job but was odd and a point of contention.
-</p>
-
-<p>
-In Go 1, that syntax has gone; instead there is a new built-in
-function, <code>delete</code>. The call
-</p>
-
-{{code "/doc/progs/go1.go" `/delete\(m, k\)/`}}
-
-<p>
-will delete the map entry retrieved by the expression <code>m[k]</code>.
-There is no return value. Deleting a non-existent entry is a no-op.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will convert expressions of the form <code>m[k] = value,
-false</code> into <code>delete(m, k)</code> when it is clear that
-the ignored value can be safely discarded from the program and
-<code>false</code> refers to the predefined boolean constant.
-The fix tool
-will flag other uses of the syntax for inspection by the programmer.
-</p>
-
-<h3 id="iteration">Iterating in maps</h3>
-
-<p>
-The old language specification did not define the order of iteration for maps,
-and in practice it differed across hardware platforms.
-This caused tests that iterated over maps to be fragile and non-portable, with the
-unpleasant property that a test might always pass on one machine but break on another.
-</p>
-
-<p>
-In Go 1, the order in which elements are visited when iterating
-over a map using a <code>for</code> <code>range</code> statement
-is defined to be unpredictable, even if the same loop is run multiple
-times with the same map.
-Code should not assume that the elements are visited in any particular order.
-</p>
-
-<p>
-This change means that code that depends on iteration order is very likely to break early and be fixed long before it becomes a problem.
-Just as important, it allows the map implementation to ensure better map balancing even when programs are using range loops to select an element from a map.
-</p>
-
-{{code "/doc/progs/go1.go" `/Sunday/` `/^ }/`}}
-
-<p>
-<em>Updating</em>:
-This is one change where tools cannot help. Most existing code
-will be unaffected, but some programs may break or misbehave; we
-recommend manual checking of all range statements over maps to
-verify they do not depend on iteration order. There were a few such
-examples in the standard repository; they have been fixed.
-Note that it was already incorrect to depend on the iteration order, which
-was unspecified. This change codifies the unpredictability.
-</p>
-
-<h3 id="multiple_assignment">Multiple assignment</h3>
-
-<p>
-The language specification has long guaranteed that in assignments
-the right-hand-side expressions are all evaluated before any left-hand-side expressions are assigned.
-To guarantee predictable behavior,
-Go 1 refines the specification further.
-</p>
-
-<p>
-If the left-hand side of the assignment
-statement contains expressions that require evaluation, such as
-function calls or array indexing operations, these will all be done
-using the usual left-to-right rule before any variables are assigned
-their value. Once everything is evaluated, the actual assignments
-proceed in left-to-right order.
-</p>
-
-<p>
-These examples illustrate the behavior.
-</p>
-
-{{code "/doc/progs/go1.go" `/sa :=/` `/then sc.0. = 2/`}}
-
-<p>
-<em>Updating</em>:
-This is one change where tools cannot help, but breakage is unlikely.
-No code in the standard repository was broken by this change, and code
-that depended on the previous unspecified behavior was already incorrect.
-</p>
-
-<h3 id="shadowing">Returns and shadowed variables</h3>
-
-<p>
-A common mistake is to use <code>return</code> (without arguments) after an assignment to a variable that has the same name as a result variable but is not the same variable.
-This situation is called <em>shadowing</em>: the result variable has been shadowed by another variable with the same name declared in an inner scope.
-</p>
-
-<p>
-In functions with named return values,
-the Go 1 compilers disallow return statements without arguments if any of the named return values is shadowed at the point of the return statement.
-(It isn't part of the specification, because this is one area we are still exploring;
-the situation is analogous to the compilers rejecting functions that do not end with an explicit return statement.)
-</p>
-
-<p>
-This function implicitly returns a shadowed return value and will be rejected by the compiler:
-</p>
-
-<pre>
- func Bug() (i, j, k int) {
- for i = 0; i &lt; 5; i++ {
- for j := 0; j &lt; 5; j++ { // Redeclares j.
- k += i*j
- if k > 100 {
- return // Rejected: j is shadowed here.
- }
- }
- }
- return // OK: j is not shadowed here.
- }
-</pre>
-
-<p>
-<em>Updating</em>:
-Code that shadows return values in this way will be rejected by the compiler and will need to be fixed by hand.
-The few cases that arose in the standard repository were mostly bugs.
-</p>
-
-<h3 id="unexported">Copying structs with unexported fields</h3>
-
-<p>
-The old language did not allow a package to make a copy of a struct value containing unexported fields belonging to a different package.
-There was, however, a required exception for a method receiver;
-also, the implementations of <code>copy</code> and <code>append</code> have never honored the restriction.
-</p>
-
-<p>
-Go 1 will allow packages to copy struct values containing unexported fields from other packages.
-Besides resolving the inconsistency,
-this change admits a new kind of API: a package can return an opaque value without resorting to a pointer or interface.
-The new implementations of <code>time.Time</code> and
-<code>reflect.Value</code> are examples of types taking advantage of this new property.
-</p>
-
-<p>
-As an example, if package <code>p</code> includes the definitions,
-</p>
-
-<pre>
- type Struct struct {
- Public int
- secret int
- }
- func NewStruct(a int) Struct { // Note: not a pointer.
- return Struct{a, f(a)}
- }
- func (s Struct) String() string {
- return fmt.Sprintf("{%d (secret %d)}", s.Public, s.secret)
- }
-</pre>
-
-<p>
-a package that imports <code>p</code> can assign and copy values of type
-<code>p.Struct</code> at will.
-Behind the scenes the unexported fields will be assigned and copied just
-as if they were exported,
-but the client code will never be aware of them. The code
-</p>
-
-<pre>
- import "p"
-
- myStruct := p.NewStruct(23)
- copyOfMyStruct := myStruct
- fmt.Println(myStruct, copyOfMyStruct)
-</pre>
-
-<p>
-will show that the secret field of the struct has been copied to the new value.
-</p>
-
-<p>
-<em>Updating</em>:
-This is a new feature, so existing code needs no changes.
-</p>
-
-<h3 id="equality">Equality</h3>
-
-<p>
-Before Go 1, the language did not define equality on struct and array values.
-This meant,
-among other things, that structs and arrays could not be used as map keys.
-On the other hand, Go did define equality on function and map values.
-Function equality was problematic in the presence of closures
-(when are two closures equal?)
-while map equality compared pointers, not the maps' content, which was usually
-not what the user would want.
-</p>
-
-<p>
-Go 1 addressed these issues.
-First, structs and arrays can be compared for equality and inequality
-(<code>==</code> and <code>!=</code>),
-and therefore be used as map keys,
-provided they are composed from elements for which equality is also defined,
-using element-wise comparison.
-</p>
-
-{{code "/doc/progs/go1.go" `/type Day struct/` `/Printf/`}}
-
-<p>
-Second, Go 1 removes the definition of equality for function values,
-except for comparison with <code>nil</code>.
-Finally, map equality is gone too, also except for comparison with <code>nil</code>.
-</p>
-
-<p>
-Note that equality is still undefined for slices, for which the
-calculation is in general infeasible. Also note that the ordered
-comparison operators (<code>&lt;</code> <code>&lt;=</code>
-<code>&gt;</code> <code>&gt;=</code>) are still undefined for
-structs and arrays.
-
-<p>
-<em>Updating</em>:
-Struct and array equality is a new feature, so existing code needs no changes.
-Existing code that depends on function or map equality will be
-rejected by the compiler and will need to be fixed by hand.
-Few programs will be affected, but the fix may require some
-redesign.
-</p>
-
-<h2 id="packages">The package hierarchy</h2>
-
-<p>
-Go 1 addresses many deficiencies in the old standard library and
-cleans up a number of packages, making them more internally consistent
-and portable.
-</p>
-
-<p>
-This section describes how the packages have been rearranged in Go 1.
-Some have moved, some have been renamed, some have been deleted.
-New packages are described in later sections.
-</p>
-
-<h3 id="hierarchy">The package hierarchy</h3>
-
-<p>
-Go 1 has a rearranged package hierarchy that groups related items
-into subdirectories. For instance, <code>utf8</code> and
-<code>utf16</code> now occupy subdirectories of <code>unicode</code>.
-Also, <a href="#subrepo">some packages</a> have moved into
-subrepositories of
-<a href="//code.google.com/p/go"><code>code.google.com/p/go</code></a>
-while <a href="#deleted">others</a> have been deleted outright.
-</p>
-
-<table class="codetable" frame="border" summary="Moved packages">
-<colgroup align="left" width="60%"></colgroup>
-<colgroup align="left" width="40%"></colgroup>
-<tr>
-<th align="left">Old path</th>
-<th align="left">New path</th>
-</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>asn1</td> <td>encoding/asn1</td></tr>
-<tr><td>csv</td> <td>encoding/csv</td></tr>
-<tr><td>gob</td> <td>encoding/gob</td></tr>
-<tr><td>json</td> <td>encoding/json</td></tr>
-<tr><td>xml</td> <td>encoding/xml</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>exp/template/html</td> <td>html/template</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>big</td> <td>math/big</td></tr>
-<tr><td>cmath</td> <td>math/cmplx</td></tr>
-<tr><td>rand</td> <td>math/rand</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>http</td> <td>net/http</td></tr>
-<tr><td>http/cgi</td> <td>net/http/cgi</td></tr>
-<tr><td>http/fcgi</td> <td>net/http/fcgi</td></tr>
-<tr><td>http/httptest</td> <td>net/http/httptest</td></tr>
-<tr><td>http/pprof</td> <td>net/http/pprof</td></tr>
-<tr><td>mail</td> <td>net/mail</td></tr>
-<tr><td>rpc</td> <td>net/rpc</td></tr>
-<tr><td>rpc/jsonrpc</td> <td>net/rpc/jsonrpc</td></tr>
-<tr><td>smtp</td> <td>net/smtp</td></tr>
-<tr><td>url</td> <td>net/url</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>exec</td> <td>os/exec</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>scanner</td> <td>text/scanner</td></tr>
-<tr><td>tabwriter</td> <td>text/tabwriter</td></tr>
-<tr><td>template</td> <td>text/template</td></tr>
-<tr><td>template/parse</td> <td>text/template/parse</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>utf8</td> <td>unicode/utf8</td></tr>
-<tr><td>utf16</td> <td>unicode/utf16</td></tr>
-</table>
-
-<p>
-Note that the package names for the old <code>cmath</code> and
-<code>exp/template/html</code> packages have changed to <code>cmplx</code>
-and <code>template</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update all imports and package renames for packages that
-remain inside the standard repository. Programs that import packages
-that are no longer in the standard repository will need to be edited
-by hand.
-</p>
-
-<h3 id="exp">The package tree exp</h3>
-
-<p>
-Because they are not standardized, the packages under the <code>exp</code> directory will not be available in the
-standard Go 1 release distributions, although they will be available in source code form
-in <a href="//code.google.com/p/go/">the repository</a> for
-developers who wish to use them.
-</p>
-
-<p>
-Several packages have moved under <code>exp</code> at the time of Go 1's release:
-</p>
-
-<ul>
-<li><code>ebnf</code></li>
-<li><code>html</code><sup>&#8224;</sup></li>
-<li><code>go/types</code></li>
-</ul>
-
-<p>
-(<sup>&#8224;</sup>The <code>EscapeString</code> and <code>UnescapeString</code> types remain
-in package <code>html</code>.)
-</p>
-
-<p>
-All these packages are available under the same names, with the prefix <code>exp/</code>: <code>exp/ebnf</code> etc.
-</p>
-
-<p>
-Also, the <code>utf8.String</code> type has been moved to its own package, <code>exp/utf8string</code>.
-</p>
-
-<p>
-Finally, the <code>gotype</code> command now resides in <code>exp/gotype</code>, while
-<code>ebnflint</code> is now in <code>exp/ebnflint</code>.
-If they are installed, they now reside in <code>$GOROOT/bin/tool</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that uses packages in <code>exp</code> will need to be updated by hand,
-or else compiled from an installation that has <code>exp</code> available.
-The <code>go</code> <code>fix</code> tool or the compiler will complain about such uses.
-</p>
-
-<h3 id="old">The package tree old</h3>
-
-<p>
-Because they are deprecated, the packages under the <code>old</code> directory will not be available in the
-standard Go 1 release distributions, although they will be available in source code form for
-developers who wish to use them.
-</p>
-
-<p>
-The packages in their new locations are:
-</p>
-
-<ul>
-<li><code>old/netchan</code></li>
-</ul>
-
-<p>
-<em>Updating</em>:
-Code that uses packages now in <code>old</code> will need to be updated by hand,
-or else compiled from an installation that has <code>old</code> available.
-The <code>go</code> <code>fix</code> tool will warn about such uses.
-</p>
-
-<h3 id="deleted">Deleted packages</h3>
-
-<p>
-Go 1 deletes several packages outright:
-</p>
-
-<ul>
-<li><code>container/vector</code></li>
-<li><code>exp/datafmt</code></li>
-<li><code>go/typechecker</code></li>
-<li><code>old/regexp</code></li>
-<li><code>old/template</code></li>
-<li><code>try</code></li>
-</ul>
-
-<p>
-and also the command <code>gotry</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that uses <code>container/vector</code> should be updated to use
-slices directly. See
-<a href="//code.google.com/p/go-wiki/wiki/SliceTricks">the Go
-Language Community Wiki</a> for some suggestions.
-Code that uses the other packages (there should be almost zero) will need to be rethought.
-</p>
-
-<h3 id="subrepo">Packages moving to subrepositories</h3>
-
-<p>
-Go 1 has moved a number of packages into other repositories, usually sub-repositories of
-<a href="//code.google.com/p/go/">the main Go repository</a>.
-This table lists the old and new import paths:
-
-<table class="codetable" frame="border" summary="Sub-repositories">
-<colgroup align="left" width="40%"></colgroup>
-<colgroup align="left" width="60%"></colgroup>
-<tr>
-<th align="left">Old</th>
-<th align="left">New</th>
-</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>crypto/bcrypt</td> <td>code.google.com/p/go.crypto/bcrypt</tr>
-<tr><td>crypto/blowfish</td> <td>code.google.com/p/go.crypto/blowfish</tr>
-<tr><td>crypto/cast5</td> <td>code.google.com/p/go.crypto/cast5</tr>
-<tr><td>crypto/md4</td> <td>code.google.com/p/go.crypto/md4</tr>
-<tr><td>crypto/ocsp</td> <td>code.google.com/p/go.crypto/ocsp</tr>
-<tr><td>crypto/openpgp</td> <td>code.google.com/p/go.crypto/openpgp</tr>
-<tr><td>crypto/openpgp/armor</td> <td>code.google.com/p/go.crypto/openpgp/armor</tr>
-<tr><td>crypto/openpgp/elgamal</td> <td>code.google.com/p/go.crypto/openpgp/elgamal</tr>
-<tr><td>crypto/openpgp/errors</td> <td>code.google.com/p/go.crypto/openpgp/errors</tr>
-<tr><td>crypto/openpgp/packet</td> <td>code.google.com/p/go.crypto/openpgp/packet</tr>
-<tr><td>crypto/openpgp/s2k</td> <td>code.google.com/p/go.crypto/openpgp/s2k</tr>
-<tr><td>crypto/ripemd160</td> <td>code.google.com/p/go.crypto/ripemd160</tr>
-<tr><td>crypto/twofish</td> <td>code.google.com/p/go.crypto/twofish</tr>
-<tr><td>crypto/xtea</td> <td>code.google.com/p/go.crypto/xtea</tr>
-<tr><td>exp/ssh</td> <td>code.google.com/p/go.crypto/ssh</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>image/bmp</td> <td>code.google.com/p/go.image/bmp</tr>
-<tr><td>image/tiff</td> <td>code.google.com/p/go.image/tiff</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>net/dict</td> <td>code.google.com/p/go.net/dict</tr>
-<tr><td>net/websocket</td> <td>code.google.com/p/go.net/websocket</tr>
-<tr><td>exp/spdy</td> <td>code.google.com/p/go.net/spdy</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>encoding/git85</td> <td>code.google.com/p/go.codereview/git85</tr>
-<tr><td>patch</td> <td>code.google.com/p/go.codereview/patch</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>exp/wingui</td> <td>code.google.com/p/gowingui</tr>
-</table>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update imports of these packages to use the new import paths.
-Installations that depend on these packages will need to install them using
-a <code>go get</code> command.
-</p>
-
-<h2 id="major">Major changes to the library</h2>
-
-<p>
-This section describes significant changes to the core libraries, the ones that
-affect the most programs.
-</p>
-
-<h3 id="errors">The error type and errors package</h3>
-
-<p>
-The placement of <code>os.Error</code> in package <code>os</code> is mostly historical: errors first came up when implementing package <code>os</code>, and they seemed system-related at the time.
-Since then it has become clear that errors are more fundamental than the operating system. For example, it would be nice to use <code>Errors</code> in packages that <code>os</code> depends on, like <code>syscall</code>.
-Also, having <code>Error</code> in <code>os</code> introduces many dependencies on <code>os</code> that would otherwise not exist.
-</p>
-
-<p>
-Go 1 solves these problems by introducing a built-in <code>error</code> interface type and a separate <code>errors</code> package (analogous to <code>bytes</code> and <code>strings</code>) that contains utility functions.
-It replaces <code>os.NewError</code> with
-<a href="/pkg/errors/#New"><code>errors.New</code></a>,
-giving errors a more central place in the environment.
-</p>
-
-<p>
-So the widely-used <code>String</code> method does not cause accidental satisfaction
-of the <code>error</code> interface, the <code>error</code> interface uses instead
-the name <code>Error</code> for that method:
-</p>
-
-<pre>
- type error interface {
- Error() string
- }
-</pre>
-
-<p>
-The <code>fmt</code> library automatically invokes <code>Error</code>, as it already
-does for <code>String</code>, for easy printing of error values.
-</p>
-
-{{code "/doc/progs/go1.go" `/START ERROR EXAMPLE/` `/END ERROR EXAMPLE/`}}
-
-<p>
-All standard packages have been updated to use the new interface; the old <code>os.Error</code> is gone.
-</p>
-
-<p>
-A new package, <a href="/pkg/errors/"><code>errors</code></a>, contains the function
-</p>
-
-<pre>
-func New(text string) error
-</pre>
-
-<p>
-to turn a string into an error. It replaces the old <code>os.NewError</code>.
-</p>
-
-{{code "/doc/progs/go1.go" `/ErrSyntax/`}}
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update almost all code affected by the change.
-Code that defines error types with a <code>String</code> method will need to be updated
-by hand to rename the methods to <code>Error</code>.
-</p>
-
-<h3 id="errno">System call errors</h3>
-
-<p>
-The old <code>syscall</code> package, which predated <code>os.Error</code>
-(and just about everything else),
-returned errors as <code>int</code> values.
-In turn, the <code>os</code> package forwarded many of these errors, such
-as <code>EINVAL</code>, but using a different set of errors on each platform.
-This behavior was unpleasant and unportable.
-</p>
-
-<p>
-In Go 1, the
-<a href="/pkg/syscall/"><code>syscall</code></a>
-package instead returns an <code>error</code> for system call errors.
-On Unix, the implementation is done by a
-<a href="/pkg/syscall/#Errno"><code>syscall.Errno</code></a> type
-that satisfies <code>error</code> and replaces the old <code>os.Errno</code>.
-</p>
-
-<p>
-The changes affecting <code>os.EINVAL</code> and relatives are
-described <a href="#os">elsewhere</a>.
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update almost all code affected by the change.
-Regardless, most code should use the <code>os</code> package
-rather than <code>syscall</code> and so will be unaffected.
-</p>
-
-<h3 id="time">Time</h3>
-
-<p>
-Time is always a challenge to support well in a programming language.
-The old Go <code>time</code> package had <code>int64</code> units, no
-real type safety,
-and no distinction between absolute times and durations.
-</p>
-
-<p>
-One of the most sweeping changes in the Go 1 library is therefore a
-complete redesign of the
-<a href="/pkg/time/"><code>time</code></a> package.
-Instead of an integer number of nanoseconds as an <code>int64</code>,
-and a separate <code>*time.Time</code> type to deal with human
-units such as hours and years,
-there are now two fundamental types:
-<a href="/pkg/time/#Time"><code>time.Time</code></a>
-(a value, so the <code>*</code> is gone), which represents a moment in time;
-and <a href="/pkg/time/#Duration"><code>time.Duration</code></a>,
-which represents an interval.
-Both have nanosecond resolution.
-A <code>Time</code> can represent any time into the ancient
-past and remote future, while a <code>Duration</code> can
-span plus or minus only about 290 years.
-There are methods on these types, plus a number of helpful
-predefined constant durations such as <code>time.Second</code>.
-</p>
-
-<p>
-Among the new methods are things like
-<a href="/pkg/time/#Time.Add"><code>Time.Add</code></a>,
-which adds a <code>Duration</code> to a <code>Time</code>, and
-<a href="/pkg/time/#Time.Sub"><code>Time.Sub</code></a>,
-which subtracts two <code>Times</code> to yield a <code>Duration</code>.
-</p>
-
-<p>
-The most important semantic change is that the Unix epoch (Jan 1, 1970) is now
-relevant only for those functions and methods that mention Unix:
-<a href="/pkg/time/#Unix"><code>time.Unix</code></a>
-and the <a href="/pkg/time/#Time.Unix"><code>Unix</code></a>
-and <a href="/pkg/time/#Time.UnixNano"><code>UnixNano</code></a> methods
-of the <code>Time</code> type.
-In particular,
-<a href="/pkg/time/#Now"><code>time.Now</code></a>
-returns a <code>time.Time</code> value rather than, in the old
-API, an integer nanosecond count since the Unix epoch.
-</p>
-
-{{code "/doc/progs/go1.go" `/sleepUntil/` `/^}/`}}
-
-<p>
-The new types, methods, and constants have been propagated through
-all the standard packages that use time, such as <code>os</code> and
-its representation of file time stamps.
-</p>
-
-<p>
-<em>Updating</em>:
-The <code>go</code> <code>fix</code> tool will update many uses of the old <code>time</code> package to use the new
-types and methods, although it does not replace values such as <code>1e9</code>
-representing nanoseconds per second.
-Also, because of type changes in some of the values that arise,
-some of the expressions rewritten by the fix tool may require
-further hand editing; in such cases the rewrite will include
-the correct function or method for the old functionality, but
-may have the wrong type or require further analysis.
-</p>
-
-<h2 id="minor">Minor changes to the library</h2>
-
-<p>
-This section describes smaller changes, such as those to less commonly
-used packages or that affect
-few programs beyond the need to run <code>go</code> <code>fix</code>.
-This category includes packages that are new in Go 1.
-Collectively they improve portability, regularize behavior, and
-make the interfaces more modern and Go-like.
-</p>
-
-<h3 id="archive_zip">The archive/zip package</h3>
-
-<p>
-In Go 1, <a href="/pkg/archive/zip/#Writer"><code>*zip.Writer</code></a> no
-longer has a <code>Write</code> method. Its presence was a mistake.
-</p>
-
-<p>
-<em>Updating</em>:
-What little code is affected will be caught by the compiler and must be updated by hand.
-</p>
-
-<h3 id="bufio">The bufio package</h3>
-
-<p>
-In Go 1, <a href="/pkg/bufio/#NewReaderSize"><code>bufio.NewReaderSize</code></a>
-and
-<a href="/pkg/bufio/#NewWriterSize"><code>bufio.NewWriterSize</code></a>
-functions no longer return an error for invalid sizes.
-If the argument size is too small or invalid, it is adjusted.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update calls that assign the error to _.
-Calls that aren't fixed will be caught by the compiler and must be updated by hand.
-</p>
-
-<h3 id="compress">The compress/flate, compress/gzip and compress/zlib packages</h3>
-
-<p>
-In Go 1, the <code>NewWriterXxx</code> functions in
-<a href="/pkg/compress/flate"><code>compress/flate</code></a>,
-<a href="/pkg/compress/gzip"><code>compress/gzip</code></a> and
-<a href="/pkg/compress/zlib"><code>compress/zlib</code></a>
-all return <code>(*Writer, error)</code> if they take a compression level,
-and <code>*Writer</code> otherwise. Package <code>gzip</code>'s
-<code>Compressor</code> and <code>Decompressor</code> types have been renamed
-to <code>Writer</code> and <code>Reader</code>. Package <code>flate</code>'s
-<code>WrongValueError</code> type has been removed.
-</p>
-
-<p>
-<em>Updating</em>
-Running <code>go</code> <code>fix</code> will update old names and calls that assign the error to _.
-Calls that aren't fixed will be caught by the compiler and must be updated by hand.
-</p>
-
-<h3 id="crypto_aes_des">The crypto/aes and crypto/des packages</h3>
-
-<p>
-In Go 1, the <code>Reset</code> method has been removed. Go does not guarantee
-that memory is not copied and therefore this method was misleading.
-</p>
-
-<p>
-The cipher-specific types <code>*aes.Cipher</code>, <code>*des.Cipher</code>,
-and <code>*des.TripleDESCipher</code> have been removed in favor of
-<code>cipher.Block</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Remove the calls to Reset. Replace uses of the specific cipher types with
-cipher.Block.
-</p>
-
-<h3 id="crypto_elliptic">The crypto/elliptic package</h3>
-
-<p>
-In Go 1, <a href="/pkg/crypto/elliptic/#Curve"><code>elliptic.Curve</code></a>
-has been made an interface to permit alternative implementations. The curve
-parameters have been moved to the
-<a href="/pkg/crypto/elliptic/#CurveParams"><code>elliptic.CurveParams</code></a>
-structure.
-</p>
-
-<p>
-<em>Updating</em>:
-Existing users of <code>*elliptic.Curve</code> will need to change to
-simply <code>elliptic.Curve</code>. Calls to <code>Marshal</code>,
-<code>Unmarshal</code> and <code>GenerateKey</code> are now functions
-in <code>crypto/elliptic</code> that take an <code>elliptic.Curve</code>
-as their first argument.
-</p>
-
-<h3 id="crypto_hmac">The crypto/hmac package</h3>
-
-<p>
-In Go 1, the hash-specific functions, such as <code>hmac.NewMD5</code>, have
-been removed from <code>crypto/hmac</code>. Instead, <code>hmac.New</code> takes
-a function that returns a <code>hash.Hash</code>, such as <code>md5.New</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will perform the needed changes.
-</p>
-
-<h3 id="crypto_x509">The crypto/x509 package</h3>
-
-<p>
-In Go 1, the
-<a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
-function and
-<a href="/pkg/crypto/x509/#Certificate.CreateCRL"><code>CreateCRL</code></a>
-method in <code>crypto/x509</code> have been altered to take an
-<code>interface{}</code> where they previously took a <code>*rsa.PublicKey</code>
-or <code>*rsa.PrivateKey</code>. This will allow other public key algorithms
-to be implemented in the future.
-</p>
-
-<p>
-<em>Updating</em>:
-No changes will be needed.
-</p>
-
-<h3 id="encoding_binary">The encoding/binary package</h3>
-
-<p>
-In Go 1, the <code>binary.TotalSize</code> function has been replaced by
-<a href="/pkg/encoding/binary/#Size"><code>Size</code></a>,
-which takes an <code>interface{}</code> argument rather than
-a <code>reflect.Value</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-What little code is affected will be caught by the compiler and must be updated by hand.
-</p>
-
-<h3 id="encoding_xml">The encoding/xml package</h3>
-
-<p>
-In Go 1, the <a href="/pkg/encoding/xml/"><code>xml</code></a> package
-has been brought closer in design to the other marshaling packages such
-as <a href="/pkg/encoding/gob/"><code>encoding/gob</code></a>.
-</p>
-
-<p>
-The old <code>Parser</code> type is renamed
-<a href="/pkg/encoding/xml/#Decoder"><code>Decoder</code></a> and has a new
-<a href="/pkg/encoding/xml/#Decoder.Decode"><code>Decode</code></a> method. An
-<a href="/pkg/encoding/xml/#Encoder"><code>Encoder</code></a> type was also introduced.
-</p>
-
-<p>
-The functions <a href="/pkg/encoding/xml/#Marshal"><code>Marshal</code></a>
-and <a href="/pkg/encoding/xml/#Unmarshal"><code>Unmarshal</code></a>
-work with <code>[]byte</code> values now. To work with streams,
-use the new <a href="/pkg/encoding/xml/#Encoder"><code>Encoder</code></a>
-and <a href="/pkg/encoding/xml/#Decoder"><code>Decoder</code></a> types.
-</p>
-
-<p>
-When marshaling or unmarshaling values, the format of supported flags in
-field tags has changed to be closer to the
-<a href="/pkg/encoding/json"><code>json</code></a> package
-(<code>`xml:"name,flag"`</code>). The matching done between field tags, field
-names, and the XML attribute and element names is now case-sensitive.
-The <code>XMLName</code> field tag, if present, must also match the name
-of the XML element being marshaled.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update most uses of the package except for some calls to
-<code>Unmarshal</code>. Special care must be taken with field tags,
-since the fix tool will not update them and if not fixed by hand they will
-misbehave silently in some cases. For example, the old
-<code>"attr"</code> is now written <code>",attr"</code> while plain
-<code>"attr"</code> remains valid but with a different meaning.
-</p>
-
-<h3 id="expvar">The expvar package</h3>
-
-<p>
-In Go 1, the <code>RemoveAll</code> function has been removed.
-The <code>Iter</code> function and Iter method on <code>*Map</code> have
-been replaced by
-<a href="/pkg/expvar/#Do"><code>Do</code></a>
-and
-<a href="/pkg/expvar/#Map.Do"><code>(*Map).Do</code></a>.
-</p>
-
-<p>
-<em>Updating</em>:
-Most code using <code>expvar</code> will not need changing. The rare code that used
-<code>Iter</code> can be updated to pass a closure to <code>Do</code> to achieve the same effect.
-</p>
-
-<h3 id="flag">The flag package</h3>
-
-<p>
-In Go 1, the interface <a href="/pkg/flag/#Value"><code>flag.Value</code></a> has changed slightly.
-The <code>Set</code> method now returns an <code>error</code> instead of
-a <code>bool</code> to indicate success or failure.
-</p>
-
-<p>
-There is also a new kind of flag, <code>Duration</code>, to support argument
-values specifying time intervals.
-Values for such flags must be given units, just as <code>time.Duration</code>
-formats them: <code>10s</code>, <code>1h30m</code>, etc.
-</p>
-
-{{code "/doc/progs/go1.go" `/timeout/`}}
-
-<p>
-<em>Updating</em>:
-Programs that implement their own flags will need minor manual fixes to update their
-<code>Set</code> methods.
-The <code>Duration</code> flag is new and affects no existing code.
-</p>
-
-
-<h3 id="go">The go/* packages</h3>
-
-<p>
-Several packages under <code>go</code> have slightly revised APIs.
-</p>
-
-<p>
-A concrete <code>Mode</code> type was introduced for configuration mode flags
-in the packages
-<a href="/pkg/go/scanner/"><code>go/scanner</code></a>,
-<a href="/pkg/go/parser/"><code>go/parser</code></a>,
-<a href="/pkg/go/printer/"><code>go/printer</code></a>, and
-<a href="/pkg/go/doc/"><code>go/doc</code></a>.
-</p>
-
-<p>
-The modes <code>AllowIllegalChars</code> and <code>InsertSemis</code> have been removed
-from the <a href="/pkg/go/scanner/"><code>go/scanner</code></a> package. They were mostly
-useful for scanning text other then Go source files. Instead, the
-<a href="/pkg/text/scanner/"><code>text/scanner</code></a> package should be used
-for that purpose.
-</p>
-
-<p>
-The <a href="/pkg/go/scanner/#ErrorHandler"><code>ErrorHandler</code></a> provided
-to the scanner's <a href="/pkg/go/scanner/#Scanner.Init"><code>Init</code></a> method is
-now simply a function rather than an interface. The <code>ErrorVector</code> type has
-been removed in favor of the (existing) <a href="/pkg/go/scanner/#ErrorList"><code>ErrorList</code></a>
-type, and the <code>ErrorVector</code> methods have been migrated. Instead of embedding
-an <code>ErrorVector</code> in a client of the scanner, now a client should maintain
-an <code>ErrorList</code>.
-</p>
-
-<p>
-The set of parse functions provided by the <a href="/pkg/go/parser/"><code>go/parser</code></a>
-package has been reduced to the primary parse function
-<a href="/pkg/go/parser/#ParseFile"><code>ParseFile</code></a>, and a couple of
-convenience functions <a href="/pkg/go/parser/#ParseDir"><code>ParseDir</code></a>
-and <a href="/pkg/go/parser/#ParseExpr"><code>ParseExpr</code></a>.
-</p>
-
-<p>
-The <a href="/pkg/go/printer/"><code>go/printer</code></a> package supports an additional
-configuration mode <a href="/pkg/go/printer/#Mode"><code>SourcePos</code></a>;
-if set, the printer will emit <code>//line</code> comments such that the generated
-output contains the original source code position information. The new type
-<a href="/pkg/go/printer/#CommentedNode"><code>CommentedNode</code></a> can be
-used to provide comments associated with an arbitrary
-<a href="/pkg/go/ast/#Node"><code>ast.Node</code></a> (until now only
-<a href="/pkg/go/ast/#File"><code>ast.File</code></a> carried comment information).
-</p>
-
-<p>
-The type names of the <a href="/pkg/go/doc/"><code>go/doc</code></a> package have been
-streamlined by removing the <code>Doc</code> suffix: <code>PackageDoc</code>
-is now <code>Package</code>, <code>ValueDoc</code> is <code>Value</code>, etc.
-Also, all types now consistently have a <code>Name</code> field (or <code>Names</code>,
-in the case of type <code>Value</code>) and <code>Type.Factories</code> has become
-<code>Type.Funcs</code>.
-Instead of calling <code>doc.NewPackageDoc(pkg, importpath)</code>,
-documentation for a package is created with:
-</p>
-
-<pre>
- doc.New(pkg, importpath, mode)
-</pre>
-
-<p>
-where the new <code>mode</code> parameter specifies the operation mode:
-if set to <a href="/pkg/go/doc/#AllDecls"><code>AllDecls</code></a>, all declarations
-(not just exported ones) are considered.
-The function <code>NewFileDoc</code> was removed, and the function
-<code>CommentText</code> has become the method
-<a href="/pkg/go/ast/#CommentGroup.Text"><code>Text</code></a> of
-<a href="/pkg/go/ast/#CommentGroup"><code>ast.CommentGroup</code></a>.
-</p>
-
-<p>
-In package <a href="/pkg/go/token/"><code>go/token</code></a>, the
-<a href="/pkg/go/token/#FileSet"><code>token.FileSet</code></a> method <code>Files</code>
-(which originally returned a channel of <code>*token.File</code>s) has been replaced
-with the iterator <a href="/pkg/go/token/#FileSet.Iterate"><code>Iterate</code></a> that
-accepts a function argument instead.
-</p>
-
-<p>
-In package <a href="/pkg/go/build/"><code>go/build</code></a>, the API
-has been nearly completely replaced.
-The package still computes Go package information
-but it does not run the build: the <code>Cmd</code> and <code>Script</code>
-types are gone.
-(To build code, use the new
-<a href="/cmd/go/"><code>go</code></a> command instead.)
-The <code>DirInfo</code> type is now named
-<a href="/pkg/go/build/#Package"><code>Package</code></a>.
-<code>FindTree</code> and <code>ScanDir</code> are replaced by
-<a href="/pkg/go/build/#Import"><code>Import</code></a>
-and
-<a href="/pkg/go/build/#ImportDir"><code>ImportDir</code></a>.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that uses packages in <code>go</code> will have to be updated by hand; the
-compiler will reject incorrect uses. Templates used in conjunction with any of the
-<code>go/doc</code> types may need manual fixes; the renamed fields will lead
-to run-time errors.
-</p>
-
-<h3 id="hash">The hash package</h3>
-
-<p>
-In Go 1, the definition of <a href="/pkg/hash/#Hash"><code>hash.Hash</code></a> includes
-a new method, <code>BlockSize</code>. This new method is used primarily in the
-cryptographic libraries.
-</p>
-
-<p>
-The <code>Sum</code> method of the
-<a href="/pkg/hash/#Hash"><code>hash.Hash</code></a> interface now takes a
-<code>[]byte</code> argument, to which the hash value will be appended.
-The previous behavior can be recreated by adding a <code>nil</code> argument to the call.
-</p>
-
-<p>
-<em>Updating</em>:
-Existing implementations of <code>hash.Hash</code> will need to add a
-<code>BlockSize</code> method. Hashes that process the input one byte at
-a time can implement <code>BlockSize</code> to return 1.
-Running <code>go</code> <code>fix</code> will update calls to the <code>Sum</code> methods of the various
-implementations of <code>hash.Hash</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Since the package's functionality is new, no updating is necessary.
-</p>
-
-<h3 id="http">The http package</h3>
-
-<p>
-In Go 1 the <a href="/pkg/net/http/"><code>http</code></a> package is refactored,
-putting some of the utilities into a
-<a href="/pkg/net/http/httputil/"><code>httputil</code></a> subdirectory.
-These pieces are only rarely needed by HTTP clients.
-The affected items are:
-</p>
-
-<ul>
-<li>ClientConn</li>
-<li>DumpRequest</li>
-<li>DumpRequestOut</li>
-<li>DumpResponse</li>
-<li>NewChunkedReader</li>
-<li>NewChunkedWriter</li>
-<li>NewClientConn</li>
-<li>NewProxyClientConn</li>
-<li>NewServerConn</li>
-<li>NewSingleHostReverseProxy</li>
-<li>ReverseProxy</li>
-<li>ServerConn</li>
-</ul>
-
-<p>
-The <code>Request.RawURL</code> field has been removed; it was a
-historical artifact.
-</p>
-
-<p>
-The <code>Handle</code> and <code>HandleFunc</code>
-functions, and the similarly-named methods of <code>ServeMux</code>,
-now panic if an attempt is made to register the same pattern twice.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update the few programs that are affected except for
-uses of <code>RawURL</code>, which must be fixed by hand.
-</p>
-
-<h3 id="image">The image package</h3>
-
-<p>
-The <a href="/pkg/image/"><code>image</code></a> package has had a number of
-minor changes, rearrangements and renamings.
-</p>
-
-<p>
-Most of the color handling code has been moved into its own package,
-<a href="/pkg/image/color/"><code>image/color</code></a>.
-For the elements that moved, a symmetry arises; for instance,
-each pixel of an
-<a href="/pkg/image/#RGBA"><code>image.RGBA</code></a>
-is a
-<a href="/pkg/image/color/#RGBA"><code>color.RGBA</code></a>.
-</p>
-
-<p>
-The old <code>image/ycbcr</code> package has been folded, with some
-renamings, into the
-<a href="/pkg/image/"><code>image</code></a>
-and
-<a href="/pkg/image/color/"><code>image/color</code></a>
-packages.
-</p>
-
-<p>
-The old <code>image.ColorImage</code> type is still in the <code>image</code>
-package but has been renamed
-<a href="/pkg/image/#Uniform"><code>image.Uniform</code></a>,
-while <code>image.Tiled</code> has been removed.
-</p>
-
-<p>
-This table lists the renamings.
-</p>
-
-<table class="codetable" frame="border" summary="image renames">
-<colgroup align="left" width="50%"></colgroup>
-<colgroup align="left" width="50%"></colgroup>
-<tr>
-<th align="left">Old</th>
-<th align="left">New</th>
-</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>image.Color</td> <td>color.Color</td></tr>
-<tr><td>image.ColorModel</td> <td>color.Model</td></tr>
-<tr><td>image.ColorModelFunc</td> <td>color.ModelFunc</td></tr>
-<tr><td>image.PalettedColorModel</td> <td>color.Palette</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>image.RGBAColor</td> <td>color.RGBA</td></tr>
-<tr><td>image.RGBA64Color</td> <td>color.RGBA64</td></tr>
-<tr><td>image.NRGBAColor</td> <td>color.NRGBA</td></tr>
-<tr><td>image.NRGBA64Color</td> <td>color.NRGBA64</td></tr>
-<tr><td>image.AlphaColor</td> <td>color.Alpha</td></tr>
-<tr><td>image.Alpha16Color</td> <td>color.Alpha16</td></tr>
-<tr><td>image.GrayColor</td> <td>color.Gray</td></tr>
-<tr><td>image.Gray16Color</td> <td>color.Gray16</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>image.RGBAColorModel</td> <td>color.RGBAModel</td></tr>
-<tr><td>image.RGBA64ColorModel</td> <td>color.RGBA64Model</td></tr>
-<tr><td>image.NRGBAColorModel</td> <td>color.NRGBAModel</td></tr>
-<tr><td>image.NRGBA64ColorModel</td> <td>color.NRGBA64Model</td></tr>
-<tr><td>image.AlphaColorModel</td> <td>color.AlphaModel</td></tr>
-<tr><td>image.Alpha16ColorModel</td> <td>color.Alpha16Model</td></tr>
-<tr><td>image.GrayColorModel</td> <td>color.GrayModel</td></tr>
-<tr><td>image.Gray16ColorModel</td> <td>color.Gray16Model</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>ycbcr.RGBToYCbCr</td> <td>color.RGBToYCbCr</td></tr>
-<tr><td>ycbcr.YCbCrToRGB</td> <td>color.YCbCrToRGB</td></tr>
-<tr><td>ycbcr.YCbCrColorModel</td> <td>color.YCbCrModel</td></tr>
-<tr><td>ycbcr.YCbCrColor</td> <td>color.YCbCr</td></tr>
-<tr><td>ycbcr.YCbCr</td> <td>image.YCbCr</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>ycbcr.SubsampleRatio444</td> <td>image.YCbCrSubsampleRatio444</td></tr>
-<tr><td>ycbcr.SubsampleRatio422</td> <td>image.YCbCrSubsampleRatio422</td></tr>
-<tr><td>ycbcr.SubsampleRatio420</td> <td>image.YCbCrSubsampleRatio420</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>image.ColorImage</td> <td>image.Uniform</td></tr>
-</table>
-
-<p>
-The image package's <code>New</code> functions
-(<a href="/pkg/image/#NewRGBA"><code>NewRGBA</code></a>,
-<a href="/pkg/image/#NewRGBA64"><code>NewRGBA64</code></a>, etc.)
-take an <a href="/pkg/image/#Rectangle"><code>image.Rectangle</code></a> as an argument
-instead of four integers.
-</p>
-
-<p>
-Finally, there are new predefined <code>color.Color</code> variables
-<a href="/pkg/image/color/#Black"><code>color.Black</code></a>,
-<a href="/pkg/image/color/#White"><code>color.White</code></a>,
-<a href="/pkg/image/color/#Opaque"><code>color.Opaque</code></a>
-and
-<a href="/pkg/image/color/#Transparent"><code>color.Transparent</code></a>.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update almost all code affected by the change.
-</p>
-
-<h3 id="log_syslog">The log/syslog package</h3>
-
-<p>
-In Go 1, the <a href="/pkg/log/syslog/#NewLogger"><code>syslog.NewLogger</code></a>
-function returns an error as well as a <code>log.Logger</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-What little code is affected will be caught by the compiler and must be updated by hand.
-</p>
-
-<h3 id="mime">The mime package</h3>
-
-<p>
-In Go 1, the <a href="/pkg/mime/#FormatMediaType"><code>FormatMediaType</code></a> function
-of the <code>mime</code> package has been simplified to make it
-consistent with
-<a href="/pkg/mime/#ParseMediaType"><code>ParseMediaType</code></a>.
-It now takes <code>"text/html"</code> rather than <code>"text"</code> and <code>"html"</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-What little code is affected will be caught by the compiler and must be updated by hand.
-</p>
-
-<h3 id="net">The net package</h3>
-
-<p>
-In Go 1, the various <code>SetTimeout</code>,
-<code>SetReadTimeout</code>, and <code>SetWriteTimeout</code> methods
-have been replaced with
-<a href="/pkg/net/#IPConn.SetDeadline"><code>SetDeadline</code></a>,
-<a href="/pkg/net/#IPConn.SetReadDeadline"><code>SetReadDeadline</code></a>, and
-<a href="/pkg/net/#IPConn.SetWriteDeadline"><code>SetWriteDeadline</code></a>,
-respectively. Rather than taking a timeout value in nanoseconds that
-apply to any activity on the connection, the new methods set an
-absolute deadline (as a <code>time.Time</code> value) after which
-reads and writes will time out and no longer block.
-</p>
-
-<p>
-There are also new functions
-<a href="/pkg/net/#DialTimeout"><code>net.DialTimeout</code></a>
-to simplify timing out dialing a network address and
-<a href="/pkg/net/#ListenMulticastUDP"><code>net.ListenMulticastUDP</code></a>
-to allow multicast UDP to listen concurrently across multiple listeners.
-The <code>net.ListenMulticastUDP</code> function replaces the old
-<code>JoinGroup</code> and <code>LeaveGroup</code> methods.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that uses the old methods will fail to compile and must be updated by hand.
-The semantic change makes it difficult for the fix tool to update automatically.
-</p>
-
-<h3 id="os">The os package</h3>
-
-<p>
-The <code>Time</code> function has been removed; callers should use
-the <a href="/pkg/time/#Time"><code>Time</code></a> type from the
-<code>time</code> package.
-</p>
-
-<p>
-The <code>Exec</code> function has been removed; callers should use
-<code>Exec</code> from the <code>syscall</code> package, where available.
-</p>
-
-<p>
-The <code>ShellExpand</code> function has been renamed to <a
-href="/pkg/os/#ExpandEnv"><code>ExpandEnv</code></a>.
-</p>
-
-<p>
-The <a href="/pkg/os/#NewFile"><code>NewFile</code></a> function
-now takes a <code>uintptr</code> fd, instead of an <code>int</code>.
-The <a href="/pkg/os/#File.Fd"><code>Fd</code></a> method on files now
-also returns a <code>uintptr</code>.
-</p>
-
-<p>
-There are no longer error constants such as <code>EINVAL</code>
-in the <code>os</code> package, since the set of values varied with
-the underlying operating system. There are new portable functions like
-<a href="/pkg/os/#IsPermission"><code>IsPermission</code></a>
-to test common error properties, plus a few new error values
-with more Go-like names, such as
-<a href="/pkg/os/#ErrPermission"><code>ErrPermission</code></a>
-and
-<a href="/pkg/os/#ErrNotExist"><code>ErrNotExist</code></a>.
-</p>
-
-<p>
-The <code>Getenverror</code> function has been removed. To distinguish
-between a non-existent environment variable and an empty string,
-use <a href="/pkg/os/#Environ"><code>os.Environ</code></a> or
-<a href="/pkg/syscall/#Getenv"><code>syscall.Getenv</code></a>.
-</p>
-
-
-<p>
-The <a href="/pkg/os/#Process.Wait"><code>Process.Wait</code></a> method has
-dropped its option argument and the associated constants are gone
-from the package.
-Also, the function <code>Wait</code> is gone; only the method of
-the <code>Process</code> type persists.
-</p>
-
-<p>
-The <code>Waitmsg</code> type returned by
-<a href="/pkg/os/#Process.Wait"><code>Process.Wait</code></a>
-has been replaced with a more portable
-<a href="/pkg/os/#ProcessState"><code>ProcessState</code></a>
-type with accessor methods to recover information about the
-process.
-Because of changes to <code>Wait</code>, the <code>ProcessState</code>
-value always describes an exited process.
-Portability concerns simplified the interface in other ways, but the values returned by the
-<a href="/pkg/os/#ProcessState.Sys"><code>ProcessState.Sys</code></a> and
-<a href="/pkg/os/#ProcessState.SysUsage"><code>ProcessState.SysUsage</code></a>
-methods can be type-asserted to underlying system-specific data structures such as
-<a href="/pkg/syscall/#WaitStatus"><code>syscall.WaitStatus</code></a> and
-<a href="/pkg/syscall/#Rusage"><code>syscall.Rusage</code></a> on Unix.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will drop a zero argument to <code>Process.Wait</code>.
-All other changes will be caught by the compiler and must be updated by hand.
-</p>
-
-<h4 id="os_fileinfo">The os.FileInfo type</h4>
-
-<p>
-Go 1 redefines the <a href="/pkg/os/#FileInfo"><code>os.FileInfo</code></a> type,
-changing it from a struct to an interface:
-</p>
-
-<pre>
- type FileInfo interface {
- Name() string // base name of the file
- Size() int64 // length in bytes
- Mode() FileMode // file mode bits
- ModTime() time.Time // modification time
- IsDir() bool // abbreviation for Mode().IsDir()
- Sys() interface{} // underlying data source (can return nil)
- }
-</pre>
-
-<p>
-The file mode information has been moved into a subtype called
-<a href="/pkg/os/#FileMode"><code>os.FileMode</code></a>,
-a simple integer type with <code>IsDir</code>, <code>Perm</code>, and <code>String</code>
-methods.
-</p>
-
-<p>
-The system-specific details of file modes and properties such as (on Unix)
-i-number have been removed from <code>FileInfo</code> altogether.
-Instead, each operating system's <code>os</code> package provides an
-implementation of the <code>FileInfo</code> interface, which
-has a <code>Sys</code> method that returns the
-system-specific representation of file metadata.
-For instance, to discover the i-number of a file on a Unix system, unpack
-the <code>FileInfo</code> like this:
-</p>
-
-<pre>
- fi, err := os.Stat("hello.go")
- if err != nil {
- log.Fatal(err)
- }
- // Check that it's a Unix file.
- unixStat, ok := fi.Sys().(*syscall.Stat_t)
- if !ok {
- log.Fatal("hello.go: not a Unix file")
- }
- fmt.Printf("file i-number: %d\n", unixStat.Ino)
-</pre>
-
-<p>
-Assuming (which is unwise) that <code>"hello.go"</code> is a Unix file,
-the i-number expression could be contracted to
-</p>
-
-<pre>
- fi.Sys().(*syscall.Stat_t).Ino
-</pre>
-
-<p>
-The vast majority of uses of <code>FileInfo</code> need only the methods
-of the standard interface.
-</p>
-
-<p>
-The <code>os</code> package no longer contains wrappers for the POSIX errors
-such as <code>ENOENT</code>.
-For the few programs that need to verify particular error conditions, there are
-now the boolean functions
-<a href="/pkg/os/#IsExist"><code>IsExist</code></a>,
-<a href="/pkg/os/#IsNotExist"><code>IsNotExist</code></a>
-and
-<a href="/pkg/os/#IsPermission"><code>IsPermission</code></a>.
-</p>
-
-{{code "/doc/progs/go1.go" `/os\.Open/` `/}/`}}
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update code that uses the old equivalent of the current <code>os.FileInfo</code>
-and <code>os.FileMode</code> API.
-Code that needs system-specific file details will need to be updated by hand.
-Code that uses the old POSIX error values from the <code>os</code> package
-will fail to compile and will also need to be updated by hand.
-</p>
-
-<h3 id="os_signal">The os/signal package</h3>
-
-<p>
-The <code>os/signal</code> package in Go 1 replaces the
-<code>Incoming</code> function, which returned a channel
-that received all incoming signals,
-with the selective <code>Notify</code> function, which asks
-for delivery of specific signals on an existing channel.
-</p>
-
-<p>
-<em>Updating</em>:
-Code must be updated by hand.
-A literal translation of
-</p>
-<pre>
-c := signal.Incoming()
-</pre>
-<p>
-is
-</p>
-<pre>
-c := make(chan os.Signal, 1)
-signal.Notify(c) // ask for all signals
-</pre>
-<p>
-but most code should list the specific signals it wants to handle instead:
-</p>
-<pre>
-c := make(chan os.Signal, 1)
-signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
-</pre>
-
-<h3 id="path_filepath">The path/filepath package</h3>
-
-<p>
-In Go 1, the <a href="/pkg/path/filepath/#Walk"><code>Walk</code></a> function of the
-<code>path/filepath</code> package
-has been changed to take a function value of type
-<a href="/pkg/path/filepath/#WalkFunc"><code>WalkFunc</code></a>
-instead of a <code>Visitor</code> interface value.
-<code>WalkFunc</code> unifies the handling of both files and directories.
-</p>
-
-<pre>
- type WalkFunc func(path string, info os.FileInfo, err error) error
-</pre>
-
-<p>
-The <code>WalkFunc</code> function will be called even for files or directories that could not be opened;
-in such cases the error argument will describe the failure.
-If a directory's contents are to be skipped,
-the function should return the value <a href="/pkg/path/filepath/#pkg-variables"><code>filepath.SkipDir</code></a>
-</p>
-
-{{code "/doc/progs/go1.go" `/STARTWALK/` `/ENDWALK/`}}
-
-<p>
-<em>Updating</em>:
-The change simplifies most code but has subtle consequences, so affected programs
-will need to be updated by hand.
-The compiler will catch code using the old interface.
-</p>
-
-<h3 id="regexp">The regexp package</h3>
-
-<p>
-The <a href="/pkg/regexp/"><code>regexp</code></a> package has been rewritten.
-It has the same interface but the specification of the regular expressions
-it supports has changed from the old "egrep" form to that of
-<a href="//code.google.com/p/re2/">RE2</a>.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that uses the package should have its regular expressions checked by hand.
-</p>
-
-<h3 id="runtime">The runtime package</h3>
-
-<p>
-In Go 1, much of the API exported by package
-<code>runtime</code> has been removed in favor of
-functionality provided by other packages.
-Code using the <code>runtime.Type</code> interface
-or its specific concrete type implementations should
-now use package <a href="/pkg/reflect/"><code>reflect</code></a>.
-Code using <code>runtime.Semacquire</code> or <code>runtime.Semrelease</code>
-should use channels or the abstractions in package <a href="/pkg/sync/"><code>sync</code></a>.
-The <code>runtime.Alloc</code>, <code>runtime.Free</code>,
-and <code>runtime.Lookup</code> functions, an unsafe API created for
-debugging the memory allocator, have no replacement.
-</p>
-
-<p>
-Before, <code>runtime.MemStats</code> was a global variable holding
-statistics about memory allocation, and calls to <code>runtime.UpdateMemStats</code>
-ensured that it was up to date.
-In Go 1, <code>runtime.MemStats</code> is a struct type, and code should use
-<a href="/pkg/runtime/#ReadMemStats"><code>runtime.ReadMemStats</code></a>
-to obtain the current statistics.
-</p>
-
-<p>
-The package adds a new function,
-<a href="/pkg/runtime/#NumCPU"><code>runtime.NumCPU</code></a>, that returns the number of CPUs available
-for parallel execution, as reported by the operating system kernel.
-Its value can inform the setting of <code>GOMAXPROCS</code>.
-The <code>runtime.Cgocalls</code> and <code>runtime.Goroutines</code> functions
-have been renamed to <code>runtime.NumCgoCall</code> and <code>runtime.NumGoroutine</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update code for the function renamings.
-Other code will need to be updated by hand.
-</p>
-
-<h3 id="strconv">The strconv package</h3>
-
-<p>
-In Go 1, the
-<a href="/pkg/strconv/"><code>strconv</code></a>
-package has been significantly reworked to make it more Go-like and less C-like,
-although <code>Atoi</code> lives on (it's similar to
-<code>int(ParseInt(x, 10, 0))</code>, as does
-<code>Itoa(x)</code> (<code>FormatInt(int64(x), 10)</code>).
-There are also new variants of some of the functions that append to byte slices rather than
-return strings, to allow control over allocation.
-</p>
-
-<p>
-This table summarizes the renamings; see the
-<a href="/pkg/strconv/">package documentation</a>
-for full details.
-</p>
-
-<table class="codetable" frame="border" summary="strconv renames">
-<colgroup align="left" width="50%"></colgroup>
-<colgroup align="left" width="50%"></colgroup>
-<tr>
-<th align="left">Old call</th>
-<th align="left">New call</th>
-</tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Atob(x)</td> <td>ParseBool(x)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Atof32(x)</td> <td>ParseFloat(x, 32)§</td></tr>
-<tr><td>Atof64(x)</td> <td>ParseFloat(x, 64)</td></tr>
-<tr><td>AtofN(x, n)</td> <td>ParseFloat(x, n)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Atoi(x)</td> <td>Atoi(x)</td></tr>
-<tr><td>Atoi(x)</td> <td>ParseInt(x, 10, 0)§</td></tr>
-<tr><td>Atoi64(x)</td> <td>ParseInt(x, 10, 64)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Atoui(x)</td> <td>ParseUint(x, 10, 0)§</td></tr>
-<tr><td>Atoui64(x)</td> <td>ParseUint(x, 10, 64)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Btoi64(x, b)</td> <td>ParseInt(x, b, 64)</td></tr>
-<tr><td>Btoui64(x, b)</td> <td>ParseUint(x, b, 64)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Btoa(x)</td> <td>FormatBool(x)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Ftoa32(x, f, p)</td> <td>FormatFloat(float64(x), f, p, 32)</td></tr>
-<tr><td>Ftoa64(x, f, p)</td> <td>FormatFloat(x, f, p, 64)</td></tr>
-<tr><td>FtoaN(x, f, p, n)</td> <td>FormatFloat(x, f, p, n)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Itoa(x)</td> <td>Itoa(x)</td></tr>
-<tr><td>Itoa(x)</td> <td>FormatInt(int64(x), 10)</td></tr>
-<tr><td>Itoa64(x)</td> <td>FormatInt(x, 10)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Itob(x, b)</td> <td>FormatInt(int64(x), b)</td></tr>
-<tr><td>Itob64(x, b)</td> <td>FormatInt(x, b)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Uitoa(x)</td> <td>FormatUint(uint64(x), 10)</td></tr>
-<tr><td>Uitoa64(x)</td> <td>FormatUint(x, 10)</td></tr>
-<tr>
-<td colspan="2"><hr></td>
-</tr>
-<tr><td>Uitob(x, b)</td> <td>FormatUint(uint64(x), b)</td></tr>
-<tr><td>Uitob64(x, b)</td> <td>FormatUint(x, b)</td></tr>
-</table>
-
-<p>
-<em>Updating</em>:
-Running <code>go</code> <code>fix</code> will update almost all code affected by the change.
-<br>
-§ <code>Atoi</code> persists but <code>Atoui</code> and <code>Atof32</code> do not, so
-they may require
-a cast that must be added by hand; the <code>go</code> <code>fix</code> tool will warn about it.
-</p>
-
-
-<h3 id="templates">The template packages</h3>
-
-<p>
-The <code>template</code> and <code>exp/template/html</code> packages have moved to
-<a href="/pkg/text/template/"><code>text/template</code></a> and
-<a href="/pkg/html/template/"><code>html/template</code></a>.
-More significant, the interface to these packages has been simplified.
-The template language is the same, but the concept of "template set" is gone
-and the functions and methods of the packages have changed accordingly,
-often by elimination.
-</p>
-
-<p>
-Instead of sets, a <code>Template</code> object
-may contain multiple named template definitions,
-in effect constructing
-name spaces for template invocation.
-A template can invoke any other template associated with it, but only those
-templates associated with it.
-The simplest way to associate templates is to parse them together, something
-made easier with the new structure of the packages.
-</p>
-
-<p>
-<em>Updating</em>:
-The imports will be updated by fix tool.
-Single-template uses will be otherwise be largely unaffected.
-Code that uses multiple templates in concert will need to be updated by hand.
-The <a href="/pkg/text/template/#pkg-examples">examples</a> in
-the documentation for <code>text/template</code> can provide guidance.
-</p>
-
-<h3 id="testing">The testing package</h3>
-
-<p>
-The testing package has a type, <code>B</code>, passed as an argument to benchmark functions.
-In Go 1, <code>B</code> has new methods, analogous to those of <code>T</code>, enabling
-logging and failure reporting.
-</p>
-
-{{code "/doc/progs/go1.go" `/func.*Benchmark/` `/^}/`}}
-
-<p>
-<em>Updating</em>:
-Existing code is unaffected, although benchmarks that use <code>println</code>
-or <code>panic</code> should be updated to use the new methods.
-</p>
-
-<h3 id="testing_script">The testing/script package</h3>
-
-<p>
-The testing/script package has been deleted. It was a dreg.
-</p>
-
-<p>
-<em>Updating</em>:
-No code is likely to be affected.
-</p>
-
-<h3 id="unsafe">The unsafe package</h3>
-
-<p>
-In Go 1, the functions
-<code>unsafe.Typeof</code>, <code>unsafe.Reflect</code>,
-<code>unsafe.Unreflect</code>, <code>unsafe.New</code>, and
-<code>unsafe.NewArray</code> have been removed;
-they duplicated safer functionality provided by
-package <a href="/pkg/reflect/"><code>reflect</code></a>.
-</p>
-
-<p>
-<em>Updating</em>:
-Code using these functions must be rewritten to use
-package <a href="/pkg/reflect/"><code>reflect</code></a>.
-The changes to <a href="//golang.org/change/2646dc956207">encoding/gob</a> and the <a href="//code.google.com/p/goprotobuf/source/detail?r=5340ad310031">protocol buffer library</a>
-may be helpful as examples.
-</p>
-
-<h3 id="url">The url package</h3>
-
-<p>
-In Go 1 several fields from the <a href="/pkg/net/url/#URL"><code>url.URL</code></a> type
-were removed or replaced.
-</p>
-
-<p>
-The <a href="/pkg/net/url/#URL.String"><code>String</code></a> method now
-predictably rebuilds an encoded URL string using all of <code>URL</code>'s
-fields as necessary. The resulting string will also no longer have
-passwords escaped.
-</p>
-
-<p>
-The <code>Raw</code> field has been removed. In most cases the <code>String</code>
-method may be used in its place.
-</p>
-
-<p>
-The old <code>RawUserinfo</code> field is replaced by the <code>User</code>
-field, of type <a href="/pkg/net/url/#Userinfo"><code>*net.Userinfo</code></a>.
-Values of this type may be created using the new <a href="/pkg/net/url/#User"><code>net.User</code></a>
-and <a href="/pkg/net/url/#UserPassword"><code>net.UserPassword</code></a>
-functions. The <code>EscapeUserinfo</code> and <code>UnescapeUserinfo</code>
-functions are also gone.
-</p>
-
-<p>
-The <code>RawAuthority</code> field has been removed. The same information is
-available in the <code>Host</code> and <code>User</code> fields.
-</p>
-
-<p>
-The <code>RawPath</code> field and the <code>EncodedPath</code> method have
-been removed. The path information in rooted URLs (with a slash following the
-schema) is now available only in decoded form in the <code>Path</code> field.
-Occasionally, the encoded data may be required to obtain information that
-was lost in the decoding process. These cases must be handled by accessing
-the data the URL was built from.
-</p>
-
-<p>
-URLs with non-rooted paths, such as <code>"mailto:dev@golang.org?subject=Hi"</code>,
-are also handled differently. The <code>OpaquePath</code> boolean field has been
-removed and a new <code>Opaque</code> string field introduced to hold the encoded
-path for such URLs. In Go 1, the cited URL parses as:
-</p>
-
-<pre>
- URL{
- Scheme: "mailto",
- Opaque: "dev@golang.org",
- RawQuery: "subject=Hi",
- }
-</pre>
-
-<p>
-A new <a href="/pkg/net/url/#URL.RequestURI"><code>RequestURI</code></a> method was
-added to <code>URL</code>.
-</p>
-
-<p>
-The <code>ParseWithReference</code> function has been renamed to <code>ParseWithFragment</code>.
-</p>
-
-<p>
-<em>Updating</em>:
-Code that uses the old fields will fail to compile and must be updated by hand.
-The semantic changes make it difficult for the fix tool to update automatically.
-</p>
-
-<h2 id="cmd_go">The go command</h2>
-
-<p>
-Go 1 introduces the <a href="/cmd/go/">go command</a>, a tool for fetching,
-building, and installing Go packages and commands. The <code>go</code> command
-does away with makefiles, instead using Go source code to find dependencies and
-determine build conditions. Most existing Go programs will no longer require
-makefiles to be built.
-</p>
-
-<p>
-See <a href="/doc/code.html">How to Write Go Code</a> for a primer on the
-<code>go</code> command and the <a href="/cmd/go/">go command documentation</a>
-for the full details.
-</p>
-
-<p>
-<em>Updating</em>:
-Projects that depend on the Go project's old makefile-based build
-infrastructure (<code>Make.pkg</code>, <code>Make.cmd</code>, and so on) should
-switch to using the <code>go</code> command for building Go code and, if
-necessary, rewrite their makefiles to perform any auxiliary build tasks.
-</p>
-
-<h2 id="cmd_cgo">The cgo command</h2>
-
-<p>
-In Go 1, the <a href="/cmd/cgo">cgo command</a>
-uses a different <code>_cgo_export.h</code>
-file, which is generated for packages containing <code>//export</code> lines.
-The <code>_cgo_export.h</code> file now begins with the C preamble comment,
-so that exported function definitions can use types defined there.
-This has the effect of compiling the preamble multiple times, so a
-package using <code>//export</code> must not put function definitions
-or variable initializations in the C preamble.
-</p>
-
-<h2 id="releases">Packaged releases</h2>
-
-<p>
-One of the most significant changes associated with Go 1 is the availability
-of prepackaged, downloadable distributions.
-They are available for many combinations of architecture and operating system
-(including Windows) and the list will grow.
-Installation details are described on the
-<a href="/doc/install">Getting Started</a> page, while
-the distributions themselves are listed on the
-<a href="/dl/">downloads page</a>.
diff --git a/doc/go1compat.html b/doc/go1compat.html
deleted file mode 100644
index a5624ef5f6..0000000000
--- a/doc/go1compat.html
+++ /dev/null
@@ -1,202 +0,0 @@
-<!--{
- "Title": "Go 1 and the Future of Go Programs",
- "Path": "/doc/go1compat"
-}-->
-
-<h2 id="introduction">Introduction</h2>
-<p>
-The release of Go version 1, Go 1 for short, is a major milestone
-in the development of the language. Go 1 is a stable platform for
-the growth of programs and projects written in Go.
-</p>
-
-<p>
-Go 1 defines two things: first, the specification of the language;
-and second, the specification of a set of core APIs, the "standard
-packages" of the Go library. The Go 1 release includes their
-implementation in the form of two compiler suites (gc and gccgo),
-and the core libraries themselves.
-</p>
-
-<p>
-It is intended that programs written to the Go 1 specification will
-continue to compile and run correctly, unchanged, over the lifetime
-of that specification. At some indefinite point, a Go 2 specification
-may arise, but until that time, Go programs that work today should
-continue to work even as future "point" releases of Go 1 arise (Go
-1.1, Go 1.2, etc.).
-</p>
-
-<p>
-Compatibility is at the source level. Binary compatibility for
-compiled packages is not guaranteed between releases. After a point
-release, Go source will need to be recompiled to link against the
-new release.
-</p>
-
-<p>
-The APIs may grow, acquiring new packages and features, but not in
-a way that breaks existing Go 1 code.
-</p>
-
-<h2 id="expectations">Expectations</h2>
-
-<p>
-Although we expect that the vast majority of programs will maintain
-this compatibility over time, it is impossible to guarantee that
-no future change will break any program. This document is an attempt
-to set expectations for the compatibility of Go 1 software in the
-future. There are a number of ways in which a program that compiles
-and runs today may fail to do so after a future point release. They
-are all unlikely but worth recording.
-</p>
-
-<ul>
-<li>
-Security. A security issue in the specification or implementation
-may come to light whose resolution requires breaking compatibility.
-We reserve the right to address such security issues.
-</li>
-
-<li>
-Unspecified behavior. The Go specification tries to be explicit
-about most properties of the language, but there are some aspects
-that are undefined. Programs that depend on such unspecified behavior
-may break in future releases.
-</li>
-
-<li>
-Specification errors. If it becomes necessary to address an
-inconsistency or incompleteness in the specification, resolving the
-issue could affect the meaning or legality of existing programs.
-We reserve the right to address such issues, including updating the
-implementations. Except for security issues, no incompatible changes
-to the specification would be made.
-</li>
-
-<li>
-Bugs. If a compiler or library has a bug that violates the
-specification, a program that depends on the buggy behavior may
-break if the bug is fixed. We reserve the right to fix such bugs.
-</li>
-
-<li>
-Struct literals. For the addition of features in later point
-releases, it may be necessary to add fields to exported structs in
-the API. Code that uses unkeyed struct literals (such as pkg.T{3,
-"x"}) to create values of these types would fail to compile after
-such a change. However, code that uses keyed literals (pkg.T{A:
-3, B: "x"}) will continue to compile after such a change. We will
-update such data structures in a way that allows keyed struct
-literals to remain compatible, although unkeyed literals may fail
-to compile. (There are also more intricate cases involving nested
-data structures or interfaces, but they have the same resolution.)
-We therefore recommend that composite literals whose type is defined
-in a separate package should use the keyed notation.
-</li>
-
-<li>
-Methods. As with struct fields, it may be necessary to add methods
-to types.
-Under some circumstances, such as when the type is embedded in
-a struct along with another type,
-the addition of the new method may break
-the struct by creating a conflict with an existing method of the other
-embedded type.
-We cannot protect against this rare case and do not guarantee compatibility
-should it arise.
-</li>
-
-<li>
-Dot imports. If a program imports a standard package
-using <code>import . "path"</code>, additional names defined in the
-imported package in future releases may conflict with other names
-defined in the program. We do not recommend the use of <code>import .</code>
-outside of tests, and using it may cause a program to fail
-to compile in future releases.
-</li>
-
-<li>
-Use of package <code>unsafe</code>. Packages that import
-<a href="/pkg/unsafe/"><code>unsafe</code></a>
-may depend on internal properties of the Go implementation.
-We reserve the right to make changes to the implementation
-that may break such programs.
-</li>
-
-</ul>
-
-<p>
-Of course, for all of these possibilities, should they arise, we
-would endeavor whenever feasible to update the specification,
-compilers, or libraries without affecting existing code.
-</p>
-
-<p>
-These same considerations apply to successive point releases. For
-instance, code that runs under Go 1.2 should be compatible with Go
-1.2.1, Go 1.3, Go 1.4, etc., although not necessarily with Go 1.1
-since it may use features added only in Go 1.2
-</p>
-
-<p>
-Features added between releases, available in the source repository
-but not part of the numbered binary releases, are under active
-development. No promise of compatibility is made for software using
-such features until they have been released.
-</p>
-
-<p>
-Finally, although it is not a correctness issue, it is possible
-that the performance of a program may be affected by
-changes in the implementation of the compilers or libraries upon
-which it depends.
-No guarantee can be made about the performance of a
-given program between releases.
-</p>
-
-<p>
-Although these expectations apply to Go 1 itself, we hope similar
-considerations would be made for the development of externally
-developed software based on Go 1.
-</p>
-
-<h2 id="subrepos">Sub-repositories</h2>
-
-<p>
-Code in sub-repositories of the main go tree, such as
-<a href="//golang.org/x/net">golang.org/x/net</a>,
-may be developed under
-looser compatibility requirements. However, the sub-repositories
-will be tagged as appropriate to identify versions that are compatible
-with the Go 1 point releases.
-</p>
-
-<h2 id="operating_systems">Operating systems</h2>
-
-<p>
-It is impossible to guarantee long-term compatibility with operating
-system interfaces, which are changed by outside parties.
-The <a href="/pkg/syscall/"><code>syscall</code></a> package
-is therefore outside the purview of the guarantees made here.
-As of Go version 1.4, the <code>syscall</code> package is frozen.
-Any evolution of the system call interface must be supported elsewhere,
-such as in the
-<a href="//golang.org/x/sys">go.sys</a> subrepository.
-For details and background, see
-<a href="//golang.org/s/go1.4-syscall">this document</a>.
-</p>
-
-<h2 id="tools">Tools</h2>
-
-<p>
-Finally, the Go toolchain (compilers, linkers, build tools, and so
-on) is under active development and may change behavior. This
-means, for instance, that scripts that depend on the location and
-properties of the tools may be broken by a point release.
-</p>
-
-<p>
-These caveats aside, we believe that Go 1 will be a firm foundation
-for the development of Go and its ecosystem.
-</p>
diff --git a/doc/go_faq.html b/doc/go_faq.html
deleted file mode 100644
index 23a3080c9b..0000000000
--- a/doc/go_faq.html
+++ /dev/null
@@ -1,2475 +0,0 @@
-<!--{
- "Title": "Frequently Asked Questions (FAQ)",
- "Path": "/doc/faq"
-}-->
-
-<h2 id="Origins">Origins</h2>
-
-<h3 id="What_is_the_purpose_of_the_project">
-What is the purpose of the project?</h3>
-
-<p>
-At the time of Go's inception, only a decade ago, the programming world was different from today.
-Production software was usually written in C++ or Java,
-GitHub did not exist, most computers were not yet multiprocessors,
-and other than Visual Studio and Eclipse there were few IDEs or other high-level tools available
-at all, let alone for free on the Internet.
-</p>
-
-<p>
-Meanwhile, we had become frustrated by the undue complexity required to use
-the languages we worked with to develop server software.
-Computers had become enormously quicker since languages such as
-C, C++ and Java were first developed but the act of programming had not
-itself advanced nearly as much.
-Also, it was clear that multiprocessors were becoming universal but
-most languages offered little help to program them efficiently
-and safely.
-</p>
-
-<p>
-We decided to take a step back and think about what major issues were
-going to dominate software engineering in the years ahead as technology
-developed, and how a new language might help address them.
-For instance, the rise of multicore CPUs argued that a language should
-provide first-class support for some sort of concurrency or parallelism.
-And to make resource management tractable in a large concurrent program,
-garbage collection, or at least some sort of safe automatic memory management was required.
-</p>
-
-<p>
-These considerations led to
-<a href="https://commandcenter.blogspot.com/2017/09/go-ten-years-and-climbing.html">a
-series of discussions</a> from which Go arose, first as a set of ideas and
-desiderata, then as a language.
-An overarching goal was that Go do more to help the working programmer
-by enabling tooling, automating mundane tasks such as code formatting,
-and removing obstacles to working on large code bases.
-</p>
-
-<p>
-A much more expansive description of the goals of Go and how
-they are met, or at least approached, is available in the article,
-<a href="//talks.golang.org/2012/splash.article">Go at Google:
-Language Design in the Service of Software Engineering</a>.
-</p>
-
-<h3 id="history">
-What is the history of the project?</h3>
-<p>
-Robert Griesemer, Rob Pike and Ken Thompson started sketching the
-goals for a new language on the white board on September 21, 2007.
-Within a few days the goals had settled into a plan to do something
-and a fair idea of what it would be. Design continued part-time in
-parallel with unrelated work. By January 2008, Ken had started work
-on a compiler with which to explore ideas; it generated C code as its
-output. By mid-year the language had become a full-time project and
-had settled enough to attempt a production compiler. In May 2008,
-Ian Taylor independently started on a GCC front end for Go using the
-draft specification. Russ Cox joined in late 2008 and helped move the language
-and libraries from prototype to reality.
-</p>
-
-<p>
-Go became a public open source project on November 10, 2009.
-Countless people from the community have contributed ideas, discussions, and code.
-</p>
-
-<p>
-There are now millions of Go programmers—gophers—around the world,
-and there are more every day.
-Go's success has far exceeded our expectations.
-</p>
-
-<h3 id="gopher">
-What's the origin of the gopher mascot?</h3>
-
-<p>
-The mascot and logo were designed by
-<a href="https://reneefrench.blogspot.com">Renée French</a>, who also designed
-<a href="https://9p.io/plan9/glenda.html">Glenda</a>,
-the Plan 9 bunny.
-A <a href="https://blog.golang.org/gopher">blog post</a>
-about the gopher explains how it was
-derived from one she used for a <a href="https://wfmu.org/">WFMU</a>
-T-shirt design some years ago.
-The logo and mascot are covered by the
-<a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a>
-license.
-</p>
-
-<p>
-The gopher has a
-<a href="/doc/gopher/modelsheet.jpg">model sheet</a>
-illustrating his characteristics and how to represent them correctly.
-The model sheet was first shown in a
-<a href="https://www.youtube.com/watch?v=4rw_B4yY69k">talk</a>
-by Renée at Gophercon in 2016.
-He has unique features; he's the <em>Go gopher</em>, not just any old gopher.
-</p>
-
-<h3 id="go_or_golang">
-Is the language called Go or Golang?</h3>
-
-<p>
-The language is called Go.
-The "golang" moniker arose because the web site is
-<a href="https://golang.org">golang.org</a>, not
-go.org, which was not available to us.
-Many use the golang name, though, and it is handy as
-a label.
-For instance, the Twitter tag for the language is "#golang".
-The language's name is just plain Go, regardless.
-</p>
-
-<p>
-A side note: Although the
-<a href="https://blog.golang.org/go-brand">official logo</a>
-has two capital letters, the language name is written Go, not GO.
-</p>
-
-<h3 id="creating_a_new_language">
-Why did you create a new language?</h3>
-
-<p>
-Go was born out of frustration with existing languages and
-environments for the work we were doing at Google.
-Programming had become too
-difficult and the choice of languages was partly to blame. One had to
-choose either efficient compilation, efficient execution, or ease of
-programming; all three were not available in the same mainstream
-language. Programmers who could were choosing ease over
-safety and efficiency by moving to dynamically typed languages such as
-Python and JavaScript rather than C++ or, to a lesser extent, Java.
-</p>
-
-<p>
-We were not alone in our concerns.
-After many years with a pretty quiet landscape for programming languages,
-Go was among the first of several new languages—Rust,
-Elixir, Swift, and more—that have made programming language development
-an active, almost mainstream field again.
-</p>
-
-<p>
-Go addressed these issues by attempting to combine the ease of programming of an interpreted,
-dynamically typed
-language with the efficiency and safety of a statically typed, compiled language.
-It also aimed to be modern, with support for networked and multicore
-computing. Finally, working with Go is intended to be <i>fast</i>: it should take
-at most a few seconds to build a large executable on a single computer.
-To meet these goals required addressing a number of
-linguistic issues: an expressive but lightweight type system;
-concurrency and garbage collection; rigid dependency specification;
-and so on. These cannot be addressed well by libraries or tools; a new
-language was called for.
-</p>
-
-<p>
-The article <a href="//talks.golang.org/2012/splash.article">Go at Google</a>
-discusses the background and motivation behind the design of the Go language,
-as well as providing more detail about many of the answers presented in this FAQ.
-</p>
-
-
-<h3 id="ancestors">
-What are Go's ancestors?</h3>
-<p>
-Go is mostly in the C family (basic syntax),
-with significant input from the Pascal/Modula/Oberon
-family (declarations, packages),
-plus some ideas from languages
-inspired by Tony Hoare's CSP,
-such as Newsqueak and Limbo (concurrency).
-However, it is a new language across the board.
-In every respect the language was designed by thinking
-about what programmers do and how to make programming, at least the
-kind of programming we do, more effective, which means more fun.
-</p>
-
-<h3 id="principles">
-What are the guiding principles in the design?</h3>
-
-<p>
-When Go was designed, Java and C++ were the most commonly
-used languages for writing servers, at least at Google.
-We felt that these languages required
-too much bookkeeping and repetition.
-Some programmers reacted by moving towards more dynamic,
-fluid languages like Python, at the cost of efficiency and
-type safety.
-We felt it should be possible to have the efficiency,
-the safety, and the fluidity in a single language.
-</p>
-
-<p>
-Go attempts to reduce the amount of typing in both senses of the word.
-Throughout its design, we have tried to reduce clutter and
-complexity. There are no forward declarations and no header files;
-everything is declared exactly once. Initialization is expressive,
-automatic, and easy to use. Syntax is clean and light on keywords.
-Stuttering (<code>foo.Foo* myFoo = new(foo.Foo)</code>) is reduced by
-simple type derivation using the <code>:=</code>
-declare-and-initialize construct. And perhaps most radically, there
-is no type hierarchy: types just <i>are</i>, they don't have to
-announce their relationships. These simplifications allow Go to be
-expressive yet comprehensible without sacrificing, well, sophistication.
-</p>
-<p>
-Another important principle is to keep the concepts orthogonal.
-Methods can be implemented for any type; structures represent data while
-interfaces represent abstraction; and so on. Orthogonality makes it
-easier to understand what happens when things combine.
-</p>
-
-<h2 id="Usage">Usage</h2>
-
-<h3 id="internal_usage">
-Is Google using Go internally?</h3>
-
-<p>
-Yes. Go is used widely in production inside Google.
-One easy example is the server behind
-<a href="//golang.org">golang.org</a>.
-It's just the <a href="/cmd/godoc"><code>godoc</code></a>
-document server running in a production configuration on
-<a href="https://developers.google.com/appengine/">Google App Engine</a>.
-</p>
-
-<p>
-A more significant instance is Google's download server, <code>dl.google.com</code>,
-which delivers Chrome binaries and other large installables such as <code>apt-get</code>
-packages.
-</p>
-
-<p>
-Go is not the only language used at Google, far from it, but it is a key language
-for a number of areas including
-<a href="https://talks.golang.org/2013/go-sreops.slide">site reliability
-engineering (SRE)</a>
-and large-scale data processing.
-</p>
-
-<h3 id="external_usage">
-What other companies use Go?</h3>
-
-<p>
-Go usage is growing worldwide, especially but by no means exclusively
-in the cloud computing space.
-A couple of major cloud infrastructure projects written in Go are
-Docker and Kubernetes,
-but there are many more.
-</p>
-
-<p>
-It's not just cloud, though.
-The Go Wiki includes a
-<a href="https://github.com/golang/go/wiki/GoUsers">page</a>,
-updated regularly, that lists some of the many companies using Go.
-</p>
-
-<p>
-The Wiki also has a page with links to
-<a href="https://github.com/golang/go/wiki/SuccessStories">success stories</a>
-about companies and projects that are using the language.
-</p>
-
-<h3 id="Do_Go_programs_link_with_Cpp_programs">
-Do Go programs link with C/C++ programs?</h3>
-
-<p>
-It is possible to use C and Go together in the same address space,
-but it is not a natural fit and can require special interface software.
-Also, linking C with Go code gives up the memory
-safety and stack management properties that Go provides.
-Sometimes it's absolutely necessary to use C libraries to solve a problem,
-but doing so always introduces an element of risk not present with
-pure Go code, so do so with care.
-</p>
-
-<p>
-If you do need to use C with Go, how to proceed depends on the Go
-compiler implementation.
-There are three Go compiler implementations supported by the
-Go team.
-These are <code>gc</code>, the default compiler,
-<code>gccgo</code>, which uses the GCC back end,
-and a somewhat less mature <code>gollvm</code>, which uses the LLVM infrastructure.
-</p>
-
-<p>
-<code>Gc</code> uses a different calling convention and linker from C and
-therefore cannot be called directly from C programs, or vice versa.
-The <a href="/cmd/cgo/"><code>cgo</code></a> program provides the mechanism for a
-&ldquo;foreign function interface&rdquo; to allow safe calling of
-C libraries from Go code.
-SWIG extends this capability to C++ libraries.
-</p>
-
-<p>
-You can also use <code>cgo</code> and SWIG with <code>Gccgo</code> and <code>gollvm</code>.
-Since they use a traditional API, it's also possible, with great care,
-to link code from these compilers directly with GCC/LLVM-compiled C or C++ programs.
-However, doing so safely requires an understanding of the calling conventions for
-all languages concerned, as well as concern for stack limits when calling C or C++
-from Go.
-</p>
-
-<h3 id="ide">
-What IDEs does Go support?</h3>
-
-<p>
-The Go project does not include a custom IDE, but the language and
-libraries have been designed to make it easy to analyze source code.
-As a consequence, most well-known editors and IDEs support Go well,
-either directly or through a plugin.
-</p>
-
-<p>
-The list of well-known IDEs and editors that have good Go support
-available includes Emacs, Vim, VSCode, Atom, Eclipse, Sublime, IntelliJ
-(through a custom variant called Goland), and many more.
-Chances are your favorite environment is a productive one for
-programming in Go.
-</p>
-
-<h3 id="protocol_buffers">
-Does Go support Google's protocol buffers?</h3>
-
-<p>
-A separate open source project provides the necessary compiler plugin and library.
-It is available at
-<a href="//github.com/golang/protobuf">github.com/golang/protobuf/</a>.
-</p>
-
-
-<h3 id="Can_I_translate_the_Go_home_page">
-Can I translate the Go home page into another language?</h3>
-
-<p>
-Absolutely. We encourage developers to make Go Language sites in their own languages.
-However, if you choose to add the Google logo or branding to your site
-(it does not appear on <a href="//golang.org/">golang.org</a>),
-you will need to abide by the guidelines at
-<a href="//www.google.com/permissions/guidelines.html">www.google.com/permissions/guidelines.html</a>
-</p>
-
-<h2 id="Design">Design</h2>
-
-<h3 id="runtime">
-Does Go have a runtime?</h3>
-
-<p>
-Go does have an extensive library, called the <em>runtime</em>,
-that is part of every Go program.
-The runtime library implements garbage collection, concurrency,
-stack management, and other critical features of the Go language.
-Although it is more central to the language, Go's runtime is analogous
-to <code>libc</code>, the C library.
-</p>
-
-<p>
-It is important to understand, however, that Go's runtime does not
-include a virtual machine, such as is provided by the Java runtime.
-Go programs are compiled ahead of time to native machine code
-(or JavaScript or WebAssembly, for some variant implementations).
-Thus, although the term is often used to describe the virtual
-environment in which a program runs, in Go the word &ldquo;runtime&rdquo;
-is just the name given to the library providing critical language services.
-</p>
-
-<h3 id="unicode_identifiers">
-What's up with Unicode identifiers?</h3>
-
-<p>
-When designing Go, we wanted to make sure that it was not
-overly ASCII-centric,
-which meant extending the space of identifiers from the
-confines of 7-bit ASCII.
-Go's rule&mdash;identifier characters must be
-letters or digits as defined by Unicode&mdash;is simple to understand
-and to implement but has restrictions.
-Combining characters are
-excluded by design, for instance,
-and that excludes some languages such as Devanagari.
-</p>
-
-<p>
-This rule has one other unfortunate consequence.
-Since an exported identifier must begin with an
-upper-case letter, identifiers created from characters
-in some languages can, by definition, not be exported.
-For now the
-only solution is to use something like <code>X日本語</code>, which
-is clearly unsatisfactory.
-</p>
-
-<p>
-Since the earliest version of the language, there has been considerable
-thought into how best to expand the identifier space to accommodate
-programmers using other native languages.
-Exactly what to do remains an active topic of discussion, and a future
-version of the language may be more liberal in its definition
-of an identifier.
-For instance, it might adopt some of the ideas from the Unicode
-organization's <a href="http://unicode.org/reports/tr31/">recommendations</a>
-for identifiers.
-Whatever happens, it must be done compatibly while preserving
-(or perhaps expanding) the way letter case determines visibility of
-identifiers, which remains one of our favorite features of Go.
-</p>
-
-<p>
-For the time being, we have a simple rule that can be expanded later
-without breaking programs, one that avoids bugs that would surely arise
-from a rule that admits ambiguous identifiers.
-</p>
-
-<h3 id="Why_doesnt_Go_have_feature_X">Why does Go not have feature X?</h3>
-
-<p>
-Every language contains novel features and omits someone's favorite
-feature. Go was designed with an eye on felicity of programming, speed of
-compilation, orthogonality of concepts, and the need to support features
-such as concurrency and garbage collection. Your favorite feature may be
-missing because it doesn't fit, because it affects compilation speed or
-clarity of design, or because it would make the fundamental system model
-too difficult.
-</p>
-
-<p>
-If it bothers you that Go is missing feature <var>X</var>,
-please forgive us and investigate the features that Go does have. You might find that
-they compensate in interesting ways for the lack of <var>X</var>.
-</p>
-
-<h3 id="generics">
-Why does Go not have generic types?</h3>
-<p>
-Generics may well be added at some point. We don't feel an urgency for
-them, although we understand some programmers do.
-</p>
-
-<p>
-Go was intended as a language for writing server programs that would be
-easy to maintain over time.
-(See <a href="https://talks.golang.org/2012/splash.article">this
-article</a> for more background.)
-The design concentrated on things like scalability, readability, and
-concurrency.
-Polymorphic programming did not seem essential to the language's
-goals at the time, and so was left out for simplicity.
-</p>
-
-<p>
-The language is more mature now, and there is scope to consider
-some form of generic programming.
-However, there remain some caveats.
-</p>
-
-<p>
-Generics are convenient but they come at a cost in
-complexity in the type system and run-time. We haven't yet found a
-design that gives value proportionate to the complexity, although we
-continue to think about it. Meanwhile, Go's built-in maps and slices,
-plus the ability to use the empty interface to construct containers
-(with explicit unboxing) mean in many cases it is possible to write
-code that does what generics would enable, if less smoothly.
-</p>
-
-<p>
-The topic remains open.
-For a look at several previous unsuccessful attempts to
-design a good generics solution for Go, see
-<a href="https://golang.org/issue/15292">this proposal</a>.
-</p>
-
-<h3 id="exceptions">
-Why does Go not have exceptions?</h3>
-<p>
-We believe that coupling exceptions to a control
-structure, as in the <code>try-catch-finally</code> idiom, results in
-convoluted code. It also tends to encourage programmers to label
-too many ordinary errors, such as failing to open a file, as
-exceptional.
-</p>
-
-<p>
-Go takes a different approach. For plain error handling, Go's multi-value
-returns make it easy to report an error without overloading the return value.
-<a href="/doc/articles/error_handling.html">A canonical error type, coupled
-with Go's other features</a>, makes error handling pleasant but quite different
-from that in other languages.
-</p>
-
-<p>
-Go also has a couple
-of built-in functions to signal and recover from truly exceptional
-conditions. The recovery mechanism is executed only as part of a
-function's state being torn down after an error, which is sufficient
-to handle catastrophe but requires no extra control structures and,
-when used well, can result in clean error-handling code.
-</p>
-
-<p>
-See the <a href="/doc/articles/defer_panic_recover.html">Defer, Panic, and Recover</a> article for details.
-Also, the <a href="https://blog.golang.org/errors-are-values">Errors are values</a> blog post
-describes one approach to handling errors cleanly in Go by demonstrating that,
-since errors are just values, the full power of Go can be deployed in error handling.
-</p>
-
-<h3 id="assertions">
-Why does Go not have assertions?</h3>
-
-<p>
-Go doesn't provide assertions. They are undeniably convenient, but our
-experience has been that programmers use them as a crutch to avoid thinking
-about proper error handling and reporting. Proper error handling means that
-servers continue to operate instead of crashing after a non-fatal error.
-Proper error reporting means that errors are direct and to the point,
-saving the programmer from interpreting a large crash trace. Precise
-errors are particularly important when the programmer seeing the errors is
-not familiar with the code.
-</p>
-
-<p>
-We understand that this is a point of contention. There are many things in
-the Go language and libraries that differ from modern practices, simply
-because we feel it's sometimes worth trying a different approach.
-</p>
-
-<h3 id="csp">
-Why build concurrency on the ideas of CSP?</h3>
-<p>
-Concurrency and multi-threaded programming have over time
-developed a reputation for difficulty. We believe this is due partly to complex
-designs such as
-<a href="https://en.wikipedia.org/wiki/POSIX_Threads">pthreads</a>
-and partly to overemphasis on low-level details
-such as mutexes, condition variables, and memory barriers.
-Higher-level interfaces enable much simpler code, even if there are still
-mutexes and such under the covers.
-</p>
-
-<p>
-One of the most successful models for providing high-level linguistic support
-for concurrency comes from Hoare's Communicating Sequential Processes, or CSP.
-Occam and Erlang are two well known languages that stem from CSP.
-Go's concurrency primitives derive from a different part of the family tree
-whose main contribution is the powerful notion of channels as first class objects.
-Experience with several earlier languages has shown that the CSP model
-fits well into a procedural language framework.
-</p>
-
-<h3 id="goroutines">
-Why goroutines instead of threads?</h3>
-<p>
-Goroutines are part of making concurrency easy to use. The idea, which has
-been around for a while, is to multiplex independently executing
-functions&mdash;coroutines&mdash;onto a set of threads.
-When a coroutine blocks, such as by calling a blocking system call,
-the run-time automatically moves other coroutines on the same operating
-system thread to a different, runnable thread so they won't be blocked.
-The programmer sees none of this, which is the point.
-The result, which we call goroutines, can be very cheap: they have little
-overhead beyond the memory for the stack, which is just a few kilobytes.
-</p>
-
-<p>
-To make the stacks small, Go's run-time uses resizable, bounded stacks. A newly
-minted goroutine is given a few kilobytes, which is almost always enough.
-When it isn't, the run-time grows (and shrinks) the memory for storing
-the stack automatically, allowing many goroutines to live in a modest
-amount of memory.
-The CPU overhead averages about three cheap instructions per function call.
-It is practical to create hundreds of thousands of goroutines in the same
-address space.
-If goroutines were just threads, system resources would
-run out at a much smaller number.
-</p>
-
-<h3 id="atomic_maps">
-Why are map operations not defined to be atomic?</h3>
-
-<p>
-After long discussion it was decided that the typical use of maps did not require
-safe access from multiple goroutines, and in those cases where it did, the map was
-probably part of some larger data structure or computation that was already
-synchronized. Therefore requiring that all map operations grab a mutex would slow
-down most programs and add safety to few. This was not an easy decision,
-however, since it means uncontrolled map access can crash the program.
-</p>
-
-<p>
-The language does not preclude atomic map updates. When required, such
-as when hosting an untrusted program, the implementation could interlock
-map access.
-</p>
-
-<p>
-Map access is unsafe only when updates are occurring.
-As long as all goroutines are only reading—looking up elements in the map,
-including iterating through it using a
-<code>for</code> <code>range</code> loop—and not changing the map
-by assigning to elements or doing deletions,
-it is safe for them to access the map concurrently without synchronization.
-</p>
-
-<p>
-As an aid to correct map use, some implementations of the language
-contain a special check that automatically reports at run time when a map is modified
-unsafely by concurrent execution.
-</p>
-
-<h3 id="language_changes">
-Will you accept my language change?</h3>
-
-<p>
-People often suggest improvements to the language—the
-<a href="//groups.google.com/group/golang-nuts">mailing list</a>
-contains a rich history of such discussions—but very few of these changes have
-been accepted.
-</p>
-
-<p>
-Although Go is an open source project, the language and libraries are protected
-by a <a href="/doc/go1compat.html">compatibility promise</a> that prevents
-changes that break existing programs, at least at the source code level
-(programs may need to be recompiled occasionally to stay current).
-If your proposal violates the Go 1 specification we cannot even entertain the
-idea, regardless of its merit.
-A future major release of Go may be incompatible with Go 1, but discussions
-on that topic have only just begun and one thing is certain:
-there will be very few such incompatibilities introduced in the process.
-Moreover, the compatibility promise encourages us to provide an automatic path
-forward for old programs to adapt should that situation arise.
-</p>
-
-<p>
-Even if your proposal is compatible with the Go 1 spec, it might
-not be in the spirit of Go's design goals.
-The article <i><a href="//talks.golang.org/2012/splash.article">Go
-at Google: Language Design in the Service of Software Engineering</a></i>
-explains Go's origins and the motivation behind its design.
-</p>
-
-<h2 id="types">Types</h2>
-
-<h3 id="Is_Go_an_object-oriented_language">
-Is Go an object-oriented language?</h3>
-
-<p>
-Yes and no. Although Go has types and methods and allows an
-object-oriented style of programming, there is no type hierarchy.
-The concept of &ldquo;interface&rdquo; in Go provides a different approach that
-we believe is easy to use and in some ways more general. There are
-also ways to embed types in other types to provide something
-analogous&mdash;but not identical&mdash;to subclassing.
-Moreover, methods in Go are more general than in C++ or Java:
-they can be defined for any sort of data, even built-in types such
-as plain, &ldquo;unboxed&rdquo; integers.
-They are not restricted to structs (classes).
-</p>
-
-<p>
-Also, the lack of a type hierarchy makes &ldquo;objects&rdquo; in Go feel much more
-lightweight than in languages such as C++ or Java.
-</p>
-
-<h3 id="How_do_I_get_dynamic_dispatch_of_methods">
-How do I get dynamic dispatch of methods?</h3>
-
-<p>
-The only way to have dynamically dispatched methods is through an
-interface. Methods on a struct or any other concrete type are always resolved statically.
-</p>
-
-<h3 id="inheritance">
-Why is there no type inheritance?</h3>
-<p>
-Object-oriented programming, at least in the best-known languages,
-involves too much discussion of the relationships between types,
-relationships that often could be derived automatically. Go takes a
-different approach.
-</p>
-
-<p>
-Rather than requiring the programmer to declare ahead of time that two
-types are related, in Go a type automatically satisfies any interface
-that specifies a subset of its methods. Besides reducing the
-bookkeeping, this approach has real advantages. Types can satisfy
-many interfaces at once, without the complexities of traditional
-multiple inheritance.
-Interfaces can be very lightweight&mdash;an interface with
-one or even zero methods can express a useful concept.
-Interfaces can be added after the fact if a new idea comes along
-or for testing&mdash;without annotating the original types.
-Because there are no explicit relationships between types
-and interfaces, there is no type hierarchy to manage or discuss.
-</p>
-
-<p>
-It's possible to use these ideas to construct something analogous to
-type-safe Unix pipes. For instance, see how <code>fmt.Fprintf</code>
-enables formatted printing to any output, not just a file, or how the
-<code>bufio</code> package can be completely separate from file I/O,
-or how the <code>image</code> packages generate compressed
-image files. All these ideas stem from a single interface
-(<code>io.Writer</code>) representing a single method
-(<code>Write</code>). And that's only scratching the surface.
-Go's interfaces have a profound influence on how programs are structured.
-</p>
-
-<p>
-It takes some getting used to but this implicit style of type
-dependency is one of the most productive things about Go.
-</p>
-
-<h3 id="methods_on_basics">
-Why is <code>len</code> a function and not a method?</h3>
-<p>
-We debated this issue but decided
-implementing <code>len</code> and friends as functions was fine in practice and
-didn't complicate questions about the interface (in the Go type sense)
-of basic types.
-</p>
-
-<h3 id="overloading">
-Why does Go not support overloading of methods and operators?</h3>
-<p>
-Method dispatch is simplified if it doesn't need to do type matching as well.
-Experience with other languages told us that having a variety of
-methods with the same name but different signatures was occasionally useful
-but that it could also be confusing and fragile in practice. Matching only by name
-and requiring consistency in the types was a major simplifying decision
-in Go's type system.
-</p>
-
-<p>
-Regarding operator overloading, it seems more a convenience than an absolute
-requirement. Again, things are simpler without it.
-</p>
-
-<h3 id="implements_interface">
-Why doesn't Go have "implements" declarations?</h3>
-
-<p>
-A Go type satisfies an interface by implementing the methods of that interface,
-nothing more. This property allows interfaces to be defined and used without
-needing to modify existing code. It enables a kind of
-<a href="https://en.wikipedia.org/wiki/Structural_type_system">structural typing</a> that
-promotes separation of concerns and improves code re-use, and makes it easier
-to build on patterns that emerge as the code develops.
-The semantics of interfaces is one of the main reasons for Go's nimble,
-lightweight feel.
-</p>
-
-<p>
-See the <a href="#inheritance">question on type inheritance</a> for more detail.
-</p>
-
-<h3 id="guarantee_satisfies_interface">
-How can I guarantee my type satisfies an interface?</h3>
-
-<p>
-You can ask the compiler to check that the type <code>T</code> implements the
-interface <code>I</code> by attempting an assignment using the zero value for
-<code>T</code> or pointer to <code>T</code>, as appropriate:
-</p>
-
-<pre>
-type T struct{}
-var _ I = T{} // Verify that T implements I.
-var _ I = (*T)(nil) // Verify that *T implements I.
-</pre>
-
-<p>
-If <code>T</code> (or <code>*T</code>, accordingly) doesn't implement
-<code>I</code>, the mistake will be caught at compile time.
-</p>
-
-<p>
-If you wish the users of an interface to explicitly declare that they implement
-it, you can add a method with a descriptive name to the interface's method set.
-For example:
-</p>
-
-<pre>
-type Fooer interface {
- Foo()
- ImplementsFooer()
-}
-</pre>
-
-<p>
-A type must then implement the <code>ImplementsFooer</code> method to be a
-<code>Fooer</code>, clearly documenting the fact and announcing it in
-<a href="/cmd/go/#hdr-Show_documentation_for_package_or_symbol">go doc</a>'s output.
-</p>
-
-<pre>
-type Bar struct{}
-func (b Bar) ImplementsFooer() {}
-func (b Bar) Foo() {}
-</pre>
-
-<p>
-Most code doesn't make use of such constraints, since they limit the utility of
-the interface idea. Sometimes, though, they're necessary to resolve ambiguities
-among similar interfaces.
-</p>
-
-<h3 id="t_and_equal_interface">
-Why doesn't type T satisfy the Equal interface?</h3>
-
-<p>
-Consider this simple interface to represent an object that can compare
-itself with another value:
-</p>
-
-<pre>
-type Equaler interface {
- Equal(Equaler) bool
-}
-</pre>
-
-<p>
-and this type, <code>T</code>:
-</p>
-
-<pre>
-type T int
-func (t T) Equal(u T) bool { return t == u } // does not satisfy Equaler
-</pre>
-
-<p>
-Unlike the analogous situation in some polymorphic type systems,
-<code>T</code> does not implement <code>Equaler</code>.
-The argument type of <code>T.Equal</code> is <code>T</code>,
-not literally the required type <code>Equaler</code>.
-</p>
-
-<p>
-In Go, the type system does not promote the argument of
-<code>Equal</code>; that is the programmer's responsibility, as
-illustrated by the type <code>T2</code>, which does implement
-<code>Equaler</code>:
-</p>
-
-<pre>
-type T2 int
-func (t T2) Equal(u Equaler) bool { return t == u.(T2) } // satisfies Equaler
-</pre>
-
-<p>
-Even this isn't like other type systems, though, because in Go <em>any</em>
-type that satisfies <code>Equaler</code> could be passed as the
-argument to <code>T2.Equal</code>, and at run time we must
-check that the argument is of type <code>T2</code>.
-Some languages arrange to make that guarantee at compile time.
-</p>
-
-<p>
-A related example goes the other way:
-</p>
-
-<pre>
-type Opener interface {
- Open() Reader
-}
-
-func (t T3) Open() *os.File
-</pre>
-
-<p>
-In Go, <code>T3</code> does not satisfy <code>Opener</code>,
-although it might in another language.
-</p>
-
-<p>
-While it is true that Go's type system does less for the programmer
-in such cases, the lack of subtyping makes the rules about
-interface satisfaction very easy to state: are the function's names
-and signatures exactly those of the interface?
-Go's rule is also easy to implement efficiently.
-We feel these benefits offset the lack of
-automatic type promotion. Should Go one day adopt some form of polymorphic
-typing, we expect there would be a way to express the idea of these
-examples and also have them be statically checked.
-</p>
-
-<h3 id="convert_slice_of_interface">
-Can I convert a []T to an []interface{}?</h3>
-
-<p>
-Not directly.
-It is disallowed by the language specification because the two types
-do not have the same representation in memory.
-It is necessary to copy the elements individually to the destination
-slice. This example converts a slice of <code>int</code> to a slice of
-<code>interface{}</code>:
-</p>
-
-<pre>
-t := []int{1, 2, 3, 4}
-s := make([]interface{}, len(t))
-for i, v := range t {
- s[i] = v
-}
-</pre>
-
-<h3 id="convert_slice_with_same_underlying_type">
-Can I convert []T1 to []T2 if T1 and T2 have the same underlying type?</h3>
-
-This last line of this code sample does not compile.
-
-<pre>
-type T1 int
-type T2 int
-var t1 T1
-var x = T2(t1) // OK
-var st1 []T1
-var sx = ([]T2)(st1) // NOT OK
-</pre>
-
-<p>
-In Go, types are closely tied to methods, in that every named type has
-a (possibly empty) method set.
-The general rule is that you can change the name of the type being
-converted (and thus possibly change its method set) but you can't
-change the name (and method set) of elements of a composite type.
-Go requires you to be explicit about type conversions.
-</p>
-
-<h3 id="nil_error">
-Why is my nil error value not equal to nil?
-</h3>
-
-<p>
-Under the covers, interfaces are implemented as two elements, a type <code>T</code>
-and a value <code>V</code>.
-<code>V</code> is a concrete value such as an <code>int</code>,
-<code>struct</code> or pointer, never an interface itself, and has
-type <code>T</code>.
-For instance, if we store the <code>int</code> value 3 in an interface,
-the resulting interface value has, schematically,
-(<code>T=int</code>, <code>V=3</code>).
-The value <code>V</code> is also known as the interface's
-<em>dynamic</em> value,
-since a given interface variable might hold different values <code>V</code>
-(and corresponding types <code>T</code>)
-during the execution of the program.
-</p>
-
-<p>
-An interface value is <code>nil</code> only if the <code>V</code> and <code>T</code>
-are both unset, (<code>T=nil</code>, <code>V</code> is not set),
-In particular, a <code>nil</code> interface will always hold a <code>nil</code> type.
-If we store a <code>nil</code> pointer of type <code>*int</code> inside
-an interface value, the inner type will be <code>*int</code> regardless of the value of the pointer:
-(<code>T=*int</code>, <code>V=nil</code>).
-Such an interface value will therefore be non-<code>nil</code>
-<em>even when the pointer value <code>V</code> inside is</em> <code>nil</code>.
-</p>
-
-<p>
-This situation can be confusing, and arises when a <code>nil</code> value is
-stored inside an interface value such as an <code>error</code> return:
-</p>
-
-<pre>
-func returnsError() error {
- var p *MyError = nil
- if bad() {
- p = ErrBad
- }
- return p // Will always return a non-nil error.
-}
-</pre>
-
-<p>
-If all goes well, the function returns a <code>nil</code> <code>p</code>,
-so the return value is an <code>error</code> interface
-value holding (<code>T=*MyError</code>, <code>V=nil</code>).
-This means that if the caller compares the returned error to <code>nil</code>,
-it will always look as if there was an error even if nothing bad happened.
-To return a proper <code>nil</code> <code>error</code> to the caller,
-the function must return an explicit <code>nil</code>:
-</p>
-
-
-<pre>
-func returnsError() error {
- if bad() {
- return ErrBad
- }
- return nil
-}
-</pre>
-
-<p>
-It's a good idea for functions
-that return errors always to use the <code>error</code> type in
-their signature (as we did above) rather than a concrete type such
-as <code>*MyError</code>, to help guarantee the error is
-created correctly. As an example,
-<a href="/pkg/os/#Open"><code>os.Open</code></a>
-returns an <code>error</code> even though, if not <code>nil</code>,
-it's always of concrete type
-<a href="/pkg/os/#PathError"><code>*os.PathError</code></a>.
-</p>
-
-<p>
-Similar situations to those described here can arise whenever interfaces are used.
-Just keep in mind that if any concrete value
-has been stored in the interface, the interface will not be <code>nil</code>.
-For more information, see
-<a href="/doc/articles/laws_of_reflection.html">The Laws of Reflection</a>.
-</p>
-
-
-<h3 id="unions">
-Why are there no untagged unions, as in C?</h3>
-
-<p>
-Untagged unions would violate Go's memory safety
-guarantees.
-</p>
-
-<h3 id="variant_types">
-Why does Go not have variant types?</h3>
-
-<p>
-Variant types, also known as algebraic types, provide a way to specify
-that a value might take one of a set of other types, but only those
-types. A common example in systems programming would specify that an
-error is, say, a network error, a security error or an application
-error and allow the caller to discriminate the source of the problem
-by examining the type of the error. Another example is a syntax tree
-in which each node can be a different type: declaration, statement,
-assignment and so on.
-</p>
-
-<p>
-We considered adding variant types to Go, but after discussion
-decided to leave them out because they overlap in confusing ways
-with interfaces. What would happen if the elements of a variant type
-were themselves interfaces?
-</p>
-
-<p>
-Also, some of what variant types address is already covered by the
-language. The error example is easy to express using an interface
-value to hold the error and a type switch to discriminate cases. The
-syntax tree example is also doable, although not as elegantly.
-</p>
-
-<h3 id="covariant_types">
-Why does Go not have covariant result types?</h3>
-
-<p>
-Covariant result types would mean that an interface like
-</p>
-
-<pre>
-type Copyable interface {
- Copy() interface{}
-}
-</pre>
-
-<p>
-would be satisfied by the method
-</p>
-
-<pre>
-func (v Value) Copy() Value
-</pre>
-
-<p>because <code>Value</code> implements the empty interface.
-In Go method types must match exactly, so <code>Value</code> does not
-implement <code>Copyable</code>.
-Go separates the notion of what a
-type does&mdash;its methods&mdash;from the type's implementation.
-If two methods return different types, they are not doing the same thing.
-Programmers who want covariant result types are often trying to
-express a type hierarchy through interfaces.
-In Go it's more natural to have a clean separation between interface
-and implementation.
-</p>
-
-<h2 id="values">Values</h2>
-
-<h3 id="conversions">
-Why does Go not provide implicit numeric conversions?</h3>
-
-<p>
-The convenience of automatic conversion between numeric types in C is
-outweighed by the confusion it causes. When is an expression unsigned?
-How big is the value? Does it overflow? Is the result portable, independent
-of the machine on which it executes?
-It also complicates the compiler; &ldquo;the usual arithmetic conversions&rdquo;
-are not easy to implement and inconsistent across architectures.
-For reasons of portability, we decided to make things clear and straightforward
-at the cost of some explicit conversions in the code.
-The definition of constants in Go&mdash;arbitrary precision values free
-of signedness and size annotations&mdash;ameliorates matters considerably,
-though.
-</p>
-
-<p>
-A related detail is that, unlike in C, <code>int</code> and <code>int64</code>
-are distinct types even if <code>int</code> is a 64-bit type. The <code>int</code>
-type is generic; if you care about how many bits an integer holds, Go
-encourages you to be explicit.
-</p>
-
-<h3 id="constants">
-How do constants work in Go?</h3>
-
-<p>
-Although Go is strict about conversion between variables of different
-numeric types, constants in the language are much more flexible.
-Literal constants such as <code>23</code>, <code>3.14159</code>
-and <a href="/pkg/math/#pkg-constants"><code>math.Pi</code></a>
-occupy a sort of ideal number space, with arbitrary precision and
-no overflow or underflow.
-For instance, the value of <code>math.Pi</code> is specified to 63 places
-in the source code, and constant expressions involving the value keep
-precision beyond what a <code>float64</code> could hold.
-Only when the constant or constant expression is assigned to a
-variable&mdash;a memory location in the program&mdash;does
-it become a "computer" number with
-the usual floating-point properties and precision.
-</p>
-
-<p>
-Also,
-because they are just numbers, not typed values, constants in Go can be
-used more freely than variables, thereby softening some of the awkwardness
-around the strict conversion rules.
-One can write expressions such as
-</p>
-
-<pre>
-sqrt2 := math.Sqrt(2)
-</pre>
-
-<p>
-without complaint from the compiler because the ideal number <code>2</code>
-can be converted safely and accurately
-to a <code>float64</code> for the call to <code>math.Sqrt</code>.
-</p>
-
-<p>
-A blog post titled <a href="https://blog.golang.org/constants">Constants</a>
-explores this topic in more detail.
-</p>
-
-<h3 id="builtin_maps">
-Why are maps built in?</h3>
-<p>
-The same reason strings are: they are such a powerful and important data
-structure that providing one excellent implementation with syntactic support
-makes programming more pleasant. We believe that Go's implementation of maps
-is strong enough that it will serve for the vast majority of uses.
-If a specific application can benefit from a custom implementation, it's possible
-to write one but it will not be as convenient syntactically; this seems a reasonable tradeoff.
-</p>
-
-<h3 id="map_keys">
-Why don't maps allow slices as keys?</h3>
-<p>
-Map lookup requires an equality operator, which slices do not implement.
-They don't implement equality because equality is not well defined on such types;
-there are multiple considerations involving shallow vs. deep comparison, pointer vs.
-value comparison, how to deal with recursive types, and so on.
-We may revisit this issue&mdash;and implementing equality for slices
-will not invalidate any existing programs&mdash;but without a clear idea of what
-equality of slices should mean, it was simpler to leave it out for now.
-</p>
-
-<p>
-In Go 1, unlike prior releases, equality is defined for structs and arrays, so such
-types can be used as map keys. Slices still do not have a definition of equality, though.
-</p>
-
-<h3 id="references">
-Why are maps, slices, and channels references while arrays are values?</h3>
-<p>
-There's a lot of history on that topic. Early on, maps and channels
-were syntactically pointers and it was impossible to declare or use a
-non-pointer instance. Also, we struggled with how arrays should work.
-Eventually we decided that the strict separation of pointers and
-values made the language harder to use. Changing these
-types to act as references to the associated, shared data structures resolved
-these issues. This change added some regrettable complexity to the
-language but had a large effect on usability: Go became a more
-productive, comfortable language when it was introduced.
-</p>
-
-<h2 id="Writing_Code">Writing Code</h2>
-
-<h3 id="How_are_libraries_documented">
-How are libraries documented?</h3>
-
-<p>
-There is a program, <code>godoc</code>, written in Go, that extracts
-package documentation from the source code and serves it as a web
-page with links to declarations, files, and so on.
-An instance is running at
-<a href="/pkg/">golang.org/pkg/</a>.
-In fact, <code>godoc</code> implements the full site at
-<a href="/">golang.org/</a>.
-</p>
-
-<p>
-A <code>godoc</code> instance may be configured to provide rich,
-interactive static analyses of symbols in the programs it displays; details are
-listed <a href="https://golang.org/lib/godoc/analysis/help.html">here</a>.
-</p>
-
-<p>
-For access to documentation from the command line, the
-<a href="https://golang.org/pkg/cmd/go/">go</a> tool has a
-<a href="https://golang.org/pkg/cmd/go/#hdr-Show_documentation_for_package_or_symbol">doc</a>
-subcommand that provides a textual interface to the same information.
-</p>
-
-<h3 id="Is_there_a_Go_programming_style_guide">
-Is there a Go programming style guide?</h3>
-
-<p>
-There is no explicit style guide, although there is certainly
-a recognizable "Go style".
-</p>
-
-<p>
-Go has established conventions to guide decisions around
-naming, layout, and file organization.
-The document <a href="effective_go.html">Effective Go</a>
-contains some advice on these topics.
-More directly, the program <code>gofmt</code> is a pretty-printer
-whose purpose is to enforce layout rules; it replaces the usual
-compendium of do's and don'ts that allows interpretation.
-All the Go code in the repository, and the vast majority in the
-open source world, has been run through <code>gofmt</code>.
-</p>
-
-<p>
-The document titled
-<a href="//golang.org/s/comments">Go Code Review Comments</a>
-is a collection of very short essays about details of Go idiom that are often
-missed by programmers.
-It is a handy reference for people doing code reviews for Go projects.
-</p>
-
-<h3 id="How_do_I_submit_patches_to_the_Go_libraries">
-How do I submit patches to the Go libraries?</h3>
-
-<p>
-The library sources are in the <code>src</code> directory of the repository.
-If you want to make a significant change, please discuss on the mailing list before embarking.
-</p>
-
-<p>
-See the document
-<a href="contribute.html">Contributing to the Go project</a>
-for more information about how to proceed.
-</p>
-
-<h3 id="git_https">
-Why does "go get" use HTTPS when cloning a repository?</h3>
-
-<p>
-Companies often permit outgoing traffic only on the standard TCP ports 80 (HTTP)
-and 443 (HTTPS), blocking outgoing traffic on other ports, including TCP port 9418
-(git) and TCP port 22 (SSH).
-When using HTTPS instead of HTTP, <code>git</code> enforces certificate validation by
-default, providing protection against man-in-the-middle, eavesdropping and tampering attacks.
-The <code>go get</code> command therefore uses HTTPS for safety.
-</p>
-
-<p>
-<code>Git</code> can be configured to authenticate over HTTPS or to use SSH in place of HTTPS.
-To authenticate over HTTPS, you can add a line
-to the <code>$HOME/.netrc</code> file that git consults:
-</p>
-<pre>
-machine github.com login <i>USERNAME</i> password <i>APIKEY</i>
-</pre>
-<p>
-For GitHub accounts, the password can be a
-<a href="https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/">personal access token</a>.
-</p>
-
-<p>
-<code>Git</code> can also be configured to use SSH in place of HTTPS for URLs matching a given prefix.
-For example, to use SSH for all GitHub access,
-add these lines to your <code>~/.gitconfig</code>:
-</p>
-<pre>
-[url "ssh://git@github.com/"]
- insteadOf = https://github.com/
-</pre>
-
-<h3 id="get_version">
-How should I manage package versions using "go get"?</h3>
-
-<p>
-Since the inception of the project, Go has had no explicit concept of package versions,
-but that is changing.
-Versioning is a source of significant complexity, especially in large code bases,
-and it has taken some time to develop an
-approach that works well at scale in a large enough
-variety of situations to be appropriate to supply to all Go users.
-</p>
-
-<p>
-The Go 1.11 release adds new, experimental support
-for package versioning to the <code>go</code> command,
-in the form of Go modules.
-For more information, see the <a href="/doc/go1.11#modules">Go 1.11 release notes</a>
-and the <a href="/cmd/go#hdr-Modules__module_versions__and_more"><code>go</code> command documentation</a>.
-</p>
-
-<p>
-Regardless of the actual package management technology,
-"go get" and the larger Go toolchain does provide isolation of
-packages with different import paths.
-For example, the standard library's <code>html/template</code> and <code>text/template</code>
-coexist even though both are "package template".
-This observation leads to some advice for package authors and package users.
-</p>
-
-<p>
-Packages intended for public use should try to maintain backwards compatibility as they evolve.
-The <a href="/doc/go1compat.html">Go 1 compatibility guidelines</a> are a good reference here:
-don't remove exported names, encourage tagged composite literals, and so on.
-If different functionality is required, add a new name instead of changing an old one.
-If a complete break is required, create a new package with a new import path.
-</p>
-
-<p>
-If you're using an externally supplied package and worry that it might change in
-unexpected ways, but are not yet using Go modules,
-the simplest solution is to copy it to your local repository.
-This is the approach Google takes internally and is supported by the
-<code>go</code> command through a technique called "vendoring".
-This involves
-storing a copy of the dependency under a new import path that identifies it as a local copy.
-See the <a href="https://golang.org/s/go15vendor">design
-document</a> for details.
-</p>
-
-<h2 id="Pointers">Pointers and Allocation</h2>
-
-<h3 id="pass_by_value">
-When are function parameters passed by value?</h3>
-
-<p>
-As in all languages in the C family, everything in Go is passed by value.
-That is, a function always gets a copy of the
-thing being passed, as if there were an assignment statement assigning the
-value to the parameter. For instance, passing an <code>int</code> value
-to a function makes a copy of the <code>int</code>, and passing a pointer
-value makes a copy of the pointer, but not the data it points to.
-(See a <a href="/doc/faq#methods_on_values_or_pointers">later
-section</a> for a discussion of how this affects method receivers.)
-</p>
-
-<p>
-Map and slice values behave like pointers: they are descriptors that
-contain pointers to the underlying map or slice data. Copying a map or
-slice value doesn't copy the data it points to. Copying an interface value
-makes a copy of the thing stored in the interface value. If the interface
-value holds a struct, copying the interface value makes a copy of the
-struct. If the interface value holds a pointer, copying the interface value
-makes a copy of the pointer, but again not the data it points to.
-</p>
-
-<p>
-Note that this discussion is about the semantics of the operations.
-Actual implementations may apply optimizations to avoid copying
-as long as the optimizations do not change the semantics.
-</p>
-
-<h3 id="pointer_to_interface">
-When should I use a pointer to an interface?</h3>
-
-<p>
-Almost never. Pointers to interface values arise only in rare, tricky situations involving
-disguising an interface value's type for delayed evaluation.
-</p>
-
-<p>
-It is a common mistake to pass a pointer to an interface value
-to a function expecting an interface. The compiler will complain about this
-error but the situation can still be confusing, because sometimes a
-<a href="#different_method_sets">pointer
-is necessary to satisfy an interface</a>.
-The insight is that although a pointer to a concrete type can satisfy
-an interface, with one exception <em>a pointer to an interface can never satisfy an interface</em>.
-</p>
-
-<p>
-Consider the variable declaration,
-</p>
-
-<pre>
-var w io.Writer
-</pre>
-
-<p>
-The printing function <code>fmt.Fprintf</code> takes as its first argument
-a value that satisfies <code>io.Writer</code>—something that implements
-the canonical <code>Write</code> method. Thus we can write
-</p>
-
-<pre>
-fmt.Fprintf(w, "hello, world\n")
-</pre>
-
-<p>
-If however we pass the address of <code>w</code>, the program will not compile.
-</p>
-
-<pre>
-fmt.Fprintf(&amp;w, "hello, world\n") // Compile-time error.
-</pre>
-
-<p>
-The one exception is that any value, even a pointer to an interface, can be assigned to
-a variable of empty interface type (<code>interface{}</code>).
-Even so, it's almost certainly a mistake if the value is a pointer to an interface;
-the result can be confusing.
-</p>
-
-<h3 id="methods_on_values_or_pointers">
-Should I define methods on values or pointers?</h3>
-
-<pre>
-func (s *MyStruct) pointerMethod() { } // method on pointer
-func (s MyStruct) valueMethod() { } // method on value
-</pre>
-
-<p>
-For programmers unaccustomed to pointers, the distinction between these
-two examples can be confusing, but the situation is actually very simple.
-When defining a method on a type, the receiver (<code>s</code> in the above
-examples) behaves exactly as if it were an argument to the method.
-Whether to define the receiver as a value or as a pointer is the same
-question, then, as whether a function argument should be a value or
-a pointer.
-There are several considerations.
-</p>
-
-<p>
-First, and most important, does the method need to modify the
-receiver?
-If it does, the receiver <em>must</em> be a pointer.
-(Slices and maps act as references, so their story is a little
-more subtle, but for instance to change the length of a slice
-in a method the receiver must still be a pointer.)
-In the examples above, if <code>pointerMethod</code> modifies
-the fields of <code>s</code>,
-the caller will see those changes, but <code>valueMethod</code>
-is called with a copy of the caller's argument (that's the definition
-of passing a value), so changes it makes will be invisible to the caller.
-</p>
-
-<p>
-By the way, in Java method receivers are always pointers,
-although their pointer nature is somewhat disguised
-(and there is a proposal to add value receivers to the language).
-It is the value receivers in Go that are unusual.
-</p>
-
-<p>
-Second is the consideration of efficiency. If the receiver is large,
-a big <code>struct</code> for instance, it will be much cheaper to
-use a pointer receiver.
-</p>
-
-<p>
-Next is consistency. If some of the methods of the type must have
-pointer receivers, the rest should too, so the method set is
-consistent regardless of how the type is used.
-See the section on <a href="#different_method_sets">method sets</a>
-for details.
-</p>
-
-<p>
-For types such as basic types, slices, and small <code>structs</code>,
-a value receiver is very cheap so unless the semantics of the method
-requires a pointer, a value receiver is efficient and clear.
-</p>
-
-
-<h3 id="new_and_make">
-What's the difference between new and make?</h3>
-
-<p>
-In short: <code>new</code> allocates memory, while <code>make</code> initializes
-the slice, map, and channel types.
-</p>
-
-<p>
-See the <a href="/doc/effective_go.html#allocation_new">relevant section
-of Effective Go</a> for more details.
-</p>
-
-<h3 id="q_int_sizes">
-What is the size of an <code>int</code> on a 64 bit machine?</h3>
-
-<p>
-The sizes of <code>int</code> and <code>uint</code> are implementation-specific
-but the same as each other on a given platform.
-For portability, code that relies on a particular
-size of value should use an explicitly sized type, like <code>int64</code>.
-On 32-bit machines the compilers use 32-bit integers by default,
-while on 64-bit machines integers have 64 bits.
-(Historically, this was not always true.)
-</p>
-
-<p>
-On the other hand, floating-point scalars and complex
-types are always sized (there are no <code>float</code> or <code>complex</code> basic types),
-because programmers should be aware of precision when using floating-point numbers.
-The default type used for an (untyped) floating-point constant is <code>float64</code>.
-Thus <code>foo</code> <code>:=</code> <code>3.0</code> declares a variable <code>foo</code>
-of type <code>float64</code>.
-For a <code>float32</code> variable initialized by an (untyped) constant, the variable type
-must be specified explicitly in the variable declaration:
-</p>
-
-<pre>
-var foo float32 = 3.0
-</pre>
-
-<p>
-Alternatively, the constant must be given a type with a conversion as in
-<code>foo := float32(3.0)</code>.
-</p>
-
-<h3 id="stack_or_heap">
-How do I know whether a variable is allocated on the heap or the stack?</h3>
-
-<p>
-From a correctness standpoint, you don't need to know.
-Each variable in Go exists as long as there are references to it.
-The storage location chosen by the implementation is irrelevant to the
-semantics of the language.
-</p>
-
-<p>
-The storage location does have an effect on writing efficient programs.
-When possible, the Go compilers will allocate variables that are
-local to a function in that function's stack frame. However, if the
-compiler cannot prove that the variable is not referenced after the
-function returns, then the compiler must allocate the variable on the
-garbage-collected heap to avoid dangling pointer errors.
-Also, if a local variable is very large, it might make more sense
-to store it on the heap rather than the stack.
-</p>
-
-<p>
-In the current compilers, if a variable has its address taken, that variable
-is a candidate for allocation on the heap. However, a basic <em>escape
-analysis</em> recognizes some cases when such variables will not
-live past the return from the function and can reside on the stack.
-</p>
-
-<h3 id="Why_does_my_Go_process_use_so_much_virtual_memory">
-Why does my Go process use so much virtual memory?</h3>
-
-<p>
-The Go memory allocator reserves a large region of virtual memory as an arena
-for allocations. This virtual memory is local to the specific Go process; the
-reservation does not deprive other processes of memory.
-</p>
-
-<p>
-To find the amount of actual memory allocated to a Go process, use the Unix
-<code>top</code> command and consult the <code>RES</code> (Linux) or
-<code>RSIZE</code> (macOS) columns.
-<!-- TODO(adg): find out how this works on Windows -->
-</p>
-
-<h2 id="Concurrency">Concurrency</h2>
-
-<h3 id="What_operations_are_atomic_What_about_mutexes">
-What operations are atomic? What about mutexes?</h3>
-
-<p>
-A description of the atomicity of operations in Go can be found in
-the <a href="/ref/mem">Go Memory Model</a> document.
-</p>
-
-<p>
-Low-level synchronization and atomic primitives are available in the
-<a href="/pkg/sync">sync</a> and
-<a href="/pkg/sync/atomic">sync/atomic</a>
-packages.
-These packages are good for simple tasks such as incrementing
-reference counts or guaranteeing small-scale mutual exclusion.
-</p>
-
-<p>
-For higher-level operations, such as coordination among
-concurrent servers, higher-level techniques can lead
-to nicer programs, and Go supports this approach through
-its goroutines and channels.
-For instance, you can structure your program so that only one
-goroutine at a time is ever responsible for a particular piece of data.
-That approach is summarized by the original
-<a href="https://www.youtube.com/watch?v=PAAkCSZUG1c">Go proverb</a>,
-</p>
-
-<p>
-Do not communicate by sharing memory. Instead, share memory by communicating.
-</p>
-
-<p>
-See the <a href="/doc/codewalk/sharemem/">Share Memory By Communicating</a> code walk
-and its <a href="https://blog.golang.org/2010/07/share-memory-by-communicating.html">
-associated article</a> for a detailed discussion of this concept.
-</p>
-
-<p>
-Large concurrent programs are likely to borrow from both these toolkits.
-</p>
-
-<h3 id="parallel_slow">
-Why doesn't my program run faster with more CPUs?</h3>
-
-<p>
-Whether a program runs faster with more CPUs depends on the problem
-it is solving.
-The Go language provides concurrency primitives, such as goroutines
-and channels, but concurrency only enables parallelism
-when the underlying problem is intrinsically parallel.
-Problems that are intrinsically sequential cannot be sped up by adding
-more CPUs, while those that can be broken into pieces that can
-execute in parallel can be sped up, sometimes dramatically.
-</p>
-
-<p>
-Sometimes adding more CPUs can slow a program down.
-In practical terms, programs that spend more time
-synchronizing or communicating than doing useful computation
-may experience performance degradation when using
-multiple OS threads.
-This is because passing data between threads involves switching
-contexts, which has significant cost, and that cost can increase
-with more CPUs.
-For instance, the <a href="/ref/spec#An_example_package">prime sieve example</a>
-from the Go specification has no significant parallelism although it launches many
-goroutines; increasing the number of threads (CPUs) is more likely to slow it down than
-to speed it up.
-</p>
-
-<p>
-For more detail on this topic see the talk entitled
-<a href="//blog.golang.org/2013/01/concurrency-is-not-parallelism.html">Concurrency
-is not Parallelism</a>.
-
-<h3 id="number_cpus">
-How can I control the number of CPUs?</h3>
-
-<p>
-The number of CPUs available simultaneously to executing goroutines is
-controlled by the <code>GOMAXPROCS</code> shell environment variable,
-whose default value is the number of CPU cores available.
-Programs with the potential for parallel execution should therefore
-achieve it by default on a multiple-CPU machine.
-To change the number of parallel CPUs to use,
-set the environment variable or use the similarly-named
-<a href="/pkg/runtime/#GOMAXPROCS">function</a>
-of the runtime package to configure the
-run-time support to utilize a different number of threads.
-Setting it to 1 eliminates the possibility of true parallelism,
-forcing independent goroutines to take turns executing.
-</p>
-
-<p>
-The runtime can allocate more threads than the value
-of <code>GOMAXPROCS</code> to service multiple outstanding
-I/O requests.
-<code>GOMAXPROCS</code> only affects how many goroutines
-can actually execute at once; arbitrarily more may be blocked
-in system calls.
-</p>
-
-<p>
-Go's goroutine scheduler is not as good as it needs to be, although it
-has improved over time.
-In the future, it may better optimize its use of OS threads.
-For now, if there are performance issues,
-setting <code>GOMAXPROCS</code> on a per-application basis may help.
-</p>
-
-
-<h3 id="no_goroutine_id">
-Why is there no goroutine ID?</h3>
-
-<p>
-Goroutines do not have names; they are just anonymous workers.
-They expose no unique identifier, name, or data structure to the programmer.
-Some people are surprised by this, expecting the <code>go</code>
-statement to return some item that can be used to access and control
-the goroutine later.
-</p>
-
-<p>
-The fundamental reason goroutines are anonymous is so that
-the full Go language is available when programming concurrent code.
-By contrast, the usage patterns that develop when threads and goroutines are
-named can restrict what a library using them can do.
-</p>
-
-<p>
-Here is an illustration of the difficulties.
-Once one names a goroutine and constructs a model around
-it, it becomes special, and one is tempted to associate all computation
-with that goroutine, ignoring the possibility
-of using multiple, possibly shared goroutines for the processing.
-If the <code>net/http</code> package associated per-request
-state with a goroutine,
-clients would be unable to use more goroutines
-when serving a request.
-</p>
-
-<p>
-Moreover, experience with libraries such as those for graphics systems
-that require all processing to occur on the "main thread"
-has shown how awkward and limiting the approach can be when
-deployed in a concurrent language.
-The very existence of a special thread or goroutine forces
-the programmer to distort the program to avoid crashes
-and other problems caused by inadvertently operating
-on the wrong thread.
-</p>
-
-<p>
-For those cases where a particular goroutine is truly special,
-the language provides features such as channels that can be
-used in flexible ways to interact with it.
-</p>
-
-<h2 id="Functions_methods">Functions and Methods</h2>
-
-<h3 id="different_method_sets">
-Why do T and *T have different method sets?</h3>
-
-<p>
-As the <a href="/ref/spec#Types">Go specification</a> says,
-the method set of a type <code>T</code> consists of all methods
-with receiver type <code>T</code>,
-while that of the corresponding pointer
-type <code>*T</code> consists of all methods with receiver <code>*T</code> or
-<code>T</code>.
-That means the method set of <code>*T</code>
-includes that of <code>T</code>,
-but not the reverse.
-</p>
-
-<p>
-This distinction arises because
-if an interface value contains a pointer <code>*T</code>,
-a method call can obtain a value by dereferencing the pointer,
-but if an interface value contains a value <code>T</code>,
-there is no safe way for a method call to obtain a pointer.
-(Doing so would allow a method to modify the contents of
-the value inside the interface, which is not permitted by
-the language specification.)
-</p>
-
-<p>
-Even in cases where the compiler could take the address of a value
-to pass to the method, if the method modifies the value the changes
-will be lost in the caller.
-As an example, if the <code>Write</code> method of
-<a href="/pkg/bytes/#Buffer"><code>bytes.Buffer</code></a>
-used a value receiver rather than a pointer,
-this code:
-</p>
-
-<pre>
-var buf bytes.Buffer
-io.Copy(buf, os.Stdin)
-</pre>
-
-<p>
-would copy standard input into a <i>copy</i> of <code>buf</code>,
-not into <code>buf</code> itself.
-This is almost never the desired behavior.
-</p>
-
-<h3 id="closures_and_goroutines">
-What happens with closures running as goroutines?</h3>
-
-<p>
-Some confusion may arise when using closures with concurrency.
-Consider the following program:
-</p>
-
-<pre>
-func main() {
- done := make(chan bool)
-
- values := []string{"a", "b", "c"}
- for _, v := range values {
- go func() {
- fmt.Println(v)
- done &lt;- true
- }()
- }
-
- // wait for all goroutines to complete before exiting
- for _ = range values {
- &lt;-done
- }
-}
-</pre>
-
-<p>
-One might mistakenly expect to see <code>a, b, c</code> as the output.
-What you'll probably see instead is <code>c, c, c</code>. This is because
-each iteration of the loop uses the same instance of the variable <code>v</code>, so
-each closure shares that single variable. When the closure runs, it prints the
-value of <code>v</code> at the time <code>fmt.Println</code> is executed,
-but <code>v</code> may have been modified since the goroutine was launched.
-To help detect this and other problems before they happen, run
-<a href="/cmd/go/#hdr-Run_go_tool_vet_on_packages"><code>go vet</code></a>.
-</p>
-
-<p>
-To bind the current value of <code>v</code> to each closure as it is launched, one
-must modify the inner loop to create a new variable each iteration.
-One way is to pass the variable as an argument to the closure:
-</p>
-
-<pre>
- for _, v := range values {
- go func(<b>u</b> string) {
- fmt.Println(<b>u</b>)
- done &lt;- true
- }(<b>v</b>)
- }
-</pre>
-
-<p>
-In this example, the value of <code>v</code> is passed as an argument to the
-anonymous function. That value is then accessible inside the function as
-the variable <code>u</code>.
-</p>
-
-<p>
-Even easier is just to create a new variable, using a declaration style that may
-seem odd but works fine in Go:
-</p>
-
-<pre>
- for _, v := range values {
- <b>v := v</b> // create a new 'v'.
- go func() {
- fmt.Println(<b>v</b>)
- done &lt;- true
- }()
- }
-</pre>
-
-<p>
-This behavior of the language, not defining a new variable for
-each iteration, may have been a mistake in retrospect.
-It may be addressed in a later version but, for compatibility,
-cannot change in Go version 1.
-</p>
-
-<h2 id="Control_flow">Control flow</h2>
-
-<h3 id="Does_Go_have_a_ternary_form">
-Why does Go not have the <code>?:</code> operator?</h3>
-
-<p>
-There is no ternary testing operation in Go.
-You may use the following to achieve the same
-result:
-</p>
-
-<pre>
-if expr {
- n = trueVal
-} else {
- n = falseVal
-}
-</pre>
-
-<p>
-The reason <code>?:</code> is absent from Go is that the language's designers
-had seen the operation used too often to create impenetrably complex expressions.
-The <code>if-else</code> form, although longer,
-is unquestionably clearer.
-A language needs only one conditional control flow construct.
-</p>
-
-<h2 id="Packages_Testing">Packages and Testing</h2>
-
-<h3 id="How_do_I_create_a_multifile_package">
-How do I create a multifile package?</h3>
-
-<p>
-Put all the source files for the package in a directory by themselves.
-Source files can refer to items from different files at will; there is
-no need for forward declarations or a header file.
-</p>
-
-<p>
-Other than being split into multiple files, the package will compile and test
-just like a single-file package.
-</p>
-
-<h3 id="How_do_I_write_a_unit_test">
-How do I write a unit test?</h3>
-
-<p>
-Create a new file ending in <code>_test.go</code> in the same directory
-as your package sources. Inside that file, <code>import "testing"</code>
-and write functions of the form
-</p>
-
-<pre>
-func TestFoo(t *testing.T) {
- ...
-}
-</pre>
-
-<p>
-Run <code>go test</code> in that directory.
-That script finds the <code>Test</code> functions,
-builds a test binary, and runs it.
-</p>
-
-<p>See the <a href="/doc/code.html">How to Write Go Code</a> document,
-the <a href="/pkg/testing/"><code>testing</code></a> package
-and the <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a> subcommand for more details.
-</p>
-
-<h3 id="testing_framework">
-Where is my favorite helper function for testing?</h3>
-
-<p>
-Go's standard <a href="/pkg/testing/"><code>testing</code></a> package makes it easy to write unit tests, but it lacks
-features provided in other language's testing frameworks such as assertion functions.
-An <a href="#assertions">earlier section</a> of this document explained why Go
-doesn't have assertions, and
-the same arguments apply to the use of <code>assert</code> in tests.
-Proper error handling means letting other tests run after one has failed, so
-that the person debugging the failure gets a complete picture of what is
-wrong. It is more useful for a test to report that
-<code>isPrime</code> gives the wrong answer for 2, 3, 5, and 7 (or for
-2, 4, 8, and 16) than to report that <code>isPrime</code> gives the wrong
-answer for 2 and therefore no more tests were run. The programmer who
-triggers the test failure may not be familiar with the code that fails.
-Time invested writing a good error message now pays off later when the
-test breaks.
-</p>
-
-<p>
-A related point is that testing frameworks tend to develop into mini-languages
-of their own, with conditionals and controls and printing mechanisms,
-but Go already has all those capabilities; why recreate them?
-We'd rather write tests in Go; it's one fewer language to learn and the
-approach keeps the tests straightforward and easy to understand.
-</p>
-
-<p>
-If the amount of extra code required to write
-good errors seems repetitive and overwhelming, the test might work better if
-table-driven, iterating over a list of inputs and outputs defined
-in a data structure (Go has excellent support for data structure literals).
-The work to write a good test and good error messages will then be amortized over many
-test cases. The standard Go library is full of illustrative examples, such as in
-<a href="/src/fmt/fmt_test.go">the formatting tests for the <code>fmt</code> package</a>.
-</p>
-
-<h3 id="x_in_std">
-Why isn't <i>X</i> in the standard library?</h3>
-
-<p>
-The standard library's purpose is to support the runtime, connect to
-the operating system, and provide key functionality that many Go
-programs require, such as formatted I/O and networking.
-It also contains elements important for web programming, including
-cryptography and support for standards like HTTP, JSON, and XML.
-</p>
-
-<p>
-There is no clear criterion that defines what is included because for
-a long time, this was the <i>only</i> Go library.
-There are criteria that define what gets added today, however.
-</p>
-
-<p>
-New additions to the standard library are rare and the bar for
-inclusion is high.
-Code included in the standard library bears a large ongoing maintenance cost
-(often borne by those other than the original author),
-is subject to the <a href="/doc/go1compat.html">Go 1 compatibility promise</a>
-(blocking fixes to any flaws in the API),
-and is subject to the Go
-<a href="https://golang.org/s/releasesched">release schedule</a>,
-preventing bug fixes from being available to users quickly.
-</p>
-
-<p>
-Most new code should live outside of the standard library and be accessible
-via the <a href="/cmd/go/"><code>go</code> tool</a>'s
-<code>go get</code> command.
-Such code can have its own maintainers, release cycle,
-and compatibility guarantees.
-Users can find packages and read their documentation at
-<a href="https://godoc.org/">godoc.org</a>.
-</p>
-
-<p>
-Although there are pieces in the standard library that don't really belong,
-such as <code>log/syslog</code>, we continue to maintain everything in the
-library because of the Go 1 compatibility promise.
-But we encourage most new code to live elsewhere.
-</p>
-
-<h2 id="Implementation">Implementation</h2>
-
-<h3 id="What_compiler_technology_is_used_to_build_the_compilers">
-What compiler technology is used to build the compilers?</h3>
-
-<p>
-There are several production compilers for Go, and a number of others
-in development for various platforms.
-</p>
-
-<p>
-The default compiler, <code>gc</code>, is included with the
-Go distribution as part of the support for the <code>go</code>
-command.
-<code>Gc</code> was originally written in C
-because of the difficulties of bootstrapping&mdash;you'd need a Go compiler to
-set up a Go environment.
-But things have advanced and since the Go 1.5 release the compiler has been
-a Go program.
-The compiler was converted from C to Go using automatic translation tools, as
-described in this <a href="/s/go13compiler">design document</a>
-and <a href="https://talks.golang.org/2015/gogo.slide#1">talk</a>.
-Thus the compiler is now "self-hosting", which means we needed to face
-the bootstrapping problem.
-The solution is to have a working Go installation already in place,
-just as one normally has with a working C installation.
-The story of how to bring up a new Go environment from source
-is described <a href="/s/go15bootstrap">here</a> and
-<a href="/doc/install/source">here</a>.
-</p>
-
-<p>
-<code>Gc</code> is written in Go with a recursive descent parser
-and uses a custom loader, also written in Go but
-based on the Plan 9 loader, to generate ELF/Mach-O/PE binaries.
-</p>
-
-<p>
-At the beginning of the project we considered using LLVM for
-<code>gc</code> but decided it was too large and slow to meet
-our performance goals.
-More important in retrospect, starting with LLVM would have made it
-harder to introduce some of the ABI and related changes, such as
-stack management, that Go requires but are not part of the standard
-C setup.
-A new <a href="https://go.googlesource.com/gollvm/">LLVM implementation</a>
-is starting to come together now, however.
-</p>
-
-<p>
-The <code>Gccgo</code> compiler is a front end written in C++
-with a recursive descent parser coupled to the
-standard GCC back end.
-</p>
-
-<p>
-Go turned out to be a fine language in which to implement a Go compiler,
-although that was not its original goal.
-Not being self-hosting from the beginning allowed Go's design to
-concentrate on its original use case, which was networked servers.
-Had we decided Go should compile itself early on, we might have
-ended up with a language targeted more for compiler construction,
-which is a worthy goal but not the one we had initially.
-</p>
-
-<p>
-Although <code>gc</code> does not use them (yet?), a native lexer and
-parser are available in the <a href="/pkg/go/"><code>go</code></a> package
-and there is also a native <a href="/pkg/go/types">type checker</a>.
-</p>
-
-<h3 id="How_is_the_run_time_support_implemented">
-How is the run-time support implemented?</h3>
-
-<p>
-Again due to bootstrapping issues, the run-time code was originally written mostly in C (with a
-tiny bit of assembler) but it has since been translated to Go
-(except for some assembler bits).
-<code>Gccgo</code>'s run-time support uses <code>glibc</code>.
-The <code>gccgo</code> compiler implements goroutines using
-a technique called segmented stacks,
-supported by recent modifications to the gold linker.
-<code>Gollvm</code> similarly is built on the corresponding
-LLVM infrastructure.
-</p>
-
-<h3 id="Why_is_my_trivial_program_such_a_large_binary">
-Why is my trivial program such a large binary?</h3>
-
-<p>
-The linker in the <code>gc</code> toolchain
-creates statically-linked binaries by default.
-All Go binaries therefore include the Go
-runtime, along with the run-time type information necessary to support dynamic
-type checks, reflection, and even panic-time stack traces.
-</p>
-
-<p>
-A simple C "hello, world" program compiled and linked statically using
-gcc on Linux is around 750 kB, including an implementation of
-<code>printf</code>.
-An equivalent Go program using
-<code>fmt.Printf</code> weighs a couple of megabytes, but that includes
-more powerful run-time support and type and debugging information.
-</p>
-
-<p>
-A Go program compiled with <code>gc</code> can be linked with
-the <code>-ldflags=-w</code> flag to disable DWARF generation,
-removing debugging information from the binary but with no
-other loss of functionality.
-This can reduce the binary size substantially.
-</p>
-
-<h3 id="unused_variables_and_imports">
-Can I stop these complaints about my unused variable/import?</h3>
-
-<p>
-The presence of an unused variable may indicate a bug, while
-unused imports just slow down compilation,
-an effect that can become substantial as a program accumulates
-code and programmers over time.
-For these reasons, Go refuses to compile programs with unused
-variables or imports,
-trading short-term convenience for long-term build speed and
-program clarity.
-</p>
-
-<p>
-Still, when developing code, it's common to create these situations
-temporarily and it can be annoying to have to edit them out before the
-program will compile.
-</p>
-
-<p>
-Some have asked for a compiler option to turn those checks off
-or at least reduce them to warnings.
-Such an option has not been added, though,
-because compiler options should not affect the semantics of the
-language and because the Go compiler does not report warnings, only
-errors that prevent compilation.
-</p>
-
-<p>
-There are two reasons for having no warnings. First, if it's worth
-complaining about, it's worth fixing in the code. (And if it's not
-worth fixing, it's not worth mentioning.) Second, having the compiler
-generate warnings encourages the implementation to warn about weak
-cases that can make compilation noisy, masking real errors that
-<em>should</em> be fixed.
-</p>
-
-<p>
-It's easy to address the situation, though. Use the blank identifier
-to let unused things persist while you're developing.
-</p>
-
-<pre>
-import "unused"
-
-// This declaration marks the import as used by referencing an
-// item from the package.
-var _ = unused.Item // TODO: Delete before committing!
-
-func main() {
- debugData := debug.Profile()
- _ = debugData // Used only during debugging.
- ....
-}
-</pre>
-
-<p>
-Nowadays, most Go programmers use a tool,
-<a href="https://godoc.org/golang.org/x/tools/cmd/goimports">goimports</a>,
-which automatically rewrites a Go source file to have the correct imports,
-eliminating the unused imports issue in practice.
-This program is easily connected to most editors to run automatically when a Go source file is written.
-</p>
-
-<h3 id="virus">
-Why does my virus-scanning software think my Go distribution or compiled binary is infected?</h3>
-
-<p>
-This is a common occurrence, especially on Windows machines, and is almost always a false positive.
-Commercial virus scanning programs are often confused by the structure of Go binaries, which
-they don't see as often as those compiled from other languages.
-</p>
-
-<p>
-If you've just installed the Go distribution and the system reports it is infected, that's certainly a mistake.
-To be really thorough, you can verify the download by comparing the checksum with those on the
-<a href="https://golang.org/dl/">downloads page</a>.
-</p>
-
-<p>
-In any case, if you believe the report is in error, please report a bug to the supplier of your virus scanner.
-Maybe in time virus scanners can learn to understand Go programs.
-</p>
-
-<h2 id="Performance">Performance</h2>
-
-<h3 id="Why_does_Go_perform_badly_on_benchmark_x">
-Why does Go perform badly on benchmark X?</h3>
-
-<p>
-One of Go's design goals is to approach the performance of C for comparable
-programs, yet on some benchmarks it does quite poorly, including several
-in <a href="https://go.googlesource.com/exp/+/master/shootout/">golang.org/x/exp/shootout</a>.
-The slowest depend on libraries for which versions of comparable performance
-are not available in Go.
-For instance, <a href="https://go.googlesource.com/exp/+/master/shootout/pidigits.go">pidigits.go</a>
-depends on a multi-precision math package, and the C
-versions, unlike Go's, use <a href="https://gmplib.org/">GMP</a> (which is
-written in optimized assembler).
-Benchmarks that depend on regular expressions
-(<a href="https://go.googlesource.com/exp/+/master/shootout/regex-dna.go">regex-dna.go</a>,
-for instance) are essentially comparing Go's native <a href="/pkg/regexp">regexp package</a> to
-mature, highly optimized regular expression libraries like PCRE.
-</p>
-
-<p>
-Benchmark games are won by extensive tuning and the Go versions of most
-of the benchmarks need attention. If you measure comparable C
-and Go programs
-(<a href="https://go.googlesource.com/exp/+/master/shootout/reverse-complement.go">reverse-complement.go</a>
-is one example), you'll see the two languages are much closer in raw performance
-than this suite would indicate.
-</p>
-
-<p>
-Still, there is room for improvement. The compilers are good but could be
-better, many libraries need major performance work, and the garbage collector
-isn't fast enough yet. (Even if it were, taking care not to generate unnecessary
-garbage can have a huge effect.)
-</p>
-
-<p>
-In any case, Go can often be very competitive.
-There has been significant improvement in the performance of many programs
-as the language and tools have developed.
-See the blog post about
-<a href="//blog.golang.org/2011/06/profiling-go-programs.html">profiling
-Go programs</a> for an informative example.
-
-<h2 id="change_from_c">Changes from C</h2>
-
-<h3 id="different_syntax">
-Why is the syntax so different from C?</h3>
-<p>
-Other than declaration syntax, the differences are not major and stem
-from two desires. First, the syntax should feel light, without too
-many mandatory keywords, repetition, or arcana. Second, the language
-has been designed to be easy to analyze
-and can be parsed without a symbol table. This makes it much easier
-to build tools such as debuggers, dependency analyzers, automated
-documentation extractors, IDE plug-ins, and so on. C and its
-descendants are notoriously difficult in this regard.
-</p>
-
-<h3 id="declarations_backwards">
-Why are declarations backwards?</h3>
-<p>
-They're only backwards if you're used to C. In C, the notion is that a
-variable is declared like an expression denoting its type, which is a
-nice idea, but the type and expression grammars don't mix very well and
-the results can be confusing; consider function pointers. Go mostly
-separates expression and type syntax and that simplifies things (using
-prefix <code>*</code> for pointers is an exception that proves the rule). In C,
-the declaration
-</p>
-<pre>
- int* a, b;
-</pre>
-<p>
-declares <code>a</code> to be a pointer but not <code>b</code>; in Go
-</p>
-<pre>
- var a, b *int
-</pre>
-<p>
-declares both to be pointers. This is clearer and more regular.
-Also, the <code>:=</code> short declaration form argues that a full variable
-declaration should present the same order as <code>:=</code> so
-</p>
-<pre>
- var a uint64 = 1
-</pre>
-<p>
-has the same effect as
-</p>
-<pre>
- a := uint64(1)
-</pre>
-<p>
-Parsing is also simplified by having a distinct grammar for types that
-is not just the expression grammar; keywords such as <code>func</code>
-and <code>chan</code> keep things clear.
-</p>
-
-<p>
-See the article about
-<a href="/doc/articles/gos_declaration_syntax.html">Go's Declaration Syntax</a>
-for more details.
-</p>
-
-<h3 id="no_pointer_arithmetic">
-Why is there no pointer arithmetic?</h3>
-<p>
-Safety. Without pointer arithmetic it's possible to create a
-language that can never derive an illegal address that succeeds
-incorrectly. Compiler and hardware technology have advanced to the
-point where a loop using array indices can be as efficient as a loop
-using pointer arithmetic. Also, the lack of pointer arithmetic can
-simplify the implementation of the garbage collector.
-</p>
-
-<h3 id="inc_dec">
-Why are <code>++</code> and <code>--</code> statements and not expressions? And why postfix, not prefix?</h3>
-<p>
-Without pointer arithmetic, the convenience value of pre- and postfix
-increment operators drops. By removing them from the expression
-hierarchy altogether, expression syntax is simplified and the messy
-issues around order of evaluation of <code>++</code> and <code>--</code>
-(consider <code>f(i++)</code> and <code>p[i] = q[++i]</code>)
-are eliminated as well. The simplification is
-significant. As for postfix vs. prefix, either would work fine but
-the postfix version is more traditional; insistence on prefix arose
-with the STL, a library for a language whose name contains, ironically, a
-postfix increment.
-</p>
-
-<h3 id="semicolons">
-Why are there braces but no semicolons? And why can't I put the opening
-brace on the next line?</h3>
-<p>
-Go uses brace brackets for statement grouping, a syntax familiar to
-programmers who have worked with any language in the C family.
-Semicolons, however, are for parsers, not for people, and we wanted to
-eliminate them as much as possible. To achieve this goal, Go borrows
-a trick from BCPL: the semicolons that separate statements are in the
-formal grammar but are injected automatically, without lookahead, by
-the lexer at the end of any line that could be the end of a statement.
-This works very well in practice but has the effect that it forces a
-brace style. For instance, the opening brace of a function cannot
-appear on a line by itself.
-</p>
-
-<p>
-Some have argued that the lexer should do lookahead to permit the
-brace to live on the next line. We disagree. Since Go code is meant
-to be formatted automatically by
-<a href="/cmd/gofmt/"><code>gofmt</code></a>,
-<i>some</i> style must be chosen. That style may differ from what
-you've used in C or Java, but Go is a different language and
-<code>gofmt</code>'s style is as good as any other. More
-important&mdash;much more important&mdash;the advantages of a single,
-programmatically mandated format for all Go programs greatly outweigh
-any perceived disadvantages of the particular style.
-Note too that Go's style means that an interactive implementation of
-Go can use the standard syntax one line at a time without special rules.
-</p>
-
-<h3 id="garbage_collection">
-Why do garbage collection? Won't it be too expensive?</h3>
-<p>
-One of the biggest sources of bookkeeping in systems programs is
-managing the lifetimes of allocated objects.
-In languages such as C in which it is done manually,
-it can consume a significant amount of programmer time and is
-often the cause of pernicious bugs.
-Even in languages like C++ or Rust that provide mechanisms
-to assist, those mechanisms can have a significant effect on the
-design of the software, often adding programming overhead
-of its own.
-We felt it was critical to eliminate such
-programmer overheads, and advances in garbage collection
-technology in the last few years gave us confidence that it
-could be implemented cheaply enough, and with low enough
-latency, that it could be a viable approach for networked
-systems.
-</p>
-
-<p>
-Much of the difficulty of concurrent programming
-has its roots in the object lifetime problem:
-as objects get passed among threads it becomes cumbersome
-to guarantee they become freed safely.
-Automatic garbage collection makes concurrent code far easier to write.
-Of course, implementing garbage collection in a concurrent environment is
-itself a challenge, but meeting it once rather than in every
-program helps everyone.
-</p>
-
-<p>
-Finally, concurrency aside, garbage collection makes interfaces
-simpler because they don't need to specify how memory is managed across them.
-</p>
-
-<p>
-This is not to say that the recent work in languages
-like Rust that bring new ideas to the problem of managing
-resources is misguided; we encourage this work and are excited to see
-how it evolves.
-But Go takes a more traditional approach by addressing
-object lifetimes through
-garbage collection, and garbage collection alone.
-</p>
-
-<p>
-The current implementation is a mark-and-sweep collector.
-If the machine is a multiprocessor, the collector runs on a separate CPU
-core in parallel with the main program.
-Major work on the collector in recent years has reduced pause times
-often to the sub-millisecond range, even for large heaps,
-all but eliminating one of the major objections to garbage collection
-in networked servers.
-Work continues to refine the algorithm, reduce overhead and
-latency further, and to explore new approaches.
-The 2018
-<a href="https://blog.golang.org/ismmkeynote">ISMM keynote</a>
-by Rick Hudson of the Go team
-describes the progress so far and suggests some future approaches.
-</p>
-
-<p>
-On the topic of performance, keep in mind that Go gives the programmer
-considerable control over memory layout and allocation, much more than
-is typical in garbage-collected languages. A careful programmer can reduce
-the garbage collection overhead dramatically by using the language well;
-see the article about
-<a href="//blog.golang.org/2011/06/profiling-go-programs.html">profiling
-Go programs</a> for a worked example, including a demonstration of Go's
-profiling tools.
-</p>
diff --git a/doc/go_spec.html b/doc/go_spec.html
index c9e14a3fec..2a1322fb0f 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Version of Feb 2, 2021",
+ "Subtitle": "Version of Feb 24, 2021",
"Path": "/ref/spec"
}-->
@@ -830,7 +830,7 @@ The underlying type of <code>[]B1</code>, <code>B3</code>, and <code>B4</code> i
<h3 id="Method_sets">Method sets</h3>
<p>
-A type may have a <i>method set</i> associated with it.
+A type has a (possibly empty) <i>method set</i> associated with it.
The method set of an <a href="#Interface_types">interface type</a> is its interface.
The method set of any other type <code>T</code> consists of all
<a href="#Method_declarations">methods</a> declared with receiver type <code>T</code>.
@@ -3446,7 +3446,7 @@ In a function call, the function value and arguments are evaluated in
After they are evaluated, the parameters of the call are passed by value to the function
and the called function begins execution.
The return parameters of the function are passed by value
-back to the calling function when the function returns.
+back to the caller when the function returns.
</p>
<p>
@@ -3532,9 +3532,9 @@ within <code>Greeting</code>, <code>who</code> will have the value
</p>
<p>
-If the final argument is assignable to a slice type <code>[]T</code>, it is
-passed unchanged as the value for a <code>...T</code> parameter if the argument
-is followed by <code>...</code>. In this case no new slice is created.
+If the final argument is assignable to a slice type <code>[]T</code> and
+is followed by <code>...</code>, it is passed unchanged as the value
+for a <code>...T</code> parameter. In this case no new slice is created.
</p>
<p>
diff --git a/doc/gopher/README b/doc/gopher/README
deleted file mode 100644
index d4ca8a1c2d..0000000000
--- a/doc/gopher/README
+++ /dev/null
@@ -1,3 +0,0 @@
-The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/)
-The design is licensed under the Creative Commons 3.0 Attributions license.
-Read this article for more details: https://blog.golang.org/gopher
diff --git a/doc/gopher/appenginegopher.jpg b/doc/gopher/appenginegopher.jpg
deleted file mode 100644
index 0a64306666..0000000000
--- a/doc/gopher/appenginegopher.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/appenginegophercolor.jpg b/doc/gopher/appenginegophercolor.jpg
deleted file mode 100644
index 68795a99b3..0000000000
--- a/doc/gopher/appenginegophercolor.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/appenginelogo.gif b/doc/gopher/appenginelogo.gif
deleted file mode 100644
index 46b3c1eeb8..0000000000
--- a/doc/gopher/appenginelogo.gif
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/biplane.jpg b/doc/gopher/biplane.jpg
deleted file mode 100644
index d5e666f963..0000000000
--- a/doc/gopher/biplane.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/bumper.png b/doc/gopher/bumper.png
deleted file mode 100644
index b357cdf47d..0000000000
--- a/doc/gopher/bumper.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/bumper192x108.png b/doc/gopher/bumper192x108.png
deleted file mode 100644
index 925474e763..0000000000
--- a/doc/gopher/bumper192x108.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/bumper320x180.png b/doc/gopher/bumper320x180.png
deleted file mode 100644
index 611c417c4f..0000000000
--- a/doc/gopher/bumper320x180.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/bumper480x270.png b/doc/gopher/bumper480x270.png
deleted file mode 100644
index cf187151fd..0000000000
--- a/doc/gopher/bumper480x270.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/bumper640x360.png b/doc/gopher/bumper640x360.png
deleted file mode 100644
index a5073e0d1a..0000000000
--- a/doc/gopher/bumper640x360.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/doc.png b/doc/gopher/doc.png
deleted file mode 100644
index e15a3234d5..0000000000
--- a/doc/gopher/doc.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/favicon.svg b/doc/gopher/favicon.svg
deleted file mode 100644
index e5a68fe29e..0000000000
--- a/doc/gopher/favicon.svg
+++ /dev/null
@@ -1,238 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- viewBox="0 0 32 32.000001"
- id="svg4416"
- version="1.1"
- inkscape:version="0.91 r13725"
- sodipodi:docname="favicon.svg"
- inkscape:export-filename="../../favicon.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
- <defs
- id="defs4418" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="15.839192"
- inkscape:cx="17.966652"
- inkscape:cy="9.2991824"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="true"
- units="px"
- inkscape:snap-bbox="true"
- inkscape:snap-bbox-edge-midpoints="false"
- inkscape:bbox-nodes="true"
- showguides="false"
- inkscape:window-width="1920"
- inkscape:window-height="1018"
- inkscape:window-x="1912"
- inkscape:window-y="-8"
- inkscape:window-maximized="1"
- inkscape:object-nodes="true"
- inkscape:snap-smooth-nodes="true"
- inkscape:snap-global="false">
- <inkscape:grid
- type="xygrid"
- id="grid5148" />
- </sodipodi:namedview>
- <metadata
- id="metadata4421">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="icon"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(0,-1020.3622)">
- <ellipse
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#384e54;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- id="ellipse4216"
- cx="-907.35657"
- cy="479.90009"
- rx="3.5793996"
- ry="3.8207953"
- transform="matrix(-0.49169095,-0.87076978,-0.87076978,0.49169095,0,0)"
- inkscape:transform-center-x="0.67794294"
- inkscape:transform-center-y="-2.3634048" />
- <ellipse
- inkscape:transform-center-y="-2.3633882"
- inkscape:transform-center-x="-0.67793718"
- transform="matrix(0.49169095,-0.87076978,0.87076978,0.49169095,0,0)"
- ry="3.8207953"
- rx="3.5793996"
- cy="507.8461"
- cx="-891.57654"
- id="ellipse4463"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#384e54;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
- <path
- inkscape:connector-curvature="0"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#384e54;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- d="m 16.091693,1021.3642 c -1.105749,0.01 -2.210341,0.049 -3.31609,0.09 C 6.8422558,1021.6738 2,1026.3942 2,1032.3622 c 0,2.9786 0,13 0,20 l 28,0 c 0,-8 0,-16 0,-20 0,-5.9683 -4.667345,-10.4912 -10.59023,-10.908 -1.10575,-0.078 -2.212328,-0.099 -3.318077,-0.09 z"
- id="path4465"
- sodipodi:nodetypes="ccsccscc" />
- <path
- inkscape:transform-center-y="-1.3604657"
- inkscape:transform-center-x="-0.98424303"
- sodipodi:nodetypes="sssssss"
- inkscape:connector-curvature="0"
- id="path4469"
- d="m 4.6078867,1025.0462 c 0.459564,0.2595 1.818262,1.2013 1.980983,1.648 0.183401,0.5035 0.159385,1.0657 -0.114614,1.551 -0.346627,0.6138 -1.005341,0.9487 -1.696421,0.9365 -0.339886,-0.01 -1.720283,-0.6372 -2.042561,-0.8192 -0.97754,-0.5519 -1.350795,-1.7418 -0.833686,-2.6576 0.517109,-0.9158 1.728749,-1.2107 2.706299,-0.6587 z"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#76e1fe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
- <rect
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0.32850246;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- id="rect4473"
- width="3.0866659"
- height="3.5313663"
- x="14.406213"
- y="1035.6842"
- ry="0.62426329" />
- <path
- inkscape:connector-curvature="0"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#76e1fe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- d="m 16,1023.3622 c -9,0 -12,3.7153 -12,9 l 0,20 24,0 c -0.04889,-7.3562 0,-18 0,-20 0,-5.2848 -3,-9 -12,-9 z"
- id="path4471"
- sodipodi:nodetypes="zsccsz" />
- <path
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#76e1fe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- d="m 27.074073,1025.0462 c -0.45957,0.2595 -1.818257,1.2013 -1.980979,1.648 -0.183401,0.5035 -0.159384,1.0657 0.114614,1.551 0.346627,0.6138 1.005335,0.9487 1.696415,0.9365 0.33988,-0.01 1.72029,-0.6372 2.04256,-0.8192 0.97754,-0.5519 1.35079,-1.7418 0.83369,-2.6576 -0.51711,-0.9158 -1.72876,-1.2107 -2.7063,-0.6587 z"
- id="path4481"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="sssssss"
- inkscape:transform-center-x="0.98424094"
- inkscape:transform-center-y="-1.3604657" />
- <circle
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- id="circle4477"
- cx="21.175734"
- cy="1030.3542"
- r="4.6537542"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <circle
- r="4.8316345"
- cy="1030.3542"
- cx="10.339486"
- id="circle4483"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <rect
- inkscape:export-ydpi="90"
- inkscape:export-xdpi="90"
- inkscape:export-filename=".\rect4485.png"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0.32941176;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- id="rect4246"
- width="3.6673687"
- height="4.1063409"
- x="14.115863"
- y="1035.9174"
- ry="0.72590536" />
- <rect
- ry="0.72590536"
- y="1035.2253"
- x="14.115863"
- height="4.1063409"
- width="3.6673687"
- id="rect4485"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#fffcfb;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <path
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0.32941176;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- d="m 19.999735,1036.5289 c 0,0.838 -0.871228,1.2682 -2.144766,1.1659 -0.02366,0 -0.04795,-0.6004 -0.254147,-0.5832 -0.503669,0.042 -1.095902,-0.02 -1.685964,-0.02 -0.612939,0 -1.206342,0.1826 -1.68549,0.017 -0.110233,-0.038 -0.178298,0.5838 -0.261532,0.5816 -1.243685,-0.033 -2.078803,-0.3383 -2.078803,-1.1618 0,-1.2118 1.815635,-2.1941 4.055351,-2.1941 2.239704,0 4.055351,0.9823 4.055351,2.1941 z"
- id="path4487"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="sssssssss"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <path
- sodipodi:nodetypes="sssssssss"
- inkscape:connector-curvature="0"
- id="path4489"
- d="m 19.977414,1035.7004 c 0,0.5685 -0.433659,0.8554 -1.138091,1.0001 -0.291933,0.06 -0.630371,0.096 -1.003719,0.1166 -0.56405,0.032 -1.207782,0.031 -1.89122,0.031 -0.672834,0 -1.307182,0 -1.864904,-0.029 -0.306268,-0.017 -0.589429,-0.043 -0.843164,-0.084 -0.813833,-0.1318 -1.324962,-0.417 -1.324962,-1.0344 0,-1.1601 1.805642,-2.1006 4.03303,-2.1006 2.227377,0 4.03303,0.9405 4.03303,2.1006 z"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#c38c74;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <ellipse
- cy="1033.8501"
- cx="15.944382"
- id="ellipse4491"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#23201f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- rx="2.0801733"
- ry="1.343747"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <circle
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#171311;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- id="circle4493"
- cx="12.414201"
- cy="1030.3542"
- r="1.9630634"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <circle
- r="1.9630634"
- cy="1030.3542"
- cx="23.110121"
- id="circle4495"
- style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#171311;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:10;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
- inkscape:export-filename=".\rect4485.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4497"
- d="m 5.0055377,1027.2727 c -1.170435,-1.0835 -2.026973,-0.7721 -2.044172,-0.7463"
- style="display:inline;fill:none;fill-rule:evenodd;stroke:#384e54;stroke-width:0.39730874;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- <path
- style="display:inline;fill:none;fill-rule:evenodd;stroke:#384e54;stroke-width:0.39730874;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 4.3852457,1026.9152 c -1.158557,0.036 -1.346704,0.6303 -1.33881,0.6523"
- id="path4499"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cc" />
- <path
- style="display:inline;fill:none;fill-rule:evenodd;stroke:#384e54;stroke-width:0.39730874;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 26.630533,1027.1724 c 1.17043,-1.0835 2.02697,-0.7721 2.04417,-0.7463"
- id="path4501"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cc" />
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4503"
- d="m 27.321773,1026.673 c 1.15856,0.036 1.3467,0.6302 1.3388,0.6522"
- style="display:inline;fill:none;fill-rule:evenodd;stroke:#384e54;stroke-width:0.39730874;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
- </g>
-</svg>
diff --git a/doc/gopher/fiveyears.jpg b/doc/gopher/fiveyears.jpg
deleted file mode 100644
index df1064868e..0000000000
--- a/doc/gopher/fiveyears.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/frontpage.png b/doc/gopher/frontpage.png
deleted file mode 100644
index 1eb81f0bef..0000000000
--- a/doc/gopher/frontpage.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/gopherbw.png b/doc/gopher/gopherbw.png
deleted file mode 100644
index 3bfe85dc16..0000000000
--- a/doc/gopher/gopherbw.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/gophercolor.png b/doc/gopher/gophercolor.png
deleted file mode 100644
index b5f8d01ff6..0000000000
--- a/doc/gopher/gophercolor.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/gophercolor16x16.png b/doc/gopher/gophercolor16x16.png
deleted file mode 100644
index ec7028cc11..0000000000
--- a/doc/gopher/gophercolor16x16.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/help.png b/doc/gopher/help.png
deleted file mode 100644
index 6ee523898d..0000000000
--- a/doc/gopher/help.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/modelsheet.jpg b/doc/gopher/modelsheet.jpg
deleted file mode 100644
index c31e35a6df..0000000000
--- a/doc/gopher/modelsheet.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pencil/gopherhat.jpg b/doc/gopher/pencil/gopherhat.jpg
deleted file mode 100644
index f34d7b3258..0000000000
--- a/doc/gopher/pencil/gopherhat.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pencil/gopherhelmet.jpg b/doc/gopher/pencil/gopherhelmet.jpg
deleted file mode 100644
index c7b6c61b2b..0000000000
--- a/doc/gopher/pencil/gopherhelmet.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pencil/gophermega.jpg b/doc/gopher/pencil/gophermega.jpg
deleted file mode 100644
index 779fb073ac..0000000000
--- a/doc/gopher/pencil/gophermega.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pencil/gopherrunning.jpg b/doc/gopher/pencil/gopherrunning.jpg
deleted file mode 100644
index eeeddf106f..0000000000
--- a/doc/gopher/pencil/gopherrunning.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pencil/gopherswim.jpg b/doc/gopher/pencil/gopherswim.jpg
deleted file mode 100644
index 2f32877121..0000000000
--- a/doc/gopher/pencil/gopherswim.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pencil/gopherswrench.jpg b/doc/gopher/pencil/gopherswrench.jpg
deleted file mode 100644
index 93005f42a8..0000000000
--- a/doc/gopher/pencil/gopherswrench.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/pkg.png b/doc/gopher/pkg.png
deleted file mode 100644
index ac96551b55..0000000000
--- a/doc/gopher/pkg.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/project.png b/doc/gopher/project.png
deleted file mode 100644
index 24603f3068..0000000000
--- a/doc/gopher/project.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/ref.png b/doc/gopher/ref.png
deleted file mode 100644
index 0508f6ec61..0000000000
--- a/doc/gopher/ref.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/run.png b/doc/gopher/run.png
deleted file mode 100644
index eb690e3f22..0000000000
--- a/doc/gopher/run.png
+++ /dev/null
Binary files differ
diff --git a/doc/gopher/talks.png b/doc/gopher/talks.png
deleted file mode 100644
index 589db470a7..0000000000
--- a/doc/gopher/talks.png
+++ /dev/null
Binary files differ
diff --git a/doc/help.html b/doc/help.html
deleted file mode 100644
index 3d32ae5dc0..0000000000
--- a/doc/help.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!--{
- "Title": "Help",
- "Path": "/help/",
- "Template": true
-}-->
-
-<div id="manual-nav"></div>
-
-<h2 id="help">Get help</h2>
-
-<img class="gopher" src="/doc/gopher/help.png" alt=""/>
-
-{{if not $.GoogleCN}}
-<h3 id="mailinglist"><a href="https://groups.google.com/group/golang-nuts">Go Nuts Mailing List</a></h3>
-<p>
-Get help from Go users, and share your work on the official mailing list.
-</p>
-<p>
-Search the <a href="https://groups.google.com/group/golang-nuts">golang-nuts</a>
-archives and consult the <a href="/doc/go_faq.html">FAQ</a> and
-<a href="//golang.org/wiki">wiki</a> before posting.
-</p>
-
-<h3 id="forum"><a href="https://forum.golangbridge.org/">Go Forum</a></h3>
-<p>
-The <a href="https://forum.golangbridge.org/">Go Forum</a> is a discussion
-forum for Go programmers.
-</p>
-
-<h3 id="discord"><a href="https://discord.gg/64C346U">Gophers Discord</a></h3>
-<p>
-Get live support and talk with other gophers on the Go Discord.
-</p>
-
-<h3 id="slack"><a href="https://blog.gopheracademy.com/gophers-slack-community/">Gopher Slack</a></h3>
-<p>Get live support from other users in the Go slack channel.</p>
-
-<h3 id="irc"><a href="irc:irc.freenode.net/go-nuts">Go IRC Channel</a></h3>
-<p>Get live support at <b>#go-nuts</b> on <b>irc.freenode.net</b>, the official
-Go IRC channel.</p>
-{{end}}
-
-<h3 id="faq"><a href="/doc/faq">Frequently Asked Questions (FAQ)</a></h3>
-<p>Answers to common questions about Go.</p>
-
-{{if not $.GoogleCN}}
-<h2 id="inform">Stay informed</h2>
-
-<h3 id="announce"><a href="https://groups.google.com/group/golang-announce">Go Announcements Mailing List</a></h3>
-<p>
-Subscribe to
-<a href="https://groups.google.com/group/golang-announce">golang-announce</a>
-for important announcements, such as the availability of new Go releases.
-</p>
-
-<h3 id="blog"><a href="//blog.golang.org">Go Blog</a></h3>
-<p>The Go project's official blog.</p>
-
-<h3 id="twitter"><a href="https://twitter.com/golang">@golang at Twitter</a></h3>
-<p>The Go project's official Twitter account.</p>
-
-<h3 id="reddit"><a href="https://reddit.com/r/golang">golang sub-Reddit</a></h3>
-<p>
-The <a href="https://reddit.com/r/golang">golang sub-Reddit</a> is a place
-for Go news and discussion.
-</p>
-
-<h3 id="gotime"><a href="https://changelog.com/gotime">Go Time Podcast</a></h3>
-<p>
-The <a href="https://changelog.com/gotime">Go Time podcast</a> is a panel of Go experts and special guests
-discussing the Go programming language, the community, and everything in between.
-</p>
-{{end}}
-
-<h2 id="community">Community resources</h2>
-
-<h3 id="go_user_groups"><a href="/wiki/GoUserGroups">Go User Groups</a></h3>
-<p>
-Each month in places around the world, groups of Go programmers ("gophers")
-meet to talk about Go. Find a chapter near you.
-</p>
-
-{{if not $.GoogleCN}}
-<h3 id="playground"><a href="/play">Go Playground</a></h3>
-<p>A place to write, run, and share Go code.</p>
-
-<h3 id="wiki"><a href="/wiki">Go Wiki</a></h3>
-<p>A wiki maintained by the Go community.</p>
-{{end}}
-
-<h3 id="conduct"><a href="/conduct">Code of Conduct</a></h3>
-<p>
-Guidelines for participating in Go community spaces
-and a reporting process for handling issues.
-</p>
-
diff --git a/doc/ie.css b/doc/ie.css
deleted file mode 100644
index bb89d54be2..0000000000
--- a/doc/ie.css
+++ /dev/null
@@ -1 +0,0 @@
-#nav-main li { display: inline; }
diff --git a/doc/install-source.html b/doc/install-source.html
deleted file mode 100644
index f0a909263c..0000000000
--- a/doc/install-source.html
+++ /dev/null
@@ -1,777 +0,0 @@
-<!--{
- "Title": "Installing Go from source",
- "Path": "/doc/install/source"
-}-->
-
-<h2 id="introduction">Introduction</h2>
-
-<p>
-Go is an open source project, distributed under a
-<a href="/LICENSE">BSD-style license</a>.
-This document explains how to check out the sources,
-build them on your own machine, and run them.
-</p>
-
-<p>
-Most users don't need to do this, and will instead install
-from precompiled binary packages as described in
-<a href="/doc/install">Getting Started</a>,
-a much simpler process.
-If you want to help develop what goes into those precompiled
-packages, though, read on.
-</p>
-
-<div class="detail">
-
-<p>
-There are two official Go compiler toolchains.
-This document focuses on the <code>gc</code> Go
-compiler and tools.
-For information on how to work on <code>gccgo</code>, a more traditional
-compiler using the GCC back end, see
-<a href="/doc/install/gccgo">Setting up and using gccgo</a>.
-</p>
-
-<p>
-The Go compilers support the following instruction sets:
-
-<dl>
-<dt>
- <code>amd64</code>, <code>386</code>
-</dt>
-<dd>
- The <code>x86</code> instruction set, 64- and 32-bit.
-</dd>
-<dt>
- <code>arm64</code>, <code>arm</code>
-</dt>
-<dd>
- The <code>ARM</code> instruction set, 64-bit (<code>AArch64</code>) and 32-bit.
-</dd>
-<dt>
- <code>mips64</code>, <code>mips64le</code>, <code>mips</code>, <code>mipsle</code>
-</dt>
-<dd>
- The <code>MIPS</code> instruction set, big- and little-endian, 64- and 32-bit.
-</dd>
-<dt>
- <code>ppc64</code>, <code>ppc64le</code>
-</dt>
-<dd>
- The 64-bit PowerPC instruction set, big- and little-endian.
-</dd>
-<dt>
- <code>riscv64</code>
-</dt>
-<dd>
- The 64-bit RISC-V instruction set.
-</dd>
-<dt>
- <code>s390x</code>
-</dt>
-<dd>
- The IBM z/Architecture.
-</dd>
-<dt>
- <code>wasm</code>
-</dt>
-<dd>
- <a href="https://webassembly.org">WebAssembly</a>.
-</dd>
-</dl>
-</p>
-
-<p>
-The compilers can target the AIX, Android, DragonFly BSD, FreeBSD,
-Illumos, Linux, macOS/iOS (Darwin), NetBSD, OpenBSD, Plan 9, Solaris,
-and Windows operating systems (although not all operating systems
-support all architectures).
-</p>
-
-<p>
-A list of ports which are considered "first class" is available at the
-<a href="/wiki/PortingPolicy#first-class-ports">first class ports</a>
-wiki page.
-</p>
-
-<p>
-The full set of supported combinations is listed in the
-discussion of <a href="#environment">environment variables</a> below.
-</p>
-
-<p>
-See the main installation page for the <a href="/doc/install#requirements">overall system requirements</a>.
-The following additional constraints apply to systems that can be built only from source:
-</p>
-
-<ul>
-<li>For Linux on PowerPC 64-bit, the minimum supported kernel version is 2.6.37, meaning that
-Go does not support CentOS 6 on these systems.
-</li>
-</ul>
-
-</div>
-
-<h2 id="go14">Install Go compiler binaries for bootstrap</h2>
-
-<p>
-The Go toolchain is written in Go. To build it, you need a Go compiler installed.
-The scripts that do the initial build of the tools look for a "go" command
-in <code>$PATH</code>, so as long as you have Go installed in your
-system and configured in your <code>$PATH</code>, you are ready to build Go
-from source.
-Or if you prefer you can set <code>$GOROOT_BOOTSTRAP</code> to the
-root of a Go installation to use to build the new Go toolchain;
-<code>$GOROOT_BOOTSTRAP/bin/go</code> should be the go command to use.</p>
-
-<p>
-There are four possible ways to obtain a bootstrap toolchain:
-</p>
-
-<ul>
-<li>Download a recent binary release of Go.
-<li>Cross-compile a toolchain using a system with a working Go installation.
-<li>Use gccgo.
-<li>Compile a toolchain from Go 1.4, the last Go release with a compiler written in C.
-</ul>
-
-<p>
-These approaches are detailed below.
-</p>
-
-<h3 id="bootstrapFromBinaryRelease">Bootstrap toolchain from binary release</h3>
-
-<p>
-To use a binary release as a bootstrap toolchain, see
-<a href="/dl/">the downloads page</a> or use any other
-packaged Go distribution.
-</p>
-
-<h3 id="bootstrapFromCrosscompiledSource">Bootstrap toolchain from cross-compiled source</h3>
-
-<p>
-To cross-compile a bootstrap toolchain from source, which is
-necessary on systems Go 1.4 did not target (for
-example, <code>linux/ppc64le</code>), install Go on a different system
-and run <a href="/src/bootstrap.bash">bootstrap.bash</a>.
-</p>
-
-<p>
-When run as (for example)
-</p>
-
-<pre>
-$ GOOS=linux GOARCH=ppc64 ./bootstrap.bash
-</pre>
-
-<p>
-<code>bootstrap.bash</code> cross-compiles a toolchain for that <code>GOOS/GOARCH</code>
-combination, leaving the resulting tree in <code>../../go-${GOOS}-${GOARCH}-bootstrap</code>.
-That tree can be copied to a machine of the given target type
-and used as <code>GOROOT_BOOTSTRAP</code> to bootstrap a local build.
-</p>
-
-<h3 id="bootstrapFromGccgo">Bootstrap toolchain using gccgo</h3>
-
-<p>
-To use gccgo as the bootstrap toolchain, you need to arrange
-for <code>$GOROOT_BOOTSTRAP/bin/go</code> to be the go tool that comes
-as part of gccgo 5. For example on Ubuntu Vivid:
-</p>
-
-<pre>
-$ sudo apt-get install gccgo-5
-$ sudo update-alternatives --set go /usr/bin/go-5
-$ GOROOT_BOOTSTRAP=/usr ./make.bash
-</pre>
-
-<h3 id="bootstrapFromSource">Bootstrap toolchain from C source code</h3>
-
-<p>
-To build a bootstrap toolchain from C source code, use
-either the git branch <code>release-branch.go1.4</code> or
-<a href="https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz">go1.4-bootstrap-20171003.tar.gz</a>,
-which contains the Go 1.4 source code plus accumulated fixes
-to keep the tools running on newer operating systems.
-(Go 1.4 was the last distribution in which the toolchain was written in C.)
-After unpacking the Go 1.4 source, <code>cd</code> to
-the <code>src</code> subdirectory, set <code>CGO_ENABLED=0</code> in
-the environment, and run <code>make.bash</code> (or,
-on Windows, <code>make.bat</code>).
-</p>
-
-<p>
-Once the Go 1.4 source has been unpacked into your GOROOT_BOOTSTRAP directory,
-you must keep this git clone instance checked out to branch
-<code>release-branch.go1.4</code>. Specifically, do not attempt to reuse
-this git clone in the later step named "Fetch the repository." The go1.4
-bootstrap toolchain <b>must be able</b> to properly traverse the go1.4 sources
-that it assumes are present under this repository root.
-</p>
-
-<p>
-Note that Go 1.4 does not run on all systems that later versions of Go do.
-In particular, Go 1.4 does not support current versions of macOS.
-On such systems, the bootstrap toolchain must be obtained using one of the other methods.
-</p>
-
-<h2 id="git">Install Git, if needed</h2>
-
-<p>
-To perform the next step you must have Git installed. (Check that you
-have a <code>git</code> command before proceeding.)
-</p>
-
-<p>
-If you do not have a working Git installation,
-follow the instructions on the
-<a href="https://git-scm.com/downloads">Git downloads</a> page.
-</p>
-
-<h2 id="ccompiler">(Optional) Install a C compiler</h2>
-
-<p>
-To build a Go installation
-with <code><a href="/cmd/cgo">cgo</a></code> support, which permits Go
-programs to import C libraries, a C compiler such as <code>gcc</code>
-or <code>clang</code> must be installed first. Do this using whatever
-installation method is standard on the system.
-</p>
-
-<p>
-To build without <code>cgo</code>, set the environment variable
-<code>CGO_ENABLED=0</code> before running <code>all.bash</code> or
-<code>make.bash</code>.
-</p>
-
-<h2 id="fetch">Fetch the repository</h2>
-
-<p>Change to the directory where you intend to install Go, and make sure
-the <code>goroot</code> directory does not exist. Then clone the repository
-and check out the latest release tag (<code class="versionTag">go1.12</code>,
-for example):</p>
-
-<pre>
-$ git clone https://go.googlesource.com/go goroot
-$ cd goroot
-$ git checkout <span class="versionTag"><i>&lt;tag&gt;</i></span>
-</pre>
-
-<p class="whereTag">
-Where <code>&lt;tag&gt;</code> is the version string of the release.
-</p>
-
-<p>Go will be installed in the directory where it is checked out. For example,
-if Go is checked out in <code>$HOME/goroot</code>, executables will be installed
-in <code>$HOME/goroot/bin</code>. The directory may have any name, but note
-that if Go is checked out in <code>$HOME/go</code>, it will conflict with
-the default location of <code>$GOPATH</code>.
-See <a href="#gopath"><code>GOPATH</code></a> below.</p>
-
-<p>
-Reminder: If you opted to also compile the bootstrap binaries from source (in an
-earlier section), you still need to <code>git clone</code> again at this point
-(to checkout the latest <code>&lt;tag&gt;</code>), because you must keep your
-go1.4 repository distinct.
-</p>
-
-<h2 id="head">(Optional) Switch to the master branch</h2>
-
-<p>If you intend to modify the go source code, and
-<a href="/doc/contribute.html">contribute your changes</a>
-to the project, then move your repository
-off the release branch, and onto the master (development) branch.
-Otherwise, skip this step.</p>
-
-<pre>
-$ git checkout master
-</pre>
-
-<h2 id="install">Install Go</h2>
-
-<p>
-To build the Go distribution, run
-</p>
-
-<pre>
-$ cd src
-$ ./all.bash
-</pre>
-
-<p>
-(To build under Windows use <code>all.bat</code>.)
-</p>
-
-<p>
-If all goes well, it will finish by printing output like:
-</p>
-
-<pre>
-ALL TESTS PASSED
-
----
-Installed Go for linux/amd64 in /home/you/go.
-Installed commands in /home/you/go/bin.
-*** You need to add /home/you/go/bin to your $PATH. ***
-</pre>
-
-<p>
-where the details on the last few lines reflect the operating system,
-architecture, and root directory used during the install.
-</p>
-
-<div class="detail">
-<p>
-For more information about ways to control the build, see the discussion of
-<a href="#environment">environment variables</a> below.
-<code>all.bash</code> (or <code>all.bat</code>) runs important tests for Go,
-which can take more time than simply building Go. If you do not want to run
-the test suite use <code>make.bash</code> (or <code>make.bat</code>)
-instead.
-</p>
-</div>
-
-
-<h2 id="testing">Testing your installation</h2>
-
-<p>
-Check that Go is installed correctly by building a simple program.
-</p>
-
-<p>
-Create a file named <code>hello.go</code> and put the following program in it:
-</p>
-
-<pre>
-package main
-
-import "fmt"
-
-func main() {
- fmt.Printf("hello, world\n")
-}
-</pre>
-
-<p>
-Then run it with the <code>go</code> tool:
-</p>
-
-<pre>
-$ go run hello.go
-hello, world
-</pre>
-
-<p>
-If you see the "hello, world" message then Go is installed correctly.
-</p>
-
-<h2 id="gopath">Set up your work environment</h2>
-
-<p>
-You're almost done.
-You just need to do a little more setup.
-</p>
-
-<p>
-<a href="/doc/code.html" class="download" id="start">
-<span class="big">How to Write Go Code</span>
-<span class="desc">Learn how to set up and use the Go tools</span>
-</a>
-</p>
-
-<p>
-The <a href="/doc/code.html">How to Write Go Code</a> document
-provides <b>essential setup instructions</b> for using the Go tools.
-</p>
-
-
-<h2 id="tools">Install additional tools</h2>
-
-<p>
-The source code for several Go tools (including <a href="/cmd/godoc/">godoc</a>)
-is kept in <a href="https://golang.org/x/tools">the go.tools repository</a>.
-To install one of the tools (<code>godoc</code> in this case):
-</p>
-
-<pre>
-$ go get golang.org/x/tools/cmd/godoc
-</pre>
-
-<p>
-To install these tools, the <code>go</code> <code>get</code> command requires
-that <a href="#git">Git</a> be installed locally.
-</p>
-
-<p>
-You must also have a workspace (<code>GOPATH</code>) set up;
-see <a href="/doc/code.html">How to Write Go Code</a> for the details.
-</p>
-
-<h2 id="community">Community resources</h2>
-
-<p>
-The usual community resources such as
-<code>#go-nuts</code> on the <a href="https://freenode.net/">Freenode</a> IRC server
-and the
-<a href="//groups.google.com/group/golang-nuts">Go Nuts</a>
-mailing list have active developers that can help you with problems
-with your installation or your development work.
-For those who wish to keep up to date,
-there is another mailing list, <a href="//groups.google.com/group/golang-checkins">golang-checkins</a>,
-that receives a message summarizing each checkin to the Go repository.
-</p>
-
-<p>
-Bugs can be reported using the <a href="//golang.org/issue/new">Go issue tracker</a>.
-</p>
-
-
-<h2 id="releases">Keeping up with releases</h2>
-
-<p>
-New releases are announced on the
-<a href="//groups.google.com/group/golang-announce">golang-announce</a>
-mailing list.
-Each announcement mentions the latest release tag, for instance,
-<code class="versionTag">go1.9</code>.
-</p>
-
-<p>
-To update an existing tree to the latest release, you can run:
-</p>
-
-<pre>
-$ cd go/src
-$ git fetch
-$ git checkout <span class="versionTag"><i>&lt;tag&gt;</i></psan>
-$ ./all.bash
-</pre>
-
-<p class="whereTag">
-Where <code>&lt;tag&gt;</code> is the version string of the release.
-</p>
-
-
-<h2 id="environment">Optional environment variables</h2>
-
-<p>
-The Go compilation environment can be customized by environment variables.
-<i>None is required by the build</i>, but you may wish to set some
-to override the defaults.
-</p>
-
-<ul>
-<li><code>$GOROOT</code>
-<p>
-The root of the Go tree, often <code>$HOME/go1.X</code>.
-Its value is built into the tree when it is compiled, and
-defaults to the parent of the directory where <code>all.bash</code> was run.
-There is no need to set this unless you want to switch between multiple
-local copies of the repository.
-</p>
-</li>
-
-<li><code>$GOROOT_FINAL</code>
-<p>
-The value assumed by installed binaries and scripts when
-<code>$GOROOT</code> is not set explicitly.
-It defaults to the value of <code>$GOROOT</code>.
-If you want to build the Go tree in one location
-but move it elsewhere after the build, set
-<code>$GOROOT_FINAL</code> to the eventual location.
-</p>
-</li>
-
-<li id="gopath"><code>$GOPATH</code>
-<p>
-The directory where Go projects outside the Go distribution are typically
-checked out. For example, <code>golang.org/x/tools</code> might be checked out
-to <code>$GOPATH/src/golang.org/x/tools</code>. Executables outside the
-Go distribution are installed in <code>$GOPATH/bin</code> (or
-<code>$GOBIN</code>, if set). Modules are downloaded and cached in
-<code>$GOPATH/pkg/mod</code>.
-</p>
-
-<p>The default location of <code>$GOPATH</code> is <code>$HOME/go</code>,
-and it's not usually necessary to set <code>GOPATH</code> explicitly. However,
-if you have checked out the Go distribution to <code>$HOME/go</code>,
-you must set <code>GOPATH</code> to another location to avoid conflicts.
-</p>
-</li>
-
-<li><code>$GOBIN</code>
-<p>
-The directory where executables outside the Go distribution are installed
-using the <a href="/cmd/go">go command</a>. For example,
-<code>go get golang.org/x/tools/cmd/godoc</code> downloads, builds, and
-installs <code>$GOBIN/godoc</code>. By default, <code>$GOBIN</code> is
-<code>$GOPATH/bin</code> (or <code>$HOME/go/bin</code> if <code>GOPATH</code>
-is not set). After installing, you will want to add this directory to
-your <code>$PATH</code> so you can use installed tools.
-</p>
-
-<p>
-Note that the Go distribution's executables are installed in
-<code>$GOROOT/bin</code> (for executables invoked by people) or
-<code>$GOTOOLDIR</code> (for executables invoked by the go command;
-defaults to <code>$GOROOT/pkg/$GOOS_GOARCH</code>) instead of
-<code>$GOBIN</code>.
-</p>
-</li>
-
-<li><code>$GOOS</code> and <code>$GOARCH</code>
-<p>
-The name of the target operating system and compilation architecture.
-These default to the values of <code>$GOHOSTOS</code> and
-<code>$GOHOSTARCH</code> respectively (described below).
-</li>
-
-<p>
-Choices for <code>$GOOS</code> are
-<code>android</code>, <code>darwin</code>, <code>dragonfly</code>,
-<code>freebsd</code>, <code>illumos</code>, <code>ios</code>, <code>js</code>,
-<code>linux</code>, <code>netbsd</code>, <code>openbsd</code>,
-<code>plan9</code>, <code>solaris</code> and <code>windows</code>.
-</p>
-
-<p>
-Choices for <code>$GOARCH</code> are
-<code>amd64</code> (64-bit x86, the most mature port),
-<code>386</code> (32-bit x86), <code>arm</code> (32-bit ARM), <code>arm64</code> (64-bit ARM),
-<code>ppc64le</code> (PowerPC 64-bit, little-endian), <code>ppc64</code> (PowerPC 64-bit, big-endian),
-<code>mips64le</code> (MIPS 64-bit, little-endian), <code>mips64</code> (MIPS 64-bit, big-endian),
-<code>mipsle</code> (MIPS 32-bit, little-endian), <code>mips</code> (MIPS 32-bit, big-endian),
-<code>s390x</code> (IBM System z 64-bit, big-endian), and
-<code>wasm</code> (WebAssembly 32-bit).
-</p>
-
-<p>
-The valid combinations of <code>$GOOS</code> and <code>$GOARCH</code> are:
-<table cellpadding="0">
-<tr>
-<th width="50"></th><th align="left" width="100"><code>$GOOS</code></th> <th align="left" width="100"><code>$GOARCH</code></th>
-</tr>
-<tr>
-<td></td><td><code>aix</code></td> <td><code>ppc64</code></td>
-</tr>
-<tr>
-<td></td><td><code>android</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>android</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>android</code></td> <td><code>arm</code></td>
-</tr>
-<tr>
-<td></td><td><code>android</code></td> <td><code>arm64</code></td>
-</tr>
-<tr>
-<td></td><td><code>darwin</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>darwin</code></td> <td><code>arm64</code></td>
-</tr>
-<tr>
-<td></td><td><code>dragonfly</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>freebsd</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>freebsd</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>freebsd</code></td> <td><code>arm</code></td>
-</tr>
-<tr>
-<td></td><td><code>illumos</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>ios</code></td> <td><code>arm64</code></td>
-</tr>
-<tr>
-<td></td><td><code>js</code></td> <td><code>wasm</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>arm</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>arm64</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>ppc64</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>ppc64le</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>mips</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>mipsle</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>mips64</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>mips64le</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>riscv64</code></td>
-</tr>
-<tr>
-<td></td><td><code>linux</code></td> <td><code>s390x</code></td>
-</tr>
-<tr>
-<td></td><td><code>netbsd</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>netbsd</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>netbsd</code></td> <td><code>arm</code></td>
-</tr>
-<tr>
-<td></td><td><code>openbsd</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>openbsd</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>openbsd</code></td> <td><code>arm</code></td>
-</tr>
-<tr>
-<td></td><td><code>openbsd</code></td> <td><code>arm64</code></td>
-</tr>
-<tr>
-<td></td><td><code>plan9</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>plan9</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>plan9</code></td> <td><code>arm</code></td>
-</tr>
-<tr>
-<td></td><td><code>solaris</code></td> <td><code>amd64</code></td>
-</tr>
-<tr>
-<td></td><td><code>windows</code></td> <td><code>386</code></td>
-</tr>
-<tr>
-<td></td><td><code>windows</code></td> <td><code>amd64</code></td>
-</tr>
-</table>
-<br>
-
-<li><code>$GOHOSTOS</code> and <code>$GOHOSTARCH</code>
-<p>
-The name of the host operating system and compilation architecture.
-These default to the local system's operating system and
-architecture.
-</p>
-</li>
-
-<p>
-Valid choices are the same as for <code>$GOOS</code> and
-<code>$GOARCH</code>, listed above.
-The specified values must be compatible with the local system.
-For example, you should not set <code>$GOHOSTARCH</code> to
-<code>arm</code> on an x86 system.
-</p>
-
-<li><code>$GO386</code> (for <code>386</code> only, defaults to <code>sse2</code>)
-<p>
-This variable controls how gc implements floating point computations.
-</p>
-<ul>
- <li><code>GO386=softfloat</code>: use software floating point operations; should support all x86 chips (Pentium MMX or later).</li>
- <li><code>GO386=sse2</code>: use SSE2 for floating point operations; has better performance but only available on Pentium 4/Opteron/Athlon 64 or later.</li>
-</ul>
-</li>
-
-<li><code>$GOARM</code> (for <code>arm</code> only; default is auto-detected if building
-on the target processor, 6 if not)
-<p>
-This sets the ARM floating point co-processor architecture version the run-time
-should target. If you are compiling on the target system, its value will be auto-detected.
-</p>
-<ul>
- <li><code>GOARM=5</code>: use software floating point; when CPU doesn't have VFP co-processor</li>
- <li><code>GOARM=6</code>: use VFPv1 only; default if cross compiling; usually ARM11 or better cores (VFPv2 or better is also supported)</li>
- <li><code>GOARM=7</code>: use VFPv3; usually Cortex-A cores</li>
-</ul>
-<p>
-If in doubt, leave this variable unset, and adjust it if required
-when you first run the Go executable.
-The <a href="//golang.org/wiki/GoArm">GoARM</a> page
-on the <a href="//golang.org/wiki">Go community wiki</a>
-contains further details regarding Go's ARM support.
-</p>
-</li>
-
-<li><code>$GOMIPS</code> (for <code>mips</code> and <code>mipsle</code> only) <br> <code>$GOMIPS64</code> (for <code>mips64</code> and <code>mips64le</code> only)
-<p>
- These variables set whether to use floating point instructions. Set to "<code>hardfloat</code>" to use floating point instructions; this is the default. Set to "<code>softfloat</code>" to use soft floating point.
-</p>
-</li>
-
-<li><code>$GOPPC64</code> (for <code>ppc64</code> and <code>ppc64le</code> only)
-<p>
-This variable sets the processor level (i.e. Instruction Set Architecture version)
-for which the compiler will target. The default is <code>power8</code>.
-</p>
-<ul>
- <li><code>GOPPC64=power8</code>: generate ISA v2.07 instructions</li>
- <li><code>GOPPC64=power9</code>: generate ISA v3.00 instructions</li>
-</ul>
-</li>
-
-
-<li><code>$GOWASM</code> (for <code>wasm</code> only)
- <p>
- This variable is a comma separated list of <a href="https://github.com/WebAssembly/proposals">experimental WebAssembly features</a> that the compiled WebAssembly binary is allowed to use.
- The default is to use no experimental features.
- </p>
- <ul>
- <li><code>GOWASM=satconv</code>: generate <a href="https://github.com/WebAssembly/nontrapping-float-to-int-conversions/blob/master/proposals/nontrapping-float-to-int-conversion/Overview.md">saturating (non-trapping) float-to-int conversions</a></li>
- <li><code>GOWASM=signext</code>: generate <a href="https://github.com/WebAssembly/sign-extension-ops/blob/master/proposals/sign-extension-ops/Overview.md">sign-extension operators</a></li>
- </ul>
-</li>
-
-</ul>
-
-<p>
-Note that <code>$GOARCH</code> and <code>$GOOS</code> identify the
-<em>target</em> environment, not the environment you are running on.
-In effect, you are always cross-compiling.
-By architecture, we mean the kind of binaries
-that the target environment can run:
-an x86-64 system running a 32-bit-only operating system
-must set <code>GOARCH</code> to <code>386</code>,
-not <code>amd64</code>.
-</p>
-
-<p>
-If you choose to override the defaults,
-set these variables in your shell profile (<code>$HOME/.bashrc</code>,
-<code>$HOME/.profile</code>, or equivalent). The settings might look
-something like this:
-</p>
-
-<pre>
-export GOARCH=amd64
-export GOOS=linux
-</pre>
-
-<p>
-although, to reiterate, none of these variables needs to be set to build,
-install, and develop the Go tree.
-</p>
diff --git a/doc/install.html b/doc/install.html
deleted file mode 100644
index 706d66c007..0000000000
--- a/doc/install.html
+++ /dev/null
@@ -1,315 +0,0 @@
-<!--{
- "Title": "Getting Started",
- "Path": "/doc/install"
-}-->
-
-<div class="hideFromDownload">
-
-<h2 id="download">Download the Go distribution</h2>
-
-<p>
-<a href="/dl/" id="start" class="download">
-<span class="big">Download Go</span>
-<span class="desc">Click here to visit the downloads page</span>
-</a>
-</p>
-
-<p>
-<a href="/dl/" target="_blank">Official binary
-distributions</a> are available for the FreeBSD (release 10-STABLE and above),
-Linux, macOS (10.11 and above), and Windows operating systems and
-the 32-bit (<code>386</code>) and 64-bit (<code>amd64</code>) x86 processor
-architectures.
-</p>
-
-<p>
-If a binary distribution is not available for your combination of operating
-system and architecture, try
-<a href="/doc/install/source">installing from source</a> or
-<a href="/doc/install/gccgo">installing gccgo instead of gc</a>.
-</p>
-
-
-<h2 id="requirements">System requirements</h2>
-
-<p>
-Go <a href="/dl/">binary distributions</a> are available for these supported operating systems and architectures.
-Please ensure your system meets these requirements before proceeding.
-If your OS or architecture is not on the list, you may be able to
-<a href="/doc/install/source">install from source</a> or
-<a href="/doc/install/gccgo">use gccgo instead</a>.
-</p>
-
-<table class="codetable" frame="border" summary="requirements">
-<tr>
-<th align="center">Operating system</th>
-<th align="center">Architectures</th>
-<th align="center">Notes</th>
-</tr>
-<tr><td colspan="3"><hr></td></tr>
-<tr><td>FreeBSD 10.3 or later</td> <td>amd64, 386</td> <td>Debian GNU/kFreeBSD not supported</td></tr>
-<tr valign='top'><td>Linux 2.6.23 or later with glibc</td> <td>amd64, 386, arm, arm64,<br>s390x, ppc64le</td> <td>CentOS/RHEL 5.x not supported.<br>Install from source for other libc.</td></tr>
-<tr><td>macOS 10.11 or later</td> <td>amd64</td> <td>use the clang or gcc<sup>&#8224;</sup> that comes with Xcode<sup>&#8225;</sup> for <code>cgo</code> support</td></tr>
-<tr valign='top'><td>Windows 7, Server 2008R2 or later</td> <td>amd64, 386</td> <td>use MinGW (<code>386</code>) or MinGW-W64 (<code>amd64</code>) gcc<sup>&#8224;</sup>.<br>No need for cygwin or msys.</td></tr>
-</table>
-
-<p>
-<sup>&#8224;</sup>A C compiler is required only if you plan to use
-<a href="/cmd/cgo">cgo</a>.<br/>
-<sup>&#8225;</sup>You only need to install the command line tools for
-<a href="https://developer.apple.com/Xcode/">Xcode</a>. If you have already
-installed Xcode 4.3+, you can install it from the Components tab of the
-Downloads preferences panel.
-</p>
-
-</div><!-- hideFromDownload -->
-
-
-<h2 id="install">Install the Go tools</h2>
-
-<p>
-If you are upgrading from an older version of Go you must
-first <a href="#uninstall">remove the existing version</a>.
-</p>
-
-<div id="tarballInstructions">
-
-<h3 id="tarball">Linux, macOS, and FreeBSD tarballs</h3>
-
-<p>
-<a href="/dl/">Download the archive</a>
-and extract it into <code>/usr/local</code>, creating a Go tree in
-<code>/usr/local/go</code>. For example:
-</p>
-
-<pre>
-tar -C /usr/local -xzf <span class="downloadFilename">go$VERSION.$OS-$ARCH.tar.gz</span>
-</pre>
-
-<p class="hideFromDownload">
-Choose the archive file appropriate for your installation.
-For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux,
-the archive you want is called <code>go1.2.1.linux-amd64.tar.gz</code>.
-</p>
-
-<p>
-(Typically these commands must be run as root or through <code>sudo</code>.)
-</p>
-
-<p>
-Add <code>/usr/local/go/bin</code> to the <code>PATH</code> environment
-variable. You can do this by adding this line to your <code>/etc/profile</code>
-(for a system-wide installation) or <code>$HOME/.profile</code>:
-</p>
-
-<pre>
-export PATH=$PATH:/usr/local/go/bin
-</pre>
-
-<p>
-<b>Note</b>: changes made to a <code>profile</code> file may not apply until the
-next time you log into your computer.
-To apply the changes immediately, just run the shell commands directly
-or execute them from the profile using a command such as
-<code>source $HOME/.profile</code>.
-</p>
-
-</div><!-- tarballInstructions -->
-
-<div id="darwinPackageInstructions">
-
-<h3 id="macos"><div id="osx"></div>macOS package installer</h3>
-
-<p>
-<a href="/dl/">Download the package file</a>,
-open it, and follow the prompts to install the Go tools.
-The package installs the Go distribution to <code>/usr/local/go</code>.
-</p>
-
-<p>
-The package should put the <code>/usr/local/go/bin</code> directory in your
-<code>PATH</code> environment variable. You may need to restart any open
-Terminal sessions for the change to take effect.
-</p>
-
-</div><!-- darwinPackageInstructions -->
-
-<div id="windowsInstructions">
-
-<h3 id="windows">Windows</h3>
-
-<p class="hideFromDownload">
-The Go project provides two installation options for Windows users
-(besides <a href="/doc/install/source">installing from source</a>):
-a zip archive that requires you to set some environment variables and an
-MSI installer that configures your installation automatically.
-</p>
-
-<div id="windowsInstallerInstructions">
-
-<h4 id="windows_msi">MSI installer</h4>
-
-<p>
-Open the <a href="/dl/">MSI file</a>
-and follow the prompts to install the Go tools.
-By default, the installer puts the Go distribution in <code>c:\Go</code>.
-</p>
-
-<p>
-The installer should put the <code>c:\Go\bin</code> directory in your
-<code>PATH</code> environment variable. You may need to restart any open
-command prompts for the change to take effect.
-</p>
-
-</div><!-- windowsInstallerInstructions -->
-
-<div id="windowsZipInstructions">
-
-<h4 id="windows_zip">Zip archive</h4>
-
-<p>
-<a href="/dl/">Download the zip file</a> and extract it into the directory of your choice (we suggest <code>c:\Go</code>).
-</p>
-
-<p>
-Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to your <code>PATH</code> environment variable.
-</p>
-
-</div><!-- windowsZipInstructions -->
-
-<h4 id="windows_env">Setting environment variables under Windows</h4>
-
-<p>
-Under Windows, you may set environment variables through the "Environment
-Variables" button on the "Advanced" tab of the "System" control panel. Some
-versions of Windows provide this control panel through the "Advanced System
-Settings" option inside the "System" control panel.
-</p>
-
-</div><!-- windowsInstructions -->
-
-
-<h2 id="testing">Test your installation</h2>
-
-<p>
-Check that Go is installed correctly by building a simple program, as follows.
-</p>
-
-<p>
-Create a file named <code>hello.go</code> that looks like:
-</p>
-
-<pre>
-package main
-
-import "fmt"
-
-func main() {
- fmt.Printf("hello, world\n")
-}
-</pre>
-
-<p>
-Then build it with the <code>go</code> tool:
-</p>
-
-<pre class="testUnix">
-$ <b>go build hello.go</b>
-</pre>
-
-<pre class="testWindows">
-C:\Users\Gopher\go\src\hello&gt; <b>go build hello.go</b>
-</pre>
-
-<p>
-The command above will build an executable named
-<code class="testUnix">hello</code><code class="testWindows">hello.exe</code>
-in the current directory alongside your source code.
-Execute it to see the greeting:
-</p>
-
-<pre class="testUnix">
-$ <b>./hello</b>
-hello, world
-</pre>
-
-<pre class="testWindows">
-C:\Users\Gopher\go\src\hello&gt; <b>hello</b>
-hello, world
-</pre>
-
-<p>
-If you see the "hello, world" message then your Go installation is working.
-</p>
-
-<p>
-Before rushing off to write Go code please read the
-<a href="/doc/code.html">How to Write Go Code</a> document,
-which describes some essential concepts about using the Go tools.
-</p>
-
-
-<h2 id="extra_versions">Installing extra Go versions</h2>
-
-<p>
-It may be useful to have multiple Go versions installed on the same machine, for
-example, to ensure that a package's tests pass on multiple Go versions.
-Once you have one Go version installed, you can install another (such as 1.10.7)
-as follows:
-</p>
-
-<pre>
-$ go get golang.org/dl/go1.10.7
-$ go1.10.7 download
-</pre>
-
-<p>
-The newly downloaded version can be used like <code>go</code>:
-</p>
-
-<pre>
-$ go1.10.7 version
-go version go1.10.7 linux/amd64
-</pre>
-
-<p>
-All Go versions available via this method are listed on
-<a href="https://godoc.org/golang.org/dl#pkg-subdirectories">the download page</a>.
-You can find where each of these extra Go versions is installed by looking
-at its <code>GOROOT</code>; for example, <code>go1.10.7 env GOROOT</code>.
-To uninstall a downloaded version, just remove its <code>GOROOT</code> directory
-and the <code>goX.Y.Z</code> binary.
-</p>
-
-
-<h2 id="uninstall">Uninstalling Go</h2>
-
-<p>
-To remove an existing Go installation from your system delete the
-<code>go</code> directory. This is usually <code>/usr/local/go</code>
-under Linux, macOS, and FreeBSD or <code>c:\Go</code>
-under Windows.
-</p>
-
-<p>
-You should also remove the Go <code>bin</code> directory from your
-<code>PATH</code> environment variable.
-Under Linux and FreeBSD you should edit <code>/etc/profile</code> or
-<code>$HOME/.profile</code>.
-If you installed Go with the <a href="#macos">macOS package</a> then you
-should remove the <code>/etc/paths.d/go</code> file.
-Windows users should read the section about <a href="#windows_env">setting
-environment variables under Windows</a>.
-</p>
-
-
-<h2 id="help">Getting help</h2>
-
-<p>
- For help, see the <a href="/help/">list of Go mailing lists, forums, and places to chat</a>.
-</p>
-
-<p>
- Report bugs either by running “<b><code>go</code> <code>bug</code></b>”, or
- manually at the <a href="https://golang.org/issue">Go issue tracker</a>.
-</p>
diff --git a/doc/play/fib.go b/doc/play/fib.go
deleted file mode 100644
index 19e4721028..0000000000
--- a/doc/play/fib.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package main
-
-import "fmt"
-
-// fib returns a function that returns
-// successive Fibonacci numbers.
-func fib() func() int {
- a, b := 0, 1
- return func() int {
- a, b = b, a+b
- return a
- }
-}
-
-func main() {
- f := fib()
- // Function calls are evaluated left-to-right.
- fmt.Println(f(), f(), f(), f(), f())
-}
diff --git a/doc/play/hello.go b/doc/play/hello.go
deleted file mode 100644
index 3badf12538..0000000000
--- a/doc/play/hello.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// You can edit this code!
-// Click here and start typing.
-package main
-
-import "fmt"
-
-func main() {
- fmt.Println("Hello, 世界")
-}
diff --git a/doc/play/life.go b/doc/play/life.go
deleted file mode 100644
index 51afb61f3d..0000000000
--- a/doc/play/life.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// An implementation of Conway's Game of Life.
-package main
-
-import (
- "bytes"
- "fmt"
- "math/rand"
- "time"
-)
-
-// Field represents a two-dimensional field of cells.
-type Field struct {
- s [][]bool
- w, h int
-}
-
-// NewField returns an empty field of the specified width and height.
-func NewField(w, h int) *Field {
- s := make([][]bool, h)
- for i := range s {
- s[i] = make([]bool, w)
- }
- return &Field{s: s, w: w, h: h}
-}
-
-// Set sets the state of the specified cell to the given value.
-func (f *Field) Set(x, y int, b bool) {
- f.s[y][x] = b
-}
-
-// Alive reports whether the specified cell is alive.
-// If the x or y coordinates are outside the field boundaries they are wrapped
-// toroidally. For instance, an x value of -1 is treated as width-1.
-func (f *Field) Alive(x, y int) bool {
- x += f.w
- x %= f.w
- y += f.h
- y %= f.h
- return f.s[y][x]
-}
-
-// Next returns the state of the specified cell at the next time step.
-func (f *Field) Next(x, y int) bool {
- // Count the adjacent cells that are alive.
- alive := 0
- for i := -1; i <= 1; i++ {
- for j := -1; j <= 1; j++ {
- if (j != 0 || i != 0) && f.Alive(x+i, y+j) {
- alive++
- }
- }
- }
- // Return next state according to the game rules:
- // exactly 3 neighbors: on,
- // exactly 2 neighbors: maintain current state,
- // otherwise: off.
- return alive == 3 || alive == 2 && f.Alive(x, y)
-}
-
-// Life stores the state of a round of Conway's Game of Life.
-type Life struct {
- a, b *Field
- w, h int
-}
-
-// NewLife returns a new Life game state with a random initial state.
-func NewLife(w, h int) *Life {
- a := NewField(w, h)
- for i := 0; i < (w * h / 4); i++ {
- a.Set(rand.Intn(w), rand.Intn(h), true)
- }
- return &Life{
- a: a, b: NewField(w, h),
- w: w, h: h,
- }
-}
-
-// Step advances the game by one instant, recomputing and updating all cells.
-func (l *Life) Step() {
- // Update the state of the next field (b) from the current field (a).
- for y := 0; y < l.h; y++ {
- for x := 0; x < l.w; x++ {
- l.b.Set(x, y, l.a.Next(x, y))
- }
- }
- // Swap fields a and b.
- l.a, l.b = l.b, l.a
-}
-
-// String returns the game board as a string.
-func (l *Life) String() string {
- var buf bytes.Buffer
- for y := 0; y < l.h; y++ {
- for x := 0; x < l.w; x++ {
- b := byte(' ')
- if l.a.Alive(x, y) {
- b = '*'
- }
- buf.WriteByte(b)
- }
- buf.WriteByte('\n')
- }
- return buf.String()
-}
-
-func main() {
- l := NewLife(40, 15)
- for i := 0; i < 300; i++ {
- l.Step()
- fmt.Print("\x0c", l) // Clear screen and print field.
- time.Sleep(time.Second / 30)
- }
-}
diff --git a/doc/play/peano.go b/doc/play/peano.go
deleted file mode 100644
index 214fe1b613..0000000000
--- a/doc/play/peano.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Peano integers are represented by a linked
-// list whose nodes contain no data
-// (the nodes are the data).
-// http://en.wikipedia.org/wiki/Peano_axioms
-
-// This program demonstrates that Go's automatic
-// stack management can handle heavily recursive
-// computations.
-
-package main
-
-import "fmt"
-
-// Number is a pointer to a Number
-type Number *Number
-
-// The arithmetic value of a Number is the
-// count of the nodes comprising the list.
-// (See the count function below.)
-
-// -------------------------------------
-// Peano primitives
-
-func zero() *Number {
- return nil
-}
-
-func isZero(x *Number) bool {
- return x == nil
-}
-
-func add1(x *Number) *Number {
- e := new(Number)
- *e = x
- return e
-}
-
-func sub1(x *Number) *Number {
- return *x
-}
-
-func add(x, y *Number) *Number {
- if isZero(y) {
- return x
- }
- return add(add1(x), sub1(y))
-}
-
-func mul(x, y *Number) *Number {
- if isZero(x) || isZero(y) {
- return zero()
- }
- return add(mul(x, sub1(y)), x)
-}
-
-func fact(n *Number) *Number {
- if isZero(n) {
- return add1(zero())
- }
- return mul(fact(sub1(n)), n)
-}
-
-// -------------------------------------
-// Helpers to generate/count Peano integers
-
-func gen(n int) *Number {
- if n > 0 {
- return add1(gen(n - 1))
- }
- return zero()
-}
-
-func count(x *Number) int {
- if isZero(x) {
- return 0
- }
- return count(sub1(x)) + 1
-}
-
-// -------------------------------------
-// Print i! for i in [0,9]
-
-func main() {
- for i := 0; i <= 9; i++ {
- f := count(fact(gen(i)))
- fmt.Println(i, "! =", f)
- }
-}
diff --git a/doc/play/pi.go b/doc/play/pi.go
deleted file mode 100644
index f61884e888..0000000000
--- a/doc/play/pi.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// Concurrent computation of pi.
-// See https://goo.gl/la6Kli.
-//
-// This demonstrates Go's ability to handle
-// large numbers of concurrent processes.
-// It is an unreasonable way to calculate pi.
-package main
-
-import (
- "fmt"
- "math"
-)
-
-func main() {
- fmt.Println(pi(5000))
-}
-
-// pi launches n goroutines to compute an
-// approximation of pi.
-func pi(n int) float64 {
- ch := make(chan float64)
- for k := 0; k <= n; k++ {
- go term(ch, float64(k))
- }
- f := 0.0
- for k := 0; k <= n; k++ {
- f += <-ch
- }
- return f
-}
-
-func term(ch chan float64, k float64) {
- ch <- 4 * math.Pow(-1, k) / (2*k + 1)
-}
diff --git a/doc/play/sieve.go b/doc/play/sieve.go
deleted file mode 100644
index 519093453f..0000000000
--- a/doc/play/sieve.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// A concurrent prime sieve
-
-package main
-
-import "fmt"
-
-// Send the sequence 2, 3, 4, ... to channel 'ch'.
-func Generate(ch chan<- int) {
- for i := 2; ; i++ {
- ch <- i // Send 'i' to channel 'ch'.
- }
-}
-
-// Copy the values from channel 'in' to channel 'out',
-// removing those divisible by 'prime'.
-func Filter(in <-chan int, out chan<- int, prime int) {
- for {
- i := <-in // Receive value from 'in'.
- if i%prime != 0 {
- out <- i // Send 'i' to 'out'.
- }
- }
-}
-
-// The prime sieve: Daisy-chain Filter processes.
-func main() {
- ch := make(chan int) // Create a new channel.
- go Generate(ch) // Launch Generate goroutine.
- for i := 0; i < 10; i++ {
- prime := <-ch
- fmt.Println(prime)
- ch1 := make(chan int)
- go Filter(ch, ch1, prime)
- ch = ch1
- }
-}
diff --git a/doc/play/solitaire.go b/doc/play/solitaire.go
deleted file mode 100644
index 15022aa194..0000000000
--- a/doc/play/solitaire.go
+++ /dev/null
@@ -1,117 +0,0 @@
-// This program solves the (English) peg
-// solitaire board game.
-// http://en.wikipedia.org/wiki/Peg_solitaire
-
-package main
-
-import "fmt"
-
-const N = 11 + 1 // length of a row (+1 for \n)
-
-// The board must be surrounded by 2 illegal
-// fields in each direction so that move()
-// doesn't need to check the board boundaries.
-// Periods represent illegal fields,
-// ● are pegs, and ○ are holes.
-
-var board = []rune(
- `...........
-...........
-....●●●....
-....●●●....
-..●●●●●●●..
-..●●●○●●●..
-..●●●●●●●..
-....●●●....
-....●●●....
-...........
-...........
-`)
-
-// center is the position of the center hole if
-// there is a single one; otherwise it is -1.
-var center int
-
-func init() {
- n := 0
- for pos, field := range board {
- if field == '○' {
- center = pos
- n++
- }
- }
- if n != 1 {
- center = -1 // no single hole
- }
-}
-
-var moves int // number of times move is called
-
-// move tests if there is a peg at position pos that
-// can jump over another peg in direction dir. If the
-// move is valid, it is executed and move returns true.
-// Otherwise, move returns false.
-func move(pos, dir int) bool {
- moves++
- if board[pos] == '●' && board[pos+dir] == '●' && board[pos+2*dir] == '○' {
- board[pos] = '○'
- board[pos+dir] = '○'
- board[pos+2*dir] = '●'
- return true
- }
- return false
-}
-
-// unmove reverts a previously executed valid move.
-func unmove(pos, dir int) {
- board[pos] = '●'
- board[pos+dir] = '●'
- board[pos+2*dir] = '○'
-}
-
-// solve tries to find a sequence of moves such that
-// there is only one peg left at the end; if center is
-// >= 0, that last peg must be in the center position.
-// If a solution is found, solve prints the board after
-// each move in a backward fashion (i.e., the last
-// board position is printed first, all the way back to
-// the starting board position).
-func solve() bool {
- var last, n int
- for pos, field := range board {
- // try each board position
- if field == '●' {
- // found a peg
- for _, dir := range [...]int{-1, -N, +1, +N} {
- // try each direction
- if move(pos, dir) {
- // a valid move was found and executed,
- // see if this new board has a solution
- if solve() {
- unmove(pos, dir)
- fmt.Println(string(board))
- return true
- }
- unmove(pos, dir)
- }
- }
- last = pos
- n++
- }
- }
- // tried each possible move
- if n == 1 && (center < 0 || last == center) {
- // there's only one peg left
- fmt.Println(string(board))
- return true
- }
- // no solution found for this board
- return false
-}
-
-func main() {
- if !solve() {
- fmt.Println("no solution found")
- }
- fmt.Println(moves, "moves tried")
-}
diff --git a/doc/play/tree.go b/doc/play/tree.go
deleted file mode 100644
index 3790e6cda5..0000000000
--- a/doc/play/tree.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Go's concurrency primitives make it easy to
-// express concurrent concepts, such as
-// this binary tree comparison.
-//
-// Trees may be of different shapes,
-// but have the same contents. For example:
-//
-// 4 6
-// 2 6 4 7
-// 1 3 5 7 2 5
-// 1 3
-//
-// This program compares a pair of trees by
-// walking each in its own goroutine,
-// sending their contents through a channel
-// to a third goroutine that compares them.
-
-package main
-
-import (
- "fmt"
- "math/rand"
-)
-
-// A Tree is a binary tree with integer values.
-type Tree struct {
- Left *Tree
- Value int
- Right *Tree
-}
-
-// Walk traverses a tree depth-first,
-// sending each Value on a channel.
-func Walk(t *Tree, ch chan int) {
- if t == nil {
- return
- }
- Walk(t.Left, ch)
- ch <- t.Value
- Walk(t.Right, ch)
-}
-
-// Walker launches Walk in a new goroutine,
-// and returns a read-only channel of values.
-func Walker(t *Tree) <-chan int {
- ch := make(chan int)
- go func() {
- Walk(t, ch)
- close(ch)
- }()
- return ch
-}
-
-// Compare reads values from two Walkers
-// that run simultaneously, and returns true
-// if t1 and t2 have the same contents.
-func Compare(t1, t2 *Tree) bool {
- c1, c2 := Walker(t1), Walker(t2)
- for {
- v1, ok1 := <-c1
- v2, ok2 := <-c2
- if !ok1 || !ok2 {
- return ok1 == ok2
- }
- if v1 != v2 {
- break
- }
- }
- return false
-}
-
-// New returns a new, random binary tree
-// holding the values 1k, 2k, ..., nk.
-func New(n, k int) *Tree {
- var t *Tree
- for _, v := range rand.Perm(n) {
- t = insert(t, (1+v)*k)
- }
- return t
-}
-
-func insert(t *Tree, v int) *Tree {
- if t == nil {
- return &Tree{nil, v, nil}
- }
- if v < t.Value {
- t.Left = insert(t.Left, v)
- return t
- }
- t.Right = insert(t.Right, v)
- return t
-}
-
-func main() {
- t1 := New(100, 1)
- fmt.Println(Compare(t1, New(100, 1)), "Same Contents")
- fmt.Println(Compare(t1, New(99, 1)), "Differing Sizes")
- fmt.Println(Compare(t1, New(100, 2)), "Differing Values")
- fmt.Println(Compare(t1, New(101, 2)), "Dissimilar")
-}
diff --git a/doc/progs/cgo1.go b/doc/progs/cgo1.go
deleted file mode 100644
index d559e13931..0000000000
--- a/doc/progs/cgo1.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 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.
-
-package rand
-
-/*
-#include <stdlib.h>
-*/
-import "C"
-
-// STOP OMIT
-func Random() int {
- return int(C.rand())
-}
-
-// STOP OMIT
-func Seed(i int) {
- C.srand(C.uint(i))
-}
-
-// END OMIT
diff --git a/doc/progs/cgo2.go b/doc/progs/cgo2.go
deleted file mode 100644
index da07aa49e6..0000000000
--- a/doc/progs/cgo2.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 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.
-
-package rand2
-
-/*
-#include <stdlib.h>
-*/
-import "C"
-
-func Random() int {
- var r C.int = C.rand()
- return int(r)
-}
-
-// STOP OMIT
-func Seed(i int) {
- C.srand(C.uint(i))
-}
-
-// END OMIT
diff --git a/doc/progs/cgo3.go b/doc/progs/cgo3.go
deleted file mode 100644
index d5cedf4960..0000000000
--- a/doc/progs/cgo3.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 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.
-
-package print
-
-// #include <stdio.h>
-// #include <stdlib.h>
-import "C"
-import "unsafe"
-
-func Print(s string) {
- cs := C.CString(s)
- C.fputs(cs, (*C.FILE)(C.stdout))
- C.free(unsafe.Pointer(cs))
-}
-
-// END OMIT
diff --git a/doc/progs/cgo4.go b/doc/progs/cgo4.go
deleted file mode 100644
index dbb07e84fe..0000000000
--- a/doc/progs/cgo4.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 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.
-
-package print
-
-// #include <stdio.h>
-// #include <stdlib.h>
-import "C"
-import "unsafe"
-
-func Print(s string) {
- cs := C.CString(s)
- defer C.free(unsafe.Pointer(cs))
- C.fputs(cs, (*C.FILE)(C.stdout))
-}
-
-// END OMIT
diff --git a/doc/progs/defer.go b/doc/progs/defer.go
deleted file mode 100644
index 2e11020abf..0000000000
--- a/doc/progs/defer.go
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains the code snippets included in "Defer, Panic, and Recover."
-
-package main
-
-import (
- "fmt"
- "io"
- "os"
-)
-
-func a() {
- i := 0
- defer fmt.Println(i)
- i++
- return
-}
-
-// STOP OMIT
-
-func b() {
- for i := 0; i < 4; i++ {
- defer fmt.Print(i)
- }
-}
-
-// STOP OMIT
-
-func c() (i int) {
- defer func() { i++ }()
- return 1
-}
-
-// STOP OMIT
-
-// Initial version.
-func CopyFile(dstName, srcName string) (written int64, err error) {
- src, err := os.Open(srcName)
- if err != nil {
- return
- }
-
- dst, err := os.Create(dstName)
- if err != nil {
- return
- }
-
- written, err = io.Copy(dst, src)
- dst.Close()
- src.Close()
- return
-}
-
-// STOP OMIT
-
-func main() {
- a()
- b()
- fmt.Println()
- fmt.Println(c())
-}
diff --git a/doc/progs/defer2.go b/doc/progs/defer2.go
deleted file mode 100644
index cad66b0702..0000000000
--- a/doc/progs/defer2.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains the code snippets included in "Defer, Panic, and Recover."
-
-package main
-
-import "fmt"
-import "io" // OMIT
-import "os" // OMIT
-
-func main() {
- f()
- fmt.Println("Returned normally from f.")
-}
-
-func f() {
- defer func() {
- if r := recover(); r != nil {
- fmt.Println("Recovered in f", r)
- }
- }()
- fmt.Println("Calling g.")
- g(0)
- fmt.Println("Returned normally from g.")
-}
-
-func g(i int) {
- if i > 3 {
- fmt.Println("Panicking!")
- panic(fmt.Sprintf("%v", i))
- }
- defer fmt.Println("Defer in g", i)
- fmt.Println("Printing in g", i)
- g(i + 1)
-}
-
-// STOP OMIT
-
-// Revised version.
-func CopyFile(dstName, srcName string) (written int64, err error) {
- src, err := os.Open(srcName)
- if err != nil {
- return
- }
- defer src.Close()
-
- dst, err := os.Create(dstName)
- if err != nil {
- return
- }
- defer dst.Close()
-
- return io.Copy(dst, src)
-}
-
-// STOP OMIT
diff --git a/doc/progs/eff_bytesize.go b/doc/progs/eff_bytesize.go
deleted file mode 100644
index b45961114d..0000000000
--- a/doc/progs/eff_bytesize.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2009 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.
-
-package main
-
-import "fmt"
-
-type ByteSize float64
-
-const (
- _ = iota // ignore first value by assigning to blank identifier
- KB ByteSize = 1 << (10 * iota)
- MB
- GB
- TB
- PB
- EB
- ZB
- YB
-)
-
-func (b ByteSize) String() string {
- switch {
- case b >= YB:
- return fmt.Sprintf("%.2fYB", b/YB)
- case b >= ZB:
- return fmt.Sprintf("%.2fZB", b/ZB)
- case b >= EB:
- return fmt.Sprintf("%.2fEB", b/EB)
- case b >= PB:
- return fmt.Sprintf("%.2fPB", b/PB)
- case b >= TB:
- return fmt.Sprintf("%.2fTB", b/TB)
- case b >= GB:
- return fmt.Sprintf("%.2fGB", b/GB)
- case b >= MB:
- return fmt.Sprintf("%.2fMB", b/MB)
- case b >= KB:
- return fmt.Sprintf("%.2fKB", b/KB)
- }
- return fmt.Sprintf("%.2fB", b)
-}
-
-func main() {
- fmt.Println(YB, ByteSize(1e13))
-}
diff --git a/doc/progs/eff_qr.go b/doc/progs/eff_qr.go
deleted file mode 100644
index f2055f08c3..0000000000
--- a/doc/progs/eff_qr.go
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2009 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.
-
-package main
-
-import (
- "flag"
- "html/template"
- "log"
- "net/http"
-)
-
-var addr = flag.String("addr", ":1718", "http service address") // Q=17, R=18
-
-var templ = template.Must(template.New("qr").Parse(templateStr))
-
-func main() {
- flag.Parse()
- http.Handle("/", http.HandlerFunc(QR))
- err := http.ListenAndServe(*addr, nil)
- if err != nil {
- log.Fatal("ListenAndServe:", err)
- }
-}
-
-func QR(w http.ResponseWriter, req *http.Request) {
- templ.Execute(w, req.FormValue("s"))
-}
-
-const templateStr = `
-<html>
-<head>
-<title>QR Link Generator</title>
-</head>
-<body>
-{{if .}}
-<img src="http://chart.apis.google.com/chart?chs=300x300&cht=qr&choe=UTF-8&chl={{.}}" />
-<br>
-{{.}}
-<br>
-<br>
-{{end}}
-<form action="/" name=f method="GET">
- <input maxLength=1024 size=70 name=s value="" title="Text to QR Encode">
- <input type=submit value="Show QR" name=qr>
-</form>
-</body>
-</html>
-`
diff --git a/doc/progs/eff_sequence.go b/doc/progs/eff_sequence.go
deleted file mode 100644
index ab1826b6ee..0000000000
--- a/doc/progs/eff_sequence.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2009 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.
-
-package main
-
-import (
- "fmt"
- "sort"
-)
-
-func main() {
- seq := Sequence{6, 2, -1, 44, 16}
- sort.Sort(seq)
- fmt.Println(seq)
-}
-
-type Sequence []int
-
-// Methods required by sort.Interface.
-func (s Sequence) Len() int {
- return len(s)
-}
-func (s Sequence) Less(i, j int) bool {
- return s[i] < s[j]
-}
-func (s Sequence) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-// Copy returns a copy of the Sequence.
-func (s Sequence) Copy() Sequence {
- copy := make(Sequence, 0, len(s))
- return append(copy, s...)
-}
-
-// Method for printing - sorts the elements before printing.
-func (s Sequence) String() string {
- s = s.Copy() // Make a copy; don't overwrite argument.
- sort.Sort(s)
- str := "["
- for i, elem := range s { // Loop is O(N²); will fix that in next example.
- if i > 0 {
- str += " "
- }
- str += fmt.Sprint(elem)
- }
- return str + "]"
-}
diff --git a/doc/progs/eff_unused1.go b/doc/progs/eff_unused1.go
deleted file mode 100644
index 285d55eee5..0000000000
--- a/doc/progs/eff_unused1.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package main
-
-import (
- "fmt"
- "io"
- "log"
- "os"
-)
-
-func main() {
- fd, err := os.Open("test.go")
- if err != nil {
- log.Fatal(err)
- }
- // TODO: use fd.
-}
diff --git a/doc/progs/eff_unused2.go b/doc/progs/eff_unused2.go
deleted file mode 100644
index 92eb74e053..0000000000
--- a/doc/progs/eff_unused2.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package main
-
-import (
- "fmt"
- "io"
- "log"
- "os"
-)
-
-var _ = fmt.Printf // For debugging; delete when done.
-var _ io.Reader // For debugging; delete when done.
-
-func main() {
- fd, err := os.Open("test.go")
- if err != nil {
- log.Fatal(err)
- }
- // TODO: use fd.
- _ = fd
-}
diff --git a/doc/progs/error.go b/doc/progs/error.go
deleted file mode 100644
index e776cdba17..0000000000
--- a/doc/progs/error.go
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains the code snippets included in "Error Handling and Go."
-
-package main
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "log"
- "net"
- "os"
- "time"
-)
-
-type File struct{}
-
-func Open(name string) (file *File, err error) {
- // OMIT
- panic(1)
- // STOP OMIT
-}
-
-func openFile() { // OMIT
- f, err := os.Open("filename.ext")
- if err != nil {
- log.Fatal(err)
- }
- // do something with the open *File f
- // STOP OMIT
- _ = f
-}
-
-// errorString is a trivial implementation of error.
-type errorString struct {
- s string
-}
-
-func (e *errorString) Error() string {
- return e.s
-}
-
-// STOP OMIT
-
-// New returns an error that formats as the given text.
-func New(text string) error {
- return &errorString{text}
-}
-
-// STOP OMIT
-
-func Sqrt(f float64) (float64, error) {
- if f < 0 {
- return 0, errors.New("math: square root of negative number")
- }
- // implementation
- return 0, nil // OMIT
-}
-
-// STOP OMIT
-
-func printErr() (int, error) { // OMIT
- f, err := Sqrt(-1)
- if err != nil {
- fmt.Println(err)
- }
- // STOP OMIT
- // fmtError OMIT
- if f < 0 {
- return 0, fmt.Errorf("math: square root of negative number %g", f)
- }
- // STOP OMIT
- return 0, nil
-}
-
-type NegativeSqrtError float64
-
-func (f NegativeSqrtError) Error() string {
- return fmt.Sprintf("math: square root of negative number %g", float64(f))
-}
-
-// STOP OMIT
-
-type SyntaxError struct {
- msg string // description of error
- Offset int64 // error occurred after reading Offset bytes
-}
-
-func (e *SyntaxError) Error() string { return e.msg }
-
-// STOP OMIT
-
-func decodeError(dec *json.Decoder, val struct{}) error { // OMIT
- var f os.FileInfo // OMIT
- if err := dec.Decode(&val); err != nil {
- if serr, ok := err.(*json.SyntaxError); ok {
- line, col := findLine(f, serr.Offset)
- return fmt.Errorf("%s:%d:%d: %v", f.Name(), line, col, err)
- }
- return err
- }
- // STOP OMIT
- return nil
-}
-
-func findLine(os.FileInfo, int64) (int, int) {
- // place holder; no need to run
- return 0, 0
-}
-
-func netError(err error) { // OMIT
- for { // OMIT
- if nerr, ok := err.(net.Error); ok && nerr.Temporary() {
- time.Sleep(1e9)
- continue
- }
- if err != nil {
- log.Fatal(err)
- }
- // STOP OMIT
- }
-}
-
-func main() {}
diff --git a/doc/progs/error2.go b/doc/progs/error2.go
deleted file mode 100644
index 086b6710d3..0000000000
--- a/doc/progs/error2.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains the code snippets included in "Error Handling and Go."
-
-package main
-
-import (
- "net/http"
- "text/template"
-)
-
-func init() {
- http.HandleFunc("/view", viewRecord)
-}
-
-func viewRecord(w http.ResponseWriter, r *http.Request) {
- c := appengine.NewContext(r)
- key := datastore.NewKey(c, "Record", r.FormValue("id"), 0, nil)
- record := new(Record)
- if err := datastore.Get(c, key, record); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- if err := viewTemplate.Execute(w, record); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- }
-}
-
-// STOP OMIT
-
-type ap struct{}
-
-func (ap) NewContext(*http.Request) *ctx { return nil }
-
-type ctx struct{}
-
-func (*ctx) Errorf(string, ...interface{}) {}
-
-var appengine ap
-
-type ds struct{}
-
-func (ds) NewKey(*ctx, string, string, int, *int) string { return "" }
-func (ds) Get(*ctx, string, *Record) error { return nil }
-
-var datastore ds
-
-type Record struct{}
-
-var viewTemplate *template.Template
-
-func main() {}
diff --git a/doc/progs/error3.go b/doc/progs/error3.go
deleted file mode 100644
index d9e56b5d64..0000000000
--- a/doc/progs/error3.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains the code snippets included in "Error Handling and Go."
-
-package main
-
-import (
- "net/http"
- "text/template"
-)
-
-func init() {
- http.Handle("/view", appHandler(viewRecord))
-}
-
-// STOP OMIT
-
-func viewRecord(w http.ResponseWriter, r *http.Request) error {
- c := appengine.NewContext(r)
- key := datastore.NewKey(c, "Record", r.FormValue("id"), 0, nil)
- record := new(Record)
- if err := datastore.Get(c, key, record); err != nil {
- return err
- }
- return viewTemplate.Execute(w, record)
-}
-
-// STOP OMIT
-
-type appHandler func(http.ResponseWriter, *http.Request) error
-
-func (fn appHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- if err := fn(w, r); err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- }
-}
-
-// STOP OMIT
-
-type ap struct{}
-
-func (ap) NewContext(*http.Request) *ctx { return nil }
-
-type ctx struct{}
-
-func (*ctx) Errorf(string, ...interface{}) {}
-
-var appengine ap
-
-type ds struct{}
-
-func (ds) NewKey(*ctx, string, string, int, *int) string { return "" }
-func (ds) Get(*ctx, string, *Record) error { return nil }
-
-var datastore ds
-
-type Record struct{}
-
-var viewTemplate *template.Template
-
-func main() {}
diff --git a/doc/progs/error4.go b/doc/progs/error4.go
deleted file mode 100644
index 8b2f3049de..0000000000
--- a/doc/progs/error4.go
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains the code snippets included in "Error Handling and Go."
-
-package main
-
-import (
- "net/http"
- "text/template"
-)
-
-type appError struct {
- Error error
- Message string
- Code int
-}
-
-// STOP OMIT
-
-type appHandler func(http.ResponseWriter, *http.Request) *appError
-
-func (fn appHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- if e := fn(w, r); e != nil { // e is *appError, not error.
- c := appengine.NewContext(r)
- c.Errorf("%v", e.Error)
- http.Error(w, e.Message, e.Code)
- }
-}
-
-// STOP OMIT
-
-func viewRecord(w http.ResponseWriter, r *http.Request) *appError {
- c := appengine.NewContext(r)
- key := datastore.NewKey(c, "Record", r.FormValue("id"), 0, nil)
- record := new(Record)
- if err := datastore.Get(c, key, record); err != nil {
- return &appError{err, "Record not found", 404}
- }
- if err := viewTemplate.Execute(w, record); err != nil {
- return &appError{err, "Can't display record", 500}
- }
- return nil
-}
-
-// STOP OMIT
-
-func init() {
- http.Handle("/view", appHandler(viewRecord))
-}
-
-type ap struct{}
-
-func (ap) NewContext(*http.Request) *ctx { return nil }
-
-type ctx struct{}
-
-func (*ctx) Errorf(string, ...interface{}) {}
-
-var appengine ap
-
-type ds struct{}
-
-func (ds) NewKey(*ctx, string, string, int, *int) string { return "" }
-func (ds) Get(*ctx, string, *Record) error { return nil }
-
-var datastore ds
-
-type Record struct{}
-
-var viewTemplate *template.Template
-
-func main() {}
diff --git a/doc/progs/go1.go b/doc/progs/go1.go
deleted file mode 100644
index 50fd93441f..0000000000
--- a/doc/progs/go1.go
+++ /dev/null
@@ -1,245 +0,0 @@
-// Copyright 2011 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.
-
-// This file contains examples to embed in the Go 1 release notes document.
-
-package main
-
-import (
- "errors"
- "flag"
- "fmt"
- "log"
- "os"
- "path/filepath"
- "testing"
- "time"
- "unicode"
-)
-
-func main() {
- flag.Parse()
- stringAppend()
- mapDelete()
- mapIteration()
- multipleAssignment()
- structEquality()
- compositeLiterals()
- runeType()
- errorExample()
- timePackage()
- walkExample()
- osIsExist()
-}
-
-var timeout = flag.Duration("timeout", 30*time.Second, "how long to wait for completion")
-
-func init() {
- // canonicalize the logging
- log.SetFlags(0)
-}
-
-func mapDelete() {
- m := map[string]int{"7": 7, "23": 23}
- k := "7"
- delete(m, k)
- if m["7"] != 0 || m["23"] != 23 {
- log.Fatal("mapDelete:", m)
- }
-}
-
-func stringAppend() {
- greeting := []byte{}
- greeting = append(greeting, []byte("hello ")...)
- greeting = append(greeting, "world"...)
- if string(greeting) != "hello world" {
- log.Fatal("stringAppend: ", string(greeting))
- }
-}
-
-func mapIteration() {
- m := map[string]int{"Sunday": 0, "Monday": 1}
- for name, value := range m {
- // This loop should not assume Sunday will be visited first.
- f(name, value)
- }
-}
-
-func f(string, int) {
-}
-
-func assert(t bool) {
- if !t {
- log.Panic("assertion fail")
- }
-}
-
-func multipleAssignment() {
- sa := []int{1, 2, 3}
- i := 0
- i, sa[i] = 1, 2 // sets i = 1, sa[0] = 2
-
- sb := []int{1, 2, 3}
- j := 0
- sb[j], j = 2, 1 // sets sb[0] = 2, j = 1
-
- sc := []int{1, 2, 3}
- sc[0], sc[0] = 1, 2 // sets sc[0] = 1, then sc[0] = 2 (so sc[0] = 2 at end)
-
- assert(i == 1 && sa[0] == 2)
- assert(j == 1 && sb[0] == 2)
- assert(sc[0] == 2)
-}
-
-func structEquality() {
- type Day struct {
- long string
- short string
- }
- Christmas := Day{"Christmas", "XMas"}
- Thanksgiving := Day{"Thanksgiving", "Turkey"}
- holiday := map[Day]bool{
- Christmas: true,
- Thanksgiving: true,
- }
- fmt.Printf("Christmas is a holiday: %t\n", holiday[Christmas])
-}
-
-func compositeLiterals() {
- type Date struct {
- month string
- day int
- }
- // Struct values, fully qualified; always legal.
- holiday1 := []Date{
- Date{"Feb", 14},
- Date{"Nov", 11},
- Date{"Dec", 25},
- }
- // Struct values, type name elided; always legal.
- holiday2 := []Date{
- {"Feb", 14},
- {"Nov", 11},
- {"Dec", 25},
- }
- // Pointers, fully qualified, always legal.
- holiday3 := []*Date{
- &Date{"Feb", 14},
- &Date{"Nov", 11},
- &Date{"Dec", 25},
- }
- // Pointers, type name elided; legal in Go 1.
- holiday4 := []*Date{
- {"Feb", 14},
- {"Nov", 11},
- {"Dec", 25},
- }
- // STOP OMIT
- _, _, _, _ = holiday1, holiday2, holiday3, holiday4
-}
-
-func runeType() {
- // STARTRUNE OMIT
- delta := 'δ' // delta has type rune.
- var DELTA rune
- DELTA = unicode.ToUpper(delta)
- epsilon := unicode.ToLower(DELTA + 1)
- if epsilon != 'δ'+1 {
- log.Fatal("inconsistent casing for Greek")
- }
- // ENDRUNE OMIT
-}
-
-// START ERROR EXAMPLE OMIT
-type SyntaxError struct {
- File string
- Line int
- Message string
-}
-
-func (se *SyntaxError) Error() string {
- return fmt.Sprintf("%s:%d: %s", se.File, se.Line, se.Message)
-}
-
-// END ERROR EXAMPLE OMIT
-
-func errorExample() {
- var ErrSyntax = errors.New("syntax error")
- _ = ErrSyntax
- se := &SyntaxError{"file", 7, "error"}
- got := fmt.Sprint(se)
- const expect = "file:7: error"
- if got != expect {
- log.Fatalf("errorsPackage: expected %q got %q", expect, got)
- }
-}
-
-// sleepUntil sleeps until the specified time. It returns immediately if it's too late.
-func sleepUntil(wakeup time.Time) {
- now := time.Now() // A Time.
- if !wakeup.After(now) {
- return
- }
- delta := wakeup.Sub(now) // A Duration.
- fmt.Printf("Sleeping for %.3fs\n", delta.Seconds())
- time.Sleep(delta)
-}
-
-func timePackage() {
- sleepUntil(time.Now().Add(123 * time.Millisecond))
-}
-
-func walkExample() {
- // STARTWALK OMIT
- markFn := func(path string, info os.FileInfo, err error) error {
- if path == "pictures" { // Will skip walking of directory pictures and its contents.
- return filepath.SkipDir
- }
- if err != nil {
- return err
- }
- log.Println(path)
- return nil
- }
- err := filepath.Walk(".", markFn)
- if err != nil {
- log.Fatal(err)
- }
- // ENDWALK OMIT
-}
-
-func initializationFunction(c chan int) {
- c <- 1
-}
-
-var PackageGlobal int
-
-func init() {
- c := make(chan int)
- go initializationFunction(c)
- PackageGlobal = <-c
-}
-
-func BenchmarkSprintf(b *testing.B) {
- // Verify correctness before running benchmark.
- b.StopTimer()
- got := fmt.Sprintf("%x", 23)
- const expect = "17"
- if expect != got {
- b.Fatalf("expected %q; got %q", expect, got)
- }
- b.StartTimer()
- for i := 0; i < b.N; i++ {
- fmt.Sprintf("%x", 23)
- }
-}
-
-func osIsExist() {
- name := "go1.go"
- f, err := os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
- if os.IsExist(err) {
- log.Printf("%s already exists", name)
- }
- _ = f
-}
diff --git a/doc/progs/gobs1.go b/doc/progs/gobs1.go
deleted file mode 100644
index 7077ca159f..0000000000
--- a/doc/progs/gobs1.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2011 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.
-
-package gobs1
-
-type T struct{ X, Y, Z int } // Only exported fields are encoded and decoded.
-var t = T{X: 7, Y: 0, Z: 8}
-
-// STOP OMIT
-
-type U struct{ X, Y *int8 } // Note: pointers to int8s
-var u U
-
-// STOP OMIT
-
-type Node struct {
- Value int
- Left, Right *Node
-}
-
-// STOP OMIT
diff --git a/doc/progs/gobs2.go b/doc/progs/gobs2.go
deleted file mode 100644
index 85bb41cdca..0000000000
--- a/doc/progs/gobs2.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2011 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.
-
-package main
-
-import (
- "bytes"
- "encoding/gob"
- "fmt"
- "log"
-)
-
-type P struct {
- X, Y, Z int
- Name string
-}
-
-type Q struct {
- X, Y *int32
- Name string
-}
-
-func main() {
- // Initialize the encoder and decoder. Normally enc and dec would be
- // bound to network connections and the encoder and decoder would
- // run in different processes.
- var network bytes.Buffer // Stand-in for a network connection
- enc := gob.NewEncoder(&network) // Will write to network.
- dec := gob.NewDecoder(&network) // Will read from network.
- // Encode (send) the value.
- err := enc.Encode(P{3, 4, 5, "Pythagoras"})
- if err != nil {
- log.Fatal("encode error:", err)
- }
- // Decode (receive) the value.
- var q Q
- err = dec.Decode(&q)
- if err != nil {
- log.Fatal("decode error:", err)
- }
- fmt.Printf("%q: {%d,%d}\n", q.Name, *q.X, *q.Y)
-}
diff --git a/doc/progs/image_draw.go b/doc/progs/image_draw.go
deleted file mode 100644
index bb73c8a714..0000000000
--- a/doc/progs/image_draw.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2012 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.
-
-// This file contains the code snippets included in "The Go image/draw package."
-
-package main
-
-import (
- "image"
- "image/color"
- "image/draw"
-)
-
-func main() {
- Color()
- Rect()
- RectAndScroll()
- ConvAndCircle()
- Glyph()
-}
-
-func Color() {
- c := color.RGBA{255, 0, 255, 255}
- r := image.Rect(0, 0, 640, 480)
- dst := image.NewRGBA(r)
-
- // ZERO OMIT
- // image.ZP is the zero point -- the origin.
- draw.Draw(dst, r, &image.Uniform{c}, image.ZP, draw.Src)
- // STOP OMIT
-
- // BLUE OMIT
- m := image.NewRGBA(image.Rect(0, 0, 640, 480))
- blue := color.RGBA{0, 0, 255, 255}
- draw.Draw(m, m.Bounds(), &image.Uniform{blue}, image.ZP, draw.Src)
- // STOP OMIT
-
- // RESET OMIT
- draw.Draw(m, m.Bounds(), image.Transparent, image.ZP, draw.Src)
- // STOP OMIT
-}
-
-func Rect() {
- dst := image.NewRGBA(image.Rect(0, 0, 640, 480))
- sr := image.Rect(0, 0, 200, 200)
- src := image.Black
- dp := image.Point{100, 100}
-
- // RECT OMIT
- r := image.Rectangle{dp, dp.Add(sr.Size())}
- draw.Draw(dst, r, src, sr.Min, draw.Src)
- // STOP OMIT
-}
-
-func RectAndScroll() {
- dst := image.NewRGBA(image.Rect(0, 0, 640, 480))
- sr := image.Rect(0, 0, 200, 200)
- src := image.Black
- dp := image.Point{100, 100}
-
- // RECT2 OMIT
- r := sr.Sub(sr.Min).Add(dp)
- draw.Draw(dst, r, src, sr.Min, draw.Src)
- // STOP OMIT
-
- m := dst
-
- // SCROLL OMIT
- b := m.Bounds()
- p := image.Pt(0, 20)
- // Note that even though the second argument is b,
- // the effective rectangle is smaller due to clipping.
- draw.Draw(m, b, m, b.Min.Add(p), draw.Src)
- dirtyRect := b.Intersect(image.Rect(b.Min.X, b.Max.Y-20, b.Max.X, b.Max.Y))
- // STOP OMIT
-
- _ = dirtyRect // noop
-}
-
-func ConvAndCircle() {
- src := image.NewRGBA(image.Rect(0, 0, 640, 480))
- dst := image.NewRGBA(image.Rect(0, 0, 640, 480))
-
- // CONV OMIT
- b := src.Bounds()
- m := image.NewRGBA(b)
- draw.Draw(m, b, src, b.Min, draw.Src)
- // STOP OMIT
-
- p := image.Point{100, 100}
- r := 50
-
- // CIRCLE2 OMIT
- draw.DrawMask(dst, dst.Bounds(), src, image.ZP, &circle{p, r}, image.ZP, draw.Over)
- // STOP OMIT
-}
-
-func theGlyphImageForAFont() image.Image {
- return image.NewRGBA(image.Rect(0, 0, 640, 480))
-}
-
-func theBoundsFor(index int) image.Rectangle {
- return image.Rect(0, 0, 32, 32)
-}
-
-func Glyph() {
- p := image.Point{100, 100}
- dst := image.NewRGBA(image.Rect(0, 0, 640, 480))
- glyphIndex := 42
-
- // GLYPH OMIT
- src := &image.Uniform{color.RGBA{0, 0, 255, 255}}
- mask := theGlyphImageForAFont()
- mr := theBoundsFor(glyphIndex)
- draw.DrawMask(dst, mr.Sub(mr.Min).Add(p), src, image.ZP, mask, mr.Min, draw.Over)
- // STOP OMIT
-}
-
-//CIRCLESTRUCT OMIT
-type circle struct {
- p image.Point
- r int
-}
-
-func (c *circle) ColorModel() color.Model {
- return color.AlphaModel
-}
-
-func (c *circle) Bounds() image.Rectangle {
- return image.Rect(c.p.X-c.r, c.p.Y-c.r, c.p.X+c.r, c.p.Y+c.r)
-}
-
-func (c *circle) At(x, y int) color.Color {
- xx, yy, rr := float64(x-c.p.X)+0.5, float64(y-c.p.Y)+0.5, float64(c.r)
- if xx*xx+yy*yy < rr*rr {
- return color.Alpha{255}
- }
- return color.Alpha{0}
-}
-
-//STOP OMIT
diff --git a/doc/progs/image_package1.go b/doc/progs/image_package1.go
deleted file mode 100644
index c4c401e729..0000000000
--- a/doc/progs/image_package1.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "image"
-)
-
-func main() {
- p := image.Point{2, 1}
- fmt.Println("X is", p.X, "Y is", p.Y)
-}
diff --git a/doc/progs/image_package2.go b/doc/progs/image_package2.go
deleted file mode 100644
index fcb5d9fd03..0000000000
--- a/doc/progs/image_package2.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "image"
-)
-
-func main() {
- r := image.Rect(2, 1, 5, 5)
- // Dx and Dy return a rectangle's width and height.
- fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 false
-}
diff --git a/doc/progs/image_package3.go b/doc/progs/image_package3.go
deleted file mode 100644
index 13d0f08079..0000000000
--- a/doc/progs/image_package3.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "image"
-)
-
-func main() {
- r := image.Rect(2, 1, 5, 5).Add(image.Pt(-4, -2))
- fmt.Println(r.Dx(), r.Dy(), image.Pt(0, 0).In(r)) // prints 3 4 true
-}
diff --git a/doc/progs/image_package4.go b/doc/progs/image_package4.go
deleted file mode 100644
index c46fddf07a..0000000000
--- a/doc/progs/image_package4.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "image"
-)
-
-func main() {
- r := image.Rect(0, 0, 4, 3).Intersect(image.Rect(2, 2, 5, 5))
- // Size returns a rectangle's width and height, as a Point.
- fmt.Printf("%#v\n", r.Size()) // prints image.Point{X:2, Y:1}
-}
diff --git a/doc/progs/image_package5.go b/doc/progs/image_package5.go
deleted file mode 100644
index 0bb5c7608e..0000000000
--- a/doc/progs/image_package5.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "image"
- "image/color"
-)
-
-func main() {
- m := image.NewRGBA(image.Rect(0, 0, 640, 480))
- m.Set(5, 5, color.RGBA{255, 0, 0, 255})
- fmt.Println(m.At(5, 5))
-}
diff --git a/doc/progs/image_package6.go b/doc/progs/image_package6.go
deleted file mode 100644
index 62eeecdb92..0000000000
--- a/doc/progs/image_package6.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "image"
-)
-
-func main() {
- m0 := image.NewRGBA(image.Rect(0, 0, 8, 5))
- m1 := m0.SubImage(image.Rect(1, 2, 5, 5)).(*image.RGBA)
- fmt.Println(m0.Bounds().Dx(), m1.Bounds().Dx()) // prints 8, 4
- fmt.Println(m0.Stride == m1.Stride) // prints true
-}
diff --git a/doc/progs/interface.go b/doc/progs/interface.go
deleted file mode 100644
index c2925d590d..0000000000
--- a/doc/progs/interface.go
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2012 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.
-
-// This file contains the code snippets included in "The Laws of Reflection."
-
-package main
-
-import (
- "bufio"
- "bytes"
- "io"
- "os"
-)
-
-type MyInt int
-
-var i int
-var j MyInt
-
-// STOP OMIT
-
-// Reader is the interface that wraps the basic Read method.
-type Reader interface {
- Read(p []byte) (n int, err error)
-}
-
-// Writer is the interface that wraps the basic Write method.
-type Writer interface {
- Write(p []byte) (n int, err error)
-}
-
-// STOP OMIT
-
-func readers() { // OMIT
- var r io.Reader
- r = os.Stdin
- r = bufio.NewReader(r)
- r = new(bytes.Buffer)
- // and so on
- // STOP OMIT
-}
-
-func typeAssertions() (interface{}, error) { // OMIT
- var r io.Reader
- tty, err := os.OpenFile("/dev/tty", os.O_RDWR, 0)
- if err != nil {
- return nil, err
- }
- r = tty
- // STOP OMIT
- var w io.Writer
- w = r.(io.Writer)
- // STOP OMIT
- var empty interface{}
- empty = w
- // STOP OMIT
- return empty, err
-}
-
-func main() {
-}
diff --git a/doc/progs/interface2.go b/doc/progs/interface2.go
deleted file mode 100644
index a541d94e48..0000000000
--- a/doc/progs/interface2.go
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright 2012 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.
-
-// This file contains the code snippets included in "The Laws of Reflection."
-
-package main
-
-import (
- "fmt"
- "reflect"
-)
-
-func main() {
- var x float64 = 3.4
- fmt.Println("type:", reflect.TypeOf(x))
- // STOP OMIT
- // TODO(proppy): test output OMIT
-}
-
-// STOP main OMIT
-
-func f1() {
- // START f1 OMIT
- var x float64 = 3.4
- v := reflect.ValueOf(x)
- fmt.Println("type:", v.Type())
- fmt.Println("kind is float64:", v.Kind() == reflect.Float64)
- fmt.Println("value:", v.Float())
- // STOP OMIT
-}
-
-func f2() {
- // START f2 OMIT
- var x uint8 = 'x'
- v := reflect.ValueOf(x)
- fmt.Println("type:", v.Type()) // uint8.
- fmt.Println("kind is uint8: ", v.Kind() == reflect.Uint8) // true.
- x = uint8(v.Uint()) // v.Uint returns a uint64.
- // STOP OMIT
-}
-
-func f3() {
- // START f3 OMIT
- type MyInt int
- var x MyInt = 7
- v := reflect.ValueOf(x)
- // STOP OMIT
- // START f3b OMIT
- y := v.Interface().(float64) // y will have type float64.
- fmt.Println(y)
- // STOP OMIT
- // START f3c OMIT
- fmt.Println(v.Interface())
- // STOP OMIT
- // START f3d OMIT
- fmt.Printf("value is %7.1e\n", v.Interface())
- // STOP OMIT
-}
-
-func f4() {
- // START f4 OMIT
- var x float64 = 3.4
- v := reflect.ValueOf(x)
- v.SetFloat(7.1) // Error: will panic.
- // STOP OMIT
-}
-
-func f5() {
- // START f5 OMIT
- var x float64 = 3.4
- v := reflect.ValueOf(x)
- fmt.Println("settability of v:", v.CanSet())
- // STOP OMIT
-}
-
-func f6() {
- // START f6 OMIT
- var x float64 = 3.4
- v := reflect.ValueOf(x)
- // STOP OMIT
- // START f6b OMIT
- v.SetFloat(7.1)
- // STOP OMIT
-}
-
-func f7() {
- // START f7 OMIT
- var x float64 = 3.4
- p := reflect.ValueOf(&x) // Note: take the address of x.
- fmt.Println("type of p:", p.Type())
- fmt.Println("settability of p:", p.CanSet())
- // STOP OMIT
- // START f7b OMIT
- v := p.Elem()
- fmt.Println("settability of v:", v.CanSet())
- // STOP OMIT
- // START f7c OMIT
- v.SetFloat(7.1)
- fmt.Println(v.Interface())
- fmt.Println(x)
- // STOP OMIT
-}
-
-func f8() {
- // START f8 OMIT
- type T struct {
- A int
- B string
- }
- t := T{23, "skidoo"}
- s := reflect.ValueOf(&t).Elem()
- typeOfT := s.Type()
- for i := 0; i < s.NumField(); i++ {
- f := s.Field(i)
- fmt.Printf("%d: %s %s = %v\n", i,
- typeOfT.Field(i).Name, f.Type(), f.Interface())
- }
- // STOP OMIT
- // START f8b OMIT
- s.Field(0).SetInt(77)
- s.Field(1).SetString("Sunset Strip")
- fmt.Println("t is now", t)
- // STOP OMIT
-}
-
-func f9() {
- // START f9 OMIT
- var x float64 = 3.4
- fmt.Println("value:", reflect.ValueOf(x))
- // STOP OMIT
-}
diff --git a/doc/progs/json1.go b/doc/progs/json1.go
deleted file mode 100644
index 9804efbaae..0000000000
--- a/doc/progs/json1.go
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "encoding/json"
- "log"
- "reflect"
-)
-
-type Message struct {
- Name string
- Body string
- Time int64
-}
-
-// STOP OMIT
-
-func Encode() {
- m := Message{"Alice", "Hello", 1294706395881547000}
- b, err := json.Marshal(m)
-
- if err != nil {
- panic(err)
- }
-
- expected := []byte(`{"Name":"Alice","Body":"Hello","Time":1294706395881547000}`)
- if !reflect.DeepEqual(b, expected) {
- log.Panicf("Error marshaling %q, expected %q, got %q.", m, expected, b)
- }
-
-}
-
-func Decode() {
- b := []byte(`{"Name":"Alice","Body":"Hello","Time":1294706395881547000}`)
- var m Message
- err := json.Unmarshal(b, &m)
-
- if err != nil {
- panic(err)
- }
-
- expected := Message{
- Name: "Alice",
- Body: "Hello",
- Time: 1294706395881547000,
- }
-
- if !reflect.DeepEqual(m, expected) {
- log.Panicf("Error unmarshaling %q, expected %q, got %q.", b, expected, m)
- }
-
- m = Message{
- Name: "Alice",
- Body: "Hello",
- Time: 1294706395881547000,
- }
-
- // STOP OMIT
-}
-
-func PartialDecode() {
- b := []byte(`{"Name":"Bob","Food":"Pickle"}`)
- var m Message
- err := json.Unmarshal(b, &m)
-
- // STOP OMIT
-
- if err != nil {
- panic(err)
- }
-
- expected := Message{
- Name: "Bob",
- }
-
- if !reflect.DeepEqual(expected, m) {
- log.Panicf("Error unmarshaling %q, expected %q, got %q.", b, expected, m)
- }
-}
-
-func main() {
- Encode()
- Decode()
- PartialDecode()
-}
diff --git a/doc/progs/json2.go b/doc/progs/json2.go
deleted file mode 100644
index 6089ae6710..0000000000
--- a/doc/progs/json2.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "fmt"
- "math"
-)
-
-func InterfaceExample() {
- var i interface{}
- i = "a string"
- i = 2011
- i = 2.777
-
- // STOP OMIT
-
- r := i.(float64)
- fmt.Println("the circle's area", math.Pi*r*r)
-
- // STOP OMIT
-
- switch v := i.(type) {
- case int:
- fmt.Println("twice i is", v*2)
- case float64:
- fmt.Println("the reciprocal of i is", 1/v)
- case string:
- h := len(v) / 2
- fmt.Println("i swapped by halves is", v[h:]+v[:h])
- default:
- // i isn't one of the types above
- }
-
- // STOP OMIT
-}
-
-func main() {
- InterfaceExample()
-}
diff --git a/doc/progs/json3.go b/doc/progs/json3.go
deleted file mode 100644
index 442c155b08..0000000000
--- a/doc/progs/json3.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "encoding/json"
- "fmt"
- "log"
- "reflect"
-)
-
-func Decode() {
- b := []byte(`{"Name":"Wednesday","Age":6,"Parents":["Gomez","Morticia"]}`)
-
- var f interface{}
- err := json.Unmarshal(b, &f)
-
- // STOP OMIT
-
- if err != nil {
- panic(err)
- }
-
- expected := map[string]interface{}{
- "Name": "Wednesday",
- "Age": float64(6),
- "Parents": []interface{}{
- "Gomez",
- "Morticia",
- },
- }
-
- if !reflect.DeepEqual(f, expected) {
- log.Panicf("Error unmarshaling %q, expected %q, got %q", b, expected, f)
- }
-
- f = map[string]interface{}{
- "Name": "Wednesday",
- "Age": 6,
- "Parents": []interface{}{
- "Gomez",
- "Morticia",
- },
- }
-
- // STOP OMIT
-
- m := f.(map[string]interface{})
-
- for k, v := range m {
- switch vv := v.(type) {
- case string:
- fmt.Println(k, "is string", vv)
- case int:
- fmt.Println(k, "is int", vv)
- case []interface{}:
- fmt.Println(k, "is an array:")
- for i, u := range vv {
- fmt.Println(i, u)
- }
- default:
- fmt.Println(k, "is of a type I don't know how to handle")
- }
- }
-
- // STOP OMIT
-}
-
-func main() {
- Decode()
-}
diff --git a/doc/progs/json4.go b/doc/progs/json4.go
deleted file mode 100644
index 1c7e5b4cfa..0000000000
--- a/doc/progs/json4.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "encoding/json"
- "log"
- "reflect"
-)
-
-type FamilyMember struct {
- Name string
- Age int
- Parents []string
-}
-
-// STOP OMIT
-
-func Decode() {
- b := []byte(`{"Name":"Bob","Age":20,"Parents":["Morticia", "Gomez"]}`)
- var m FamilyMember
- err := json.Unmarshal(b, &m)
-
- // STOP OMIT
-
- if err != nil {
- panic(err)
- }
-
- expected := FamilyMember{
- Name: "Bob",
- Age: 20,
- Parents: []string{"Morticia", "Gomez"},
- }
-
- if !reflect.DeepEqual(expected, m) {
- log.Panicf("Error unmarshaling %q, expected %q, got %q", b, expected, m)
- }
-}
-
-func main() {
- Decode()
-}
diff --git a/doc/progs/json5.go b/doc/progs/json5.go
deleted file mode 100644
index 6d7a4ca8c4..0000000000
--- a/doc/progs/json5.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "encoding/json"
- "log"
- "os"
-)
-
-func main() {
- dec := json.NewDecoder(os.Stdin)
- enc := json.NewEncoder(os.Stdout)
- for {
- var v map[string]interface{}
- if err := dec.Decode(&v); err != nil {
- log.Println(err)
- return
- }
- for k := range v {
- if k != "Name" {
- delete(v, k)
- }
- }
- if err := enc.Encode(&v); err != nil {
- log.Println(err)
- }
- }
-}
diff --git a/doc/progs/run.go b/doc/progs/run.go
deleted file mode 100644
index 8ac75cdcff..0000000000
--- a/doc/progs/run.go
+++ /dev/null
@@ -1,229 +0,0 @@
-// Copyright 2015 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.
-
-// run runs the docs tests found in this directory.
-package main
-
-import (
- "bytes"
- "flag"
- "fmt"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "regexp"
- "runtime"
- "strings"
- "time"
-)
-
-const usage = `go run run.go [tests]
-
-run.go runs the docs tests in this directory.
-If no tests are provided, it runs all tests.
-Tests may be specified without their .go suffix.
-`
-
-func main() {
- start := time.Now()
-
- flag.Usage = func() {
- fmt.Fprintf(os.Stderr, usage)
- flag.PrintDefaults()
- os.Exit(2)
- }
-
- flag.Parse()
- if flag.NArg() == 0 {
- // run all tests
- fixcgo()
- } else {
- // run specified tests
- onlyTest(flag.Args()...)
- }
-
- tmpdir, err := ioutil.TempDir("", "go-progs")
- if err != nil {
- fmt.Fprintln(os.Stderr, err)
- os.Exit(1)
- }
-
- // ratec limits the number of tests running concurrently.
- // None of the tests are intensive, so don't bother
- // trying to manually adjust for slow builders.
- ratec := make(chan bool, runtime.NumCPU())
- errc := make(chan error, len(tests))
-
- for _, tt := range tests {
- tt := tt
- ratec <- true
- go func() {
- errc <- test(tmpdir, tt.file, tt.want)
- <-ratec
- }()
- }
-
- var rc int
- for range tests {
- if err := <-errc; err != nil {
- fmt.Fprintln(os.Stderr, err)
- rc = 1
- }
- }
- os.Remove(tmpdir)
- if rc == 0 {
- fmt.Printf("ok\t%s\t%s\n", filepath.Base(os.Args[0]), time.Since(start).Round(time.Millisecond))
- }
- os.Exit(rc)
-}
-
-// test builds the test in the given file.
-// If want is non-empty, test also runs the test
-// and checks that the output matches the regexp want.
-func test(tmpdir, file, want string) error {
- // Build the program.
- prog := filepath.Join(tmpdir, file+".exe")
- cmd := exec.Command("go", "build", "-o", prog, file+".go")
- out, err := cmd.CombinedOutput()
- if err != nil {
- return fmt.Errorf("go build %s.go failed: %v\nOutput:\n%s", file, err, out)
- }
- defer os.Remove(prog)
-
- // Only run the test if we have output to check.
- if want == "" {
- return nil
- }
-
- cmd = exec.Command(prog)
- out, err = cmd.CombinedOutput()
- if err != nil {
- return fmt.Errorf("%s failed: %v\nOutput:\n%s", file, err, out)
- }
-
- // Canonicalize output.
- out = bytes.TrimRight(out, "\n")
- out = bytes.ReplaceAll(out, []byte{'\n'}, []byte{' '})
-
- // Check the result.
- match, err := regexp.Match(want, out)
- if err != nil {
- return fmt.Errorf("failed to parse regexp %q: %v", want, err)
- }
- if !match {
- return fmt.Errorf("%s.go:\n%q\ndoes not match %s", file, out, want)
- }
-
- return nil
-}
-
-type testcase struct {
- file string
- want string
-}
-
-var tests = []testcase{
- // defer_panic_recover
- {"defer", `^0 3210 2$`},
- {"defer2", `^Calling g. Printing in g 0 Printing in g 1 Printing in g 2 Printing in g 3 Panicking! Defer in g 3 Defer in g 2 Defer in g 1 Defer in g 0 Recovered in f 4 Returned normally from f.$`},
-
- // effective_go
- {"eff_bytesize", `^1.00YB 9.09TB$`},
- {"eff_qr", ""},
- {"eff_sequence", `^\[-1 2 6 16 44\]$`},
- {"eff_unused2", ""},
-
- // error_handling
- {"error", ""},
- {"error2", ""},
- {"error3", ""},
- {"error4", ""},
-
- // law_of_reflection
- {"interface", ""},
- {"interface2", `^type: float64$`},
-
- // c_go_cgo
- {"cgo1", ""},
- {"cgo2", ""},
- {"cgo3", ""},
- {"cgo4", ""},
-
- // timeout
- {"timeout1", ""},
- {"timeout2", ""},
-
- // gobs
- {"gobs1", ""},
- {"gobs2", ""},
-
- // json
- {"json1", `^$`},
- {"json2", `the reciprocal of i is`},
- {"json3", `Age is int 6`},
- {"json4", `^$`},
- {"json5", ""},
-
- // image_package
- {"image_package1", `^X is 2 Y is 1$`},
- {"image_package2", `^3 4 false$`},
- {"image_package3", `^3 4 true$`},
- {"image_package4", `^image.Point{X:2, Y:1}$`},
- {"image_package5", `^{255 0 0 255}$`},
- {"image_package6", `^8 4 true$`},
-
- // other
- {"go1", `^Christmas is a holiday: true .*go1.go already exists$`},
- {"slices", ""},
-}
-
-func onlyTest(files ...string) {
- var new []testcase
-NextFile:
- for _, file := range files {
- file = strings.TrimSuffix(file, ".go")
- for _, tt := range tests {
- if tt.file == file {
- new = append(new, tt)
- continue NextFile
- }
- }
- fmt.Fprintf(os.Stderr, "test %s.go not found\n", file)
- os.Exit(1)
- }
- tests = new
-}
-
-func skipTest(file string) {
- for i, tt := range tests {
- if tt.file == file {
- copy(tests[i:], tests[i+1:])
- tests = tests[:len(tests)-1]
- return
- }
- }
- panic("delete(" + file + "): not found")
-}
-
-func fixcgo() {
- if os.Getenv("CGO_ENABLED") != "1" {
- skipTest("cgo1")
- skipTest("cgo2")
- skipTest("cgo3")
- skipTest("cgo4")
- return
- }
-
- switch runtime.GOOS {
- case "freebsd":
- // cgo1 and cgo2 don't run on freebsd, srandom has a different signature
- skipTest("cgo1")
- skipTest("cgo2")
- case "netbsd":
- // cgo1 and cgo2 don't run on netbsd, srandom has a different signature
- skipTest("cgo1")
- skipTest("cgo2")
- }
-}
diff --git a/doc/progs/slices.go b/doc/progs/slices.go
deleted file mode 100644
index 967a3e76bd..0000000000
--- a/doc/progs/slices.go
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2012 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.
-
-package main
-
-import (
- "io/ioutil"
- "regexp"
-)
-
-func AppendByte(slice []byte, data ...byte) []byte {
- m := len(slice)
- n := m + len(data)
- if n > cap(slice) { // if necessary, reallocate
- // allocate double what's needed, for future growth.
- newSlice := make([]byte, (n+1)*2)
- copy(newSlice, slice)
- slice = newSlice
- }
- slice = slice[0:n]
- copy(slice[m:n], data)
- return slice
-}
-
-// STOP OMIT
-
-// Filter returns a new slice holding only
-// the elements of s that satisfy fn.
-func Filter(s []int, fn func(int) bool) []int {
- var p []int // == nil
- for _, i := range s {
- if fn(i) {
- p = append(p, i)
- }
- }
- return p
-}
-
-// STOP OMIT
-
-var digitRegexp = regexp.MustCompile("[0-9]+")
-
-func FindDigits(filename string) []byte {
- b, _ := ioutil.ReadFile(filename)
- return digitRegexp.Find(b)
-}
-
-// STOP OMIT
-
-func CopyDigits(filename string) []byte {
- b, _ := ioutil.ReadFile(filename)
- b = digitRegexp.Find(b)
- c := make([]byte, len(b))
- copy(c, b)
- return c
-}
-
-// STOP OMIT
-
-func main() {
- // place holder; no need to run
-}
diff --git a/doc/progs/timeout1.go b/doc/progs/timeout1.go
deleted file mode 100644
index 353ba6908e..0000000000
--- a/doc/progs/timeout1.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 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.
-
-package timeout
-
-import (
- "time"
-)
-
-func Timeout() {
- ch := make(chan bool, 1)
- timeout := make(chan bool, 1)
- go func() {
- time.Sleep(1 * time.Second)
- timeout <- true
- }()
-
- // STOP OMIT
-
- select {
- case <-ch:
- // a read from ch has occurred
- case <-timeout:
- // the read from ch has timed out
- }
-
- // STOP OMIT
-}
diff --git a/doc/progs/timeout2.go b/doc/progs/timeout2.go
deleted file mode 100644
index b0d34eabf8..0000000000
--- a/doc/progs/timeout2.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2012 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.
-
-package query
-
-type Conn string
-
-func (c Conn) DoQuery(query string) Result {
- return Result("result")
-}
-
-type Result string
-
-func Query(conns []Conn, query string) Result {
- ch := make(chan Result, 1)
- for _, conn := range conns {
- go func(c Conn) {
- select {
- case ch <- c.DoQuery(query):
- default:
- }
- }(conn)
- }
- return <-ch
-}
-
-// STOP OMIT
diff --git a/doc/share.png b/doc/share.png
deleted file mode 100644
index c04f0c71aa..0000000000
--- a/doc/share.png
+++ /dev/null
Binary files differ
diff --git a/doc/tos.html b/doc/tos.html
deleted file mode 100644
index fff46428ec..0000000000
--- a/doc/tos.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<!--{
- "Title": "Terms of service"
-}-->
-
-<p>
-The Go website (the "Website") is hosted by Google.
-By using and/or visiting the Website, you consent to be bound by Google's general
-<a href="//www.google.com/intl/en/policies/terms/">Terms of Service</a>
-and Google's general
-<a href="//www.google.com/intl/en/privacy/privacy-policy.html">Privacy Policy</a>.
-</p>
diff --git a/misc/cgo/test/callback.go b/misc/cgo/test/callback.go
index 814888e3ac..08dd9b39d8 100644
--- a/misc/cgo/test/callback.go
+++ b/misc/cgo/test/callback.go
@@ -182,7 +182,7 @@ func testCallbackCallers(t *testing.T) {
"runtime.cgocallbackg1",
"runtime.cgocallbackg",
"runtime.cgocallback",
- "runtime.asmcgocall",
+ "runtime.systemstack_switch",
"runtime.cgocall",
"test._Cfunc_callback",
"test.nestedCall.func1",
diff --git a/misc/cgo/test/testdata/issue9400/asm_386.s b/misc/cgo/test/testdata/issue9400/asm_386.s
index 7f158b5c39..96b8b60c10 100644
--- a/misc/cgo/test/testdata/issue9400/asm_386.s
+++ b/misc/cgo/test/testdata/issue9400/asm_386.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_amd64x.s b/misc/cgo/test/testdata/issue9400/asm_amd64x.s
index 48b86190a5..99509bce5e 100644
--- a/misc/cgo/test/testdata/issue9400/asm_amd64x.s
+++ b/misc/cgo/test/testdata/issue9400/asm_amd64x.s
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build amd64 amd64p32
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_arm.s b/misc/cgo/test/testdata/issue9400/asm_arm.s
index 96c278520f..cc92856c2f 100644
--- a/misc/cgo/test/testdata/issue9400/asm_arm.s
+++ b/misc/cgo/test/testdata/issue9400/asm_arm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_arm64.s b/misc/cgo/test/testdata/issue9400/asm_arm64.s
index 2ebbfcca3b..2565793f9a 100644
--- a/misc/cgo/test/testdata/issue9400/asm_arm64.s
+++ b/misc/cgo/test/testdata/issue9400/asm_arm64.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_mips64x.s b/misc/cgo/test/testdata/issue9400/asm_mips64x.s
index 63dc90605e..693231ddfe 100644
--- a/misc/cgo/test/testdata/issue9400/asm_mips64x.s
+++ b/misc/cgo/test/testdata/issue9400/asm_mips64x.s
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build mips64 mips64le
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_mipsx.s b/misc/cgo/test/testdata/issue9400/asm_mipsx.s
index 7a92735194..63261bbf9d 100644
--- a/misc/cgo/test/testdata/issue9400/asm_mipsx.s
+++ b/misc/cgo/test/testdata/issue9400/asm_mipsx.s
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build mips mipsle
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_ppc64x.s b/misc/cgo/test/testdata/issue9400/asm_ppc64x.s
index c88ec3b21e..b5613fb6ec 100644
--- a/misc/cgo/test/testdata/issue9400/asm_ppc64x.s
+++ b/misc/cgo/test/testdata/issue9400/asm_ppc64x.s
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build ppc64 ppc64le
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_riscv64.s b/misc/cgo/test/testdata/issue9400/asm_riscv64.s
index 20fcc0066d..244dadac35 100644
--- a/misc/cgo/test/testdata/issue9400/asm_riscv64.s
+++ b/misc/cgo/test/testdata/issue9400/asm_riscv64.s
@@ -3,7 +3,7 @@
// license that can be found in the LICENSE file.
// +build riscv64
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/test/testdata/issue9400/asm_s390x.s b/misc/cgo/test/testdata/issue9400/asm_s390x.s
index fc9ad724c1..4856492958 100644
--- a/misc/cgo/test/testdata/issue9400/asm_s390x.s
+++ b/misc/cgo/test/testdata/issue9400/asm_s390x.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/testplugin/plugin_test.go b/misc/cgo/testplugin/plugin_test.go
index 9055dbda04..2d991012c8 100644
--- a/misc/cgo/testplugin/plugin_test.go
+++ b/misc/cgo/testplugin/plugin_test.go
@@ -201,12 +201,11 @@ func TestMethod(t *testing.T) {
// Exported symbol's method must be live.
goCmd(t, "build", "-buildmode=plugin", "-o", "plugin.so", "./method/plugin.go")
goCmd(t, "build", "-o", "method.exe", "./method/main.go")
+ run(t, "./method.exe")
+}
- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
- defer cancel()
- cmd := exec.CommandContext(ctx, "./method.exe")
- out, err := cmd.CombinedOutput()
- if err != nil {
- t.Fatalf("%s: %v\n%s", strings.Join(cmd.Args, " "), err, out)
- }
+func TestMethod2(t *testing.T) {
+ goCmd(t, "build", "-buildmode=plugin", "-o", "method2.so", "./method2/plugin.go")
+ goCmd(t, "build", "-o", "method2.exe", "./method2/main.go")
+ run(t, "./method2.exe")
}
diff --git a/misc/cgo/testplugin/testdata/method2/main.go b/misc/cgo/testplugin/testdata/method2/main.go
new file mode 100644
index 0000000000..6a87e7b6a0
--- /dev/null
+++ b/misc/cgo/testplugin/testdata/method2/main.go
@@ -0,0 +1,32 @@
+// Copyright 2021 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.
+
+// A type can be passed to a plugin and converted to interface
+// there. So its methods need to be live.
+
+package main
+
+import (
+ "plugin"
+
+ "testplugin/method2/p"
+)
+
+var t p.T
+
+type I interface { M() }
+
+func main() {
+ pl, err := plugin.Open("method2.so")
+ if err != nil {
+ panic(err)
+ }
+
+ f, err := pl.Lookup("F")
+ if err != nil {
+ panic(err)
+ }
+
+ f.(func(p.T) interface{})(t).(I).M()
+}
diff --git a/misc/cgo/testplugin/testdata/method2/p/p.go b/misc/cgo/testplugin/testdata/method2/p/p.go
new file mode 100644
index 0000000000..acb526acec
--- /dev/null
+++ b/misc/cgo/testplugin/testdata/method2/p/p.go
@@ -0,0 +1,9 @@
+// Copyright 2021 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.
+
+package p
+
+type T int
+
+func (T) M() { println("M") }
diff --git a/misc/cgo/testplugin/testdata/method2/plugin.go b/misc/cgo/testplugin/testdata/method2/plugin.go
new file mode 100644
index 0000000000..6198e7648e
--- /dev/null
+++ b/misc/cgo/testplugin/testdata/method2/plugin.go
@@ -0,0 +1,11 @@
+// Copyright 2021 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.
+
+package main
+
+import "testplugin/method2/p"
+
+func main() {}
+
+func F(t p.T) interface{} { return t }
diff --git a/misc/cgo/testshared/testdata/depBase/asm.s b/misc/cgo/testshared/testdata/depBase/asm.s
index a8acf77f0b..0f1111f392 100644
--- a/misc/cgo/testshared/testdata/depBase/asm.s
+++ b/misc/cgo/testshared/testdata/depBase/asm.s
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
#include "textflag.h"
diff --git a/misc/cgo/testshared/testdata/depBase/stubs.go b/misc/cgo/testshared/testdata/depBase/stubs.go
index 04534f38dd..c77953803b 100644
--- a/misc/cgo/testshared/testdata/depBase/stubs.go
+++ b/misc/cgo/testshared/testdata/depBase/stubs.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+// +build gc
package depBase
diff --git a/src/archive/tar/stat_actime1.go b/src/archive/tar/stat_actime1.go
index 1bdd1c9dcb..4fdf2a04b3 100644
--- a/src/archive/tar/stat_actime1.go
+++ b/src/archive/tar/stat_actime1.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || linux || dragonfly || openbsd || solaris
// +build aix linux dragonfly openbsd solaris
package tar
diff --git a/src/archive/tar/stat_actime2.go b/src/archive/tar/stat_actime2.go
index 6f17dbe307..5a9a35cbb4 100644
--- a/src/archive/tar/stat_actime2.go
+++ b/src/archive/tar/stat_actime2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || freebsd || netbsd
// +build darwin freebsd netbsd
package tar
diff --git a/src/archive/tar/stat_unix.go b/src/archive/tar/stat_unix.go
index 581d87dca9..3957349d6e 100644
--- a/src/archive/tar/stat_unix.go
+++ b/src/archive/tar/stat_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || linux || darwin || dragonfly || freebsd || openbsd || netbsd || solaris
// +build aix linux darwin dragonfly freebsd openbsd netbsd solaris
package tar
diff --git a/src/archive/tar/strconv.go b/src/archive/tar/strconv.go
index 6d0a403808..f0b61e6dba 100644
--- a/src/archive/tar/strconv.go
+++ b/src/archive/tar/strconv.go
@@ -265,8 +265,27 @@ func parsePAXRecord(s string) (k, v, r string, err error) {
return "", "", s, ErrHeader
}
+ afterSpace := int64(sp + 1)
+ beforeLastNewLine := n - 1
+ // In some cases, "length" was perhaps padded/malformed, and
+ // trying to index past where the space supposedly is goes past
+ // the end of the actual record.
+ // For example:
+ // "0000000000000000000000000000000030 mtime=1432668921.098285006\n30 ctime=2147483649.15163319"
+ // ^ ^
+ // | |
+ // | afterSpace=35
+ // |
+ // beforeLastNewLine=29
+ // yet indexOf(firstSpace) MUST BE before endOfRecord.
+ //
+ // See https://golang.org/issues/40196.
+ if afterSpace >= beforeLastNewLine {
+ return "", "", s, ErrHeader
+ }
+
// Extract everything between the space and the final newline.
- rec, nl, rem := s[sp+1:n-1], s[n-1:n], s[n:]
+ rec, nl, rem := s[afterSpace:beforeLastNewLine], s[beforeLastNewLine:n], s[n:]
if nl != "\n" {
return "", "", s, ErrHeader
}
diff --git a/src/archive/tar/strconv_test.go b/src/archive/tar/strconv_test.go
index dd3505a758..add65e272a 100644
--- a/src/archive/tar/strconv_test.go
+++ b/src/archive/tar/strconv_test.go
@@ -368,6 +368,13 @@ func TestParsePAXRecord(t *testing.T) {
{"16 longkeyname=hahaha\n", "16 longkeyname=hahaha\n", "", "", false},
{"3 somelongkey=\n", "3 somelongkey=\n", "", "", false},
{"50 tooshort=\n", "50 tooshort=\n", "", "", false},
+ {"0000000000000000000000000000000030 mtime=1432668921.098285006\n30 ctime=2147483649.15163319", "0000000000000000000000000000000030 mtime=1432668921.098285006\n30 ctime=2147483649.15163319", "mtime", "1432668921.098285006", false},
+ {"06 k=v\n", "06 k=v\n", "", "", false},
+ {"00006 k=v\n", "00006 k=v\n", "", "", false},
+ {"000006 k=v\n", "000006 k=v\n", "", "", false},
+ {"000000 k=v\n", "000000 k=v\n", "", "", false},
+ {"0 k=v\n", "0 k=v\n", "", "", false},
+ {"+0000005 x=\n", "+0000005 x=\n", "", "", false},
}
for _, v := range vectors {
diff --git a/src/bufio/bufio.go b/src/bufio/bufio.go
index 6baf9b9e40..ec928e7ad6 100644
--- a/src/bufio/bufio.go
+++ b/src/bufio/bufio.go
@@ -670,7 +670,8 @@ func (b *Writer) WriteByte(c byte) error {
// WriteRune writes a single Unicode code point, returning
// the number of bytes written and any error.
func (b *Writer) WriteRune(r rune) (size int, err error) {
- if r < utf8.RuneSelf {
+ // Compare as uint32 to correctly handle negative runes.
+ if uint32(r) < utf8.RuneSelf {
err = b.WriteByte(byte(r))
if err != nil {
return 0, err
diff --git a/src/bufio/bufio_test.go b/src/bufio/bufio_test.go
index d7b34bd0d8..ebcc711db9 100644
--- a/src/bufio/bufio_test.go
+++ b/src/bufio/bufio_test.go
@@ -534,6 +534,20 @@ func TestReadWriteRune(t *testing.T) {
}
}
+func TestWriteInvalidRune(t *testing.T) {
+ // Invalid runes, including negative ones, should be written as the
+ // replacement character.
+ for _, r := range []rune{-1, utf8.MaxRune + 1} {
+ var buf bytes.Buffer
+ w := NewWriter(&buf)
+ w.WriteRune(r)
+ w.Flush()
+ if s := buf.String(); s != "\uFFFD" {
+ t.Errorf("WriteRune(%d) wrote %q, not replacement character", r, s)
+ }
+ }
+}
+
func TestReadStringAllocs(t *testing.T) {
r := strings.NewReader(" foo foo 42 42 42 42 42 42 42 42 4.2 4.2 4.2 4.2\n")
buf := NewReader(r)
diff --git a/src/bytes/boundary_test.go b/src/bytes/boundary_test.go
index ea84f1e40f..5a47526593 100644
--- a/src/bytes/boundary_test.go
+++ b/src/bytes/boundary_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
+//go:build linux
// +build linux
package bytes_test
diff --git a/src/bytes/buffer.go b/src/bytes/buffer.go
index f19a4cfff0..549b077708 100644
--- a/src/bytes/buffer.go
+++ b/src/bytes/buffer.go
@@ -275,7 +275,8 @@ func (b *Buffer) WriteByte(c byte) error {
// included to match bufio.Writer's WriteRune. The buffer is grown as needed;
// if it becomes too large, WriteRune will panic with ErrTooLarge.
func (b *Buffer) WriteRune(r rune) (n int, err error) {
- if r < utf8.RuneSelf {
+ // Compare as uint32 to correctly handle negative runes.
+ if uint32(r) < utf8.RuneSelf {
b.WriteByte(byte(r))
return 1, nil
}
diff --git a/src/bytes/buffer_test.go b/src/bytes/buffer_test.go
index fec5ef8a35..9c9b7440ff 100644
--- a/src/bytes/buffer_test.go
+++ b/src/bytes/buffer_test.go
@@ -6,6 +6,7 @@ package bytes_test
import (
. "bytes"
+ "fmt"
"io"
"math/rand"
"testing"
@@ -387,6 +388,16 @@ func TestRuneIO(t *testing.T) {
}
}
+func TestWriteInvalidRune(t *testing.T) {
+ // Invalid runes, including negative ones, should be written as
+ // utf8.RuneError.
+ for _, r := range []rune{-1, utf8.MaxRune + 1} {
+ var buf Buffer
+ buf.WriteRune(r)
+ check(t, fmt.Sprintf("TestWriteInvalidRune (%d)", r), &buf, "\uFFFD")
+ }
+}
+
func TestNext(t *testing.T) {
b := []byte{0, 1, 2, 3, 4}
tmp := make([]byte, 5)
diff --git a/src/cmd/api/run.go b/src/cmd/api/run.go
index ecb1d0f81a..8c9fb723a5 100644
--- a/src/cmd/api/run.go
+++ b/src/cmd/api/run.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// The run program is invoked via the dist tool.
diff --git a/src/cmd/asm/internal/arch/arch.go b/src/cmd/asm/internal/arch/arch.go
index a62e55191e..026d8abf81 100644
--- a/src/cmd/asm/internal/arch/arch.go
+++ b/src/cmd/asm/internal/arch/arch.go
@@ -109,6 +109,10 @@ func archX86(linkArch *obj.LinkArch) *Arch {
register["SB"] = RSB
register["FP"] = RFP
register["PC"] = RPC
+ if linkArch == &x86.Linkamd64 {
+ // Alias g to R14
+ register["g"] = x86.REGG
+ }
// Register prefix not used on this architecture.
instructions := make(map[string]obj.As)
diff --git a/src/cmd/asm/internal/asm/asm.go b/src/cmd/asm/internal/asm/asm.go
index c4032759bb..06867cd507 100644
--- a/src/cmd/asm/internal/asm/asm.go
+++ b/src/cmd/asm/internal/asm/asm.go
@@ -811,10 +811,7 @@ func (p *Parser) asmInstruction(op obj.As, cond string, a []obj.Addr) {
} else {
mask = (^uint32(0) >> uint(mask2+1)) & (^uint32(0) << uint(31-(mask1-1)))
}
- prog.SetFrom3(obj.Addr{
- Type: obj.TYPE_CONST,
- Offset: int64(mask),
- })
+ prog.SetFrom3Const(int64(mask))
prog.To = a[4]
break
}
diff --git a/src/cmd/asm/internal/asm/endtoend_test.go b/src/cmd/asm/internal/asm/endtoend_test.go
index 7472507caf..92cf64575b 100644
--- a/src/cmd/asm/internal/asm/endtoend_test.go
+++ b/src/cmd/asm/internal/asm/endtoend_test.go
@@ -36,6 +36,7 @@ func testEndToEnd(t *testing.T, goarch, file string) {
var ok bool
testOut = new(bytes.Buffer) // The assembler writes test output to this buffer.
ctxt.Bso = bufio.NewWriter(os.Stdout)
+ ctxt.IsAsm = true
defer ctxt.Bso.Flush()
failed := false
ctxt.DiagFunc = func(format string, args ...interface{}) {
@@ -278,6 +279,7 @@ func testErrors(t *testing.T, goarch, file string) {
var ok bool
testOut = new(bytes.Buffer) // The assembler writes test output to this buffer.
ctxt.Bso = bufio.NewWriter(os.Stdout)
+ ctxt.IsAsm = true
defer ctxt.Bso.Flush()
failed := false
var errBuf bytes.Buffer
@@ -437,8 +439,12 @@ func TestPPC64EndToEnd(t *testing.T) {
testEndToEnd(t, "ppc64", "ppc64")
}
-func TestRISCVEncoder(t *testing.T) {
- testEndToEnd(t, "riscv64", "riscvenc")
+func TestRISCVEndToEnd(t *testing.T) {
+ testEndToEnd(t, "riscv64", "riscv64")
+}
+
+func TestRISCVErrors(t *testing.T) {
+ testErrors(t, "riscv64", "riscv64error")
}
func TestS390XEndToEnd(t *testing.T) {
diff --git a/src/cmd/asm/internal/asm/operand_test.go b/src/cmd/asm/internal/asm/operand_test.go
index 2e83e176b2..c6def15e20 100644
--- a/src/cmd/asm/internal/asm/operand_test.go
+++ b/src/cmd/asm/internal/asm/operand_test.go
@@ -259,6 +259,7 @@ var amd64OperandTests = []operandTest{
{"R15", "R15"},
{"R8", "R8"},
{"R9", "R9"},
+ {"g", "R14"},
{"SI", "SI"},
{"SP", "SP"},
{"X0", "X0"},
diff --git a/src/cmd/asm/internal/asm/testdata/riscvenc.s b/src/cmd/asm/internal/asm/testdata/riscv64.s
index 9a49d96ca0..9a49d96ca0 100644
--- a/src/cmd/asm/internal/asm/testdata/riscvenc.s
+++ b/src/cmd/asm/internal/asm/testdata/riscv64.s
diff --git a/src/cmd/asm/internal/asm/testdata/riscv64error.s b/src/cmd/asm/internal/asm/testdata/riscv64error.s
new file mode 100644
index 0000000000..fb43e68fc1
--- /dev/null
+++ b/src/cmd/asm/internal/asm/testdata/riscv64error.s
@@ -0,0 +1,14 @@
+// Copyright 2021 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.
+
+TEXT errors(SB),$0
+ MOV $0, 0(SP) // ERROR "constant load must target register"
+ MOV $0, 8(SP) // ERROR "constant load must target register"
+ MOV $1234, 0(SP) // ERROR "constant load must target register"
+ MOV $1234, 8(SP) // ERROR "constant load must target register"
+ MOVB $1, X5 // ERROR "unsupported constant load"
+ MOVH $1, X5 // ERROR "unsupported constant load"
+ MOVW $1, X5 // ERROR "unsupported constant load"
+ MOVF $1, X5 // ERROR "unsupported constant load"
+ RET
diff --git a/src/cmd/asm/internal/flags/flags.go b/src/cmd/asm/internal/flags/flags.go
index 1335860315..dd947c7b5b 100644
--- a/src/cmd/asm/internal/flags/flags.go
+++ b/src/cmd/asm/internal/flags/flags.go
@@ -32,11 +32,13 @@ var (
D MultiFlag
I MultiFlag
PrintOut int
+ DebugV bool
)
func init() {
flag.Var(&D, "D", "predefined symbol with optional simple value -D=identifier=value; can be set multiple times")
flag.Var(&I, "I", "include directory; can be set multiple times")
+ flag.BoolVar(&DebugV, "v", false, "print debug output")
objabi.AddVersionFlag() // -V
objabi.Flagcount("S", "print assembly and machine code", &PrintOut)
}
diff --git a/src/cmd/asm/main.go b/src/cmd/asm/main.go
index 31636e3045..98618a67ef 100644
--- a/src/cmd/asm/main.go
+++ b/src/cmd/asm/main.go
@@ -36,6 +36,7 @@ func main() {
ctxt := obj.Linknew(architecture.LinkArch)
ctxt.Debugasm = flags.PrintOut
+ ctxt.Debugvlog = flags.DebugV
ctxt.Flag_dynlink = *flags.Dynlink
ctxt.Flag_linkshared = *flags.Linkshared
ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index b5e28e3254..775f20b09f 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -1566,9 +1566,17 @@ func (p *Package) gccMachine() []string {
case "s390x":
return []string{"-m64"}
case "mips64", "mips64le":
- return []string{"-mabi=64"}
+ if gomips64 == "hardfloat" {
+ return []string{"-mabi=64", "-mhard-float"}
+ } else if gomips64 == "softfloat" {
+ return []string{"-mabi=64", "-msoft-float"}
+ }
case "mips", "mipsle":
- return []string{"-mabi=32"}
+ if gomips == "hardfloat" {
+ return []string{"-mabi=32", "-mfp32", "-mhard-float", "-mno-odd-spreg"}
+ } else if gomips == "softfloat" {
+ return []string{"-mabi=32", "-msoft-float"}
+ }
}
return nil
}
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go
index c1116e28ec..5767c54307 100644
--- a/src/cmd/cgo/main.go
+++ b/src/cmd/cgo/main.go
@@ -245,7 +245,7 @@ var importRuntimeCgo = flag.Bool("import_runtime_cgo", true, "import runtime/cgo
var importSyscall = flag.Bool("import_syscall", true, "import syscall in generated code")
var trimpath = flag.String("trimpath", "", "applies supplied rewrites or trims prefixes to recorded source file paths")
-var goarch, goos string
+var goarch, goos, gomips, gomips64 string
func main() {
objabi.AddVersionFlag() // -V
@@ -405,6 +405,8 @@ func newPackage(args []string) *Package {
if s := os.Getenv("GOOS"); s != "" {
goos = s
}
+ gomips = objabi.GOMIPS
+ gomips64 = objabi.GOMIPS64
ptrSize := ptrSizeMap[goarch]
if ptrSize == 0 {
fatalf("unknown ptrSize for $GOARCH %q", goarch)
diff --git a/src/cmd/compile/internal-abi.md b/src/cmd/compile/internal-abi.md
index f4ef2cc869..b457f6ee74 100644
--- a/src/cmd/compile/internal-abi.md
+++ b/src/cmd/compile/internal-abi.md
@@ -153,6 +153,7 @@ Assigning a receiver, argument, or result V of underlying type T works
as follows:
1. Remember I and FP.
+1. If T has zero size, add T to the stack sequence S and return.
1. Try to register-assign V.
1. If step 2 failed, reset I and FP to the values from step 1, add T
to the stack sequence S, and assign V to this field in S.
@@ -295,6 +296,15 @@ An architecture may still define register meanings that aren’t
compatible with ABI0, but these differences should be easy to account
for in the compiler.
+The assignment algorithm assigns zero-sized values to the stack
+(assignment step 2) in order to support ABI0-equivalence.
+While these values take no space themselves, they do result in
+alignment padding on the stack in ABI0.
+Without this step, the internal ABI would register-assign zero-sized
+values even on architectures that provide no argument registers
+because they don't consume any registers, and hence not add alignment
+padding to the stack.
+
The algorithm reserves spill space for arguments in the caller’s frame
so that the compiler can generate a stack growth path that spills into
this reserved space.
@@ -402,9 +412,6 @@ Special-purpose registers are as follows:
| R15 | GOT reference temporary | Fixed if dynlink |
| X15 | Zero value | Fixed |
-TODO: We may start with the existing TLS-based g and move to R14
-later.
-
*Rationale*: These register meanings are compatible with Go’s
stack-based calling convention except for R14 and X15, which will have
to be restored on transitions from ABI0 code to ABIInternal code.
@@ -455,13 +462,12 @@ The arithmetic status flags are treated like scratch registers and not
preserved across calls.
All other bits in RFLAGS are system flags.
-The CPU is always in MMX technology state (not x87 mode).
+At function calls and returns, the CPU is in x87 mode (not MMX
+technology mode).
-*Rationale*: Go on amd64 uses the XMM registers and never uses the x87
-registers, so it makes sense to assume the CPU is in MMX mode.
-Otherwise, any function that used the XMM registers would have to
-execute an EMMS instruction before calling another function or
-returning (this is the case in the SysV ABI).
+*Rationale*: Go on amd64 does not use either the x87 registers or MMX
+registers. Hence, we follow the SysV platform conventions in order to
+simplify transitions to and from the C ABI.
At calls, the MXCSR control bits are always set as follows:
diff --git a/src/cmd/compile/internal/abi/abiutils.go b/src/cmd/compile/internal/abi/abiutils.go
index e935821802..3eab4b8d8b 100644
--- a/src/cmd/compile/internal/abi/abiutils.go
+++ b/src/cmd/compile/internal/abi/abiutils.go
@@ -27,9 +27,15 @@ type ABIParamResultInfo struct {
outparams []ABIParamAssignment
offsetToSpillArea int64
spillAreaSize int64
+ inRegistersUsed int
+ outRegistersUsed int
config *ABIConfig // to enable String() method
}
+func (a *ABIParamResultInfo) Config() *ABIConfig {
+ return a.config
+}
+
func (a *ABIParamResultInfo) InParams() []ABIParamAssignment {
return a.inparams
}
@@ -38,12 +44,20 @@ func (a *ABIParamResultInfo) OutParams() []ABIParamAssignment {
return a.outparams
}
-func (a *ABIParamResultInfo) InParam(i int) ABIParamAssignment {
- return a.inparams[i]
+func (a *ABIParamResultInfo) InRegistersUsed() int {
+ return a.inRegistersUsed
}
-func (a *ABIParamResultInfo) OutParam(i int) ABIParamAssignment {
- return a.outparams[i]
+func (a *ABIParamResultInfo) OutRegistersUsed() int {
+ return a.outRegistersUsed
+}
+
+func (a *ABIParamResultInfo) InParam(i int) *ABIParamAssignment {
+ return &a.inparams[i]
+}
+
+func (a *ABIParamResultInfo) OutParam(i int) *ABIParamAssignment {
+ return &a.outparams[i]
}
func (a *ABIParamResultInfo) SpillAreaOffset() int64 {
@@ -68,10 +82,11 @@ type RegIndex uint8
// ABIParamAssignment holds information about how a specific param or
// result will be passed: in registers (in which case 'Registers' is
// populated) or on the stack (in which case 'Offset' is set to a
-// non-negative stack offset. The values in 'Registers' are indices (as
-// described above), not architected registers.
+// non-negative stack offset. The values in 'Registers' are indices
+// (as described above), not architected registers.
type ABIParamAssignment struct {
Type *types.Type
+ Name types.Object // should always be *ir.Name, used to match with a particular ssa.OpArg.
Registers []RegIndex
offset int32
}
@@ -96,6 +111,18 @@ func (a *ABIParamAssignment) SpillOffset() int32 {
return a.offset
}
+// FrameOffset returns the location that a value would spill to, if any exists.
+// For register-allocated inputs, that is their spill offset reserved for morestack
+// (might as well use it, it is there); for stack-allocated inputs and outputs,
+// that is their location on the stack. For register-allocated outputs, there is
+// no defined spill area, so return -1.
+func (a *ABIParamAssignment) FrameOffset(i *ABIParamResultInfo) int64 {
+ if len(a.Registers) == 0 || a.offset == -1 {
+ return int64(a.offset)
+ }
+ return int64(a.offset) + i.SpillAreaOffset()
+}
+
// RegAmounts holds a specified number of integer/float registers.
type RegAmounts struct {
intRegs int
@@ -106,94 +133,216 @@ type RegAmounts struct {
// by the ABI rules for parameter passing and result returning.
type ABIConfig struct {
// Do we need anything more than this?
+ offsetForLocals int64 // e.g., obj.(*Link).FixedFrameSize() -- extra linkage information on some architectures.
regAmounts RegAmounts
regsForTypeCache map[*types.Type]int
}
// NewABIConfig returns a new ABI configuration for an architecture with
// iRegsCount integer/pointer registers and fRegsCount floating point registers.
-func NewABIConfig(iRegsCount, fRegsCount int) *ABIConfig {
- return &ABIConfig{regAmounts: RegAmounts{iRegsCount, fRegsCount}, regsForTypeCache: make(map[*types.Type]int)}
+func NewABIConfig(iRegsCount, fRegsCount int, offsetForLocals int64) *ABIConfig {
+ return &ABIConfig{offsetForLocals: offsetForLocals, regAmounts: RegAmounts{iRegsCount, fRegsCount}, regsForTypeCache: make(map[*types.Type]int)}
+}
+
+// Copy returns a copy of an ABIConfig for use in a function's compilation so that access to the cache does not need to be protected with a mutex.
+func (a *ABIConfig) Copy() *ABIConfig {
+ b := *a
+ b.regsForTypeCache = make(map[*types.Type]int)
+ return &b
+}
+
+// LocalsOffset returns the architecture-dependent offset from SP for args and results.
+// In theory this is only used for debugging; it ought to already be incorporated into
+// results from the ABI-related methods
+func (a *ABIConfig) LocalsOffset() int64 {
+ return a.offsetForLocals
+}
+
+// FloatIndexFor translates r into an index in the floating point parameter
+// registers. If the result is negative, the input index was actually for the
+// integer parameter registers.
+func (a *ABIConfig) FloatIndexFor(r RegIndex) int64 {
+ return int64(r) - int64(a.regAmounts.intRegs)
}
// NumParamRegs returns the number of parameter registers used for a given type,
// without regard for the number available.
func (a *ABIConfig) NumParamRegs(t *types.Type) int {
+ var n int
if n, ok := a.regsForTypeCache[t]; ok {
return n
}
if t.IsScalar() || t.IsPtrShaped() {
- var n int
if t.IsComplex() {
n = 2
} else {
n = (int(t.Size()) + types.RegSize - 1) / types.RegSize
}
- a.regsForTypeCache[t] = n
- return n
- }
- typ := t.Kind()
- n := 0
- switch typ {
- case types.TARRAY:
- n = a.NumParamRegs(t.Elem()) * int(t.NumElem())
- case types.TSTRUCT:
- for _, f := range t.FieldSlice() {
- n += a.NumParamRegs(f.Type)
+ } else {
+ typ := t.Kind()
+ switch typ {
+ case types.TARRAY:
+ n = a.NumParamRegs(t.Elem()) * int(t.NumElem())
+ case types.TSTRUCT:
+ for _, f := range t.FieldSlice() {
+ n += a.NumParamRegs(f.Type)
+ }
+ case types.TSLICE:
+ n = a.NumParamRegs(synthSlice)
+ case types.TSTRING:
+ n = a.NumParamRegs(synthString)
+ case types.TINTER:
+ n = a.NumParamRegs(synthIface)
}
- case types.TSLICE:
- n = a.NumParamRegs(synthSlice)
- case types.TSTRING:
- n = a.NumParamRegs(synthString)
- case types.TINTER:
- n = a.NumParamRegs(synthIface)
}
a.regsForTypeCache[t] = n
+
return n
}
-// ABIAnalyze takes a function type 't' and an ABI rules description
+// preAllocateParams gets the slice sizes right for inputs and outputs.
+func (a *ABIParamResultInfo) preAllocateParams(hasRcvr bool, nIns, nOuts int) {
+ if hasRcvr {
+ nIns++
+ }
+ a.inparams = make([]ABIParamAssignment, 0, nIns)
+ a.outparams = make([]ABIParamAssignment, 0, nOuts)
+}
+
+// ABIAnalyzeTypes takes an optional receiver type, arrays of ins and outs, and returns an ABIParamResultInfo,
+// based on the given configuration. This is the same result computed by config.ABIAnalyze applied to the
+// corresponding method/function type, except that all the embedded parameter names are nil.
+// This is intended for use by ssagen/ssa.go:(*state).rtcall, for runtime functions that lack a parsed function type.
+func (config *ABIConfig) ABIAnalyzeTypes(rcvr *types.Type, ins, outs []*types.Type) *ABIParamResultInfo {
+ setup()
+ s := assignState{
+ stackOffset: config.offsetForLocals,
+ rTotal: config.regAmounts,
+ }
+ result := &ABIParamResultInfo{config: config}
+ result.preAllocateParams(rcvr != nil, len(ins), len(outs))
+
+ // Receiver
+ if rcvr != nil {
+ result.inparams = append(result.inparams,
+ s.assignParamOrReturn(rcvr, nil, false))
+ }
+
+ // Inputs
+ for _, t := range ins {
+ result.inparams = append(result.inparams,
+ s.assignParamOrReturn(t, nil, false))
+ }
+ s.stackOffset = types.Rnd(s.stackOffset, int64(types.RegSize))
+ result.inRegistersUsed = s.rUsed.intRegs + s.rUsed.floatRegs
+
+ // Outputs
+ s.rUsed = RegAmounts{}
+ for _, t := range outs {
+ result.outparams = append(result.outparams, s.assignParamOrReturn(t, nil, true))
+ }
+ // The spill area is at a register-aligned offset and its size is rounded up to a register alignment.
+ // TODO in theory could align offset only to minimum required by spilled data types.
+ result.offsetToSpillArea = alignTo(s.stackOffset, types.RegSize)
+ result.spillAreaSize = alignTo(s.spillOffset, types.RegSize)
+ result.outRegistersUsed = s.rUsed.intRegs + s.rUsed.floatRegs
+
+ return result
+}
+
+// ABIAnalyzeFuncType takes a function type 'ft' and an ABI rules description
// 'config' and analyzes the function to determine how its parameters
// and results will be passed (in registers or on the stack), returning
// an ABIParamResultInfo object that holds the results of the analysis.
-func (config *ABIConfig) ABIAnalyze(t *types.Type) ABIParamResultInfo {
+func (config *ABIConfig) ABIAnalyzeFuncType(ft *types.Func) *ABIParamResultInfo {
setup()
s := assignState{
- rTotal: config.regAmounts,
+ stackOffset: config.offsetForLocals,
+ rTotal: config.regAmounts,
}
- result := ABIParamResultInfo{config: config}
+ result := &ABIParamResultInfo{config: config}
+ result.preAllocateParams(ft.Receiver != nil, ft.Params.NumFields(), ft.Results.NumFields())
// Receiver
- ft := t.FuncType()
- if t.NumRecvs() != 0 {
- rfsl := ft.Receiver.FieldSlice()
+ // TODO(register args) ? seems like "struct" and "fields" is not right anymore for describing function parameters
+ if ft.Receiver != nil && ft.Receiver.NumFields() != 0 {
+ r := ft.Receiver.FieldSlice()[0]
result.inparams = append(result.inparams,
- s.assignParamOrReturn(rfsl[0].Type, false))
+ s.assignParamOrReturn(r.Type, r.Nname, false))
}
// Inputs
ifsl := ft.Params.FieldSlice()
for _, f := range ifsl {
result.inparams = append(result.inparams,
- s.assignParamOrReturn(f.Type, false))
+ s.assignParamOrReturn(f.Type, f.Nname, false))
}
s.stackOffset = types.Rnd(s.stackOffset, int64(types.RegSize))
+ result.inRegistersUsed = s.rUsed.intRegs + s.rUsed.floatRegs
// Outputs
s.rUsed = RegAmounts{}
ofsl := ft.Results.FieldSlice()
for _, f := range ofsl {
- result.outparams = append(result.outparams, s.assignParamOrReturn(f.Type, true))
+ result.outparams = append(result.outparams, s.assignParamOrReturn(f.Type, f.Nname, true))
}
// The spill area is at a register-aligned offset and its size is rounded up to a register alignment.
// TODO in theory could align offset only to minimum required by spilled data types.
result.offsetToSpillArea = alignTo(s.stackOffset, types.RegSize)
result.spillAreaSize = alignTo(s.spillOffset, types.RegSize)
+ result.outRegistersUsed = s.rUsed.intRegs + s.rUsed.floatRegs
+ return result
+}
+// ABIAnalyze returns the same result as ABIAnalyzeFuncType, but also
+// updates the offsets of all the receiver, input, and output fields.
+func (config *ABIConfig) ABIAnalyze(t *types.Type) *ABIParamResultInfo {
+ ft := t.FuncType()
+ result := config.ABIAnalyzeFuncType(ft)
+ // Fill in the frame offsets for receiver, inputs, results
+ k := 0
+ if t.NumRecvs() != 0 {
+ config.updateOffset(result, ft.Receiver.FieldSlice()[0], result.inparams[0], false)
+ k++
+ }
+ for i, f := range ft.Params.FieldSlice() {
+ config.updateOffset(result, f, result.inparams[k+i], false)
+ }
+ for i, f := range ft.Results.FieldSlice() {
+ config.updateOffset(result, f, result.outparams[i], true)
+ }
return result
}
+// parameterUpdateMu protects the Offset field of function/method parameters (a subset of structure Fields)
+var parameterUpdateMu sync.Mutex
+
+// FieldOffsetOf returns a concurency-safe version of f.Offset
+func FieldOffsetOf(f *types.Field) int64 {
+ parameterUpdateMu.Lock()
+ defer parameterUpdateMu.Unlock()
+ return f.Offset
+}
+
+func (config *ABIConfig) updateOffset(result *ABIParamResultInfo, f *types.Field, a ABIParamAssignment, isReturn bool) {
+ // Everything except return values in registers has either a frame home (if not in a register) or a frame spill location.
+ if !isReturn || len(a.Registers) == 0 {
+ // The type frame offset DOES NOT show effects of minimum frame size.
+ // Getting this wrong breaks stackmaps, see liveness/plive.go:WriteFuncMap and typebits/typebits.go:Set
+ parameterUpdateMu.Lock()
+ defer parameterUpdateMu.Unlock()
+ off := a.FrameOffset(result) - config.LocalsOffset()
+ fOffset := f.Offset
+ if fOffset == types.BOGUS_FUNARG_OFFSET {
+ // Set the Offset the first time. After that, we may recompute it, but it should never change.
+ f.Offset = off
+ } else if fOffset != off {
+ panic(fmt.Errorf("Offset changed from %d to %d", fOffset, off))
+ }
+ }
+}
+
//......................................................................
//
// Non-public portions.
@@ -292,7 +441,7 @@ func (state *assignState) allocateRegs() []RegIndex {
// regAllocate creates a register ABIParamAssignment object for a param
// or result with the specified type, as a final step (this assumes
// that all of the safety/suitability analysis is complete).
-func (state *assignState) regAllocate(t *types.Type, isReturn bool) ABIParamAssignment {
+func (state *assignState) regAllocate(t *types.Type, name types.Object, isReturn bool) ABIParamAssignment {
spillLoc := int64(-1)
if !isReturn {
// Spill for register-resident t must be aligned for storage of a t.
@@ -301,6 +450,7 @@ func (state *assignState) regAllocate(t *types.Type, isReturn bool) ABIParamAssi
}
return ABIParamAssignment{
Type: t,
+ Name: name,
Registers: state.allocateRegs(),
offset: int32(spillLoc),
}
@@ -309,9 +459,10 @@ func (state *assignState) regAllocate(t *types.Type, isReturn bool) ABIParamAssi
// stackAllocate creates a stack memory ABIParamAssignment object for
// a param or result with the specified type, as a final step (this
// assumes that all of the safety/suitability analysis is complete).
-func (state *assignState) stackAllocate(t *types.Type) ABIParamAssignment {
+func (state *assignState) stackAllocate(t *types.Type, name types.Object) ABIParamAssignment {
return ABIParamAssignment{
Type: t,
+ Name: name,
offset: int32(state.stackSlot(t)),
}
}
@@ -444,18 +595,18 @@ func (state *assignState) regassign(pt *types.Type) bool {
}
// assignParamOrReturn processes a given receiver, param, or result
-// of type 'pt' to determine whether it can be register assigned.
+// of field f to determine whether it can be register assigned.
// The result of the analysis is recorded in the result
// ABIParamResultInfo held in 'state'.
-func (state *assignState) assignParamOrReturn(pt *types.Type, isReturn bool) ABIParamAssignment {
+func (state *assignState) assignParamOrReturn(pt *types.Type, n types.Object, isReturn bool) ABIParamAssignment {
state.pUsed = RegAmounts{}
if pt.Width == types.BADWIDTH {
panic("should never happen")
} else if pt.Width == 0 {
- return state.stackAllocate(pt)
+ return state.stackAllocate(pt, n)
} else if state.regassign(pt) {
- return state.regAllocate(pt, isReturn)
+ return state.regAllocate(pt, n, isReturn)
} else {
- return state.stackAllocate(pt)
+ return state.stackAllocate(pt, n)
}
}
diff --git a/src/cmd/compile/internal/amd64/ggen.go b/src/cmd/compile/internal/amd64/ggen.go
index dacdb07a38..14c3bd1129 100644
--- a/src/cmd/compile/internal/amd64/ggen.go
+++ b/src/cmd/compile/internal/amd64/ggen.go
@@ -22,8 +22,8 @@ var isPlan9 = objabi.GOOS == "plan9"
const (
dzBlocks = 16 // number of MOV/ADD blocks
dzBlockLen = 4 // number of clears per block
- dzBlockSize = 19 // size of instructions in a single block
- dzMovSize = 4 // size of single MOV instruction w/ offset
+ dzBlockSize = 23 // size of instructions in a single block
+ dzMovSize = 5 // size of single MOV instruction w/ offset
dzLeaqSize = 4 // size of single LEAQ instruction
dzClearStep = 16 // number of bytes cleared by each MOV instruction
@@ -56,8 +56,8 @@ func dzDI(b int64) int64 {
func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, state *uint32) *obj.Prog {
const (
- ax = 1 << iota
- x0
+ ax = 1 << iota // if AX is already zeroed.
+ x15 // if X15 is already zeroed. Note: in new ABI, X15 is always zero.
)
if cnt == 0 {
@@ -85,29 +85,29 @@ func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, state *uint32) *obj.
}
p = pp.Append(p, x86.AMOVQ, obj.TYPE_REG, x86.REG_AX, 0, obj.TYPE_MEM, x86.REG_SP, off)
} else if !isPlan9 && cnt <= int64(8*types.RegSize) {
- if *state&x0 == 0 {
- p = pp.Append(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_REG, x86.REG_X0, 0)
- *state |= x0
+ if objabi.Regabi_enabled == 0 && *state&x15 == 0 {
+ p = pp.Append(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_REG, x86.REG_X15, 0)
+ *state |= x15
}
for i := int64(0); i < cnt/16; i++ {
- p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_MEM, x86.REG_SP, off+i*16)
+ p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off+i*16)
}
if cnt%16 != 0 {
- p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_MEM, x86.REG_SP, off+cnt-int64(16))
+ p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_SP, off+cnt-int64(16))
}
} else if !isPlan9 && (cnt <= int64(128*types.RegSize)) {
- if *state&x0 == 0 {
- p = pp.Append(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_REG, x86.REG_X0, 0)
- *state |= x0
+ if objabi.Regabi_enabled == 0 && *state&x15 == 0 {
+ p = pp.Append(p, x86.AXORPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_REG, x86.REG_X15, 0)
+ *state |= x15
}
p = pp.Append(p, leaptr, obj.TYPE_MEM, x86.REG_SP, off+dzDI(cnt), obj.TYPE_REG, x86.REG_DI, 0)
p = pp.Append(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_ADDR, 0, dzOff(cnt))
p.To.Sym = ir.Syms.Duffzero
if cnt%16 != 0 {
- p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X0, 0, obj.TYPE_MEM, x86.REG_DI, -int64(8))
+ p = pp.Append(p, x86.AMOVUPS, obj.TYPE_REG, x86.REG_X15, 0, obj.TYPE_MEM, x86.REG_DI, -int64(8))
}
} else {
if *state&ax == 0 {
diff --git a/src/cmd/compile/internal/amd64/ssa.go b/src/cmd/compile/internal/amd64/ssa.go
index da355c49d1..d83d78f080 100644
--- a/src/cmd/compile/internal/amd64/ssa.go
+++ b/src/cmd/compile/internal/amd64/ssa.go
@@ -16,6 +16,7 @@ import (
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/obj/x86"
+ "cmd/internal/objabi"
)
// markMoves marks any MOVXconst ops that need to avoid clobbering flags.
@@ -166,16 +167,41 @@ func duff(size int64) (int64, int64) {
return off, adj
}
+func getgFromTLS(s *ssagen.State, r int16) {
+ // See the comments in cmd/internal/obj/x86/obj6.go
+ // near CanUse1InsnTLS for a detailed explanation of these instructions.
+ if x86.CanUse1InsnTLS(base.Ctxt) {
+ // MOVQ (TLS), r
+ p := s.Prog(x86.AMOVQ)
+ p.From.Type = obj.TYPE_MEM
+ p.From.Reg = x86.REG_TLS
+ p.To.Type = obj.TYPE_REG
+ p.To.Reg = r
+ } else {
+ // MOVQ TLS, r
+ // MOVQ (r)(TLS*1), r
+ p := s.Prog(x86.AMOVQ)
+ p.From.Type = obj.TYPE_REG
+ p.From.Reg = x86.REG_TLS
+ p.To.Type = obj.TYPE_REG
+ p.To.Reg = r
+ q := s.Prog(x86.AMOVQ)
+ q.From.Type = obj.TYPE_MEM
+ q.From.Reg = r
+ q.From.Index = x86.REG_TLS
+ q.From.Scale = 1
+ q.To.Type = obj.TYPE_REG
+ q.To.Reg = r
+ }
+}
+
func ssaGenValue(s *ssagen.State, v *ssa.Value) {
switch v.Op {
case ssa.OpAMD64VFMADD231SD:
p := s.Prog(v.Op.Asm())
p.From = obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[2].Reg()}
p.To = obj.Addr{Type: obj.TYPE_REG, Reg: v.Reg()}
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[1].Reg()})
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
+ p.SetFrom3Reg(v.Args[1].Reg())
case ssa.OpAMD64ADDQ, ssa.OpAMD64ADDL:
r := v.Reg()
r1 := v.Args[0].Reg()
@@ -225,11 +251,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpAMD64BTSL, ssa.OpAMD64BTSQ,
ssa.OpAMD64BTCL, ssa.OpAMD64BTCQ,
ssa.OpAMD64BTRL, ssa.OpAMD64BTRQ:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
- opregreg(s, v.Op.Asm(), r, v.Args[1].Reg())
+ opregreg(s, v.Op.Asm(), v.Reg(), v.Args[1].Reg())
case ssa.OpAMD64DIVQU, ssa.OpAMD64DIVLU, ssa.OpAMD64DIVWU:
// Arg[0] (the dividend) is in AX.
@@ -372,20 +394,16 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
// compute (x+y)/2 unsigned.
// Do a 64-bit add, the overflow goes into the carry.
// Shift right once and pull the carry back into the 63rd bit.
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(x86.AADDQ)
p.From.Type = obj.TYPE_REG
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
p.From.Reg = v.Args[1].Reg()
p = s.Prog(x86.ARCRQ)
p.From.Type = obj.TYPE_CONST
p.From.Offset = 1
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpAMD64ADDQcarry, ssa.OpAMD64ADCQ:
r := v.Reg0()
@@ -501,21 +519,13 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpAMD64CMOVQCS, ssa.OpAMD64CMOVLCS, ssa.OpAMD64CMOVWCS,
ssa.OpAMD64CMOVQGTF, ssa.OpAMD64CMOVLGTF, ssa.OpAMD64CMOVWGTF,
ssa.OpAMD64CMOVQGEF, ssa.OpAMD64CMOVLGEF, ssa.OpAMD64CMOVWGEF:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[1].Reg()
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpAMD64CMOVQNEF, ssa.OpAMD64CMOVLNEF, ssa.OpAMD64CMOVWNEF:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
// Flag condition: ^ZERO || PARITY
// Generate:
// CMOV*NE SRC,DST
@@ -524,7 +534,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[1].Reg()
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
var q *obj.Prog
if v.Op == ssa.OpAMD64CMOVQNEF {
q = s.Prog(x86.ACMOVQPS)
@@ -536,14 +546,9 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
q.From.Type = obj.TYPE_REG
q.From.Reg = v.Args[1].Reg()
q.To.Type = obj.TYPE_REG
- q.To.Reg = r
+ q.To.Reg = v.Reg()
case ssa.OpAMD64CMOVQEQF, ssa.OpAMD64CMOVLEQF, ssa.OpAMD64CMOVWEQF:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
-
// Flag condition: ZERO && !PARITY
// Generate:
// MOV SRC,AX
@@ -560,7 +565,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
}
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
- p.From.Reg = r
+ p.From.Reg = v.Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = x86.REG_AX
var q *obj.Prog
@@ -574,7 +579,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
q.From.Type = obj.TYPE_REG
q.From.Reg = x86.REG_AX
q.To.Type = obj.TYPE_REG
- q.To.Reg = r
+ q.To.Reg = v.Reg()
case ssa.OpAMD64MULQconst, ssa.OpAMD64MULLconst:
r := v.Reg()
@@ -583,7 +588,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
p.To.Reg = r
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[0].Reg()})
+ p.SetFrom3Reg(v.Args[0].Reg())
case ssa.OpAMD64SUBQconst, ssa.OpAMD64SUBLconst,
ssa.OpAMD64ANDQconst, ssa.OpAMD64ANDLconst,
@@ -593,15 +598,11 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpAMD64SHRQconst, ssa.OpAMD64SHRLconst, ssa.OpAMD64SHRWconst, ssa.OpAMD64SHRBconst,
ssa.OpAMD64SARQconst, ssa.OpAMD64SARLconst, ssa.OpAMD64SARWconst, ssa.OpAMD64SARBconst,
ssa.OpAMD64ROLQconst, ssa.OpAMD64ROLLconst, ssa.OpAMD64ROLWconst, ssa.OpAMD64ROLBconst:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpAMD64SBBQcarrymask, ssa.OpAMD64SBBLcarrymask:
r := v.Reg()
p := s.Prog(v.Op.Asm())
@@ -813,6 +814,20 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_MEM
p.To.Reg = v.Args[0].Reg()
ssagen.AddAux2(&p.To, v, sc.Off())
+ case ssa.OpAMD64MOVOstorezero:
+ if s.ABI != obj.ABIInternal {
+ v.Fatalf("MOVOstorezero can be only used in ABIInternal functions")
+ }
+ if !(objabi.Regabi_enabled == 1 && base.Flag.ABIWrap) {
+ // zeroing X15 manually if wrappers are not used
+ opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15)
+ }
+ p := s.Prog(v.Op.Asm())
+ p.From.Type = obj.TYPE_REG
+ p.From.Reg = x86.REG_X15
+ p.To.Type = obj.TYPE_MEM
+ p.To.Reg = v.Args[0].Reg()
+ ssagen.AddAux(&p.To, v)
case ssa.OpAMD64MOVQstoreconstidx1, ssa.OpAMD64MOVQstoreconstidx8, ssa.OpAMD64MOVLstoreconstidx1, ssa.OpAMD64MOVLstoreconstidx4, ssa.OpAMD64MOVWstoreconstidx1, ssa.OpAMD64MOVWstoreconstidx2, ssa.OpAMD64MOVBstoreconstidx1,
ssa.OpAMD64ADDLconstmodifyidx1, ssa.OpAMD64ADDLconstmodifyidx4, ssa.OpAMD64ADDLconstmodifyidx8, ssa.OpAMD64ADDQconstmodifyidx1, ssa.OpAMD64ADDQconstmodifyidx8,
ssa.OpAMD64ANDLconstmodifyidx1, ssa.OpAMD64ANDLconstmodifyidx4, ssa.OpAMD64ANDLconstmodifyidx8, ssa.OpAMD64ANDQconstmodifyidx1, ssa.OpAMD64ANDQconstmodifyidx8,
@@ -870,9 +885,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssagen.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
case ssa.OpAMD64ADDLloadidx1, ssa.OpAMD64ADDLloadidx4, ssa.OpAMD64ADDLloadidx8, ssa.OpAMD64ADDQloadidx1, ssa.OpAMD64ADDQloadidx8,
ssa.OpAMD64SUBLloadidx1, ssa.OpAMD64SUBLloadidx4, ssa.OpAMD64SUBLloadidx8, ssa.OpAMD64SUBQloadidx1, ssa.OpAMD64SUBQloadidx8,
ssa.OpAMD64ANDLloadidx1, ssa.OpAMD64ANDLloadidx4, ssa.OpAMD64ANDLloadidx8, ssa.OpAMD64ANDQloadidx1, ssa.OpAMD64ANDQloadidx8,
@@ -896,10 +908,14 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssagen.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
case ssa.OpAMD64DUFFZERO:
+ if s.ABI != obj.ABIInternal {
+ v.Fatalf("MOVOconst can be only used in ABIInternal functions")
+ }
+ if !(objabi.Regabi_enabled == 1 && base.Flag.ABIWrap) {
+ // zeroing X15 manually if wrappers are not used
+ opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15)
+ }
off := duffStart(v.AuxInt)
adj := duffAdj(v.AuxInt)
var p *obj.Prog
@@ -915,12 +931,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_ADDR
p.To.Sym = ir.Syms.Duffzero
p.To.Offset = off
- case ssa.OpAMD64MOVOconst:
- if v.AuxInt != 0 {
- v.Fatalf("MOVOconst can only do constant=0")
- }
- r := v.Reg()
- opregreg(s, x86.AXORPS, r, r)
case ssa.OpAMD64DUFFCOPY:
p := s.Prog(obj.ADUFFCOPY)
p.To.Type = obj.TYPE_ADDR
@@ -974,33 +984,26 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
// Closure pointer is DX.
ssagen.CheckLoweredGetClosurePtr(v)
case ssa.OpAMD64LoweredGetG:
+ if objabi.Regabi_enabled == 1 && base.Flag.ABIWrap {
+ v.Fatalf("LoweredGetG should not appear in new ABI")
+ }
r := v.Reg()
- // See the comments in cmd/internal/obj/x86/obj6.go
- // near CanUse1InsnTLS for a detailed explanation of these instructions.
- if x86.CanUse1InsnTLS(base.Ctxt) {
- // MOVQ (TLS), r
- p := s.Prog(x86.AMOVQ)
- p.From.Type = obj.TYPE_MEM
- p.From.Reg = x86.REG_TLS
- p.To.Type = obj.TYPE_REG
- p.To.Reg = r
- } else {
- // MOVQ TLS, r
- // MOVQ (r)(TLS*1), r
- p := s.Prog(x86.AMOVQ)
- p.From.Type = obj.TYPE_REG
- p.From.Reg = x86.REG_TLS
- p.To.Type = obj.TYPE_REG
- p.To.Reg = r
- q := s.Prog(x86.AMOVQ)
- q.From.Type = obj.TYPE_MEM
- q.From.Reg = r
- q.From.Index = x86.REG_TLS
- q.From.Scale = 1
- q.To.Type = obj.TYPE_REG
- q.To.Reg = r
+ getgFromTLS(s, r)
+ case ssa.OpAMD64CALLstatic:
+ if objabi.Regabi_enabled == 1 && s.ABI == obj.ABI0 && v.Aux.(*ssa.AuxCall).Fn.ABI() == obj.ABIInternal {
+ // zeroing X15 when entering ABIInternal from ABI0
+ opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15)
+ // set G register from TLS
+ getgFromTLS(s, x86.REG_R14)
+ }
+ s.Call(v)
+ if objabi.Regabi_enabled == 1 && s.ABI == obj.ABIInternal && v.Aux.(*ssa.AuxCall).Fn.ABI() == obj.ABI0 {
+ // zeroing X15 when entering ABIInternal from ABI0
+ opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15)
+ // set G register from TLS
+ getgFromTLS(s, x86.REG_R14)
}
- case ssa.OpAMD64CALLstatic, ssa.OpAMD64CALLclosure, ssa.OpAMD64CALLinter:
+ case ssa.OpAMD64CALLclosure, ssa.OpAMD64CALLinter:
s.Call(v)
case ssa.OpAMD64LoweredGetCallerPC:
@@ -1041,24 +1044,16 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
case ssa.OpAMD64NEGQ, ssa.OpAMD64NEGL,
ssa.OpAMD64BSWAPQ, ssa.OpAMD64BSWAPL,
ssa.OpAMD64NOTQ, ssa.OpAMD64NOTL:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpAMD64NEGLflags:
- r := v.Reg0()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg0()
- case ssa.OpAMD64BSFQ, ssa.OpAMD64BSRQ, ssa.OpAMD64BSFL, ssa.OpAMD64BSRL, ssa.OpAMD64SQRTSD:
+ case ssa.OpAMD64BSFQ, ssa.OpAMD64BSRQ, ssa.OpAMD64BSFL, ssa.OpAMD64BSRL, ssa.OpAMD64SQRTSD, ssa.OpAMD64SQRTSS:
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
@@ -1066,7 +1061,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
switch v.Op {
case ssa.OpAMD64BSFQ, ssa.OpAMD64BSRQ:
p.To.Reg = v.Reg0()
- case ssa.OpAMD64BSFL, ssa.OpAMD64BSRL, ssa.OpAMD64SQRTSD:
+ case ssa.OpAMD64BSFL, ssa.OpAMD64BSRL, ssa.OpAMD64SQRTSD, ssa.OpAMD64SQRTSS:
p.To.Reg = v.Reg()
}
case ssa.OpAMD64ROUNDSD:
@@ -1078,7 +1073,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
}
p.From.Offset = val
p.From.Type = obj.TYPE_CONST
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[0].Reg()})
+ p.SetFrom3Reg(v.Args[0].Reg())
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
case ssa.OpAMD64POPCNTQ, ssa.OpAMD64POPCNTL:
@@ -1177,25 +1172,17 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg0()
case ssa.OpAMD64XCHGB, ssa.OpAMD64XCHGL, ssa.OpAMD64XCHGQ:
- r := v.Reg0()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output[0] not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
- p.From.Reg = r
+ p.From.Reg = v.Reg0()
p.To.Type = obj.TYPE_MEM
p.To.Reg = v.Args[1].Reg()
ssagen.AddAux(&p.To, v)
case ssa.OpAMD64XADDLlock, ssa.OpAMD64XADDQlock:
- r := v.Reg0()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output[0] not in same register %s", v.LongString())
- }
s.Prog(x86.ALOCK)
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
- p.From.Reg = r
+ p.From.Reg = v.Reg0()
p.To.Type = obj.TYPE_MEM
p.To.Reg = v.Args[1].Reg()
ssagen.AddAux(&p.To, v)
@@ -1297,6 +1284,12 @@ func ssaGenBlock(s *ssagen.State, b, next *ssa.Block) {
case ssa.BlockRet:
s.Prog(obj.ARET)
case ssa.BlockRetJmp:
+ if objabi.Regabi_enabled == 1 && s.ABI == obj.ABI0 && b.Aux.(*obj.LSym).ABI() == obj.ABIInternal {
+ // zeroing X15 when entering ABIInternal from ABI0
+ opregreg(s, x86.AXORPS, x86.REG_X15, x86.REG_X15)
+ // set G register from TLS
+ getgFromTLS(s, x86.REG_R14)
+ }
p := s.Prog(obj.ARET)
p.To.Type = obj.TYPE_MEM
p.To.Name = obj.NAME_EXTERN
diff --git a/src/cmd/compile/internal/arm/ssa.go b/src/cmd/compile/internal/arm/ssa.go
index 729d2dab2d..7b2fec3765 100644
--- a/src/cmd/compile/internal/arm/ssa.go
+++ b/src/cmd/compile/internal/arm/ssa.go
@@ -173,9 +173,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = y
case ssa.OpARMMOVWnop:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
@@ -282,7 +279,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt >> 8
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: v.AuxInt & 0xff})
+ p.SetFrom3Const(v.AuxInt & 0xff)
p.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
@@ -302,7 +299,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(arm.ABFC)
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(width)
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: int64(lsb)})
+ p.SetFrom3Const(int64(lsb))
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
break
@@ -657,6 +654,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpARMREV,
ssa.OpARMREV16,
ssa.OpARMRBIT,
+ ssa.OpARMSQRTF,
ssa.OpARMSQRTD,
ssa.OpARMNEGF,
ssa.OpARMNEGD,
diff --git a/src/cmd/compile/internal/arm64/ssa.go b/src/cmd/compile/internal/arm64/ssa.go
index 73e74e1219..056a6eb62d 100644
--- a/src/cmd/compile/internal/arm64/ssa.go
+++ b/src/cmd/compile/internal/arm64/ssa.go
@@ -100,9 +100,11 @@ func genIndexedOperand(v *ssa.Value) obj.Addr {
// Reg: base register, Index: (shifted) index register
mop := obj.Addr{Type: obj.TYPE_MEM, Reg: v.Args[0].Reg()}
switch v.Op {
- case ssa.OpARM64MOVDloadidx8, ssa.OpARM64MOVDstoreidx8, ssa.OpARM64MOVDstorezeroidx8:
+ case ssa.OpARM64MOVDloadidx8, ssa.OpARM64MOVDstoreidx8, ssa.OpARM64MOVDstorezeroidx8,
+ ssa.OpARM64FMOVDloadidx8, ssa.OpARM64FMOVDstoreidx8:
mop.Index = arm64.REG_LSL | 3<<5 | v.Args[1].Reg()&31
- case ssa.OpARM64MOVWloadidx4, ssa.OpARM64MOVWUloadidx4, ssa.OpARM64MOVWstoreidx4, ssa.OpARM64MOVWstorezeroidx4:
+ case ssa.OpARM64MOVWloadidx4, ssa.OpARM64MOVWUloadidx4, ssa.OpARM64MOVWstoreidx4, ssa.OpARM64MOVWstorezeroidx4,
+ ssa.OpARM64FMOVSloadidx4, ssa.OpARM64FMOVSstoreidx4:
mop.Index = arm64.REG_LSL | 2<<5 | v.Args[1].Reg()&31
case ssa.OpARM64MOVHloadidx2, ssa.OpARM64MOVHUloadidx2, ssa.OpARM64MOVHstoreidx2, ssa.OpARM64MOVHstorezeroidx2:
mop.Index = arm64.REG_LSL | 1<<5 | v.Args[1].Reg()&31
@@ -140,9 +142,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = y
case ssa.OpARM64MOVDnop:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
@@ -230,7 +229,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.Reg = ra
p.From.Type = obj.TYPE_REG
p.From.Reg = rm
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: rn})
+ p.SetFrom3Reg(rn)
p.To.Type = obj.TYPE_REG
p.To.Reg = rt
case ssa.OpARM64ADDconst,
@@ -293,7 +292,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[0].Reg()})
+ p.SetFrom3Reg(v.Args[0].Reg())
p.Reg = v.Args[1].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
@@ -435,7 +434,9 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpARM64MOVHUloadidx2,
ssa.OpARM64MOVWloadidx4,
ssa.OpARM64MOVWUloadidx4,
- ssa.OpARM64MOVDloadidx8:
+ ssa.OpARM64MOVDloadidx8,
+ ssa.OpARM64FMOVDloadidx8,
+ ssa.OpARM64FMOVSloadidx4:
p := s.Prog(v.Op.Asm())
p.From = genIndexedOperand(v)
p.To.Type = obj.TYPE_REG
@@ -472,7 +473,9 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpARM64FMOVDstoreidx,
ssa.OpARM64MOVHstoreidx2,
ssa.OpARM64MOVWstoreidx4,
- ssa.OpARM64MOVDstoreidx8:
+ ssa.OpARM64FMOVSstoreidx4,
+ ssa.OpARM64MOVDstoreidx8,
+ ssa.OpARM64FMOVDstoreidx8:
p := s.Prog(v.Op.Asm())
p.To = genIndexedOperand(v)
p.From.Type = obj.TYPE_REG
@@ -516,17 +519,13 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssagen.AddAux(&p.To, v)
case ssa.OpARM64BFI,
ssa.OpARM64BFXIL:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt >> 8
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: v.AuxInt & 0xff})
+ p.SetFrom3Const(v.AuxInt & 0xff)
p.Reg = v.Args[1].Reg()
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpARM64SBFIZ,
ssa.OpARM64SBFX,
ssa.OpARM64UBFIZ,
@@ -534,7 +533,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt >> 8
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: v.AuxInt & 0xff})
+ p.SetFrom3Const(v.AuxInt & 0xff)
p.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
@@ -894,6 +893,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpARM64FMOVSgpfp,
ssa.OpARM64FNEGS,
ssa.OpARM64FNEGD,
+ ssa.OpARM64FSQRTS,
ssa.OpARM64FSQRTD,
ssa.OpARM64FCVTZSSW,
ssa.OpARM64FCVTZSDW,
@@ -953,7 +953,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Type = obj.TYPE_REG // assembler encodes conditional bits in Reg
p.From.Reg = condBits[ssa.Op(v.AuxInt)]
p.Reg = v.Args[0].Reg()
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: r1})
+ p.SetFrom3Reg(r1)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
case ssa.OpARM64DUFFZERO:
diff --git a/src/cmd/compile/internal/base/debug.go b/src/cmd/compile/internal/base/debug.go
index 164941bb26..b9fa3d882e 100644
--- a/src/cmd/compile/internal/base/debug.go
+++ b/src/cmd/compile/internal/base/debug.go
@@ -29,28 +29,29 @@ var Debug = DebugFlags{
// The -d option takes a comma-separated list of settings.
// Each setting is name=value; for ints, name is short for name=1.
type DebugFlags struct {
- Append int `help:"print information about append compilation"`
- Checkptr int `help:"instrument unsafe pointer conversions"`
- Closure int `help:"print information about closure compilation"`
- DclStack int `help:"run internal dclstack check"`
- Defer int `help:"print information about defer compilation"`
- DisableNil int `help:"disable nil checks"`
- DumpPtrs int `help:"show Node pointers values in dump output"`
- DwarfInl int `help:"print information about DWARF inlined function creation"`
- Export int `help:"print export data"`
- Fieldtrack *int `help:"enable field tracking"`
- GCProg int `help:"print dump of GC programs"`
- Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
- LocationLists int `help:"print information about DWARF location list creation"`
- Nil int `help:"print information about nil checks"`
- PCTab string `help:"print named pc-value table"`
- Panic int `help:"show all compiler panics"`
- Slice int `help:"print information about slice compilation"`
- SoftFloat int `help:"force compiler to emit soft-float code"`
- TypeAssert int `help:"print information about type assertion inlining"`
- TypecheckInl int `help:"eager typechecking of inline function bodies"`
- WB int `help:"print information about write barriers"`
- ABIWrap int `help:"print information about ABI wrapper generation"`
+ Append int `help:"print information about append compilation"`
+ Checkptr int `help:"instrument unsafe pointer conversions"`
+ Closure int `help:"print information about closure compilation"`
+ DclStack int `help:"run internal dclstack check"`
+ Defer int `help:"print information about defer compilation"`
+ DisableNil int `help:"disable nil checks"`
+ DumpPtrs int `help:"show Node pointers values in dump output"`
+ DwarfInl int `help:"print information about DWARF inlined function creation"`
+ Export int `help:"print export data"`
+ Fieldtrack *int `help:"enable field tracking"`
+ GCProg int `help:"print dump of GC programs"`
+ InlFuncsWithClosures int `help:"allow functions with closures to be inlined"`
+ Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"`
+ LocationLists int `help:"print information about DWARF location list creation"`
+ Nil int `help:"print information about nil checks"`
+ PCTab string `help:"print named pc-value table"`
+ Panic int `help:"show all compiler panics"`
+ Slice int `help:"print information about slice compilation"`
+ SoftFloat int `help:"force compiler to emit soft-float code"`
+ TypeAssert int `help:"print information about type assertion inlining"`
+ TypecheckInl int `help:"eager typechecking of inline function bodies"`
+ WB int `help:"print information about write barriers"`
+ ABIWrap int `help:"print information about ABI wrapper generation"`
any bool // set when any of the values have been set
}
diff --git a/src/cmd/compile/internal/base/flag.go b/src/cmd/compile/internal/base/flag.go
index d8ca9885cb..ade17fc0cd 100644
--- a/src/cmd/compile/internal/base/flag.go
+++ b/src/cmd/compile/internal/base/flag.go
@@ -159,6 +159,7 @@ func ParseFlags() {
Flag.LinkShared = &Ctxt.Flag_linkshared
Flag.Shared = &Ctxt.Flag_shared
Flag.WB = true
+ Debug.InlFuncsWithClosures = 1
Flag.Cfg.ImportMap = make(map[string]string)
diff --git a/src/cmd/compile/internal/dwarfgen/dwarf.go b/src/cmd/compile/internal/dwarfgen/dwarf.go
index dd22c033cc..70168cffeb 100644
--- a/src/cmd/compile/internal/dwarfgen/dwarf.go
+++ b/src/cmd/compile/internal/dwarfgen/dwarf.go
@@ -271,8 +271,7 @@ func createSimpleVar(fnsym *obj.LSym, n *ir.Name) *dwarf.Var {
if base.Ctxt.FixedFrameSize() == 0 {
offs -= int64(types.PtrSize)
}
- if objabi.Framepointer_enabled || objabi.GOARCH == "arm64" {
- // There is a word space for FP on ARM64 even if the frame pointer is disabled
+ if objabi.Framepointer_enabled {
offs -= int64(types.PtrSize)
}
diff --git a/src/cmd/compile/internal/dwarfgen/dwinl.go b/src/cmd/compile/internal/dwarfgen/dwinl.go
index d5687cb1d7..8adb36fc88 100644
--- a/src/cmd/compile/internal/dwarfgen/dwinl.go
+++ b/src/cmd/compile/internal/dwarfgen/dwinl.go
@@ -247,7 +247,8 @@ func makePreinlineDclMap(fnsym *obj.LSym) map[varPos]int {
DeclCol: pos.Col(),
}
if _, found := m[vp]; found {
- base.Fatalf("child dcl collision on symbol %s within %v\n", n.Sym().Name, fnsym.Name)
+ // We can see collisions (variables with the same name/file/line/col) in obfuscated or machine-generated code -- see issue 44378 for an example. Skip duplicates in such cases, since it is unlikely that a human will be debugging such code.
+ continue
}
m[vp] = i
}
diff --git a/src/cmd/compile/internal/dwarfgen/scope.go b/src/cmd/compile/internal/dwarfgen/scope.go
index 1c040edc28..4957e24e44 100644
--- a/src/cmd/compile/internal/dwarfgen/scope.go
+++ b/src/cmd/compile/internal/dwarfgen/scope.go
@@ -37,7 +37,9 @@ func assembleScopes(fnsym *obj.LSym, fn *ir.Func, dwarfVars []*dwarf.Var, varSco
}
scopeVariables(dwarfVars, varScopes, dwarfScopes)
- scopePCs(fnsym, fn.Marks, dwarfScopes)
+ if fnsym.Func().Text != nil {
+ scopePCs(fnsym, fn.Marks, dwarfScopes)
+ }
return compactScopes(dwarfScopes)
}
diff --git a/src/cmd/compile/internal/escape/escape.go b/src/cmd/compile/internal/escape/escape.go
index 58cad73c76..213ef7832d 100644
--- a/src/cmd/compile/internal/escape/escape.go
+++ b/src/cmd/compile/internal/escape/escape.go
@@ -1625,9 +1625,10 @@ func containsClosure(f, c *ir.Func) bool {
// leak records that parameter l leaks to sink.
func (l *location) leakTo(sink *location, derefs int) {
- // If sink is a result parameter and we can fit return bits
- // into the escape analysis tag, then record a return leak.
- if sink.isName(ir.PPARAMOUT) && sink.curfn == l.curfn {
+ // If sink is a result parameter that doesn't escape (#44614)
+ // and we can fit return bits into the escape analysis tag,
+ // then record as a result leak.
+ if !sink.escapes && sink.isName(ir.PPARAMOUT) && sink.curfn == l.curfn {
ri := sink.resultIndex - 1
if ri < numEscResults {
// Leak to result parameter.
diff --git a/src/cmd/compile/internal/gc/bootstrap.go b/src/cmd/compile/internal/gc/bootstrap.go
index 2e13d6b57a..37b0d59ede 100644
--- a/src/cmd/compile/internal/gc/bootstrap.go
+++ b/src/cmd/compile/internal/gc/bootstrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !go1.8
// +build !go1.8
package gc
diff --git a/src/cmd/compile/internal/gc/compile.go b/src/cmd/compile/internal/gc/compile.go
index ba67c58c45..2d7a74a403 100644
--- a/src/cmd/compile/internal/gc/compile.go
+++ b/src/cmd/compile/internal/gc/compile.go
@@ -43,6 +43,9 @@ func enqueueFunc(fn *ir.Func) {
if len(fn.Body) == 0 {
// Initialize ABI wrappers if necessary.
ssagen.InitLSym(fn, false)
+ types.CalcSize(fn.Type()) // TODO register args; remove this once all is done by abiutils
+ a := ssagen.AbiForFunc(fn)
+ a.ABIAnalyze(fn.Type()) // will set parameter spill/home locations correctly
liveness.WriteFuncMap(fn)
return
}
diff --git a/src/cmd/compile/internal/gc/export.go b/src/cmd/compile/internal/gc/export.go
index 356fcfa671..4d8221f53b 100644
--- a/src/cmd/compile/internal/gc/export.go
+++ b/src/cmd/compile/internal/gc/export.go
@@ -25,6 +25,11 @@ func exportf(bout *bio.Writer, format string, args ...interface{}) {
func dumpexport(bout *bio.Writer) {
p := &exporter{marked: make(map[*types.Type]bool)}
for _, n := range typecheck.Target.Exports {
+ // Must catch it here rather than Export(), because the type can be
+ // not fully set (still TFORW) when Export() is called.
+ if n.Type() != nil && n.Type().HasTParam() {
+ base.Fatalf("Cannot (yet) export a generic type: %v", n)
+ }
p.markObject(n)
}
diff --git a/src/cmd/compile/internal/gc/pprof.go b/src/cmd/compile/internal/gc/pprof.go
index 256c659259..5f9b030621 100644
--- a/src/cmd/compile/internal/gc/pprof.go
+++ b/src/cmd/compile/internal/gc/pprof.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.8
// +build go1.8
package gc
diff --git a/src/cmd/compile/internal/gc/trace.go b/src/cmd/compile/internal/gc/trace.go
index c6eb23a090..8cdbd4b0f3 100644
--- a/src/cmd/compile/internal/gc/trace.go
+++ b/src/cmd/compile/internal/gc/trace.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.7
// +build go1.7
package gc
diff --git a/src/cmd/compile/internal/importer/support.go b/src/cmd/compile/internal/importer/support.go
index 4f013f4a51..40b9c7c958 100644
--- a/src/cmd/compile/internal/importer/support.go
+++ b/src/cmd/compile/internal/importer/support.go
@@ -125,20 +125,4 @@ var predeclared = []types2.Type{
type anyType struct{}
func (t anyType) Underlying() types2.Type { return t }
-func (t anyType) Under() types2.Type { return t }
func (t anyType) String() string { return "any" }
-
-// types2.aType is not exported for now so we need to implemented these here.
-func (anyType) Basic() *types2.Basic { return nil }
-func (anyType) Array() *types2.Array { return nil }
-func (anyType) Slice() *types2.Slice { return nil }
-func (anyType) Struct() *types2.Struct { return nil }
-func (anyType) Pointer() *types2.Pointer { return nil }
-func (anyType) Tuple() *types2.Tuple { return nil }
-func (anyType) Signature() *types2.Signature { return nil }
-func (anyType) Sum() *types2.Sum { return nil }
-func (anyType) Interface() *types2.Interface { return nil }
-func (anyType) Map() *types2.Map { return nil }
-func (anyType) Chan() *types2.Chan { return nil }
-func (anyType) Named() *types2.Named { return nil }
-func (anyType) TypeParam() *types2.TypeParam { return nil }
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index 7d70fca6c9..1d049298d7 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -354,15 +354,13 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
return true
case ir.OCLOSURE:
- // TODO(danscales,mdempsky): Get working with -G.
- // Probably after #43818 is fixed.
- if base.Flag.G > 0 {
- v.reason = "inlining closures not yet working with -G"
+ if base.Debug.InlFuncsWithClosures == 0 {
+ v.reason = "not inlining functions with closures"
return true
}
- // TODO(danscales) - fix some bugs when budget is lowered below 15
- // Maybe make budget proportional to number of closure variables, e.g.:
+ // TODO(danscales): Maybe make budget proportional to number of closure
+ // variables, e.g.:
//v.budget -= int32(len(n.(*ir.ClosureExpr).Func.ClosureVars) * 3)
v.budget -= 15
// Scan body of closure (which DoChildren doesn't automatically
@@ -384,6 +382,22 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
case ir.OAPPEND:
v.budget -= inlineExtraAppendCost
+ case ir.ODEREF:
+ // *(*X)(unsafe.Pointer(&x)) is low-cost
+ n := n.(*ir.StarExpr)
+
+ ptr := n.X
+ for ptr.Op() == ir.OCONVNOP {
+ ptr = ptr.(*ir.ConvExpr).X
+ }
+ if ptr.Op() == ir.OADDR {
+ v.budget += 1 // undo half of default cost of ir.ODEREF+ir.OADDR
+ }
+
+ case ir.OCONVNOP:
+ // This doesn't produce code, but the children might.
+ v.budget++ // undo default cost
+
case ir.ODCLCONST, ir.OFALL:
// These nodes don't produce code; omit from inlining budget.
return false
@@ -836,17 +850,25 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlMap map[*ir.Func]b
}
}
+ // We can delay declaring+initializing result parameters if:
+ // (1) there's exactly one "return" statement in the inlined function;
+ // (2) it's not an empty return statement (#44355); and
+ // (3) the result parameters aren't named.
+ delayretvars := true
+
nreturns := 0
ir.VisitList(ir.Nodes(fn.Inl.Body), func(n ir.Node) {
- if n != nil && n.Op() == ir.ORETURN {
+ if n, ok := n.(*ir.ReturnStmt); ok {
nreturns++
+ if len(n.Results) == 0 {
+ delayretvars = false // empty return statement (case 2)
+ }
}
})
- // We can delay declaring+initializing result parameters if:
- // (1) there's only one "return" statement in the inlined
- // function, and (2) the result parameters aren't named.
- delayretvars := nreturns == 1
+ if nreturns != 1 {
+ delayretvars = false // not exactly one return statement (case 1)
+ }
// temporaries for return values.
var retvars []ir.Node
@@ -857,7 +879,7 @@ func mkinlcall(n *ir.CallExpr, fn *ir.Func, maxCost int32, inlMap map[*ir.Func]b
m = inlvar(n)
m = typecheck.Expr(m).(*ir.Name)
inlvars[n] = m
- delayretvars = false // found a named result parameter
+ delayretvars = false // found a named result parameter (case 3)
} else {
// anonymous return values, synthesize names for use in assignment that replaces return
m = retvar(t, i)
diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go
index d68bcfe60c..65ed3cff66 100644
--- a/src/cmd/compile/internal/ir/expr.go
+++ b/src/cmd/compile/internal/ir/expr.go
@@ -447,14 +447,14 @@ func (n *ParenExpr) SetOTYPE(t *types.Type) {
t.SetNod(n)
}
-// A ResultExpr represents a direct access to a result slot on the stack frame.
+// A ResultExpr represents a direct access to a result.
type ResultExpr struct {
miniExpr
- Offset int64
+ Index int64 // index of the result expr.
}
-func NewResultExpr(pos src.XPos, typ *types.Type, offset int64) *ResultExpr {
- n := &ResultExpr{Offset: offset}
+func NewResultExpr(pos src.XPos, typ *types.Type, index int64) *ResultExpr {
+ n := &ResultExpr{Index: index}
n.pos = pos
n.op = ORESULT
n.typ = typ
diff --git a/src/cmd/compile/internal/ir/mknode.go b/src/cmd/compile/internal/ir/mknode.go
index 326f491a69..5a0aaadf16 100644
--- a/src/cmd/compile/internal/ir/mknode.go
+++ b/src/cmd/compile/internal/ir/mknode.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/cmd/compile/internal/ir/name.go b/src/cmd/compile/internal/ir/name.go
index 6240852aaf..035c9cd3d0 100644
--- a/src/cmd/compile/internal/ir/name.go
+++ b/src/cmd/compile/internal/ir/name.go
@@ -398,7 +398,7 @@ func FinishCaptureNames(pos src.XPos, outerfn, fn *Func) {
// unhook them.
// make the list of pointers for the closure call.
for _, cv := range fn.ClosureVars {
- // Unlink from n; see comment in syntax.go type Param for these fields.
+ // Unlink from n; see comment above on type Name for these fields.
n := cv.Defn.(*Name)
n.Innermost = cv.Outer
diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go
index 59643713fa..38f9123582 100644
--- a/src/cmd/compile/internal/ir/node.go
+++ b/src/cmd/compile/internal/ir/node.go
@@ -456,7 +456,7 @@ const (
// Go command pragmas
GoBuildPragma
- RegisterParams // TODO remove after register abi is working
+ RegisterParams // TODO(register args) remove after register abi is working
)
diff --git a/src/cmd/compile/internal/ir/package.go b/src/cmd/compile/internal/ir/package.go
index 3896e2b91b..e4b93d113e 100644
--- a/src/cmd/compile/internal/ir/package.go
+++ b/src/cmd/compile/internal/ir/package.go
@@ -32,4 +32,7 @@ type Package struct {
// Exported (or re-exported) symbols.
Exports []*Name
+
+ // Map from function names of stencils to already-created stencils.
+ Stencils map[*types.Sym]*Func
}
diff --git a/src/cmd/compile/internal/ir/visit.go b/src/cmd/compile/internal/ir/visit.go
index c1b3d4ed95..e4aeae3522 100644
--- a/src/cmd/compile/internal/ir/visit.go
+++ b/src/cmd/compile/internal/ir/visit.go
@@ -25,10 +25,10 @@ package ir
//
// var do func(ir.Node) bool
// do = func(x ir.Node) bool {
-// ... processing BEFORE visting children ...
+// ... processing BEFORE visiting children ...
// if ... should visit children ... {
// ir.DoChildren(x, do)
-// ... processing AFTER visting children ...
+// ... processing AFTER visiting children ...
// }
// if ... should stop parent DoChildren call from visiting siblings ... {
// return true
@@ -43,11 +43,11 @@ package ir
//
// var do func(ir.Node) bool
// do = func(x ir.Node) bool {
-// ... processing BEFORE visting children ...
+// ... processing BEFORE visiting children ...
// if ... should visit children ... {
// ir.DoChildren(x, do)
// }
-// ... processing AFTER visting children ...
+// ... processing AFTER visiting children ...
// return false
// }
// do(root)
diff --git a/src/cmd/compile/internal/logopt/escape.go b/src/cmd/compile/internal/logopt/escape.go
index 802f967aa6..9660e938b4 100644
--- a/src/cmd/compile/internal/logopt/escape.go
+++ b/src/cmd/compile/internal/logopt/escape.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.8
// +build go1.8
package logopt
diff --git a/src/cmd/compile/internal/logopt/escape_bootstrap.go b/src/cmd/compile/internal/logopt/escape_bootstrap.go
index 66ff0b8f22..cc04eaadfd 100644
--- a/src/cmd/compile/internal/logopt/escape_bootstrap.go
+++ b/src/cmd/compile/internal/logopt/escape_bootstrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !go1.8
// +build !go1.8
package logopt
diff --git a/src/cmd/compile/internal/mips/ssa.go b/src/cmd/compile/internal/mips/ssa.go
index f1cdbd3241..13736d12b4 100644
--- a/src/cmd/compile/internal/mips/ssa.go
+++ b/src/cmd/compile/internal/mips/ssa.go
@@ -112,9 +112,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Reg = y
}
case ssa.OpMIPSMOVWnop:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
@@ -244,9 +241,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
case ssa.OpMIPSCMOVZ:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[2].Reg()
@@ -254,9 +248,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
case ssa.OpMIPSCMOVZzero:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[1].Reg()
@@ -372,6 +363,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpMIPSMOVDF,
ssa.OpMIPSNEGF,
ssa.OpMIPSNEGD,
+ ssa.OpMIPSSQRTF,
ssa.OpMIPSSQRTD,
ssa.OpMIPSCLZ:
p := s.Prog(v.Op.Asm())
diff --git a/src/cmd/compile/internal/mips64/ssa.go b/src/cmd/compile/internal/mips64/ssa.go
index 14cf7af143..c5a3ca305a 100644
--- a/src/cmd/compile/internal/mips64/ssa.go
+++ b/src/cmd/compile/internal/mips64/ssa.go
@@ -115,9 +115,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Reg = y
}
case ssa.OpMIPS64MOVVnop:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
@@ -358,6 +355,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpMIPS64MOVDF,
ssa.OpMIPS64NEGF,
ssa.OpMIPS64NEGD,
+ ssa.OpMIPS64SQRTF,
ssa.OpMIPS64SQRTD:
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
diff --git a/src/cmd/compile/internal/noder/decl.go b/src/cmd/compile/internal/noder/decl.go
index 9862f452fd..a1596be4a4 100644
--- a/src/cmd/compile/internal/noder/decl.go
+++ b/src/cmd/compile/internal/noder/decl.go
@@ -102,10 +102,6 @@ func (g *irgen) funcDecl(out *ir.Nodes, decl *syntax.FuncDecl) {
func (g *irgen) typeDecl(out *ir.Nodes, decl *syntax.TypeDecl) {
if decl.Alias {
- if !types.AllowsGoVersion(types.LocalPkg, 1, 9) {
- base.ErrorfAt(g.pos(decl), "type aliases only supported as of -lang=go1.9")
- }
-
name, _ := g.def(decl.Name)
g.pragmaFlags(decl.Pragma, 0)
diff --git a/src/cmd/compile/internal/noder/expr.go b/src/cmd/compile/internal/noder/expr.go
index 568ec216e3..3fded144dc 100644
--- a/src/cmd/compile/internal/noder/expr.go
+++ b/src/cmd/compile/internal/noder/expr.go
@@ -87,11 +87,13 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
case *syntax.CompositeLit:
return g.compLit(typ, expr)
+
case *syntax.FuncLit:
return g.funcLit(typ, expr)
case *syntax.AssertExpr:
return Assert(pos, g.expr(expr.X), g.typeExpr(expr.Type))
+
case *syntax.CallExpr:
fun := g.expr(expr.Fun)
if inferred, ok := g.info.Inferred[expr]; ok && len(inferred.Targs) > 0 {
@@ -114,6 +116,7 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
}
return Call(pos, g.typ(typ), fun, g.exprs(expr.ArgList), expr.HasDots)
+
case *syntax.IndexExpr:
var targs []ir.Node
if _, ok := expr.Index.(*syntax.ListExpr); ok {
@@ -139,6 +142,7 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
case *syntax.ParenExpr:
return g.expr(expr.X) // skip parens; unneeded after parse+typecheck
+
case *syntax.SelectorExpr:
// Qualified identifier.
if name, ok := expr.X.(*syntax.Name); ok {
@@ -147,8 +151,8 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
return typecheck.Expr(g.use(expr.Sel))
}
}
+ return g.selectorExpr(pos, typ, expr)
- return g.selectorExpr(pos, expr)
case *syntax.SliceExpr:
return Slice(pos, g.expr(expr.X), g.expr(expr.Index[0]), g.expr(expr.Index[1]), g.expr(expr.Index[2]))
@@ -172,15 +176,22 @@ func (g *irgen) expr0(typ types2.Type, expr syntax.Expr) ir.Node {
// selectorExpr resolves the choice of ODOT, ODOTPTR, OCALLPART (eventually
// ODOTMETH & ODOTINTER), and OMETHEXPR and deals with embedded fields here rather
// than in typecheck.go.
-func (g *irgen) selectorExpr(pos src.XPos, expr *syntax.SelectorExpr) ir.Node {
- selinfo := g.info.Selections[expr]
+func (g *irgen) selectorExpr(pos src.XPos, typ types2.Type, expr *syntax.SelectorExpr) ir.Node {
+ x := g.expr(expr.X)
+ if x.Type().Kind() == types.TTYPEPARAM {
+ // Leave a method call on a type param as an OXDOT, since it can
+ // only be fully transformed once it has an instantiated type.
+ n := ir.NewSelectorExpr(pos, ir.OXDOT, x, typecheck.Lookup(expr.Sel.Value))
+ typed(g.typ(typ), n)
+ return n
+ }
+ selinfo := g.info.Selections[expr]
// Everything up to the last selection is an implicit embedded field access,
// and the last selection is determined by selinfo.Kind().
index := selinfo.Index()
embeds, last := index[:len(index)-1], index[len(index)-1]
- x := g.expr(expr.X)
origx := x
for _, ix := range embeds {
x = Implicit(DotField(pos, x, ix))
@@ -198,7 +209,7 @@ func (g *irgen) selectorExpr(pos src.XPos, expr *syntax.SelectorExpr) ir.Node {
// interface embedding).
var n ir.Node
- method := selinfo.Obj().(*types2.Func)
+ method2 := selinfo.Obj().(*types2.Func)
if kind == types2.MethodExpr {
// OMETHEXPR is unusual in using directly the node and type of the
@@ -210,9 +221,11 @@ func (g *irgen) selectorExpr(pos src.XPos, expr *syntax.SelectorExpr) ir.Node {
n = MethodExpr(pos, origx, x.Type(), last)
} else {
// Add implicit addr/deref for method values, if needed.
- if !x.Type().IsInterface() {
- recvTyp := method.Type().(*types2.Signature).Recv().Type()
- _, wantPtr := recvTyp.(*types2.Pointer)
+ if x.Type().IsInterface() {
+ n = DotMethod(pos, x, last)
+ } else {
+ recvType2 := method2.Type().(*types2.Signature).Recv().Type()
+ _, wantPtr := recvType2.(*types2.Pointer)
havePtr := x.Type().IsPtr()
if havePtr != wantPtr {
@@ -222,13 +235,45 @@ func (g *irgen) selectorExpr(pos src.XPos, expr *syntax.SelectorExpr) ir.Node {
x = Implicit(Addr(pos, x))
}
}
- if !g.match(x.Type(), recvTyp, false) {
- base.FatalfAt(pos, "expected %L to have type %v", x, recvTyp)
+ recvType2Base := recvType2
+ if wantPtr {
+ recvType2Base = types2.AsPointer(recvType2).Elem()
+ }
+ if len(types2.AsNamed(recvType2Base).TParams()) > 0 {
+ // recvType2 is the original generic type that is
+ // instantiated for this method call.
+ // selinfo.Recv() is the instantiated type
+ recvType2 = recvType2Base
+ // method is the generic method associated with the gen type
+ method := g.obj(types2.AsNamed(recvType2).Method(last))
+ n = ir.NewSelectorExpr(pos, ir.OCALLPART, x, method.Sym())
+ n.(*ir.SelectorExpr).Selection = types.NewField(pos, method.Sym(), method.Type())
+ n.(*ir.SelectorExpr).Selection.Nname = method
+ typed(method.Type(), n)
+
+ // selinfo.Targs() are the types used to
+ // instantiate the type of receiver
+ targs2 := selinfo.TArgs()
+ targs := make([]ir.Node, len(targs2))
+ for i, targ2 := range targs2 {
+ targs[i] = ir.TypeNode(g.typ(targ2))
+ }
+
+ // Create function instantiation with the type
+ // args for the receiver type for the method call.
+ n = ir.NewInstExpr(pos, ir.OFUNCINST, n, targs)
+ typed(g.typ(typ), n)
+ return n
+ }
+
+ if !g.match(x.Type(), recvType2, false) {
+ base.FatalfAt(pos, "expected %L to have type %v", x, recvType2)
+ } else {
+ n = DotMethod(pos, x, last)
}
}
- n = DotMethod(pos, x, last)
}
- if have, want := n.Sym(), g.selector(method); have != want {
+ if have, want := n.Sym(), g.selector(method2); have != want {
base.FatalfAt(pos, "bad Sym: have %v, want %v", have, want)
}
return n
@@ -280,19 +325,22 @@ func (g *irgen) compLit(typ types2.Type, lit *syntax.CompositeLit) ir.Node {
return typecheck.Expr(ir.NewCompLitExpr(g.pos(lit), ir.OCOMPLIT, ir.TypeNode(g.typ(typ)), exprs))
}
-func (g *irgen) funcLit(typ types2.Type, expr *syntax.FuncLit) ir.Node {
+func (g *irgen) funcLit(typ2 types2.Type, expr *syntax.FuncLit) ir.Node {
fn := ir.NewFunc(g.pos(expr))
fn.SetIsHiddenClosure(ir.CurFunc != nil)
fn.Nname = ir.NewNameAt(g.pos(expr), typecheck.ClosureName(ir.CurFunc))
ir.MarkFunc(fn.Nname)
- fn.Nname.SetType(g.typ(typ))
+ typ := g.typ(typ2)
fn.Nname.Func = fn
fn.Nname.Defn = fn
+ // Set Ntype for now to be compatible with later parts of compile, remove later.
+ fn.Nname.Ntype = ir.TypeNode(typ)
+ typed(typ, fn.Nname)
+ fn.SetTypecheck(1)
fn.OClosure = ir.NewClosureExpr(g.pos(expr), fn)
- fn.OClosure.SetType(fn.Nname.Type())
- fn.OClosure.SetTypecheck(1)
+ typed(typ, fn.OClosure)
g.funcBody(fn, nil, expr.Type, expr.Body)
diff --git a/src/cmd/compile/internal/noder/helpers.go b/src/cmd/compile/internal/noder/helpers.go
index bb17a5331a..4cb6bc3eab 100644
--- a/src/cmd/compile/internal/noder/helpers.go
+++ b/src/cmd/compile/internal/noder/helpers.go
@@ -84,6 +84,11 @@ func Call(pos src.XPos, typ *types.Type, fun ir.Node, args []ir.Node, dots bool)
if fun.Op() == ir.OTYPE {
// Actually a type conversion, not a function call.
n := ir.NewCallExpr(pos, ir.OCALL, fun, args)
+ if fun.Type().Kind() == types.TTYPEPARAM {
+ // For type params, don't typecheck until we actually know
+ // the type.
+ return typed(typ, n)
+ }
return typecheck.Expr(n)
}
@@ -119,6 +124,16 @@ func Call(pos src.XPos, typ *types.Type, fun ir.Node, args []ir.Node, dots bool)
n := ir.NewCallExpr(pos, ir.OCALL, fun, args)
n.IsDDD = dots
+ if fun.Op() == ir.OXDOT {
+ if fun.(*ir.SelectorExpr).X.Type().Kind() != types.TTYPEPARAM {
+ base.FatalfAt(pos, "Expecting type param receiver in %v", fun)
+ }
+ // For methods called in a generic function, don't do any extra
+ // transformations. We will do those later when we create the
+ // instantiated function and have the correct receiver type.
+ typed(typ, n)
+ return n
+ }
if fun.Op() != ir.OFUNCINST {
// If no type params, still do normal typechecking, since we're
// still missing some things done by tcCall below (mainly
diff --git a/src/cmd/compile/internal/noder/irgen.go b/src/cmd/compile/internal/noder/irgen.go
index 1cef98742d..28536cc1f7 100644
--- a/src/cmd/compile/internal/noder/irgen.go
+++ b/src/cmd/compile/internal/noder/irgen.go
@@ -35,6 +35,7 @@ func check2(noders []*noder) {
// typechecking
conf := types2.Config{
+ GoVersion: base.Flag.Lang,
InferFromConstraints: true,
IgnoreLabels: true, // parser already checked via syntax.CheckBranches mode
CompilerErrorMessages: true, // use error strings matching existing compiler errors
@@ -185,6 +186,21 @@ Outer:
return false
})
}
+
+ // Create any needed stencils of generic functions
+ g.stencil()
+
+ // For now, remove all generic functions from g.target.Decl, since they
+ // have been used for stenciling, but don't compile. TODO: We will
+ // eventually export any exportable generic functions.
+ j := 0
+ for i, decl := range g.target.Decls {
+ if decl.Op() != ir.ODCLFUNC || !decl.Type().HasTParam() {
+ g.target.Decls[j] = g.target.Decls[i]
+ j++
+ }
+ }
+ g.target.Decls = g.target.Decls[:j]
}
func (g *irgen) unhandled(what string, p poser) {
diff --git a/src/cmd/compile/internal/noder/lex.go b/src/cmd/compile/internal/noder/lex.go
index cdca9e55f3..36cfb9bc23 100644
--- a/src/cmd/compile/internal/noder/lex.go
+++ b/src/cmd/compile/internal/noder/lex.go
@@ -28,7 +28,7 @@ const (
ir.Nosplit |
ir.Noinline |
ir.NoCheckPtr |
- ir.RegisterParams | // TODO remove after register abi is working
+ ir.RegisterParams | // TODO(register args) remove after register abi is working
ir.CgoUnsafeArgs |
ir.UintptrEscapes |
ir.Systemstack |
@@ -80,7 +80,7 @@ func pragmaFlag(verb string) ir.PragmaFlag {
// in the argument list.
// Used in syscall/dll_windows.go.
return ir.UintptrEscapes
- case "go:registerparams": // TODO remove after register abi is working
+ case "go:registerparams": // TODO(register args) remove after register abi is working
return ir.RegisterParams
case "go:notinheap":
return ir.NotInHeap
diff --git a/src/cmd/compile/internal/noder/object.go b/src/cmd/compile/internal/noder/object.go
index c740285ca2..b4e5c022db 100644
--- a/src/cmd/compile/internal/noder/object.go
+++ b/src/cmd/compile/internal/noder/object.go
@@ -155,6 +155,9 @@ func (g *irgen) objFinish(name *ir.Name, class ir.Class, typ *types.Type) {
break // methods are exported with their receiver type
}
if types.IsExported(sym.Name) {
+ if name.Class == ir.PFUNC && name.Type().NumTParams() > 0 {
+ base.FatalfAt(name.Pos(), "Cannot export a generic function (yet): %v", name)
+ }
typecheck.Export(name)
}
if base.Flag.AsmHdr != "" && !name.Sym().Asm() {
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
new file mode 100644
index 0000000000..fb1bbfedc8
--- /dev/null
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -0,0 +1,556 @@
+// Copyright 2021 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.
+
+// This file will evolve, since we plan to do a mix of stenciling and passing
+// around dictionaries.
+
+package noder
+
+import (
+ "bytes"
+ "cmd/compile/internal/base"
+ "cmd/compile/internal/ir"
+ "cmd/compile/internal/typecheck"
+ "cmd/compile/internal/types"
+ "cmd/internal/src"
+ "fmt"
+ "strings"
+)
+
+// stencil scans functions for instantiated generic function calls and
+// creates the required stencils for simple generic functions.
+func (g *irgen) stencil() {
+ g.target.Stencils = make(map[*types.Sym]*ir.Func)
+ // Don't use range(g.target.Decls) - we also want to process any new instantiated
+ // functions that are created during this loop, in order to handle generic
+ // functions calling other generic functions.
+ for i := 0; i < len(g.target.Decls); i++ {
+ decl := g.target.Decls[i]
+
+ // Look for function instantiations in bodies of non-generic
+ // functions or in global assignments (ignore global type and
+ // constant declarations).
+ switch decl.Op() {
+ case ir.ODCLFUNC:
+ if decl.Type().HasTParam() {
+ // Skip any generic functions
+ continue
+ }
+
+ case ir.OAS:
+
+ case ir.OAS2:
+
+ default:
+ continue
+ }
+
+ // For all non-generic code, search for any function calls using
+ // generic function instantiations. Then create the needed
+ // instantiated function if it hasn't been created yet, and change
+ // to calling that function directly.
+ modified := false
+ foundFuncInst := false
+ ir.Visit(decl, func(n ir.Node) {
+ if n.Op() == ir.OFUNCINST {
+ // We found a function instantiation that is not
+ // immediately called.
+ foundFuncInst = true
+ }
+ if n.Op() != ir.OCALLFUNC || n.(*ir.CallExpr).X.Op() != ir.OFUNCINST {
+ return
+ }
+ // We have found a function call using a generic function
+ // instantiation.
+ call := n.(*ir.CallExpr)
+ inst := call.X.(*ir.InstExpr)
+ st := g.getInstantiation(inst)
+ // Replace the OFUNCINST with a direct reference to the
+ // new stenciled function
+ call.X = st.Nname
+ if inst.X.Op() == ir.OCALLPART {
+ // When we create an instantiation of a method
+ // call, we make it a function. So, move the
+ // receiver to be the first arg of the function
+ // call.
+ withRecv := make([]ir.Node, len(call.Args)+1)
+ dot := inst.X.(*ir.SelectorExpr)
+ withRecv[0] = dot.X
+ copy(withRecv[1:], call.Args)
+ call.Args = withRecv
+ }
+ modified = true
+ })
+
+ // If we found an OFUNCINST without a corresponding call in the
+ // above decl, then traverse the nodes of decl again (with
+ // EditChildren rather than Visit), where we actually change the
+ // OFUNCINST node to an ONAME for the instantiated function.
+ // EditChildren is more expensive than Visit, so we only do this
+ // in the infrequent case of an OFUNCINSt without a corresponding
+ // call.
+ if foundFuncInst {
+ var edit func(ir.Node) ir.Node
+ edit = func(x ir.Node) ir.Node {
+ if x.Op() == ir.OFUNCINST {
+ st := g.getInstantiation(x.(*ir.InstExpr))
+ return st.Nname
+ }
+ ir.EditChildren(x, edit)
+ return x
+ }
+ edit(decl)
+ }
+ if base.Flag.W > 1 && modified {
+ ir.Dump(fmt.Sprintf("\nmodified %v", decl), decl)
+ }
+ }
+
+}
+
+// getInstantiation gets the instantiated function corresponding to inst. If the
+// instantiated function is not already cached, then it calls genericStub to
+// create the new instantiation.
+func (g *irgen) getInstantiation(inst *ir.InstExpr) *ir.Func {
+ var sym *types.Sym
+ if meth, ok := inst.X.(*ir.SelectorExpr); ok {
+ // Write the name of the generic method, including receiver type
+ sym = makeInstName(meth.Selection.Nname.Sym(), inst.Targs)
+ } else {
+ sym = makeInstName(inst.X.(*ir.Name).Name().Sym(), inst.Targs)
+ }
+ //fmt.Printf("Found generic func call in %v to %v\n", f, s)
+ st := g.target.Stencils[sym]
+ if st == nil {
+ // If instantiation doesn't exist yet, create it and add
+ // to the list of decls.
+ st = g.genericSubst(sym, inst)
+ g.target.Stencils[sym] = st
+ g.target.Decls = append(g.target.Decls, st)
+ if base.Flag.W > 1 {
+ ir.Dump(fmt.Sprintf("\nstenciled %v", st), st)
+ }
+ }
+ return st
+}
+
+// makeInstName makes the unique name for a stenciled generic function, based on
+// the name of the function and the targs.
+func makeInstName(fnsym *types.Sym, targs []ir.Node) *types.Sym {
+ b := bytes.NewBufferString("#")
+ b.WriteString(fnsym.Name)
+ b.WriteString("[")
+ for i, targ := range targs {
+ if i > 0 {
+ b.WriteString(",")
+ }
+ b.WriteString(targ.Type().String())
+ }
+ b.WriteString("]")
+ return typecheck.Lookup(b.String())
+}
+
+// Struct containing info needed for doing the substitution as we create the
+// instantiation of a generic function with specified type arguments.
+type subster struct {
+ g *irgen
+ newf *ir.Func // Func node for the new stenciled function
+ tparams []*types.Field
+ targs []ir.Node
+ // The substitution map from name nodes in the generic function to the
+ // name nodes in the new stenciled function.
+ vars map[*ir.Name]*ir.Name
+ seen map[*types.Type]*types.Type
+}
+
+// genericSubst returns a new function with the specified name. The function is an
+// instantiation of a generic function or method with type params, as specified by
+// inst. For a method with a generic receiver, it returns an instantiated function
+// type where the receiver becomes the first parameter. Otherwise the instantiated
+// method would still need to be transformed by later compiler phases.
+func (g *irgen) genericSubst(name *types.Sym, inst *ir.InstExpr) *ir.Func {
+ var nameNode *ir.Name
+ var tparams []*types.Field
+ if selExpr, ok := inst.X.(*ir.SelectorExpr); ok {
+ // Get the type params from the method receiver (after skipping
+ // over any pointer)
+ nameNode = ir.AsNode(selExpr.Selection.Nname).(*ir.Name)
+ recvType := selExpr.Type().Recv().Type
+ if recvType.IsPtr() {
+ recvType = recvType.Elem()
+ }
+ tparams = make([]*types.Field, len(recvType.RParams))
+ for i, rparam := range recvType.RParams {
+ tparams[i] = types.NewField(src.NoXPos, nil, rparam)
+ }
+ } else {
+ nameNode = inst.X.(*ir.Name)
+ tparams = nameNode.Type().TParams().Fields().Slice()
+ }
+ gf := nameNode.Func
+ newf := ir.NewFunc(inst.Pos())
+ newf.Nname = ir.NewNameAt(inst.Pos(), name)
+ newf.Nname.Func = newf
+ newf.Nname.Defn = newf
+ name.Def = newf.Nname
+
+ subst := &subster{
+ g: g,
+ newf: newf,
+ tparams: tparams,
+ targs: inst.Targs,
+ vars: make(map[*ir.Name]*ir.Name),
+ seen: make(map[*types.Type]*types.Type),
+ }
+
+ newf.Dcl = make([]*ir.Name, len(gf.Dcl))
+ for i, n := range gf.Dcl {
+ newf.Dcl[i] = subst.node(n).(*ir.Name)
+ }
+ newf.Body = subst.list(gf.Body)
+
+ // Ugly: we have to insert the Name nodes of the parameters/results into
+ // the function type. The current function type has no Nname fields set,
+ // because it came via conversion from the types2 type.
+ oldt := inst.X.Type()
+ // We also transform a generic method type to the corresponding
+ // instantiated function type where the receiver is the first parameter.
+ newt := types.NewSignature(oldt.Pkg(), nil, nil,
+ subst.fields(ir.PPARAM, append(oldt.Recvs().FieldSlice(), oldt.Params().FieldSlice()...), newf.Dcl),
+ subst.fields(ir.PPARAMOUT, oldt.Results().FieldSlice(), newf.Dcl))
+
+ newf.Nname.Ntype = ir.TypeNode(newt)
+ newf.Nname.SetType(newt)
+ ir.MarkFunc(newf.Nname)
+ newf.SetTypecheck(1)
+ newf.Nname.SetTypecheck(1)
+ // TODO(danscales) - remove later, but avoid confusion for now.
+ newf.Pragma = ir.Noinline
+ return newf
+}
+
+// node is like DeepCopy(), but creates distinct ONAME nodes, and also descends
+// into closures. It substitutes type arguments for type parameters in all the new
+// nodes.
+func (subst *subster) node(n ir.Node) ir.Node {
+ // Use closure to capture all state needed by the ir.EditChildren argument.
+ var edit func(ir.Node) ir.Node
+ edit = func(x ir.Node) ir.Node {
+ switch x.Op() {
+ case ir.OTYPE:
+ return ir.TypeNode(subst.typ(x.Type()))
+
+ case ir.ONAME:
+ name := x.(*ir.Name)
+ if v := subst.vars[name]; v != nil {
+ return v
+ }
+ m := ir.NewNameAt(name.Pos(), name.Sym())
+ if name.IsClosureVar() {
+ m.SetIsClosureVar(true)
+ }
+ t := x.Type()
+ newt := subst.typ(t)
+ m.SetType(newt)
+ m.Curfn = subst.newf
+ m.Class = name.Class
+ m.Func = name.Func
+ subst.vars[name] = m
+ m.SetTypecheck(1)
+ return m
+ case ir.OLITERAL, ir.ONIL:
+ if x.Sym() != nil {
+ return x
+ }
+ }
+ m := ir.Copy(x)
+ if _, isExpr := m.(ir.Expr); isExpr {
+ t := x.Type()
+ if t == nil {
+ // t can be nil only if this is a call that has no
+ // return values, so allow that and otherwise give
+ // an error.
+ _, isCallExpr := m.(*ir.CallExpr)
+ _, isStructKeyExpr := m.(*ir.StructKeyExpr)
+ if !isCallExpr && !isStructKeyExpr {
+ base.Fatalf(fmt.Sprintf("Nil type for %v", x))
+ }
+ } else if x.Op() != ir.OCLOSURE {
+ m.SetType(subst.typ(x.Type()))
+ }
+ }
+ ir.EditChildren(m, edit)
+
+ if x.Op() == ir.OXDOT {
+ // A method value/call via a type param will have been left as an
+ // OXDOT. When we see this during stenciling, finish the
+ // typechecking, now that we have the instantiated receiver type.
+ // We need to do this now, since the access/selection to the
+ // method for the real type is very different from the selection
+ // for the type param.
+ m.SetTypecheck(0)
+ // m will transform to an OCALLPART
+ typecheck.Expr(m)
+ }
+ if x.Op() == ir.OCALL {
+ call := m.(*ir.CallExpr)
+ if call.X.Op() == ir.OTYPE {
+ // Do typechecking on a conversion, now that we
+ // know the type argument.
+ m.SetTypecheck(0)
+ m = typecheck.Expr(m)
+ } else if call.X.Op() == ir.OCALLPART {
+ // Redo the typechecking, now that we know the method
+ // value is being called.
+ call.X.(*ir.SelectorExpr).SetOp(ir.OXDOT)
+ call.X.SetTypecheck(0)
+ call.X.SetType(nil)
+ typecheck.Callee(call.X)
+ m.SetTypecheck(0)
+ typecheck.Call(m.(*ir.CallExpr))
+ } else {
+ base.FatalfAt(call.Pos(), "Expecting OCALLPART or OTYPE with CALL")
+ }
+ }
+
+ if x.Op() == ir.OCLOSURE {
+ x := x.(*ir.ClosureExpr)
+ // Need to save/duplicate x.Func.Nname,
+ // x.Func.Nname.Ntype, x.Func.Dcl, x.Func.ClosureVars, and
+ // x.Func.Body.
+ oldfn := x.Func
+ newfn := ir.NewFunc(oldfn.Pos())
+ if oldfn.ClosureCalled() {
+ newfn.SetClosureCalled(true)
+ }
+ newfn.SetIsHiddenClosure(true)
+ m.(*ir.ClosureExpr).Func = newfn
+ newsym := makeInstName(oldfn.Nname.Sym(), subst.targs)
+ newfn.Nname = ir.NewNameAt(oldfn.Nname.Pos(), newsym)
+ newfn.Nname.Func = newfn
+ newfn.Nname.Defn = newfn
+ ir.MarkFunc(newfn.Nname)
+ newfn.OClosure = m.(*ir.ClosureExpr)
+
+ saveNewf := subst.newf
+ subst.newf = newfn
+ newfn.Dcl = subst.namelist(oldfn.Dcl)
+ newfn.ClosureVars = subst.namelist(oldfn.ClosureVars)
+ newfn.Body = subst.list(oldfn.Body)
+ subst.newf = saveNewf
+
+ // Set Ntype for now to be compatible with later parts of compiler
+ newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype)
+ typed(subst.typ(oldfn.Nname.Type()), newfn.Nname)
+ newfn.SetTypecheck(1)
+ subst.g.target.Decls = append(subst.g.target.Decls, newfn)
+ }
+ return m
+ }
+
+ return edit(n)
+}
+
+func (subst *subster) namelist(l []*ir.Name) []*ir.Name {
+ s := make([]*ir.Name, len(l))
+ for i, n := range l {
+ s[i] = subst.node(n).(*ir.Name)
+ if n.Defn != nil {
+ s[i].Defn = subst.node(n.Defn)
+ }
+ if n.Outer != nil {
+ s[i].Outer = subst.node(n.Outer).(*ir.Name)
+ }
+ }
+ return s
+}
+
+func (subst *subster) list(l []ir.Node) []ir.Node {
+ s := make([]ir.Node, len(l))
+ for i, n := range l {
+ s[i] = subst.node(n)
+ }
+ return s
+}
+
+// tstruct substitutes type params in types of the fields of a structure type. For
+// each field, if Nname is set, tstruct also translates the Nname using subst.vars, if
+// Nname is in subst.vars.
+func (subst *subster) tstruct(t *types.Type) *types.Type {
+ if t.NumFields() == 0 {
+ return t
+ }
+ var newfields []*types.Field
+ for i, f := range t.Fields().Slice() {
+ t2 := subst.typ(f.Type)
+ if (t2 != f.Type || f.Nname != nil) && newfields == nil {
+ newfields = make([]*types.Field, t.NumFields())
+ for j := 0; j < i; j++ {
+ newfields[j] = t.Field(j)
+ }
+ }
+ if newfields != nil {
+ newfields[i] = types.NewField(f.Pos, f.Sym, t2)
+ if f.Nname != nil {
+ // f.Nname may not be in subst.vars[] if this is
+ // a function name or a function instantiation type
+ // that we are translating
+ newfields[i].Nname = subst.vars[f.Nname.(*ir.Name)]
+ }
+ }
+ }
+ if newfields != nil {
+ return types.NewStruct(t.Pkg(), newfields)
+ }
+ return t
+
+}
+
+// instTypeName creates a name for an instantiated type, based on the type args
+func instTypeName(name string, targs []*types.Type) string {
+ b := bytes.NewBufferString(name)
+ b.WriteByte('[')
+ for i, targ := range targs {
+ if i > 0 {
+ b.WriteByte(',')
+ }
+ b.WriteString(targ.String())
+ }
+ b.WriteByte(']')
+ return b.String()
+}
+
+// typ computes the type obtained by substituting any type parameter in t with the
+// corresponding type argument in subst. If t contains no type parameters, the
+// result is t; otherwise the result is a new type.
+// It deals with recursive types by using a map and TFORW types.
+// TODO(danscales) deal with recursion besides ptr/struct cases.
+func (subst *subster) typ(t *types.Type) *types.Type {
+ if !t.HasTParam() {
+ return t
+ }
+ if subst.seen[t] != nil {
+ // We've hit a recursive type
+ return subst.seen[t]
+ }
+
+ var newt *types.Type
+ switch t.Kind() {
+ case types.TTYPEPARAM:
+ for i, tp := range subst.tparams {
+ if tp.Type == t {
+ return subst.targs[i].Type()
+ }
+ }
+ return t
+
+ case types.TARRAY:
+ elem := t.Elem()
+ newelem := subst.typ(elem)
+ if newelem != elem {
+ newt = types.NewArray(newelem, t.NumElem())
+ }
+
+ case types.TPTR:
+ elem := t.Elem()
+ // In order to deal with recursive generic types, create a TFORW
+ // type initially and store it in the seen map, so it can be
+ // accessed if this type appears recursively within the type.
+ forw := types.New(types.TFORW)
+ subst.seen[t] = forw
+ newelem := subst.typ(elem)
+ if newelem != elem {
+ forw.SetUnderlying(types.NewPtr(newelem))
+ newt = forw
+ }
+ delete(subst.seen, t)
+
+ case types.TSLICE:
+ elem := t.Elem()
+ newelem := subst.typ(elem)
+ if newelem != elem {
+ newt = types.NewSlice(newelem)
+ }
+
+ case types.TSTRUCT:
+ forw := types.New(types.TFORW)
+ subst.seen[t] = forw
+ newt = subst.tstruct(t)
+ if newt != t {
+ forw.SetUnderlying(newt)
+ newt = forw
+ }
+ delete(subst.seen, t)
+
+ case types.TFUNC:
+ newrecvs := subst.tstruct(t.Recvs())
+ newparams := subst.tstruct(t.Params())
+ newresults := subst.tstruct(t.Results())
+ if newrecvs != t.Recvs() || newparams != t.Params() || newresults != t.Results() {
+ var newrecv *types.Field
+ if newrecvs.NumFields() > 0 {
+ newrecv = newrecvs.Field(0)
+ }
+ newt = types.NewSignature(t.Pkg(), newrecv, nil, newparams.FieldSlice(), newresults.FieldSlice())
+ }
+
+ // TODO: case TCHAN
+ // TODO: case TMAP
+ // TODO: case TINTER
+ }
+ if newt != nil {
+ if t.Sym() != nil {
+ // Since we've substituted types, we also need to change
+ // the defined name of the type, by removing the old types
+ // (in brackets) from the name, and adding the new types.
+
+ // Translate the type params for this type according to
+ // the tparam/targs mapping of the function.
+ neededTargs := make([]*types.Type, len(t.RParams))
+ for i, rparam := range t.RParams {
+ neededTargs[i] = subst.typ(rparam)
+ }
+ oldname := t.Sym().Name
+ i := strings.Index(oldname, "[")
+ oldname = oldname[:i]
+ sym := t.Sym().Pkg.Lookup(instTypeName(oldname, neededTargs))
+ if sym.Def != nil {
+ // We've already created this instantiated defined type.
+ return sym.Def.Type()
+ }
+ newt.SetSym(sym)
+ sym.Def = ir.TypeNode(newt)
+ }
+ return newt
+ }
+
+ return t
+}
+
+// fields sets the Nname field for the Field nodes inside a type signature, based
+// on the corresponding in/out parameters in dcl. It depends on the in and out
+// parameters being in order in dcl.
+func (subst *subster) fields(class ir.Class, oldfields []*types.Field, dcl []*ir.Name) []*types.Field {
+ newfields := make([]*types.Field, len(oldfields))
+ var i int
+
+ // Find the starting index in dcl of declarations of the class (either
+ // PPARAM or PPARAMOUT).
+ for i = range dcl {
+ if dcl[i].Class == class {
+ break
+ }
+ }
+
+ // Create newfields nodes that are copies of the oldfields nodes, but
+ // with substitution for any type params, and with Nname set to be the node in
+ // Dcl for the corresponding PPARAM or PPARAMOUT.
+ for j := range oldfields {
+ newfields[j] = oldfields[j].Copy()
+ newfields[j].Type = subst.typ(oldfields[j].Type)
+ newfields[j].Nname = dcl[i]
+ i++
+ }
+ return newfields
+}
diff --git a/src/cmd/compile/internal/noder/types.go b/src/cmd/compile/internal/noder/types.go
index 1e71969858..c23295c3a1 100644
--- a/src/cmd/compile/internal/noder/types.go
+++ b/src/cmd/compile/internal/noder/types.go
@@ -5,6 +5,7 @@
package noder
import (
+ "bytes"
"cmd/compile/internal/base"
"cmd/compile/internal/ir"
"cmd/compile/internal/typecheck"
@@ -25,6 +26,8 @@ func (g *irgen) pkg(pkg *types2.Package) *types.Pkg {
return types.NewPkg(pkg.Path(), pkg.Name())
}
+// typ converts a types2.Type to a types.Type, including caching of previously
+// translated types.
func (g *irgen) typ(typ types2.Type) *types.Type {
// Caching type mappings isn't strictly needed, because typ0 preserves
// type identity; but caching minimizes memory blow-up from mapping the
@@ -46,11 +49,79 @@ func (g *irgen) typ(typ types2.Type) *types.Type {
return res
}
+// instTypeName2 creates a name for an instantiated type, base on the type args
+// (given as types2 types).
+func instTypeName2(name string, targs []types2.Type) string {
+ b := bytes.NewBufferString(name)
+ b.WriteByte('[')
+ for i, targ := range targs {
+ if i > 0 {
+ b.WriteByte(',')
+ }
+ b.WriteString(types2.TypeString(targ,
+ func(*types2.Package) string { return "" }))
+ }
+ b.WriteByte(']')
+ return b.String()
+}
+
+// typ0 converts a types2.Type to a types.Type, but doesn't do the caching check
+// at the top level.
func (g *irgen) typ0(typ types2.Type) *types.Type {
switch typ := typ.(type) {
case *types2.Basic:
return g.basic(typ)
case *types2.Named:
+ if typ.TParams() != nil {
+ // typ is an instantiation of a defined (named) generic type.
+ // This instantiation should also be a defined (named) type.
+ // types2 gives us the substituted type in t.Underlying()
+ // The substituted type may or may not still have type
+ // params. We might, for example, be substituting one type
+ // param for another type param.
+
+ if typ.TArgs() == nil {
+ base.Fatalf("In typ0, Targs should be set if TParams is set")
+ }
+
+ // When converted to types.Type, typ must have a name,
+ // based on the names of the type arguments. We need a
+ // name to deal with recursive generic types (and it also
+ // looks better when printing types).
+ instName := instTypeName2(typ.Obj().Name(), typ.TArgs())
+ s := g.pkg(typ.Obj().Pkg()).Lookup(instName)
+ if s.Def != nil {
+ // We have already encountered this instantiation,
+ // so use the type we previously created, since there
+ // must be exactly one instance of a defined type.
+ return s.Def.Type()
+ }
+
+ // Create a forwarding type first and put it in the g.typs
+ // map, in order to deal with recursive generic types.
+ ntyp := types.New(types.TFORW)
+ g.typs[typ] = ntyp
+ ntyp.SetUnderlying(g.typ(typ.Underlying()))
+ ntyp.SetSym(s)
+
+ if ntyp.HasTParam() {
+ // If ntyp still has type params, then we must be
+ // referencing something like 'value[T2]', as when
+ // specifying the generic receiver of a method,
+ // where value was defined as "type value[T any]
+ // ...". Save the type args, which will now be the
+ // new type params of the current type.
+ ntyp.RParams = make([]*types.Type, len(typ.TArgs()))
+ for i, targ := range typ.TArgs() {
+ ntyp.RParams[i] = g.typ(targ)
+ }
+ }
+
+ // Make sure instantiated type can be uniquely found from
+ // the sym
+ s.Def = ir.TypeNode(ntyp)
+ return ntyp
+ }
obj := g.obj(typ.Obj())
if obj.Op() != ir.OTYPE {
base.FatalfAt(obj.Pos(), "expected type: %L", obj)
diff --git a/src/cmd/compile/internal/ppc64/ssa.go b/src/cmd/compile/internal/ppc64/ssa.go
index c85e110ed3..f984079c4b 100644
--- a/src/cmd/compile/internal/ppc64/ssa.go
+++ b/src/cmd/compile/internal/ppc64/ssa.go
@@ -419,7 +419,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
// If it is a Compare-and-Swap-Release operation, set the EH field with
// the release hint.
if v.AuxInt == 0 {
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: 0})
+ p.SetFrom3Const(0)
}
// CMP reg1,reg2
p1 := s.Prog(cmp)
@@ -586,7 +586,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(v.Op.Asm())
// clrlslwi ra,rs,mb,sh will become rlwinm ra,rs,sh,mb-sh,31-sh as described in ISA
p.From = obj.Addr{Type: obj.TYPE_CONST, Offset: ssa.GetPPC64Shiftmb(shifts)}
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: ssa.GetPPC64Shiftsh(shifts)})
+ p.SetFrom3Const(ssa.GetPPC64Shiftsh(shifts))
p.Reg = r1
p.To.Type = obj.TYPE_REG
p.To.Reg = r
@@ -598,7 +598,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(v.Op.Asm())
// clrlsldi ra,rs,mb,sh will become rldic ra,rs,sh,mb-sh
p.From = obj.Addr{Type: obj.TYPE_CONST, Offset: ssa.GetPPC64Shiftmb(shifts)}
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: ssa.GetPPC64Shiftsh(shifts)})
+ p.SetFrom3Const(ssa.GetPPC64Shiftsh(shifts))
p.Reg = r1
p.To.Type = obj.TYPE_REG
p.To.Reg = r
@@ -610,7 +610,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
shifts := v.AuxInt
p := s.Prog(v.Op.Asm())
p.From = obj.Addr{Type: obj.TYPE_CONST, Offset: ssa.GetPPC64Shiftsh(shifts)}
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: ssa.GetPPC64Shiftmb(shifts)})
+ p.SetFrom3Const(ssa.GetPPC64Shiftmb(shifts))
p.Reg = r1
p.To.Type = obj.TYPE_REG
p.To.Reg = r
@@ -658,7 +658,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To = obj.Addr{Type: obj.TYPE_REG, Reg: v.Reg()}
p.Reg = v.Args[0].Reg()
p.From = obj.Addr{Type: obj.TYPE_CONST, Offset: int64(rot)}
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: int64(mask)})
+ p.SetFrom3Const(int64(mask))
// Auxint holds mask
case ssa.OpPPC64RLWNM:
@@ -667,7 +667,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To = obj.Addr{Type: obj.TYPE_REG, Reg: v.Reg()}
p.Reg = v.Args[0].Reg()
p.From = obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[1].Reg()}
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: int64(mask)})
+ p.SetFrom3Const(int64(mask))
case ssa.OpPPC64MADDLD:
r := v.Reg()
@@ -679,7 +679,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Type = obj.TYPE_REG
p.From.Reg = r1
p.Reg = r2
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: r3})
+ p.SetFrom3Reg(r3)
p.To.Type = obj.TYPE_REG
p.To.Reg = r
@@ -693,7 +693,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Type = obj.TYPE_REG
p.From.Reg = r1
p.Reg = r3
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: r2})
+ p.SetFrom3Reg(r2)
p.To.Type = obj.TYPE_REG
p.To.Reg = r
@@ -720,7 +720,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
case ssa.OpPPC64SUBFCconst:
p := s.Prog(v.Op.Asm())
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: v.AuxInt})
+ p.SetFrom3Const(v.AuxInt)
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
p.To.Type = obj.TYPE_REG
@@ -910,7 +910,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
// AuxInt values 4,5,6 implemented with reverse operand order from 0,1,2
if v.AuxInt > 3 {
p.Reg = r.Reg
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[0].Reg()})
+ p.SetFrom3Reg(v.Args[0].Reg())
} else {
p.Reg = v.Args[0].Reg()
p.SetFrom3(r)
@@ -1784,7 +1784,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
pp.To.Reg = ppc64.REG_LR
// Insert a hint this is not a subroutine return.
- pp.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: 1})
+ pp.SetFrom3Const(1)
if base.Ctxt.Flag_shared {
// When compiling Go into PIC, the function we just
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index 632e0f48d4..06a7f91c52 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -1288,6 +1288,11 @@ func ITabSym(it *obj.LSym, offset int64) *obj.LSym {
// NeedRuntimeType ensures that a runtime type descriptor is emitted for t.
func NeedRuntimeType(t *types.Type) {
+ if t.HasTParam() {
+ // Generic types don't have a runtime type descriptor (but will
+ // have a dictionary)
+ return
+ }
if _, ok := signatset[t]; !ok {
signatset[t] = struct{}{}
signatslice = append(signatslice, t)
diff --git a/src/cmd/compile/internal/riscv64/ssa.go b/src/cmd/compile/internal/riscv64/ssa.go
index 70c29a4b7b..5576dd4e48 100644
--- a/src/cmd/compile/internal/riscv64/ssa.go
+++ b/src/cmd/compile/internal/riscv64/ssa.go
@@ -211,9 +211,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
p.To.Reg = rd
case ssa.OpRISCV64MOVDnop:
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
@@ -513,6 +510,14 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p6 := s.Prog(obj.ANOP)
p2.To.SetTarget(p6)
+ case ssa.OpRISCV64LoweredAtomicAnd32, ssa.OpRISCV64LoweredAtomicOr32:
+ p := s.Prog(v.Op.Asm())
+ p.From.Type = obj.TYPE_REG
+ p.From.Reg = v.Args[1].Reg()
+ p.To.Type = obj.TYPE_MEM
+ p.To.Reg = v.Args[0].Reg()
+ p.RegTo2 = riscv.REG_ZERO
+
case ssa.OpRISCV64LoweredZero:
mov, sz := largestMove(v.AuxInt)
diff --git a/src/cmd/compile/internal/s390x/ssa.go b/src/cmd/compile/internal/s390x/ssa.go
index d4c7a286e2..ca6720bb33 100644
--- a/src/cmd/compile/internal/s390x/ssa.go
+++ b/src/cmd/compile/internal/s390x/ssa.go
@@ -175,10 +175,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.Reg = r1
}
case ssa.OpS390XRXSBG:
- r1 := v.Reg()
- if r1 != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
r2 := v.Args[1].Reg()
i := v.Aux.(s390x.RotateParams)
p := s.Prog(v.Op.Asm())
@@ -188,7 +184,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
{Type: obj.TYPE_CONST, Offset: int64(i.Amount)},
{Type: obj.TYPE_REG, Reg: r2},
})
- p.To = obj.Addr{Type: obj.TYPE_REG, Reg: r1}
+ p.To = obj.Addr{Type: obj.TYPE_REG, Reg: v.Reg()}
case ssa.OpS390XRISBGZ:
r1 := v.Reg()
r2 := v.Args[0].Reg()
@@ -233,12 +229,8 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.Reg = r2
}
case ssa.OpS390XADDE, ssa.OpS390XSUBE:
- r1 := v.Reg0()
- if r1 != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
r2 := v.Args[1].Reg()
- opregreg(s, v.Op.Asm(), r1, r2)
+ opregreg(s, v.Op.Asm(), v.Reg0(), r2)
case ssa.OpS390XADDCconst:
r1 := v.Reg0()
r3 := v.Args[0].Reg()
@@ -248,18 +240,10 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
case ssa.OpS390XMULLD, ssa.OpS390XMULLW,
ssa.OpS390XMULHD, ssa.OpS390XMULHDU,
ssa.OpS390XFMULS, ssa.OpS390XFMUL, ssa.OpS390XFDIVS, ssa.OpS390XFDIV:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
- opregreg(s, v.Op.Asm(), r, v.Args[1].Reg())
+ opregreg(s, v.Op.Asm(), v.Reg(), v.Args[1].Reg())
case ssa.OpS390XFSUBS, ssa.OpS390XFSUB,
ssa.OpS390XFADDS, ssa.OpS390XFADD:
- r := v.Reg0()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
- opregreg(s, v.Op.Asm(), r, v.Args[1].Reg())
+ opregreg(s, v.Op.Asm(), v.Reg0(), v.Args[1].Reg())
case ssa.OpS390XMLGR:
// MLGR Rx R3 -> R2:R3
r0 := v.Args[0].Reg()
@@ -274,10 +258,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.To.Type = obj.TYPE_REG
case ssa.OpS390XFMADD, ssa.OpS390XFMADDS,
ssa.OpS390XFMSUB, ssa.OpS390XFMSUBS:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
r1 := v.Args[1].Reg()
r2 := v.Args[2].Reg()
p := s.Prog(v.Op.Asm())
@@ -285,7 +265,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Reg = r1
p.Reg = r2
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpS390XFIDBR:
switch v.AuxInt {
case 0, 1, 3, 4, 5, 6, 7:
@@ -361,15 +341,11 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpS390XANDconst, ssa.OpS390XANDWconst,
ssa.OpS390XORconst, ssa.OpS390XORWconst,
ssa.OpS390XXORconst, ssa.OpS390XXORWconst:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpS390XSLDconst, ssa.OpS390XSLWconst,
ssa.OpS390XSRDconst, ssa.OpS390XSRWconst,
ssa.OpS390XSRADconst, ssa.OpS390XSRAWconst,
@@ -441,16 +417,12 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.OpS390XANDWload, ssa.OpS390XANDload,
ssa.OpS390XORWload, ssa.OpS390XORload,
ssa.OpS390XXORWload, ssa.OpS390XXORload:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_MEM
p.From.Reg = v.Args[1].Reg()
ssagen.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.OpS390XMOVDload,
ssa.OpS390XMOVWZload, ssa.OpS390XMOVHZload, ssa.OpS390XMOVBZload,
ssa.OpS390XMOVDBRload, ssa.OpS390XMOVWBRload, ssa.OpS390XMOVHBRload,
@@ -608,17 +580,13 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
case ssa.OpS390XSumBytes2, ssa.OpS390XSumBytes4, ssa.OpS390XSumBytes8:
v.Fatalf("SumBytes generated %s", v.LongString())
case ssa.OpS390XLOCGR:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(v.Aux.(s390x.CCMask))
p.Reg = v.Args[1].Reg()
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
- case ssa.OpS390XFSQRT:
+ p.To.Reg = v.Reg()
+ case ssa.OpS390XFSQRTS, ssa.OpS390XFSQRT:
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
@@ -926,7 +894,7 @@ func ssaGenBlock(s *ssagen.State, b, next *ssa.Block) {
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(s390x.NotEqual & s390x.NotUnordered) // unordered is not possible
p.Reg = s390x.REG_R3
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: 0})
+ p.SetFrom3Const(0)
if b.Succs[0].Block() != next {
s.Br(s390x.ABR, b.Succs[0].Block())
}
@@ -969,17 +937,17 @@ func ssaGenBlock(s *ssagen.State, b, next *ssa.Block) {
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(mask & s390x.NotUnordered) // unordered is not possible
p.Reg = b.Controls[0].Reg()
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: b.Controls[1].Reg()})
+ p.SetFrom3Reg(b.Controls[1].Reg())
case ssa.BlockS390XCGIJ, ssa.BlockS390XCIJ:
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(mask & s390x.NotUnordered) // unordered is not possible
p.Reg = b.Controls[0].Reg()
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: int64(int8(b.AuxInt))})
+ p.SetFrom3Const(int64(int8(b.AuxInt)))
case ssa.BlockS390XCLGIJ, ssa.BlockS390XCLIJ:
p.From.Type = obj.TYPE_CONST
p.From.Offset = int64(mask & s390x.NotUnordered) // unordered is not possible
p.Reg = b.Controls[0].Reg()
- p.SetFrom3(obj.Addr{Type: obj.TYPE_CONST, Offset: int64(uint8(b.AuxInt))})
+ p.SetFrom3Const(int64(uint8(b.AuxInt)))
default:
b.Fatalf("branch not implemented: %s", b.LongString())
}
diff --git a/src/cmd/compile/internal/ssa/check.go b/src/cmd/compile/internal/ssa/check.go
index 9e4aa6cd79..969fd96dbf 100644
--- a/src/cmd/compile/internal/ssa/check.go
+++ b/src/cmd/compile/internal/ssa/check.go
@@ -182,6 +182,12 @@ func checkFunc(f *Func) {
f.Fatalf("value %v has Aux type %T, want *AuxCall", v, v.Aux)
}
canHaveAux = true
+ case auxNameOffsetInt8:
+ if _, ok := v.Aux.(*AuxNameOffset); !ok {
+ f.Fatalf("value %v has Aux type %T, want *AuxNameOffset", v, v.Aux)
+ }
+ canHaveAux = true
+ canHaveAuxInt = true
case auxSym, auxTyp:
canHaveAux = true
case auxSymOff, auxSymValAndOff, auxTypSize:
diff --git a/src/cmd/compile/internal/ssa/config.go b/src/cmd/compile/internal/ssa/config.go
index e952c73d9b..9921b51cc7 100644
--- a/src/cmd/compile/internal/ssa/config.go
+++ b/src/cmd/compile/internal/ssa/config.go
@@ -5,6 +5,8 @@
package ssa
import (
+ "cmd/compile/internal/abi"
+ "cmd/compile/internal/base"
"cmd/compile/internal/ir"
"cmd/compile/internal/types"
"cmd/internal/obj"
@@ -20,30 +22,33 @@ type Config struct {
PtrSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.PtrSize
RegSize int64 // 4 or 8; copy of cmd/internal/sys.Arch.RegSize
Types Types
- lowerBlock blockRewriter // lowering function
- lowerValue valueRewriter // lowering function
- splitLoad valueRewriter // function for splitting merged load ops; only used on some architectures
- registers []Register // machine registers
- gpRegMask regMask // general purpose integer register mask
- fpRegMask regMask // floating point register mask
- fp32RegMask regMask // floating point register mask
- fp64RegMask regMask // floating point register mask
- specialRegMask regMask // special register mask
- GCRegMap []*Register // garbage collector register map, by GC register index
- FPReg int8 // register number of frame pointer, -1 if not used
- LinkReg int8 // register number of link register if it is a general purpose register, -1 if not used
- hasGReg bool // has hardware g register
- ctxt *obj.Link // Generic arch information
- optimize bool // Do optimization
- noDuffDevice bool // Don't use Duff's device
- useSSE bool // Use SSE for non-float operations
- useAvg bool // Use optimizations that need Avg* operations
- useHmul bool // Use optimizations that need Hmul* operations
- SoftFloat bool //
- Race bool // race detector enabled
- NeedsFpScratch bool // No direct move between GP and FP register sets
- BigEndian bool //
- UseFMA bool // Use hardware FMA operation
+ lowerBlock blockRewriter // lowering function
+ lowerValue valueRewriter // lowering function
+ splitLoad valueRewriter // function for splitting merged load ops; only used on some architectures
+ registers []Register // machine registers
+ gpRegMask regMask // general purpose integer register mask
+ fpRegMask regMask // floating point register mask
+ fp32RegMask regMask // floating point register mask
+ fp64RegMask regMask // floating point register mask
+ specialRegMask regMask // special register mask
+ intParamRegs []int8 // register numbers of integer param (in/out) registers
+ floatParamRegs []int8 // register numbers of floating param (in/out) registers
+ ABI1 *abi.ABIConfig // "ABIInternal" under development // TODO change comment when this becomes current
+ ABI0 *abi.ABIConfig
+ GCRegMap []*Register // garbage collector register map, by GC register index
+ FPReg int8 // register number of frame pointer, -1 if not used
+ LinkReg int8 // register number of link register if it is a general purpose register, -1 if not used
+ hasGReg bool // has hardware g register
+ ctxt *obj.Link // Generic arch information
+ optimize bool // Do optimization
+ noDuffDevice bool // Don't use Duff's device
+ useSSE bool // Use SSE for non-float operations
+ useAvg bool // Use optimizations that need Avg* operations
+ useHmul bool // Use optimizations that need Hmul* operations
+ SoftFloat bool //
+ Race bool // race detector enabled
+ BigEndian bool //
+ UseFMA bool // Use hardware FMA operation
}
type (
@@ -194,9 +199,12 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config
c.registers = registersAMD64[:]
c.gpRegMask = gpRegMaskAMD64
c.fpRegMask = fpRegMaskAMD64
+ c.specialRegMask = specialRegMaskAMD64
+ c.intParamRegs = paramIntRegAMD64
+ c.floatParamRegs = paramFloatRegAMD64
c.FPReg = framepointerRegAMD64
c.LinkReg = linkRegAMD64
- c.hasGReg = false
+ c.hasGReg = base.Flag.ABIWrap
case "386":
c.PtrSize = 4
c.RegSize = 4
@@ -325,6 +333,9 @@ func NewConfig(arch string, types Types, ctxt *obj.Link, optimize bool) *Config
c.useSSE = true
c.UseFMA = true
+ c.ABI0 = abi.NewABIConfig(0, 0, ctxt.FixedFrameSize())
+ c.ABI1 = abi.NewABIConfig(len(c.intParamRegs), len(c.floatParamRegs), ctxt.FixedFrameSize())
+
// On Plan 9, floating point operations are not allowed in note handler.
if objabi.GOOS == "plan9" {
// Don't use FMA on Plan 9
diff --git a/src/cmd/compile/internal/ssa/cse.go b/src/cmd/compile/internal/ssa/cse.go
index f78527410c..ade5e0648e 100644
--- a/src/cmd/compile/internal/ssa/cse.go
+++ b/src/cmd/compile/internal/ssa/cse.go
@@ -299,7 +299,7 @@ func cmpVal(v, w *Value, auxIDs auxmap) types.Cmp {
// OpSelect is a pseudo-op. We need to be more aggressive
// regarding CSE to keep multiple OpSelect's of the same
// argument from existing.
- if v.Op != OpSelect0 && v.Op != OpSelect1 {
+ if v.Op != OpSelect0 && v.Op != OpSelect1 && v.Op != OpSelectN {
if tc := v.Type.Compare(w.Type); tc != types.CMPeq {
return tc
}
diff --git a/src/cmd/compile/internal/ssa/expand_calls.go b/src/cmd/compile/internal/ssa/expand_calls.go
index 579818e4f3..87b8a02b25 100644
--- a/src/cmd/compile/internal/ssa/expand_calls.go
+++ b/src/cmd/compile/internal/ssa/expand_calls.go
@@ -5,6 +5,8 @@
package ssa
import (
+ "cmd/compile/internal/abi"
+ "cmd/compile/internal/ir"
"cmd/compile/internal/types"
"cmd/internal/src"
"fmt"
@@ -24,10 +26,16 @@ type offsetKey struct {
pt *types.Type
}
+type Abi1RO uint8 // An offset within a parameter's slice of register indices, for abi1.
+
func isBlockMultiValueExit(b *Block) bool {
return (b.Kind == BlockRet || b.Kind == BlockRetJmp) && len(b.Controls) > 0 && b.Controls[0].Op == OpMakeResult
}
+func badVal(s string, v *Value) error {
+ return fmt.Errorf("%s %s", s, v.LongString())
+}
+
// removeTrivialWrapperTypes unwraps layers of
// struct { singleField SomeType } and [1]SomeType
// until a non-wrapper type is reached. This is useful
@@ -51,20 +59,123 @@ func removeTrivialWrapperTypes(t *types.Type) *types.Type {
return t
}
+// A registerCursor tracks which register is used for an Arg or regValues, or a piece of such.
+type registerCursor struct {
+ // TODO(register args) convert this to a generalized target cursor.
+ regsLen int // the number of registers available for this Arg/result (which is all in registers or not at all)
+ nextSlice Abi1RO // the next register/register-slice offset
+ config *abi.ABIConfig
+ regValues *[]*Value // values assigned to registers accumulate here
+}
+
+// next effectively post-increments the register cursor; the receiver is advanced,
+// the old value is returned.
+func (c *registerCursor) next(t *types.Type) registerCursor {
+ rc := *c
+ if int(c.nextSlice) < c.regsLen {
+ w := c.config.NumParamRegs(t)
+ c.nextSlice += Abi1RO(w)
+ }
+ return rc
+}
+
+// plus returns a register cursor offset from the original, without modifying the original.
+func (c *registerCursor) plus(regWidth Abi1RO) registerCursor {
+ rc := *c
+ rc.nextSlice += regWidth
+ return rc
+}
+
+const (
+ // Register offsets for fields of built-in aggregate types; the ones not listed are zero.
+ RO_complex_imag = 1
+ RO_string_len = 1
+ RO_slice_len = 1
+ RO_slice_cap = 2
+ RO_iface_data = 1
+)
+
+func (x *expandState) regWidth(t *types.Type) Abi1RO {
+ return Abi1RO(x.abi1.NumParamRegs(t))
+}
+
+// regOffset returns the register offset of the i'th element of type t
+func (x *expandState) regOffset(t *types.Type, i int) Abi1RO {
+ // TODO maybe cache this in a map if profiling recommends.
+ if i == 0 {
+ return 0
+ }
+ if t.IsArray() {
+ return Abi1RO(i) * x.regWidth(t.Elem())
+ }
+ if t.IsStruct() {
+ k := Abi1RO(0)
+ for j := 0; j < i; j++ {
+ k += x.regWidth(t.FieldType(j))
+ }
+ return k
+ }
+ panic("Haven't implemented this case yet, do I need to?")
+}
+
+// at returns the register cursor for component i of t, where the first
+// component is numbered 0.
+func (c *registerCursor) at(t *types.Type, i int) registerCursor {
+ rc := *c
+ if i == 0 || c.regsLen == 0 {
+ return rc
+ }
+ if t.IsArray() {
+ w := c.config.NumParamRegs(t.Elem())
+ rc.nextSlice += Abi1RO(i * w)
+ return rc
+ }
+ if t.IsStruct() {
+ for j := 0; j < i; j++ {
+ rc.next(t.FieldType(j))
+ }
+ return rc
+ }
+ panic("Haven't implemented this case yet, do I need to?")
+}
+
+func (c *registerCursor) init(regs []abi.RegIndex, info *abi.ABIParamResultInfo, result *[]*Value) {
+ c.regsLen = len(regs)
+ c.nextSlice = 0
+ if len(regs) == 0 {
+ return
+ }
+ c.config = info.Config()
+ c.regValues = result
+}
+
+func (c *registerCursor) addArg(v *Value) {
+ *c.regValues = append(*c.regValues, v)
+}
+
+func (c *registerCursor) hasRegs() bool {
+ return c.regsLen > 0
+}
+
type expandState struct {
- f *Func
- debug bool
- canSSAType func(*types.Type) bool
- regSize int64
- sp *Value
- typs *Types
- ptrSize int64
- hiOffset int64
- lowOffset int64
- namedSelects map[*Value][]namedVal
- sdom SparseTree
- common map[selKey]*Value
- offsets map[offsetKey]*Value
+ f *Func
+ abi1 *abi.ABIConfig
+ debug bool
+ canSSAType func(*types.Type) bool
+ regSize int64
+ sp *Value
+ typs *Types
+ ptrSize int64
+ hiOffset int64
+ lowOffset int64
+ hiRo Abi1RO
+ loRo Abi1RO
+ namedSelects map[*Value][]namedVal
+ sdom SparseTree
+ commonSelectors map[selKey]*Value // used to de-dupe selectors
+ commonArgs map[selKey]*Value // used to de-dupe OpArg/OpArgIntReg/OpArgFloatReg
+ offsets map[offsetKey]*Value
+ memForCall map[ID]*Value // For a call, need to know the unique selector that gets the mem.
}
// intPairTypes returns the pair of 32-bit int types needed to encode a 64-bit integer type on a target
@@ -123,6 +234,27 @@ func (x *expandState) splitSlots(ls []LocalSlot, sfx string, offset int64, ty *t
return locs
}
+// prAssignForArg returns the ABIParamAssignment for v, assumed to be an OpArg.
+func (x *expandState) prAssignForArg(v *Value) abi.ABIParamAssignment {
+ if v.Op != OpArg {
+ panic(badVal("Wanted OpArg, instead saw", v))
+ }
+ return ParamAssignmentForArgName(x.f, v.Aux.(*ir.Name))
+}
+
+// ParamAssignmentForArgName returns the ABIParamAssignment for f's arg with matching name.
+func ParamAssignmentForArgName(f *Func, name *ir.Name) abi.ABIParamAssignment {
+ abiInfo := f.OwnAux.abiInfo
+ // This is unfortunate, but apparently the only way.
+ // TODO after register args stabilize, find a better way
+ for _, a := range abiInfo.InParams() {
+ if a.Name == name {
+ return a
+ }
+ }
+ panic(fmt.Errorf("Did not match param %v in prInfo %+v", name, abiInfo.InParams()))
+}
+
// Calls that need lowering have some number of inputs, including a memory input,
// and produce a tuple of (value1, value2, ..., mem) where valueK may or may not be SSA-able.
@@ -140,7 +272,7 @@ func (x *expandState) splitSlots(ls []LocalSlot, sfx string, offset int64, ty *t
// It emits the code necessary to implement the leaf select operation that leads to the root.
//
// TODO when registers really arrive, must also decompose anything split across two registers or registers and memory.
-func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64) []LocalSlot {
+func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64, regOffset Abi1RO) []LocalSlot {
if x.debug {
fmt.Printf("rewriteSelect(%s, %s, %d)\n", leaf.LongString(), selector.LongString(), offset)
}
@@ -159,7 +291,7 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64)
case OpArg:
if !x.isAlreadyExpandedAggregateType(selector.Type) {
if leafType == selector.Type { // OpIData leads us here, sometimes.
- leaf.copyOf(selector)
+ x.newArgToMemOrRegs(selector, leaf, offset, regOffset, leafType, leaf.Pos)
} else {
x.f.Fatalf("Unexpected OpArg type, selector=%s, leaf=%s\n", selector.LongString(), leaf.LongString())
}
@@ -172,20 +304,8 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64)
case OpIData, OpStructSelect, OpArraySelect:
leafType = removeTrivialWrapperTypes(leaf.Type)
}
- aux := selector.Aux
- auxInt := selector.AuxInt + offset
- if leaf.Block == selector.Block {
- leaf.reset(OpArg)
- leaf.Aux = aux
- leaf.AuxInt = auxInt
- leaf.Type = leafType
- } else {
- w := selector.Block.NewValue0IA(leaf.Pos, OpArg, leafType, auxInt, aux)
- leaf.copyOf(w)
- if x.debug {
- fmt.Printf("\tnew %s\n", w.LongString())
- }
- }
+ x.newArgToMemOrRegs(selector, leaf, offset, regOffset, leafType, leaf.Pos)
+
for _, s := range x.namedSelects[selector] {
locs = append(locs, x.f.Names[s.locIndex])
}
@@ -228,19 +348,51 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64)
}
case OpSelectN:
+ // TODO(register args) result case
+ // if applied to Op-mumble-call, the Aux tells us which result, regOffset specifies offset within result. If a register, should rewrite to OpSelectN for new call.
// TODO these may be duplicated. Should memoize. Intermediate selectors will go dead, no worries there.
call := selector.Args[0]
aux := call.Aux.(*AuxCall)
which := selector.AuxInt
if which == aux.NResults() { // mem is after the results.
// rewrite v as a Copy of call -- the replacement call will produce a mem.
- leaf.copyOf(call)
+ if call.Op == OpStaticLECall {
+ if leaf != selector {
+ panic("Unexpected selector of memory")
+ }
+ // StaticCall selector will address last element of Result.
+ // TODO do this for all the other call types eventually.
+ if aux.abiInfo == nil {
+ panic(badVal("aux.abiInfo nil for call", call))
+ }
+ if existing := x.memForCall[call.ID]; existing == nil {
+ selector.AuxInt = int64(aux.abiInfo.OutRegistersUsed())
+ x.memForCall[call.ID] = selector
+ } else {
+ selector.copyOf(existing)
+ }
+ } else {
+ leaf.copyOf(call)
+ }
} else {
leafType := removeTrivialWrapperTypes(leaf.Type)
if x.canSSAType(leafType) {
pt := types.NewPtr(leafType)
off := x.offsetFrom(x.sp, offset+aux.OffsetOfResult(which), pt)
// Any selection right out of the arg area/registers has to be same Block as call, use call as mem input.
+ if call.Op == OpStaticLECall { // TODO this is temporary until all calls are register-able
+ // Create a "mem" for any loads that need to occur.
+ if mem := x.memForCall[call.ID]; mem != nil {
+ if mem.Block != call.Block {
+ panic(fmt.Errorf("selector and call need to be in same block, selector=%s; call=%s", selector.LongString(), call.LongString()))
+ }
+ call = mem
+ } else {
+ mem = call.Block.NewValue1I(call.Pos.WithNotStmt(), OpSelectN, types.TypeMem, int64(aux.abiInfo.OutRegistersUsed()), call)
+ x.memForCall[call.ID] = mem
+ call = mem
+ }
+ }
if leaf.Block == call.Block {
leaf.reset(OpLoad)
leaf.SetArgs2(off, call)
@@ -264,9 +416,10 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64)
w := selector.Args[0]
var ls []LocalSlot
if w.Type.Kind() != types.TSTRUCT { // IData artifact
- ls = x.rewriteSelect(leaf, w, offset)
+ ls = x.rewriteSelect(leaf, w, offset, regOffset)
} else {
- ls = x.rewriteSelect(leaf, w, offset+w.Type.FieldOff(int(selector.AuxInt)))
+ fldi := int(selector.AuxInt)
+ ls = x.rewriteSelect(leaf, w, offset+w.Type.FieldOff(fldi), regOffset+x.regOffset(w.Type, fldi))
if w.Op != OpIData {
for _, l := range ls {
locs = append(locs, x.f.fe.SplitStruct(l, int(selector.AuxInt)))
@@ -276,30 +429,31 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64)
case OpArraySelect:
w := selector.Args[0]
- x.rewriteSelect(leaf, w, offset+selector.Type.Size()*selector.AuxInt)
+ index := selector.AuxInt
+ x.rewriteSelect(leaf, w, offset+selector.Type.Size()*index, regOffset+x.regOffset(w.Type, int(index)))
case OpInt64Hi:
w := selector.Args[0]
- ls := x.rewriteSelect(leaf, w, offset+x.hiOffset)
+ ls := x.rewriteSelect(leaf, w, offset+x.hiOffset, regOffset+x.hiRo)
locs = x.splitSlots(ls, ".hi", x.hiOffset, leafType)
case OpInt64Lo:
w := selector.Args[0]
- ls := x.rewriteSelect(leaf, w, offset+x.lowOffset)
+ ls := x.rewriteSelect(leaf, w, offset+x.lowOffset, regOffset+x.loRo)
locs = x.splitSlots(ls, ".lo", x.lowOffset, leafType)
case OpStringPtr:
- ls := x.rewriteSelect(leaf, selector.Args[0], offset)
+ ls := x.rewriteSelect(leaf, selector.Args[0], offset, regOffset)
locs = x.splitSlots(ls, ".ptr", 0, x.typs.BytePtr)
case OpSlicePtr:
w := selector.Args[0]
- ls := x.rewriteSelect(leaf, w, offset)
+ ls := x.rewriteSelect(leaf, w, offset, regOffset)
locs = x.splitSlots(ls, ".ptr", 0, types.NewPtr(w.Type.Elem()))
case OpITab:
w := selector.Args[0]
- ls := x.rewriteSelect(leaf, w, offset)
+ ls := x.rewriteSelect(leaf, w, offset, regOffset)
sfx := ".itab"
if w.Type.IsEmptyInterface() {
sfx = ".type"
@@ -307,27 +461,27 @@ func (x *expandState) rewriteSelect(leaf *Value, selector *Value, offset int64)
locs = x.splitSlots(ls, sfx, 0, x.typs.Uintptr)
case OpComplexReal:
- ls := x.rewriteSelect(leaf, selector.Args[0], offset)
+ ls := x.rewriteSelect(leaf, selector.Args[0], offset, regOffset)
locs = x.splitSlots(ls, ".real", 0, leafType)
case OpComplexImag:
- ls := x.rewriteSelect(leaf, selector.Args[0], offset+leafType.Width) // result is FloatNN, width of result is offset of imaginary part.
+ ls := x.rewriteSelect(leaf, selector.Args[0], offset+leafType.Width, regOffset+RO_complex_imag) // result is FloatNN, width of result is offset of imaginary part.
locs = x.splitSlots(ls, ".imag", leafType.Width, leafType)
case OpStringLen, OpSliceLen:
- ls := x.rewriteSelect(leaf, selector.Args[0], offset+x.ptrSize)
+ ls := x.rewriteSelect(leaf, selector.Args[0], offset+x.ptrSize, regOffset+RO_slice_len)
locs = x.splitSlots(ls, ".len", x.ptrSize, leafType)
case OpIData:
- ls := x.rewriteSelect(leaf, selector.Args[0], offset+x.ptrSize)
+ ls := x.rewriteSelect(leaf, selector.Args[0], offset+x.ptrSize, regOffset+RO_iface_data)
locs = x.splitSlots(ls, ".data", x.ptrSize, leafType)
case OpSliceCap:
- ls := x.rewriteSelect(leaf, selector.Args[0], offset+2*x.ptrSize)
+ ls := x.rewriteSelect(leaf, selector.Args[0], offset+2*x.ptrSize, regOffset+RO_slice_cap)
locs = x.splitSlots(ls, ".cap", 2*x.ptrSize, leafType)
case OpCopy: // If it's an intermediate result, recurse
- locs = x.rewriteSelect(leaf, selector.Args[0], offset)
+ locs = x.rewriteSelect(leaf, selector.Args[0], offset, regOffset)
for _, s := range x.namedSelects[selector] {
// this copy may have had its own name, preserve that, too.
locs = append(locs, x.f.Names[s.locIndex])
@@ -360,24 +514,42 @@ func (x *expandState) rewriteDereference(b *Block, base, a, mem *Value, offset,
// decomposeArgOrLoad is a helper for storeArgOrLoad.
// It decomposes a Load or an Arg into smaller parts, parameterized by the decomposeOne and decomposeTwo functions
-// passed to it, and returns the new mem. If the type does not match one of the expected aggregate types, it returns nil instead.
-func (x *expandState) decomposeArgOrLoad(pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offset int64,
- decomposeOne func(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1 *types.Type, offArg, offStore int64) *Value,
- decomposeTwo func(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1, t2 *types.Type, offArg, offStore int64) *Value) *Value {
+// passed to it, and returns the new mem.
+// If the type does not match one of the expected aggregate types, it returns nil instead.
+// Parameters:
+// pos -- the location of any generated code.
+// b -- the block into which any generated code should normally be placed
+// base -- for the stores that will ultimately be generated, the base to which the offset is applied. (Note this disappears in a future CL, folded into storeRc)
+// source -- the value, possibly an aggregate, to be stored.
+// mem -- the mem flowing into this decomposition (loads depend on it, stores updated it)
+// t -- the type of the value to be stored
+// offset -- if the value is stored in memory, it is stored at base + offset
+// loadRegOffset -- regarding source as a value in registers, the register offset in ABI1. Meaningful only if source is OpArg.
+// storeRc -- storeRC; if the value is stored in registers, this specifies the registers. StoreRc also identifies whether the target is registers or memory.
+//
+// TODO -- this needs cleanup; it just works for SSA-able aggregates, and won't fully generalize to register-args aggregates.
+func (x *expandState) decomposeArgOrLoad(pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offset int64, loadRegOffset Abi1RO, storeRc registerCursor,
+ // For decompose One and Two, the additional offArg provides the offset from the beginning of "source", if it is in memory.
+ // offStore is combined to base to obtain a store destionation, like "offset" of decomposeArgOrLoad
+ decomposeOne func(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1 *types.Type, offArg, offStore int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value,
+ decomposeTwo func(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1, t2 *types.Type, offArg, offStore int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value) *Value {
u := source.Type
switch u.Kind() {
case types.TARRAY:
elem := u.Elem()
+ elemRO := x.regWidth(elem)
for i := int64(0); i < u.NumElem(); i++ {
elemOff := i * elem.Size()
- mem = decomposeOne(x, pos, b, base, source, mem, elem, source.AuxInt+elemOff, offset+elemOff)
+ mem = decomposeOne(x, pos, b, base, source, mem, elem, elemOff, offset+elemOff, loadRegOffset, storeRc.next(elem))
+ loadRegOffset += elemRO
pos = pos.WithNotStmt()
}
return mem
case types.TSTRUCT:
for i := 0; i < u.NumFields(); i++ {
fld := u.Field(i)
- mem = decomposeOne(x, pos, b, base, source, mem, fld.Type, source.AuxInt+fld.Offset, offset+fld.Offset)
+ mem = decomposeOne(x, pos, b, base, source, mem, fld.Type, fld.Offset, offset+fld.Offset, loadRegOffset, storeRc.next(fld.Type))
+ loadRegOffset += x.regWidth(fld.Type)
pos = pos.WithNotStmt()
}
return mem
@@ -386,20 +558,20 @@ func (x *expandState) decomposeArgOrLoad(pos src.XPos, b *Block, base, source, m
break
}
tHi, tLo := x.intPairTypes(t.Kind())
- mem = decomposeOne(x, pos, b, base, source, mem, tHi, source.AuxInt+x.hiOffset, offset+x.hiOffset)
+ mem = decomposeOne(x, pos, b, base, source, mem, tHi, x.hiOffset, offset+x.hiOffset, loadRegOffset+x.hiRo, storeRc.plus(x.hiRo))
pos = pos.WithNotStmt()
- return decomposeOne(x, pos, b, base, source, mem, tLo, source.AuxInt+x.lowOffset, offset+x.lowOffset)
+ return decomposeOne(x, pos, b, base, source, mem, tLo, x.lowOffset, offset+x.lowOffset, loadRegOffset+x.loRo, storeRc.plus(x.loRo))
case types.TINTER:
- return decomposeTwo(x, pos, b, base, source, mem, x.typs.Uintptr, x.typs.BytePtr, source.AuxInt, offset)
+ return decomposeTwo(x, pos, b, base, source, mem, x.typs.Uintptr, x.typs.BytePtr, 0, offset, loadRegOffset, storeRc)
case types.TSTRING:
- return decomposeTwo(x, pos, b, base, source, mem, x.typs.BytePtr, x.typs.Int, source.AuxInt, offset)
+ return decomposeTwo(x, pos, b, base, source, mem, x.typs.BytePtr, x.typs.Int, 0, offset, loadRegOffset, storeRc)
case types.TCOMPLEX64:
- return decomposeTwo(x, pos, b, base, source, mem, x.typs.Float32, x.typs.Float32, source.AuxInt, offset)
+ return decomposeTwo(x, pos, b, base, source, mem, x.typs.Float32, x.typs.Float32, 0, offset, loadRegOffset, storeRc)
case types.TCOMPLEX128:
- return decomposeTwo(x, pos, b, base, source, mem, x.typs.Float64, x.typs.Float64, source.AuxInt, offset)
+ return decomposeTwo(x, pos, b, base, source, mem, x.typs.Float64, x.typs.Float64, 0, offset, loadRegOffset, storeRc)
case types.TSLICE:
- mem = decomposeTwo(x, pos, b, base, source, mem, x.typs.BytePtr, x.typs.Int, source.AuxInt, offset)
- return decomposeOne(x, pos, b, base, source, mem, x.typs.Int, source.AuxInt+2*x.ptrSize, offset+2*x.ptrSize)
+ mem = decomposeOne(x, pos, b, base, source, mem, x.typs.BytePtr, 0, offset, loadRegOffset, storeRc.next(x.typs.BytePtr))
+ return decomposeTwo(x, pos, b, base, source, mem, x.typs.Int, x.typs.Int, x.ptrSize, offset+x.ptrSize, loadRegOffset+RO_slice_len, storeRc)
}
return nil
}
@@ -407,79 +579,83 @@ func (x *expandState) decomposeArgOrLoad(pos src.XPos, b *Block, base, source, m
// storeOneArg creates a decomposed (one step) arg that is then stored.
// pos and b locate the store instruction, base is the base of the store target, source is the "base" of the value input,
// mem is the input mem, t is the type in question, and offArg and offStore are the offsets from the respective bases.
-func storeOneArg(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offArg, offStore int64) *Value {
- w := x.common[selKey{source, offArg, t.Width, t}]
+func storeOneArg(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offArg, offStore int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value {
+ w := x.commonArgs[selKey{source, offArg, t.Width, t}]
if w == nil {
- w = source.Block.NewValue0IA(source.Pos, OpArg, t, offArg, source.Aux)
- x.common[selKey{source, offArg, t.Width, t}] = w
+ // w = source.Block.NewValue0IA(source.Pos, OpArg, t, offArg, source.Aux)
+ w = x.newArgToMemOrRegs(source, w, offArg, loadRegOffset, t, pos)
+ // x.commonArgs[selKey{source, offArg, t.Width, t}] = w
}
- return x.storeArgOrLoad(pos, b, base, w, mem, t, offStore)
+ return x.storeArgOrLoad(pos, b, base, w, mem, t, offStore, loadRegOffset, storeRc)
}
// storeOneLoad creates a decomposed (one step) load that is then stored.
-func storeOneLoad(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offArg, offStore int64) *Value {
+func storeOneLoad(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offArg, offStore int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value {
from := x.offsetFrom(source.Args[0], offArg, types.NewPtr(t))
w := source.Block.NewValue2(source.Pos, OpLoad, t, from, mem)
- return x.storeArgOrLoad(pos, b, base, w, mem, t, offStore)
+ return x.storeArgOrLoad(pos, b, base, w, mem, t, offStore, loadRegOffset, storeRc)
}
-func storeTwoArg(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1, t2 *types.Type, offArg, offStore int64) *Value {
- mem = storeOneArg(x, pos, b, base, source, mem, t1, offArg, offStore)
+func storeTwoArg(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1, t2 *types.Type, offArg, offStore int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value {
+ mem = storeOneArg(x, pos, b, base, source, mem, t1, offArg, offStore, loadRegOffset, storeRc.next(t1))
pos = pos.WithNotStmt()
t1Size := t1.Size()
- return storeOneArg(x, pos, b, base, source, mem, t2, offArg+t1Size, offStore+t1Size)
+ return storeOneArg(x, pos, b, base, source, mem, t2, offArg+t1Size, offStore+t1Size, loadRegOffset+1, storeRc)
}
-func storeTwoLoad(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1, t2 *types.Type, offArg, offStore int64) *Value {
- mem = storeOneLoad(x, pos, b, base, source, mem, t1, offArg, offStore)
+// storeTwoLoad creates a pair of decomposed (one step) loads that are then stored.
+// the elements of the pair must not require any additional alignment.
+func storeTwoLoad(x *expandState, pos src.XPos, b *Block, base, source, mem *Value, t1, t2 *types.Type, offArg, offStore int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value {
+ mem = storeOneLoad(x, pos, b, base, source, mem, t1, offArg, offStore, loadRegOffset, storeRc.next(t1))
pos = pos.WithNotStmt()
t1Size := t1.Size()
- return storeOneLoad(x, pos, b, base, source, mem, t2, offArg+t1Size, offStore+t1Size)
+ return storeOneLoad(x, pos, b, base, source, mem, t2, offArg+t1Size, offStore+t1Size, loadRegOffset+1, storeRc)
}
-// storeArgOrLoad converts stores of SSA-able aggregate arguments (passed to a call) into a series of primitive-typed
+// storeArgOrLoad converts stores of SSA-able potentially aggregatable arguments (passed to a call) into a series of primitive-typed
// stores of non-aggregate types. It recursively walks up a chain of selectors until it reaches a Load or an Arg.
// If it does not reach a Load or an Arg, nothing happens; this allows a little freedom in phase ordering.
-func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offset int64) *Value {
+func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, base, source, mem *Value, t *types.Type, offset int64, loadRegOffset Abi1RO, storeRc registerCursor) *Value {
if x.debug {
fmt.Printf("\tstoreArgOrLoad(%s; %s; %s; %s; %d)\n", base.LongString(), source.LongString(), mem.String(), t.String(), offset)
}
switch source.Op {
case OpCopy:
- return x.storeArgOrLoad(pos, b, base, source.Args[0], mem, t, offset)
+ return x.storeArgOrLoad(pos, b, base, source.Args[0], mem, t, offset, loadRegOffset, storeRc)
case OpLoad:
- ret := x.decomposeArgOrLoad(pos, b, base, source, mem, t, offset, storeOneLoad, storeTwoLoad)
+ ret := x.decomposeArgOrLoad(pos, b, base, source, mem, t, offset, loadRegOffset, storeRc, storeOneLoad, storeTwoLoad)
if ret != nil {
return ret
}
case OpArg:
- ret := x.decomposeArgOrLoad(pos, b, base, source, mem, t, offset, storeOneArg, storeTwoArg)
+ ret := x.decomposeArgOrLoad(pos, b, base, source, mem, t, offset, loadRegOffset, storeRc, storeOneArg, storeTwoArg)
if ret != nil {
return ret
}
case OpArrayMake0, OpStructMake0:
+ // TODO(register args) is this correct for registers?
return mem
case OpStructMake1, OpStructMake2, OpStructMake3, OpStructMake4:
for i := 0; i < t.NumFields(); i++ {
fld := t.Field(i)
- mem = x.storeArgOrLoad(pos, b, base, source.Args[i], mem, fld.Type, offset+fld.Offset)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[i], mem, fld.Type, offset+fld.Offset, 0, storeRc.next(fld.Type))
pos = pos.WithNotStmt()
}
return mem
case OpArrayMake1:
- return x.storeArgOrLoad(pos, b, base, source.Args[0], mem, t.Elem(), offset)
+ return x.storeArgOrLoad(pos, b, base, source.Args[0], mem, t.Elem(), offset, 0, storeRc.at(t, 0))
case OpInt64Make:
tHi, tLo := x.intPairTypes(t.Kind())
- mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, tHi, offset+x.hiOffset)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, tHi, offset+x.hiOffset, 0, storeRc.next(tHi))
pos = pos.WithNotStmt()
- return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, tLo, offset+x.lowOffset)
+ return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, tLo, offset+x.lowOffset, 0, storeRc)
case OpComplexMake:
tPart := x.typs.Float32
@@ -487,25 +663,25 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, base, source, mem *
if wPart == 8 {
tPart = x.typs.Float64
}
- mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, tPart, offset)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, tPart, offset, 0, storeRc.next(tPart))
pos = pos.WithNotStmt()
- return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, tPart, offset+wPart)
+ return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, tPart, offset+wPart, 0, storeRc)
case OpIMake:
- mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, x.typs.Uintptr, offset)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, x.typs.Uintptr, offset, 0, storeRc.next(x.typs.Uintptr))
pos = pos.WithNotStmt()
- return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, x.typs.BytePtr, offset+x.ptrSize)
+ return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, x.typs.BytePtr, offset+x.ptrSize, 0, storeRc)
case OpStringMake:
- mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, x.typs.BytePtr, offset)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, x.typs.BytePtr, offset, 0, storeRc.next(x.typs.BytePtr))
pos = pos.WithNotStmt()
- return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, x.typs.Int, offset+x.ptrSize)
+ return x.storeArgOrLoad(pos, b, base, source.Args[1], mem, x.typs.Int, offset+x.ptrSize, 0, storeRc)
case OpSliceMake:
- mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, x.typs.BytePtr, offset)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[0], mem, x.typs.BytePtr, offset, 0, storeRc.next(x.typs.BytePtr))
pos = pos.WithNotStmt()
- mem = x.storeArgOrLoad(pos, b, base, source.Args[1], mem, x.typs.Int, offset+x.ptrSize)
- return x.storeArgOrLoad(pos, b, base, source.Args[2], mem, x.typs.Int, offset+2*x.ptrSize)
+ mem = x.storeArgOrLoad(pos, b, base, source.Args[1], mem, x.typs.Int, offset+x.ptrSize, 0, storeRc.next(x.typs.Int))
+ return x.storeArgOrLoad(pos, b, base, source.Args[2], mem, x.typs.Int, offset+2*x.ptrSize, 0, storeRc)
}
// For nodes that cannot be taken apart -- OpSelectN, other structure selectors.
@@ -515,11 +691,13 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, base, source, mem *
if source.Type != t && t.NumElem() == 1 && elt.Width == t.Width && t.Width == x.regSize {
t = removeTrivialWrapperTypes(t)
// it could be a leaf type, but the "leaf" could be complex64 (for example)
- return x.storeArgOrLoad(pos, b, base, source, mem, t, offset)
+ return x.storeArgOrLoad(pos, b, base, source, mem, t, offset, loadRegOffset, storeRc)
}
+ eltRO := x.regWidth(elt)
for i := int64(0); i < t.NumElem(); i++ {
sel := source.Block.NewValue1I(pos, OpArraySelect, elt, i, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, elt, offset+i*elt.Width)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, elt, offset+i*elt.Width, loadRegOffset, storeRc.at(t, 0))
+ loadRegOffset += eltRO
pos = pos.WithNotStmt()
}
return mem
@@ -546,13 +724,14 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, base, source, mem *
// of a *uint8, which does not succeed.
t = removeTrivialWrapperTypes(t)
// it could be a leaf type, but the "leaf" could be complex64 (for example)
- return x.storeArgOrLoad(pos, b, base, source, mem, t, offset)
+ return x.storeArgOrLoad(pos, b, base, source, mem, t, offset, loadRegOffset, storeRc)
}
for i := 0; i < t.NumFields(); i++ {
fld := t.Field(i)
sel := source.Block.NewValue1I(pos, OpStructSelect, fld.Type, int64(i), source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, fld.Type, offset+fld.Offset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, fld.Type, offset+fld.Offset, loadRegOffset, storeRc.next(fld.Type))
+ loadRegOffset += x.regWidth(fld.Type)
pos = pos.WithNotStmt()
}
return mem
@@ -563,52 +742,58 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, base, source, mem *
}
tHi, tLo := x.intPairTypes(t.Kind())
sel := source.Block.NewValue1(pos, OpInt64Hi, tHi, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, tHi, offset+x.hiOffset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, tHi, offset+x.hiOffset, loadRegOffset+x.hiRo, storeRc.plus(x.hiRo))
pos = pos.WithNotStmt()
sel = source.Block.NewValue1(pos, OpInt64Lo, tLo, source)
- return x.storeArgOrLoad(pos, b, base, sel, mem, tLo, offset+x.lowOffset)
+ return x.storeArgOrLoad(pos, b, base, sel, mem, tLo, offset+x.lowOffset, loadRegOffset+x.loRo, storeRc.plus(x.hiRo))
case types.TINTER:
sel := source.Block.NewValue1(pos, OpITab, x.typs.BytePtr, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.BytePtr, offset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.BytePtr, offset, loadRegOffset, storeRc.next(x.typs.BytePtr))
pos = pos.WithNotStmt()
sel = source.Block.NewValue1(pos, OpIData, x.typs.BytePtr, source)
- return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.BytePtr, offset+x.ptrSize)
+ return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.BytePtr, offset+x.ptrSize, loadRegOffset+RO_iface_data, storeRc)
case types.TSTRING:
sel := source.Block.NewValue1(pos, OpStringPtr, x.typs.BytePtr, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.BytePtr, offset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.BytePtr, offset, loadRegOffset, storeRc.next(x.typs.BytePtr))
pos = pos.WithNotStmt()
sel = source.Block.NewValue1(pos, OpStringLen, x.typs.Int, source)
- return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Int, offset+x.ptrSize)
+ return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Int, offset+x.ptrSize, loadRegOffset+RO_string_len, storeRc)
case types.TSLICE:
et := types.NewPtr(t.Elem())
sel := source.Block.NewValue1(pos, OpSlicePtr, et, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, et, offset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, et, offset, loadRegOffset, storeRc.next(et))
pos = pos.WithNotStmt()
sel = source.Block.NewValue1(pos, OpSliceLen, x.typs.Int, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Int, offset+x.ptrSize)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Int, offset+x.ptrSize, loadRegOffset+RO_slice_len, storeRc.next(x.typs.Int))
sel = source.Block.NewValue1(pos, OpSliceCap, x.typs.Int, source)
- return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Int, offset+2*x.ptrSize)
+ return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Int, offset+2*x.ptrSize, loadRegOffset+RO_slice_cap, storeRc)
case types.TCOMPLEX64:
sel := source.Block.NewValue1(pos, OpComplexReal, x.typs.Float32, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float32, offset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float32, offset, loadRegOffset, storeRc.next(x.typs.Float32))
pos = pos.WithNotStmt()
sel = source.Block.NewValue1(pos, OpComplexImag, x.typs.Float32, source)
- return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float32, offset+4)
+ return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float32, offset+4, loadRegOffset+RO_complex_imag, storeRc)
case types.TCOMPLEX128:
sel := source.Block.NewValue1(pos, OpComplexReal, x.typs.Float64, source)
- mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float64, offset)
+ mem = x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float64, offset, loadRegOffset, storeRc.next(x.typs.Float64))
pos = pos.WithNotStmt()
sel = source.Block.NewValue1(pos, OpComplexImag, x.typs.Float64, source)
- return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float64, offset+8)
+ return x.storeArgOrLoad(pos, b, base, sel, mem, x.typs.Float64, offset+8, loadRegOffset+RO_complex_imag, storeRc)
}
- dst := x.offsetFrom(base, offset, types.NewPtr(t))
- s := b.NewValue3A(pos, OpStore, types.TypeMem, t, dst, source, mem)
+ s := mem
+ if storeRc.hasRegs() {
+ // TODO(register args)
+ storeRc.addArg(source)
+ } else {
+ dst := x.offsetFrom(base, offset, types.NewPtr(t))
+ s = b.NewValue3A(pos, OpStore, types.TypeMem, t, dst, source, mem)
+ }
if x.debug {
fmt.Printf("\t\tstoreArg returns %s\n", s.LongString())
}
@@ -624,6 +809,7 @@ func (x *expandState) rewriteArgs(v *Value, firstArg int) *Value {
pos := v.Pos.WithNotStmt()
m0 := v.MemoryArg()
mem := m0
+ allResults := []*Value{}
for i, a := range v.Args {
if i < firstArg {
continue
@@ -632,18 +818,34 @@ func (x *expandState) rewriteArgs(v *Value, firstArg int) *Value {
break
}
auxI := int64(i - firstArg)
+ aRegs := aux.RegsOfArg(auxI)
+ aType := aux.TypeOfArg(auxI)
if a.Op == OpDereference {
+ aOffset := aux.OffsetOfArg(auxI)
if a.MemoryArg() != m0 {
x.f.Fatalf("Op...LECall and OpDereference have mismatched mem, %s and %s", v.LongString(), a.LongString())
}
+ if len(aRegs) > 0 {
+ x.f.Fatalf("Not implemented yet, not-SSA-type %v passed in registers", aType)
+ }
// "Dereference" of addressed (probably not-SSA-eligible) value becomes Move
- // TODO this will be more complicated with registers in the picture.
- mem = x.rewriteDereference(v.Block, x.sp, a, mem, aux.OffsetOfArg(auxI), aux.SizeOfArg(auxI), aux.TypeOfArg(auxI), pos)
+ // TODO(register args) this will be more complicated with registers in the picture.
+ mem = x.rewriteDereference(v.Block, x.sp, a, mem, aOffset, aux.SizeOfArg(auxI), aType, pos)
} else {
+ var rc registerCursor
+ var result *[]*Value
+ var aOffset int64
+ if len(aRegs) > 0 {
+ result = &allResults
+ } else {
+ aOffset = aux.OffsetOfArg(auxI)
+ }
if x.debug {
- fmt.Printf("storeArg %s, %v, %d\n", a.LongString(), aux.TypeOfArg(auxI), aux.OffsetOfArg(auxI))
+ fmt.Printf("storeArg %s, %v, %d\n", a.LongString(), aType, aOffset)
}
- mem = x.storeArgOrLoad(pos, v.Block, x.sp, a, mem, aux.TypeOfArg(auxI), aux.OffsetOfArg(auxI))
+ rc.init(aRegs, aux.abiInfo, result)
+ mem = x.storeArgOrLoad(pos, v.Block, x.sp, a, mem, aType, aOffset, 0, rc)
+ // TODO append mem to Result, update type
}
}
v.resetArgs()
@@ -667,6 +869,7 @@ func expandCalls(f *Func) {
sp, _ := f.spSb()
x := &expandState{
f: f,
+ abi1: f.ABI1,
debug: f.pass.debug > 0,
canSSAType: f.fe.CanSSA,
regSize: f.Config.RegSize,
@@ -675,15 +878,18 @@ func expandCalls(f *Func) {
ptrSize: f.Config.PtrSize,
namedSelects: make(map[*Value][]namedVal),
sdom: f.Sdom(),
- common: make(map[selKey]*Value),
+ commonArgs: make(map[selKey]*Value),
offsets: make(map[offsetKey]*Value),
+ memForCall: make(map[ID]*Value),
}
// For 32-bit, need to deal with decomposition of 64-bit integers, which depends on endianness.
if f.Config.BigEndian {
- x.lowOffset = 4
+ x.lowOffset, x.hiOffset = 4, 0
+ x.loRo, x.hiRo = 1, 0
} else {
- x.hiOffset = 4
+ x.lowOffset, x.hiOffset = 0, 4
+ x.loRo, x.hiRo = 0, 1
}
if x.debug {
@@ -692,7 +898,7 @@ func expandCalls(f *Func) {
// TODO if too slow, whole program iteration can be replaced w/ slices of appropriate values, accumulated in first loop here.
- // Step 0: rewrite the calls to convert incoming args to stores.
+ // Step 0: rewrite the calls to convert args to calls into stores/register movement.
for _, b := range f.Blocks {
for _, v := range b.Values {
switch v.Op {
@@ -717,6 +923,7 @@ func expandCalls(f *Func) {
mem := m0
aux := f.OwnAux
pos := v.Pos.WithNotStmt()
+ allResults := []*Value{}
for j, a := range v.Args {
i := int64(j)
if a == m0 {
@@ -726,7 +933,11 @@ func expandCalls(f *Func) {
auxBase := b.NewValue2A(v.Pos, OpLocalAddr, types.NewPtr(auxType), aux.results[i].Name, x.sp, mem)
auxOffset := int64(0)
auxSize := aux.SizeOfResult(i)
+ aRegs := aux.RegsOfResult(int64(j))
if a.Op == OpDereference {
+ if len(aRegs) > 0 {
+ x.f.Fatalf("Not implemented yet, not-SSA-type %v returned in register", auxType)
+ }
// Avoid a self-move, and if one is detected try to remove the already-inserted VarDef for the assignment that won't happen.
if dAddr, dMem := a.Args[0], a.Args[1]; dAddr.Op == OpLocalAddr && dAddr.Args[0].Op == OpSP &&
dAddr.Args[1] == dMem && dAddr.Aux == aux.results[i].Name {
@@ -738,12 +949,20 @@ func expandCalls(f *Func) {
mem = x.rewriteDereference(v.Block, auxBase, a, mem, auxOffset, auxSize, auxType, pos)
} else {
if a.Op == OpLoad && a.Args[0].Op == OpLocalAddr {
- addr := a.Args[0]
+ addr := a.Args[0] // This is a self-move. // TODO(register args) do what here for registers?
if addr.MemoryArg() == a.MemoryArg() && addr.Aux == aux.results[i].Name {
continue
}
}
- mem = x.storeArgOrLoad(v.Pos, b, auxBase, a, mem, aux.TypeOfResult(i), auxOffset)
+ var rc registerCursor
+ var result *[]*Value
+ if len(aRegs) > 0 {
+ result = &allResults
+ }
+ rc.init(aRegs, aux.abiInfo, result)
+ // TODO(register args)
+ mem = x.storeArgOrLoad(v.Pos, b, auxBase, a, mem, aux.TypeOfResult(i), auxOffset, 0, rc)
+ // TODO append mem to Result, update type
}
}
b.SetControl(mem)
@@ -786,7 +1005,7 @@ func expandCalls(f *Func) {
fmt.Printf("Splitting store %s\n", v.LongString())
}
dst, mem := v.Args[0], v.Args[2]
- mem = x.storeArgOrLoad(v.Pos, b, dst, source, mem, t, 0)
+ mem = x.storeArgOrLoad(v.Pos, b, dst, source, mem, t, 0, 0, registerCursor{})
v.copyOf(mem)
}
}
@@ -902,7 +1121,7 @@ func expandCalls(f *Func) {
}
}
- x.common = make(map[selKey]*Value)
+ x.commonSelectors = make(map[selKey]*Value)
// Rewrite duplicate selectors as copies where possible.
for i := len(allOrdered) - 1; i >= 0; i-- {
v := allOrdered[i]
@@ -945,15 +1164,15 @@ func expandCalls(f *Func) {
offset = size
}
sk := selKey{from: w, size: size, offset: offset, typ: typ}
- dupe := x.common[sk]
+ dupe := x.commonSelectors[sk]
if dupe == nil {
- x.common[sk] = v
+ x.commonSelectors[sk] = v
} else if x.sdom.IsAncestorEq(dupe.Block, v.Block) {
v.copyOf(dupe)
} else {
// Because values are processed in dominator order, the old common[s] will never dominate after a miss is seen.
// Installing the new value might match some future values.
- x.common[sk] = v
+ x.commonSelectors[sk] = v
}
}
@@ -973,7 +1192,7 @@ func expandCalls(f *Func) {
if v.Op == OpCopy {
continue
}
- locs := x.rewriteSelect(v, v, 0)
+ locs := x.rewriteSelect(v, v, 0, 0)
// Install new names.
if v.Type.IsMemory() {
continue
@@ -994,13 +1213,16 @@ func expandCalls(f *Func) {
deleteNamedVals(f, toDelete)
- // Step 4: rewrite the calls themselves, correcting the type
+ // Step 4: rewrite the calls themselves, correcting the type.
for _, b := range f.Blocks {
for _, v := range b.Values {
switch v.Op {
+ case OpArg:
+ x.rewriteArgToMemOrRegs(v)
case OpStaticLECall:
v.Op = OpStaticCall
- v.Type = types.TypeMem
+ // TODO need to insert all the register types.
+ v.Type = types.NewResults([]*types.Type{types.TypeMem})
case OpClosureLECall:
v.Op = OpClosureCall
v.Type = types.TypeMem
@@ -1029,3 +1251,107 @@ func expandCalls(f *Func) {
}
}
}
+
+// rewriteArgToMemOrRegs converts OpArg v in-place into the register version of v,
+// if that is appropriate.
+func (x *expandState) rewriteArgToMemOrRegs(v *Value) *Value {
+ pa := x.prAssignForArg(v)
+ switch len(pa.Registers) {
+ case 0:
+ frameOff := v.Aux.(*ir.Name).FrameOffset()
+ if pa.Offset() != int32(frameOff+x.f.ABISelf.LocalsOffset()) {
+ panic(fmt.Errorf("Parameter assignment %d and OpArg.Aux frameOffset %d disagree, op=%s",
+ pa.Offset(), frameOff, v.LongString()))
+ }
+ case 1:
+ r := pa.Registers[0]
+ i := x.f.ABISelf.FloatIndexFor(r)
+ // TODO seems like this has implications for debugging. How does this affect the location?
+ if i >= 0 { // float PR
+ v.Op = OpArgFloatReg
+ } else {
+ v.Op = OpArgIntReg
+ i = int64(r)
+ }
+ v.Aux = &AuxNameOffset{v.Aux.(*ir.Name), 0}
+ v.AuxInt = i
+
+ default:
+ panic(badVal("Saw unexpanded OpArg", v))
+ }
+ return v
+}
+
+// newArgToMemOrRegs either rewrites toReplace into an OpArg referencing memory or into an OpArgXXXReg to a register,
+// or rewrites it into a copy of the appropriate OpArgXXX. The actual OpArgXXX is determined by combining baseArg (an OpArg)
+// with offset, regOffset, and t to determine which portion of it reference (either all or a part, in memory or in registers).
+func (x *expandState) newArgToMemOrRegs(baseArg, toReplace *Value, offset int64, regOffset Abi1RO, t *types.Type, pos src.XPos) *Value {
+ key := selKey{baseArg, offset, t.Width, t}
+ w := x.commonArgs[key]
+ if w != nil {
+ if toReplace != nil {
+ toReplace.copyOf(w)
+ }
+ return w
+ }
+
+ pa := x.prAssignForArg(baseArg)
+ switch len(pa.Registers) {
+ case 0:
+ frameOff := baseArg.Aux.(*ir.Name).FrameOffset()
+ if pa.Offset() != int32(frameOff+x.f.ABISelf.LocalsOffset()) {
+ panic(fmt.Errorf("Parameter assignment %d and OpArg.Aux frameOffset %d disagree, op=%s",
+ pa.Offset(), frameOff, baseArg.LongString()))
+ }
+
+ aux := baseArg.Aux
+ auxInt := baseArg.AuxInt + offset
+ if toReplace != nil && toReplace.Block == baseArg.Block {
+ toReplace.reset(OpArg)
+ toReplace.Aux = aux
+ toReplace.AuxInt = auxInt
+ toReplace.Type = t
+ x.commonArgs[key] = toReplace
+ return toReplace
+ } else {
+ w := baseArg.Block.NewValue0IA(pos, OpArg, t, auxInt, aux)
+ x.commonArgs[key] = w
+ if x.debug {
+ fmt.Printf("\tnew %s\n", w.LongString())
+ }
+ if toReplace != nil {
+ toReplace.copyOf(w)
+ }
+ return w
+ }
+
+ default:
+ r := pa.Registers[regOffset]
+ auxInt := x.f.ABISelf.FloatIndexFor(r)
+ op := OpArgFloatReg
+ // TODO seems like this has implications for debugging. How does this affect the location?
+ if auxInt < 0 { // int (not float) parameter register
+ op = OpArgIntReg
+ auxInt = int64(r)
+ }
+ aux := &AuxNameOffset{baseArg.Aux.(*ir.Name), baseArg.AuxInt + offset}
+ if toReplace != nil && toReplace.Block == baseArg.Block {
+ toReplace.reset(op)
+ toReplace.Aux = aux
+ toReplace.AuxInt = auxInt
+ toReplace.Type = t
+ x.commonArgs[key] = toReplace
+ return toReplace
+ } else {
+ w := baseArg.Block.NewValue0IA(pos, op, t, auxInt, aux)
+ if x.debug {
+ fmt.Printf("\tnew %s\n", w.LongString())
+ }
+ x.commonArgs[key] = w
+ if toReplace != nil {
+ toReplace.copyOf(w)
+ }
+ return w
+ }
+ }
+}
diff --git a/src/cmd/compile/internal/ssa/flags_test.go b/src/cmd/compile/internal/ssa/flags_test.go
index d64abf652c..0bc1097199 100644
--- a/src/cmd/compile/internal/ssa/flags_test.go
+++ b/src/cmd/compile/internal/ssa/flags_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm64
// +build amd64 arm64
package ssa
diff --git a/src/cmd/compile/internal/ssa/func.go b/src/cmd/compile/internal/ssa/func.go
index de99a8d4af..a36529af03 100644
--- a/src/cmd/compile/internal/ssa/func.go
+++ b/src/cmd/compile/internal/ssa/func.go
@@ -5,6 +5,7 @@
package ssa
import (
+ "cmd/compile/internal/abi"
"cmd/compile/internal/types"
"cmd/internal/src"
"crypto/sha1"
@@ -43,6 +44,10 @@ type Func struct {
DebugTest bool // default true unless $GOSSAHASH != ""; as a debugging aid, make new code conditional on this and use GOSSAHASH to binary search for failing cases
PrintOrHtmlSSA bool // true if GOSSAFUNC matches, true even if fe.Log() (spew phase results to stdout) is false.
ruleMatches map[string]int // number of times countRule was called during compilation for any given string
+ ABI0 *abi.ABIConfig // A copy, for no-sync access
+ ABI1 *abi.ABIConfig // A copy, for no-sync access
+ ABISelf *abi.ABIConfig // ABI for function being compiled
+ ABIDefault *abi.ABIConfig // ABI for rtcall and other no-parsed-signature/pragma functions.
scheduled bool // Values in Blocks are in final order
laidout bool // Blocks are ordered
diff --git a/src/cmd/compile/internal/ssa/gen/386.rules b/src/cmd/compile/internal/ssa/gen/386.rules
index df03cb71a6..d6d122dc78 100644
--- a/src/cmd/compile/internal/ssa/gen/386.rules
+++ b/src/cmd/compile/internal/ssa/gen/386.rules
@@ -54,6 +54,7 @@
(Bswap32 ...) => (BSWAPL ...)
(Sqrt ...) => (SQRTSD ...)
+(Sqrt32 ...) => (SQRTSS ...)
(Ctz16 x) => (BSFL (ORLconst <typ.UInt32> [0x10000] x))
(Ctz16NonZero ...) => (BSFL ...)
diff --git a/src/cmd/compile/internal/ssa/gen/386Ops.go b/src/cmd/compile/internal/ssa/gen/386Ops.go
index 737b99c371..c4b49fbb23 100644
--- a/src/cmd/compile/internal/ssa/gen/386Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/386Ops.go
@@ -146,14 +146,14 @@ func init() {
var _386ops = []opData{
// fp ops
- {name: "ADDSS", argLength: 2, reg: fp21, asm: "ADDSS", commutative: true, resultInArg0: true, usesScratch: true}, // fp32 add
- {name: "ADDSD", argLength: 2, reg: fp21, asm: "ADDSD", commutative: true, resultInArg0: true}, // fp64 add
- {name: "SUBSS", argLength: 2, reg: fp21, asm: "SUBSS", resultInArg0: true, usesScratch: true}, // fp32 sub
- {name: "SUBSD", argLength: 2, reg: fp21, asm: "SUBSD", resultInArg0: true}, // fp64 sub
- {name: "MULSS", argLength: 2, reg: fp21, asm: "MULSS", commutative: true, resultInArg0: true, usesScratch: true}, // fp32 mul
- {name: "MULSD", argLength: 2, reg: fp21, asm: "MULSD", commutative: true, resultInArg0: true}, // fp64 mul
- {name: "DIVSS", argLength: 2, reg: fp21, asm: "DIVSS", resultInArg0: true, usesScratch: true}, // fp32 div
- {name: "DIVSD", argLength: 2, reg: fp21, asm: "DIVSD", resultInArg0: true}, // fp64 div
+ {name: "ADDSS", argLength: 2, reg: fp21, asm: "ADDSS", commutative: true, resultInArg0: true}, // fp32 add
+ {name: "ADDSD", argLength: 2, reg: fp21, asm: "ADDSD", commutative: true, resultInArg0: true}, // fp64 add
+ {name: "SUBSS", argLength: 2, reg: fp21, asm: "SUBSS", resultInArg0: true}, // fp32 sub
+ {name: "SUBSD", argLength: 2, reg: fp21, asm: "SUBSD", resultInArg0: true}, // fp64 sub
+ {name: "MULSS", argLength: 2, reg: fp21, asm: "MULSS", commutative: true, resultInArg0: true}, // fp32 mul
+ {name: "MULSD", argLength: 2, reg: fp21, asm: "MULSD", commutative: true, resultInArg0: true}, // fp64 mul
+ {name: "DIVSS", argLength: 2, reg: fp21, asm: "DIVSS", resultInArg0: true}, // fp32 div
+ {name: "DIVSD", argLength: 2, reg: fp21, asm: "DIVSD", resultInArg0: true}, // fp64 div
{name: "MOVSSload", argLength: 2, reg: fpload, asm: "MOVSS", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // fp32 load
{name: "MOVSDload", argLength: 2, reg: fpload, asm: "MOVSD", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // fp64 load
@@ -246,8 +246,8 @@ func init() {
{name: "CMPWconstload", argLength: 2, reg: gp0flagsLoad, asm: "CMPW", aux: "SymValAndOff", typ: "Flags", symEffect: "Read", faultOnNilArg0: true},
{name: "CMPBconstload", argLength: 2, reg: gp0flagsLoad, asm: "CMPB", aux: "SymValAndOff", typ: "Flags", symEffect: "Read", faultOnNilArg0: true},
- {name: "UCOMISS", argLength: 2, reg: fp2flags, asm: "UCOMISS", typ: "Flags", usesScratch: true}, // arg0 compare to arg1, f32
- {name: "UCOMISD", argLength: 2, reg: fp2flags, asm: "UCOMISD", typ: "Flags", usesScratch: true}, // arg0 compare to arg1, f64
+ {name: "UCOMISS", argLength: 2, reg: fp2flags, asm: "UCOMISS", typ: "Flags"}, // arg0 compare to arg1, f32
+ {name: "UCOMISD", argLength: 2, reg: fp2flags, asm: "UCOMISD", typ: "Flags"}, // arg0 compare to arg1, f64
{name: "TESTL", argLength: 2, reg: gp2flags, commutative: true, asm: "TESTL", typ: "Flags"}, // (arg0 & arg1) compare to 0
{name: "TESTW", argLength: 2, reg: gp2flags, commutative: true, asm: "TESTW", typ: "Flags"}, // (arg0 & arg1) compare to 0
@@ -308,6 +308,7 @@ func init() {
{name: "BSWAPL", argLength: 1, reg: gp11, asm: "BSWAPL", resultInArg0: true, clobberFlags: true}, // arg0 swap bytes
{name: "SQRTSD", argLength: 1, reg: fp11, asm: "SQRTSD"}, // sqrt(arg0)
+ {name: "SQRTSS", argLength: 1, reg: fp11, asm: "SQRTSS"}, // sqrt(arg0), float32
{name: "SBBLcarrymask", argLength: 1, reg: flagsgp, asm: "SBBL"}, // (int32)(-1) if carry is set, 0 if carry is clear.
// Note: SBBW and SBBB are subsumed by SBBL
@@ -341,12 +342,12 @@ func init() {
{name: "MOVLconst", reg: gp01, asm: "MOVL", typ: "UInt32", aux: "Int32", rematerializeable: true}, // 32 low bits of auxint
- {name: "CVTTSD2SL", argLength: 1, reg: fpgp, asm: "CVTTSD2SL", usesScratch: true}, // convert float64 to int32
- {name: "CVTTSS2SL", argLength: 1, reg: fpgp, asm: "CVTTSS2SL", usesScratch: true}, // convert float32 to int32
- {name: "CVTSL2SS", argLength: 1, reg: gpfp, asm: "CVTSL2SS", usesScratch: true}, // convert int32 to float32
- {name: "CVTSL2SD", argLength: 1, reg: gpfp, asm: "CVTSL2SD", usesScratch: true}, // convert int32 to float64
- {name: "CVTSD2SS", argLength: 1, reg: fp11, asm: "CVTSD2SS", usesScratch: true}, // convert float64 to float32
- {name: "CVTSS2SD", argLength: 1, reg: fp11, asm: "CVTSS2SD"}, // convert float32 to float64
+ {name: "CVTTSD2SL", argLength: 1, reg: fpgp, asm: "CVTTSD2SL"}, // convert float64 to int32
+ {name: "CVTTSS2SL", argLength: 1, reg: fpgp, asm: "CVTTSS2SL"}, // convert float32 to int32
+ {name: "CVTSL2SS", argLength: 1, reg: gpfp, asm: "CVTSL2SS"}, // convert int32 to float32
+ {name: "CVTSL2SD", argLength: 1, reg: gpfp, asm: "CVTSL2SD"}, // convert int32 to float64
+ {name: "CVTSD2SS", argLength: 1, reg: fp11, asm: "CVTSD2SS"}, // convert float64 to float32
+ {name: "CVTSS2SD", argLength: 1, reg: fp11, asm: "CVTSS2SD"}, // convert float32 to float64
{name: "PXOR", argLength: 2, reg: fp21, asm: "PXOR", commutative: true, resultInArg0: true}, // exclusive or, applied to X regs for float negation.
diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules
index 7d46266411..bab9cee88c 100644
--- a/src/cmd/compile/internal/ssa/gen/AMD64.rules
+++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules
@@ -104,6 +104,7 @@
(PopCount8 x) => (POPCNTL (MOVBQZX <typ.UInt32> x))
(Sqrt ...) => (SQRTSD ...)
+(Sqrt32 ...) => (SQRTSS ...)
(RoundToEven x) => (ROUNDSD [0] x)
(Floor x) => (ROUNDSD [1] x)
@@ -361,31 +362,31 @@
// Adjust zeros to be a multiple of 16 bytes.
(Zero [s] destptr mem) && s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE =>
(Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16])
- (MOVOstore destptr (MOVOconst [0]) mem))
+ (MOVOstorezero destptr mem))
(Zero [s] destptr mem) && s%16 != 0 && s > 16 && s%16 <= 8 && config.useSSE =>
(Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16])
(MOVQstoreconst [makeValAndOff32(0,0)] destptr mem))
(Zero [16] destptr mem) && config.useSSE =>
- (MOVOstore destptr (MOVOconst [0]) mem)
+ (MOVOstorezero destptr mem)
(Zero [32] destptr mem) && config.useSSE =>
- (MOVOstore (OffPtr <destptr.Type> destptr [16]) (MOVOconst [0])
- (MOVOstore destptr (MOVOconst [0]) mem))
+ (MOVOstorezero (OffPtr <destptr.Type> destptr [16])
+ (MOVOstorezero destptr mem))
(Zero [48] destptr mem) && config.useSSE =>
- (MOVOstore (OffPtr <destptr.Type> destptr [32]) (MOVOconst [0])
- (MOVOstore (OffPtr <destptr.Type> destptr [16]) (MOVOconst [0])
- (MOVOstore destptr (MOVOconst [0]) mem)))
+ (MOVOstorezero (OffPtr <destptr.Type> destptr [32])
+ (MOVOstorezero (OffPtr <destptr.Type> destptr [16])
+ (MOVOstorezero destptr mem)))
(Zero [64] destptr mem) && config.useSSE =>
- (MOVOstore (OffPtr <destptr.Type> destptr [48]) (MOVOconst [0])
- (MOVOstore (OffPtr <destptr.Type> destptr [32]) (MOVOconst [0])
- (MOVOstore (OffPtr <destptr.Type> destptr [16]) (MOVOconst [0])
- (MOVOstore destptr (MOVOconst [0]) mem))))
+ (MOVOstorezero (OffPtr <destptr.Type> destptr [48])
+ (MOVOstorezero (OffPtr <destptr.Type> destptr [32])
+ (MOVOstorezero (OffPtr <destptr.Type> destptr [16])
+ (MOVOstorezero destptr mem))))
// Medium zeroing uses a duff device.
(Zero [s] destptr mem)
&& s > 64 && s <= 1024 && s%16 == 0 && !config.noDuffDevice =>
- (DUFFZERO [s] destptr (MOVOconst [0]) mem)
+ (DUFFZERO [s] destptr mem)
// Large zeroing uses REP STOSQ.
(Zero [s] destptr mem)
@@ -459,7 +460,7 @@
(IsInBounds idx len) => (SETB (CMPQ idx len))
(IsSliceInBounds idx len) => (SETBE (CMPQ idx len))
(NilCheck ...) => (LoweredNilCheck ...)
-(GetG ...) => (LoweredGetG ...)
+(GetG mem) && !(objabi.Regabi_enabled == 1 && base.Flag.ABIWrap) => (LoweredGetG mem) // only lower in old ABI. in new ABI we have a G register.
(GetClosurePtr ...) => (LoweredGetClosurePtr ...)
(GetCallerPC ...) => (LoweredGetCallerPC ...)
(GetCallerSP ...) => (LoweredGetCallerSP ...)
@@ -1900,7 +1901,7 @@
&& c.Val() == 0
&& c2.Val() == 0
&& clobber(x)
- => (MOVOstore [c2.Off32()] {s} p (MOVOconst [0]) mem)
+ => (MOVOstorezero [c2.Off32()] {s} p mem)
// Combine stores into larger (unaligned) stores. Little endian.
(MOVBstore [i] {s} p (SHR(W|L|Q)const [8] w) x:(MOVBstore [i-1] {s} p w mem))
@@ -1969,6 +1970,16 @@
&& clobber(x)
=> (MOVQstore [i] {s} p0 w0 mem)
+(MOVBstore [7] p1 (SHRQconst [56] w)
+ x1:(MOVWstore [5] p1 (SHRQconst [40] w)
+ x2:(MOVLstore [1] p1 (SHRQconst [8] w)
+ x3:(MOVBstore p1 w mem))))
+ && x1.Uses == 1
+ && x2.Uses == 1
+ && x3.Uses == 1
+ && clobber(x1, x2, x3)
+ => (MOVQstore p1 w mem)
+
(MOVBstore [i] {s} p
x1:(MOVBload [j] {s2} p2 mem)
mem2:(MOVBstore [i-1] {s} p
@@ -2191,6 +2202,11 @@
&& clobber(l) =>
@l.Block (CMP(Q|L|W|B)constload {sym} [makeValAndOff64(0, int64(off))] ptr mem)
+// Convert ANDload to MOVload when we can do the AND in a containing TEST op.
+// Only do when it's within the same block, so we don't have flags live across basic block boundaries.
+// See issue 44228.
+(TEST(Q|L) a:(AND(Q|L)load [off] {sym} x ptr mem) a) && a.Uses == 2 && a.Block == v.Block && clobber(a) => (TEST(Q|L) (MOV(Q|L)load <a.Type> [off] {sym} ptr mem) x)
+
(MOVBload [off] {sym} (SB) _) && symIsRO(sym) => (MOVLconst [int32(read8(sym, int64(off)))])
(MOVWload [off] {sym} (SB) _) && symIsRO(sym) => (MOVLconst [int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder))])
(MOVLload [off] {sym} (SB) _) && symIsRO(sym) => (MOVQconst [int64(read32(sym, int64(off), config.ctxt.Arch.ByteOrder))])
diff --git a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go
index de5372670b..fd2c2023e6 100644
--- a/src/cmd/compile/internal/ssa/gen/AMD64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/AMD64Ops.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
@@ -44,7 +45,7 @@ var regNamesAMD64 = []string{
"R11",
"R12",
"R13",
- "R14",
+ "g", // a.k.a. R14
"R15",
"X0",
"X1",
@@ -61,7 +62,7 @@ var regNamesAMD64 = []string{
"X12",
"X13",
"X14",
- "X15",
+ "X15", // constant 0 in ABIInternal
// If you add registers, update asyncPreempt in runtime
@@ -96,11 +97,14 @@ func init() {
cx = buildReg("CX")
dx = buildReg("DX")
bx = buildReg("BX")
- gp = buildReg("AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15")
- fp = buildReg("X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15")
+ gp = buildReg("AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15")
+ g = buildReg("g")
+ fp = buildReg("X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14")
+ x15 = buildReg("X15")
gpsp = gp | buildReg("SP")
gpspsb = gpsp | buildReg("SB")
- callerSave = gp | fp
+ gpspsbg = gpspsb | g
+ callerSave = gp | fp | g // runtime.setg (and anything calling it) may clobber g
)
// Common slices of register masks
var (
@@ -113,10 +117,10 @@ func init() {
gp01 = regInfo{inputs: nil, outputs: gponly}
gp11 = regInfo{inputs: []regMask{gp}, outputs: gponly}
gp11sp = regInfo{inputs: []regMask{gpsp}, outputs: gponly}
- gp11sb = regInfo{inputs: []regMask{gpspsb}, outputs: gponly}
+ gp11sb = regInfo{inputs: []regMask{gpspsbg}, outputs: gponly}
gp21 = regInfo{inputs: []regMask{gp, gp}, outputs: gponly}
gp21sp = regInfo{inputs: []regMask{gpsp, gp}, outputs: gponly}
- gp21sb = regInfo{inputs: []regMask{gpspsb, gpsp}, outputs: gponly}
+ gp21sb = regInfo{inputs: []regMask{gpspsbg, gpsp}, outputs: gponly}
gp21shift = regInfo{inputs: []regMask{gp, cx}, outputs: []regMask{gp}}
gp11div = regInfo{inputs: []regMask{ax, gpsp &^ dx}, outputs: []regMask{ax, dx}}
gp21hmul = regInfo{inputs: []regMask{ax, gpsp}, outputs: []regMask{dx}, clobbers: ax}
@@ -125,9 +129,9 @@ func init() {
gp2flags = regInfo{inputs: []regMask{gpsp, gpsp}}
gp1flags = regInfo{inputs: []regMask{gpsp}}
- gp0flagsLoad = regInfo{inputs: []regMask{gpspsb, 0}}
- gp1flagsLoad = regInfo{inputs: []regMask{gpspsb, gpsp, 0}}
- gp2flagsLoad = regInfo{inputs: []regMask{gpspsb, gpsp, gpsp, 0}}
+ gp0flagsLoad = regInfo{inputs: []regMask{gpspsbg, 0}}
+ gp1flagsLoad = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}}
+ gp2flagsLoad = regInfo{inputs: []regMask{gpspsbg, gpsp, gpsp, 0}}
flagsgp = regInfo{inputs: nil, outputs: gponly}
gp11flags = regInfo{inputs: []regMask{gp}, outputs: []regMask{gp, 0}}
@@ -136,24 +140,24 @@ func init() {
readflags = regInfo{inputs: nil, outputs: gponly}
flagsgpax = regInfo{inputs: nil, clobbers: ax, outputs: []regMask{gp &^ ax}}
- gpload = regInfo{inputs: []regMask{gpspsb, 0}, outputs: gponly}
- gp21load = regInfo{inputs: []regMask{gp, gpspsb, 0}, outputs: gponly}
- gploadidx = regInfo{inputs: []regMask{gpspsb, gpsp, 0}, outputs: gponly}
- gp21loadidx = regInfo{inputs: []regMask{gp, gpspsb, gpsp, 0}, outputs: gponly}
+ gpload = regInfo{inputs: []regMask{gpspsbg, 0}, outputs: gponly}
+ gp21load = regInfo{inputs: []regMask{gp, gpspsbg, 0}, outputs: gponly}
+ gploadidx = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}, outputs: gponly}
+ gp21loadidx = regInfo{inputs: []regMask{gp, gpspsbg, gpsp, 0}, outputs: gponly}
gp21pax = regInfo{inputs: []regMask{gp &^ ax, gp}, outputs: []regMask{gp &^ ax}, clobbers: ax}
- gpstore = regInfo{inputs: []regMask{gpspsb, gpsp, 0}}
- gpstoreconst = regInfo{inputs: []regMask{gpspsb, 0}}
- gpstoreidx = regInfo{inputs: []regMask{gpspsb, gpsp, gpsp, 0}}
- gpstoreconstidx = regInfo{inputs: []regMask{gpspsb, gpsp, 0}}
- gpstorexchg = regInfo{inputs: []regMask{gp, gpspsb, 0}, outputs: []regMask{gp}}
+ gpstore = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}}
+ gpstoreconst = regInfo{inputs: []regMask{gpspsbg, 0}}
+ gpstoreidx = regInfo{inputs: []regMask{gpspsbg, gpsp, gpsp, 0}}
+ gpstoreconstidx = regInfo{inputs: []regMask{gpspsbg, gpsp, 0}}
+ gpstorexchg = regInfo{inputs: []regMask{gp, gpspsbg, 0}, outputs: []regMask{gp}}
cmpxchg = regInfo{inputs: []regMask{gp, ax, gp, 0}, outputs: []regMask{gp, 0}, clobbers: ax}
fp01 = regInfo{inputs: nil, outputs: fponly}
fp21 = regInfo{inputs: []regMask{fp, fp}, outputs: fponly}
fp31 = regInfo{inputs: []regMask{fp, fp, fp}, outputs: fponly}
- fp21load = regInfo{inputs: []regMask{fp, gpspsb, 0}, outputs: fponly}
- fp21loadidx = regInfo{inputs: []regMask{fp, gpspsb, gpspsb, 0}, outputs: fponly}
+ fp21load = regInfo{inputs: []regMask{fp, gpspsbg, 0}, outputs: fponly}
+ fp21loadidx = regInfo{inputs: []regMask{fp, gpspsbg, gpspsb, 0}, outputs: fponly}
fpgp = regInfo{inputs: fponly, outputs: gponly}
gpfp = regInfo{inputs: gponly, outputs: fponly}
fp11 = regInfo{inputs: fponly, outputs: fponly}
@@ -590,6 +594,7 @@ func init() {
{name: "POPCNTL", argLength: 1, reg: gp11, asm: "POPCNTL", clobberFlags: true}, // count number of set bits in arg0
{name: "SQRTSD", argLength: 1, reg: fp11, asm: "SQRTSD"}, // sqrt(arg0)
+ {name: "SQRTSS", argLength: 1, reg: fp11, asm: "SQRTSS"}, // sqrt(arg0), float32
// ROUNDSD instruction isn't guaranteed to be on the target platform (it is SSE4.1)
// Any use must be preceded by a successful check of runtime.x86HasSSE41.
@@ -684,19 +689,20 @@ func init() {
// Note: LEAx{1,2,4,8} must not have OpSB as either argument.
// auxint+aux == add auxint and the offset of the symbol in aux (if any) to the effective address
- {name: "MOVBload", argLength: 2, reg: gpload, asm: "MOVBLZX", aux: "SymOff", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"}, // load byte from arg0+auxint+aux. arg1=mem. Zero extend.
- {name: "MOVBQSXload", argLength: 2, reg: gpload, asm: "MOVBQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64
- {name: "MOVWload", argLength: 2, reg: gpload, asm: "MOVWLZX", aux: "SymOff", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"}, // load 2 bytes from arg0+auxint+aux. arg1=mem. Zero extend.
- {name: "MOVWQSXload", argLength: 2, reg: gpload, asm: "MOVWQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64
- {name: "MOVLload", argLength: 2, reg: gpload, asm: "MOVL", aux: "SymOff", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"}, // load 4 bytes from arg0+auxint+aux. arg1=mem. Zero extend.
- {name: "MOVLQSXload", argLength: 2, reg: gpload, asm: "MOVLQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64
- {name: "MOVQload", argLength: 2, reg: gpload, asm: "MOVQ", aux: "SymOff", typ: "UInt64", faultOnNilArg0: true, symEffect: "Read"}, // load 8 bytes from arg0+auxint+aux. arg1=mem
- {name: "MOVBstore", argLength: 3, reg: gpstore, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store byte in arg1 to arg0+auxint+aux. arg2=mem
- {name: "MOVWstore", argLength: 3, reg: gpstore, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes in arg1 to arg0+auxint+aux. arg2=mem
- {name: "MOVLstore", argLength: 3, reg: gpstore, asm: "MOVL", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 4 bytes in arg1 to arg0+auxint+aux. arg2=mem
- {name: "MOVQstore", argLength: 3, reg: gpstore, asm: "MOVQ", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes in arg1 to arg0+auxint+aux. arg2=mem
- {name: "MOVOload", argLength: 2, reg: fpload, asm: "MOVUPS", aux: "SymOff", typ: "Int128", faultOnNilArg0: true, symEffect: "Read"}, // load 16 bytes from arg0+auxint+aux. arg1=mem
- {name: "MOVOstore", argLength: 3, reg: fpstore, asm: "MOVUPS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 16 bytes in arg1 to arg0+auxint+aux. arg2=mem
+ {name: "MOVBload", argLength: 2, reg: gpload, asm: "MOVBLZX", aux: "SymOff", typ: "UInt8", faultOnNilArg0: true, symEffect: "Read"}, // load byte from arg0+auxint+aux. arg1=mem. Zero extend.
+ {name: "MOVBQSXload", argLength: 2, reg: gpload, asm: "MOVBQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64
+ {name: "MOVWload", argLength: 2, reg: gpload, asm: "MOVWLZX", aux: "SymOff", typ: "UInt16", faultOnNilArg0: true, symEffect: "Read"}, // load 2 bytes from arg0+auxint+aux. arg1=mem. Zero extend.
+ {name: "MOVWQSXload", argLength: 2, reg: gpload, asm: "MOVWQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64
+ {name: "MOVLload", argLength: 2, reg: gpload, asm: "MOVL", aux: "SymOff", typ: "UInt32", faultOnNilArg0: true, symEffect: "Read"}, // load 4 bytes from arg0+auxint+aux. arg1=mem. Zero extend.
+ {name: "MOVLQSXload", argLength: 2, reg: gpload, asm: "MOVLQSX", aux: "SymOff", faultOnNilArg0: true, symEffect: "Read"}, // ditto, sign extend to int64
+ {name: "MOVQload", argLength: 2, reg: gpload, asm: "MOVQ", aux: "SymOff", typ: "UInt64", faultOnNilArg0: true, symEffect: "Read"}, // load 8 bytes from arg0+auxint+aux. arg1=mem
+ {name: "MOVBstore", argLength: 3, reg: gpstore, asm: "MOVB", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store byte in arg1 to arg0+auxint+aux. arg2=mem
+ {name: "MOVWstore", argLength: 3, reg: gpstore, asm: "MOVW", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes in arg1 to arg0+auxint+aux. arg2=mem
+ {name: "MOVLstore", argLength: 3, reg: gpstore, asm: "MOVL", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 4 bytes in arg1 to arg0+auxint+aux. arg2=mem
+ {name: "MOVQstore", argLength: 3, reg: gpstore, asm: "MOVQ", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 8 bytes in arg1 to arg0+auxint+aux. arg2=mem
+ {name: "MOVOload", argLength: 2, reg: fpload, asm: "MOVUPS", aux: "SymOff", typ: "Int128", faultOnNilArg0: true, symEffect: "Read"}, // load 16 bytes from arg0+auxint+aux. arg1=mem
+ {name: "MOVOstore", argLength: 3, reg: fpstore, asm: "MOVUPS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 16 bytes in arg1 to arg0+auxint+aux. arg2=mem
+ {name: "MOVOstorezero", argLength: 2, reg: regInfo{inputs: []regMask{gpspsb, 0}}, asm: "MOVUPS", aux: "SymOff", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 16 bytes of zero to arg0+auxint+aux. arg1=mem
// indexed loads/stores
{name: "MOVBloadidx1", argLength: 3, reg: gploadidx, commutative: true, asm: "MOVBLZX", scale: 1, aux: "SymOff", typ: "UInt8", symEffect: "Read"}, // load a byte from arg0+arg1+auxint+aux. arg2=mem
@@ -735,22 +741,20 @@ func init() {
{name: "MOVQstoreconstidx8", argLength: 3, reg: gpstoreconstidx, asm: "MOVQ", scale: 8, aux: "SymValAndOff", typ: "Mem", symEffect: "Write"}, // store 8 bytes of ... 8*arg1 ...
// arg0 = pointer to start of memory to zero
- // arg1 = value to store (will always be zero)
- // arg2 = mem
+ // arg1 = mem
// auxint = # of bytes to zero
// returns mem
{
name: "DUFFZERO",
aux: "Int64",
- argLength: 3,
+ argLength: 2,
reg: regInfo{
- inputs: []regMask{buildReg("DI"), buildReg("X0")},
+ inputs: []regMask{buildReg("DI")},
clobbers: buildReg("DI"),
},
faultOnNilArg0: true,
unsafePoint: true, // FP maintenance around DUFFCOPY can be clobbered by interrupts
},
- {name: "MOVOconst", reg: regInfo{nil, 0, []regMask{fp}}, typ: "Int128", aux: "Int128", rematerializeable: true},
// arg0 = address of memory to zero
// arg1 = # of 8-byte words to zero
@@ -830,7 +834,7 @@ func init() {
{name: "LoweredNilCheck", argLength: 2, reg: regInfo{inputs: []regMask{gpsp}}, clobberFlags: true, nilCheck: true, faultOnNilArg0: true},
// LoweredWB invokes runtime.gcWriteBarrier. arg0=destptr, arg1=srcptr, arg2=mem, aux=runtime.gcWriteBarrier
// It saves all GP registers if necessary, but may clobber others.
- {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("DI"), buildReg("AX CX DX BX BP SI R8 R9")}, clobbers: callerSave &^ gp}, clobberFlags: true, aux: "Sym", symEffect: "None"},
+ {name: "LoweredWB", argLength: 3, reg: regInfo{inputs: []regMask{buildReg("DI"), buildReg("AX CX DX BX BP SI R8 R9")}, clobbers: callerSave &^ (gp | g)}, clobberFlags: true, aux: "Sym", symEffect: "None"},
{name: "LoweredHasCPUFeature", argLength: 0, reg: gp01, rematerializeable: true, typ: "UInt64", aux: "Sym", symEffect: "None"},
@@ -927,15 +931,18 @@ func init() {
}
archs = append(archs, arch{
- name: "AMD64",
- pkg: "cmd/internal/obj/x86",
- genfile: "../../amd64/ssa.go",
- ops: AMD64ops,
- blocks: AMD64blocks,
- regnames: regNamesAMD64,
- gpregmask: gp,
- fpregmask: fp,
- framepointerreg: int8(num["BP"]),
- linkreg: -1, // not used
+ name: "AMD64",
+ pkg: "cmd/internal/obj/x86",
+ genfile: "../../amd64/ssa.go",
+ ops: AMD64ops,
+ blocks: AMD64blocks,
+ regnames: regNamesAMD64,
+ ParamIntRegNames: "AX BX CX DI SI R8 R9 R10 R11",
+ ParamFloatRegNames: "X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14",
+ gpregmask: gp,
+ fpregmask: fp,
+ specialregmask: x15,
+ framepointerreg: int8(num["BP"]),
+ linkreg: -1, // not used
})
}
diff --git a/src/cmd/compile/internal/ssa/gen/ARM.rules b/src/cmd/compile/internal/ssa/gen/ARM.rules
index de0df363e4..f46f4238f7 100644
--- a/src/cmd/compile/internal/ssa/gen/ARM.rules
+++ b/src/cmd/compile/internal/ssa/gen/ARM.rules
@@ -56,6 +56,7 @@
(Com(32|16|8) ...) => (MVN ...)
(Sqrt ...) => (SQRTD ...)
+(Sqrt32 ...) => (SQRTF ...)
(Abs ...) => (ABSD ...)
// TODO: optimize this for ARMv5 and ARMv6
@@ -546,6 +547,10 @@
// MOVWnop doesn't emit instruction, only for ensuring the type.
(MOVWreg x) && x.Uses == 1 => (MOVWnop x)
+// TODO: we should be able to get rid of MOVWnop all together.
+// But for now, this is enough to get rid of lots of them.
+(MOVWnop (MOVWconst [c])) => (MOVWconst [c])
+
// mul by constant
(MUL x (MOVWconst [c])) && int32(c) == -1 => (RSBconst [0] x)
(MUL _ (MOVWconst [0])) => (MOVWconst [0])
diff --git a/src/cmd/compile/internal/ssa/gen/ARM64.rules b/src/cmd/compile/internal/ssa/gen/ARM64.rules
index a0e2a0d5e2..ea912f9f97 100644
--- a/src/cmd/compile/internal/ssa/gen/ARM64.rules
+++ b/src/cmd/compile/internal/ssa/gen/ARM64.rules
@@ -60,6 +60,8 @@
(Trunc ...) => (FRINTZD ...)
(FMA x y z) => (FMADDD z x y)
+(Sqrt32 ...) => (FSQRTS ...)
+
// lowering rotates
(RotateLeft8 <t> x (MOVDconst [c])) => (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
(RotateLeft16 <t> x (MOVDconst [c])) => (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
@@ -792,6 +794,15 @@
(MOVHUloadidx2 ptr (MOVDconst [c]) mem) && is32Bit(c<<1) => (MOVHUload [int32(c)<<1] ptr mem)
(MOVHloadidx2 ptr (MOVDconst [c]) mem) && is32Bit(c<<1) => (MOVHload [int32(c)<<1] ptr mem)
+(FMOVDload [off] {sym} (ADDshiftLL [3] ptr idx) mem) && off == 0 && sym == nil => (FMOVDloadidx8 ptr idx mem)
+(FMOVSload [off] {sym} (ADDshiftLL [2] ptr idx) mem) && off == 0 && sym == nil => (FMOVSloadidx4 ptr idx mem)
+(FMOVDloadidx ptr (SLLconst [3] idx) mem) => (FMOVDloadidx8 ptr idx mem)
+(FMOVSloadidx ptr (SLLconst [2] idx) mem) => (FMOVSloadidx4 ptr idx mem)
+(FMOVDloadidx (SLLconst [3] idx) ptr mem) => (FMOVDloadidx8 ptr idx mem)
+(FMOVSloadidx (SLLconst [2] idx) ptr mem) => (FMOVSloadidx4 ptr idx mem)
+(FMOVDloadidx8 ptr (MOVDconst [c]) mem) && is32Bit(c<<3) => (FMOVDload ptr [int32(c)<<3] mem)
+(FMOVSloadidx4 ptr (MOVDconst [c]) mem) && is32Bit(c<<2) => (FMOVSload ptr [int32(c)<<2] mem)
+
(MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem) && is32Bit(int64(off1)+off2)
&& (ptr.Op != OpSB || !config.ctxt.Flag_shared) =>
(MOVBstore [off1+int32(off2)] {sym} ptr val mem)
@@ -865,6 +876,15 @@
(MOVWstoreidx4 ptr (MOVDconst [c]) val mem) && is32Bit(c<<2) => (MOVWstore [int32(c)<<2] ptr val mem)
(MOVHstoreidx2 ptr (MOVDconst [c]) val mem) && is32Bit(c<<1) => (MOVHstore [int32(c)<<1] ptr val mem)
+(FMOVDstore [off] {sym} (ADDshiftLL [3] ptr idx) val mem) && off == 0 && sym == nil => (FMOVDstoreidx8 ptr idx val mem)
+(FMOVSstore [off] {sym} (ADDshiftLL [2] ptr idx) val mem) && off == 0 && sym == nil => (FMOVSstoreidx4 ptr idx val mem)
+(FMOVDstoreidx ptr (SLLconst [3] idx) val mem) => (FMOVDstoreidx8 ptr idx val mem)
+(FMOVSstoreidx ptr (SLLconst [2] idx) val mem) => (FMOVSstoreidx4 ptr idx val mem)
+(FMOVDstoreidx (SLLconst [3] idx) ptr val mem) => (FMOVDstoreidx8 ptr idx val mem)
+(FMOVSstoreidx (SLLconst [2] idx) ptr val mem) => (FMOVSstoreidx4 ptr idx val mem)
+(FMOVDstoreidx8 ptr (MOVDconst [c]) val mem) && is32Bit(c<<3) => (FMOVDstore [int32(c)<<3] ptr val mem)
+(FMOVSstoreidx4 ptr (MOVDconst [c]) val mem) && is32Bit(c<<2) => (FMOVSstore [int32(c)<<2] ptr val mem)
+
(MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
&& canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2))
&& (ptr.Op != OpSB || !config.ctxt.Flag_shared) =>
@@ -1127,6 +1147,10 @@
// MOVDnop doesn't emit instruction, only for ensuring the type.
(MOVDreg x) && x.Uses == 1 => (MOVDnop x)
+// TODO: we should be able to get rid of MOVDnop all together.
+// But for now, this is enough to get rid of lots of them.
+(MOVDnop (MOVDconst [c])) => (MOVDconst [c])
+
// fold constant into arithmatic ops
(ADD x (MOVDconst [c])) => (ADDconst [c] x)
(SUB x (MOVDconst [c])) => (SUBconst [c] x)
diff --git a/src/cmd/compile/internal/ssa/gen/ARM64Ops.go b/src/cmd/compile/internal/ssa/gen/ARM64Ops.go
index b0bc9c78ff..0a4fd14b2b 100644
--- a/src/cmd/compile/internal/ssa/gen/ARM64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/ARM64Ops.go
@@ -236,6 +236,7 @@ func init() {
{name: "FNEGS", argLength: 1, reg: fp11, asm: "FNEGS"}, // -arg0, float32
{name: "FNEGD", argLength: 1, reg: fp11, asm: "FNEGD"}, // -arg0, float64
{name: "FSQRTD", argLength: 1, reg: fp11, asm: "FSQRTD"}, // sqrt(arg0), float64
+ {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS"}, // sqrt(arg0), float32
{name: "REV", argLength: 1, reg: gp11, asm: "REV"}, // byte reverse, 64-bit
{name: "REVW", argLength: 1, reg: gp11, asm: "REVW"}, // byte reverse, 32-bit
{name: "REV16W", argLength: 1, reg: gp11, asm: "REV16W"}, // byte reverse in each 16-bit halfword, 32-bit
@@ -379,11 +380,13 @@ func init() {
{name: "FMOVDloadidx", argLength: 3, reg: fp2load, asm: "FMOVD", typ: "Float64"}, // load 64-bit float from arg0 + arg1, arg2=mem.
// shifted register indexed load
- {name: "MOVHloadidx2", argLength: 3, reg: gp2load, asm: "MOVH", typ: "Int16"}, // load 16-bit half-word from arg0 + arg1*2, sign-extended to 64-bit, arg2=mem.
- {name: "MOVHUloadidx2", argLength: 3, reg: gp2load, asm: "MOVHU", typ: "UInt16"}, // load 16-bit half-word from arg0 + arg1*2, zero-extended to 64-bit, arg2=mem.
- {name: "MOVWloadidx4", argLength: 3, reg: gp2load, asm: "MOVW", typ: "Int32"}, // load 32-bit word from arg0 + arg1*4, sign-extended to 64-bit, arg2=mem.
- {name: "MOVWUloadidx4", argLength: 3, reg: gp2load, asm: "MOVWU", typ: "UInt32"}, // load 32-bit word from arg0 + arg1*4, zero-extended to 64-bit, arg2=mem.
- {name: "MOVDloadidx8", argLength: 3, reg: gp2load, asm: "MOVD", typ: "UInt64"}, // load 64-bit double-word from arg0 + arg1*8, arg2 = mem.
+ {name: "MOVHloadidx2", argLength: 3, reg: gp2load, asm: "MOVH", typ: "Int16"}, // load 16-bit half-word from arg0 + arg1*2, sign-extended to 64-bit, arg2=mem.
+ {name: "MOVHUloadidx2", argLength: 3, reg: gp2load, asm: "MOVHU", typ: "UInt16"}, // load 16-bit half-word from arg0 + arg1*2, zero-extended to 64-bit, arg2=mem.
+ {name: "MOVWloadidx4", argLength: 3, reg: gp2load, asm: "MOVW", typ: "Int32"}, // load 32-bit word from arg0 + arg1*4, sign-extended to 64-bit, arg2=mem.
+ {name: "MOVWUloadidx4", argLength: 3, reg: gp2load, asm: "MOVWU", typ: "UInt32"}, // load 32-bit word from arg0 + arg1*4, zero-extended to 64-bit, arg2=mem.
+ {name: "MOVDloadidx8", argLength: 3, reg: gp2load, asm: "MOVD", typ: "UInt64"}, // load 64-bit double-word from arg0 + arg1*8, arg2 = mem.
+ {name: "FMOVSloadidx4", argLength: 3, reg: fp2load, asm: "FMOVS", typ: "Float32"}, // load 32-bit float from arg0 + arg1*4, arg2 = mem.
+ {name: "FMOVDloadidx8", argLength: 3, reg: fp2load, asm: "FMOVD", typ: "Float64"}, // load 64-bit float from arg0 + arg1*8, arg2 = mem.
{name: "MOVBstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 1 byte of arg1 to arg0 + auxInt + aux. arg2=mem.
{name: "MOVHstore", argLength: 3, reg: gpstore, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes of arg1 to arg0 + auxInt + aux. arg2=mem.
@@ -402,9 +405,11 @@ func init() {
{name: "FMOVDstoreidx", argLength: 4, reg: fpstore2, asm: "FMOVD", typ: "Mem"}, // store 64-bit float of arg2 to arg0 + arg1, arg3=mem.
// shifted register indexed store
- {name: "MOVHstoreidx2", argLength: 4, reg: gpstore2, asm: "MOVH", typ: "Mem"}, // store 2 bytes of arg2 to arg0 + arg1*2, arg3 = mem.
- {name: "MOVWstoreidx4", argLength: 4, reg: gpstore2, asm: "MOVW", typ: "Mem"}, // store 4 bytes of arg2 to arg0 + arg1*4, arg3 = mem.
- {name: "MOVDstoreidx8", argLength: 4, reg: gpstore2, asm: "MOVD", typ: "Mem"}, // store 8 bytes of arg2 to arg0 + arg1*8, arg3 = mem.
+ {name: "MOVHstoreidx2", argLength: 4, reg: gpstore2, asm: "MOVH", typ: "Mem"}, // store 2 bytes of arg2 to arg0 + arg1*2, arg3 = mem.
+ {name: "MOVWstoreidx4", argLength: 4, reg: gpstore2, asm: "MOVW", typ: "Mem"}, // store 4 bytes of arg2 to arg0 + arg1*4, arg3 = mem.
+ {name: "MOVDstoreidx8", argLength: 4, reg: gpstore2, asm: "MOVD", typ: "Mem"}, // store 8 bytes of arg2 to arg0 + arg1*8, arg3 = mem.
+ {name: "FMOVSstoreidx4", argLength: 4, reg: fpstore2, asm: "FMOVS", typ: "Mem"}, // store 32-bit float of arg2 to arg0 + arg1*4, arg3=mem.
+ {name: "FMOVDstoreidx8", argLength: 4, reg: fpstore2, asm: "FMOVD", typ: "Mem"}, // store 64-bit float of arg2 to arg0 + arg1*8, arg3=mem.
{name: "MOVBstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVB", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 1 byte of zero to arg0 + auxInt + aux. arg1=mem.
{name: "MOVHstorezero", argLength: 2, reg: gpstore0, aux: "SymOff", asm: "MOVH", typ: "Mem", faultOnNilArg0: true, symEffect: "Write"}, // store 2 bytes of zero to arg0 + auxInt + aux. arg1=mem.
diff --git a/src/cmd/compile/internal/ssa/gen/ARMOps.go b/src/cmd/compile/internal/ssa/gen/ARMOps.go
index 70c789937a..253ff573ec 100644
--- a/src/cmd/compile/internal/ssa/gen/ARMOps.go
+++ b/src/cmd/compile/internal/ssa/gen/ARMOps.go
@@ -217,6 +217,7 @@ func init() {
{name: "NEGF", argLength: 1, reg: fp11, asm: "NEGF"}, // -arg0, float32
{name: "NEGD", argLength: 1, reg: fp11, asm: "NEGD"}, // -arg0, float64
{name: "SQRTD", argLength: 1, reg: fp11, asm: "SQRTD"}, // sqrt(arg0), float64
+ {name: "SQRTF", argLength: 1, reg: fp11, asm: "SQRTF"}, // sqrt(arg0), float32
{name: "ABSD", argLength: 1, reg: fp11, asm: "ABSD"}, // abs(arg0), float64
{name: "CLZ", argLength: 1, reg: gp11, asm: "CLZ"}, // count leading zero
diff --git a/src/cmd/compile/internal/ssa/gen/MIPS.rules b/src/cmd/compile/internal/ssa/gen/MIPS.rules
index 8ad2c90ac3..6b59555cbe 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPS.rules
+++ b/src/cmd/compile/internal/ssa/gen/MIPS.rules
@@ -121,6 +121,7 @@
(Com(32|16|8) x) => (NORconst [0] x)
(Sqrt ...) => (SQRTD ...)
+(Sqrt32 ...) => (SQRTF ...)
// TODO: optimize this case?
(Ctz32NonZero ...) => (Ctz32 ...)
@@ -559,6 +560,10 @@
// MOVWnop doesn't emit instruction, only for ensuring the type.
(MOVWreg x) && x.Uses == 1 => (MOVWnop x)
+// TODO: we should be able to get rid of MOVWnop all together.
+// But for now, this is enough to get rid of lots of them.
+(MOVWnop (MOVWconst [c])) => (MOVWconst [c])
+
// fold constant into arithmatic ops
(ADD x (MOVWconst [c])) => (ADDconst [c] x)
(SUB x (MOVWconst [c])) => (SUBconst [c] x)
diff --git a/src/cmd/compile/internal/ssa/gen/MIPS64.rules b/src/cmd/compile/internal/ssa/gen/MIPS64.rules
index 088c9b1ac4..bc51a0d53d 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPS64.rules
+++ b/src/cmd/compile/internal/ssa/gen/MIPS64.rules
@@ -121,6 +121,7 @@
(Com(64|32|16|8) x) => (NOR (MOVVconst [0]) x)
(Sqrt ...) => (SQRTD ...)
+(Sqrt32 ...) => (SQRTF ...)
// boolean ops -- booleans are represented with 0=false, 1=true
(AndB ...) => (AND ...)
@@ -558,6 +559,10 @@
// MOVVnop doesn't emit instruction, only for ensuring the type.
(MOVVreg x) && x.Uses == 1 => (MOVVnop x)
+// TODO: we should be able to get rid of MOVVnop all together.
+// But for now, this is enough to get rid of lots of them.
+(MOVVnop (MOVVconst [c])) => (MOVVconst [c])
+
// fold constant into arithmatic ops
(ADDV x (MOVVconst [c])) && is32Bit(c) => (ADDVconst [c] x)
(SUBV x (MOVVconst [c])) && is32Bit(c) => (SUBVconst [c] x)
diff --git a/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go b/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
index e1e3933502..77f251c0d3 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/MIPS64Ops.go
@@ -199,6 +199,7 @@ func init() {
{name: "NEGF", argLength: 1, reg: fp11, asm: "NEGF"}, // -arg0, float32
{name: "NEGD", argLength: 1, reg: fp11, asm: "NEGD"}, // -arg0, float64
{name: "SQRTD", argLength: 1, reg: fp11, asm: "SQRTD"}, // sqrt(arg0), float64
+ {name: "SQRTF", argLength: 1, reg: fp11, asm: "SQRTF"}, // sqrt(arg0), float32
// shifts
{name: "SLLV", argLength: 2, reg: gp21, asm: "SLLV"}, // arg0 << arg1, shift amount is mod 64
diff --git a/src/cmd/compile/internal/ssa/gen/MIPSOps.go b/src/cmd/compile/internal/ssa/gen/MIPSOps.go
index 75ab99ea26..b92e8cb9f1 100644
--- a/src/cmd/compile/internal/ssa/gen/MIPSOps.go
+++ b/src/cmd/compile/internal/ssa/gen/MIPSOps.go
@@ -182,6 +182,7 @@ func init() {
{name: "NEGF", argLength: 1, reg: fp11, asm: "NEGF"}, // -arg0, float32
{name: "NEGD", argLength: 1, reg: fp11, asm: "NEGD"}, // -arg0, float64
{name: "SQRTD", argLength: 1, reg: fp11, asm: "SQRTD"}, // sqrt(arg0), float64
+ {name: "SQRTF", argLength: 1, reg: fp11, asm: "SQRTF"}, // sqrt(arg0), float32
// shifts
{name: "SLL", argLength: 2, reg: gp21, asm: "SLL"}, // arg0 << arg1, shift amount is mod 32
diff --git a/src/cmd/compile/internal/ssa/gen/PPC64.rules b/src/cmd/compile/internal/ssa/gen/PPC64.rules
index a762be65d4..85ce9a5b54 100644
--- a/src/cmd/compile/internal/ssa/gen/PPC64.rules
+++ b/src/cmd/compile/internal/ssa/gen/PPC64.rules
@@ -71,6 +71,7 @@
(Round(32|64)F ...) => (LoweredRound(32|64)F ...)
(Sqrt ...) => (FSQRT ...)
+(Sqrt32 ...) => (FSQRTS ...)
(Floor ...) => (FFLOOR ...)
(Ceil ...) => (FCEIL ...)
(Trunc ...) => (FTRUNC ...)
diff --git a/src/cmd/compile/internal/ssa/gen/RISCV64.rules b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
index 4380a5efef..d7efef039e 100644
--- a/src/cmd/compile/internal/ssa/gen/RISCV64.rules
+++ b/src/cmd/compile/internal/ssa/gen/RISCV64.rules
@@ -92,6 +92,7 @@
(Com8 ...) => (NOT ...)
(Sqrt ...) => (FSQRTD ...)
+(Sqrt32 ...) => (FSQRTS ...)
// Sign and zero extension.
@@ -251,7 +252,7 @@
(EqPtr x y) => (SEQZ (SUB <x.Type> x y))
(Eq64 x y) => (SEQZ (SUB <x.Type> x y))
-(Eq32 x y) => (SEQZ (SUBW <x.Type> x y))
+(Eq32 x y) => (SEQZ (SUB <x.Type> (ZeroExt32to64 x) (ZeroExt32to64 y)))
(Eq16 x y) => (SEQZ (SUB <x.Type> (ZeroExt16to64 x) (ZeroExt16to64 y)))
(Eq8 x y) => (SEQZ (SUB <x.Type> (ZeroExt8to64 x) (ZeroExt8to64 y)))
(Eq64F ...) => (FEQD ...)
@@ -259,7 +260,7 @@
(NeqPtr x y) => (SNEZ (SUB <x.Type> x y))
(Neq64 x y) => (SNEZ (SUB <x.Type> x y))
-(Neq32 x y) => (SNEZ (SUBW <x.Type> x y))
+(Neq32 x y) => (SNEZ (SUB <x.Type> (ZeroExt32to64 x) (ZeroExt32to64 y)))
(Neq16 x y) => (SNEZ (SUB <x.Type> (ZeroExt16to64 x) (ZeroExt16to64 y)))
(Neq8 x y) => (SNEZ (SUB <x.Type> (ZeroExt8to64 x) (ZeroExt8to64 y)))
(Neq64F ...) => (FNED ...)
@@ -563,12 +564,28 @@
(AtomicAdd32 ...) => (LoweredAtomicAdd32 ...)
(AtomicAdd64 ...) => (LoweredAtomicAdd64 ...)
+// AtomicAnd8(ptr,val) => LoweredAtomicAnd32(ptr&^3, ^((uint8(val) ^ 0xff) << ((ptr & 3) * 8)))
+(AtomicAnd8 ptr val mem) =>
+ (LoweredAtomicAnd32 (ANDI <typ.Uintptr> [^3] ptr)
+ (NOT <typ.UInt32> (SLL <typ.UInt32> (XORI <typ.UInt32> [0xff] (ZeroExt8to32 val))
+ (SLLI <typ.UInt64> [3] (ANDI <typ.UInt64> [3] ptr)))) mem)
+
+(AtomicAnd32 ...) => (LoweredAtomicAnd32 ...)
+
(AtomicCompareAndSwap32 ...) => (LoweredAtomicCas32 ...)
(AtomicCompareAndSwap64 ...) => (LoweredAtomicCas64 ...)
(AtomicExchange32 ...) => (LoweredAtomicExchange32 ...)
(AtomicExchange64 ...) => (LoweredAtomicExchange64 ...)
+// AtomicOr8(ptr,val) => LoweredAtomicOr32(ptr&^3, uint32(val)<<((ptr&3)*8))
+(AtomicOr8 ptr val mem) =>
+ (LoweredAtomicOr32 (ANDI <typ.Uintptr> [^3] ptr)
+ (SLL <typ.UInt32> (ZeroExt8to32 val)
+ (SLLI <typ.UInt64> [3] (ANDI <typ.UInt64> [3] ptr))) mem)
+
+(AtomicOr32 ...) => (LoweredAtomicOr32 ...)
+
// Conditional branches
(If cond yes no) => (BNEZ cond yes no)
@@ -673,6 +690,10 @@
// MOVnop does not emit an instruction, only for ensuring the type.
(MOVDreg x) && x.Uses == 1 => (MOVDnop x)
+// TODO: we should be able to get rid of MOVDnop all together.
+// But for now, this is enough to get rid of lots of them.
+(MOVDnop (MOVDconst [c])) => (MOVDconst [c])
+
// Fold constant into immediate instructions where possible.
(ADD (MOVBconst [val]) x) => (ADDI [int64(val)] x)
(ADD (MOVHconst [val]) x) => (ADDI [int64(val)] x)
diff --git a/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go b/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
index f64319230b..92a0c3c84c 100644
--- a/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
+++ b/src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
@@ -126,6 +126,7 @@ func init() {
gp11sb = regInfo{inputs: []regMask{gpspsbMask}, outputs: []regMask{gpMask}}
gpxchg = regInfo{inputs: []regMask{gpspsbgMask, gpgMask}, outputs: []regMask{gpMask}}
gpcas = regInfo{inputs: []regMask{gpspsbgMask, gpgMask, gpgMask}, outputs: []regMask{gpMask}}
+ gpatomic = regInfo{inputs: []regMask{gpspsbgMask, gpgMask}}
fp11 = regInfo{inputs: []regMask{fpMask}, outputs: []regMask{fpMask}}
fp21 = regInfo{inputs: []regMask{fpMask, fpMask}, outputs: []regMask{fpMask}}
@@ -335,7 +336,7 @@ func init() {
{name: "LoweredAtomicLoad64", argLength: 2, reg: gpload, faultOnNilArg0: true},
// Atomic stores.
- // store arg1 to arg0. arg2=mem. returns memory.
+ // store arg1 to *arg0. arg2=mem. returns memory.
{name: "LoweredAtomicStore8", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
{name: "LoweredAtomicStore32", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
{name: "LoweredAtomicStore64", argLength: 3, reg: gpstore, faultOnNilArg0: true, hasSideEffects: true},
@@ -367,6 +368,11 @@ func init() {
{name: "LoweredAtomicCas32", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
{name: "LoweredAtomicCas64", argLength: 4, reg: gpcas, resultNotInArgs: true, faultOnNilArg0: true, hasSideEffects: true, unsafePoint: true},
+ // Atomic 32 bit AND/OR.
+ // *arg0 &= (|=) arg1. arg2=mem. returns nil.
+ {name: "LoweredAtomicAnd32", argLength: 3, reg: gpatomic, asm: "AMOANDW", faultOnNilArg0: true, hasSideEffects: true},
+ {name: "LoweredAtomicOr32", argLength: 3, reg: gpatomic, asm: "AMOORW", faultOnNilArg0: true, hasSideEffects: true},
+
// Lowering pass-throughs
{name: "LoweredNilCheck", argLength: 2, faultOnNilArg0: true, nilCheck: true, reg: regInfo{inputs: []regMask{gpspMask}}}, // arg0=ptr,arg1=mem, returns void. Faults if ptr is nil.
{name: "LoweredGetClosurePtr", reg: regInfo{outputs: []regMask{regCtxt}}}, // scheduler ensures only at beginning of entry block
diff --git a/src/cmd/compile/internal/ssa/gen/S390X.rules b/src/cmd/compile/internal/ssa/gen/S390X.rules
index c3421da0a2..e4a1cd6981 100644
--- a/src/cmd/compile/internal/ssa/gen/S390X.rules
+++ b/src/cmd/compile/internal/ssa/gen/S390X.rules
@@ -142,6 +142,8 @@
(Round x) => (FIDBR [1] x)
(FMA x y z) => (FMADD z x y)
+(Sqrt32 ...) => (FSQRTS ...)
+
// Atomic loads and stores.
// The SYNC instruction (fast-BCR-serialization) prevents store-load
// reordering. Other sequences of memory operations (load-load,
@@ -1420,6 +1422,16 @@
&& clobber(x)
=> (MOVDBRstore [i-4] {s} p w0 mem)
+(MOVBstore [7] p1 (SRDconst w)
+ x1:(MOVHBRstore [5] p1 (SRDconst w)
+ x2:(MOVWBRstore [1] p1 (SRDconst w)
+ x3:(MOVBstore p1 w mem))))
+ && x1.Uses == 1
+ && x2.Uses == 1
+ && x3.Uses == 1
+ && clobber(x1, x2, x3)
+ => (MOVDBRstore p1 w mem)
+
// Combining byte loads into larger (unaligned) loads.
// Big-endian loads
diff --git a/src/cmd/compile/internal/ssa/gen/S390XOps.go b/src/cmd/compile/internal/ssa/gen/S390XOps.go
index b24fd61942..1ddad1febd 100644
--- a/src/cmd/compile/internal/ssa/gen/S390XOps.go
+++ b/src/cmd/compile/internal/ssa/gen/S390XOps.go
@@ -382,6 +382,7 @@ func init() {
{name: "NOTW", argLength: 1, reg: gp11, resultInArg0: true, clobberFlags: true}, // ^arg0
{name: "FSQRT", argLength: 1, reg: fp11, asm: "FSQRT"}, // sqrt(arg0)
+ {name: "FSQRTS", argLength: 1, reg: fp11, asm: "FSQRTS"}, // sqrt(arg0), float32
// Conditional register-register moves.
// The aux for these values is an s390x.CCMask value representing the condition code mask.
diff --git a/src/cmd/compile/internal/ssa/gen/Wasm.rules b/src/cmd/compile/internal/ssa/gen/Wasm.rules
index fc45cd3ed5..7cda16b4b5 100644
--- a/src/cmd/compile/internal/ssa/gen/Wasm.rules
+++ b/src/cmd/compile/internal/ssa/gen/Wasm.rules
@@ -332,6 +332,8 @@
(Abs ...) => (F64Abs ...)
(Copysign ...) => (F64Copysign ...)
+(Sqrt32 ...) => (F32Sqrt ...)
+
(Ctz64 ...) => (I64Ctz ...)
(Ctz32 x) => (I64Ctz (I64Or x (I64Const [0x100000000])))
(Ctz16 x) => (I64Ctz (I64Or x (I64Const [0x10000])))
diff --git a/src/cmd/compile/internal/ssa/gen/WasmOps.go b/src/cmd/compile/internal/ssa/gen/WasmOps.go
index 36c53bc78c..c92878ca73 100644
--- a/src/cmd/compile/internal/ssa/gen/WasmOps.go
+++ b/src/cmd/compile/internal/ssa/gen/WasmOps.go
@@ -238,13 +238,13 @@ func init() {
{name: "I64Extend16S", asm: "I64Extend16S", argLength: 1, reg: gp11, typ: "Int64"}, // sign-extend arg0 from 16 to 64 bit
{name: "I64Extend32S", asm: "I64Extend32S", argLength: 1, reg: gp11, typ: "Int64"}, // sign-extend arg0 from 32 to 64 bit
- {name: "F32Sqrt", asm: "F32Sqrt", argLength: 1, reg: fp64_11, typ: "Float32"}, // sqrt(arg0)
- {name: "F32Trunc", asm: "F32Trunc", argLength: 1, reg: fp64_11, typ: "Float32"}, // trunc(arg0)
- {name: "F32Ceil", asm: "F32Ceil", argLength: 1, reg: fp64_11, typ: "Float32"}, // ceil(arg0)
- {name: "F32Floor", asm: "F32Floor", argLength: 1, reg: fp64_11, typ: "Float32"}, // floor(arg0)
- {name: "F32Nearest", asm: "F32Nearest", argLength: 1, reg: fp64_11, typ: "Float32"}, // round(arg0)
- {name: "F32Abs", asm: "F32Abs", argLength: 1, reg: fp64_11, typ: "Float32"}, // abs(arg0)
- {name: "F32Copysign", asm: "F32Copysign", argLength: 2, reg: fp64_21, typ: "Float32"}, // copysign(arg0, arg1)
+ {name: "F32Sqrt", asm: "F32Sqrt", argLength: 1, reg: fp32_11, typ: "Float32"}, // sqrt(arg0)
+ {name: "F32Trunc", asm: "F32Trunc", argLength: 1, reg: fp32_11, typ: "Float32"}, // trunc(arg0)
+ {name: "F32Ceil", asm: "F32Ceil", argLength: 1, reg: fp32_11, typ: "Float32"}, // ceil(arg0)
+ {name: "F32Floor", asm: "F32Floor", argLength: 1, reg: fp32_11, typ: "Float32"}, // floor(arg0)
+ {name: "F32Nearest", asm: "F32Nearest", argLength: 1, reg: fp32_11, typ: "Float32"}, // round(arg0)
+ {name: "F32Abs", asm: "F32Abs", argLength: 1, reg: fp32_11, typ: "Float32"}, // abs(arg0)
+ {name: "F32Copysign", asm: "F32Copysign", argLength: 2, reg: fp32_21, typ: "Float32"}, // copysign(arg0, arg1)
{name: "F64Sqrt", asm: "F64Sqrt", argLength: 1, reg: fp64_11, typ: "Float64"}, // sqrt(arg0)
{name: "F64Trunc", asm: "F64Trunc", argLength: 1, reg: fp64_11, typ: "Float64"}, // trunc(arg0)
diff --git a/src/cmd/compile/internal/ssa/gen/generic.rules b/src/cmd/compile/internal/ssa/gen/generic.rules
index 1784923224..9dd20a7cfa 100644
--- a/src/cmd/compile/internal/ssa/gen/generic.rules
+++ b/src/cmd/compile/internal/ssa/gen/generic.rules
@@ -1968,38 +1968,10 @@
(Div32F x (Const32F <t> [c])) && reciprocalExact32(c) => (Mul32F x (Const32F <t> [1/c]))
(Div64F x (Const64F <t> [c])) && reciprocalExact64(c) => (Mul64F x (Const64F <t> [1/c]))
-(Sqrt (Const64F [c])) && !math.IsNaN(math.Sqrt(c)) => (Const64F [math.Sqrt(c)])
+// rewrite single-precision sqrt expression "float32(math.Sqrt(float64(x)))"
+(Cvt64Fto32F sqrt0:(Sqrt (Cvt32Fto64F x))) && sqrt0.Uses==1 => (Sqrt32 x)
-// recognize runtime.newobject and don't Zero/Nilcheck it
-(Zero (Load (OffPtr [c] (SP)) mem) mem)
- && mem.Op == OpStaticCall
- && isSameCall(mem.Aux, "runtime.newobject")
- && c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
- => mem
-(Store (Load (OffPtr [c] (SP)) mem) x mem)
- && isConstZero(x)
- && mem.Op == OpStaticCall
- && isSameCall(mem.Aux, "runtime.newobject")
- && c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
- => mem
-(Store (OffPtr (Load (OffPtr [c] (SP)) mem)) x mem)
- && isConstZero(x)
- && mem.Op == OpStaticCall
- && isSameCall(mem.Aux, "runtime.newobject")
- && c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
- => mem
-// nil checks just need to rewrite to something useless.
-// they will be deadcode eliminated soon afterwards.
-(NilCheck (Load (OffPtr [c] (SP)) (StaticCall {sym} _)) _)
- && isSameCall(sym, "runtime.newobject")
- && c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
- && warnRule(fe.Debug_checknil(), v, "removed nil check")
- => (Invalid)
-(NilCheck (OffPtr (Load (OffPtr [c] (SP)) (StaticCall {sym} _))) _)
- && isSameCall(sym, "runtime.newobject")
- && c == config.ctxt.FixedFrameSize() + config.RegSize // offset of return value
- && warnRule(fe.Debug_checknil(), v, "removed nil check")
- => (Invalid)
+(Sqrt (Const64F [c])) && !math.IsNaN(math.Sqrt(c)) => (Const64F [math.Sqrt(c)])
// for rewriting results of some late-expanded rewrites (below)
(SelectN [0] (MakeResult a ___)) => a
@@ -2021,12 +1993,12 @@
&& isSameCall(call.Aux, "runtime.newobject")
=> mem
-(NilCheck (SelectN [0] call:(StaticLECall _ _)) (SelectN [1] call))
+(NilCheck (SelectN [0] call:(StaticLECall _ _)) _)
&& isSameCall(call.Aux, "runtime.newobject")
&& warnRule(fe.Debug_checknil(), v, "removed nil check")
=> (Invalid)
-(NilCheck (OffPtr (SelectN [0] call:(StaticLECall _ _))) (SelectN [1] call))
+(NilCheck (OffPtr (SelectN [0] call:(StaticLECall _ _))) _)
&& isSameCall(call.Aux, "runtime.newobject")
&& warnRule(fe.Debug_checknil(), v, "removed nil check")
=> (Invalid)
@@ -2083,15 +2055,19 @@
(IsNonNil (Addr _)) => (ConstBool [true])
(IsNonNil (LocalAddr _ _)) => (ConstBool [true])
+// TODO REGISTER ARGS this will need revision.
+// Because expand calls runs after prove, constants useful to this pattern may not appear
+// In the future both versions need to exist; the memory and register variants.
+
// Inline small or disjoint runtime.memmove calls with constant length.
// See the comment in op Move in genericOps.go for discussion of the type.
-(StaticCall {sym} s1:(Store _ (Const(64|32) [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))
+(SelectN [0] call:(StaticCall {sym} s1:(Store _ (Const(64|32) [sz]) s2:(Store _ src s3:(Store {t} _ dst mem)))))
&& sz >= 0
&& isSameCall(sym, "runtime.memmove")
&& t.IsPtr() // avoids TUINTPTR, see issue 30061
&& s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1
&& isInlinableMemmove(dst, src, int64(sz), config)
- && clobber(s1, s2, s3)
+ && clobber(s1, s2, s3, call)
=> (Move {t.Elem()} [int64(sz)] dst src mem)
// Inline small or disjoint runtime.memmove calls with constant length.
@@ -2105,13 +2081,6 @@
&& clobber(call)
=> (Move {dst.Type.Elem()} [int64(sz)] dst src mem)
-// De-virtualize interface calls into static calls.
-// Note that (ITab (IMake)) doesn't get
-// rewritten until after the first opt pass,
-// so this rule should trigger reliably.
-(InterCall [argsize] {auxCall} (Load (OffPtr [off] (ITab (IMake (Addr {itab} (SB)) _))) _) mem) && devirt(v, auxCall, itab, off) != nil =>
- (StaticCall [int32(argsize)] {devirt(v, auxCall, itab, off)} mem)
-
// De-virtualize late-expanded interface calls into late-expanded static calls.
// Note that (ITab (IMake)) doesn't get rewritten until after the first opt pass,
// so this rule should trigger reliably.
@@ -2499,8 +2468,8 @@
(Store {t5} (OffPtr <tt5> [o5] dst) d4
(Zero {t1} [n] dst mem)))))
-// TODO this does not fire before call expansion; is that acceptable?
-(StaticCall {sym} x) && needRaceCleanup(sym, v) => x
+(SelectN [0] call:(StaticLECall {sym} a x)) && needRaceCleanup(sym, call) && clobber(call) => x
+(SelectN [0] call:(StaticLECall {sym} x)) && needRaceCleanup(sym, call) && clobber(call) => x
// Collapse moving A -> B -> C into just A -> C.
// Later passes (deadstore, elim unread auto) will remove the A -> B move, if possible.
diff --git a/src/cmd/compile/internal/ssa/gen/genericOps.go b/src/cmd/compile/internal/ssa/gen/genericOps.go
index 8cfda35c22..ee85156a42 100644
--- a/src/cmd/compile/internal/ssa/gen/genericOps.go
+++ b/src/cmd/compile/internal/ssa/gen/genericOps.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
@@ -257,13 +258,14 @@ var genericOps = []opData{
{name: "RotateLeft32", argLength: 2}, // Rotate bits in arg[0] left by arg[1]
{name: "RotateLeft64", argLength: 2}, // Rotate bits in arg[0] left by arg[1]
- // Square root, float64 only.
+ // Square root.
// Special cases:
// +∞ → +∞
// ±0 → ±0 (sign preserved)
// x<0 → NaN
// NaN → NaN
- {name: "Sqrt", argLength: 1}, // √arg0
+ {name: "Sqrt", argLength: 1}, // √arg0 (floating point, double precision)
+ {name: "Sqrt32", argLength: 1}, // √arg0 (floating point, single precision)
// Round to integer, float64 only.
// Special cases:
@@ -332,6 +334,11 @@ var genericOps = []opData{
{name: "InitMem", zeroWidth: true}, // memory input to the function.
{name: "Arg", aux: "SymOff", symEffect: "Read", zeroWidth: true}, // argument to the function. aux=GCNode of arg, off = offset in that arg.
+ // Like Arg, these are generic ops that survive lowering. AuxInt is a register index, and the actual output register for each index is defined by the architecture.
+ // AuxInt = integer argument index (not a register number). ABI-specified spill loc obtained from function
+ {name: "ArgIntReg", aux: "NameOffsetInt8", zeroWidth: true}, // argument to the function in an int reg.
+ {name: "ArgFloatReg", aux: "NameOffsetInt8", zeroWidth: true}, // argument to the function in a float reg.
+
// The address of a variable. arg0 is the base pointer.
// If the variable is a global, the base pointer will be SB and
// the Aux field will be a *obj.LSym.
@@ -390,7 +397,7 @@ var genericOps = []opData{
// to match StaticCall's 32 bit arg size limit.
// TODO(drchase,josharian): could the arg size limit be bundled into the rules for CallOff?
{name: "ClosureCall", argLength: 3, aux: "CallOff", call: true}, // arg0=code pointer, arg1=context ptr, arg2=memory. auxint=arg size. Returns memory.
- {name: "StaticCall", argLength: 1, aux: "CallOff", call: true}, // call function aux.(*obj.LSym), arg0=memory. auxint=arg size. Returns memory.
+ {name: "StaticCall", argLength: -1, aux: "CallOff", call: true}, // call function aux.(*obj.LSym), arg0..argN-1 are register inputs, argN=memory. auxint=arg size. Returns Result of register results, plus memory.
{name: "InterCall", argLength: 2, aux: "CallOff", call: true}, // interface call. arg0=code pointer, arg1=memory, auxint=arg size. Returns memory.
{name: "ClosureLECall", argLength: -1, aux: "CallOff", call: true}, // late-expanded closure call. arg0=code pointer, arg1=context ptr, arg2..argN-1 are inputs, argN is mem. auxint = arg size. Result is tuple of result(s), plus mem.
{name: "StaticLECall", argLength: -1, aux: "CallOff", call: true}, // late-expanded static call function aux.(*ssa.AuxCall.Fn). arg0..argN-1 are inputs, argN is mem. auxint = arg size. Result is tuple of result(s), plus mem.
diff --git a/src/cmd/compile/internal/ssa/gen/main.go b/src/cmd/compile/internal/ssa/gen/main.go
index dfa146a28a..8e5997b25a 100644
--- a/src/cmd/compile/internal/ssa/gen/main.go
+++ b/src/cmd/compile/internal/ssa/gen/main.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// The gen command generates Go code (in the parent directory) for all
@@ -30,21 +31,23 @@ import (
// apart from type names, and avoid awkward func parameters like "arch arch".
type arch struct {
- name string
- pkg string // obj package to import for this arch.
- genfile string // source file containing opcode code generation.
- ops []opData
- blocks []blockData
- regnames []string
- gpregmask regMask
- fpregmask regMask
- fp32regmask regMask
- fp64regmask regMask
- specialregmask regMask
- framepointerreg int8
- linkreg int8
- generic bool
- imports []string
+ name string
+ pkg string // obj package to import for this arch.
+ genfile string // source file containing opcode code generation.
+ ops []opData
+ blocks []blockData
+ regnames []string
+ ParamIntRegNames string
+ ParamFloatRegNames string
+ gpregmask regMask
+ fpregmask regMask
+ fp32regmask regMask
+ fp64regmask regMask
+ specialregmask regMask
+ framepointerreg int8
+ linkreg int8
+ generic bool
+ imports []string
}
type opData struct {
@@ -63,7 +66,6 @@ type opData struct {
nilCheck bool // this op is a nil check on arg0
faultOnNilArg0 bool // this op will fault if arg0 is nil (and aux encodes a small offset)
faultOnNilArg1 bool // this op will fault if arg1 is nil (and aux encodes a small offset)
- usesScratch bool // this op requires scratch memory space
hasSideEffects bool // for "reasons", not to be eliminated. E.g., atomic store, #19182.
zeroWidth bool // op never translates into any machine code. example: copy, which may sometimes translate to machine code, is not zero-width.
unsafePoint bool // this op is an unsafe point, i.e. not safe for async preemption
@@ -320,9 +322,6 @@ func genOp() {
log.Fatalf("faultOnNilArg1 with aux %s not allowed", v.aux)
}
}
- if v.usesScratch {
- fmt.Fprintln(w, "usesScratch: true,")
- }
if v.hasSideEffects {
fmt.Fprintln(w, "hasSideEffects: true,")
}
@@ -404,12 +403,11 @@ func genOp() {
// generate op string method
fmt.Fprintln(w, "func (o Op) String() string {return opcodeTable[o].name }")
- fmt.Fprintln(w, "func (o Op) UsesScratch() bool { return opcodeTable[o].usesScratch }")
-
fmt.Fprintln(w, "func (o Op) SymEffect() SymEffect { return opcodeTable[o].symEffect }")
fmt.Fprintln(w, "func (o Op) IsCall() bool { return opcodeTable[o].call }")
fmt.Fprintln(w, "func (o Op) HasSideEffects() bool { return opcodeTable[o].hasSideEffects }")
fmt.Fprintln(w, "func (o Op) UnsafePoint() bool { return opcodeTable[o].unsafePoint }")
+ fmt.Fprintln(w, "func (o Op) ResultInArg0() bool { return opcodeTable[o].resultInArg0 }")
// generate registers
for _, a := range archs {
@@ -418,7 +416,9 @@ func genOp() {
}
fmt.Fprintf(w, "var registers%s = [...]Register {\n", a.name)
var gcRegN int
+ num := map[string]int8{}
for i, r := range a.regnames {
+ num[r] = int8(i)
pkg := a.pkg[len("cmd/internal/obj/"):]
var objname string // name in cmd/internal/obj/$ARCH
switch r {
@@ -441,11 +441,38 @@ func genOp() {
}
fmt.Fprintf(w, " {%d, %s, %d, \"%s\"},\n", i, objname, gcRegIdx, r)
}
+ parameterRegisterList := func(paramNamesString string) []int8 {
+ paramNamesString = strings.TrimSpace(paramNamesString)
+ if paramNamesString == "" {
+ return nil
+ }
+ paramNames := strings.Split(paramNamesString, " ")
+ var paramRegs []int8
+ for _, regName := range paramNames {
+ if regName == "" {
+ // forgive extra spaces
+ continue
+ }
+ if regNum, ok := num[regName]; ok {
+ paramRegs = append(paramRegs, regNum)
+ delete(num, regName)
+ } else {
+ log.Fatalf("parameter register %s for architecture %s not a register name (or repeated in parameter list)", regName, a.name)
+ }
+ }
+ return paramRegs
+ }
+
+ paramIntRegs := parameterRegisterList(a.ParamIntRegNames)
+ paramFloatRegs := parameterRegisterList(a.ParamFloatRegNames)
+
if gcRegN > 32 {
// Won't fit in a uint32 mask.
log.Fatalf("too many GC registers (%d > 32) on %s", gcRegN, a.name)
}
fmt.Fprintln(w, "}")
+ fmt.Fprintf(w, "var paramIntReg%s = %#v\n", a.name, paramIntRegs)
+ fmt.Fprintf(w, "var paramFloatReg%s = %#v\n", a.name, paramFloatRegs)
fmt.Fprintf(w, "var gpRegMask%s = regMask(%d)\n", a.name, a.gpregmask)
fmt.Fprintf(w, "var fpRegMask%s = regMask(%d)\n", a.name, a.fpregmask)
if a.fp32regmask != 0 {
diff --git a/src/cmd/compile/internal/ssa/gen/rulegen.go b/src/cmd/compile/internal/ssa/gen/rulegen.go
index aaf9101368..6388aab362 100644
--- a/src/cmd/compile/internal/ssa/gen/rulegen.go
+++ b/src/cmd/compile/internal/ssa/gen/rulegen.go
@@ -582,6 +582,7 @@ func fprint(w io.Writer, n Node) {
"math",
"cmd/internal/obj",
"cmd/internal/objabi",
+ "cmd/compile/internal/base",
"cmd/compile/internal/types",
}, n.Arch.imports...) {
fmt.Fprintf(w, "import %q\n", path)
diff --git a/src/cmd/compile/internal/ssa/location.go b/src/cmd/compile/internal/ssa/location.go
index 4cd0ac8d77..af0a913d17 100644
--- a/src/cmd/compile/internal/ssa/location.go
+++ b/src/cmd/compile/internal/ssa/location.go
@@ -88,6 +88,20 @@ func (t LocPair) String() string {
return fmt.Sprintf("<%s,%s>", n0, n1)
}
+type LocResults []Location
+
+func (t LocResults) String() string {
+ s := "<"
+ a := ""
+ for _, r := range t {
+ a += s
+ s = ","
+ a += r.String()
+ }
+ a += ">"
+ return a
+}
+
type ArgPair struct {
reg *Register
mem LocalSlot
diff --git a/src/cmd/compile/internal/ssa/loopreschedchecks.go b/src/cmd/compile/internal/ssa/loopreschedchecks.go
index 9c73bcff26..5308d1ac48 100644
--- a/src/cmd/compile/internal/ssa/loopreschedchecks.go
+++ b/src/cmd/compile/internal/ssa/loopreschedchecks.go
@@ -246,7 +246,8 @@ func insertLoopReschedChecks(f *Func) {
// mem1 := call resched (mem0)
// goto header
resched := f.fe.Syslook("goschedguarded")
- mem1 := sched.NewValue1A(bb.Pos, OpStaticCall, types.TypeMem, StaticAuxCall(resched, nil, nil), mem0)
+ // TODO(register args) -- will need more details
+ mem1 := sched.NewValue1A(bb.Pos, OpStaticCall, types.TypeMem, StaticAuxCall(resched, nil, nil, nil), mem0)
sched.AddEdgeTo(h)
headerMemPhi.AddArg(mem1)
diff --git a/src/cmd/compile/internal/ssa/lower.go b/src/cmd/compile/internal/ssa/lower.go
index f332b2e028..bbb80a7a30 100644
--- a/src/cmd/compile/internal/ssa/lower.go
+++ b/src/cmd/compile/internal/ssa/lower.go
@@ -21,8 +21,12 @@ func checkLower(f *Func) {
continue // lowered
}
switch v.Op {
- case OpSP, OpSB, OpInitMem, OpArg, OpPhi, OpVarDef, OpVarKill, OpVarLive, OpKeepAlive, OpSelect0, OpSelect1, OpConvert, OpInlMark:
+ case OpSP, OpSB, OpInitMem, OpArg, OpArgIntReg, OpArgFloatReg, OpPhi, OpVarDef, OpVarKill, OpVarLive, OpKeepAlive, OpSelect0, OpSelect1, OpSelectN, OpConvert, OpInlMark:
continue // ok not to lower
+ case OpMakeResult:
+ if len(b.Controls) == 1 && b.Controls[0] == v {
+ continue
+ }
case OpGetG:
if f.Config.hasGReg {
// has hardware g register, regalloc takes care of it
diff --git a/src/cmd/compile/internal/ssa/numberlines.go b/src/cmd/compile/internal/ssa/numberlines.go
index 2a9c8e4f32..54a158ff87 100644
--- a/src/cmd/compile/internal/ssa/numberlines.go
+++ b/src/cmd/compile/internal/ssa/numberlines.go
@@ -16,7 +16,7 @@ func isPoorStatementOp(op Op) bool {
// so that a debugger-user sees the stop before the panic, and can examine the value.
case OpAddr, OpLocalAddr, OpOffPtr, OpStructSelect, OpPhi, OpITab, OpIData,
OpIMake, OpStringMake, OpSliceMake, OpStructMake0, OpStructMake1, OpStructMake2, OpStructMake3, OpStructMake4,
- OpConstBool, OpConst8, OpConst16, OpConst32, OpConst64, OpConst32F, OpConst64F:
+ OpConstBool, OpConst8, OpConst16, OpConst32, OpConst64, OpConst32F, OpConst64F, OpSB, OpSP:
return true
}
return false
diff --git a/src/cmd/compile/internal/ssa/op.go b/src/cmd/compile/internal/ssa/op.go
index c64b145107..0bc7b0ca0d 100644
--- a/src/cmd/compile/internal/ssa/op.go
+++ b/src/cmd/compile/internal/ssa/op.go
@@ -5,6 +5,7 @@
package ssa
import (
+ "cmd/compile/internal/abi"
"cmd/compile/internal/ir"
"cmd/compile/internal/types"
"cmd/internal/obj"
@@ -71,47 +72,63 @@ type auxType int8
type Param struct {
Type *types.Type
- Offset int32 // Offset of Param if not in a register.
+ Offset int32 // Offset of Param if not in a register, spill offset if it is in a register input, types.BADWIDTH if it is a register output.
+ Reg []abi.RegIndex
Name *ir.Name // For OwnAux, need to prepend stores with Vardefs
}
+type AuxNameOffset struct {
+ Name *ir.Name
+ Offset int64
+}
+
+func (a *AuxNameOffset) CanBeAnSSAAux() {}
+func (a *AuxNameOffset) String() string {
+ return fmt.Sprintf("%s+%d", a.Name.Sym().Name, a.Offset)
+}
+
type AuxCall struct {
+ // TODO(register args) this information is largely redundant with ../abi information, needs cleanup once new ABI is in place.
Fn *obj.LSym
args []Param // Includes receiver for method calls. Does NOT include hidden closure pointer.
results []Param
-}
-
-// ResultForOffset returns the index of the result at a particular offset among the results
-// This does not include the mem result for the call opcode.
-func (a *AuxCall) ResultForOffset(offset int64) int64 {
- which := int64(-1)
- for i := int64(0); i < a.NResults(); i++ { // note aux NResults does not include mem result.
- if a.OffsetOfResult(i) == offset {
- which = i
- break
- }
- }
- return which
+ reg *regInfo // regInfo for this call // TODO for now nil means ignore
+ abiInfo *abi.ABIParamResultInfo // TODO remove fields above redundant with this information.
}
// OffsetOfResult returns the SP offset of result which (indexed 0, 1, etc).
func (a *AuxCall) OffsetOfResult(which int64) int64 {
- return int64(a.results[which].Offset)
+ n := int64(a.abiInfo.OutParam(int(which)).Offset())
+ return n
}
// OffsetOfArg returns the SP offset of argument which (indexed 0, 1, etc).
+// If the call is to a method, the receiver is the first argument (i.e., index 0)
func (a *AuxCall) OffsetOfArg(which int64) int64 {
- return int64(a.args[which].Offset)
+ n := int64(a.abiInfo.InParam(int(which)).Offset())
+ return n
+}
+
+// RegsOfResult returns the register(s) used for result which (indexed 0, 1, etc).
+func (a *AuxCall) RegsOfResult(which int64) []abi.RegIndex {
+ return a.abiInfo.OutParam(int(which)).Registers
+}
+
+// RegsOfArg returns the register(s) used for argument which (indexed 0, 1, etc).
+// If the call is to a method, the receiver is the first argument (i.e., index 0)
+func (a *AuxCall) RegsOfArg(which int64) []abi.RegIndex {
+ return a.abiInfo.InParam(int(which)).Registers
}
// TypeOfResult returns the type of result which (indexed 0, 1, etc).
func (a *AuxCall) TypeOfResult(which int64) *types.Type {
- return a.results[which].Type
+ return a.abiInfo.OutParam(int(which)).Type
}
// TypeOfArg returns the type of argument which (indexed 0, 1, etc).
+// If the call is to a method, the receiver is the first argument (i.e., index 0)
func (a *AuxCall) TypeOfArg(which int64) *types.Type {
- return a.args[which].Type
+ return a.abiInfo.InParam(int(which)).Type
}
// SizeOfResult returns the size of result which (indexed 0, 1, etc).
@@ -120,13 +137,14 @@ func (a *AuxCall) SizeOfResult(which int64) int64 {
}
// SizeOfArg returns the size of argument which (indexed 0, 1, etc).
+// If the call is to a method, the receiver is the first argument (i.e., index 0)
func (a *AuxCall) SizeOfArg(which int64) int64 {
return a.TypeOfArg(which).Width
}
// NResults returns the number of results
func (a *AuxCall) NResults() int64 {
- return int64(len(a.results))
+ return int64(len(a.abiInfo.OutParams()))
}
// LateExpansionResultType returns the result type (including trailing mem)
@@ -140,9 +158,9 @@ func (a *AuxCall) LateExpansionResultType() *types.Type {
return types.NewResults(tys)
}
-// NArgs returns the number of arguments
+// NArgs returns the number of arguments (including receiver, if there is one).
func (a *AuxCall) NArgs() int64 {
- return int64(len(a.args))
+ return int64(len(a.abiInfo.InParams()))
}
// String returns
@@ -184,50 +202,65 @@ func (a *AuxCall) String() string {
return fn + "}"
}
+// ACParamsToTypes translates a slice of Param into a slice of *types.Type
+// This is a helper call for ssagen/ssa.go.
+// TODO remove this, as part of replacing fields of AuxCall with abi.ABIParamResultInfo.
+func ACParamsToTypes(ps []Param) (ts []*types.Type) {
+ for _, p := range ps {
+ ts = append(ts, p.Type)
+ }
+ return
+}
+
// StaticAuxCall returns an AuxCall for a static call.
-func StaticAuxCall(sym *obj.LSym, args []Param, results []Param) *AuxCall {
- return &AuxCall{Fn: sym, args: args, results: results}
+func StaticAuxCall(sym *obj.LSym, args []Param, results []Param, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
+ if paramResultInfo == nil {
+ panic(fmt.Errorf("Nil paramResultInfo, sym=%v", sym))
+ }
+ return &AuxCall{Fn: sym, args: args, results: results, abiInfo: paramResultInfo}
}
// InterfaceAuxCall returns an AuxCall for an interface call.
-func InterfaceAuxCall(args []Param, results []Param) *AuxCall {
- return &AuxCall{Fn: nil, args: args, results: results}
+func InterfaceAuxCall(args []Param, results []Param, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
+ return &AuxCall{Fn: nil, args: args, results: results, abiInfo: paramResultInfo}
}
// ClosureAuxCall returns an AuxCall for a closure call.
-func ClosureAuxCall(args []Param, results []Param) *AuxCall {
- return &AuxCall{Fn: nil, args: args, results: results}
+func ClosureAuxCall(args []Param, results []Param, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
+ return &AuxCall{Fn: nil, args: args, results: results, abiInfo: paramResultInfo}
}
func (*AuxCall) CanBeAnSSAAux() {}
// OwnAuxCall returns a function's own AuxCall
-func OwnAuxCall(args []Param, results []Param) *AuxCall {
+
+func OwnAuxCall(fn *obj.LSym, args []Param, results []Param, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
// TODO if this remains identical to ClosureAuxCall above after new ABI is done, should deduplicate.
- return &AuxCall{Fn: nil, args: args, results: results}
+ return &AuxCall{Fn: fn, args: args, results: results, abiInfo: paramResultInfo}
}
const (
- auxNone auxType = iota
- auxBool // auxInt is 0/1 for false/true
- auxInt8 // auxInt is an 8-bit integer
- auxInt16 // auxInt is a 16-bit integer
- auxInt32 // auxInt is a 32-bit integer
- auxInt64 // auxInt is a 64-bit integer
- auxInt128 // auxInt represents a 128-bit integer. Always 0.
- auxUInt8 // auxInt is an 8-bit unsigned integer
- auxFloat32 // auxInt is a float32 (encoded with math.Float64bits)
- auxFloat64 // auxInt is a float64 (encoded with math.Float64bits)
- auxFlagConstant // auxInt is a flagConstant
- auxString // aux is a string
- auxSym // aux is a symbol (a *gc.Node for locals, an *obj.LSym for globals, or nil for none)
- auxSymOff // aux is a symbol, auxInt is an offset
- auxSymValAndOff // aux is a symbol, auxInt is a ValAndOff
- auxTyp // aux is a type
- auxTypSize // aux is a type, auxInt is a size, must have Aux.(Type).Size() == AuxInt
- auxCCop // aux is a ssa.Op that represents a flags-to-bool conversion (e.g. LessThan)
- auxCall // aux is a *ssa.AuxCall
- auxCallOff // aux is a *ssa.AuxCall, AuxInt is int64 param (in+out) size
+ auxNone auxType = iota
+ auxBool // auxInt is 0/1 for false/true
+ auxInt8 // auxInt is an 8-bit integer
+ auxInt16 // auxInt is a 16-bit integer
+ auxInt32 // auxInt is a 32-bit integer
+ auxInt64 // auxInt is a 64-bit integer
+ auxInt128 // auxInt represents a 128-bit integer. Always 0.
+ auxUInt8 // auxInt is an 8-bit unsigned integer
+ auxFloat32 // auxInt is a float32 (encoded with math.Float64bits)
+ auxFloat64 // auxInt is a float64 (encoded with math.Float64bits)
+ auxFlagConstant // auxInt is a flagConstant
+ auxNameOffsetInt8 // aux is a &struct{Name ir.Name, Offset int64}; auxInt is index in parameter registers array
+ auxString // aux is a string
+ auxSym // aux is a symbol (a *gc.Node for locals, an *obj.LSym for globals, or nil for none)
+ auxSymOff // aux is a symbol, auxInt is an offset
+ auxSymValAndOff // aux is a symbol, auxInt is a ValAndOff
+ auxTyp // aux is a type
+ auxTypSize // aux is a type, auxInt is a size, must have Aux.(Type).Size() == AuxInt
+ auxCCop // aux is a ssa.Op that represents a flags-to-bool conversion (e.g. LessThan)
+ auxCall // aux is a *ssa.AuxCall
+ auxCallOff // aux is a *ssa.AuxCall, AuxInt is int64 param (in+out) size
// architecture specific aux types
auxARM64BitField // aux is an arm64 bitfield lsb and width packed into auxInt
diff --git a/src/cmd/compile/internal/ssa/opGen.go b/src/cmd/compile/internal/ssa/opGen.go
index e590f6ba5d..a9565ffe4b 100644
--- a/src/cmd/compile/internal/ssa/opGen.go
+++ b/src/cmd/compile/internal/ssa/opGen.go
@@ -432,6 +432,7 @@ const (
Op386BSRW
Op386BSWAPL
Op386SQRTSD
+ Op386SQRTSS
Op386SBBLcarrymask
Op386SETEQ
Op386SETNE
@@ -888,6 +889,7 @@ const (
OpAMD64POPCNTQ
OpAMD64POPCNTL
OpAMD64SQRTSD
+ OpAMD64SQRTSS
OpAMD64ROUNDSD
OpAMD64VFMADD231SD
OpAMD64SBBQcarrymask
@@ -970,6 +972,7 @@ const (
OpAMD64MOVQstore
OpAMD64MOVOload
OpAMD64MOVOstore
+ OpAMD64MOVOstorezero
OpAMD64MOVBloadidx1
OpAMD64MOVWloadidx1
OpAMD64MOVWloadidx2
@@ -998,7 +1001,6 @@ const (
OpAMD64MOVQstoreconstidx1
OpAMD64MOVQstoreconstidx8
OpAMD64DUFFZERO
- OpAMD64MOVOconst
OpAMD64REPSTOSQ
OpAMD64CALLstatic
OpAMD64CALLclosure
@@ -1090,6 +1092,7 @@ const (
OpARMNEGF
OpARMNEGD
OpARMSQRTD
+ OpARMSQRTF
OpARMABSD
OpARMCLZ
OpARMREV
@@ -1358,6 +1361,7 @@ const (
OpARM64FNEGS
OpARM64FNEGD
OpARM64FSQRTD
+ OpARM64FSQRTS
OpARM64REV
OpARM64REVW
OpARM64REV16W
@@ -1481,6 +1485,8 @@ const (
OpARM64MOVWloadidx4
OpARM64MOVWUloadidx4
OpARM64MOVDloadidx8
+ OpARM64FMOVSloadidx4
+ OpARM64FMOVDloadidx8
OpARM64MOVBstore
OpARM64MOVHstore
OpARM64MOVWstore
@@ -1497,6 +1503,8 @@ const (
OpARM64MOVHstoreidx2
OpARM64MOVWstoreidx4
OpARM64MOVDstoreidx8
+ OpARM64FMOVSstoreidx4
+ OpARM64FMOVDstoreidx8
OpARM64MOVBstorezero
OpARM64MOVHstorezero
OpARM64MOVWstorezero
@@ -1637,6 +1645,7 @@ const (
OpMIPSNEGF
OpMIPSNEGD
OpMIPSSQRTD
+ OpMIPSSQRTF
OpMIPSSLL
OpMIPSSLLconst
OpMIPSSRL
@@ -1747,6 +1756,7 @@ const (
OpMIPS64NEGF
OpMIPS64NEGD
OpMIPS64SQRTD
+ OpMIPS64SQRTF
OpMIPS64SLLV
OpMIPS64SLLVconst
OpMIPS64SRLV
@@ -2139,6 +2149,8 @@ const (
OpRISCV64LoweredAtomicAdd64
OpRISCV64LoweredAtomicCas32
OpRISCV64LoweredAtomicCas64
+ OpRISCV64LoweredAtomicAnd32
+ OpRISCV64LoweredAtomicOr32
OpRISCV64LoweredNilCheck
OpRISCV64LoweredGetClosurePtr
OpRISCV64LoweredGetCallerSP
@@ -2297,6 +2309,7 @@ const (
OpS390XNOT
OpS390XNOTW
OpS390XFSQRT
+ OpS390XFSQRTS
OpS390XLOCGR
OpS390XMOVBreg
OpS390XMOVBZreg
@@ -2723,6 +2736,7 @@ const (
OpRotateLeft32
OpRotateLeft64
OpSqrt
+ OpSqrt32
OpFloor
OpCeil
OpTrunc
@@ -2747,6 +2761,8 @@ const (
OpConstSlice
OpInitMem
OpArg
+ OpArgIntReg
+ OpArgFloatReg
OpAddr
OpLocalAddr
OpSP
@@ -2912,7 +2928,6 @@ var opcodeTable = [...]opInfo{
argLen: 2,
commutative: true,
resultInArg0: true,
- usesScratch: true,
asm: x86.AADDSS,
reg: regInfo{
inputs: []inputInfo{
@@ -2944,7 +2959,6 @@ var opcodeTable = [...]opInfo{
name: "SUBSS",
argLen: 2,
resultInArg0: true,
- usesScratch: true,
asm: x86.ASUBSS,
reg: regInfo{
inputs: []inputInfo{
@@ -2976,7 +2990,6 @@ var opcodeTable = [...]opInfo{
argLen: 2,
commutative: true,
resultInArg0: true,
- usesScratch: true,
asm: x86.AMULSS,
reg: regInfo{
inputs: []inputInfo{
@@ -3008,7 +3021,6 @@ var opcodeTable = [...]opInfo{
name: "DIVSS",
argLen: 2,
resultInArg0: true,
- usesScratch: true,
asm: x86.ADIVSS,
reg: regInfo{
inputs: []inputInfo{
@@ -4072,10 +4084,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "UCOMISS",
- argLen: 2,
- usesScratch: true,
- asm: x86.AUCOMISS,
+ name: "UCOMISS",
+ argLen: 2,
+ asm: x86.AUCOMISS,
reg: regInfo{
inputs: []inputInfo{
{0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
@@ -4084,10 +4095,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "UCOMISD",
- argLen: 2,
- usesScratch: true,
- asm: x86.AUCOMISD,
+ name: "UCOMISD",
+ argLen: 2,
+ asm: x86.AUCOMISD,
reg: regInfo{
inputs: []inputInfo{
{0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
@@ -4779,6 +4789,19 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "SQRTSS",
+ argLen: 1,
+ asm: x86.ASQRTSS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
+ },
+ outputs: []outputInfo{
+ {0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
+ },
+ },
+ },
+ {
name: "SBBLcarrymask",
argLen: 1,
asm: x86.ASBBL,
@@ -5027,10 +5050,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "CVTTSD2SL",
- argLen: 1,
- usesScratch: true,
- asm: x86.ACVTTSD2SL,
+ name: "CVTTSD2SL",
+ argLen: 1,
+ asm: x86.ACVTTSD2SL,
reg: regInfo{
inputs: []inputInfo{
{0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
@@ -5041,10 +5063,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "CVTTSS2SL",
- argLen: 1,
- usesScratch: true,
- asm: x86.ACVTTSS2SL,
+ name: "CVTTSS2SL",
+ argLen: 1,
+ asm: x86.ACVTTSS2SL,
reg: regInfo{
inputs: []inputInfo{
{0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
@@ -5055,10 +5076,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "CVTSL2SS",
- argLen: 1,
- usesScratch: true,
- asm: x86.ACVTSL2SS,
+ name: "CVTSL2SS",
+ argLen: 1,
+ asm: x86.ACVTSL2SS,
reg: regInfo{
inputs: []inputInfo{
{0, 239}, // AX CX DX BX BP SI DI
@@ -5069,10 +5089,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "CVTSL2SD",
- argLen: 1,
- usesScratch: true,
- asm: x86.ACVTSL2SD,
+ name: "CVTSL2SD",
+ argLen: 1,
+ asm: x86.ACVTSL2SD,
reg: regInfo{
inputs: []inputInfo{
{0, 239}, // AX CX DX BX BP SI DI
@@ -5083,10 +5102,9 @@ var opcodeTable = [...]opInfo{
},
},
{
- name: "CVTSD2SS",
- argLen: 1,
- usesScratch: true,
- asm: x86.ACVTSD2SS,
+ name: "CVTSD2SS",
+ argLen: 1,
+ asm: x86.ACVTSD2SS,
reg: regInfo{
inputs: []inputInfo{
{0, 65280}, // X0 X1 X2 X3 X4 X5 X6 X7
@@ -6162,11 +6180,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6178,11 +6196,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6193,11 +6211,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6208,11 +6226,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6224,11 +6242,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AMULSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6240,11 +6258,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AMULSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6255,11 +6273,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ADIVSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6270,11 +6288,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ADIVSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6287,10 +6305,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6303,10 +6321,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6318,7 +6336,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVSS,
reg: regInfo{
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6330,7 +6348,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVSD,
reg: regInfo{
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6343,11 +6361,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6360,11 +6378,11 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6377,11 +6395,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6394,11 +6412,11 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6411,8 +6429,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVSS,
reg: regInfo{
inputs: []inputInfo{
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -6425,8 +6443,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVSD,
reg: regInfo{
inputs: []inputInfo{
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -6439,9 +6457,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -6454,9 +6472,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -6469,9 +6487,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -6484,9 +6502,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -6500,11 +6518,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6518,11 +6536,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6536,11 +6554,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6554,11 +6572,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6572,11 +6590,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AMULSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6590,11 +6608,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AMULSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6608,11 +6626,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ADIVSS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6626,11 +6644,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ADIVSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6644,12 +6662,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6663,12 +6681,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6682,12 +6700,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6701,12 +6719,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6720,12 +6738,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6739,12 +6757,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6758,12 +6776,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6777,12 +6795,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6796,12 +6814,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6815,12 +6833,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6834,12 +6852,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6853,12 +6871,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6872,12 +6890,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6891,12 +6909,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6910,12 +6928,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6929,12 +6947,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
- {2, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -6946,11 +6964,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -6962,11 +6980,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -6978,10 +6996,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -6993,10 +7011,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7010,7 +7028,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7024,7 +7042,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7036,11 +7054,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7052,11 +7070,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7069,10 +7087,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7085,10 +7103,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7101,11 +7119,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AIMULQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7118,11 +7136,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AIMULL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7134,10 +7152,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AIMUL3Q,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7149,10 +7167,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AIMUL3L,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7165,7 +7183,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 4, // DX
outputs: []outputInfo{
@@ -7183,7 +7201,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 4, // DX
outputs: []outputInfo{
@@ -7200,7 +7218,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
@@ -7216,7 +7234,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
@@ -7232,7 +7250,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
@@ -7248,7 +7266,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
@@ -7264,11 +7282,11 @@ var opcodeTable = [...]opInfo{
clobberFlags: true,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7281,7 +7299,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7298,7 +7316,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7315,7 +7333,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7331,7 +7349,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7347,7 +7365,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7363,7 +7381,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65531}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49147}, // AX CX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7378,11 +7396,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ANEGL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7394,12 +7412,12 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7411,12 +7429,12 @@ var opcodeTable = [...]opInfo{
asm: x86.AADCQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7428,11 +7446,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7444,11 +7462,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADCQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7459,12 +7477,12 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7475,12 +7493,12 @@ var opcodeTable = [...]opInfo{
asm: x86.ASBBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7492,11 +7510,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7508,11 +7526,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASBBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7525,7 +7543,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{0, 1}, // AX
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 4}, // DX
@@ -7542,7 +7560,7 @@ var opcodeTable = [...]opInfo{
inputs: []inputInfo{
{0, 4}, // DX
{1, 1}, // AX
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{0, 1}, // AX
@@ -7559,11 +7577,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7576,11 +7594,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7593,10 +7611,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7609,10 +7627,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7626,7 +7644,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7640,7 +7658,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7653,11 +7671,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7670,11 +7688,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7687,10 +7705,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7703,10 +7721,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7720,7 +7738,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7734,7 +7752,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7747,11 +7765,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7764,11 +7782,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7781,10 +7799,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7797,10 +7815,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7814,7 +7832,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7828,7 +7846,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7838,8 +7856,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7849,8 +7867,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7860,8 +7878,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7871,8 +7889,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7883,7 +7901,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7894,7 +7912,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7905,7 +7923,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7916,7 +7934,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -7929,8 +7947,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7943,8 +7961,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7957,8 +7975,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPW,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7971,8 +7989,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPB,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7985,7 +8003,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -7998,7 +8016,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8011,7 +8029,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPW,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8024,7 +8042,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMPB,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8037,9 +8055,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8053,9 +8071,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8068,9 +8086,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8084,9 +8102,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8099,9 +8117,9 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8115,9 +8133,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8131,9 +8149,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8146,8 +8164,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8161,8 +8179,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8175,8 +8193,8 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8190,8 +8208,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8204,8 +8222,8 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8219,8 +8237,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8234,8 +8252,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8245,8 +8263,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AUCOMISS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -8256,8 +8274,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AUCOMISD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -8267,8 +8285,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8278,8 +8296,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8291,11 +8309,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8307,11 +8325,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8323,11 +8341,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8339,11 +8357,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8355,11 +8373,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8371,11 +8389,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8386,7 +8404,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8397,7 +8415,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8410,10 +8428,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8426,10 +8444,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8442,10 +8460,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8458,10 +8476,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8474,10 +8492,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8490,10 +8508,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8507,8 +8525,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8522,8 +8540,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8537,8 +8555,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8552,8 +8570,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8567,8 +8585,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8582,8 +8600,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8597,7 +8615,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8611,7 +8629,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTCL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8625,7 +8643,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8639,7 +8657,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTSL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8653,7 +8671,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8667,7 +8685,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ABTRL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -8678,8 +8696,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8690,8 +8708,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8702,8 +8720,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8714,8 +8732,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8726,7 +8744,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8737,7 +8755,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8748,7 +8766,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8759,7 +8777,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ATESTB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8772,10 +8790,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8788,10 +8806,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8804,10 +8822,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASHLQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8820,10 +8838,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASHLL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8836,10 +8854,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8852,10 +8870,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8868,10 +8886,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8884,10 +8902,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8900,10 +8918,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASHRQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8916,10 +8934,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASHRL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8932,10 +8950,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASHRW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8948,10 +8966,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASHRB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8964,10 +8982,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8980,10 +8998,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -8996,10 +9014,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9012,10 +9030,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9028,10 +9046,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASARQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9044,10 +9062,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASARL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9060,10 +9078,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASARW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9076,10 +9094,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ASARB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9092,10 +9110,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9108,10 +9126,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9124,10 +9142,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9140,10 +9158,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9156,10 +9174,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9172,10 +9190,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9188,10 +9206,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9204,10 +9222,10 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 2}, // CX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9220,10 +9238,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AROLQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9236,10 +9254,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AROLL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9252,10 +9270,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AROLW,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9268,10 +9286,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AROLB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9286,11 +9304,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9305,11 +9323,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9324,11 +9342,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9343,11 +9361,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9362,11 +9380,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9381,11 +9399,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9400,11 +9418,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9419,11 +9437,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9438,11 +9456,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9457,11 +9475,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9476,12 +9494,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9496,12 +9514,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9516,12 +9534,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9536,12 +9554,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9556,12 +9574,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9576,12 +9594,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9596,12 +9614,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9616,12 +9634,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9636,12 +9654,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9656,12 +9674,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9676,12 +9694,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9696,12 +9714,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9716,12 +9734,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9736,12 +9754,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9756,12 +9774,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9776,12 +9794,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9796,12 +9814,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9816,12 +9834,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9836,12 +9854,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9856,12 +9874,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9876,12 +9894,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9896,12 +9914,12 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9916,12 +9934,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9936,12 +9954,12 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9956,12 +9974,12 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -9975,8 +9993,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -9990,8 +10008,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10005,8 +10023,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10020,8 +10038,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AORQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10035,8 +10053,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10050,8 +10068,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AADDL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10065,8 +10083,8 @@ var opcodeTable = [...]opInfo{
asm: x86.ASUBL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10080,8 +10098,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10095,8 +10113,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AORL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10110,8 +10128,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AXORL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10125,9 +10143,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10141,9 +10159,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10157,9 +10175,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10173,9 +10191,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10189,9 +10207,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10205,9 +10223,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10221,9 +10239,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10237,9 +10255,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10253,9 +10271,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10269,9 +10287,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10285,9 +10303,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10301,9 +10319,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10317,9 +10335,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10333,9 +10351,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10349,9 +10367,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10365,9 +10383,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10381,9 +10399,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10397,9 +10415,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10413,9 +10431,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10429,9 +10447,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10445,9 +10463,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10461,9 +10479,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10477,9 +10495,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10493,9 +10511,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10509,9 +10527,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10525,8 +10543,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10540,8 +10558,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10555,8 +10573,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10570,8 +10588,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10585,8 +10603,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10600,8 +10618,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10615,8 +10633,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10630,8 +10648,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10645,8 +10663,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10660,8 +10678,8 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10675,8 +10693,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10690,8 +10708,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10705,8 +10723,8 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10720,8 +10738,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10735,8 +10753,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10750,8 +10768,8 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10765,8 +10783,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10780,8 +10798,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10795,8 +10813,8 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10810,8 +10828,8 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -10823,10 +10841,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ANEGQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10838,10 +10856,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ANEGL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10853,10 +10871,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ANOTQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10868,10 +10886,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ANOTL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10881,11 +10899,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABSFQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10896,10 +10914,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABSFL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10909,11 +10927,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ABSRQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10924,10 +10942,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABSRL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10938,11 +10956,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQEQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10953,11 +10971,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10968,11 +10986,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQLT,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10983,11 +11001,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQGT,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -10998,11 +11016,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQLE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11013,11 +11031,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQGE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11028,11 +11046,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQLS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11043,11 +11061,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11058,11 +11076,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11073,11 +11091,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQCS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11088,11 +11106,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLEQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11103,11 +11121,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11118,11 +11136,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLLT,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11133,11 +11151,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLGT,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11148,11 +11166,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLLE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11163,11 +11181,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLGE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11178,11 +11196,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLLS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11193,11 +11211,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11208,11 +11226,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11223,11 +11241,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLCS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11238,11 +11256,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWEQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11253,11 +11271,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11268,11 +11286,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWLT,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11283,11 +11301,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWGT,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11298,11 +11316,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWLE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11313,11 +11331,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWGE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11328,11 +11346,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWLS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11343,11 +11361,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11358,11 +11376,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11373,11 +11391,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWCS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11388,12 +11406,12 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11404,11 +11422,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11419,11 +11437,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11434,11 +11452,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVQCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11449,12 +11467,12 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11465,11 +11483,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11480,11 +11498,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11495,11 +11513,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVLCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11510,12 +11528,12 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11526,11 +11544,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11541,11 +11559,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11556,11 +11574,11 @@ var opcodeTable = [...]opInfo{
asm: x86.ACMOVWCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11572,10 +11590,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABSWAPQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11587,10 +11605,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ABSWAPL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11601,10 +11619,10 @@ var opcodeTable = [...]opInfo{
asm: x86.APOPCNTQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11615,10 +11633,10 @@ var opcodeTable = [...]opInfo{
asm: x86.APOPCNTL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11628,10 +11646,23 @@ var opcodeTable = [...]opInfo{
asm: x86.ASQRTSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ },
+ },
+ },
+ {
+ name: "SQRTSS",
+ argLen: 1,
+ asm: x86.ASQRTSS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ },
+ outputs: []outputInfo{
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -11642,10 +11673,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AROUNDSD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -11656,12 +11687,12 @@ var opcodeTable = [...]opInfo{
asm: x86.AVFMADD231SD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {2, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {2, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -11671,7 +11702,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASBBQ,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11681,7 +11712,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASBBL,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11691,7 +11722,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETEQ,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11701,7 +11732,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETNE,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11711,7 +11742,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETLT,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11721,7 +11752,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETLE,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11731,7 +11762,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETGT,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11741,7 +11772,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETGE,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11751,7 +11782,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETCS,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11761,7 +11792,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETLS,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11771,7 +11802,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETHI,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11781,7 +11812,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETCC,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11791,7 +11822,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETOS,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11804,7 +11835,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETEQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11817,7 +11848,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETNE,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11830,7 +11861,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETLT,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11843,7 +11874,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETLE,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11856,7 +11887,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETGT,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11869,7 +11900,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETGE,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11882,7 +11913,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETCS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11895,7 +11926,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETLS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11908,7 +11939,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETHI,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11921,7 +11952,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETCC,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -11933,7 +11964,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
clobbers: 1, // AX
outputs: []outputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11945,7 +11976,7 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
clobbers: 1, // AX
outputs: []outputInfo{
- {0, 65518}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49134}, // CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11955,7 +11986,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETPC,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11965,7 +11996,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETPS,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11975,7 +12006,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETHI,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11985,7 +12016,7 @@ var opcodeTable = [...]opInfo{
asm: x86.ASETCC,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -11995,10 +12026,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVBQSX,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12008,10 +12039,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVBLZX,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12021,10 +12052,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVWQSX,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12034,10 +12065,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVWLZX,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12047,10 +12078,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVLQSX,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12060,10 +12091,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12075,7 +12106,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVL,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12087,7 +12118,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVQ,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12097,10 +12128,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTTSD2SL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12110,10 +12141,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTTSD2SQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12123,10 +12154,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTTSS2SL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12136,10 +12167,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTTSS2SQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12149,10 +12180,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTSL2SS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12162,10 +12193,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTSL2SD,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12175,10 +12206,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTSQ2SS,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12188,10 +12219,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTSQ2SD,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12201,10 +12232,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTSD2SS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12214,10 +12245,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ACVTSS2SD,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12226,10 +12257,10 @@ var opcodeTable = [...]opInfo{
argLen: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12238,10 +12269,10 @@ var opcodeTable = [...]opInfo{
argLen: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12250,10 +12281,10 @@ var opcodeTable = [...]opInfo{
argLen: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12262,10 +12293,10 @@ var opcodeTable = [...]opInfo{
argLen: 1,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12277,11 +12308,11 @@ var opcodeTable = [...]opInfo{
asm: x86.APXOR,
reg: regInfo{
inputs: []inputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12294,10 +12325,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ALEAQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12310,10 +12341,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ALEAL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12326,10 +12357,10 @@ var opcodeTable = [...]opInfo{
asm: x86.ALEAW,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12343,11 +12374,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12361,11 +12392,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12379,11 +12410,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12396,11 +12427,11 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12413,11 +12444,11 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12430,11 +12461,11 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12447,11 +12478,11 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12464,11 +12495,11 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12481,11 +12512,11 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12498,11 +12529,11 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12515,11 +12546,11 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12532,11 +12563,11 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12549,10 +12580,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVBLZX,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12565,10 +12596,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVBQSX,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12581,10 +12612,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVWLZX,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12597,10 +12628,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVWQSX,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12613,10 +12644,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12629,10 +12660,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVLQSX,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12645,10 +12676,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12661,8 +12692,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVB,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12675,8 +12706,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVW,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12689,8 +12720,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12703,8 +12734,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVQ,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12717,10 +12748,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVUPS,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ {0, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
},
@@ -12733,8 +12764,21 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVUPS,
reg: regInfo{
inputs: []inputInfo{
- {1, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 2147418112}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
+ },
+ },
+ },
+ {
+ name: "MOVOstorezero",
+ auxType: auxSymOff,
+ argLen: 2,
+ faultOnNilArg0: true,
+ symEffect: SymWrite,
+ asm: x86.AMOVUPS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 4295016447}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15 SB
},
},
},
@@ -12748,11 +12792,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12766,11 +12810,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12783,11 +12827,11 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12801,11 +12845,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12818,11 +12862,11 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12835,11 +12879,11 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12853,11 +12897,11 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12870,11 +12914,11 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -12888,9 +12932,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12904,9 +12948,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12919,9 +12963,9 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12935,9 +12979,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12950,9 +12994,9 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12965,9 +13009,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12981,9 +13025,9 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -12996,9 +13040,9 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13011,7 +13055,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVB,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13024,7 +13068,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVW,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13037,7 +13081,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13050,7 +13094,7 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13064,8 +13108,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13079,8 +13123,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13093,8 +13137,8 @@ var opcodeTable = [...]opInfo{
scale: 2,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13108,8 +13152,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13122,8 +13166,8 @@ var opcodeTable = [...]opInfo{
scale: 4,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13137,8 +13181,8 @@ var opcodeTable = [...]opInfo{
scale: 1,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13151,37 +13195,25 @@ var opcodeTable = [...]opInfo{
scale: 8,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
{
name: "DUFFZERO",
auxType: auxInt64,
- argLen: 3,
+ argLen: 2,
faultOnNilArg0: true,
unsafePoint: true,
reg: regInfo{
inputs: []inputInfo{
- {0, 128}, // DI
- {1, 65536}, // X0
+ {0, 128}, // DI
},
clobbers: 128, // DI
},
},
{
- name: "MOVOconst",
- auxType: auxInt128,
- argLen: 0,
- rematerializeable: true,
- reg: regInfo{
- outputs: []outputInfo{
- {0, 4294901760}, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
- },
- },
- },
- {
name: "REPSTOSQ",
argLen: 4,
faultOnNilArg0: true,
@@ -13201,7 +13233,7 @@ var opcodeTable = [...]opInfo{
clobberFlags: true,
call: true,
reg: regInfo{
- clobbers: 4294967279, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 g R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
{
@@ -13213,9 +13245,9 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 4}, // DX
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
- clobbers: 4294967279, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 g R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
{
@@ -13226,9 +13258,9 @@ var opcodeTable = [...]opInfo{
call: true,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
- clobbers: 4294967279, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ clobbers: 2147483631, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 g R15 X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
{
@@ -13271,7 +13303,7 @@ var opcodeTable = [...]opInfo{
argLen: 1,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13291,7 +13323,7 @@ var opcodeTable = [...]opInfo{
rematerializeable: true,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13301,7 +13333,7 @@ var opcodeTable = [...]opInfo{
rematerializeable: true,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13313,7 +13345,7 @@ var opcodeTable = [...]opInfo{
faultOnNilArg0: true,
reg: regInfo{
inputs: []inputInfo{
- {0, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13328,7 +13360,7 @@ var opcodeTable = [...]opInfo{
{0, 128}, // DI
{1, 879}, // AX CX DX BX BP SI R8 R9
},
- clobbers: 4294901760, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15
+ clobbers: 2147418112, // X0 X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
},
},
{
@@ -13339,7 +13371,7 @@ var opcodeTable = [...]opInfo{
symEffect: SymNone,
reg: regInfo{
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13413,10 +13445,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVB,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13429,10 +13461,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVL,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13445,10 +13477,10 @@ var opcodeTable = [...]opInfo{
asm: x86.AMOVQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13463,11 +13495,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXCHGB,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13482,11 +13514,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXCHGL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13501,11 +13533,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXCHGQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13521,11 +13553,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXADDL,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13541,11 +13573,11 @@ var opcodeTable = [...]opInfo{
asm: x86.AXADDQ,
reg: regInfo{
inputs: []inputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {1, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
outputs: []outputInfo{
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13571,13 +13603,13 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 1}, // AX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13593,13 +13625,13 @@ var opcodeTable = [...]opInfo{
reg: regInfo{
inputs: []inputInfo{
{1, 1}, // AX
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {2, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {2, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
clobbers: 1, // AX
outputs: []outputInfo{
{1, 0},
- {0, 65519}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
+ {0, 49135}, // AX CX DX BX BP SI DI R8 R9 R10 R11 R12 R13 R15
},
},
},
@@ -13614,8 +13646,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDB,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13630,8 +13662,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AANDL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13646,8 +13678,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AORB,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -13662,8 +13694,8 @@ var opcodeTable = [...]opInfo{
asm: x86.AORL,
reg: regInfo{
inputs: []inputInfo{
- {1, 65535}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15
- {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R14 R15 SB
+ {1, 49151}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 R15
+ {0, 4295032831}, // AX CX DX BX SP BP SI DI R8 R9 R10 R11 R12 R13 g R15 SB
},
},
},
@@ -14429,6 +14461,19 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "SQRTF",
+ argLen: 1,
+ asm: arm.ASQRTF,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
+ },
+ outputs: []outputInfo{
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
+ },
+ },
+ },
+ {
name: "ABSD",
argLen: 1,
asm: arm.AABSD,
@@ -18091,6 +18136,19 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "FSQRTS",
+ argLen: 1,
+ asm: arm64.AFSQRTS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 9223372034707292160}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ outputs: []outputInfo{
+ {0, 9223372034707292160}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ },
+ },
+ {
name: "REV",
argLen: 1,
asm: arm64.AREV,
@@ -19796,6 +19854,34 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "FMOVSloadidx4",
+ argLen: 3,
+ asm: arm64.AFMOVS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {1, 805044223}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30
+ {0, 9223372038733561855}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30 SP SB
+ },
+ outputs: []outputInfo{
+ {0, 9223372034707292160}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ },
+ },
+ {
+ name: "FMOVDloadidx8",
+ argLen: 3,
+ asm: arm64.AFMOVD,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {1, 805044223}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30
+ {0, 9223372038733561855}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30 SP SB
+ },
+ outputs: []outputInfo{
+ {0, 9223372034707292160}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ },
+ },
+ {
name: "MOVBstore",
auxType: auxSymOff,
argLen: 3,
@@ -20003,6 +20089,30 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "FMOVSstoreidx4",
+ argLen: 4,
+ asm: arm64.AFMOVS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {1, 805044223}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30
+ {0, 9223372038733561855}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30 SP SB
+ {2, 9223372034707292160}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ },
+ },
+ {
+ name: "FMOVDstoreidx8",
+ argLen: 4,
+ asm: arm64.AFMOVD,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {1, 805044223}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30
+ {0, 9223372038733561855}, // R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 R16 R17 R19 R20 R21 R22 R23 R24 R25 R26 g R30 SP SB
+ {2, 9223372034707292160}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ },
+ },
+ {
name: "MOVBstorezero",
auxType: auxSymOff,
argLen: 2,
@@ -21832,6 +21942,19 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "SQRTF",
+ argLen: 1,
+ asm: mips.ASQRTF,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 35183835217920}, // F0 F2 F4 F6 F8 F10 F12 F14 F16 F18 F20 F22 F24 F26 F28 F30
+ },
+ outputs: []outputInfo{
+ {0, 35183835217920}, // F0 F2 F4 F6 F8 F10 F12 F14 F16 F18 F20 F22 F24 F26 F28 F30
+ },
+ },
+ },
+ {
name: "SLL",
argLen: 2,
asm: mips.ASLL,
@@ -23311,6 +23434,19 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "SQRTF",
+ argLen: 1,
+ asm: mips.ASQRTF,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 1152921504338411520}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ outputs: []outputInfo{
+ {0, 1152921504338411520}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ },
+ },
+ },
+ {
name: "SLLV",
argLen: 2,
asm: mips.ASLLV,
@@ -28589,6 +28725,32 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "LoweredAtomicAnd32",
+ argLen: 3,
+ faultOnNilArg0: true,
+ hasSideEffects: true,
+ asm: riscv.AAMOANDW,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {1, 1073741812}, // X3 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 g X28 X29 X30
+ {0, 9223372037928517622}, // SP X3 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 g X28 X29 X30 SB
+ },
+ },
+ },
+ {
+ name: "LoweredAtomicOr32",
+ argLen: 3,
+ faultOnNilArg0: true,
+ hasSideEffects: true,
+ asm: riscv.AAMOORW,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {1, 1073741812}, // X3 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 g X28 X29 X30
+ {0, 9223372037928517622}, // SP X3 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15 X16 X17 X18 X19 X20 X21 X22 X23 X24 X25 X26 g X28 X29 X30 SB
+ },
+ },
+ },
+ {
name: "LoweredNilCheck",
argLen: 2,
nilCheck: true,
@@ -30895,6 +31057,19 @@ var opcodeTable = [...]opInfo{
},
},
{
+ name: "FSQRTS",
+ argLen: 1,
+ asm: s390x.AFSQRTS,
+ reg: regInfo{
+ inputs: []inputInfo{
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
+ },
+ outputs: []outputInfo{
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
+ },
+ },
+ },
+ {
name: "LOCGR",
auxType: auxS390XCCMask,
argLen: 3,
@@ -33828,10 +34003,10 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Sqrt,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -33841,10 +34016,10 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Trunc,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -33854,10 +34029,10 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Ceil,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -33867,10 +34042,10 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Floor,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -33880,10 +34055,10 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Nearest,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -33893,10 +34068,10 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Abs,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -33906,11 +34081,11 @@ var opcodeTable = [...]opInfo{
asm: wasm.AF32Copysign,
reg: regInfo{
inputs: []inputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
- {1, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
+ {1, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
outputs: []outputInfo{
- {0, 281470681743360}, // F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28 F29 F30 F31
+ {0, 4294901760}, // F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
},
},
},
@@ -35129,6 +35304,11 @@ var opcodeTable = [...]opInfo{
generic: true,
},
{
+ name: "Sqrt32",
+ argLen: 1,
+ generic: true,
+ },
+ {
name: "Floor",
argLen: 1,
generic: true,
@@ -35264,6 +35444,20 @@ var opcodeTable = [...]opInfo{
generic: true,
},
{
+ name: "ArgIntReg",
+ auxType: auxNameOffsetInt8,
+ argLen: 0,
+ zeroWidth: true,
+ generic: true,
+ },
+ {
+ name: "ArgFloatReg",
+ auxType: auxNameOffsetInt8,
+ argLen: 0,
+ zeroWidth: true,
+ generic: true,
+ },
+ {
name: "Addr",
auxType: auxSym,
argLen: 1,
@@ -35373,7 +35567,7 @@ var opcodeTable = [...]opInfo{
{
name: "StaticCall",
auxType: auxCallOff,
- argLen: 1,
+ argLen: -1,
call: true,
generic: true,
},
@@ -36127,11 +36321,11 @@ var opcodeTable = [...]opInfo{
func (o Op) Asm() obj.As { return opcodeTable[o].asm }
func (o Op) Scale() int16 { return int16(opcodeTable[o].scale) }
func (o Op) String() string { return opcodeTable[o].name }
-func (o Op) UsesScratch() bool { return opcodeTable[o].usesScratch }
func (o Op) SymEffect() SymEffect { return opcodeTable[o].symEffect }
func (o Op) IsCall() bool { return opcodeTable[o].call }
func (o Op) HasSideEffects() bool { return opcodeTable[o].hasSideEffects }
func (o Op) UnsafePoint() bool { return opcodeTable[o].unsafePoint }
+func (o Op) ResultInArg0() bool { return opcodeTable[o].resultInArg0 }
var registers386 = [...]Register{
{0, x86.REG_AX, 0, "AX"},
@@ -36152,6 +36346,8 @@ var registers386 = [...]Register{
{15, x86.REG_X7, -1, "X7"},
{16, 0, -1, "SB"},
}
+var paramIntReg386 = []int8(nil)
+var paramFloatReg386 = []int8(nil)
var gpRegMask386 = regMask(239)
var fpRegMask386 = regMask(65280)
var specialRegMask386 = regMask(0)
@@ -36172,8 +36368,8 @@ var registersAMD64 = [...]Register{
{11, x86.REG_R11, 10, "R11"},
{12, x86.REG_R12, 11, "R12"},
{13, x86.REG_R13, 12, "R13"},
- {14, x86.REG_R14, 13, "R14"},
- {15, x86.REG_R15, 14, "R15"},
+ {14, x86.REGG, -1, "g"},
+ {15, x86.REG_R15, 13, "R15"},
{16, x86.REG_X0, -1, "X0"},
{17, x86.REG_X1, -1, "X1"},
{18, x86.REG_X2, -1, "X2"},
@@ -36192,9 +36388,11 @@ var registersAMD64 = [...]Register{
{31, x86.REG_X15, -1, "X15"},
{32, 0, -1, "SB"},
}
-var gpRegMaskAMD64 = regMask(65519)
-var fpRegMaskAMD64 = regMask(4294901760)
-var specialRegMaskAMD64 = regMask(0)
+var paramIntRegAMD64 = []int8{0, 3, 1, 7, 6, 8, 9, 10, 11}
+var paramFloatRegAMD64 = []int8{16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}
+var gpRegMaskAMD64 = regMask(49135)
+var fpRegMaskAMD64 = regMask(2147418112)
+var specialRegMaskAMD64 = regMask(2147483648)
var framepointerRegAMD64 = int8(5)
var linkRegAMD64 = int8(-1)
var registersARM = [...]Register{
@@ -36232,6 +36430,8 @@ var registersARM = [...]Register{
{31, arm.REG_F15, -1, "F15"},
{32, 0, -1, "SB"},
}
+var paramIntRegARM = []int8(nil)
+var paramFloatRegARM = []int8(nil)
var gpRegMaskARM = regMask(21503)
var fpRegMaskARM = regMask(4294901760)
var specialRegMaskARM = regMask(0)
@@ -36303,6 +36503,8 @@ var registersARM64 = [...]Register{
{62, arm64.REG_F31, -1, "F31"},
{63, 0, -1, "SB"},
}
+var paramIntRegARM64 = []int8(nil)
+var paramFloatRegARM64 = []int8(nil)
var gpRegMaskARM64 = regMask(670826495)
var fpRegMaskARM64 = regMask(9223372034707292160)
var specialRegMaskARM64 = regMask(0)
@@ -36358,6 +36560,8 @@ var registersMIPS = [...]Register{
{46, mips.REG_LO, -1, "LO"},
{47, 0, -1, "SB"},
}
+var paramIntRegMIPS = []int8(nil)
+var paramFloatRegMIPS = []int8(nil)
var gpRegMaskMIPS = regMask(335544318)
var fpRegMaskMIPS = regMask(35183835217920)
var specialRegMaskMIPS = regMask(105553116266496)
@@ -36428,6 +36632,8 @@ var registersMIPS64 = [...]Register{
{61, mips.REG_LO, -1, "LO"},
{62, 0, -1, "SB"},
}
+var paramIntRegMIPS64 = []int8(nil)
+var paramFloatRegMIPS64 = []int8(nil)
var gpRegMaskMIPS64 = regMask(167772158)
var fpRegMaskMIPS64 = regMask(1152921504338411520)
var specialRegMaskMIPS64 = regMask(3458764513820540928)
@@ -36499,6 +36705,8 @@ var registersPPC64 = [...]Register{
{62, ppc64.REG_F30, -1, "F30"},
{63, ppc64.REG_F31, -1, "F31"},
}
+var paramIntRegPPC64 = []int8(nil)
+var paramFloatRegPPC64 = []int8(nil)
var gpRegMaskPPC64 = regMask(1073733624)
var fpRegMaskPPC64 = regMask(576460743713488896)
var specialRegMaskPPC64 = regMask(0)
@@ -36570,6 +36778,8 @@ var registersRISCV64 = [...]Register{
{62, riscv.REG_F31, -1, "F31"},
{63, 0, -1, "SB"},
}
+var paramIntRegRISCV64 = []int8(nil)
+var paramFloatRegRISCV64 = []int8(nil)
var gpRegMaskRISCV64 = regMask(1006632948)
var fpRegMaskRISCV64 = regMask(9223372034707292160)
var specialRegMaskRISCV64 = regMask(0)
@@ -36610,6 +36820,8 @@ var registersS390X = [...]Register{
{31, s390x.REG_F15, -1, "F15"},
{32, 0, -1, "SB"},
}
+var paramIntRegS390X = []int8(nil)
+var paramFloatRegS390X = []int8(nil)
var gpRegMaskS390X = regMask(23551)
var fpRegMaskS390X = regMask(4294901760)
var specialRegMaskS390X = regMask(0)
@@ -36668,6 +36880,8 @@ var registersWasm = [...]Register{
{49, wasm.REGG, -1, "g"},
{50, 0, -1, "SB"},
}
+var paramIntRegWasm = []int8(nil)
+var paramFloatRegWasm = []int8(nil)
var gpRegMaskWasm = regMask(65535)
var fpRegMaskWasm = regMask(281474976645120)
var fp32RegMaskWasm = regMask(4294901760)
diff --git a/src/cmd/compile/internal/ssa/prove.go b/src/cmd/compile/internal/ssa/prove.go
index 8a2e7c09bc..bcfdfc13f0 100644
--- a/src/cmd/compile/internal/ssa/prove.go
+++ b/src/cmd/compile/internal/ssa/prove.go
@@ -778,7 +778,14 @@ func prove(f *Func) {
if ft.lens == nil {
ft.lens = map[ID]*Value{}
}
- ft.lens[v.Args[0].ID] = v
+ // Set all len Values for the same slice as equal in the poset.
+ // The poset handles transitive relations, so Values related to
+ // any OpSliceLen for this slice will be correctly related to others.
+ if l, ok := ft.lens[v.Args[0].ID]; ok {
+ ft.update(b, v, l, signed, eq)
+ } else {
+ ft.lens[v.Args[0].ID] = v
+ }
ft.update(b, v, ft.zero, signed, gt|eq)
if v.Args[0].Op == OpSliceMake {
if lensVars == nil {
@@ -790,7 +797,12 @@ func prove(f *Func) {
if ft.caps == nil {
ft.caps = map[ID]*Value{}
}
- ft.caps[v.Args[0].ID] = v
+ // Same as case OpSliceLen above, but for slice cap.
+ if c, ok := ft.caps[v.Args[0].ID]; ok {
+ ft.update(b, v, c, signed, eq)
+ } else {
+ ft.caps[v.Args[0].ID] = v
+ }
ft.update(b, v, ft.zero, signed, gt|eq)
if v.Args[0].Op == OpSliceMake {
if lensVars == nil {
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go
index 8c25b1c81d..c11138bf4e 100644
--- a/src/cmd/compile/internal/ssa/regalloc.go
+++ b/src/cmd/compile/internal/ssa/regalloc.go
@@ -761,6 +761,9 @@ func (s *regAllocState) advanceUses(v *Value) {
// current instruction.
func (s *regAllocState) liveAfterCurrentInstruction(v *Value) bool {
u := s.values[v.ID].uses
+ if u == nil {
+ panic(fmt.Errorf("u is nil, v = %s, s.values[v.ID] = %v", v.LongString(), s.values[v.ID]))
+ }
d := u.dist
for u != nil && u.dist == d {
u = u.next
@@ -797,7 +800,8 @@ func (s *regAllocState) compatRegs(t *types.Type) regMask {
}
// regspec returns the regInfo for operation op.
-func (s *regAllocState) regspec(op Op) regInfo {
+func (s *regAllocState) regspec(v *Value) regInfo {
+ op := v.Op
if op == OpConvert {
// OpConvert is a generic op, so it doesn't have a
// register set in the static table. It can use any
@@ -805,6 +809,20 @@ func (s *regAllocState) regspec(op Op) regInfo {
m := s.allocatable & s.f.Config.gpRegMask
return regInfo{inputs: []inputInfo{{regs: m}}, outputs: []outputInfo{{regs: m}}}
}
+ if op == OpArgIntReg {
+ reg := v.Block.Func.Config.intParamRegs[v.AuxInt8()]
+ return regInfo{outputs: []outputInfo{{regs: 1 << uint(reg)}}}
+ }
+ if op == OpArgFloatReg {
+ reg := v.Block.Func.Config.floatParamRegs[v.AuxInt8()]
+ return regInfo{outputs: []outputInfo{{regs: 1 << uint(reg)}}}
+ }
+ if op.IsCall() {
+ // TODO Panic if not okay
+ if ac, ok := v.Aux.(*AuxCall); ok && ac.reg != nil {
+ return *ac.reg
+ }
+ }
return opcodeTable[op].reg
}
@@ -1160,7 +1178,7 @@ func (s *regAllocState) regalloc(f *Func) {
for i := len(oldSched) - 1; i >= 0; i-- {
v := oldSched[i]
prefs := desired.remove(v.ID)
- regspec := s.regspec(v.Op)
+ regspec := s.regspec(v)
desired.clobber(regspec.clobbers)
for _, j := range regspec.inputs {
if countRegs(j.regs) != 1 {
@@ -1190,7 +1208,7 @@ func (s *regAllocState) regalloc(f *Func) {
if s.f.pass.debug > regDebug {
fmt.Printf(" processing %s\n", v.LongString())
}
- regspec := s.regspec(v.Op)
+ regspec := s.regspec(v)
if v.Op == OpPhi {
f.Fatalf("phi %s not at start of block", v)
}
@@ -1208,13 +1226,17 @@ func (s *regAllocState) regalloc(f *Func) {
s.sb = v.ID
continue
}
- if v.Op == OpSelect0 || v.Op == OpSelect1 {
+ if v.Op == OpSelect0 || v.Op == OpSelect1 || v.Op == OpSelectN {
if s.values[v.ID].needReg {
- var i = 0
- if v.Op == OpSelect1 {
- i = 1
+ if v.Op == OpSelectN {
+ s.assignReg(register(s.f.getHome(v.Args[0].ID).(LocResults)[int(v.AuxInt)].(*Register).num), v, v)
+ } else {
+ var i = 0
+ if v.Op == OpSelect1 {
+ i = 1
+ }
+ s.assignReg(register(s.f.getHome(v.Args[0].ID).(LocPair)[i].(*Register).num), v, v)
}
- s.assignReg(register(s.f.getHome(v.Args[0].ID).(LocPair)[i].(*Register).num), v, v)
}
b.Values = append(b.Values, v)
s.advanceUses(v)
@@ -1495,6 +1517,9 @@ func (s *regAllocState) regalloc(f *Func) {
}
s.f.setHome(v, outLocs)
// Note that subsequent SelectX instructions will do the assignReg calls.
+ } else if v.Type.IsResults() {
+ // TODO register arguments need to make this work
+ panic("Oops, implement this.")
} else {
if r := outRegs[0]; r != noRegister {
s.assignReg(r, v, v)
@@ -1767,6 +1792,9 @@ func (s *regAllocState) placeSpills() {
// put the spill of v. At the start "best" is the best place
// we have found so far.
// TODO: find a way to make this O(1) without arbitrary cutoffs.
+ if v == nil {
+ panic(fmt.Errorf("nil v, s.orig[%d], vi = %v, spill = %s", i, vi, spill.LongString()))
+ }
best := v.Block
bestArg := v
var bestDepth int16
@@ -2437,7 +2465,7 @@ func (s *regAllocState) computeLive() {
// desired registers back though phi nodes.
continue
}
- regspec := s.regspec(v.Op)
+ regspec := s.regspec(v)
// Cancel desired registers if they get clobbered.
desired.clobber(regspec.clobbers)
// Update desired registers if there are any fixed register inputs.
diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go
index e82aa84cdf..9243000cef 100644
--- a/src/cmd/compile/internal/ssa/rewrite.go
+++ b/src/cmd/compile/internal/ssa/rewrite.go
@@ -765,7 +765,7 @@ func devirt(v *Value, aux Aux, sym Sym, offset int64) *AuxCall {
return nil
}
va := aux.(*AuxCall)
- return StaticAuxCall(lsym, va.args, va.results)
+ return StaticAuxCall(lsym, va.args, va.results, va.abiInfo)
}
// de-virtualize an InterLECall
@@ -793,7 +793,8 @@ func devirtLESym(v *Value, aux Aux, sym Sym, offset int64) *obj.LSym {
func devirtLECall(v *Value, sym *obj.LSym) *Value {
v.Op = OpStaticLECall
- v.Aux.(*AuxCall).Fn = sym
+ auxcall := v.Aux.(*AuxCall)
+ auxcall.Fn = sym
v.RemoveArg(0)
return v
}
@@ -1617,7 +1618,7 @@ func needRaceCleanup(sym *AuxCall, v *Value) bool {
for _, b := range f.Blocks {
for _, v := range b.Values {
switch v.Op {
- case OpStaticCall:
+ case OpStaticCall, OpStaticLECall:
// Check for racefuncenter/racefuncenterfp will encounter racefuncexit and vice versa.
// Allow calls to panic*
s := v.Aux.(*AuxCall).Fn.String()
@@ -1632,15 +1633,20 @@ func needRaceCleanup(sym *AuxCall, v *Value) bool {
return false
case OpPanicBounds, OpPanicExtend:
// Note: these are panic generators that are ok (like the static calls above).
- case OpClosureCall, OpInterCall:
+ case OpClosureCall, OpInterCall, OpClosureLECall, OpInterLECall:
// We must keep the race functions if there are any other call types.
return false
}
}
}
if isSameCall(sym, "runtime.racefuncenter") {
+ // TODO REGISTER ABI this needs to be cleaned up.
// If we're removing racefuncenter, remove its argument as well.
if v.Args[0].Op != OpStore {
+ if v.Op == OpStaticLECall {
+ // there is no store, yet.
+ return true
+ }
return false
}
mem := v.Args[0].Args[2]
diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go
index 4e7fdb9e63..726d68e243 100644
--- a/src/cmd/compile/internal/ssa/rewrite386.go
+++ b/src/cmd/compile/internal/ssa/rewrite386.go
@@ -620,6 +620,9 @@ func rewriteValue386(v *Value) bool {
case OpSqrt:
v.Op = Op386SQRTSD
return true
+ case OpSqrt32:
+ v.Op = Op386SQRTSS
+ return true
case OpStaticCall:
v.Op = Op386CALLstatic
return true
diff --git a/src/cmd/compile/internal/ssa/rewriteAMD64.go b/src/cmd/compile/internal/ssa/rewriteAMD64.go
index db2dc7a004..52d0fd095d 100644
--- a/src/cmd/compile/internal/ssa/rewriteAMD64.go
+++ b/src/cmd/compile/internal/ssa/rewriteAMD64.go
@@ -4,6 +4,8 @@
package ssa
import "math"
+import "cmd/internal/objabi"
+import "cmd/compile/internal/base"
import "cmd/compile/internal/types"
func rewriteValueAMD64(v *Value) bool {
@@ -767,8 +769,7 @@ func rewriteValueAMD64(v *Value) bool {
v.Op = OpAMD64LoweredGetClosurePtr
return true
case OpGetG:
- v.Op = OpAMD64LoweredGetG
- return true
+ return rewriteValueAMD64_OpGetG(v)
case OpHasCPUFeature:
return rewriteValueAMD64_OpHasCPUFeature(v)
case OpHmul32:
@@ -1088,6 +1089,9 @@ func rewriteValueAMD64(v *Value) bool {
case OpSqrt:
v.Op = OpAMD64SQRTSD
return true
+ case OpSqrt32:
+ v.Op = OpAMD64SQRTSS
+ return true
case OpStaticCall:
v.Op = OpAMD64CALLstatic
return true
@@ -11411,6 +11415,54 @@ func rewriteValueAMD64_OpAMD64MOVBstore(v *Value) bool {
v.AddArg3(p0, w0, mem)
return true
}
+ // match: (MOVBstore [7] p1 (SHRQconst [56] w) x1:(MOVWstore [5] p1 (SHRQconst [40] w) x2:(MOVLstore [1] p1 (SHRQconst [8] w) x3:(MOVBstore p1 w mem))))
+ // cond: x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && clobber(x1, x2, x3)
+ // result: (MOVQstore p1 w mem)
+ for {
+ if auxIntToInt32(v.AuxInt) != 7 {
+ break
+ }
+ p1 := v_0
+ if v_1.Op != OpAMD64SHRQconst || auxIntToInt8(v_1.AuxInt) != 56 {
+ break
+ }
+ w := v_1.Args[0]
+ x1 := v_2
+ if x1.Op != OpAMD64MOVWstore || auxIntToInt32(x1.AuxInt) != 5 {
+ break
+ }
+ _ = x1.Args[2]
+ if p1 != x1.Args[0] {
+ break
+ }
+ x1_1 := x1.Args[1]
+ if x1_1.Op != OpAMD64SHRQconst || auxIntToInt8(x1_1.AuxInt) != 40 || w != x1_1.Args[0] {
+ break
+ }
+ x2 := x1.Args[2]
+ if x2.Op != OpAMD64MOVLstore || auxIntToInt32(x2.AuxInt) != 1 {
+ break
+ }
+ _ = x2.Args[2]
+ if p1 != x2.Args[0] {
+ break
+ }
+ x2_1 := x2.Args[1]
+ if x2_1.Op != OpAMD64SHRQconst || auxIntToInt8(x2_1.AuxInt) != 8 || w != x2_1.Args[0] {
+ break
+ }
+ x3 := x2.Args[2]
+ if x3.Op != OpAMD64MOVBstore {
+ break
+ }
+ mem := x3.Args[2]
+ if p1 != x3.Args[0] || w != x3.Args[1] || !(x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && clobber(x1, x2, x3)) {
+ break
+ }
+ v.reset(OpAMD64MOVQstore)
+ v.AddArg3(p1, w, mem)
+ return true
+ }
// match: (MOVBstore [i] {s} p x1:(MOVBload [j] {s2} p2 mem) mem2:(MOVBstore [i-1] {s} p x2:(MOVBload [j-1] {s2} p2 mem) mem))
// cond: x1.Uses == 1 && x2.Uses == 1 && mem2.Uses == 1 && clobber(x1, x2, mem2)
// result: (MOVWstore [i-1] {s} p (MOVWload [j-1] {s2} p2 mem) mem)
@@ -14226,7 +14278,7 @@ func rewriteValueAMD64_OpAMD64MOVQstoreconst(v *Value) bool {
}
// match: (MOVQstoreconst [c] {s} p x:(MOVQstoreconst [c2] {s} p mem))
// cond: config.useSSE && x.Uses == 1 && c2.Off() + 8 == c.Off() && c.Val() == 0 && c2.Val() == 0 && clobber(x)
- // result: (MOVOstore [c2.Off32()] {s} p (MOVOconst [0]) mem)
+ // result: (MOVOstorezero [c2.Off32()] {s} p mem)
for {
c := auxIntToValAndOff(v.AuxInt)
s := auxToSym(v.Aux)
@@ -14243,12 +14295,10 @@ func rewriteValueAMD64_OpAMD64MOVQstoreconst(v *Value) bool {
if p != x.Args[0] || !(config.useSSE && x.Uses == 1 && c2.Off()+8 == c.Off() && c.Val() == 0 && c2.Val() == 0 && clobber(x)) {
break
}
- v.reset(OpAMD64MOVOstore)
+ v.reset(OpAMD64MOVOstorezero)
v.AuxInt = int32ToAuxInt(c2.Off32())
v.Aux = symToAux(s)
- v0 := b.NewValue0(x.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v0.AuxInt = int128ToAuxInt(0)
- v.AddArg3(p, v0, mem)
+ v.AddArg2(p, mem)
return true
}
// match: (MOVQstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
@@ -27142,6 +27192,33 @@ func rewriteValueAMD64_OpAMD64TESTL(v *Value) bool {
}
break
}
+ // match: (TESTL a:(ANDLload [off] {sym} x ptr mem) a)
+ // cond: a.Uses == 2 && a.Block == v.Block && clobber(a)
+ // result: (TESTL (MOVLload <a.Type> [off] {sym} ptr mem) x)
+ for {
+ for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
+ a := v_0
+ if a.Op != OpAMD64ANDLload {
+ continue
+ }
+ off := auxIntToInt32(a.AuxInt)
+ sym := auxToSym(a.Aux)
+ mem := a.Args[2]
+ x := a.Args[0]
+ ptr := a.Args[1]
+ if a != v_1 || !(a.Uses == 2 && a.Block == v.Block && clobber(a)) {
+ continue
+ }
+ v.reset(OpAMD64TESTL)
+ v0 := b.NewValue0(a.Pos, OpAMD64MOVLload, a.Type)
+ v0.AuxInt = int32ToAuxInt(off)
+ v0.Aux = symToAux(sym)
+ v0.AddArg2(ptr, mem)
+ v.AddArg2(v0, x)
+ return true
+ }
+ break
+ }
return false
}
func rewriteValueAMD64_OpAMD64TESTLconst(v *Value) bool {
@@ -27247,6 +27324,33 @@ func rewriteValueAMD64_OpAMD64TESTQ(v *Value) bool {
}
break
}
+ // match: (TESTQ a:(ANDQload [off] {sym} x ptr mem) a)
+ // cond: a.Uses == 2 && a.Block == v.Block && clobber(a)
+ // result: (TESTQ (MOVQload <a.Type> [off] {sym} ptr mem) x)
+ for {
+ for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
+ a := v_0
+ if a.Op != OpAMD64ANDQload {
+ continue
+ }
+ off := auxIntToInt32(a.AuxInt)
+ sym := auxToSym(a.Aux)
+ mem := a.Args[2]
+ x := a.Args[0]
+ ptr := a.Args[1]
+ if a != v_1 || !(a.Uses == 2 && a.Block == v.Block && clobber(a)) {
+ continue
+ }
+ v.reset(OpAMD64TESTQ)
+ v0 := b.NewValue0(a.Pos, OpAMD64MOVQload, a.Type)
+ v0.AuxInt = int32ToAuxInt(off)
+ v0.Aux = symToAux(sym)
+ v0.AddArg2(ptr, mem)
+ v.AddArg2(v0, x)
+ return true
+ }
+ break
+ }
return false
}
func rewriteValueAMD64_OpAMD64TESTQconst(v *Value) bool {
@@ -30128,6 +30232,22 @@ func rewriteValueAMD64_OpFloor(v *Value) bool {
return true
}
}
+func rewriteValueAMD64_OpGetG(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (GetG mem)
+ // cond: !(objabi.Regabi_enabled == 1 && base.Flag.ABIWrap)
+ // result: (LoweredGetG mem)
+ for {
+ mem := v_0
+ if !(!(objabi.Regabi_enabled == 1 && base.Flag.ABIWrap)) {
+ break
+ }
+ v.reset(OpAMD64LoweredGetG)
+ v.AddArg(mem)
+ return true
+ }
+ return false
+}
func rewriteValueAMD64_OpHasCPUFeature(v *Value) bool {
b := v.Block
typ := &b.Func.Config.Types
@@ -34163,7 +34283,7 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
}
// match: (Zero [s] destptr mem)
// cond: s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE
- // result: (Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16]) (MOVOstore destptr (MOVOconst [0]) mem))
+ // result: (Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16]) (MOVOstorezero destptr mem))
for {
s := auxIntToInt64(v.AuxInt)
destptr := v_0
@@ -34176,10 +34296,8 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
v0.AuxInt = int64ToAuxInt(s % 16)
v0.AddArg(destptr)
- v1 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v2 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v2.AuxInt = int128ToAuxInt(0)
- v1.AddArg3(destptr, v2, mem)
+ v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v1.AddArg2(destptr, mem)
v.AddArg2(v0, v1)
return true
}
@@ -34206,7 +34324,7 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
}
// match: (Zero [16] destptr mem)
// cond: config.useSSE
- // result: (MOVOstore destptr (MOVOconst [0]) mem)
+ // result: (MOVOstorezero destptr mem)
for {
if auxIntToInt64(v.AuxInt) != 16 {
break
@@ -34216,15 +34334,13 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
if !(config.useSSE) {
break
}
- v.reset(OpAMD64MOVOstore)
- v0 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v0.AuxInt = int128ToAuxInt(0)
- v.AddArg3(destptr, v0, mem)
+ v.reset(OpAMD64MOVOstorezero)
+ v.AddArg2(destptr, mem)
return true
}
// match: (Zero [32] destptr mem)
// cond: config.useSSE
- // result: (MOVOstore (OffPtr <destptr.Type> destptr [16]) (MOVOconst [0]) (MOVOstore destptr (MOVOconst [0]) mem))
+ // result: (MOVOstorezero (OffPtr <destptr.Type> destptr [16]) (MOVOstorezero destptr mem))
for {
if auxIntToInt64(v.AuxInt) != 32 {
break
@@ -34234,20 +34350,18 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
if !(config.useSSE) {
break
}
- v.reset(OpAMD64MOVOstore)
+ v.reset(OpAMD64MOVOstorezero)
v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
v0.AuxInt = int64ToAuxInt(16)
v0.AddArg(destptr)
- v1 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v1.AuxInt = int128ToAuxInt(0)
- v2 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v2.AddArg3(destptr, v1, mem)
- v.AddArg3(v0, v1, v2)
+ v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v1.AddArg2(destptr, mem)
+ v.AddArg2(v0, v1)
return true
}
// match: (Zero [48] destptr mem)
// cond: config.useSSE
- // result: (MOVOstore (OffPtr <destptr.Type> destptr [32]) (MOVOconst [0]) (MOVOstore (OffPtr <destptr.Type> destptr [16]) (MOVOconst [0]) (MOVOstore destptr (MOVOconst [0]) mem)))
+ // result: (MOVOstorezero (OffPtr <destptr.Type> destptr [32]) (MOVOstorezero (OffPtr <destptr.Type> destptr [16]) (MOVOstorezero destptr mem)))
for {
if auxIntToInt64(v.AuxInt) != 48 {
break
@@ -34257,25 +34371,23 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
if !(config.useSSE) {
break
}
- v.reset(OpAMD64MOVOstore)
+ v.reset(OpAMD64MOVOstorezero)
v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
v0.AuxInt = int64ToAuxInt(32)
v0.AddArg(destptr)
- v1 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v1.AuxInt = int128ToAuxInt(0)
- v2 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v3 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
- v3.AuxInt = int64ToAuxInt(16)
- v3.AddArg(destptr)
- v4 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v4.AddArg3(destptr, v1, mem)
- v2.AddArg3(v3, v1, v4)
- v.AddArg3(v0, v1, v2)
+ v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v2 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
+ v2.AuxInt = int64ToAuxInt(16)
+ v2.AddArg(destptr)
+ v3 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v3.AddArg2(destptr, mem)
+ v1.AddArg2(v2, v3)
+ v.AddArg2(v0, v1)
return true
}
// match: (Zero [64] destptr mem)
// cond: config.useSSE
- // result: (MOVOstore (OffPtr <destptr.Type> destptr [48]) (MOVOconst [0]) (MOVOstore (OffPtr <destptr.Type> destptr [32]) (MOVOconst [0]) (MOVOstore (OffPtr <destptr.Type> destptr [16]) (MOVOconst [0]) (MOVOstore destptr (MOVOconst [0]) mem))))
+ // result: (MOVOstorezero (OffPtr <destptr.Type> destptr [48]) (MOVOstorezero (OffPtr <destptr.Type> destptr [32]) (MOVOstorezero (OffPtr <destptr.Type> destptr [16]) (MOVOstorezero destptr mem))))
for {
if auxIntToInt64(v.AuxInt) != 64 {
break
@@ -34285,30 +34397,28 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
if !(config.useSSE) {
break
}
- v.reset(OpAMD64MOVOstore)
+ v.reset(OpAMD64MOVOstorezero)
v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
v0.AuxInt = int64ToAuxInt(48)
v0.AddArg(destptr)
- v1 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v1.AuxInt = int128ToAuxInt(0)
- v2 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v3 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
- v3.AuxInt = int64ToAuxInt(32)
- v3.AddArg(destptr)
- v4 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v5 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
- v5.AuxInt = int64ToAuxInt(16)
- v5.AddArg(destptr)
- v6 := b.NewValue0(v.Pos, OpAMD64MOVOstore, types.TypeMem)
- v6.AddArg3(destptr, v1, mem)
- v4.AddArg3(v5, v1, v6)
- v2.AddArg3(v3, v1, v4)
- v.AddArg3(v0, v1, v2)
+ v1 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v2 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
+ v2.AuxInt = int64ToAuxInt(32)
+ v2.AddArg(destptr)
+ v3 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v4 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
+ v4.AuxInt = int64ToAuxInt(16)
+ v4.AddArg(destptr)
+ v5 := b.NewValue0(v.Pos, OpAMD64MOVOstorezero, types.TypeMem)
+ v5.AddArg2(destptr, mem)
+ v3.AddArg2(v4, v5)
+ v1.AddArg2(v2, v3)
+ v.AddArg2(v0, v1)
return true
}
// match: (Zero [s] destptr mem)
// cond: s > 64 && s <= 1024 && s%16 == 0 && !config.noDuffDevice
- // result: (DUFFZERO [s] destptr (MOVOconst [0]) mem)
+ // result: (DUFFZERO [s] destptr mem)
for {
s := auxIntToInt64(v.AuxInt)
destptr := v_0
@@ -34318,9 +34428,7 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
}
v.reset(OpAMD64DUFFZERO)
v.AuxInt = int64ToAuxInt(s)
- v0 := b.NewValue0(v.Pos, OpAMD64MOVOconst, types.TypeInt128)
- v0.AuxInt = int128ToAuxInt(0)
- v.AddArg3(destptr, v0, mem)
+ v.AddArg2(destptr, mem)
return true
}
// match: (Zero [s] destptr mem)
diff --git a/src/cmd/compile/internal/ssa/rewriteARM.go b/src/cmd/compile/internal/ssa/rewriteARM.go
index c958aae2c4..ed1f85e340 100644
--- a/src/cmd/compile/internal/ssa/rewriteARM.go
+++ b/src/cmd/compile/internal/ssa/rewriteARM.go
@@ -202,6 +202,8 @@ func rewriteValueARM(v *Value) bool {
return rewriteValueARM_OpARMMOVWloadshiftRA(v)
case OpARMMOVWloadshiftRL:
return rewriteValueARM_OpARMMOVWloadshiftRL(v)
+ case OpARMMOVWnop:
+ return rewriteValueARM_OpARMMOVWnop(v)
case OpARMMOVWreg:
return rewriteValueARM_OpARMMOVWreg(v)
case OpARMMOVWstore:
@@ -821,6 +823,9 @@ func rewriteValueARM(v *Value) bool {
case OpSqrt:
v.Op = OpARMSQRTD
return true
+ case OpSqrt32:
+ v.Op = OpARMSQRTF
+ return true
case OpStaticCall:
v.Op = OpARMCALLstatic
return true
@@ -6501,6 +6506,21 @@ func rewriteValueARM_OpARMMOVWloadshiftRL(v *Value) bool {
}
return false
}
+func rewriteValueARM_OpARMMOVWnop(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (MOVWnop (MOVWconst [c]))
+ // result: (MOVWconst [c])
+ for {
+ if v_0.Op != OpARMMOVWconst {
+ break
+ }
+ c := auxIntToInt32(v_0.AuxInt)
+ v.reset(OpARMMOVWconst)
+ v.AuxInt = int32ToAuxInt(c)
+ return true
+ }
+ return false
+}
func rewriteValueARM_OpARMMOVWreg(v *Value) bool {
v_0 := v.Args[0]
// match: (MOVWreg x)
diff --git a/src/cmd/compile/internal/ssa/rewriteARM64.go b/src/cmd/compile/internal/ssa/rewriteARM64.go
index ff1156d901..55bb486600 100644
--- a/src/cmd/compile/internal/ssa/rewriteARM64.go
+++ b/src/cmd/compile/internal/ssa/rewriteARM64.go
@@ -99,18 +99,26 @@ func rewriteValueARM64(v *Value) bool {
return rewriteValueARM64_OpARM64FMOVDload(v)
case OpARM64FMOVDloadidx:
return rewriteValueARM64_OpARM64FMOVDloadidx(v)
+ case OpARM64FMOVDloadidx8:
+ return rewriteValueARM64_OpARM64FMOVDloadidx8(v)
case OpARM64FMOVDstore:
return rewriteValueARM64_OpARM64FMOVDstore(v)
case OpARM64FMOVDstoreidx:
return rewriteValueARM64_OpARM64FMOVDstoreidx(v)
+ case OpARM64FMOVDstoreidx8:
+ return rewriteValueARM64_OpARM64FMOVDstoreidx8(v)
case OpARM64FMOVSload:
return rewriteValueARM64_OpARM64FMOVSload(v)
case OpARM64FMOVSloadidx:
return rewriteValueARM64_OpARM64FMOVSloadidx(v)
+ case OpARM64FMOVSloadidx4:
+ return rewriteValueARM64_OpARM64FMOVSloadidx4(v)
case OpARM64FMOVSstore:
return rewriteValueARM64_OpARM64FMOVSstore(v)
case OpARM64FMOVSstoreidx:
return rewriteValueARM64_OpARM64FMOVSstoreidx(v)
+ case OpARM64FMOVSstoreidx4:
+ return rewriteValueARM64_OpARM64FMOVSstoreidx4(v)
case OpARM64FMULD:
return rewriteValueARM64_OpARM64FMULD(v)
case OpARM64FMULS:
@@ -189,6 +197,8 @@ func rewriteValueARM64(v *Value) bool {
return rewriteValueARM64_OpARM64MOVDloadidx(v)
case OpARM64MOVDloadidx8:
return rewriteValueARM64_OpARM64MOVDloadidx8(v)
+ case OpARM64MOVDnop:
+ return rewriteValueARM64_OpARM64MOVDnop(v)
case OpARM64MOVDreg:
return rewriteValueARM64_OpARM64MOVDreg(v)
case OpARM64MOVDstore:
@@ -989,6 +999,9 @@ func rewriteValueARM64(v *Value) bool {
case OpSqrt:
v.Op = OpARM64FSQRTD
return true
+ case OpSqrt32:
+ v.Op = OpARM64FSQRTS
+ return true
case OpStaticCall:
v.Op = OpARM64CALLstatic
return true
@@ -3898,6 +3911,25 @@ func rewriteValueARM64_OpARM64FMOVDload(v *Value) bool {
v.AddArg3(ptr, idx, mem)
return true
}
+ // match: (FMOVDload [off] {sym} (ADDshiftLL [3] ptr idx) mem)
+ // cond: off == 0 && sym == nil
+ // result: (FMOVDloadidx8 ptr idx mem)
+ for {
+ off := auxIntToInt32(v.AuxInt)
+ sym := auxToSym(v.Aux)
+ if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
+ break
+ }
+ idx := v_0.Args[1]
+ ptr := v_0.Args[0]
+ mem := v_1
+ if !(off == 0 && sym == nil) {
+ break
+ }
+ v.reset(OpARM64FMOVDloadidx8)
+ v.AddArg3(ptr, idx, mem)
+ return true
+ }
// match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
// result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
@@ -3962,6 +3994,56 @@ func rewriteValueARM64_OpARM64FMOVDloadidx(v *Value) bool {
v.AddArg2(ptr, mem)
return true
}
+ // match: (FMOVDloadidx ptr (SLLconst [3] idx) mem)
+ // result: (FMOVDloadidx8 ptr idx mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
+ break
+ }
+ idx := v_1.Args[0]
+ mem := v_2
+ v.reset(OpARM64FMOVDloadidx8)
+ v.AddArg3(ptr, idx, mem)
+ return true
+ }
+ // match: (FMOVDloadidx (SLLconst [3] idx) ptr mem)
+ // result: (FMOVDloadidx8 ptr idx mem)
+ for {
+ if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
+ break
+ }
+ idx := v_0.Args[0]
+ ptr := v_1
+ mem := v_2
+ v.reset(OpARM64FMOVDloadidx8)
+ v.AddArg3(ptr, idx, mem)
+ return true
+ }
+ return false
+}
+func rewriteValueARM64_OpARM64FMOVDloadidx8(v *Value) bool {
+ v_2 := v.Args[2]
+ v_1 := v.Args[1]
+ v_0 := v.Args[0]
+ // match: (FMOVDloadidx8 ptr (MOVDconst [c]) mem)
+ // cond: is32Bit(c<<3)
+ // result: (FMOVDload ptr [int32(c)<<3] mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64MOVDconst {
+ break
+ }
+ c := auxIntToInt64(v_1.AuxInt)
+ mem := v_2
+ if !(is32Bit(c << 3)) {
+ break
+ }
+ v.reset(OpARM64FMOVDload)
+ v.AuxInt = int32ToAuxInt(int32(c) << 3)
+ v.AddArg2(ptr, mem)
+ return true
+ }
return false
}
func rewriteValueARM64_OpARM64FMOVDstore(v *Value) bool {
@@ -4029,6 +4111,26 @@ func rewriteValueARM64_OpARM64FMOVDstore(v *Value) bool {
v.AddArg4(ptr, idx, val, mem)
return true
}
+ // match: (FMOVDstore [off] {sym} (ADDshiftLL [3] ptr idx) val mem)
+ // cond: off == 0 && sym == nil
+ // result: (FMOVDstoreidx8 ptr idx val mem)
+ for {
+ off := auxIntToInt32(v.AuxInt)
+ sym := auxToSym(v.Aux)
+ if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 3 {
+ break
+ }
+ idx := v_0.Args[1]
+ ptr := v_0.Args[0]
+ val := v_1
+ mem := v_2
+ if !(off == 0 && sym == nil) {
+ break
+ }
+ v.reset(OpARM64FMOVDstoreidx8)
+ v.AddArg4(ptr, idx, val, mem)
+ return true
+ }
// match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
// result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
@@ -4097,6 +4199,60 @@ func rewriteValueARM64_OpARM64FMOVDstoreidx(v *Value) bool {
v.AddArg3(idx, val, mem)
return true
}
+ // match: (FMOVDstoreidx ptr (SLLconst [3] idx) val mem)
+ // result: (FMOVDstoreidx8 ptr idx val mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 3 {
+ break
+ }
+ idx := v_1.Args[0]
+ val := v_2
+ mem := v_3
+ v.reset(OpARM64FMOVDstoreidx8)
+ v.AddArg4(ptr, idx, val, mem)
+ return true
+ }
+ // match: (FMOVDstoreidx (SLLconst [3] idx) ptr val mem)
+ // result: (FMOVDstoreidx8 ptr idx val mem)
+ for {
+ if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 3 {
+ break
+ }
+ idx := v_0.Args[0]
+ ptr := v_1
+ val := v_2
+ mem := v_3
+ v.reset(OpARM64FMOVDstoreidx8)
+ v.AddArg4(ptr, idx, val, mem)
+ return true
+ }
+ return false
+}
+func rewriteValueARM64_OpARM64FMOVDstoreidx8(v *Value) bool {
+ v_3 := v.Args[3]
+ v_2 := v.Args[2]
+ v_1 := v.Args[1]
+ v_0 := v.Args[0]
+ // match: (FMOVDstoreidx8 ptr (MOVDconst [c]) val mem)
+ // cond: is32Bit(c<<3)
+ // result: (FMOVDstore [int32(c)<<3] ptr val mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64MOVDconst {
+ break
+ }
+ c := auxIntToInt64(v_1.AuxInt)
+ val := v_2
+ mem := v_3
+ if !(is32Bit(c << 3)) {
+ break
+ }
+ v.reset(OpARM64FMOVDstore)
+ v.AuxInt = int32ToAuxInt(int32(c) << 3)
+ v.AddArg3(ptr, val, mem)
+ return true
+ }
return false
}
func rewriteValueARM64_OpARM64FMOVSload(v *Value) bool {
@@ -4161,6 +4317,25 @@ func rewriteValueARM64_OpARM64FMOVSload(v *Value) bool {
v.AddArg3(ptr, idx, mem)
return true
}
+ // match: (FMOVSload [off] {sym} (ADDshiftLL [2] ptr idx) mem)
+ // cond: off == 0 && sym == nil
+ // result: (FMOVSloadidx4 ptr idx mem)
+ for {
+ off := auxIntToInt32(v.AuxInt)
+ sym := auxToSym(v.Aux)
+ if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
+ break
+ }
+ idx := v_0.Args[1]
+ ptr := v_0.Args[0]
+ mem := v_1
+ if !(off == 0 && sym == nil) {
+ break
+ }
+ v.reset(OpARM64FMOVSloadidx4)
+ v.AddArg3(ptr, idx, mem)
+ return true
+ }
// match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) mem)
// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
// result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
@@ -4225,6 +4400,56 @@ func rewriteValueARM64_OpARM64FMOVSloadidx(v *Value) bool {
v.AddArg2(ptr, mem)
return true
}
+ // match: (FMOVSloadidx ptr (SLLconst [2] idx) mem)
+ // result: (FMOVSloadidx4 ptr idx mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
+ break
+ }
+ idx := v_1.Args[0]
+ mem := v_2
+ v.reset(OpARM64FMOVSloadidx4)
+ v.AddArg3(ptr, idx, mem)
+ return true
+ }
+ // match: (FMOVSloadidx (SLLconst [2] idx) ptr mem)
+ // result: (FMOVSloadidx4 ptr idx mem)
+ for {
+ if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
+ break
+ }
+ idx := v_0.Args[0]
+ ptr := v_1
+ mem := v_2
+ v.reset(OpARM64FMOVSloadidx4)
+ v.AddArg3(ptr, idx, mem)
+ return true
+ }
+ return false
+}
+func rewriteValueARM64_OpARM64FMOVSloadidx4(v *Value) bool {
+ v_2 := v.Args[2]
+ v_1 := v.Args[1]
+ v_0 := v.Args[0]
+ // match: (FMOVSloadidx4 ptr (MOVDconst [c]) mem)
+ // cond: is32Bit(c<<2)
+ // result: (FMOVSload ptr [int32(c)<<2] mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64MOVDconst {
+ break
+ }
+ c := auxIntToInt64(v_1.AuxInt)
+ mem := v_2
+ if !(is32Bit(c << 2)) {
+ break
+ }
+ v.reset(OpARM64FMOVSload)
+ v.AuxInt = int32ToAuxInt(int32(c) << 2)
+ v.AddArg2(ptr, mem)
+ return true
+ }
return false
}
func rewriteValueARM64_OpARM64FMOVSstore(v *Value) bool {
@@ -4292,6 +4517,26 @@ func rewriteValueARM64_OpARM64FMOVSstore(v *Value) bool {
v.AddArg4(ptr, idx, val, mem)
return true
}
+ // match: (FMOVSstore [off] {sym} (ADDshiftLL [2] ptr idx) val mem)
+ // cond: off == 0 && sym == nil
+ // result: (FMOVSstoreidx4 ptr idx val mem)
+ for {
+ off := auxIntToInt32(v.AuxInt)
+ sym := auxToSym(v.Aux)
+ if v_0.Op != OpARM64ADDshiftLL || auxIntToInt64(v_0.AuxInt) != 2 {
+ break
+ }
+ idx := v_0.Args[1]
+ ptr := v_0.Args[0]
+ val := v_1
+ mem := v_2
+ if !(off == 0 && sym == nil) {
+ break
+ }
+ v.reset(OpARM64FMOVSstoreidx4)
+ v.AddArg4(ptr, idx, val, mem)
+ return true
+ }
// match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} ptr) val mem)
// cond: canMergeSym(sym1,sym2) && is32Bit(int64(off1)+int64(off2)) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
// result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
@@ -4360,6 +4605,60 @@ func rewriteValueARM64_OpARM64FMOVSstoreidx(v *Value) bool {
v.AddArg3(idx, val, mem)
return true
}
+ // match: (FMOVSstoreidx ptr (SLLconst [2] idx) val mem)
+ // result: (FMOVSstoreidx4 ptr idx val mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64SLLconst || auxIntToInt64(v_1.AuxInt) != 2 {
+ break
+ }
+ idx := v_1.Args[0]
+ val := v_2
+ mem := v_3
+ v.reset(OpARM64FMOVSstoreidx4)
+ v.AddArg4(ptr, idx, val, mem)
+ return true
+ }
+ // match: (FMOVSstoreidx (SLLconst [2] idx) ptr val mem)
+ // result: (FMOVSstoreidx4 ptr idx val mem)
+ for {
+ if v_0.Op != OpARM64SLLconst || auxIntToInt64(v_0.AuxInt) != 2 {
+ break
+ }
+ idx := v_0.Args[0]
+ ptr := v_1
+ val := v_2
+ mem := v_3
+ v.reset(OpARM64FMOVSstoreidx4)
+ v.AddArg4(ptr, idx, val, mem)
+ return true
+ }
+ return false
+}
+func rewriteValueARM64_OpARM64FMOVSstoreidx4(v *Value) bool {
+ v_3 := v.Args[3]
+ v_2 := v.Args[2]
+ v_1 := v.Args[1]
+ v_0 := v.Args[0]
+ // match: (FMOVSstoreidx4 ptr (MOVDconst [c]) val mem)
+ // cond: is32Bit(c<<2)
+ // result: (FMOVSstore [int32(c)<<2] ptr val mem)
+ for {
+ ptr := v_0
+ if v_1.Op != OpARM64MOVDconst {
+ break
+ }
+ c := auxIntToInt64(v_1.AuxInt)
+ val := v_2
+ mem := v_3
+ if !(is32Bit(c << 2)) {
+ break
+ }
+ v.reset(OpARM64FMOVSstore)
+ v.AuxInt = int32ToAuxInt(int32(c) << 2)
+ v.AddArg3(ptr, val, mem)
+ return true
+ }
return false
}
func rewriteValueARM64_OpARM64FMULD(v *Value) bool {
@@ -9011,6 +9310,21 @@ func rewriteValueARM64_OpARM64MOVDloadidx8(v *Value) bool {
}
return false
}
+func rewriteValueARM64_OpARM64MOVDnop(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (MOVDnop (MOVDconst [c]))
+ // result: (MOVDconst [c])
+ for {
+ if v_0.Op != OpARM64MOVDconst {
+ break
+ }
+ c := auxIntToInt64(v_0.AuxInt)
+ v.reset(OpARM64MOVDconst)
+ v.AuxInt = int64ToAuxInt(c)
+ return true
+ }
+ return false
+}
func rewriteValueARM64_OpARM64MOVDreg(v *Value) bool {
v_0 := v.Args[0]
// match: (MOVDreg x)
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go
index 3fc5527955..fdf329cbd0 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go
@@ -297,6 +297,8 @@ func rewriteValueMIPS(v *Value) bool {
return rewriteValueMIPS_OpMIPSMOVHstorezero(v)
case OpMIPSMOVWload:
return rewriteValueMIPS_OpMIPSMOVWload(v)
+ case OpMIPSMOVWnop:
+ return rewriteValueMIPS_OpMIPSMOVWnop(v)
case OpMIPSMOVWreg:
return rewriteValueMIPS_OpMIPSMOVWreg(v)
case OpMIPSMOVWstore:
@@ -514,6 +516,9 @@ func rewriteValueMIPS(v *Value) bool {
case OpSqrt:
v.Op = OpMIPSSQRTD
return true
+ case OpSqrt32:
+ v.Op = OpMIPSSQRTF
+ return true
case OpStaticCall:
v.Op = OpMIPSCALLstatic
return true
@@ -3647,6 +3652,21 @@ func rewriteValueMIPS_OpMIPSMOVWload(v *Value) bool {
}
return false
}
+func rewriteValueMIPS_OpMIPSMOVWnop(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (MOVWnop (MOVWconst [c]))
+ // result: (MOVWconst [c])
+ for {
+ if v_0.Op != OpMIPSMOVWconst {
+ break
+ }
+ c := auxIntToInt32(v_0.AuxInt)
+ v.reset(OpMIPSMOVWconst)
+ v.AuxInt = int32ToAuxInt(c)
+ return true
+ }
+ return false
+}
func rewriteValueMIPS_OpMIPSMOVWreg(v *Value) bool {
v_0 := v.Args[0]
// match: (MOVWreg x)
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS64.go b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
index d78f6089af..541bdd694a 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
@@ -339,6 +339,8 @@ func rewriteValueMIPS64(v *Value) bool {
return rewriteValueMIPS64_OpMIPS64MOVHstorezero(v)
case OpMIPS64MOVVload:
return rewriteValueMIPS64_OpMIPS64MOVVload(v)
+ case OpMIPS64MOVVnop:
+ return rewriteValueMIPS64_OpMIPS64MOVVnop(v)
case OpMIPS64MOVVreg:
return rewriteValueMIPS64_OpMIPS64MOVVreg(v)
case OpMIPS64MOVVstore:
@@ -594,6 +596,9 @@ func rewriteValueMIPS64(v *Value) bool {
case OpSqrt:
v.Op = OpMIPS64SQRTD
return true
+ case OpSqrt32:
+ v.Op = OpMIPS64SQRTF
+ return true
case OpStaticCall:
v.Op = OpMIPS64CALLstatic
return true
@@ -3584,6 +3589,21 @@ func rewriteValueMIPS64_OpMIPS64MOVVload(v *Value) bool {
}
return false
}
+func rewriteValueMIPS64_OpMIPS64MOVVnop(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (MOVVnop (MOVVconst [c]))
+ // result: (MOVVconst [c])
+ for {
+ if v_0.Op != OpMIPS64MOVVconst {
+ break
+ }
+ c := auxIntToInt64(v_0.AuxInt)
+ v.reset(OpMIPS64MOVVconst)
+ v.AuxInt = int64ToAuxInt(c)
+ return true
+ }
+ return false
+}
func rewriteValueMIPS64_OpMIPS64MOVVreg(v *Value) bool {
v_0 := v.Args[0]
// match: (MOVVreg x)
diff --git a/src/cmd/compile/internal/ssa/rewritePPC64.go b/src/cmd/compile/internal/ssa/rewritePPC64.go
index 98f748e5fa..3357864291 100644
--- a/src/cmd/compile/internal/ssa/rewritePPC64.go
+++ b/src/cmd/compile/internal/ssa/rewritePPC64.go
@@ -743,6 +743,9 @@ func rewriteValuePPC64(v *Value) bool {
case OpSqrt:
v.Op = OpPPC64FSQRT
return true
+ case OpSqrt32:
+ v.Op = OpPPC64FSQRTS
+ return true
case OpStaticCall:
v.Op = OpPPC64CALLstatic
return true
diff --git a/src/cmd/compile/internal/ssa/rewriteRISCV64.go b/src/cmd/compile/internal/ssa/rewriteRISCV64.go
index fb507b65c4..7f77477da7 100644
--- a/src/cmd/compile/internal/ssa/rewriteRISCV64.go
+++ b/src/cmd/compile/internal/ssa/rewriteRISCV64.go
@@ -52,6 +52,11 @@ func rewriteValueRISCV64(v *Value) bool {
case OpAtomicAdd64:
v.Op = OpRISCV64LoweredAtomicAdd64
return true
+ case OpAtomicAnd32:
+ v.Op = OpRISCV64LoweredAtomicAnd32
+ return true
+ case OpAtomicAnd8:
+ return rewriteValueRISCV64_OpAtomicAnd8(v)
case OpAtomicCompareAndSwap32:
v.Op = OpRISCV64LoweredAtomicCas32
return true
@@ -76,6 +81,11 @@ func rewriteValueRISCV64(v *Value) bool {
case OpAtomicLoadPtr:
v.Op = OpRISCV64LoweredAtomicLoad64
return true
+ case OpAtomicOr32:
+ v.Op = OpRISCV64LoweredAtomicOr32
+ return true
+ case OpAtomicOr8:
+ return rewriteValueRISCV64_OpAtomicOr8(v)
case OpAtomicStore32:
v.Op = OpRISCV64LoweredAtomicStore32
return true
@@ -435,6 +445,8 @@ func rewriteValueRISCV64(v *Value) bool {
return rewriteValueRISCV64_OpRISCV64MOVDconst(v)
case OpRISCV64MOVDload:
return rewriteValueRISCV64_OpRISCV64MOVDload(v)
+ case OpRISCV64MOVDnop:
+ return rewriteValueRISCV64_OpRISCV64MOVDnop(v)
case OpRISCV64MOVDreg:
return rewriteValueRISCV64_OpRISCV64MOVDreg(v)
case OpRISCV64MOVDstore:
@@ -580,6 +592,9 @@ func rewriteValueRISCV64(v *Value) bool {
case OpSqrt:
v.Op = OpRISCV64FSQRTD
return true
+ case OpSqrt32:
+ v.Op = OpRISCV64FSQRTS
+ return true
case OpStaticCall:
v.Op = OpRISCV64CALLstatic
return true
@@ -676,6 +691,71 @@ func rewriteValueRISCV64_OpAddr(v *Value) bool {
return true
}
}
+func rewriteValueRISCV64_OpAtomicAnd8(v *Value) bool {
+ v_2 := v.Args[2]
+ v_1 := v.Args[1]
+ v_0 := v.Args[0]
+ b := v.Block
+ typ := &b.Func.Config.Types
+ // match: (AtomicAnd8 ptr val mem)
+ // result: (LoweredAtomicAnd32 (ANDI <typ.Uintptr> [^3] ptr) (NOT <typ.UInt32> (SLL <typ.UInt32> (XORI <typ.UInt32> [0xff] (ZeroExt8to32 val)) (SLLI <typ.UInt64> [3] (ANDI <typ.UInt64> [3] ptr)))) mem)
+ for {
+ ptr := v_0
+ val := v_1
+ mem := v_2
+ v.reset(OpRISCV64LoweredAtomicAnd32)
+ v0 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.Uintptr)
+ v0.AuxInt = int64ToAuxInt(^3)
+ v0.AddArg(ptr)
+ v1 := b.NewValue0(v.Pos, OpRISCV64NOT, typ.UInt32)
+ v2 := b.NewValue0(v.Pos, OpRISCV64SLL, typ.UInt32)
+ v3 := b.NewValue0(v.Pos, OpRISCV64XORI, typ.UInt32)
+ v3.AuxInt = int64ToAuxInt(0xff)
+ v4 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
+ v4.AddArg(val)
+ v3.AddArg(v4)
+ v5 := b.NewValue0(v.Pos, OpRISCV64SLLI, typ.UInt64)
+ v5.AuxInt = int64ToAuxInt(3)
+ v6 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.UInt64)
+ v6.AuxInt = int64ToAuxInt(3)
+ v6.AddArg(ptr)
+ v5.AddArg(v6)
+ v2.AddArg2(v3, v5)
+ v1.AddArg(v2)
+ v.AddArg3(v0, v1, mem)
+ return true
+ }
+}
+func rewriteValueRISCV64_OpAtomicOr8(v *Value) bool {
+ v_2 := v.Args[2]
+ v_1 := v.Args[1]
+ v_0 := v.Args[0]
+ b := v.Block
+ typ := &b.Func.Config.Types
+ // match: (AtomicOr8 ptr val mem)
+ // result: (LoweredAtomicOr32 (ANDI <typ.Uintptr> [^3] ptr) (SLL <typ.UInt32> (ZeroExt8to32 val) (SLLI <typ.UInt64> [3] (ANDI <typ.UInt64> [3] ptr))) mem)
+ for {
+ ptr := v_0
+ val := v_1
+ mem := v_2
+ v.reset(OpRISCV64LoweredAtomicOr32)
+ v0 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.Uintptr)
+ v0.AuxInt = int64ToAuxInt(^3)
+ v0.AddArg(ptr)
+ v1 := b.NewValue0(v.Pos, OpRISCV64SLL, typ.UInt32)
+ v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
+ v2.AddArg(val)
+ v3 := b.NewValue0(v.Pos, OpRISCV64SLLI, typ.UInt64)
+ v3.AuxInt = int64ToAuxInt(3)
+ v4 := b.NewValue0(v.Pos, OpRISCV64ANDI, typ.UInt64)
+ v4.AuxInt = int64ToAuxInt(3)
+ v4.AddArg(ptr)
+ v3.AddArg(v4)
+ v1.AddArg2(v2, v3)
+ v.AddArg3(v0, v1, mem)
+ return true
+ }
+}
func rewriteValueRISCV64_OpAvg64u(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
@@ -890,14 +970,19 @@ func rewriteValueRISCV64_OpEq32(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
+ typ := &b.Func.Config.Types
// match: (Eq32 x y)
- // result: (SEQZ (SUBW <x.Type> x y))
+ // result: (SEQZ (SUB <x.Type> (ZeroExt32to64 x) (ZeroExt32to64 y)))
for {
x := v_0
y := v_1
v.reset(OpRISCV64SEQZ)
- v0 := b.NewValue0(v.Pos, OpRISCV64SUBW, x.Type)
- v0.AddArg2(x, y)
+ v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
+ v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
+ v1.AddArg(x)
+ v2 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
+ v2.AddArg(y)
+ v0.AddArg2(v1, v2)
v.AddArg(v0)
return true
}
@@ -2466,14 +2551,19 @@ func rewriteValueRISCV64_OpNeq32(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
+ typ := &b.Func.Config.Types
// match: (Neq32 x y)
- // result: (SNEZ (SUBW <x.Type> x y))
+ // result: (SNEZ (SUB <x.Type> (ZeroExt32to64 x) (ZeroExt32to64 y)))
for {
x := v_0
y := v_1
v.reset(OpRISCV64SNEZ)
- v0 := b.NewValue0(v.Pos, OpRISCV64SUBW, x.Type)
- v0.AddArg2(x, y)
+ v0 := b.NewValue0(v.Pos, OpRISCV64SUB, x.Type)
+ v1 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
+ v1.AddArg(x)
+ v2 := b.NewValue0(v.Pos, OpZeroExt32to64, typ.UInt64)
+ v2.AddArg(y)
+ v0.AddArg2(v1, v2)
v.AddArg(v0)
return true
}
@@ -3339,6 +3429,21 @@ func rewriteValueRISCV64_OpRISCV64MOVDload(v *Value) bool {
}
return false
}
+func rewriteValueRISCV64_OpRISCV64MOVDnop(v *Value) bool {
+ v_0 := v.Args[0]
+ // match: (MOVDnop (MOVDconst [c]))
+ // result: (MOVDconst [c])
+ for {
+ if v_0.Op != OpRISCV64MOVDconst {
+ break
+ }
+ c := auxIntToInt64(v_0.AuxInt)
+ v.reset(OpRISCV64MOVDconst)
+ v.AuxInt = int64ToAuxInt(c)
+ return true
+ }
+ return false
+}
func rewriteValueRISCV64_OpRISCV64MOVDreg(v *Value) bool {
v_0 := v.Args[0]
// match: (MOVDreg x)
diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go
index b52a1b6745..e0a5ff4cbb 100644
--- a/src/cmd/compile/internal/ssa/rewriteS390X.go
+++ b/src/cmd/compile/internal/ssa/rewriteS390X.go
@@ -792,6 +792,9 @@ func rewriteValueS390X(v *Value) bool {
case OpSqrt:
v.Op = OpS390XFSQRT
return true
+ case OpSqrt32:
+ v.Op = OpS390XFSQRTS
+ return true
case OpStaticCall:
v.Op = OpS390XCALLstatic
return true
@@ -8880,6 +8883,54 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool {
v.AddArg3(p, w0, mem)
return true
}
+ // match: (MOVBstore [7] p1 (SRDconst w) x1:(MOVHBRstore [5] p1 (SRDconst w) x2:(MOVWBRstore [1] p1 (SRDconst w) x3:(MOVBstore p1 w mem))))
+ // cond: x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && clobber(x1, x2, x3)
+ // result: (MOVDBRstore p1 w mem)
+ for {
+ if auxIntToInt32(v.AuxInt) != 7 {
+ break
+ }
+ p1 := v_0
+ if v_1.Op != OpS390XSRDconst {
+ break
+ }
+ w := v_1.Args[0]
+ x1 := v_2
+ if x1.Op != OpS390XMOVHBRstore || auxIntToInt32(x1.AuxInt) != 5 {
+ break
+ }
+ _ = x1.Args[2]
+ if p1 != x1.Args[0] {
+ break
+ }
+ x1_1 := x1.Args[1]
+ if x1_1.Op != OpS390XSRDconst || w != x1_1.Args[0] {
+ break
+ }
+ x2 := x1.Args[2]
+ if x2.Op != OpS390XMOVWBRstore || auxIntToInt32(x2.AuxInt) != 1 {
+ break
+ }
+ _ = x2.Args[2]
+ if p1 != x2.Args[0] {
+ break
+ }
+ x2_1 := x2.Args[1]
+ if x2_1.Op != OpS390XSRDconst || w != x2_1.Args[0] {
+ break
+ }
+ x3 := x2.Args[2]
+ if x3.Op != OpS390XMOVBstore {
+ break
+ }
+ mem := x3.Args[2]
+ if p1 != x3.Args[0] || w != x3.Args[1] || !(x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && clobber(x1, x2, x3)) {
+ break
+ }
+ v.reset(OpS390XMOVDBRstore)
+ v.AddArg3(p1, w, mem)
+ return true
+ }
return false
}
func rewriteValueS390X_OpS390XMOVBstoreconst(v *Value) bool {
diff --git a/src/cmd/compile/internal/ssa/rewriteWasm.go b/src/cmd/compile/internal/ssa/rewriteWasm.go
index c8ecefc736..7258bc4f8e 100644
--- a/src/cmd/compile/internal/ssa/rewriteWasm.go
+++ b/src/cmd/compile/internal/ssa/rewriteWasm.go
@@ -527,6 +527,9 @@ func rewriteValueWasm(v *Value) bool {
case OpSqrt:
v.Op = OpWasmF64Sqrt
return true
+ case OpSqrt32:
+ v.Op = OpWasmF32Sqrt
+ return true
case OpStaticCall:
v.Op = OpWasmLoweredStaticCall
return true
diff --git a/src/cmd/compile/internal/ssa/rewrite_test.go b/src/cmd/compile/internal/ssa/rewrite_test.go
index 6fe429e85a..272b080d88 100644
--- a/src/cmd/compile/internal/ssa/rewrite_test.go
+++ b/src/cmd/compile/internal/ssa/rewrite_test.go
@@ -13,7 +13,7 @@ func TestMove(t *testing.T) {
copy(x[1:], x[:])
for i := 1; i < len(x); i++ {
if int(x[i]) != i {
- t.Errorf("Memmove got converted to OpMove in alias-unsafe way. Got %d insted of %d in position %d", int(x[i]), i, i+1)
+ t.Errorf("Memmove got converted to OpMove in alias-unsafe way. Got %d instead of %d in position %d", int(x[i]), i, i+1)
}
}
}
diff --git a/src/cmd/compile/internal/ssa/rewritegeneric.go b/src/cmd/compile/internal/ssa/rewritegeneric.go
index 958e24d29f..7e7cf458ff 100644
--- a/src/cmd/compile/internal/ssa/rewritegeneric.go
+++ b/src/cmd/compile/internal/ssa/rewritegeneric.go
@@ -122,8 +122,6 @@ func rewriteValuegeneric(v *Value) bool {
return rewriteValuegeneric_OpEqSlice(v)
case OpIMake:
return rewriteValuegeneric_OpIMake(v)
- case OpInterCall:
- return rewriteValuegeneric_OpInterCall(v)
case OpInterLECall:
return rewriteValuegeneric_OpInterLECall(v)
case OpIsInBounds:
@@ -392,8 +390,6 @@ func rewriteValuegeneric(v *Value) bool {
return rewriteValuegeneric_OpSlicemask(v)
case OpSqrt:
return rewriteValuegeneric_OpSqrt(v)
- case OpStaticCall:
- return rewriteValuegeneric_OpStaticCall(v)
case OpStaticLECall:
return rewriteValuegeneric_OpStaticLECall(v)
case OpStore:
@@ -4089,6 +4085,26 @@ func rewriteValuegeneric_OpCvt64Fto32F(v *Value) bool {
v.AuxInt = float32ToAuxInt(float32(c))
return true
}
+ // match: (Cvt64Fto32F sqrt0:(Sqrt (Cvt32Fto64F x)))
+ // cond: sqrt0.Uses==1
+ // result: (Sqrt32 x)
+ for {
+ sqrt0 := v_0
+ if sqrt0.Op != OpSqrt {
+ break
+ }
+ sqrt0_0 := sqrt0.Args[0]
+ if sqrt0_0.Op != OpCvt32Fto64F {
+ break
+ }
+ x := sqrt0_0.Args[0]
+ if !(sqrt0.Uses == 1) {
+ break
+ }
+ v.reset(OpSqrt32)
+ v.AddArg(x)
+ return true
+ }
return false
}
func rewriteValuegeneric_OpCvt64Fto64(v *Value) bool {
@@ -8542,52 +8558,6 @@ func rewriteValuegeneric_OpIMake(v *Value) bool {
}
return false
}
-func rewriteValuegeneric_OpInterCall(v *Value) bool {
- v_1 := v.Args[1]
- v_0 := v.Args[0]
- // match: (InterCall [argsize] {auxCall} (Load (OffPtr [off] (ITab (IMake (Addr {itab} (SB)) _))) _) mem)
- // cond: devirt(v, auxCall, itab, off) != nil
- // result: (StaticCall [int32(argsize)] {devirt(v, auxCall, itab, off)} mem)
- for {
- argsize := auxIntToInt32(v.AuxInt)
- auxCall := auxToCall(v.Aux)
- if v_0.Op != OpLoad {
- break
- }
- v_0_0 := v_0.Args[0]
- if v_0_0.Op != OpOffPtr {
- break
- }
- off := auxIntToInt64(v_0_0.AuxInt)
- v_0_0_0 := v_0_0.Args[0]
- if v_0_0_0.Op != OpITab {
- break
- }
- v_0_0_0_0 := v_0_0_0.Args[0]
- if v_0_0_0_0.Op != OpIMake {
- break
- }
- v_0_0_0_0_0 := v_0_0_0_0.Args[0]
- if v_0_0_0_0_0.Op != OpAddr {
- break
- }
- itab := auxToSym(v_0_0_0_0_0.Aux)
- v_0_0_0_0_0_0 := v_0_0_0_0_0.Args[0]
- if v_0_0_0_0_0_0.Op != OpSB {
- break
- }
- mem := v_1
- if !(devirt(v, auxCall, itab, off) != nil) {
- break
- }
- v.reset(OpStaticCall)
- v.AuxInt = int32ToAuxInt(int32(argsize))
- v.Aux = callToAux(devirt(v, auxCall, itab, off))
- v.AddArg(mem)
- return true
- }
- return false
-}
func rewriteValuegeneric_OpInterLECall(v *Value) bool {
// match: (InterLECall [argsize] {auxCall} (Load (OffPtr [off] (ITab (IMake (Addr {itab} (SB)) _))) _) ___)
// cond: devirtLESym(v, auxCall, itab, off) != nil
@@ -16113,7 +16083,6 @@ func rewriteValuegeneric_OpNilCheck(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
- config := b.Func.Config
fe := b.Func.fe
// match: (NilCheck (GetG mem) mem)
// result: mem
@@ -16128,67 +16097,7 @@ func rewriteValuegeneric_OpNilCheck(v *Value) bool {
v.copyOf(mem)
return true
}
- // match: (NilCheck (Load (OffPtr [c] (SP)) (StaticCall {sym} _)) _)
- // cond: isSameCall(sym, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.RegSize && warnRule(fe.Debug_checknil(), v, "removed nil check")
- // result: (Invalid)
- for {
- if v_0.Op != OpLoad {
- break
- }
- _ = v_0.Args[1]
- v_0_0 := v_0.Args[0]
- if v_0_0.Op != OpOffPtr {
- break
- }
- c := auxIntToInt64(v_0_0.AuxInt)
- v_0_0_0 := v_0_0.Args[0]
- if v_0_0_0.Op != OpSP {
- break
- }
- v_0_1 := v_0.Args[1]
- if v_0_1.Op != OpStaticCall {
- break
- }
- sym := auxToCall(v_0_1.Aux)
- if !(isSameCall(sym, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.RegSize && warnRule(fe.Debug_checknil(), v, "removed nil check")) {
- break
- }
- v.reset(OpInvalid)
- return true
- }
- // match: (NilCheck (OffPtr (Load (OffPtr [c] (SP)) (StaticCall {sym} _))) _)
- // cond: isSameCall(sym, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.RegSize && warnRule(fe.Debug_checknil(), v, "removed nil check")
- // result: (Invalid)
- for {
- if v_0.Op != OpOffPtr {
- break
- }
- v_0_0 := v_0.Args[0]
- if v_0_0.Op != OpLoad {
- break
- }
- _ = v_0_0.Args[1]
- v_0_0_0 := v_0_0.Args[0]
- if v_0_0_0.Op != OpOffPtr {
- break
- }
- c := auxIntToInt64(v_0_0_0.AuxInt)
- v_0_0_0_0 := v_0_0_0.Args[0]
- if v_0_0_0_0.Op != OpSP {
- break
- }
- v_0_0_1 := v_0_0.Args[1]
- if v_0_0_1.Op != OpStaticCall {
- break
- }
- sym := auxToCall(v_0_0_1.Aux)
- if !(isSameCall(sym, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.RegSize && warnRule(fe.Debug_checknil(), v, "removed nil check")) {
- break
- }
- v.reset(OpInvalid)
- return true
- }
- // match: (NilCheck (SelectN [0] call:(StaticLECall _ _)) (SelectN [1] call))
+ // match: (NilCheck (SelectN [0] call:(StaticLECall _ _)) _)
// cond: isSameCall(call.Aux, "runtime.newobject") && warnRule(fe.Debug_checknil(), v, "removed nil check")
// result: (Invalid)
for {
@@ -16196,13 +16105,13 @@ func rewriteValuegeneric_OpNilCheck(v *Value) bool {
break
}
call := v_0.Args[0]
- if call.Op != OpStaticLECall || len(call.Args) != 2 || v_1.Op != OpSelectN || auxIntToInt64(v_1.AuxInt) != 1 || call != v_1.Args[0] || !(isSameCall(call.Aux, "runtime.newobject") && warnRule(fe.Debug_checknil(), v, "removed nil check")) {
+ if call.Op != OpStaticLECall || len(call.Args) != 2 || !(isSameCall(call.Aux, "runtime.newobject") && warnRule(fe.Debug_checknil(), v, "removed nil check")) {
break
}
v.reset(OpInvalid)
return true
}
- // match: (NilCheck (OffPtr (SelectN [0] call:(StaticLECall _ _))) (SelectN [1] call))
+ // match: (NilCheck (OffPtr (SelectN [0] call:(StaticLECall _ _))) _)
// cond: isSameCall(call.Aux, "runtime.newobject") && warnRule(fe.Debug_checknil(), v, "removed nil check")
// result: (Invalid)
for {
@@ -16214,7 +16123,7 @@ func rewriteValuegeneric_OpNilCheck(v *Value) bool {
break
}
call := v_0_0.Args[0]
- if call.Op != OpStaticLECall || len(call.Args) != 2 || v_1.Op != OpSelectN || auxIntToInt64(v_1.AuxInt) != 1 || call != v_1.Args[0] || !(isSameCall(call.Aux, "runtime.newobject") && warnRule(fe.Debug_checknil(), v, "removed nil check")) {
+ if call.Op != OpStaticLECall || len(call.Args) != 2 || !(isSameCall(call.Aux, "runtime.newobject") && warnRule(fe.Debug_checknil(), v, "removed nil check")) {
break
}
v.reset(OpInvalid)
@@ -20799,6 +20708,94 @@ func rewriteValuegeneric_OpSelectN(v *Value) bool {
v.copyOf(c)
return true
}
+ // match: (SelectN [0] call:(StaticCall {sym} s1:(Store _ (Const64 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem)))))
+ // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3, call)
+ // result: (Move {t.Elem()} [int64(sz)] dst src mem)
+ for {
+ if auxIntToInt64(v.AuxInt) != 0 {
+ break
+ }
+ call := v_0
+ if call.Op != OpStaticCall || len(call.Args) != 1 {
+ break
+ }
+ sym := auxToCall(call.Aux)
+ s1 := call.Args[0]
+ if s1.Op != OpStore {
+ break
+ }
+ _ = s1.Args[2]
+ s1_1 := s1.Args[1]
+ if s1_1.Op != OpConst64 {
+ break
+ }
+ sz := auxIntToInt64(s1_1.AuxInt)
+ s2 := s1.Args[2]
+ if s2.Op != OpStore {
+ break
+ }
+ _ = s2.Args[2]
+ src := s2.Args[1]
+ s3 := s2.Args[2]
+ if s3.Op != OpStore {
+ break
+ }
+ t := auxToType(s3.Aux)
+ mem := s3.Args[2]
+ dst := s3.Args[1]
+ if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3, call)) {
+ break
+ }
+ v.reset(OpMove)
+ v.AuxInt = int64ToAuxInt(int64(sz))
+ v.Aux = typeToAux(t.Elem())
+ v.AddArg3(dst, src, mem)
+ return true
+ }
+ // match: (SelectN [0] call:(StaticCall {sym} s1:(Store _ (Const32 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem)))))
+ // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3, call)
+ // result: (Move {t.Elem()} [int64(sz)] dst src mem)
+ for {
+ if auxIntToInt64(v.AuxInt) != 0 {
+ break
+ }
+ call := v_0
+ if call.Op != OpStaticCall || len(call.Args) != 1 {
+ break
+ }
+ sym := auxToCall(call.Aux)
+ s1 := call.Args[0]
+ if s1.Op != OpStore {
+ break
+ }
+ _ = s1.Args[2]
+ s1_1 := s1.Args[1]
+ if s1_1.Op != OpConst32 {
+ break
+ }
+ sz := auxIntToInt32(s1_1.AuxInt)
+ s2 := s1.Args[2]
+ if s2.Op != OpStore {
+ break
+ }
+ _ = s2.Args[2]
+ src := s2.Args[1]
+ s3 := s2.Args[2]
+ if s3.Op != OpStore {
+ break
+ }
+ t := auxToType(s3.Aux)
+ mem := s3.Args[2]
+ dst := s3.Args[1]
+ if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3, call)) {
+ break
+ }
+ v.reset(OpMove)
+ v.AuxInt = int64ToAuxInt(int64(sz))
+ v.Aux = typeToAux(t.Elem())
+ v.AddArg3(dst, src, mem)
+ return true
+ }
// match: (SelectN [0] call:(StaticLECall {sym} dst src (Const64 [sz]) mem))
// cond: sz >= 0 && call.Uses == 1 && isSameCall(sym, "runtime.memmove") && dst.Type.IsPtr() && isInlinableMemmove(dst, src, int64(sz), config) && clobber(call)
// result: (Move {dst.Type.Elem()} [int64(sz)] dst src mem)
@@ -20857,6 +20854,44 @@ func rewriteValuegeneric_OpSelectN(v *Value) bool {
v.AddArg3(dst, src, mem)
return true
}
+ // match: (SelectN [0] call:(StaticLECall {sym} a x))
+ // cond: needRaceCleanup(sym, call) && clobber(call)
+ // result: x
+ for {
+ if auxIntToInt64(v.AuxInt) != 0 {
+ break
+ }
+ call := v_0
+ if call.Op != OpStaticLECall || len(call.Args) != 2 {
+ break
+ }
+ sym := auxToCall(call.Aux)
+ x := call.Args[1]
+ if !(needRaceCleanup(sym, call) && clobber(call)) {
+ break
+ }
+ v.copyOf(x)
+ return true
+ }
+ // match: (SelectN [0] call:(StaticLECall {sym} x))
+ // cond: needRaceCleanup(sym, call) && clobber(call)
+ // result: x
+ for {
+ if auxIntToInt64(v.AuxInt) != 0 {
+ break
+ }
+ call := v_0
+ if call.Op != OpStaticLECall || len(call.Args) != 1 {
+ break
+ }
+ sym := auxToCall(call.Aux)
+ x := call.Args[0]
+ if !(needRaceCleanup(sym, call) && clobber(call)) {
+ break
+ }
+ v.copyOf(x)
+ return true
+ }
return false
}
func rewriteValuegeneric_OpSignExt16to32(v *Value) bool {
@@ -21307,98 +21342,6 @@ func rewriteValuegeneric_OpSqrt(v *Value) bool {
}
return false
}
-func rewriteValuegeneric_OpStaticCall(v *Value) bool {
- v_0 := v.Args[0]
- b := v.Block
- config := b.Func.Config
- // match: (StaticCall {sym} s1:(Store _ (Const64 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))
- // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3)
- // result: (Move {t.Elem()} [int64(sz)] dst src mem)
- for {
- sym := auxToCall(v.Aux)
- s1 := v_0
- if s1.Op != OpStore {
- break
- }
- _ = s1.Args[2]
- s1_1 := s1.Args[1]
- if s1_1.Op != OpConst64 {
- break
- }
- sz := auxIntToInt64(s1_1.AuxInt)
- s2 := s1.Args[2]
- if s2.Op != OpStore {
- break
- }
- _ = s2.Args[2]
- src := s2.Args[1]
- s3 := s2.Args[2]
- if s3.Op != OpStore {
- break
- }
- t := auxToType(s3.Aux)
- mem := s3.Args[2]
- dst := s3.Args[1]
- if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3)) {
- break
- }
- v.reset(OpMove)
- v.AuxInt = int64ToAuxInt(int64(sz))
- v.Aux = typeToAux(t.Elem())
- v.AddArg3(dst, src, mem)
- return true
- }
- // match: (StaticCall {sym} s1:(Store _ (Const32 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))
- // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3)
- // result: (Move {t.Elem()} [int64(sz)] dst src mem)
- for {
- sym := auxToCall(v.Aux)
- s1 := v_0
- if s1.Op != OpStore {
- break
- }
- _ = s1.Args[2]
- s1_1 := s1.Args[1]
- if s1_1.Op != OpConst32 {
- break
- }
- sz := auxIntToInt32(s1_1.AuxInt)
- s2 := s1.Args[2]
- if s2.Op != OpStore {
- break
- }
- _ = s2.Args[2]
- src := s2.Args[1]
- s3 := s2.Args[2]
- if s3.Op != OpStore {
- break
- }
- t := auxToType(s3.Aux)
- mem := s3.Args[2]
- dst := s3.Args[1]
- if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && t.IsPtr() && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, int64(sz), config) && clobber(s1, s2, s3)) {
- break
- }
- v.reset(OpMove)
- v.AuxInt = int64ToAuxInt(int64(sz))
- v.Aux = typeToAux(t.Elem())
- v.AddArg3(dst, src, mem)
- return true
- }
- // match: (StaticCall {sym} x)
- // cond: needRaceCleanup(sym, v)
- // result: x
- for {
- sym := auxToCall(v.Aux)
- x := v_0
- if !(needRaceCleanup(sym, v)) {
- break
- }
- v.copyOf(x)
- return true
- }
- return false
-}
func rewriteValuegeneric_OpStaticLECall(v *Value) bool {
b := v.Block
typ := &b.Func.Config.Types
@@ -21442,7 +21385,6 @@ func rewriteValuegeneric_OpStore(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
- config := b.Func.Config
fe := b.Func.fe
// match: (Store {t1} p1 (Load <t2> p2 mem) mem)
// cond: isSamePtr(p1, p2) && t2.Size() == t1.Size()
@@ -21890,58 +21832,6 @@ func rewriteValuegeneric_OpStore(v *Value) bool {
v.AddArg3(dst, e, mem)
return true
}
- // match: (Store (Load (OffPtr [c] (SP)) mem) x mem)
- // cond: isConstZero(x) && mem.Op == OpStaticCall && isSameCall(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.RegSize
- // result: mem
- for {
- if v_0.Op != OpLoad {
- break
- }
- mem := v_0.Args[1]
- v_0_0 := v_0.Args[0]
- if v_0_0.Op != OpOffPtr {
- break
- }
- c := auxIntToInt64(v_0_0.AuxInt)
- v_0_0_0 := v_0_0.Args[0]
- if v_0_0_0.Op != OpSP {
- break
- }
- x := v_1
- if mem != v_2 || !(isConstZero(x) && mem.Op == OpStaticCall && isSameCall(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.RegSize) {
- break
- }
- v.copyOf(mem)
- return true
- }
- // match: (Store (OffPtr (Load (OffPtr [c] (SP)) mem)) x mem)
- // cond: isConstZero(x) && mem.Op == OpStaticCall && isSameCall(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.RegSize
- // result: mem
- for {
- if v_0.Op != OpOffPtr {
- break
- }
- v_0_0 := v_0.Args[0]
- if v_0_0.Op != OpLoad {
- break
- }
- mem := v_0_0.Args[1]
- v_0_0_0 := v_0_0.Args[0]
- if v_0_0_0.Op != OpOffPtr {
- break
- }
- c := auxIntToInt64(v_0_0_0.AuxInt)
- v_0_0_0_0 := v_0_0_0.Args[0]
- if v_0_0_0_0.Op != OpSP {
- break
- }
- x := v_1
- if mem != v_2 || !(isConstZero(x) && mem.Op == OpStaticCall && isSameCall(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.RegSize) {
- break
- }
- v.copyOf(mem)
- return true
- }
// match: (Store (SelectN [0] call:(StaticLECall _ _)) x mem:(SelectN [1] call))
// cond: isConstZero(x) && isSameCall(call.Aux, "runtime.newobject")
// result: mem
@@ -24660,27 +24550,6 @@ func rewriteValuegeneric_OpZero(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
b := v.Block
- config := b.Func.Config
- // match: (Zero (Load (OffPtr [c] (SP)) mem) mem)
- // cond: mem.Op == OpStaticCall && isSameCall(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize() + config.RegSize
- // result: mem
- for {
- if v_0.Op != OpLoad {
- break
- }
- mem := v_0.Args[1]
- v_0_0 := v_0.Args[0]
- if v_0_0.Op != OpOffPtr {
- break
- }
- c := auxIntToInt64(v_0_0.AuxInt)
- v_0_0_0 := v_0_0.Args[0]
- if v_0_0_0.Op != OpSP || mem != v_1 || !(mem.Op == OpStaticCall && isSameCall(mem.Aux, "runtime.newobject") && c == config.ctxt.FixedFrameSize()+config.RegSize) {
- break
- }
- v.copyOf(mem)
- return true
- }
// match: (Zero (SelectN [0] call:(StaticLECall _ _)) mem:(SelectN [1] call))
// cond: isSameCall(call.Aux, "runtime.newobject")
// result: mem
diff --git a/src/cmd/compile/internal/ssa/schedule.go b/src/cmd/compile/internal/ssa/schedule.go
index 8facb91100..c987647131 100644
--- a/src/cmd/compile/internal/ssa/schedule.go
+++ b/src/cmd/compile/internal/ssa/schedule.go
@@ -137,7 +137,7 @@ func schedule(f *Func) {
case v.Op == OpVarDef:
// We want all the vardefs next.
score[v.ID] = ScoreVarDef
- case v.Op == OpArg:
+ case v.Op == OpArg || v.Op == OpArgIntReg || v.Op == OpArgFloatReg:
// We want all the args as early as possible, for better debugging.
score[v.ID] = ScoreArg
case v.Type.IsMemory():
@@ -145,7 +145,7 @@ func schedule(f *Func) {
// reduce register pressure. It also helps make sure
// VARDEF ops are scheduled before the corresponding LEA.
score[v.ID] = ScoreMemory
- case v.Op == OpSelect0 || v.Op == OpSelect1:
+ case v.Op == OpSelect0 || v.Op == OpSelect1 || v.Op == OpSelectN:
// Schedule the pseudo-op of reading part of a tuple
// immediately after the tuple-generating op, since
// this value is already live. This also removes its
@@ -270,6 +270,20 @@ func schedule(f *Func) {
tuples[v.Args[0].ID] = make([]*Value, 2)
}
tuples[v.Args[0].ID][1] = v
+ case v.Op == OpSelectN:
+ if tuples[v.Args[0].ID] == nil {
+ tuples[v.Args[0].ID] = make([]*Value, v.Args[0].Type.NumFields())
+ }
+ tuples[v.Args[0].ID][v.AuxInt] = v
+ case v.Type.IsResults() && tuples[v.ID] != nil:
+ tup := tuples[v.ID]
+ for i := len(tup) - 1; i >= 0; i-- {
+ if tup[i] != nil {
+ order = append(order, tup[i])
+ }
+ }
+ delete(tuples, v.ID)
+ order = append(order, v)
case v.Type.IsTuple() && tuples[v.ID] != nil:
if tuples[v.ID][1] != nil {
order = append(order, tuples[v.ID][1])
diff --git a/src/cmd/compile/internal/ssa/shortcircuit.go b/src/cmd/compile/internal/ssa/shortcircuit.go
index 7b4ee2e81c..c72c86a67e 100644
--- a/src/cmd/compile/internal/ssa/shortcircuit.go
+++ b/src/cmd/compile/internal/ssa/shortcircuit.go
@@ -266,6 +266,13 @@ func shortcircuitPhiPlan(b *Block, ctl *Value, cidx int, ti int64) func(*Value,
// u is the "untaken" branch: the successor we never go to when coming in from p.
u := b.Succs[1^ti].b
+ // In the following CFG matching, ensure that b's preds are entirely distinct from b's succs.
+ // This is probably a stronger condition than required, but this happens extremely rarely,
+ // and it makes it easier to avoid getting deceived by pretty ASCII charts. See #44465.
+ if p0, p1 := b.Preds[0].b, b.Preds[1].b; p0 == t || p1 == t || p0 == u || p1 == u {
+ return nil
+ }
+
// Look for some common CFG structures
// in which the outbound paths from b merge,
// with no other preds joining them.
diff --git a/src/cmd/compile/internal/ssa/stackalloc.go b/src/cmd/compile/internal/ssa/stackalloc.go
index 68a6f08a2a..041e7855f6 100644
--- a/src/cmd/compile/internal/ssa/stackalloc.go
+++ b/src/cmd/compile/internal/ssa/stackalloc.go
@@ -151,13 +151,24 @@ func (s *stackAllocState) stackalloc() {
// Allocate args to their assigned locations.
for _, v := range f.Entry.Values {
- if v.Op != OpArg {
+ if v.Op != OpArg { // && v.Op != OpArgFReg && v.Op != OpArgIReg {
continue
}
if v.Aux == nil {
f.Fatalf("%s has nil Aux\n", v.LongString())
}
- loc := LocalSlot{N: v.Aux.(*ir.Name), Type: v.Type, Off: v.AuxInt}
+ var loc LocalSlot
+ var name *ir.Name
+ var offset int64
+ if v.Op == OpArg {
+ name = v.Aux.(*ir.Name)
+ offset = v.AuxInt
+ } else {
+ nameOff := v.Aux.(*AuxNameOffset)
+ name = nameOff.Name
+ offset = nameOff.Offset
+ }
+ loc = LocalSlot{N: name, Type: v.Type, Off: offset}
if f.pass.debug > stackDebug {
fmt.Printf("stackalloc %s to %s\n", v, loc)
}
diff --git a/src/cmd/compile/internal/ssa/tighten.go b/src/cmd/compile/internal/ssa/tighten.go
index 5dfc453649..214bf628bd 100644
--- a/src/cmd/compile/internal/ssa/tighten.go
+++ b/src/cmd/compile/internal/ssa/tighten.go
@@ -18,10 +18,11 @@ func tighten(f *Func) {
continue
}
switch v.Op {
- case OpPhi, OpArg, OpSelect0, OpSelect1:
+ case OpPhi, OpArg, OpArgIntReg, OpArgFloatReg, OpSelect0, OpSelect1, OpSelectN:
// Phis need to stay in their block.
// Arg must stay in the entry block.
// Tuple selectors must stay with the tuple generator.
+ // SelectN is typically, ultimately, a register.
continue
}
if v.MemoryArg() != nil {
diff --git a/src/cmd/compile/internal/ssa/tuple.go b/src/cmd/compile/internal/ssa/tuple.go
index 38deabf83d..289df40431 100644
--- a/src/cmd/compile/internal/ssa/tuple.go
+++ b/src/cmd/compile/internal/ssa/tuple.go
@@ -4,8 +4,8 @@
package ssa
-// tightenTupleSelectors ensures that tuple selectors (Select0 and
-// Select1 ops) are in the same block as their tuple generator. The
+// tightenTupleSelectors ensures that tuple selectors (Select0, Select1,
+// and SelectN ops) are in the same block as their tuple generator. The
// function also ensures that there are no duplicate tuple selectors.
// These properties are expected by the scheduler but may not have
// been maintained by the optimization pipeline up to this point.
@@ -13,28 +13,40 @@ package ssa
// See issues 16741 and 39472.
func tightenTupleSelectors(f *Func) {
selectors := make(map[struct {
- id ID
- op Op
+ id ID
+ which int
}]*Value)
for _, b := range f.Blocks {
for _, selector := range b.Values {
- if selector.Op != OpSelect0 && selector.Op != OpSelect1 {
+ // Key fields for de-duplication
+ var tuple *Value
+ idx := 0
+ switch selector.Op {
+ default:
continue
- }
-
- // Get the tuple generator to use as a key for de-duplication.
- tuple := selector.Args[0]
- if !tuple.Type.IsTuple() {
- f.Fatalf("arg of tuple selector %s is not a tuple: %s", selector.String(), tuple.LongString())
+ case OpSelect1:
+ idx = 1
+ fallthrough
+ case OpSelect0:
+ tuple = selector.Args[0]
+ if !tuple.Type.IsTuple() {
+ f.Fatalf("arg of tuple selector %s is not a tuple: %s", selector.String(), tuple.LongString())
+ }
+ case OpSelectN:
+ tuple = selector.Args[0]
+ idx = int(selector.AuxInt)
+ if !tuple.Type.IsResults() {
+ f.Fatalf("arg of result selector %s is not a results: %s", selector.String(), tuple.LongString())
+ }
}
// If there is a pre-existing selector in the target block then
// use that. Do this even if the selector is already in the
// target block to avoid duplicate tuple selectors.
key := struct {
- id ID
- op Op
- }{tuple.ID, selector.Op}
+ id ID
+ which int
+ }{tuple.ID, idx}
if t := selectors[key]; t != nil {
if selector != t {
selector.copyOf(t)
diff --git a/src/cmd/compile/internal/ssa/value.go b/src/cmd/compile/internal/ssa/value.go
index d000b7cce0..127e4ce641 100644
--- a/src/cmd/compile/internal/ssa/value.go
+++ b/src/cmd/compile/internal/ssa/value.go
@@ -78,7 +78,7 @@ func (v *Value) String() string {
}
func (v *Value) AuxInt8() int8 {
- if opcodeTable[v.Op].auxType != auxInt8 {
+ if opcodeTable[v.Op].auxType != auxInt8 && opcodeTable[v.Op].auxType != auxNameOffsetInt8 {
v.Fatalf("op %s doesn't have an int8 aux field", v.Op)
}
return int8(v.AuxInt)
@@ -411,6 +411,23 @@ func (v *Value) isGenericIntConst() bool {
return v != nil && (v.Op == OpConst64 || v.Op == OpConst32 || v.Op == OpConst16 || v.Op == OpConst8)
}
+// ResultReg returns the result register assigned to v, in cmd/internal/obj/$ARCH numbering.
+// It is similar to Reg and Reg0, except that it is usable interchangeably for all Value Ops.
+// If you know v.Op, using Reg or Reg0 (as appropriate) will be more efficient.
+func (v *Value) ResultReg() int16 {
+ reg := v.Block.Func.RegAlloc[v.ID]
+ if reg == nil {
+ v.Fatalf("nil reg for value: %s\n%s\n", v.LongString(), v.Block.Func)
+ }
+ if pair, ok := reg.(LocPair); ok {
+ reg = pair[0]
+ }
+ if reg == nil {
+ v.Fatalf("nil reg0 for value: %s\n%s\n", v.LongString(), v.Block.Func)
+ }
+ return reg.(*Register).objNum
+}
+
// Reg returns the register assigned to v, in cmd/internal/obj/$ARCH numbering.
func (v *Value) Reg() int16 {
reg := v.Block.Func.RegAlloc[v.ID]
@@ -484,7 +501,7 @@ func (v *Value) removeable() bool {
if v.Type.IsMemory() {
// All memory ops aren't needed here, but we do need
// to keep calls at least (because they might have
- // syncronization operations we can't see).
+ // synchronization operations we can't see).
return false
}
if v.Op.HasSideEffects() {
diff --git a/src/cmd/compile/internal/ssa/writebarrier.go b/src/cmd/compile/internal/ssa/writebarrier.go
index 4378f2d627..0af039577f 100644
--- a/src/cmd/compile/internal/ssa/writebarrier.go
+++ b/src/cmd/compile/internal/ssa/writebarrier.go
@@ -487,12 +487,14 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
off := config.ctxt.FixedFrameSize()
var ACArgs []Param
+ var argTypes []*types.Type
if typ != nil { // for typedmemmove
taddr := b.NewValue1A(pos, OpAddr, b.Func.Config.Types.Uintptr, typ, sb)
off = round(off, taddr.Type.Alignment())
arg := b.NewValue1I(pos, OpOffPtr, taddr.Type.PtrTo(), off, sp)
mem = b.NewValue3A(pos, OpStore, types.TypeMem, ptr.Type, arg, taddr, mem)
ACArgs = append(ACArgs, Param{Type: b.Func.Config.Types.Uintptr, Offset: int32(off)})
+ argTypes = append(argTypes, b.Func.Config.Types.Uintptr)
off += taddr.Type.Size()
}
@@ -500,6 +502,7 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
arg := b.NewValue1I(pos, OpOffPtr, ptr.Type.PtrTo(), off, sp)
mem = b.NewValue3A(pos, OpStore, types.TypeMem, ptr.Type, arg, ptr, mem)
ACArgs = append(ACArgs, Param{Type: ptr.Type, Offset: int32(off)})
+ argTypes = append(argTypes, ptr.Type)
off += ptr.Type.Size()
if val != nil {
@@ -507,14 +510,15 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
arg = b.NewValue1I(pos, OpOffPtr, val.Type.PtrTo(), off, sp)
mem = b.NewValue3A(pos, OpStore, types.TypeMem, val.Type, arg, val, mem)
ACArgs = append(ACArgs, Param{Type: val.Type, Offset: int32(off)})
+ argTypes = append(argTypes, val.Type)
off += val.Type.Size()
}
off = round(off, config.PtrSize)
// issue call
- mem = b.NewValue1A(pos, OpStaticCall, types.TypeMem, StaticAuxCall(fn, ACArgs, nil), mem)
+ mem = b.NewValue1A(pos, OpStaticCall, types.TypeResultMem, StaticAuxCall(fn, ACArgs, nil, b.Func.ABIDefault.ABIAnalyzeTypes(nil, argTypes, nil)), mem)
mem.AuxInt = off - config.ctxt.FixedFrameSize()
- return mem
+ return b.NewValue1I(pos, OpSelectN, types.TypeMem, 0, mem)
}
// round to a multiple of r, r is a power of 2
@@ -562,12 +566,20 @@ func IsReadOnlyGlobalAddr(v *Value) bool {
// IsNewObject reports whether v is a pointer to a freshly allocated & zeroed object at memory state mem.
func IsNewObject(v *Value, mem *Value) bool {
+ // TODO this will need updating for register args; the OpLoad is wrong.
if v.Op != OpLoad {
return false
}
if v.MemoryArg() != mem {
return false
}
+ if mem.Op != OpSelectN {
+ return false
+ }
+ if mem.Type != types.TypeMem {
+ return false
+ } // assume it is the right selection if true
+ mem = mem.Args[0]
if mem.Op != OpStaticCall {
return false
}
diff --git a/src/cmd/compile/internal/ssagen/abi.go b/src/cmd/compile/internal/ssagen/abi.go
index 5bebce1db5..7180b3816c 100644
--- a/src/cmd/compile/internal/ssagen/abi.go
+++ b/src/cmd/compile/internal/ssagen/abi.go
@@ -300,9 +300,20 @@ func makeABIWrapper(f *ir.Func, wrapperABI obj.ABI) {
// to allocate any stack space). Doing this will require some
// extra work in typecheck/walk/ssa, might want to add a new node
// OTAILCALL or something to this effect.
- var tail ir.Node
- if tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 && !(base.Ctxt.Arch.Name == "ppc64le" && base.Ctxt.Flag_dynlink) {
+ tailcall := tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0
+ if base.Ctxt.Arch.Name == "ppc64le" && base.Ctxt.Flag_dynlink {
+ // cannot tailcall on PPC64 with dynamic linking, as we need
+ // to restore R2 after call.
+ tailcall = false
+ }
+ if base.Ctxt.Arch.Name == "amd64" && wrapperABI == obj.ABIInternal {
+ // cannot tailcall from ABIInternal to ABI0 on AMD64, as we need
+ // to special registers (X15) when returning to ABIInternal.
+ tailcall = false
+ }
+ var tail ir.Node
+ if tailcall {
tail = ir.NewTailCallStmt(base.Pos, f.Nname)
} else {
call := ir.NewCallExpr(base.Pos, ir.OCALL, f.Nname, nil)
diff --git a/src/cmd/compile/internal/ssagen/pgen.go b/src/cmd/compile/internal/ssagen/pgen.go
index 182f8408cf..b675d1c876 100644
--- a/src/cmd/compile/internal/ssagen/pgen.go
+++ b/src/cmd/compile/internal/ssagen/pgen.go
@@ -15,7 +15,6 @@ import (
"cmd/compile/internal/ir"
"cmd/compile/internal/objw"
"cmd/compile/internal/ssa"
- "cmd/compile/internal/typecheck"
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/objabi"
@@ -90,7 +89,6 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
}
}
- scratchUsed := false
for _, b := range f.Blocks {
for _, v := range b.Values {
if n, ok := v.Aux.(*ir.Name); ok {
@@ -104,17 +102,9 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
n.SetUsed(true)
}
}
- if !scratchUsed {
- scratchUsed = v.Op.UsesScratch()
- }
-
}
}
- if f.Config.NeedsFpScratch && scratchUsed {
- s.scratchFpMem = typecheck.TempAt(src.NoXPos, s.curfn, types.Types[types.TUINT64])
- }
-
sort.Sort(byStackVar(fn.Dcl))
// Reassign stack offsets of the locals that are used.
@@ -148,7 +138,7 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
} else {
lastHasPtr = false
}
- if Arch.LinkArch.InFamily(sys.MIPS, sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) {
+ if Arch.LinkArch.InFamily(sys.ARM, sys.ARM64, sys.PPC64) {
s.stksize = types.Rnd(s.stksize, int64(types.PtrSize))
}
n.SetFrameOffset(-s.stksize)
@@ -213,8 +203,7 @@ func StackOffset(slot ssa.LocalSlot) int32 {
if base.Ctxt.FixedFrameSize() == 0 {
off -= int64(types.PtrSize)
}
- if objabi.Framepointer_enabled || objabi.GOARCH == "arm64" {
- // There is a word space for FP on ARM64 even if the frame pointer is disabled
+ if objabi.Framepointer_enabled {
off -= int64(types.PtrSize)
}
case ir.PPARAM, ir.PPARAMOUT:
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index b042c132d5..05dd0c62a9 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -7,6 +7,7 @@ package ssagen
import (
"bufio"
"bytes"
+ "cmd/compile/internal/abi"
"encoding/binary"
"fmt"
"go/constant"
@@ -208,6 +209,32 @@ func InitConfig() {
ir.Syms.SigPanic = typecheck.LookupRuntimeFunc("sigpanic")
}
+// AbiForFunc returns the ABI for a function, used to figure out arg/result mapping for rtcall and bodyless functions.
+// This follows policy for GOEXPERIMENT=regabi, //go:registerparams, and currently defined ABIInternal.
+// Policy is subject to change....
+// This always returns a freshly copied ABI.
+func AbiForFunc(fn *ir.Func) *abi.ABIConfig {
+ return abiForFunc(fn, ssaConfig.ABI0, ssaConfig.ABI1).Copy() // No idea what races will result, be safe
+}
+
+// abiForFunc implements ABI policy for a function, but does not return a copy of the ABI.
+// Passing a nil function returns ABIInternal.
+func abiForFunc(fn *ir.Func, abi0, abi1 *abi.ABIConfig) *abi.ABIConfig {
+ a := abi1
+ if true || objabi.Regabi_enabled == 0 {
+ a = abi0
+ }
+ if fn != nil && fn.Pragma&ir.RegisterParams != 0 { // TODO(register args) remove after register abi is working
+ name := ir.FuncName(fn)
+ if strings.Contains(name, ".") {
+ base.ErrorfAt(fn.Pos(), "Calls to //go:registerparams method %s won't work, remove the pragma from the declaration.", name)
+ }
+ a = abi1
+ base.WarnfAt(fn.Pos(), "declared function %v has register params", fn)
+ }
+ return a
+}
+
// getParam returns the Field of ith param of node n (which is a
// function/method/interface call), where the receiver of a method call is
// considered as the 0th parameter. This does not include the receiver of an
@@ -274,7 +301,7 @@ func (s *state) emitOpenDeferInfo() {
var maxargsize int64
for i := len(s.openDefers) - 1; i >= 0; i-- {
r := s.openDefers[i]
- argsize := r.n.X.Type().ArgWidth()
+ argsize := r.n.X.Type().ArgWidth() // TODO register args: but maybe use of abi0 will make this easy
if argsize > maxargsize {
maxargsize = argsize
}
@@ -297,19 +324,30 @@ func (s *state) emitOpenDeferInfo() {
}
off = dvarint(x, off, int64(numArgs))
if r.rcvrNode != nil {
- off = dvarint(x, off, -r.rcvrNode.FrameOffset())
+ off = dvarint(x, off, -okOffset(r.rcvrNode.FrameOffset()))
off = dvarint(x, off, s.config.PtrSize)
- off = dvarint(x, off, 0)
+ off = dvarint(x, off, 0) // This is okay because defer records use ABI0 (for now)
}
+
+ // TODO(register args) assume abi0 for this?
+ ab := s.f.ABI0
+ pri := ab.ABIAnalyzeFuncType(r.n.X.Type().FuncType())
for j, arg := range r.argNodes {
f := getParam(r.n, j)
- off = dvarint(x, off, -arg.FrameOffset())
+ off = dvarint(x, off, -okOffset(arg.FrameOffset()))
off = dvarint(x, off, f.Type.Size())
- off = dvarint(x, off, f.Offset)
+ off = dvarint(x, off, okOffset(pri.InParam(j).FrameOffset(pri))-ab.LocalsOffset()) // defer does not want the fixed frame adjustment
}
}
}
+func okOffset(offset int64) int64 {
+ if offset >= types.BOGUS_FUNARG_OFFSET {
+ panic(fmt.Errorf("Bogus offset %d", offset))
+ }
+ return offset
+}
+
// buildssa builds an SSA function for fn.
// worker indicates which of the backend workers is doing the processing.
func buildssa(fn *ir.Func, worker int) *ssa.Func {
@@ -357,12 +395,10 @@ func buildssa(fn *ir.Func, worker int) *ssa.Func {
if fn.Pragma&ir.Nosplit != 0 {
s.f.NoSplit = true
}
- if fn.Pragma&ir.RegisterParams != 0 { // TODO remove after register abi is working
- if strings.Contains(name, ".") {
- base.ErrorfAt(fn.Pos(), "Calls to //go:registerparams method %s won't work, remove the pragma from the declaration.", name)
- }
- s.f.Warnl(fn.Pos(), "declared function %v has register params", fn)
- }
+ s.f.ABI0 = ssaConfig.ABI0.Copy() // Make a copy to avoid racy map operations in type-register-width cache.
+ s.f.ABI1 = ssaConfig.ABI1.Copy()
+ s.f.ABIDefault = abiForFunc(nil, s.f.ABI0, s.f.ABI1)
+ s.f.ABISelf = abiForFunc(fn, s.f.ABI0, s.f.ABI1)
s.panics = map[funcLine]*ssa.Block{}
s.softFloat = s.config.SoftFloat
@@ -449,18 +485,20 @@ func buildssa(fn *ir.Func, worker int) *ssa.Func {
s.vars[memVar] = s.newValue1Apos(ssa.OpVarLive, types.TypeMem, deferBitsTemp, s.mem(), false)
}
+ var params *abi.ABIParamResultInfo
+ params = s.f.ABISelf.ABIAnalyze(fn.Type())
+
// Generate addresses of local declarations
s.decladdrs = map[*ir.Name]*ssa.Value{}
- var args []ssa.Param
var results []ssa.Param
for _, n := range fn.Dcl {
switch n.Class {
case ir.PPARAM:
+ // Be aware that blank and unnamed input parameters will not appear here, but do appear in the type
s.decladdrs[n] = s.entryNewValue2A(ssa.OpLocalAddr, types.NewPtr(n.Type()), n, s.sp, s.startmem)
- args = append(args, ssa.Param{Type: n.Type(), Offset: int32(n.FrameOffset())})
case ir.PPARAMOUT:
s.decladdrs[n] = s.entryNewValue2A(ssa.OpLocalAddr, types.NewPtr(n.Type()), n, s.sp, s.startmem)
- results = append(results, ssa.Param{Type: n.Type(), Offset: int32(n.FrameOffset()), Name: n})
+ results = append(results, ssa.Param{Name: n})
case ir.PAUTO:
// processed at each use, to prevent Addr coming
// before the decl.
@@ -468,14 +506,65 @@ func buildssa(fn *ir.Func, worker int) *ssa.Func {
s.Fatalf("local variable with class %v unimplemented", n.Class)
}
}
- s.f.OwnAux = ssa.OwnAuxCall(args, results)
+
+ // TODO: figure out why base.Ctxt.FixedFrameSize() is not added to these offsets here (compare to calls).
+ // The input half is ignored unless a register ABI is used.
+ var args []ssa.Param
+ for _, p := range params.InParams() {
+ r := p.Registers
+ var o int32
+ if len(r) == 0 {
+ o = p.Offset()
+ } else {
+ o = p.SpillOffset() + int32(params.SpillAreaOffset())
+ }
+ args = append(args, ssa.Param{Type: p.Type, Offset: o, Reg: r})
+ }
+
+ // For now, need the ir.Name attached to these, so update those already created.
+ for i, p := range params.OutParams() {
+ r := p.Registers
+ var o int32
+ if len(r) == 0 {
+ o = p.Offset()
+ } else {
+ o = types.BADWIDTH
+ }
+ results[i].Type = p.Type
+ results[i].Offset = o
+ results[i].Reg = r
+ }
+
+ s.f.OwnAux = ssa.OwnAuxCall(fn.LSym, args, results, params)
// Populate SSAable arguments.
for _, n := range fn.Dcl {
- if n.Class == ir.PPARAM && s.canSSA(n) {
- v := s.newValue0A(ssa.OpArg, n.Type(), n)
- s.vars[n] = v
- s.addNamedValue(n, v) // This helps with debugging information, not needed for compilation itself.
+ if n.Class == ir.PPARAM {
+ if s.canSSA(n) {
+ var v *ssa.Value
+ if n.Sym().Name == ".fp" {
+ // Race-detector's get-caller-pc incantation is NOT a real Arg.
+ v = s.newValue0(ssa.OpGetCallerPC, n.Type())
+ } else {
+ v = s.newValue0A(ssa.OpArg, n.Type(), n)
+ }
+ s.vars[n] = v
+ s.addNamedValue(n, v) // This helps with debugging information, not needed for compilation itself.
+ } else if !s.canSSAName(n) { // I.e., the address was taken. The type may or may not be okay.
+ // If the value will arrive in registers,
+ // AND if it can be SSA'd (if it cannot, panic for now),
+ // THEN
+ // (1) receive it as an OpArg (but do not store its name in the var table)
+ // (2) store it to its spill location, which is its address as well.
+ paramAssignment := ssa.ParamAssignmentForArgName(s.f, n)
+ if len(paramAssignment.Registers) > 0 {
+ if !TypeOK(n.Type()) { // TODO register args -- if v is not an SSA-able type, must decompose, here.
+ panic(fmt.Errorf("Arg in registers is too big to be SSA'd, need to implement decomposition, type=%v, n=%v", n.Type(), n))
+ }
+ v := s.newValue0A(ssa.OpArg, n.Type(), n)
+ s.store(n.Type(), s.decladdrs[n], v)
+ }
+ }
}
}
@@ -1151,7 +1240,7 @@ func (s *state) instrumentFields(t *types.Type, addr *ssa.Value, kind instrument
if f.Sym.IsBlank() {
continue
}
- offptr := s.newValue1I(ssa.OpOffPtr, types.NewPtr(f.Type), f.Offset, addr)
+ offptr := s.newValue1I(ssa.OpOffPtr, types.NewPtr(f.Type), abi.FieldOffsetOf(f), addr)
s.instrumentFields(f.Type, offptr, kind)
}
}
@@ -1846,7 +1935,7 @@ func (s *state) exit() *ssa.Block {
}
// Run exit code. Today, this is just racefuncexit, in -race mode.
- // TODO this seems risky here with a register-ABI, but not clear it is right to do it earlier either.
+ // TODO(register args) this seems risky here with a register-ABI, but not clear it is right to do it earlier either.
// Spills in register allocation might just fix it.
s.stmtList(s.curfn.Exit)
@@ -2862,15 +2951,11 @@ func (s *state) expr(n ir.Node) *ssa.Value {
case ir.ORESULT:
n := n.(*ir.ResultExpr)
if s.prevCall == nil || s.prevCall.Op != ssa.OpStaticLECall && s.prevCall.Op != ssa.OpInterLECall && s.prevCall.Op != ssa.OpClosureLECall {
- // Do the old thing
- addr := s.constOffPtrSP(types.NewPtr(n.Type()), n.Offset)
- return s.rawLoad(n.Type(), addr)
+ panic("Expected to see a previous call")
}
- which := s.prevCall.Aux.(*ssa.AuxCall).ResultForOffset(n.Offset)
+ which := n.Index
if which == -1 {
- // Do the old thing // TODO: Panic instead.
- addr := s.constOffPtrSP(types.NewPtr(n.Type()), n.Offset)
- return s.rawLoad(n.Type(), addr)
+ panic(fmt.Errorf("ORESULT %v does not match call %s", n, s.prevCall))
}
if TypeOK(n.Type()) {
return s.newValue1I(ssa.OpSelectN, n.Type(), which, s.prevCall)
@@ -4674,7 +4759,7 @@ func (s *state) openDeferExit() {
}
for j, argAddrVal := range r.argVals {
f := getParam(r.n, j)
- ACArgs = append(ACArgs, ssa.Param{Type: f.Type, Offset: int32(argStart + f.Offset)})
+ ACArgs = append(ACArgs, ssa.Param{Type: f.Type, Offset: int32(argStart + abi.FieldOffsetOf(f))})
var a *ssa.Value
if !TypeOK(f.Type) {
a = s.newValue2(ssa.OpDereference, f.Type, argAddrVal, s.mem())
@@ -4688,10 +4773,11 @@ func (s *state) openDeferExit() {
v := s.load(r.closure.Type.Elem(), r.closure)
s.maybeNilCheckClosure(v, callDefer)
codeptr := s.rawLoad(types.Types[types.TUINTPTR], v)
- aux := ssa.ClosureAuxCall(ACArgs, ACResults)
+ aux := ssa.ClosureAuxCall(ACArgs, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue2A(ssa.OpClosureLECall, aux.LateExpansionResultType(), aux, codeptr, v)
} else {
- aux := ssa.StaticAuxCall(fn.(*ir.Name).Linksym(), ACArgs, ACResults)
+ aux := ssa.StaticAuxCall(fn.(*ir.Name).Linksym(), ACArgs, ACResults,
+ s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
}
callArgs = append(callArgs, s.mem())
@@ -4738,18 +4824,9 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
var codeptr *ssa.Value // ptr to target code (if dynamic)
var rcvr *ssa.Value // receiver to set
fn := n.X
- var ACArgs []ssa.Param
- var ACResults []ssa.Param
- var callArgs []*ssa.Value
- res := n.X.Type().Results()
- if k == callNormal {
- nf := res.NumFields()
- for i := 0; i < nf; i++ {
- fp := res.Field(i)
- ACResults = append(ACResults, ssa.Param{Type: fp.Type, Offset: int32(fp.Offset + base.Ctxt.FixedFrameSize())})
- }
- }
-
+ var ACArgs []ssa.Param // AuxCall args
+ var ACResults []ssa.Param // AuxCall results
+ var callArgs []*ssa.Value // For late-expansion, the args themselves (not stored, args to the call instead).
inRegisters := false
switch n.Op() {
@@ -4757,7 +4834,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
if k == callNormal && fn.Op() == ir.ONAME && fn.(*ir.Name).Class == ir.PFUNC {
fn := fn.(*ir.Name)
callee = fn
- // TODO remove after register abi is working
+ // TODO(register args) remove after register abi is working
inRegistersImported := fn.Pragma()&ir.RegisterParams != 0
inRegistersSamePackage := fn.Func != nil && fn.Func.Pragma&ir.RegisterParams != 0
inRegisters = inRegistersImported || inRegistersSamePackage
@@ -4790,6 +4867,27 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
types.CalcSize(fn.Type())
stksize := fn.Type().ArgWidth() // includes receiver, args, and results
+ callABI := s.f.ABI1
+ if !inRegisters {
+ callABI = s.f.ABI0
+ }
+
+ params := callABI.ABIAnalyze(n.X.Type())
+
+ res := n.X.Type().Results()
+ if k == callNormal {
+ for _, p := range params.OutParams() {
+ r := p.Registers
+ var o int32
+ if len(r) == 0 {
+ o = p.Offset()
+ } else {
+ o = p.SpillOffset() + int32(params.SpillAreaOffset())
+ }
+ ACResults = append(ACResults, ssa.Param{Type: p.Type, Offset: o, Reg: r})
+ }
+ }
+
var call *ssa.Value
if k == callDeferStack {
// Make a defer struct d on the stack.
@@ -4821,7 +4919,7 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// Then, store all the arguments of the defer call.
ft := fn.Type()
- off := t.FieldOff(12)
+ off := t.FieldOff(12) // TODO register args: be sure this isn't a hardcoded param stack offset.
args := n.Args
// Set receiver (for interface calls). Always a pointer.
@@ -4835,20 +4933,21 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
}
// Set other args.
for _, f := range ft.Params().Fields().Slice() {
- s.storeArgWithBase(args[0], f.Type, addr, off+f.Offset)
+ s.storeArgWithBase(args[0], f.Type, addr, off+abi.FieldOffsetOf(f))
args = args[1:]
}
// Call runtime.deferprocStack with pointer to _defer record.
ACArgs = append(ACArgs, ssa.Param{Type: types.Types[types.TUINTPTR], Offset: int32(base.Ctxt.FixedFrameSize())})
- aux := ssa.StaticAuxCall(ir.Syms.DeferprocStack, ACArgs, ACResults)
+ aux := ssa.StaticAuxCall(ir.Syms.DeferprocStack, ACArgs, ACResults,
+ s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
callArgs = append(callArgs, addr, s.mem())
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
call.AddArgs(callArgs...)
if stksize < int64(types.PtrSize) {
// We need room for both the call to deferprocStack and the call to
// the deferred function.
- // TODO Revisit this if/when we pass args in registers.
+ // TODO(register args) Revisit this if/when we pass args in registers.
stksize = int64(types.PtrSize)
}
call.AuxInt = stksize
@@ -4856,21 +4955,23 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// Store arguments to stack, including defer/go arguments and receiver for method calls.
// These are written in SP-offset order.
argStart := base.Ctxt.FixedFrameSize()
+ // argExtra is for combining with ABI-derived offsets; argStart is for old ABI0 code (defer, go).
+ argExtra := int32(0) // TODO(register args) untangle this mess when fully transition to abiutils, defer/go sanitized.
// Defer/go args.
if k != callNormal {
// Write argsize and closure (args to newproc/deferproc).
argsize := s.constInt32(types.Types[types.TUINT32], int32(stksize))
- ACArgs = append(ACArgs, ssa.Param{Type: types.Types[types.TUINT32], Offset: int32(argStart)})
+ ACArgs = append(ACArgs, ssa.Param{Type: types.Types[types.TUINT32], Offset: int32(argStart)}) // not argExtra
callArgs = append(callArgs, argsize)
ACArgs = append(ACArgs, ssa.Param{Type: types.Types[types.TUINTPTR], Offset: int32(argStart) + int32(types.PtrSize)})
callArgs = append(callArgs, closure)
stksize += 2 * int64(types.PtrSize)
argStart += 2 * int64(types.PtrSize)
+ argExtra = 2 * int32(types.PtrSize)
}
// Set receiver (for interface calls).
if rcvr != nil {
- ACArgs = append(ACArgs, ssa.Param{Type: types.Types[types.TUINTPTR], Offset: int32(argStart)})
callArgs = append(callArgs, rcvr)
}
@@ -4880,11 +4981,20 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
if n.Op() == ir.OCALLMETH {
base.Fatalf("OCALLMETH missed by walkCall")
}
- for i, n := range args {
- f := t.Params().Field(i)
- ACArg, arg := s.putArg(n, f.Type, argStart+f.Offset)
+
+ for _, p := range params.InParams() { // includes receiver for interface calls
+ r := p.Registers
+ var o int32
+ if len(r) == 0 {
+ o = p.Offset()
+ } else {
+ o = p.SpillOffset() + int32(params.SpillAreaOffset())
+ }
+ ACArg := ssa.Param{Type: p.Type, Offset: argExtra + o, Reg: r} // o from ABI includes any architecture-dependent offsets.
ACArgs = append(ACArgs, ACArg)
- callArgs = append(callArgs, arg)
+ }
+ for i, n := range args {
+ callArgs = append(callArgs, s.putArg(n, t.Params().Field(i).Type))
}
callArgs = append(callArgs, s.mem())
@@ -4892,11 +5002,13 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// call target
switch {
case k == callDefer:
- aux := ssa.StaticAuxCall(ir.Syms.Deferproc, ACArgs, ACResults)
+ aux := ssa.StaticAuxCall(ir.Syms.Deferproc, ACArgs, ACResults,
+ s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults))) // TODO paramResultInfo for DeferProc
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
case k == callGo:
- aux := ssa.StaticAuxCall(ir.Syms.Newproc, ACArgs, ACResults)
- call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
+ aux := ssa.StaticAuxCall(ir.Syms.Newproc, ACArgs, ACResults,
+ s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
+ call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux) // TODO paramResultInfo for NewProc
case closure != nil:
// rawLoad because loading the code pointer from a
// closure is always safe, but IsSanitizerSafeAddr
@@ -4904,13 +5016,14 @@ func (s *state) call(n *ir.CallExpr, k callKind, returnResultAddr bool) *ssa.Val
// critical that we not clobber any arguments already
// stored onto the stack.
codeptr = s.rawLoad(types.Types[types.TUINTPTR], closure)
- aux := ssa.ClosureAuxCall(ACArgs, ACResults)
+ aux := ssa.ClosureAuxCall(ACArgs, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue2A(ssa.OpClosureLECall, aux.LateExpansionResultType(), aux, codeptr, closure)
case codeptr != nil:
- aux := ssa.InterfaceAuxCall(ACArgs, ACResults)
+ // Note that the "receiver" parameter is nil because the actual receiver is the first input parameter.
+ aux := ssa.InterfaceAuxCall(ACArgs, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, ssa.ACParamsToTypes(ACArgs), ssa.ACParamsToTypes(ACResults)))
call = s.newValue1A(ssa.OpInterLECall, aux.LateExpansionResultType(), aux, codeptr)
case callee != nil:
- aux := ssa.StaticAuxCall(callTargetLSym(callee, s.curfn.LSym), ACArgs, ACResults)
+ aux := ssa.StaticAuxCall(callTargetLSym(callee, s.curfn.LSym), ACArgs, ACResults, params)
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
default:
s.Fatalf("bad call type %v %v", n.Op(), n)
@@ -5048,15 +5161,7 @@ func (s *state) addr(n ir.Node) *ssa.Value {
case ir.ORESULT:
// load return from callee
n := n.(*ir.ResultExpr)
- if s.prevCall == nil || s.prevCall.Op != ssa.OpStaticLECall && s.prevCall.Op != ssa.OpInterLECall && s.prevCall.Op != ssa.OpClosureLECall {
- return s.constOffPtrSP(t, n.Offset)
- }
- which := s.prevCall.Aux.(*ssa.AuxCall).ResultForOffset(n.Offset)
- if which == -1 {
- // Do the old thing // TODO: Panic instead.
- return s.constOffPtrSP(t, n.Offset)
- }
- x := s.newValue1I(ssa.OpSelectNAddr, t, which, s.prevCall)
+ x := s.newValue1I(ssa.OpSelectNAddr, t, n.Index, s.prevCall)
return x
case ir.OINDEX:
@@ -5370,6 +5475,7 @@ func (s *state) rtcall(fn *obj.LSym, returns bool, results []*types.Type, args .
var ACArgs []ssa.Param
var ACResults []ssa.Param
var callArgs []*ssa.Value
+ var callArgTypes []*types.Type
for _, arg := range args {
t := arg.Type
@@ -5377,6 +5483,7 @@ func (s *state) rtcall(fn *obj.LSym, returns bool, results []*types.Type, args .
size := t.Size()
ACArgs = append(ACArgs, ssa.Param{Type: t, Offset: int32(off)})
callArgs = append(callArgs, arg)
+ callArgTypes = append(callArgTypes, t)
off += size
}
off = types.Rnd(off, int64(types.RegSize))
@@ -5391,7 +5498,7 @@ func (s *state) rtcall(fn *obj.LSym, returns bool, results []*types.Type, args .
// Issue call
var call *ssa.Value
- aux := ssa.StaticAuxCall(fn, ACArgs, ACResults)
+ aux := ssa.StaticAuxCall(fn, ACArgs, ACResults, s.f.ABIDefault.ABIAnalyzeTypes(nil, callArgTypes, results))
callArgs = append(callArgs, s.mem())
call = s.newValue0A(ssa.OpStaticLECall, aux.LateExpansionResultType(), aux)
call.AddArgs(callArgs...)
@@ -5539,15 +5646,15 @@ func (s *state) storeTypePtrs(t *types.Type, left, right *ssa.Value) {
}
}
-// putArg evaluates n for the purpose of passing it as an argument to a function and returns the corresponding Param and value for the call.
-func (s *state) putArg(n ir.Node, t *types.Type, off int64) (ssa.Param, *ssa.Value) {
+// putArg evaluates n for the purpose of passing it as an argument to a function and returns the value for the call.
+func (s *state) putArg(n ir.Node, t *types.Type) *ssa.Value {
var a *ssa.Value
if !TypeOK(t) {
a = s.newValue2(ssa.OpDereference, t, s.addr(n), s.mem())
} else {
a = s.expr(n)
}
- return ssa.Param{Type: t, Offset: int32(off)}, a
+ return a
}
func (s *state) storeArgWithBase(n ir.Node, t *types.Type, base *ssa.Value, off int64) {
@@ -6075,18 +6182,23 @@ func (s *state) dottype(n *ir.TypeAssertExpr, commaok bool) (res, resok *ssa.Val
if base.Debug.TypeAssert > 0 {
base.WarnfAt(n.Pos(), "type assertion not inlined")
}
- if n.X.Type().IsEmptyInterface() {
- if commaok {
- call := s.rtcall(ir.Syms.AssertE2I2, true, []*types.Type{n.Type(), types.Types[types.TBOOL]}, target, iface)
- return call[0], call[1]
+ if !commaok {
+ fn := ir.Syms.AssertI2I
+ if n.X.Type().IsEmptyInterface() {
+ fn = ir.Syms.AssertE2I
}
- return s.rtcall(ir.Syms.AssertE2I, true, []*types.Type{n.Type()}, target, iface)[0], nil
+ data := s.newValue1(ssa.OpIData, types.Types[types.TUNSAFEPTR], iface)
+ tab := s.newValue1(ssa.OpITab, byteptr, iface)
+ tab = s.rtcall(fn, true, []*types.Type{byteptr}, target, tab)[0]
+ return s.newValue2(ssa.OpIMake, n.Type(), tab, data), nil
}
- if commaok {
- call := s.rtcall(ir.Syms.AssertI2I2, true, []*types.Type{n.Type(), types.Types[types.TBOOL]}, target, iface)
- return call[0], call[1]
+ fn := ir.Syms.AssertI2I2
+ if n.X.Type().IsEmptyInterface() {
+ fn = ir.Syms.AssertE2I2
}
- return s.rtcall(ir.Syms.AssertI2I, true, []*types.Type{n.Type()}, target, iface)[0], nil
+ res = s.rtcall(fn, true, []*types.Type{n.Type()}, target, iface)[0]
+ resok = s.newValue2(ssa.OpNeqInter, types.Types[types.TBOOL], res, s.constInterface(n.Type()))
+ return
}
if base.Debug.TypeAssert > 0 {
@@ -6266,6 +6378,8 @@ type Branch struct {
// State contains state needed during Prog generation.
type State struct {
+ ABI obj.ABI
+
pp *objw.Progs
// Branches remembers all the branch instructions we've seen
@@ -6275,9 +6389,6 @@ type State struct {
// bstart remembers where each block starts (indexed by block ID)
bstart []*obj.Prog
- // Some architectures require a 64-bit temporary for FP-related register shuffling. Examples include PPC and Sparc V8.
- ScratchFpMem *ir.Name
-
maxarg int64 // largest frame size for arguments to calls made by the function
// Map from GC safe points to liveness index, generated by
@@ -6361,6 +6472,7 @@ func (s *State) DebugFriendlySetPosFrom(v *ssa.Value) {
// genssa appends entries to pp for each instruction in f.
func genssa(f *ssa.Func, pp *objw.Progs) {
var s State
+ s.ABI = f.OwnAux.Fn.ABI()
e := f.Frontend().(*ssafn)
@@ -6390,8 +6502,6 @@ func genssa(f *ssa.Func, pp *objw.Progs) {
progToBlock[s.pp.Next] = f.Blocks[0]
}
- s.ScratchFpMem = e.scratchFpMem
-
if base.Ctxt.Flag_locationlists {
if cap(f.Cache.ValueToProgAfter) < f.NumValues() {
f.Cache.ValueToProgAfter = make([]*obj.Prog, f.NumValues())
@@ -6442,14 +6552,20 @@ func genssa(f *ssa.Func, pp *objw.Progs) {
x := s.pp.Next
s.DebugFriendlySetPosFrom(v)
+ if v.Op.ResultInArg0() && v.ResultReg() != v.Args[0].Reg() {
+ v.Fatalf("input[0] and output not in same register %s", v.LongString())
+ }
+
switch v.Op {
case ssa.OpInitMem:
// memory arg needs no code
case ssa.OpArg:
// input args need no code
+ case ssa.OpArgIntReg, ssa.OpArgFloatReg:
+ CheckArgReg(v)
case ssa.OpSP, ssa.OpSB:
// nothing to do
- case ssa.OpSelect0, ssa.OpSelect1:
+ case ssa.OpSelect0, ssa.OpSelect1, ssa.OpSelectN:
// nothing to do
case ssa.OpGetG:
// nothing to do when there's a g register,
@@ -6922,11 +7038,20 @@ func CheckLoweredPhi(v *ssa.Value) {
// That register contains the closure pointer on closure entry.
func CheckLoweredGetClosurePtr(v *ssa.Value) {
entry := v.Block.Func.Entry
+ // TODO register args: not all the register-producing ops can come first.
if entry != v.Block || entry.Values[0] != v {
base.Fatalf("in %s, badly placed LoweredGetClosurePtr: %v %v", v.Block.Func.Name, v.Block, v)
}
}
+// CheckArgReg ensures that v is in the function's entry block.
+func CheckArgReg(v *ssa.Value) {
+ entry := v.Block.Func.Entry
+ if entry != v.Block {
+ base.Fatalf("in %s, badly placed ArgIReg or ArgFReg: %v %v", v.Block.Func.Name, v.Block, v)
+ }
+}
+
func AddrAuto(a *obj.Addr, v *ssa.Value) {
n, off := ssa.AutoVar(v)
a.Type = obj.TYPE_MEM
@@ -6940,17 +7065,6 @@ func AddrAuto(a *obj.Addr, v *ssa.Value) {
}
}
-func (s *State) AddrScratch(a *obj.Addr) {
- if s.ScratchFpMem == nil {
- panic("no scratch memory available; forgot to declare usesScratch for Op?")
- }
- a.Type = obj.TYPE_MEM
- a.Name = obj.NAME_AUTO
- a.Sym = s.ScratchFpMem.Linksym()
- a.Reg = int16(Arch.REGSP)
- a.Offset = s.ScratchFpMem.Offset_
-}
-
// Call returns a new CALL instruction for the SSA value v.
// It uses PrepareCall to prepare the call.
func (s *State) Call(v *ssa.Value) *obj.Prog {
@@ -7053,12 +7167,11 @@ func fieldIdx(n *ir.SelectorExpr) int {
// ssafn holds frontend information about a function that the backend is processing.
// It also exports a bunch of compiler services for the ssa backend.
type ssafn struct {
- curfn *ir.Func
- strings map[string]*obj.LSym // map from constant string to data symbols
- scratchFpMem *ir.Name // temp for floating point register / memory moves on some architectures
- stksize int64 // stack size for current frame
- stkptrsize int64 // prefix of stack containing pointers
- log bool // print ssa debug to the stdout
+ curfn *ir.Func
+ strings map[string]*obj.LSym // map from constant string to data symbols
+ stksize int64 // stack size for current frame
+ stkptrsize int64 // prefix of stack containing pointers
+ log bool // print ssa debug to the stdout
}
// StringData returns a symbol which
diff --git a/src/cmd/compile/internal/test/abiutils_test.go b/src/cmd/compile/internal/test/abiutils_test.go
index decc29667e..9a7d6d138c 100644
--- a/src/cmd/compile/internal/test/abiutils_test.go
+++ b/src/cmd/compile/internal/test/abiutils_test.go
@@ -21,7 +21,7 @@ import (
// AMD64 registers available:
// - integer: RAX, RBX, RCX, RDI, RSI, R8, R9, r10, R11
// - floating point: X0 - X14
-var configAMD64 = abi.NewABIConfig(9, 15)
+var configAMD64 = abi.NewABIConfig(9, 15, 0)
func TestMain(m *testing.M) {
ssagen.Arch.LinkArch = &x86.Linkamd64
@@ -292,4 +292,4 @@ func TestABINumParamRegs(t *testing.T) {
nrtest(t, s, 4)
nrtest(t, a, 12)
-} \ No newline at end of file
+}
diff --git a/src/cmd/compile/internal/test/abiutilsaux_test.go b/src/cmd/compile/internal/test/abiutilsaux_test.go
index bac0c7639d..7eb273273d 100644
--- a/src/cmd/compile/internal/test/abiutilsaux_test.go
+++ b/src/cmd/compile/internal/test/abiutilsaux_test.go
@@ -129,36 +129,4 @@ func abitest(t *testing.T, ft *types.Type, exp expectedDump) {
strings.TrimSpace(exp.dump), regResString, reason)
}
- // Analyze again with empty register set.
- empty := abi.NewABIConfig(0, 0)
- emptyRes := empty.ABIAnalyze(ft)
- emptyResString := emptyRes.String()
-
- // Walk the results and make sure the offsets assigned match
- // up with those assiged by CalcSize. This checks to make sure that
- // when we have no available registers the ABI assignment degenerates
- // back to the original ABI0.
-
- // receiver
- failed := 0
- rfsl := ft.Recvs().Fields().Slice()
- poff := 0
- if len(rfsl) != 0 {
- failed |= verifyParamResultOffset(t, rfsl[0], emptyRes.InParams()[0], "receiver", 0)
- poff = 1
- }
- // params
- pfsl := ft.Params().Fields().Slice()
- for k, f := range pfsl {
- verifyParamResultOffset(t, f, emptyRes.InParams()[k+poff], "param", k)
- }
- // results
- ofsl := ft.Results().Fields().Slice()
- for k, f := range ofsl {
- failed |= verifyParamResultOffset(t, f, emptyRes.OutParams()[k], "result", k)
- }
-
- if failed != 0 {
- t.Logf("emptyres:\n%s\n", emptyResString)
- }
}
diff --git a/src/cmd/compile/internal/test/fixedbugs_test.go b/src/cmd/compile/internal/test/fixedbugs_test.go
index e7e2f7e58e..376b45edfc 100644
--- a/src/cmd/compile/internal/test/fixedbugs_test.go
+++ b/src/cmd/compile/internal/test/fixedbugs_test.go
@@ -75,7 +75,7 @@ func TestIssue16214(t *testing.T) {
cmd := exec.Command(testenv.GoToolPath(t), "tool", "compile", "-S", "-o", filepath.Join(dir, "out.o"), src)
out, err := cmd.CombinedOutput()
if err != nil {
- t.Fatalf("fail to run go tool compile: %v", err)
+ t.Fatalf("go tool compile: %v\n%s", err, out)
}
if strings.Contains(string(out), "unknown line number") {
diff --git a/src/cmd/compile/internal/test/global_test.go b/src/cmd/compile/internal/test/global_test.go
index 5f5f7d6198..93de894f37 100644
--- a/src/cmd/compile/internal/test/global_test.go
+++ b/src/cmd/compile/internal/test/global_test.go
@@ -50,7 +50,7 @@ func main() {
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", dst, src)
out, err := cmd.CombinedOutput()
if err != nil {
- t.Fatalf("could not build target: %v", err)
+ t.Fatalf("could not build target: %v\n%s", err, out)
}
// Check destination to see if scanf code was included.
@@ -95,7 +95,7 @@ func main() {
cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags", "-S", "-o", filepath.Join(dir, "test"), src)
out, err := cmd.CombinedOutput()
if err != nil {
- t.Fatalf("could not build target: %v", err)
+ t.Fatalf("could not build target: %v\n%s", err, out)
}
patterns := []string{
diff --git a/src/cmd/compile/internal/typecheck/builtin.go b/src/cmd/compile/internal/typecheck/builtin.go
index f9a4f6aef4..3c7776d9ae 100644
--- a/src/cmd/compile/internal/typecheck/builtin.go
+++ b/src/cmd/compile/internal/typecheck/builtin.go
@@ -80,10 +80,10 @@ var runtimeDecls = [...]struct {
{"convT2Enoptr", funcTag, 59},
{"convT2I", funcTag, 59},
{"convT2Inoptr", funcTag, 59},
- {"assertE2I", funcTag, 57},
- {"assertE2I2", funcTag, 60},
- {"assertI2I", funcTag, 57},
- {"assertI2I2", funcTag, 60},
+ {"assertE2I", funcTag, 60},
+ {"assertE2I2", funcTag, 57},
+ {"assertI2I", funcTag, 60},
+ {"assertI2I2", funcTag, 57},
{"panicdottypeE", funcTag, 61},
{"panicdottypeI", funcTag, 61},
{"panicnildottype", funcTag, 62},
@@ -128,76 +128,75 @@ var runtimeDecls = [...]struct {
{"typedslicecopy", funcTag, 93},
{"selectnbsend", funcTag, 94},
{"selectnbrecv", funcTag, 95},
- {"selectnbrecv2", funcTag, 97},
- {"selectsetpc", funcTag, 98},
- {"selectgo", funcTag, 99},
+ {"selectsetpc", funcTag, 96},
+ {"selectgo", funcTag, 97},
{"block", funcTag, 9},
- {"makeslice", funcTag, 100},
- {"makeslice64", funcTag, 101},
- {"makeslicecopy", funcTag, 102},
- {"growslice", funcTag, 104},
- {"memmove", funcTag, 105},
- {"memclrNoHeapPointers", funcTag, 106},
- {"memclrHasPointers", funcTag, 106},
- {"memequal", funcTag, 107},
- {"memequal0", funcTag, 108},
- {"memequal8", funcTag, 108},
- {"memequal16", funcTag, 108},
- {"memequal32", funcTag, 108},
- {"memequal64", funcTag, 108},
- {"memequal128", funcTag, 108},
- {"f32equal", funcTag, 109},
- {"f64equal", funcTag, 109},
- {"c64equal", funcTag, 109},
- {"c128equal", funcTag, 109},
- {"strequal", funcTag, 109},
- {"interequal", funcTag, 109},
- {"nilinterequal", funcTag, 109},
- {"memhash", funcTag, 110},
- {"memhash0", funcTag, 111},
- {"memhash8", funcTag, 111},
- {"memhash16", funcTag, 111},
- {"memhash32", funcTag, 111},
- {"memhash64", funcTag, 111},
- {"memhash128", funcTag, 111},
- {"f32hash", funcTag, 111},
- {"f64hash", funcTag, 111},
- {"c64hash", funcTag, 111},
- {"c128hash", funcTag, 111},
- {"strhash", funcTag, 111},
- {"interhash", funcTag, 111},
- {"nilinterhash", funcTag, 111},
- {"int64div", funcTag, 112},
- {"uint64div", funcTag, 113},
- {"int64mod", funcTag, 112},
- {"uint64mod", funcTag, 113},
- {"float64toint64", funcTag, 114},
- {"float64touint64", funcTag, 115},
- {"float64touint32", funcTag, 116},
- {"int64tofloat64", funcTag, 117},
- {"uint64tofloat64", funcTag, 118},
- {"uint32tofloat64", funcTag, 119},
- {"complex128div", funcTag, 120},
+ {"makeslice", funcTag, 98},
+ {"makeslice64", funcTag, 99},
+ {"makeslicecopy", funcTag, 100},
+ {"growslice", funcTag, 102},
+ {"memmove", funcTag, 103},
+ {"memclrNoHeapPointers", funcTag, 104},
+ {"memclrHasPointers", funcTag, 104},
+ {"memequal", funcTag, 105},
+ {"memequal0", funcTag, 106},
+ {"memequal8", funcTag, 106},
+ {"memequal16", funcTag, 106},
+ {"memequal32", funcTag, 106},
+ {"memequal64", funcTag, 106},
+ {"memequal128", funcTag, 106},
+ {"f32equal", funcTag, 107},
+ {"f64equal", funcTag, 107},
+ {"c64equal", funcTag, 107},
+ {"c128equal", funcTag, 107},
+ {"strequal", funcTag, 107},
+ {"interequal", funcTag, 107},
+ {"nilinterequal", funcTag, 107},
+ {"memhash", funcTag, 108},
+ {"memhash0", funcTag, 109},
+ {"memhash8", funcTag, 109},
+ {"memhash16", funcTag, 109},
+ {"memhash32", funcTag, 109},
+ {"memhash64", funcTag, 109},
+ {"memhash128", funcTag, 109},
+ {"f32hash", funcTag, 109},
+ {"f64hash", funcTag, 109},
+ {"c64hash", funcTag, 109},
+ {"c128hash", funcTag, 109},
+ {"strhash", funcTag, 109},
+ {"interhash", funcTag, 109},
+ {"nilinterhash", funcTag, 109},
+ {"int64div", funcTag, 110},
+ {"uint64div", funcTag, 111},
+ {"int64mod", funcTag, 110},
+ {"uint64mod", funcTag, 111},
+ {"float64toint64", funcTag, 112},
+ {"float64touint64", funcTag, 113},
+ {"float64touint32", funcTag, 114},
+ {"int64tofloat64", funcTag, 115},
+ {"uint64tofloat64", funcTag, 116},
+ {"uint32tofloat64", funcTag, 117},
+ {"complex128div", funcTag, 118},
{"racefuncenter", funcTag, 31},
{"racefuncenterfp", funcTag, 9},
{"racefuncexit", funcTag, 9},
{"raceread", funcTag, 31},
{"racewrite", funcTag, 31},
- {"racereadrange", funcTag, 121},
- {"racewriterange", funcTag, 121},
- {"msanread", funcTag, 121},
- {"msanwrite", funcTag, 121},
- {"msanmove", funcTag, 122},
- {"checkptrAlignment", funcTag, 123},
- {"checkptrArithmetic", funcTag, 125},
- {"libfuzzerTraceCmp1", funcTag, 127},
- {"libfuzzerTraceCmp2", funcTag, 129},
- {"libfuzzerTraceCmp4", funcTag, 130},
- {"libfuzzerTraceCmp8", funcTag, 131},
- {"libfuzzerTraceConstCmp1", funcTag, 127},
- {"libfuzzerTraceConstCmp2", funcTag, 129},
- {"libfuzzerTraceConstCmp4", funcTag, 130},
- {"libfuzzerTraceConstCmp8", funcTag, 131},
+ {"racereadrange", funcTag, 119},
+ {"racewriterange", funcTag, 119},
+ {"msanread", funcTag, 119},
+ {"msanwrite", funcTag, 119},
+ {"msanmove", funcTag, 120},
+ {"checkptrAlignment", funcTag, 121},
+ {"checkptrArithmetic", funcTag, 123},
+ {"libfuzzerTraceCmp1", funcTag, 125},
+ {"libfuzzerTraceCmp2", funcTag, 127},
+ {"libfuzzerTraceCmp4", funcTag, 128},
+ {"libfuzzerTraceCmp8", funcTag, 129},
+ {"libfuzzerTraceConstCmp1", funcTag, 125},
+ {"libfuzzerTraceConstCmp2", funcTag, 127},
+ {"libfuzzerTraceConstCmp4", funcTag, 128},
+ {"libfuzzerTraceConstCmp8", funcTag, 129},
{"x86HasPOPCNT", varTag, 6},
{"x86HasSSE41", varTag, 6},
{"x86HasFMA", varTag, 6},
@@ -220,7 +219,7 @@ func params(tlist ...*types.Type) []*types.Field {
}
func runtimeTypes() []*types.Type {
- var typs [132]*types.Type
+ var typs [130]*types.Type
typs[0] = types.ByteType
typs[1] = types.NewPtr(typs[0])
typs[2] = types.Types[types.TANY]
@@ -281,7 +280,7 @@ func runtimeTypes() []*types.Type {
typs[57] = newSig(params(typs[1], typs[2]), params(typs[2]))
typs[58] = newSig(params(typs[2]), params(typs[7]))
typs[59] = newSig(params(typs[1], typs[3]), params(typs[2]))
- typs[60] = newSig(params(typs[1], typs[2]), params(typs[2], typs[6]))
+ typs[60] = newSig(params(typs[1], typs[1]), params(typs[1]))
typs[61] = newSig(params(typs[1], typs[1], typs[1]), nil)
typs[62] = newSig(params(typs[1]), nil)
typs[63] = types.NewPtr(typs[5])
@@ -316,42 +315,40 @@ func runtimeTypes() []*types.Type {
typs[92] = newSig(params(typs[1], typs[3]), nil)
typs[93] = newSig(params(typs[1], typs[3], typs[15], typs[3], typs[15]), params(typs[15]))
typs[94] = newSig(params(typs[87], typs[3]), params(typs[6]))
- typs[95] = newSig(params(typs[3], typs[84]), params(typs[6]))
- typs[96] = types.NewPtr(typs[6])
- typs[97] = newSig(params(typs[3], typs[96], typs[84]), params(typs[6]))
- typs[98] = newSig(params(typs[63]), nil)
- typs[99] = newSig(params(typs[1], typs[1], typs[63], typs[15], typs[15], typs[6]), params(typs[15], typs[6]))
- typs[100] = newSig(params(typs[1], typs[15], typs[15]), params(typs[7]))
- typs[101] = newSig(params(typs[1], typs[22], typs[22]), params(typs[7]))
- typs[102] = newSig(params(typs[1], typs[15], typs[15], typs[7]), params(typs[7]))
- typs[103] = types.NewSlice(typs[2])
- typs[104] = newSig(params(typs[1], typs[103], typs[15]), params(typs[103]))
- typs[105] = newSig(params(typs[3], typs[3], typs[5]), nil)
- typs[106] = newSig(params(typs[7], typs[5]), nil)
- typs[107] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6]))
- typs[108] = newSig(params(typs[3], typs[3]), params(typs[6]))
- typs[109] = newSig(params(typs[7], typs[7]), params(typs[6]))
- typs[110] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5]))
- typs[111] = newSig(params(typs[7], typs[5]), params(typs[5]))
- typs[112] = newSig(params(typs[22], typs[22]), params(typs[22]))
- typs[113] = newSig(params(typs[24], typs[24]), params(typs[24]))
- typs[114] = newSig(params(typs[20]), params(typs[22]))
- typs[115] = newSig(params(typs[20]), params(typs[24]))
- typs[116] = newSig(params(typs[20]), params(typs[65]))
- typs[117] = newSig(params(typs[22]), params(typs[20]))
- typs[118] = newSig(params(typs[24]), params(typs[20]))
- typs[119] = newSig(params(typs[65]), params(typs[20]))
- typs[120] = newSig(params(typs[26], typs[26]), params(typs[26]))
- typs[121] = newSig(params(typs[5], typs[5]), nil)
- typs[122] = newSig(params(typs[5], typs[5], typs[5]), nil)
- typs[123] = newSig(params(typs[7], typs[1], typs[5]), nil)
- typs[124] = types.NewSlice(typs[7])
- typs[125] = newSig(params(typs[7], typs[124]), nil)
- typs[126] = types.Types[types.TUINT8]
+ typs[95] = newSig(params(typs[3], typs[84]), params(typs[6], typs[6]))
+ typs[96] = newSig(params(typs[63]), nil)
+ typs[97] = newSig(params(typs[1], typs[1], typs[63], typs[15], typs[15], typs[6]), params(typs[15], typs[6]))
+ typs[98] = newSig(params(typs[1], typs[15], typs[15]), params(typs[7]))
+ typs[99] = newSig(params(typs[1], typs[22], typs[22]), params(typs[7]))
+ typs[100] = newSig(params(typs[1], typs[15], typs[15], typs[7]), params(typs[7]))
+ typs[101] = types.NewSlice(typs[2])
+ typs[102] = newSig(params(typs[1], typs[101], typs[15]), params(typs[101]))
+ typs[103] = newSig(params(typs[3], typs[3], typs[5]), nil)
+ typs[104] = newSig(params(typs[7], typs[5]), nil)
+ typs[105] = newSig(params(typs[3], typs[3], typs[5]), params(typs[6]))
+ typs[106] = newSig(params(typs[3], typs[3]), params(typs[6]))
+ typs[107] = newSig(params(typs[7], typs[7]), params(typs[6]))
+ typs[108] = newSig(params(typs[7], typs[5], typs[5]), params(typs[5]))
+ typs[109] = newSig(params(typs[7], typs[5]), params(typs[5]))
+ typs[110] = newSig(params(typs[22], typs[22]), params(typs[22]))
+ typs[111] = newSig(params(typs[24], typs[24]), params(typs[24]))
+ typs[112] = newSig(params(typs[20]), params(typs[22]))
+ typs[113] = newSig(params(typs[20]), params(typs[24]))
+ typs[114] = newSig(params(typs[20]), params(typs[65]))
+ typs[115] = newSig(params(typs[22]), params(typs[20]))
+ typs[116] = newSig(params(typs[24]), params(typs[20]))
+ typs[117] = newSig(params(typs[65]), params(typs[20]))
+ typs[118] = newSig(params(typs[26], typs[26]), params(typs[26]))
+ typs[119] = newSig(params(typs[5], typs[5]), nil)
+ typs[120] = newSig(params(typs[5], typs[5], typs[5]), nil)
+ typs[121] = newSig(params(typs[7], typs[1], typs[5]), nil)
+ typs[122] = types.NewSlice(typs[7])
+ typs[123] = newSig(params(typs[7], typs[122]), nil)
+ typs[124] = types.Types[types.TUINT8]
+ typs[125] = newSig(params(typs[124], typs[124]), nil)
+ typs[126] = types.Types[types.TUINT16]
typs[127] = newSig(params(typs[126], typs[126]), nil)
- typs[128] = types.Types[types.TUINT16]
- typs[129] = newSig(params(typs[128], typs[128]), nil)
- typs[130] = newSig(params(typs[65], typs[65]), nil)
- typs[131] = newSig(params(typs[24], typs[24]), nil)
+ typs[128] = newSig(params(typs[65], typs[65]), nil)
+ typs[129] = newSig(params(typs[24], typs[24]), nil)
return typs[:]
}
diff --git a/src/cmd/compile/internal/typecheck/builtin/runtime.go b/src/cmd/compile/internal/typecheck/builtin/runtime.go
index acb69c7b28..d5e00afcf8 100644
--- a/src/cmd/compile/internal/typecheck/builtin/runtime.go
+++ b/src/cmd/compile/internal/typecheck/builtin/runtime.go
@@ -101,10 +101,10 @@ func convT2I(tab *byte, elem *any) (ret any)
func convT2Inoptr(tab *byte, elem *any) (ret any)
// interface type assertions x.(T)
-func assertE2I(typ *byte, iface any) (ret any)
-func assertE2I2(typ *byte, iface any) (ret any, b bool)
-func assertI2I(typ *byte, iface any) (ret any)
-func assertI2I2(typ *byte, iface any) (ret any, b bool)
+func assertE2I(inter *byte, typ *byte) *byte
+func assertE2I2(inter *byte, eface any) (ret any)
+func assertI2I(inter *byte, tab *byte) *byte
+func assertI2I2(inter *byte, iface any) (ret any)
func panicdottypeE(have, want, iface *byte)
func panicdottypeI(have, want, iface *byte)
func panicnildottype(want *byte)
@@ -166,8 +166,7 @@ func typedmemclr(typ *byte, dst *any)
func typedslicecopy(typ *byte, dstPtr *any, dstLen int, srcPtr *any, srcLen int) int
func selectnbsend(hchan chan<- any, elem *any) bool
-func selectnbrecv(elem *any, hchan <-chan any) bool
-func selectnbrecv2(elem *any, received *bool, hchan <-chan any) bool
+func selectnbrecv(elem *any, hchan <-chan any) (bool, bool)
func selectsetpc(pc *uintptr)
func selectgo(cas0 *byte, order0 *byte, pc0 *uintptr, nsends int, nrecvs int, block bool) (int, bool)
diff --git a/src/cmd/compile/internal/typecheck/const.go b/src/cmd/compile/internal/typecheck/const.go
index 1a8e58383a..c60d36ba62 100644
--- a/src/cmd/compile/internal/typecheck/const.go
+++ b/src/cmd/compile/internal/typecheck/const.go
@@ -449,7 +449,7 @@ func EvalConst(n ir.Node) ir.Node {
n := n.(*ir.BinaryExpr)
nl, nr := n.X, n.Y
if nl.Op() == ir.OLITERAL && nr.Op() == ir.OLITERAL {
- // shiftBound from go/types; "so we can express smallestFloat64"
+ // shiftBound from go/types; "so we can express smallestFloat64" (see issue #44057)
const shiftBound = 1023 - 1 + 52
s, ok := constant.Uint64Val(nr.Val())
if !ok || s > shiftBound {
diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go
index 7ab5f68ce3..6e2354c281 100644
--- a/src/cmd/compile/internal/typecheck/func.go
+++ b/src/cmd/compile/internal/typecheck/func.go
@@ -100,6 +100,11 @@ func PartialCallType(n *ir.SelectorExpr) *types.Type {
return t
}
+// True if we are typechecking an inline body in ImportedBody below. We use this
+// flag to not create a new closure function in tcClosure when we are just
+// typechecking an inline body, as opposed to the body of a real function.
+var inTypeCheckInl bool
+
// Lazy typechecking of imported bodies. For local functions, CanInline will set ->typecheck
// because they're a copy of an already checked body.
func ImportedBody(fn *ir.Func) {
@@ -138,7 +143,12 @@ func ImportedBody(fn *ir.Func) {
savefn := ir.CurFunc
ir.CurFunc = fn
+ if inTypeCheckInl {
+ base.Fatalf("inTypeCheckInl should not be set recursively")
+ }
+ inTypeCheckInl = true
Stmts(fn.Inl.Body)
+ inTypeCheckInl = false
ir.CurFunc = savefn
// During ImportBody (which imports fn.Func.Inl.Body),
@@ -307,7 +317,6 @@ func tcClosure(clo *ir.ClosureExpr, top int) {
// body in ImportedBody(), since we only want to create the named function
// when the closure is actually inlined (and then we force a typecheck
// explicitly in (*inlsubst).node()).
- inTypeCheckInl := ir.CurFunc != nil && ir.CurFunc.Body == nil
if !inTypeCheckInl {
fn.Nname.SetSym(ClosureName(ir.CurFunc))
ir.MarkFunc(fn.Nname)
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 6fab74e61f..38ac753201 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -1025,7 +1025,7 @@ func (w *exportWriter) funcExt(n *ir.Name) {
w.linkname(n.Sym())
w.symIdx(n.Sym())
- // TODO remove after register abi is working.
+ // TODO(register args) remove after register abi is working.
w.uint64(uint64(n.Func.Pragma))
// Escape analysis.
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index 7b5b113b15..9355174da8 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -673,7 +673,7 @@ func (r *importReader) funcExt(n *ir.Name) {
r.linkname(n.Sym())
r.symIdx(n.Sym())
- // TODO remove after register abi is working
+ // TODO(register args) remove after register abi is working
n.SetPragma(ir.PragmaFlag(r.uint64()))
// Escape analysis.
@@ -986,15 +986,24 @@ func (r *importReader) node() ir.Node {
fn.ClosureVars = cvars
r.allClosureVars = append(r.allClosureVars, cvars...)
- fn.Dcl = r.readFuncDcls(fn)
- body := r.stmtList()
+ fn.Inl = &ir.Inline{}
+ // Read in the Dcls and Body of the closure after temporarily
+ // setting r.curfn to fn.
+ r.funcBody(fn)
+ fn.Dcl = fn.Inl.Dcl
+ fn.Body = fn.Inl.Body
+ if len(fn.Body) == 0 {
+ // An empty closure must be represented as a single empty
+ // block statement, else it will be dropped.
+ fn.Body = []ir.Node{ir.NewBlockStmt(src.NoXPos, nil)}
+ }
+ fn.Inl = nil
+
ir.FinishCaptureNames(pos, r.curfn, fn)
clo := ir.NewClosureExpr(pos, fn)
fn.OClosure = clo
- fn.Body = body
-
return clo
// case OPTRLIT:
diff --git a/src/cmd/compile/internal/typecheck/mapfile_mmap.go b/src/cmd/compile/internal/typecheck/mapfile_mmap.go
index 2f3aa16dec..298b385bcb 100644
--- a/src/cmd/compile/internal/typecheck/mapfile_mmap.go
+++ b/src/cmd/compile/internal/typecheck/mapfile_mmap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package typecheck
diff --git a/src/cmd/compile/internal/typecheck/mapfile_read.go b/src/cmd/compile/internal/typecheck/mapfile_read.go
index 4059f261d4..9637ab97ab 100644
--- a/src/cmd/compile/internal/typecheck/mapfile_read.go
+++ b/src/cmd/compile/internal/typecheck/mapfile_read.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
package typecheck
diff --git a/src/cmd/compile/internal/typecheck/mkbuiltin.go b/src/cmd/compile/internal/typecheck/mkbuiltin.go
index bef510a578..6dbd1869b3 100644
--- a/src/cmd/compile/internal/typecheck/mkbuiltin.go
+++ b/src/cmd/compile/internal/typecheck/mkbuiltin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generate builtin.go from builtin/runtime.go.
diff --git a/src/cmd/compile/internal/typecheck/subr.go b/src/cmd/compile/internal/typecheck/subr.go
index b88a9f2283..c40cfa2288 100644
--- a/src/cmd/compile/internal/typecheck/subr.go
+++ b/src/cmd/compile/internal/typecheck/subr.go
@@ -106,7 +106,8 @@ var DirtyAddrtaken = false
func ComputeAddrtaken(top []ir.Node) {
for _, n := range top {
- ir.Visit(n, func(n ir.Node) {
+ var doVisit func(n ir.Node)
+ doVisit = func(n ir.Node) {
if n.Op() == ir.OADDR {
if x := ir.OuterValue(n.(*ir.AddrExpr).X); x.Op() == ir.ONAME {
x.Name().SetAddrtaken(true)
@@ -117,7 +118,11 @@ func ComputeAddrtaken(top []ir.Node) {
}
}
}
- })
+ if n.Op() == ir.OCLOSURE {
+ ir.VisitList(n.(*ir.ClosureExpr).Func.Body, doVisit)
+ }
+ }
+ ir.Visit(n, doVisit)
}
}
diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go
index cb434578dd..5a3446b358 100644
--- a/src/cmd/compile/internal/typecheck/typecheck.go
+++ b/src/cmd/compile/internal/typecheck/typecheck.go
@@ -1175,7 +1175,7 @@ func lookdot(n *ir.SelectorExpr, t *types.Type, dostrcmp int) *types.Field {
base.Errorf("%v is both field and method", n.Sel)
}
if f1.Offset == types.BADWIDTH {
- base.Fatalf("lookdot badwidth %v %p", f1, f1)
+ base.Fatalf("lookdot badwidth t=%v, f1=%v@%p", t, f1, f1)
}
n.Selection = f1
n.SetType(f1.Type)
diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go
index d1203e4a21..4c7378560c 100644
--- a/src/cmd/compile/internal/types/size.go
+++ b/src/cmd/compile/internal/types/size.go
@@ -141,6 +141,8 @@ func expandiface(t *Type) {
}
func calcStructOffset(errtype *Type, t *Type, o int64, flag int) int64 {
+ // flag is 0 (receiver), 1 (actual struct), or RegSize (in/out parameters)
+ isStruct := flag == 1
starto := o
maxalign := int32(flag)
if maxalign < 1 {
@@ -161,7 +163,9 @@ func calcStructOffset(errtype *Type, t *Type, o int64, flag int) int64 {
if f.Type.Align > 0 {
o = Rnd(o, int64(f.Type.Align))
}
- f.Offset = o
+ if isStruct { // For receiver/args/results, depends on ABI
+ f.Offset = o
+ }
if f.Nname != nil {
// addrescapes has similar code to update these offsets.
// Usually addrescapes runs after calcStructOffset,
@@ -624,9 +628,11 @@ func PtrDataSize(t *Type) int64 {
case TSTRUCT:
// Find the last field that has pointers.
var lastPtrField *Field
- for _, t1 := range t.Fields().Slice() {
- if t1.Type.HasPointers() {
- lastPtrField = t1
+ fs := t.Fields().Slice()
+ for i := len(fs) - 1; i >= 0; i-- {
+ if fs[i].Type.HasPointers() {
+ lastPtrField = fs[i]
+ break
}
}
return lastPtrField.Offset + PtrDataSize(lastPtrField.Type)
diff --git a/src/cmd/compile/internal/types/sizeof_test.go b/src/cmd/compile/internal/types/sizeof_test.go
index 6937283d69..f80de937be 100644
--- a/src/cmd/compile/internal/types/sizeof_test.go
+++ b/src/cmd/compile/internal/types/sizeof_test.go
@@ -21,7 +21,7 @@ func TestSizeof(t *testing.T) {
_64bit uintptr // size on 64bit platforms
}{
{Sym{}, 44, 72},
- {Type{}, 56, 96},
+ {Type{}, 68, 120},
{Map{}, 20, 40},
{Forward{}, 20, 32},
{Func{}, 28, 48},
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go
index 8d07b88ecd..b0516a8259 100644
--- a/src/cmd/compile/internal/types/type.go
+++ b/src/cmd/compile/internal/types/type.go
@@ -176,6 +176,11 @@ type Type struct {
Align uint8 // the required alignment of this type, in bytes (0 means Width and Align have not yet been computed)
flags bitset8
+
+ // Type params (in order) of this named type that need to be instantiated.
+ // TODO(danscales): for space reasons, should probably be a pointer to a
+ // slice, possibly change the name of this field.
+ RParams []*Type
}
func (*Type) CanBeAnSSAAux() {}
@@ -186,6 +191,7 @@ const (
typeNoalg // suppress hash and eq algorithm generation
typeDeferwidth // width computation has been deferred and type is on deferredTypeStack
typeRecur
+ typeHasTParam // there is a typeparam somewhere in the type (generic function or type)
)
func (t *Type) NotInHeap() bool { return t.flags&typeNotInHeap != 0 }
@@ -193,12 +199,14 @@ func (t *Type) Broke() bool { return t.flags&typeBroke != 0 }
func (t *Type) Noalg() bool { return t.flags&typeNoalg != 0 }
func (t *Type) Deferwidth() bool { return t.flags&typeDeferwidth != 0 }
func (t *Type) Recur() bool { return t.flags&typeRecur != 0 }
+func (t *Type) HasTParam() bool { return t.flags&typeHasTParam != 0 }
func (t *Type) SetNotInHeap(b bool) { t.flags.set(typeNotInHeap, b) }
func (t *Type) SetBroke(b bool) { t.flags.set(typeBroke, b) }
func (t *Type) SetNoalg(b bool) { t.flags.set(typeNoalg, b) }
func (t *Type) SetDeferwidth(b bool) { t.flags.set(typeDeferwidth, b) }
func (t *Type) SetRecur(b bool) { t.flags.set(typeRecur, b) }
+func (t *Type) SetHasTParam(b bool) { t.flags.set(typeHasTParam, b) }
// Kind returns the kind of type t.
func (t *Type) Kind() Kind { return t.kind }
@@ -403,7 +411,8 @@ type Field struct {
Nname Object
// Offset in bytes of this field or method within its enclosing struct
- // or interface Type.
+ // or interface Type. Exception: if field is function receiver, arg or
+ // result, then this is BOGUS_FUNARG_OFFSET; types does not know the Abi.
Offset int64
}
@@ -527,6 +536,9 @@ func NewArray(elem *Type, bound int64) *Type {
t := New(TARRAY)
t.Extra = &Array{Elem: elem, Bound: bound}
t.SetNotInHeap(elem.NotInHeap())
+ if elem.HasTParam() {
+ t.SetHasTParam(true)
+ }
return t
}
@@ -542,6 +554,9 @@ func NewSlice(elem *Type) *Type {
t := New(TSLICE)
t.Extra = Slice{Elem: elem}
elem.cache.slice = t
+ if elem.HasTParam() {
+ t.SetHasTParam(true)
+ }
return t
}
@@ -551,6 +566,9 @@ func NewChan(elem *Type, dir ChanDir) *Type {
ct := t.ChanType()
ct.Elem = elem
ct.Dir = dir
+ if elem.HasTParam() {
+ t.SetHasTParam(true)
+ }
return t
}
@@ -558,15 +576,25 @@ func NewTuple(t1, t2 *Type) *Type {
t := New(TTUPLE)
t.Extra.(*Tuple).first = t1
t.Extra.(*Tuple).second = t2
+ if t1.HasTParam() || t2.HasTParam() {
+ t.SetHasTParam(true)
+ }
return t
}
-func NewResults(types []*Type) *Type {
+func newResults(types []*Type) *Type {
t := New(TRESULTS)
t.Extra.(*Results).Types = types
return t
}
+func NewResults(types []*Type) *Type {
+ if len(types) == 1 && types[0] == TypeMem {
+ return TypeResultMem
+ }
+ return newResults(types)
+}
+
func newSSA(name string) *Type {
t := New(TSSA)
t.Extra = name
@@ -579,6 +607,9 @@ func NewMap(k, v *Type) *Type {
mt := t.MapType()
mt.Key = k
mt.Elem = v
+ if k.HasTParam() || v.HasTParam() {
+ t.SetHasTParam(true)
+ }
return t
}
@@ -597,6 +628,12 @@ func NewPtr(elem *Type) *Type {
if t.Elem() != elem {
base.Fatalf("NewPtr: elem mismatch")
}
+ if elem.HasTParam() {
+ // Extra check when reusing the cache, since the elem
+ // might have still been undetermined (i.e. a TFORW type)
+ // when this entry was cached.
+ t.SetHasTParam(true)
+ }
return t
}
@@ -607,6 +644,9 @@ func NewPtr(elem *Type) *Type {
if NewPtrCacheEnabled {
elem.cache.ptr = t
}
+ if elem.HasTParam() {
+ t.SetHasTParam(true)
+ }
return t
}
@@ -1375,6 +1415,9 @@ func (t *Type) PtrTo() *Type {
}
func (t *Type) NumFields() int {
+ if t.kind == TRESULTS {
+ return len(t.Extra.(*Results).Types)
+ }
return t.Fields().Len()
}
func (t *Type) FieldType(i int) *Type {
@@ -1565,11 +1608,12 @@ func FakeRecvType() *Type {
var (
// TSSA types. HasPointers assumes these are pointer-free.
- TypeInvalid = newSSA("invalid")
- TypeMem = newSSA("mem")
- TypeFlags = newSSA("flags")
- TypeVoid = newSSA("void")
- TypeInt128 = newSSA("int128")
+ TypeInvalid = newSSA("invalid")
+ TypeMem = newSSA("mem")
+ TypeFlags = newSSA("flags")
+ TypeVoid = newSSA("void")
+ TypeInt128 = newSSA("int128")
+ TypeResultMem = newResults([]*Type{TypeMem})
)
// NewNamed returns a new named type for the given type name.
@@ -1611,6 +1655,9 @@ func (t *Type) SetUnderlying(underlying *Type) {
if underlying.Broke() {
t.SetBroke(true)
}
+ if underlying.HasTParam() {
+ t.SetHasTParam(true)
+ }
// spec: "The declared type does not inherit any methods bound
// to the existing type, but the method set of an interface
@@ -1633,6 +1680,15 @@ func (t *Type) SetUnderlying(underlying *Type) {
}
}
+func fieldsHasTParam(fields []*Field) bool {
+ for _, f := range fields {
+ if f.Type != nil && f.Type.HasTParam() {
+ return true
+ }
+ }
+ return false
+}
+
// NewBasic returns a new basic type of the given kind.
func NewBasic(kind Kind, obj Object) *Type {
t := New(kind)
@@ -1657,11 +1713,21 @@ func NewInterface(pkg *Pkg, methods []*Field) *Type {
// not really be needed except for the type checker).
func NewTypeParam(pkg *Pkg, constraint *Type) *Type {
t := New(TTYPEPARAM)
+ constraint.wantEtype(TINTER)
t.methods = constraint.methods
t.Extra.(*Interface).pkg = pkg
+ t.SetHasTParam(true)
return t
}
+const BOGUS_FUNARG_OFFSET = 1000000000
+
+func unzeroFieldOffsets(f []*Field) {
+ for i := range f {
+ f[i].Offset = BOGUS_FUNARG_OFFSET // This will cause an explosion if it is not corrected
+ }
+}
+
// NewSignature returns a new function type for the given receiver,
// parametes, results, and type parameters, any of which may be nil.
func NewSignature(pkg *Pkg, recv *Field, tparams, params, results []*Field) *Type {
@@ -1682,11 +1748,20 @@ func NewSignature(pkg *Pkg, recv *Field, tparams, params, results []*Field) *Typ
return s
}
+ if recv != nil {
+ recv.Offset = BOGUS_FUNARG_OFFSET
+ }
+ unzeroFieldOffsets(params)
+ unzeroFieldOffsets(results)
ft.Receiver = funargs(recvs, FunargRcvr)
ft.TParams = funargs(tparams, FunargTparams)
ft.Params = funargs(params, FunargParams)
ft.Results = funargs(results, FunargResults)
ft.pkg = pkg
+ if len(tparams) > 0 || fieldsHasTParam(recvs) || fieldsHasTParam(params) ||
+ fieldsHasTParam(results) {
+ t.SetHasTParam(true)
+ }
return t
}
@@ -1699,6 +1774,9 @@ func NewStruct(pkg *Pkg, fields []*Field) *Type {
t.SetBroke(true)
}
t.Extra.(*Struct).pkg = pkg
+ if fieldsHasTParam(fields) {
+ t.SetHasTParam(true)
+ }
return t
}
diff --git a/src/cmd/compile/internal/types2/api.go b/src/cmd/compile/internal/types2/api.go
index b29c0802ed..30f0430ff1 100644
--- a/src/cmd/compile/internal/types2/api.go
+++ b/src/cmd/compile/internal/types2/api.go
@@ -99,6 +99,13 @@ type ImporterFrom interface {
// A Config specifies the configuration for type checking.
// The zero value for Config is a ready-to-use default configuration.
type Config struct {
+ // GoVersion describes the accepted Go language version. The string
+ // must follow the format "go%d.%d" (e.g. "go1.12") or ist must be
+ // empty; an empty string indicates the latest language version.
+ // If the format is invalid, invoking the type checker will cause a
+ // panic.
+ GoVersion string
+
// If IgnoreFuncBodies is set, function bodies are not
// type-checked.
IgnoreFuncBodies bool
diff --git a/src/cmd/compile/internal/types2/assignments.go b/src/cmd/compile/internal/types2/assignments.go
index 6caa4863d5..00495f3976 100644
--- a/src/cmd/compile/internal/types2/assignments.go
+++ b/src/cmd/compile/internal/types2/assignments.go
@@ -52,7 +52,7 @@ func (check *Checker) assignment(x *operand, T Type, context string) {
// x.typ is typed
// A generic (non-instantiated) function value cannot be assigned to a variable.
- if sig := x.typ.Signature(); sig != nil && len(sig.tparams) > 0 {
+ if sig := asSignature(x.typ); sig != nil && len(sig.tparams) > 0 {
check.errorf(x, "cannot use generic function %s without instantiation in %s", x, context)
}
diff --git a/src/cmd/compile/internal/types2/builtins.go b/src/cmd/compile/internal/types2/builtins.go
index bd1ea0fdc1..a6a9b51dd1 100644
--- a/src/cmd/compile/internal/types2/builtins.go
+++ b/src/cmd/compile/internal/types2/builtins.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2012 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.
@@ -83,7 +82,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
// of S and the respective parameter passing rules apply."
S := x.typ
var T Type
- if s := S.Slice(); s != nil {
+ if s := asSlice(S); s != nil {
T = s.elem
} else {
check.invalidArgf(x, "%s is not a slice", x)
@@ -143,7 +142,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
mode := invalid
var typ Type
var val constant.Value
- switch typ = implicitArrayDeref(optype(x.typ.Under())); t := typ.(type) {
+ switch typ = implicitArrayDeref(optype(x.typ)); t := typ.(type) {
case *Basic:
if isString(t) && id == _Len {
if x.mode == constant_ {
@@ -179,7 +178,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
case *Sum:
if t.is(func(t Type) bool {
- switch t := t.Under().(type) {
+ switch t := under(t).(type) {
case *Basic:
if isString(t) && id == _Len {
return true
@@ -211,7 +210,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
case _Close:
// close(c)
- c := x.typ.Chan()
+ c := asChan(x.typ)
if c == nil {
check.invalidArgf(x, "%s is not a channel", x)
return
@@ -287,7 +286,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
// the argument types must be of floating-point type
f := func(x Type) Type {
- if t := x.Basic(); t != nil {
+ if t := asBasic(x); t != nil {
switch t.kind {
case Float32:
return Typ[Complex64]
@@ -321,7 +320,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
case _Copy:
// copy(x, y []T) int
var dst Type
- if t := x.typ.Slice(); t != nil {
+ if t := asSlice(x.typ); t != nil {
dst = t.elem
}
@@ -331,7 +330,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
return
}
var src Type
- switch t := optype(y.typ.Under()).(type) {
+ switch t := optype(y.typ).(type) {
case *Basic:
if isString(y.typ) {
src = universeByte
@@ -358,7 +357,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
case _Delete:
// delete(m, k)
- m := x.typ.Map()
+ m := asMap(x.typ)
if m == nil {
check.invalidArgf(x, "%s is not a map", x)
return
@@ -405,7 +404,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
// the argument must be of complex type
f := func(x Type) Type {
- if t := x.Basic(); t != nil {
+ if t := asBasic(x); t != nil {
switch t.kind {
case Complex64:
return Typ[Float32]
@@ -454,7 +453,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
var valid func(t Type) bool
valid = func(t Type) bool {
var m int
- switch t := optype(t.Under()).(type) {
+ switch t := optype(t).(type) {
case *Slice:
m = 2
case *Map, *Chan:
@@ -578,7 +577,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
case _Alignof:
// unsafe.Alignof(x T) uintptr
- if x.typ.TypeParam() != nil {
+ if asTypeParam(x.typ) != nil {
check.invalidOpf(call, "unsafe.Alignof undefined for %s", x)
return
}
@@ -639,7 +638,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
case _Sizeof:
// unsafe.Sizeof(x T) uintptr
- if x.typ.TypeParam() != nil {
+ if asTypeParam(x.typ) != nil {
check.invalidOpf(call, "unsafe.Sizeof undefined for %s", x)
return
}
@@ -706,7 +705,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
// applyTypeFunc returns nil.
// If x is not a type parameter, the result is f(x).
func (check *Checker) applyTypeFunc(f func(Type) Type, x Type) Type {
- if tp := x.TypeParam(); tp != nil {
+ if tp := asTypeParam(x); tp != nil {
// Test if t satisfies the requirements for the argument
// type and collect possible result types at the same time.
var rtypes []Type
@@ -758,7 +757,7 @@ func makeSig(res Type, args ...Type) *Signature {
//
func implicitArrayDeref(typ Type) Type {
if p, ok := typ.(*Pointer); ok {
- if a := p.base.Array(); a != nil {
+ if a := asArray(p.base); a != nil {
return a
}
}
diff --git a/src/cmd/compile/internal/types2/builtins_test.go b/src/cmd/compile/internal/types2/builtins_test.go
index 35c38518f6..780d0a15a7 100644
--- a/src/cmd/compile/internal/types2/builtins_test.go
+++ b/src/cmd/compile/internal/types2/builtins_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
diff --git a/src/cmd/compile/internal/types2/call.go b/src/cmd/compile/internal/types2/call.go
index 72a33b50b1..320e12d4d6 100644
--- a/src/cmd/compile/internal/types2/call.go
+++ b/src/cmd/compile/internal/types2/call.go
@@ -17,15 +17,15 @@ import (
// The operand x must be the evaluation of inst.X and its type must be a signature.
func (check *Checker) funcInst(x *operand, inst *syntax.IndexExpr) {
args, ok := check.exprOrTypeList(unpackExpr(inst.Index))
- if ok && len(args) > 0 && args[0].mode != typexpr {
- check.errorf(args[0], "%s is not a type", args[0])
- ok = false
- }
if !ok {
x.mode = invalid
x.expr = inst
return
}
+ if len(args) > 0 && args[0].mode != typexpr {
+ check.errorf(args[0], "%s is not a type", args[0])
+ ok = false
+ }
// check number of type arguments
n := len(args)
@@ -71,13 +71,12 @@ func (check *Checker) funcInst(x *operand, inst *syntax.IndexExpr) {
x.expr = inst
return
}
- // all type arguments were inferred sucessfully
+ // all type arguments were inferred successfully
if debug {
for _, targ := range targs {
assert(targ != nil)
}
}
- //check.dump("### inferred targs = %s", targs)
n = len(targs)
inferred = true
}
@@ -121,7 +120,7 @@ func (check *Checker) call(x *operand, call *syntax.CallExpr) exprKind {
case 1:
check.expr(x, call.ArgList[0])
if x.mode != invalid {
- if t := T.Interface(); t != nil {
+ if t := asInterface(T); t != nil {
check.completeInterface(nopos, t)
if t.IsConstraint() {
check.errorf(call, "cannot use interface %s in conversion (contains type list or is comparable)", T)
@@ -157,7 +156,7 @@ func (check *Checker) call(x *operand, call *syntax.CallExpr) exprKind {
// function/method call
cgocall := x.mode == cgofunc
- sig := x.typ.Signature()
+ sig := asSignature(x.typ)
if sig == nil {
check.invalidOpf(x, "cannot call non-function %s", x)
x.mode = invalid
@@ -403,7 +402,7 @@ func (check *Checker) arguments(call *syntax.CallExpr, sig *Signature, args []*o
return
}
}
- // all type arguments were inferred sucessfully
+ // all type arguments were inferred successfully
if debug {
for _, targ := range targs {
assert(targ != nil)
@@ -563,7 +562,7 @@ func (check *Checker) selector(x *operand, e *syntax.SelectorExpr) {
check.errorf(e.Sel, "cannot call pointer method %s on %s", sel, x.typ)
default:
var why string
- if tpar := x.typ.TypeParam(); tpar != nil {
+ if tpar := asTypeParam(x.typ); tpar != nil {
// Type parameter bounds don't specify fields, so don't mention "field".
switch obj := tpar.Bound().obj.(type) {
case nil:
@@ -598,34 +597,43 @@ func (check *Checker) selector(x *operand, e *syntax.SelectorExpr) {
if m, _ := obj.(*Func); m != nil {
// check.dump("### found method %s", m)
check.objDecl(m, nil)
- // If m has a parameterized receiver type, infer the type parameter
- // values from the actual receiver provided and then substitute the
- // type parameters in the signature accordingly.
+ // If m has a parameterized receiver type, infer the type arguments
+ // from the actual receiver provided and then substitute the type
+ // parameters accordingly.
// TODO(gri) factor this code out
sig := m.typ.(*Signature)
if len(sig.rparams) > 0 {
- //check.dump("### recv typ = %s", x.typ)
+ // For inference to work, we must use the receiver type
+ // matching the receiver in the actual method declaration.
+ // If the method is embedded, the matching receiver is the
+ // embedded struct or interface that declared the method.
+ // Traverse the embedding to find that type (issue #44688).
+ recv := x.typ
+ for i := 0; i < len(index)-1; i++ {
+ // The embedded type is always a struct or a pointer to
+ // a struct except for the last one (which we don't need).
+ recv = asStruct(derefStructPtr(recv)).Field(index[i]).typ
+ }
+ //check.dump("### recv = %s", recv)
//check.dump("### method = %s rparams = %s tparams = %s", m, sig.rparams, sig.tparams)
// The method may have a pointer receiver, but the actually provided receiver
// may be a (hopefully addressable) non-pointer value, or vice versa. Here we
// only care about inferring receiver type parameters; to make the inference
// work, match up pointer-ness of receiver and argument.
- arg := x
- if ptrRecv := isPointer(sig.recv.typ); ptrRecv != isPointer(arg.typ) {
- copy := *arg
+ if ptrRecv := isPointer(sig.recv.typ); ptrRecv != isPointer(recv) {
if ptrRecv {
- copy.typ = NewPointer(arg.typ)
+ recv = NewPointer(recv)
} else {
- copy.typ = arg.typ.(*Pointer).base
+ recv = recv.(*Pointer).base
}
- arg = &copy
}
- targs, failed := check.infer(sig.rparams, NewTuple(sig.recv), []*operand{arg})
+ arg := operand{mode: variable, expr: x.expr, typ: recv}
+ targs, failed := check.infer(sig.rparams, NewTuple(sig.recv), []*operand{&arg})
//check.dump("### inferred targs = %s", targs)
if failed >= 0 {
// We may reach here if there were other errors (see issue #40056).
// check.infer will report a follow-up error.
- // TODO(gri) avoid the follow-up error or provide better explanation.
+ // TODO(gri) avoid the follow-up error as it is confusing (there's no inference in the source code)
goto Error
}
// Don't modify m. Instead - for now - make a copy of m and use that instead.
diff --git a/src/cmd/compile/internal/types2/check.go b/src/cmd/compile/internal/types2/check.go
index e2c6c4f606..95fb4e1076 100644
--- a/src/cmd/compile/internal/types2/check.go
+++ b/src/cmd/compile/internal/types2/check.go
@@ -88,12 +88,13 @@ type Checker struct {
conf *Config
pkg *Package
*Info
- nextId uint64 // unique Id for type parameters (first valid Id is 1)
- objMap map[Object]*declInfo // maps package-level objects and (non-interface) methods to declaration info
- impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
- posMap map[*Interface][]syntax.Pos // maps interface types to lists of embedded interface positions
- typMap map[string]*Named // maps an instantiated named type hash to a *Named type
- pkgCnt map[string]int // counts number of imported packages with a given name (for better error messages)
+ version version // accepted language version
+ nextId uint64 // unique Id for type parameters (first valid Id is 1)
+ objMap map[Object]*declInfo // maps package-level objects and (non-interface) methods to declaration info
+ impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
+ posMap map[*Interface][]syntax.Pos // maps interface types to lists of embedded interface positions
+ typMap map[string]*Named // maps an instantiated named type hash to a *Named type
+ pkgCnt map[string]int // counts number of imported packages with a given name (for better error messages)
// information collected during type-checking of a set of package files
// (initialized by Files, valid only for the duration of check.Files;
@@ -182,16 +183,22 @@ func NewChecker(conf *Config, pkg *Package, info *Info) *Checker {
info = new(Info)
}
+ version, err := parseGoVersion(conf.GoVersion)
+ if err != nil {
+ panic(fmt.Sprintf("invalid Go version %q (%v)", conf.GoVersion, err))
+ }
+
return &Checker{
- conf: conf,
- pkg: pkg,
- Info: info,
- nextId: 1,
- objMap: make(map[Object]*declInfo),
- impMap: make(map[importKey]*Package),
- posMap: make(map[*Interface][]syntax.Pos),
- typMap: make(map[string]*Named),
- pkgCnt: make(map[string]int),
+ conf: conf,
+ pkg: pkg,
+ Info: info,
+ version: version,
+ nextId: 1,
+ objMap: make(map[Object]*declInfo),
+ impMap: make(map[importKey]*Package),
+ posMap: make(map[*Interface][]syntax.Pos),
+ typMap: make(map[string]*Named),
+ pkgCnt: make(map[string]int),
}
}
diff --git a/src/cmd/compile/internal/types2/check_test.go b/src/cmd/compile/internal/types2/check_test.go
index b03b074b6d..9c1d278520 100644
--- a/src/cmd/compile/internal/types2/check_test.go
+++ b/src/cmd/compile/internal/types2/check_test.go
@@ -44,7 +44,8 @@ import (
var (
haltOnError = flag.Bool("halt", false, "halt on error")
listErrors = flag.Bool("errlist", false, "list errors")
- testFiles = flag.String("files", "", "space-separated list of test files")
+ testFiles = flag.String("files", "", "comma-separated list of test files")
+ goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\"")
)
func parseFiles(t *testing.T, filenames []string, mode syntax.Mode) ([]*syntax.File, []error) {
@@ -83,7 +84,21 @@ func delta(x, y uint) uint {
}
}
-func checkFiles(t *testing.T, sources []string, colDelta uint, trace bool) {
+// goVersionRx matches a Go version string using '_', e.g. "go1_12".
+var goVersionRx = regexp.MustCompile(`^go[1-9][0-9]*_(0|[1-9][0-9]*)$`)
+
+// asGoVersion returns a regular Go language version string
+// if s is a Go version string using '_' rather than '.' to
+// separate the major and minor version numbers (e.g. "go1_12").
+// Otherwise it returns the empty string.
+func asGoVersion(s string) string {
+ if goVersionRx.MatchString(s) {
+ return strings.Replace(s, "_", ".", 1)
+ }
+ return ""
+}
+
+func checkFiles(t *testing.T, sources []string, goVersion string, colDelta uint, trace bool) {
if len(sources) == 0 {
t.Fatal("no source files")
}
@@ -100,6 +115,11 @@ func checkFiles(t *testing.T, sources []string, colDelta uint, trace bool) {
pkgName = files[0].PkgName.Value
}
+ // if no Go version is given, consider the package name
+ if goVersion == "" {
+ goVersion = asGoVersion(pkgName)
+ }
+
if *listErrors && len(errlist) > 0 {
t.Errorf("--- %s:", pkgName)
for _, err := range errlist {
@@ -109,6 +129,7 @@ func checkFiles(t *testing.T, sources []string, colDelta uint, trace bool) {
// typecheck and collect typechecker errors
var conf Config
+ conf.GoVersion = goVersion
conf.AcceptMethodTypeParams = true
conf.InferFromConstraints = true
// special case for importC.src
@@ -220,13 +241,14 @@ func checkFiles(t *testing.T, sources []string, colDelta uint, trace bool) {
}
// TestCheck is for manual testing of selected input files, provided with -files.
+// The accepted Go language version can be controlled with the -lang flag.
func TestCheck(t *testing.T) {
if *testFiles == "" {
return
}
testenv.MustHaveGoBuild(t)
DefPredeclaredTestFuncs()
- checkFiles(t, strings.Split(*testFiles, " "), 0, testing.Verbose())
+ checkFiles(t, strings.Split(*testFiles, ","), *goVersion, 0, testing.Verbose())
}
func TestTestdata(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, 75, "testdata") } // TODO(gri) narrow column tolerance
@@ -263,7 +285,7 @@ func testDir(t *testing.T, colDelta uint, dir string) {
fmt.Printf("\t%s\n", files[i])
}
}
- checkFiles(t, files, colDelta, false)
+ checkFiles(t, files, "", colDelta, false)
continue
}
@@ -271,6 +293,6 @@ func testDir(t *testing.T, colDelta uint, dir string) {
if testing.Verbose() {
fmt.Printf("%3d %s\n", count, path)
}
- checkFiles(t, []string{path}, colDelta, false)
+ checkFiles(t, []string{path}, "", colDelta, false)
}
}
diff --git a/src/cmd/compile/internal/types2/conversions.go b/src/cmd/compile/internal/types2/conversions.go
index 90c08fb72f..d04ccec411 100644
--- a/src/cmd/compile/internal/types2/conversions.go
+++ b/src/cmd/compile/internal/types2/conversions.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2012 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.
@@ -21,7 +20,7 @@ func (check *Checker) conversion(x *operand, T Type) {
switch {
case constArg && isConstType(T):
// constant conversion
- switch t := T.Basic(); {
+ switch t := asBasic(T); {
case representableConst(x.val, check, t, &x.val):
ok = true
case isInteger(x.typ) && isString(t):
@@ -90,8 +89,8 @@ func (x *operand) convertibleTo(check *Checker, T Type) bool {
// "x's type and T have identical underlying types if tags are ignored"
V := x.typ
- Vu := V.Under()
- Tu := T.Under()
+ Vu := under(V)
+ Tu := under(T)
if check.identicalIgnoreTags(Vu, Tu) {
return true
}
@@ -100,7 +99,7 @@ func (x *operand) convertibleTo(check *Checker, T Type) bool {
// have identical underlying types if tags are ignored"
if V, ok := V.(*Pointer); ok {
if T, ok := T.(*Pointer); ok {
- if check.identicalIgnoreTags(V.base.Under(), T.base.Under()) {
+ if check.identicalIgnoreTags(under(V.base), under(T.base)) {
return true
}
}
@@ -140,26 +139,26 @@ func (x *operand) convertibleTo(check *Checker, T Type) bool {
}
func isUintptr(typ Type) bool {
- t := typ.Basic()
+ t := asBasic(typ)
return t != nil && t.kind == Uintptr
}
func isUnsafePointer(typ Type) bool {
- // TODO(gri): Is this typ.Basic() instead of typ.(*Basic) correct?
- // (The former calls typ.Under(), while the latter doesn't.)
+ // TODO(gri): Is this asBasic(typ) instead of typ.(*Basic) correct?
+ // (The former calls under(), while the latter doesn't.)
// The spec does not say so, but gc claims it is. See also
// issue 6326.
- t := typ.Basic()
+ t := asBasic(typ)
return t != nil && t.kind == UnsafePointer
}
func isPointer(typ Type) bool {
- return typ.Pointer() != nil
+ return asPointer(typ) != nil
}
func isBytesOrRunes(typ Type) bool {
- if s := typ.Slice(); s != nil {
- t := s.elem.Basic()
+ if s := asSlice(typ); s != nil {
+ t := asBasic(s.elem)
return t != nil && (t.kind == Byte || t.kind == Rune)
}
return false
diff --git a/src/cmd/compile/internal/types2/decl.go b/src/cmd/compile/internal/types2/decl.go
index 0b7956f287..f0a037adb0 100644
--- a/src/cmd/compile/internal/types2/decl.go
+++ b/src/cmd/compile/internal/types2/decl.go
@@ -445,7 +445,7 @@ func (check *Checker) constDecl(obj *Const, typ, init syntax.Expr, inherited boo
if !isConstType(t) {
// don't report an error if the type is an invalid C (defined) type
// (issue #22090)
- if t.Under() != Typ[Invalid] {
+ if under(t) != Typ[Invalid] {
check.errorf(typ, "invalid constant type %s", t)
}
obj.typ = Typ[Invalid]
@@ -545,13 +545,13 @@ func (check *Checker) varDecl(obj *Var, lhs []*Var, typ, init syntax.Expr) {
check.initVars(lhs, []syntax.Expr{init}, nopos)
}
-// Under returns the expanded underlying type of n0; possibly by following
+// under returns the expanded underlying type of n0; possibly by following
// forward chains of named types. If an underlying type is found, resolve
// the chain by setting the underlying type for each defined type in the
// chain before returning it. If no underlying type is found or a cycle
// is detected, the result is Typ[Invalid]. If a cycle is detected and
// n0.check != nil, the cycle is reported.
-func (n0 *Named) Under() Type {
+func (n0 *Named) under() Type {
u := n0.underlying
if u == nil {
return Typ[Invalid]
@@ -559,7 +559,7 @@ func (n0 *Named) Under() Type {
// If the underlying type of a defined type is not a defined
// type, then that is the desired underlying type.
- n := u.Named()
+ n := asNamed(u)
if n == nil {
return u // common case
}
@@ -573,7 +573,7 @@ func (n0 *Named) Under() Type {
u = Typ[Invalid]
break
}
- n1 := u.Named()
+ n1 := asNamed(u)
if n1 == nil {
break // end of chain
}
@@ -584,6 +584,8 @@ func (n0 *Named) Under() Type {
if i, ok := seen[n]; ok {
// cycle
+ // TODO(gri) revert this to a method on Checker. Having a possibly
+ // nil Checker on Named and TypeParam is too subtle.
if n0.check != nil {
n0.check.cycleError(path[i:])
}
@@ -629,6 +631,9 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *Named
if alias {
// type alias declaration
+ if !check.allowVersion(obj.pkg, 1, 9) {
+ check.errorf(tdecl, "type aliases requires go1.9 or later")
+ }
obj.typ = Typ[Invalid]
obj.typ = check.anyType(tdecl.Type)
@@ -664,7 +669,7 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *syntax.TypeDecl, def *Named
// any forward chain.
// TODO(gri) Investigate if we can just use named.origin here
// and rely on lazy computation of the underlying type.
- named.underlying = named.Under()
+ named.underlying = under(named)
}
}
@@ -702,7 +707,7 @@ func (check *Checker) collectTypeParams(list []*syntax.Field) (tparams []*TypeNa
// The predeclared identifier "any" is visible only as a constraint
// in a type parameter list. Look for it before general constraint
// resolution.
- if tident, _ := f.Type.(*syntax.Name); tident != nil && tident.Value == "any" && check.lookup("any") == nil {
+ if tident, _ := unparen(f.Type).(*syntax.Name); tident != nil && tident.Value == "any" && check.lookup("any") == nil {
bound = universeAny
} else {
bound = check.typ(f.Type)
@@ -713,7 +718,7 @@ func (check *Checker) collectTypeParams(list []*syntax.Field) (tparams []*TypeNa
// we may not have a complete interface yet:
// type C(type T C) interface {}
// (issue #39724).
- if _, ok := bound.Under().(*Interface); ok {
+ if _, ok := under(bound).(*Interface); ok {
// set the type bounds
for i < j {
tparams[i].typ.(*TypeParam).bound = bound
@@ -757,7 +762,7 @@ func (check *Checker) collectMethods(obj *TypeName) {
// spec: "If the base type is a struct type, the non-blank method
// and field names must be distinct."
- base := obj.typ.Named() // shouldn't fail but be conservative
+ base := asNamed(obj.typ) // shouldn't fail but be conservative
if base != nil {
if t, _ := base.underlying.(*Struct); t != nil {
for _, fld := range t.fields {
diff --git a/src/cmd/compile/internal/types2/errors_test.go b/src/cmd/compile/internal/types2/errors_test.go
index 51ae5fdb73..cb21ff1ad3 100644
--- a/src/cmd/compile/internal/types2/errors_test.go
+++ b/src/cmd/compile/internal/types2/errors_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2020 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.
diff --git a/src/cmd/compile/internal/types2/example_test.go b/src/cmd/compile/internal/types2/example_test.go
index ffd54fe459..974acb82ef 100644
--- a/src/cmd/compile/internal/types2/example_test.go
+++ b/src/cmd/compile/internal/types2/example_test.go
@@ -6,6 +6,7 @@
// Only run where builders (build.golang.org) have
// access to compiled packages for import.
//
+//go:build !arm && !arm64
// +build !arm,!arm64
package types2_test
diff --git a/src/cmd/compile/internal/types2/examples/types.go2 b/src/cmd/compile/internal/types2/examples/types.go2
index f094880c49..a081f61c01 100644
--- a/src/cmd/compile/internal/types2/examples/types.go2
+++ b/src/cmd/compile/internal/types2/examples/types.go2
@@ -261,4 +261,20 @@ func _(_ comparable /* ERROR comparable */ , _ C /* ERROR comparable */ )
func _() {
var _ comparable /* ERROR comparable */
var _ C /* ERROR comparable */
-} \ No newline at end of file
+}
+
+// Type parameters are never const types, i.e., it's
+// not possible to declare a constant of type parameter type.
+// (If a type list contains just a single const type, we could
+// allow it, but such type lists don't make much sense in the
+// first place.)
+func _[T interface { type int, float64 }]() {
+ // not valid
+ const _ = T /* ERROR not constant */ (0)
+ const _ T /* ERROR invalid constant type T */ = 1
+
+ // valid
+ var _ = T(0)
+ var _ T = 1
+ _ = T(0)
+}
diff --git a/src/cmd/compile/internal/types2/expr.go b/src/cmd/compile/internal/types2/expr.go
index a1a626fb33..584b8ee6a0 100644
--- a/src/cmd/compile/internal/types2/expr.go
+++ b/src/cmd/compile/internal/types2/expr.go
@@ -59,11 +59,16 @@ the type (and constant value, if any) is recorded via Info.Types, if present.
type opPredicates map[syntax.Operator]func(Type) bool
-var unaryOpPredicates = opPredicates{
- syntax.Add: isNumeric,
- syntax.Sub: isNumeric,
- syntax.Xor: isInteger,
- syntax.Not: isBoolean,
+var unaryOpPredicates opPredicates
+
+func init() {
+ // Setting unaryOpPredicates in init avoids declaration cycles.
+ unaryOpPredicates = opPredicates{
+ syntax.Add: isNumeric,
+ syntax.Sub: isNumeric,
+ syntax.Xor: isInteger,
+ syntax.Not: isBoolean,
+ }
}
func (check *Checker) op(m opPredicates, x *operand, op syntax.Operator) bool {
@@ -96,9 +101,7 @@ func (check *Checker) overflow(x *operand) {
what := "" // operator description, if any
if op, _ := x.expr.(*syntax.Operation); op != nil {
pos = op.Pos()
- if int(op.Op) < len(op2str) {
- what = op2str[op.Op]
- }
+ what = opName(op)
}
if x.val.Kind() == constant.Unknown {
@@ -112,20 +115,42 @@ func (check *Checker) overflow(x *operand) {
// Typed constants must be representable in
// their type after each constant operation.
if isTyped(x.typ) {
- check.representable(x, x.typ.Basic())
+ check.representable(x, asBasic(x.typ))
return
}
// Untyped integer values must not grow arbitrarily.
- const limit = 4 * 512 // 512 is the constant precision - we need more because old tests had no limits
- if x.val.Kind() == constant.Int && constant.BitLen(x.val) > limit {
+ const prec = 512 // 512 is the constant precision
+ if x.val.Kind() == constant.Int && constant.BitLen(x.val) > prec {
check.errorf(pos, "constant %s overflow", what)
x.val = constant.MakeUnknown()
}
}
-// This is only used for operations that may cause overflow.
-var op2str = [...]string{
+// opName returns the name of an operation, or the empty string.
+// For now, only operations that might overflow are handled.
+// TODO(gri) Expand this to a general mechanism giving names to
+// nodes?
+func opName(e *syntax.Operation) string {
+ op := int(e.Op)
+ if e.Y == nil {
+ if op < len(op2str1) {
+ return op2str1[op]
+ }
+ } else {
+ if op < len(op2str2) {
+ return op2str2[op]
+ }
+ }
+ return ""
+}
+
+// Entries must be "" or end with a space.
+var op2str1 = [...]string{
+ syntax.Xor: "bitwise complement",
+}
+
+var op2str2 = [...]string{
syntax.Add: "addition",
syntax.Sub: "subtraction",
syntax.Xor: "bitwise XOR",
@@ -153,7 +178,7 @@ func (check *Checker) unary(x *operand, e *syntax.Operation) {
return
case syntax.Recv:
- typ := x.typ.Chan()
+ typ := asChan(x.typ)
if typ == nil {
check.invalidOpf(x, "cannot receive from non-channel %s", x)
x.mode = invalid
@@ -523,7 +548,7 @@ func (check *Checker) updateExprType(x syntax.Expr, typ Type, final bool) {
// If the new type is not final and still untyped, just
// update the recorded type.
if !final && isUntyped(typ) {
- old.typ = typ.Basic()
+ old.typ = asBasic(typ)
check.untyped[x] = old
return
}
@@ -595,7 +620,7 @@ func (check *Checker) convertUntyped(x *operand, target Type) {
// TODO(gri) We should not need this because we have the code
// for Sum types in convertUntypedInternal. But at least one
// test fails. Investigate.
- if t := target.TypeParam(); t != nil {
+ if t := asTypeParam(target); t != nil {
types := t.Bound().allTypes
if types == nil {
goto Error
@@ -636,7 +661,7 @@ func (check *Checker) convertUntypedInternal(x *operand, target Type) {
}
// typed target
- switch t := optype(target.Under()).(type) {
+ switch t := optype(target).(type) {
case *Basic:
if x.mode == constant_ {
check.representable(x, t)
@@ -796,12 +821,25 @@ func (check *Checker) shift(x, y *operand, e syntax.Expr, op syntax.Operator) {
check.invalidOpf(y, "shift count %s must be integer", y)
x.mode = invalid
return
+ } else if !isUnsigned(y.typ) && !check.allowVersion(check.pkg, 1, 13) {
+ check.invalidOpf(y, "signed shift count %s requires go1.13 or later", y)
+ x.mode = invalid
+ return
}
if x.mode == constant_ {
if y.mode == constant_ {
+ // if either x or y has an unknown value, the result is unknown
+ if x.val.Kind() == constant.Unknown || y.val.Kind() == constant.Unknown {
+ x.val = constant.MakeUnknown()
+ // ensure the correct type - see comment below
+ if !isInteger(x.typ) {
+ x.typ = Typ[UntypedInt]
+ }
+ return
+ }
// rhs must be within reasonable bounds in constant shifts
- const shiftBound = 1023 - 1 + 52 // so we can express smallestFloat64
+ const shiftBound = 1023 - 1 + 52 // so we can express smallestFloat64 (see issue #44057)
s, ok := constant.Uint64Val(y.val)
if !ok || s > shiftBound {
check.invalidOpf(y, "invalid shift count %s", y)
@@ -863,20 +901,25 @@ func (check *Checker) shift(x, y *operand, e syntax.Expr, op syntax.Operator) {
x.mode = value
}
-var binaryOpPredicates = opPredicates{
- syntax.Add: isNumericOrString,
- syntax.Sub: isNumeric,
- syntax.Mul: isNumeric,
- syntax.Div: isNumeric,
- syntax.Rem: isInteger,
+var binaryOpPredicates opPredicates
- syntax.And: isInteger,
- syntax.Or: isInteger,
- syntax.Xor: isInteger,
- syntax.AndNot: isInteger,
+func init() {
+ // Setting binaryOpPredicates in init avoids declaration cycles.
+ binaryOpPredicates = opPredicates{
+ syntax.Add: isNumericOrString,
+ syntax.Sub: isNumeric,
+ syntax.Mul: isNumeric,
+ syntax.Div: isNumeric,
+ syntax.Rem: isInteger,
- syntax.AndAnd: isBoolean,
- syntax.OrOr: isBoolean,
+ syntax.And: isInteger,
+ syntax.Or: isInteger,
+ syntax.Xor: isInteger,
+ syntax.AndNot: isInteger,
+
+ syntax.AndAnd: isBoolean,
+ syntax.OrOr: isBoolean,
+ }
}
// If e != nil, it must be the binary expression; it may be nil for non-constant expressions
@@ -1156,6 +1199,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
}
switch e.Kind {
case syntax.IntLit, syntax.FloatLit, syntax.ImagLit:
+ check.langCompat(e)
// The max. mantissa precision for untyped numeric values
// is 512 bits, or 4048 bits for each of the two integer
// parts of a fraction for floating-point numbers that are
@@ -1224,7 +1268,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
case hint != nil:
// no composite literal type present - use hint (element type of enclosing type)
typ = hint
- base, _ = deref(typ.Under()) // *T implies &T{}
+ base, _ = deref(under(typ)) // *T implies &T{}
default:
// TODO(gri) provide better error messages depending on context
@@ -1232,7 +1276,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
goto Error
}
- switch utyp := optype(base.Under()).(type) {
+ switch utyp := optype(base).(type) {
case *Struct:
if len(e.ElemList) == 0 {
break
@@ -1362,7 +1406,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
duplicate := false
// if the key is of interface type, the type is also significant when checking for duplicates
xkey := keyVal(x.val)
- if utyp.key.Interface() != nil {
+ if asInterface(utyp.key) != nil {
for _, vtyp := range visited[xkey] {
if check.identical(vtyp, x.typ) {
duplicate = true
@@ -1431,7 +1475,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
}
if x.mode == value {
- if sig := x.typ.Signature(); sig != nil && len(sig.tparams) > 0 {
+ if sig := asSignature(x.typ); sig != nil && len(sig.tparams) > 0 {
// function instantiation
check.funcInst(x, e)
return expression
@@ -1441,7 +1485,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
// ordinary index expression
valid := false
length := int64(-1) // valid if >= 0
- switch typ := optype(x.typ.Under()).(type) {
+ switch typ := optype(x.typ).(type) {
case *Basic:
if isString(typ) {
valid = true
@@ -1464,7 +1508,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
x.typ = typ.elem
case *Pointer:
- if typ := typ.base.Array(); typ != nil {
+ if typ := asArray(typ.base); typ != nil {
valid = true
length = typ.len
x.mode = variable
@@ -1494,7 +1538,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
nmaps := 0 // number of map types in sum type
if typ.is(func(t Type) bool {
var e Type
- switch t := t.Under().(type) {
+ switch t := under(t).(type) {
case *Basic:
if isString(t) {
e = universeByte
@@ -1502,7 +1546,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
case *Array:
e = t.elem
case *Pointer:
- if t := t.base.Array(); t != nil {
+ if t := asArray(t.base); t != nil {
e = t.elem
}
case *Slice:
@@ -1603,7 +1647,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
valid := false
length := int64(-1) // valid if >= 0
- switch typ := optype(x.typ.Under()).(type) {
+ switch typ := optype(x.typ).(type) {
case *Basic:
if isString(typ) {
if e.Full {
@@ -1631,7 +1675,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
x.typ = &Slice{elem: typ.elem}
case *Pointer:
- if typ := typ.base.Array(); typ != nil {
+ if typ := asArray(typ.base); typ != nil {
valid = true
length = typ.len
x.typ = &Slice{elem: typ.elem}
@@ -1704,7 +1748,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
if x.mode == invalid {
goto Error
}
- xtyp, _ := x.typ.Under().(*Interface)
+ xtyp, _ := under(x.typ).(*Interface)
if xtyp == nil {
check.errorf(x, "%s is not an interface type", x)
goto Error
@@ -1763,7 +1807,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
case typexpr:
x.typ = &Pointer{base: x.typ}
default:
- if typ := x.typ.Pointer(); typ != nil {
+ if typ := asPointer(x.typ); typ != nil {
x.mode = variable
x.typ = typ.base
} else {
diff --git a/src/cmd/compile/internal/types2/fixedbugs/issue44688.go2 b/src/cmd/compile/internal/types2/fixedbugs/issue44688.go2
new file mode 100644
index 0000000000..512bfcc922
--- /dev/null
+++ b/src/cmd/compile/internal/types2/fixedbugs/issue44688.go2
@@ -0,0 +1,83 @@
+// Copyright 2021 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.
+
+package P
+
+type A1[T any] struct{}
+
+func (*A1[T]) m1(T) {}
+
+type A2[T any] interface {
+ m2(T)
+}
+
+type B1[T any] struct {
+ filler int
+ *A1[T]
+ A2[T]
+}
+
+type B2[T any] interface {
+ A2[T]
+}
+
+type C[T any] struct {
+ filler1 int
+ filler2 int
+ B1[T]
+}
+
+type D[T any] struct {
+ filler1 int
+ filler2 int
+ filler3 int
+ C[T]
+}
+
+func _() {
+ // calling embedded methods
+ var b1 B1[string]
+
+ b1.A1.m1("")
+ b1.m1("")
+
+ b1.A2.m2("")
+ b1.m2("")
+
+ var b2 B2[string]
+ b2.m2("")
+
+ // a deeper nesting
+ var d D[string]
+ d.m1("")
+ d.m2("")
+
+ // calling method expressions
+ m1x := B1[string].m1
+ m1x(b1, "")
+ m2x := B2[string].m2
+ m2x(b2, "")
+
+ // calling method values
+ m1v := b1.m1
+ m1v("")
+ m2v := b1.m2
+ m2v("")
+ b2v := b2.m2
+ b2v("")
+}
+
+// actual test case from issue
+
+type A[T any] struct{}
+
+func (*A[T]) f(T) {}
+
+type B[T any] struct{ A[T] }
+
+func _() {
+ var b B[string]
+ b.A.f("")
+ b.f("")
+}
diff --git a/src/cmd/compile/internal/types2/infer.go b/src/cmd/compile/internal/types2/infer.go
index 125d3f31b9..061b919239 100644
--- a/src/cmd/compile/internal/types2/infer.go
+++ b/src/cmd/compile/internal/types2/infer.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// 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.
@@ -15,7 +14,7 @@ import "bytes"
// is impossible because unification fails, an error is reported and the resulting types list is
// nil, and index is 0. Otherwise, types is the list of inferred type arguments, and index is
// the index of the first type argument in that list that couldn't be inferred (and thus is nil).
-// If all type arguments where inferred successfully, index is < 0.
+// If all type arguments were inferred successfully, index is < 0.
func (check *Checker) infer(tparams []*TypeName, params *Tuple, args []*operand) (types []Type, index int) {
assert(params.Len() == len(args))
@@ -70,7 +69,7 @@ func (check *Checker) infer(tparams []*TypeName, params *Tuple, args []*operand)
if targ := arg.typ; isTyped(targ) {
// If we permit bidirectional unification, and targ is
// a generic function, we need to initialize u.y with
- // the respectice type parameters of targ.
+ // the respective type parameters of targ.
if !u.unify(par.typ, targ) {
errorf("type", par.typ, targ, arg)
return nil, 0
@@ -290,21 +289,19 @@ func (check *Checker) inferB(tparams []*TypeName, targs []Type) (types []Type, i
// Unify type parameters with their structural constraints, if any.
for _, tpar := range tparams {
typ := tpar.typ.(*TypeParam)
- sbound := check.structuralType(typ.bound.Under())
+ sbound := check.structuralType(typ.bound)
if sbound != nil {
- //check.dump(">>> unify(%s, %s)", tpar, sbound)
if !u.unify(typ, sbound) {
check.errorf(tpar.pos, "%s does not match %s", tpar, sbound)
return nil, 0
}
- //check.dump(">>> => indices = %v, types = %s", u.x.indices, u.types)
}
}
// u.x.types() now contains the incoming type arguments plus any additional type
// arguments for which there were structural constraints. The newly inferred non-
// nil entries may still contain references to other type parameters. For instance,
- // for [type A interface{}, B interface{type []C}, C interface{type *A}], if A == int
+ // for [A any, B interface{type []C}, C interface{type *A}], if A == int
// was given, unification produced the type list [int, []C, *A]. We eliminate the
// remaining type parameters by substituting the type parameters in this type list
// until nothing changes anymore.
@@ -316,7 +313,7 @@ func (check *Checker) inferB(tparams []*TypeName, targs []Type) (types []Type, i
}
// dirty tracks the indices of all types that may still contain type parameters.
- // We know that nil types entries and entries corresponding to provided (non-nil)
+ // We know that nil type entries and entries corresponding to provided (non-nil)
// type arguments are clean, so exclude them from the start.
var dirty []int
for i, typ := range types {
@@ -326,8 +323,8 @@ func (check *Checker) inferB(tparams []*TypeName, targs []Type) (types []Type, i
}
for len(dirty) > 0 {
- // TODO(gri) Instead of creating a new smap for each iteration,
- // provide an update operation for smaps and only change when
+ // TODO(gri) Instead of creating a new substMap for each iteration,
+ // provide an update operation for substMaps and only change when
// needed. Optimization.
smap := makeSubstMap(tparams, types)
n := 0
@@ -341,14 +338,13 @@ func (check *Checker) inferB(tparams []*TypeName, targs []Type) (types []Type, i
}
dirty = dirty[:n]
}
- //check.dump(">>> inferred types = %s", types)
return
}
// structuralType returns the structural type of a constraint, if any.
func (check *Checker) structuralType(constraint Type) Type {
- if iface, _ := constraint.(*Interface); iface != nil {
+ if iface, _ := under(constraint).(*Interface); iface != nil {
check.completeInterface(nopos, iface)
types := unpack(iface.allTypes)
if len(types) == 1 {
diff --git a/src/cmd/compile/internal/types2/issues_test.go b/src/cmd/compile/internal/types2/issues_test.go
index 9a73a46d11..e1f5c92fc4 100644
--- a/src/cmd/compile/internal/types2/issues_test.go
+++ b/src/cmd/compile/internal/types2/issues_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
@@ -29,7 +28,6 @@ func mustParse(t *testing.T, src string) *syntax.File {
func TestIssue5770(t *testing.T) {
f := mustParse(t, `package p; type S struct{T}`)
var conf Config
- // conf := Config{Importer: importer.Default()}
_, err := conf.Check(f.PkgName.Value, []*syntax.File{f}, nil) // do not crash
want := "undeclared name: T"
if err == nil || !strings.Contains(err.Error(), want) {
@@ -76,7 +74,7 @@ var (
}
case *syntax.Name:
if x.Value == "nil" {
- want = NewInterfaceType(nil, nil) // interface{}
+ want = NewInterfaceType(nil, nil) // interface{} (for now, go/types types this as "untyped nil")
}
}
if want != nil && !Identical(tv.Type, want) {
@@ -300,8 +298,6 @@ func TestIssue22525(t *testing.T) {
}
func TestIssue25627(t *testing.T) {
- t.Skip("requires syntax tree inspection")
-
const prefix = `package p; import "unsafe"; type P *struct{}; type I interface{}; type T `
// The src strings (without prefix) are constructed such that the number of semicolons
// plus one corresponds to the number of fields expected in the respective struct.
@@ -325,20 +321,17 @@ func TestIssue25627(t *testing.T) {
}
}
- unimplemented()
- /*
- ast.Inspect(f, func(n syntax.Node) bool {
- if spec, _ := n.(*syntax.TypeDecl); spec != nil {
- if tv, ok := info.Types[spec.Type]; ok && spec.Name.Value == "T" {
- want := strings.Count(src, ";") + 1
- if got := tv.Type.(*Struct).NumFields(); got != want {
- t.Errorf("%s: got %d fields; want %d", src, got, want)
- }
+ syntax.Walk(f, func(n syntax.Node) bool {
+ if decl, _ := n.(*syntax.TypeDecl); decl != nil {
+ if tv, ok := info.Types[decl.Type]; ok && decl.Name.Value == "T" {
+ want := strings.Count(src, ";") + 1
+ if got := tv.Type.(*Struct).NumFields(); got != want {
+ t.Errorf("%s: got %d fields; want %d", src, got, want)
}
}
- return true
- })
- */
+ }
+ return false
+ })
}
}
@@ -391,10 +384,7 @@ func TestIssue28005(t *testing.T) {
if obj == nil {
t.Fatal("object X not found")
}
- iface := obj.Type().Interface() // object X must be an interface
- if iface == nil {
- t.Fatalf("%s is not an interface", obj)
- }
+ iface := obj.Type().Underlying().(*Interface) // object X must be an interface
// Each iface method m is embedded; and m's receiver base type name
// must match the method's name per the choice in the source file.
@@ -414,7 +404,7 @@ func TestIssue28282(t *testing.T) {
it := NewInterfaceType(nil, []Type{et})
it.Complete()
// verify that after completing the interface, the embedded method remains unchanged
- want := et.Interface().Method(0)
+ want := et.Underlying().(*Interface).Method(0)
got := it.Method(0)
if got != want {
t.Fatalf("%s.Method(0): got %q (%p); want %q (%p)", it, got, got, want, want)
@@ -534,25 +524,47 @@ func TestIssue34921(t *testing.T) {
func TestIssue43088(t *testing.T) {
// type T1 struct {
- // x T2
+ // _ T2
// }
//
// type T2 struct {
- // x struct {
- // x T2
+ // _ struct {
+ // _ T2
// }
// }
n1 := NewTypeName(syntax.Pos{}, nil, "T1", nil)
T1 := NewNamed(n1, nil, nil)
n2 := NewTypeName(syntax.Pos{}, nil, "T2", nil)
T2 := NewNamed(n2, nil, nil)
- s1 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "x", T2, false)}, nil)
+ s1 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "_", T2, false)}, nil)
T1.SetUnderlying(s1)
- s2 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "x", T2, false)}, nil)
- s3 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "x", s2, false)}, nil)
+ s2 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "_", T2, false)}, nil)
+ s3 := NewStruct([]*Var{NewField(syntax.Pos{}, nil, "_", s2, false)}, nil)
T2.SetUnderlying(s3)
// These calls must terminate (no endless recursion).
Comparable(T1)
Comparable(T2)
}
+
+func TestIssue44515(t *testing.T) {
+ typ := Unsafe.Scope().Lookup("Pointer").Type()
+
+ got := TypeString(typ, nil)
+ want := "unsafe.Pointer"
+ if got != want {
+ t.Errorf("got %q; want %q", got, want)
+ }
+
+ qf := func(pkg *Package) string {
+ if pkg == Unsafe {
+ return "foo"
+ }
+ return ""
+ }
+ got = TypeString(typ, qf)
+ want = "foo.Pointer"
+ if got != want {
+ t.Errorf("got %q; want %q", got, want)
+ }
+}
diff --git a/src/cmd/compile/internal/types2/labels.go b/src/cmd/compile/internal/types2/labels.go
index ca5fe6b389..b20b454dea 100644
--- a/src/cmd/compile/internal/types2/labels.go
+++ b/src/cmd/compile/internal/types2/labels.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
diff --git a/src/cmd/compile/internal/types2/lookup.go b/src/cmd/compile/internal/types2/lookup.go
index 5dfb8bfee7..34d18acdfc 100644
--- a/src/cmd/compile/internal/types2/lookup.go
+++ b/src/cmd/compile/internal/types2/lookup.go
@@ -54,7 +54,7 @@ func (check *Checker) lookupFieldOrMethod(T Type, addressable bool, pkg *Package
// Thus, if we have a named pointer type, proceed with the underlying
// pointer type but discard the result if it is a method since we would
// not have found it for T (see also issue 8590).
- if t := T.Named(); t != nil {
+ if t := asNamed(T); t != nil {
if p, _ := t.underlying.(*Pointer); p != nil {
obj, index, indirect = check.rawLookupFieldOrMethod(p, false, pkg, name)
if _, ok := obj.(*Func); ok {
@@ -112,7 +112,7 @@ func (check *Checker) rawLookupFieldOrMethod(T Type, addressable bool, pkg *Pack
// If we have a named type, we may have associated methods.
// Look for those first.
- if named := typ.Named(); named != nil {
+ if named := asNamed(typ); named != nil {
if seen[named] {
// We have seen this type before, at a more shallow depth
// (note that multiples of this type at the current depth
@@ -141,8 +141,8 @@ func (check *Checker) rawLookupFieldOrMethod(T Type, addressable bool, pkg *Pack
// continue with underlying type, but only if it's not a type parameter
// TODO(gri) is this what we want to do for type parameters? (spec question)
- typ = named.Under()
- if typ.TypeParam() != nil {
+ typ = under(named)
+ if asTypeParam(typ) != nil {
continue
}
}
@@ -314,7 +314,7 @@ func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method,
return
}
- if ityp := V.Interface(); ityp != nil {
+ if ityp := asInterface(V); ityp != nil {
check.completeInterface(nopos, ityp)
// TODO(gri) allMethods is sorted - can do this more efficiently
for _, m := range T.allMethods {
@@ -352,7 +352,7 @@ func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method,
// A concrete type implements T if it implements all methods of T.
Vd, _ := deref(V)
- Vn := Vd.Named()
+ Vn := asNamed(Vd)
for _, m := range T.allMethods {
// TODO(gri) should this be calling lookupFieldOrMethod instead (and why not)?
obj, _, _ := check.rawLookupFieldOrMethod(V, false, m.pkg, m.name)
@@ -434,7 +434,7 @@ func (check *Checker) assertableTo(V *Interface, T Type, strict bool) (method, w
// no static check is required if T is an interface
// spec: "If T is an interface type, x.(T) asserts that the
// dynamic type of x implements the interface T."
- if T.Interface() != nil && !(strict || forceStrict) {
+ if asInterface(T) != nil && !(strict || forceStrict) {
return
}
return check.missingMethod(T, V, false)
@@ -452,8 +452,8 @@ func deref(typ Type) (Type, bool) {
// derefStructPtr dereferences typ if it is a (named or unnamed) pointer to a
// (named or unnamed) struct and returns its base. Otherwise it returns typ.
func derefStructPtr(typ Type) Type {
- if p := typ.Pointer(); p != nil {
- if p.base.Struct() != nil {
+ if p := asPointer(typ); p != nil {
+ if asStruct(p.base) != nil {
return p.base
}
}
diff --git a/src/cmd/compile/internal/types2/object.go b/src/cmd/compile/internal/types2/object.go
index b42662222f..844bc34b6a 100644
--- a/src/cmd/compile/internal/types2/object.go
+++ b/src/cmd/compile/internal/types2/object.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
@@ -462,7 +461,7 @@ func writeObject(buf *bytes.Buffer, obj Object, qf Qualifier) {
if tname.IsAlias() {
buf.WriteString(" =")
} else {
- typ = typ.Under()
+ typ = under(typ)
}
}
diff --git a/src/cmd/compile/internal/types2/object_test.go b/src/cmd/compile/internal/types2/object_test.go
index 8f11c87451..7f63c79332 100644
--- a/src/cmd/compile/internal/types2/object_test.go
+++ b/src/cmd/compile/internal/types2/object_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2016 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.
diff --git a/src/cmd/compile/internal/types2/operand.go b/src/cmd/compile/internal/types2/operand.go
index dcd29fbce0..001e905a7b 100644
--- a/src/cmd/compile/internal/types2/operand.go
+++ b/src/cmd/compile/internal/types2/operand.go
@@ -180,7 +180,7 @@ func operandString(x *operand, qf Qualifier) string {
switch {
case isGeneric(x.typ):
intro = " of generic type "
- case x.typ.TypeParam() != nil:
+ case asTypeParam(x.typ) != nil:
intro = " of type parameter type "
default:
intro = " of type "
@@ -257,8 +257,8 @@ func (x *operand) assignableTo(check *Checker, T Type, reason *string) bool {
return true
}
- Vu := optype(V.Under())
- Tu := optype(T.Under())
+ Vu := optype(V)
+ Tu := optype(T)
// x is an untyped value representable by a value of type T
// TODO(gri) This is borrowing from checker.convertUntyped and
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go
index 94a9b64761..ae186a0b5d 100644
--- a/src/cmd/compile/internal/types2/predicates.go
+++ b/src/cmd/compile/internal/types2/predicates.go
@@ -25,7 +25,7 @@ func isGeneric(typ Type) bool {
}
func is(typ Type, what BasicInfo) bool {
- switch t := optype(typ.Under()).(type) {
+ switch t := optype(typ).(type) {
case *Basic:
return t.info&what != 0
case *Sum:
@@ -69,12 +69,17 @@ func isUntyped(typ Type) bool {
return !isTyped(typ)
}
-func isOrdered(typ Type) bool { return is(typ, IsOrdered) }
-func isConstType(typ Type) bool { return is(typ, IsConstType) }
+func isOrdered(typ Type) bool { return is(typ, IsOrdered) }
+
+func isConstType(typ Type) bool {
+ // Type parameters are never const types.
+ t, _ := under(typ).(*Basic)
+ return t != nil && t.info&IsConstType != 0
+}
// IsInterface reports whether typ is an interface type.
func IsInterface(typ Type) bool {
- return typ.Interface() != nil
+ return asInterface(typ) != nil
}
// Comparable reports whether values of type T are comparable.
@@ -99,11 +104,11 @@ func comparable(T Type, seen map[Type]bool) bool {
// interface{ comparable; type []byte }
//
// is not comparable because []byte is not comparable.
- if t := T.TypeParam(); t != nil && optype(t) == theTop {
+ if t := asTypeParam(T); t != nil && optype(t) == theTop {
return t.Bound().IsComparable()
}
- switch t := optype(T.Under()).(type) {
+ switch t := optype(T).(type) {
case *Basic:
// assume invalid types to be comparable
// to avoid follow-up errors
@@ -132,7 +137,7 @@ func comparable(T Type, seen map[Type]bool) bool {
// hasNil reports whether a type includes the nil value.
func hasNil(typ Type) bool {
- switch t := optype(typ.Under()).(type) {
+ switch t := optype(typ).(type) {
case *Basic:
return t.kind == UnsafePointer
case *Slice, *Pointer, *Signature, *Interface, *Map, *Chan:
diff --git a/src/cmd/compile/internal/types2/resolver_test.go b/src/cmd/compile/internal/types2/resolver_test.go
index 983e8ec4d6..aee435ff5f 100644
--- a/src/cmd/compile/internal/types2/resolver_test.go
+++ b/src/cmd/compile/internal/types2/resolver_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2011 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.
diff --git a/src/cmd/compile/internal/types2/return.go b/src/cmd/compile/internal/types2/return.go
index 88234b1723..204e456a91 100644
--- a/src/cmd/compile/internal/types2/return.go
+++ b/src/cmd/compile/internal/types2/return.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
diff --git a/src/cmd/compile/internal/types2/sanitize.go b/src/cmd/compile/internal/types2/sanitize.go
index bac569416b..cd1719c8c0 100644
--- a/src/cmd/compile/internal/types2/sanitize.go
+++ b/src/cmd/compile/internal/types2/sanitize.go
@@ -1,10 +1,16 @@
-// UNREVIEWED
// Copyright 2020 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.
package types2
+// sanitizeInfo walks the types contained in info to ensure that all instances
+// are expanded.
+//
+// This includes some objects that may be shared across concurrent
+// type-checking passes (such as those in the universe scope), so we are
+// careful here not to write types that are already sanitized. This avoids a
+// data race as any shared types should already be sanitized.
func sanitizeInfo(info *Info) {
var s sanitizer = make(map[Type]Type)
@@ -12,27 +18,42 @@ func sanitizeInfo(info *Info) {
// If modified, they must be assigned back.
for e, tv := range info.Types {
- tv.Type = s.typ(tv.Type)
- info.Types[e] = tv
+ if typ := s.typ(tv.Type); typ != tv.Type {
+ tv.Type = typ
+ info.Types[e] = tv
+ }
}
for e, inf := range info.Inferred {
+ changed := false
for i, targ := range inf.Targs {
- inf.Targs[i] = s.typ(targ)
+ if typ := s.typ(targ); typ != targ {
+ inf.Targs[i] = typ
+ changed = true
+ }
+ }
+ if typ := s.typ(inf.Sig); typ != inf.Sig {
+ inf.Sig = typ.(*Signature)
+ changed = true
+ }
+ if changed {
+ info.Inferred[e] = inf
}
- inf.Sig = s.typ(inf.Sig).(*Signature)
- info.Inferred[e] = inf
}
for _, obj := range info.Defs {
if obj != nil {
- obj.setType(s.typ(obj.Type()))
+ if typ := s.typ(obj.Type()); typ != obj.Type() {
+ obj.setType(typ)
+ }
}
}
for _, obj := range info.Uses {
if obj != nil {
- obj.setType(s.typ(obj.Type()))
+ if typ := s.typ(obj.Type()); typ != obj.Type() {
+ obj.setType(typ)
+ }
}
}
@@ -56,16 +77,22 @@ func (s sanitizer) typ(typ Type) Type {
// nothing to do
case *Array:
- t.elem = s.typ(t.elem)
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Slice:
- t.elem = s.typ(t.elem)
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Struct:
s.varList(t.fields)
case *Pointer:
- t.base = s.typ(t.base)
+ if base := s.typ(t.base); base != t.base {
+ t.base = base
+ }
case *Tuple:
s.tuple(t)
@@ -86,27 +113,39 @@ func (s sanitizer) typ(typ Type) Type {
s.typ(t.allTypes)
case *Map:
- t.key = s.typ(t.key)
- t.elem = s.typ(t.elem)
+ if key := s.typ(t.key); key != t.key {
+ t.key = key
+ }
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Chan:
- t.elem = s.typ(t.elem)
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Named:
- t.orig = s.typ(t.orig)
- t.underlying = s.typ(t.underlying)
+ if orig := s.typ(t.orig); orig != t.orig {
+ t.orig = orig
+ }
+ if under := s.typ(t.underlying); under != t.underlying {
+ t.underlying = under
+ }
s.typeList(t.targs)
s.funcList(t.methods)
case *TypeParam:
- t.bound = s.typ(t.bound)
+ if bound := s.typ(t.bound); bound != t.bound {
+ t.bound = bound
+ }
case *instance:
typ = t.expand()
s[t] = typ
default:
- unimplemented()
+ panic("unimplemented")
}
return typ
@@ -114,7 +153,9 @@ func (s sanitizer) typ(typ Type) Type {
func (s sanitizer) var_(v *Var) {
if v != nil {
- v.typ = s.typ(v.typ)
+ if typ := s.typ(v.typ); typ != v.typ {
+ v.typ = typ
+ }
}
}
@@ -132,7 +173,9 @@ func (s sanitizer) tuple(t *Tuple) {
func (s sanitizer) func_(f *Func) {
if f != nil {
- f.typ = s.typ(f.typ)
+ if typ := s.typ(f.typ); typ != f.typ {
+ f.typ = typ
+ }
}
}
@@ -144,6 +187,8 @@ func (s sanitizer) funcList(list []*Func) {
func (s sanitizer) typeList(list []Type) {
for i, t := range list {
- list[i] = s.typ(t)
+ if typ := s.typ(t); typ != t {
+ list[i] = typ
+ }
}
}
diff --git a/src/cmd/compile/internal/types2/selection.go b/src/cmd/compile/internal/types2/selection.go
index 8128aeee2e..02c0fc6902 100644
--- a/src/cmd/compile/internal/types2/selection.go
+++ b/src/cmd/compile/internal/types2/selection.go
@@ -51,6 +51,22 @@ func (s *Selection) Kind() SelectionKind { return s.kind }
// Recv returns the type of x in x.f.
func (s *Selection) Recv() Type { return s.recv }
+// Work-around for a compiler issue where an (*instance) escapes.
+// TODO(gri): Is this still needed?
+func (s *Selection) TArgs() []Type {
+ r := s.recv
+ if p := asPointer(r); p != nil {
+ r = p.Elem()
+ }
+ if n := asNamed(r); n != nil {
+ return n.TArgs()
+ }
+ // The base type (after skipping any pointer) must be a Named type. The
+ // bug is that sometimes it can be an instance type (which is supposed to
+ // be an internal type only).
+ return r.(*instance).targs
+}
+
// Obj returns the object denoted by x.f; a *Var for
// a field selection, and a *Func in all other cases.
func (s *Selection) Obj() Object { return s.obj }
diff --git a/src/cmd/compile/internal/types2/sizes.go b/src/cmd/compile/internal/types2/sizes.go
index cae71c139c..aa0fbf40fc 100644
--- a/src/cmd/compile/internal/types2/sizes.go
+++ b/src/cmd/compile/internal/types2/sizes.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
@@ -49,7 +48,7 @@ type StdSizes struct {
func (s *StdSizes) Alignof(T Type) int64 {
// For arrays and structs, alignment is defined in terms
// of alignment of the elements and fields, respectively.
- switch t := optype(T.Under()).(type) {
+ switch t := optype(T).(type) {
case *Array:
// spec: "For a variable x of array type: unsafe.Alignof(x)
// is the same as unsafe.Alignof(x[0]), but at least 1."
@@ -119,7 +118,7 @@ var basicSizes = [...]byte{
}
func (s *StdSizes) Sizeof(T Type) int64 {
- switch t := optype(T.Under()).(type) {
+ switch t := optype(T).(type) {
case *Basic:
assert(isTyped(T))
k := t.kind
@@ -242,7 +241,7 @@ func (conf *Config) offsetsof(T *Struct) []int64 {
func (conf *Config) offsetof(typ Type, index []int) int64 {
var o int64
for _, i := range index {
- s := typ.Struct()
+ s := asStruct(typ)
o += conf.offsetsof(s)[i]
typ = s.fields[i].typ
}
diff --git a/src/cmd/compile/internal/types2/sizes_test.go b/src/cmd/compile/internal/types2/sizes_test.go
index b246909d2a..c9a4942bed 100644
--- a/src/cmd/compile/internal/types2/sizes_test.go
+++ b/src/cmd/compile/internal/types2/sizes_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2016 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.
diff --git a/src/cmd/compile/internal/types2/stdlib_test.go b/src/cmd/compile/internal/types2/stdlib_test.go
index 1dd3229852..34925687e3 100644
--- a/src/cmd/compile/internal/types2/stdlib_test.go
+++ b/src/cmd/compile/internal/types2/stdlib_test.go
@@ -110,6 +110,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
// get per-file instructions
expectErrors := false
filename := filepath.Join(path, f.Name())
+ goVersion := ""
if comment := firstComment(filename); comment != "" {
fields := strings.Fields(comment)
switch fields[0] {
@@ -119,13 +120,17 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
expectErrors = true
for _, arg := range fields[1:] {
if arg == "-0" || arg == "-+" || arg == "-std" {
- // Marked explicitly as not expected errors (-0),
+ // Marked explicitly as not expecting errors (-0),
// or marked as compiling runtime/stdlib, which is only done
// to trigger runtime/stdlib-only error output.
// In both cases, the code should typecheck.
expectErrors = false
break
}
+ const prefix = "-lang="
+ if strings.HasPrefix(arg, prefix) {
+ goVersion = arg[len(prefix):]
+ }
}
}
}
@@ -136,7 +141,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
}
file, err := syntax.ParseFile(filename, nil, nil, 0)
if err == nil {
- conf := Config{Importer: stdLibImporter}
+ conf := Config{GoVersion: goVersion, Importer: stdLibImporter}
_, err = conf.Check(filename, []*syntax.File{file}, nil)
}
@@ -182,14 +187,11 @@ func TestStdFixed(t *testing.T) {
"issue16369.go", // go/types handles this correctly - not an issue
"issue18459.go", // go/types doesn't check validity of //go:xxx directives
"issue18882.go", // go/types doesn't check validity of //go:xxx directives
- "issue20232.go", // go/types handles larger constants than gc
"issue20529.go", // go/types does not have constraints on stack size
"issue22200.go", // go/types does not have constraints on stack size
"issue22200b.go", // go/types does not have constraints on stack size
"issue25507.go", // go/types does not have constraints on stack size
"issue20780.go", // go/types does not have constraints on stack size
- "issue31747.go", // go/types does not have constraints on language level (-lang=go1.12) (see #31793)
- "issue34329.go", // go/types does not have constraints on language level (-lang=go1.13) (see #31793)
"issue42058a.go", // go/types does not have constraints on channel element size
"issue42058b.go", // go/types does not have constraints on channel element size
"bug251.go", // issue #34333 which was exposed with fix for #34151
@@ -239,7 +241,7 @@ func typecheck(t *testing.T, path string, filenames []string) {
// Perform checks of API invariants.
// All Objects have a package, except predeclared ones.
- errorError := Universe.Lookup("error").Type().Interface().ExplicitMethod(0) // (error).Error
+ errorError := Universe.Lookup("error").Type().Underlying().(*Interface).ExplicitMethod(0) // (error).Error
for id, obj := range info.Uses {
predeclared := obj == Universe.Lookup(obj.Name()) || obj == errorError
if predeclared == (obj.Pkg() != nil) {
diff --git a/src/cmd/compile/internal/types2/stmt.go b/src/cmd/compile/internal/types2/stmt.go
index bab56b22ef..490cd0fc19 100644
--- a/src/cmd/compile/internal/types2/stmt.go
+++ b/src/cmd/compile/internal/types2/stmt.go
@@ -351,7 +351,7 @@ func (check *Checker) stmt(ctxt stmtContext, s syntax.Stmt) {
return
}
- tch := ch.typ.Chan()
+ tch := asChan(ch.typ)
if tch == nil {
check.invalidOpf(s, "cannot send to non-chan type %s", ch.typ)
return
@@ -680,7 +680,7 @@ func (check *Checker) typeSwitchStmt(inner stmtContext, s *syntax.SwitchStmt, gu
if x.mode == invalid {
return
}
- xtyp, _ := x.typ.Under().(*Interface)
+ xtyp, _ := under(x.typ).(*Interface)
if xtyp == nil {
check.errorf(&x, "%s is not an interface type", &x)
return
@@ -769,7 +769,7 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
// determine key/value types
var key, val Type
if x.mode != invalid {
- typ := optype(x.typ.Under())
+ typ := optype(x.typ)
if _, ok := typ.(*Chan); ok && sValue != nil {
// TODO(gri) this also needs to happen for channels in generic variables
check.softErrorf(sValue, "range over %s permits only one iteration variable", &x)
@@ -890,7 +890,7 @@ func rangeKeyVal(typ Type, wantKey, wantVal bool) (Type, Type, string) {
case *Slice:
return Typ[Int], typ.elem, ""
case *Pointer:
- if typ := typ.base.Array(); typ != nil {
+ if typ := asArray(typ.base); typ != nil {
return Typ[Int], typ.elem, ""
}
case *Map:
@@ -906,7 +906,7 @@ func rangeKeyVal(typ Type, wantKey, wantVal bool) (Type, Type, string) {
var key, val Type
var msg string
typ.is(func(t Type) bool {
- k, v, m := rangeKeyVal(t.Under(), wantKey, wantVal)
+ k, v, m := rangeKeyVal(under(t), wantKey, wantVal)
if k == nil || m != "" {
key, val, msg = k, v, m
return false
diff --git a/src/cmd/compile/internal/types2/subst.go b/src/cmd/compile/internal/types2/subst.go
index 27405d8f41..d730642831 100644
--- a/src/cmd/compile/internal/types2/subst.go
+++ b/src/cmd/compile/internal/types2/subst.go
@@ -61,7 +61,7 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis
check.indent--
var under Type
if res != nil {
- // Calling Under() here may lead to endless instantiations.
+ // Calling under() here may lead to endless instantiations.
// Test case: type T[P any] T[P]
// TODO(gri) investigate if that's a bug or to be expected.
under = res.Underlying()
@@ -146,7 +146,7 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis
// If the type argument is a pointer to a type parameter, the type argument's
// method set is empty.
// TODO(gri) is this what we want? (spec question)
- if base, isPtr := deref(targ); isPtr && base.TypeParam() != nil {
+ if base, isPtr := deref(targ); isPtr && asTypeParam(base) != nil {
check.errorf(pos, "%s has no methods", targ)
break
}
@@ -179,14 +179,14 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis
// If targ is itself a type parameter, each of its possible types, but at least one, must be in the
// list of iface types (i.e., the targ type list must be a non-empty subset of the iface types).
- if targ := targ.TypeParam(); targ != nil {
+ if targ := asTypeParam(targ); targ != nil {
targBound := targ.Bound()
if targBound.allTypes == nil {
check.softErrorf(pos, "%s does not satisfy %s (%s has no type constraints)", targ, tpar.bound, targ)
break
}
for _, t := range unpack(targBound.allTypes) {
- if !iface.isSatisfiedBy(t.Under()) {
+ if !iface.isSatisfiedBy(t) {
// TODO(gri) match this error message with the one below (or vice versa)
check.softErrorf(pos, "%s does not satisfy %s (%s type constraint %s not found in %s)", targ, tpar.bound, targ, t, iface.allTypes)
break
@@ -197,7 +197,7 @@ func (check *Checker) instantiate(pos syntax.Pos, typ Type, targs []Type, poslis
// Otherwise, targ's type or underlying type must also be one of the interface types listed, if any.
if !iface.isSatisfiedBy(targ) {
- check.softErrorf(pos, "%s does not satisfy %s (%s not found in %s)", targ, tpar.bound, targ.Under(), iface.allTypes)
+ check.softErrorf(pos, "%s does not satisfy %s (%s not found in %s)", targ, tpar.bound, under(targ), iface.allTypes)
break
}
}
diff --git a/src/cmd/compile/internal/types2/testdata/builtins.src b/src/cmd/compile/internal/types2/testdata/builtins.src
index e473bd1df2..f866ef059f 100644
--- a/src/cmd/compile/internal/types2/testdata/builtins.src
+++ b/src/cmd/compile/internal/types2/testdata/builtins.src
@@ -514,7 +514,7 @@ func panic1() {
panic("foo")
panic(false)
panic(1<<10)
- panic(1 /* ERROR overflows */ <<1000)
+ panic(1 << /* ERROR constant shift overflow */ 1000)
_ = panic /* ERROR used as value */ (0)
var s []byte
@@ -538,7 +538,7 @@ func print1() {
print(2.718281828)
print(false)
print(1<<10)
- print(1 /* ERROR overflows */ <<1000)
+ print(1 << /* ERROR constant shift overflow */ 1000)
println(nil /* ERROR untyped nil */ )
var s []int
@@ -564,7 +564,7 @@ func println1() {
println(2.718281828)
println(false)
println(1<<10)
- println(1 /* ERROR overflows */ <<1000)
+ println(1 << /* ERROR constant shift overflow */ 1000)
println(nil /* ERROR untyped nil */ )
var s []int
@@ -695,7 +695,7 @@ func Alignof1() {
_ = unsafe.Alignof(42)
_ = unsafe.Alignof(new(struct{}))
_ = unsafe.Alignof(1<<10)
- _ = unsafe.Alignof(1 /* ERROR overflows */ <<1000)
+ _ = unsafe.Alignof(1 << /* ERROR constant shift overflow */ 1000)
_ = unsafe.Alignof(nil /* ERROR "untyped nil */ )
unsafe /* ERROR not used */ .Alignof(x)
@@ -783,7 +783,7 @@ func Sizeof1() {
_ = unsafe.Sizeof(42)
_ = unsafe.Sizeof(new(complex128))
_ = unsafe.Sizeof(1<<10)
- _ = unsafe.Sizeof(1 /* ERROR overflows */ <<1000)
+ _ = unsafe.Sizeof(1 << /* ERROR constant shift overflow */ 1000)
_ = unsafe.Sizeof(nil /* ERROR untyped nil */ )
unsafe /* ERROR not used */ .Sizeof(x)
diff --git a/src/cmd/compile/internal/types2/testdata/const0.src b/src/cmd/compile/internal/types2/testdata/const0.src
index 9e0de93d54..5608b1549b 100644
--- a/src/cmd/compile/internal/types2/testdata/const0.src
+++ b/src/cmd/compile/internal/types2/testdata/const0.src
@@ -350,9 +350,14 @@ const _ = unsafe.Sizeof(func() {
})
// untyped constants must not get arbitrarily large
-const (
- huge = 1<<1000
- // TODO(gri) here the errors should be at the last operator not the last operand
- _ = huge * huge * huge // ERROR constant multiplication overflow
- _ = huge << 1000 << 1000 // ERROR constant shift overflow
-)
+const prec = 512 // internal maximum precision for integers
+const maxInt = (1<<(prec/2) - 1) * (1<<(prec/2) + 1) // == 1<<prec - 1
+
+const _ = maxInt + /* ERROR constant addition overflow */ 1
+const _ = -maxInt - /* ERROR constant subtraction overflow */ 1
+const _ = maxInt ^ /* ERROR constant bitwise XOR overflow */ -1
+const _ = maxInt * /* ERROR constant multiplication overflow */ 2
+const _ = maxInt << /* ERROR constant shift overflow */ 2
+const _ = 1 << /* ERROR constant shift overflow */ prec
+
+const _ = ^ /* ERROR constant bitwise complement overflow */ maxInt
diff --git a/src/cmd/compile/internal/types2/testdata/const1.src b/src/cmd/compile/internal/types2/testdata/const1.src
index d82770464f..56b6bd4ca5 100644
--- a/src/cmd/compile/internal/types2/testdata/const1.src
+++ b/src/cmd/compile/internal/types2/testdata/const1.src
@@ -43,7 +43,12 @@ const (
const (
smallestFloat32 = 1.0 / (1<<(127 - 1 + 23))
- smallestFloat64 = 1.0 / (1<<(1023 - 1 + 52))
+ // TODO(gri) The compiler limits integers to 512 bit and thus
+ // we cannot compute the value (1<<(1023 - 1 + 52))
+ // without overflow. For now we match the compiler.
+ // See also issue #44057.
+ // smallestFloat64 = 1.0 / (1<<(1023 - 1 + 52))
+ smallestFloat64 = 4.940656458412465441765687928682213723651e-324
)
const (
@@ -53,7 +58,12 @@ const (
const (
maxFloat32 = 1<<127 * (1<<24 - 1) / (1.0<<23)
- maxFloat64 = 1<<1023 * (1<<53 - 1) / (1.0<<52)
+ // TODO(gri) The compiler limits integers to 512 bit and thus
+ // we cannot compute the value 1<<1023
+ // without overflow. For now we match the compiler.
+ // See also issue #44057.
+ // maxFloat64 = 1<<1023 * (1<<53 - 1) / (1.0<<52)
+ maxFloat64 = 1.797693134862315708145274237317043567981e+308
)
const (
@@ -271,7 +281,9 @@ const (
_ = assert(float64(smallestFloat32) == smallestFloat32)
_ = assert(float64(smallestFloat32/2) == smallestFloat32/2)
_ = assert(float64(smallestFloat64) == smallestFloat64)
- _ = assert(float64(smallestFloat64/2) == 0)
+ // TODO(gri) With the change to the declaration of smallestFloat64
+ // this now fails to be true. See issue #44058.
+ // _ = assert(float64(smallestFloat64/2) == 0)
)
const (
diff --git a/src/cmd/compile/internal/types2/testdata/go1_12.src b/src/cmd/compile/internal/types2/testdata/go1_12.src
new file mode 100644
index 0000000000..75a602b8ff
--- /dev/null
+++ b/src/cmd/compile/internal/types2/testdata/go1_12.src
@@ -0,0 +1,34 @@
+// Copyright 2021 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.
+
+// Check Go language version-specific errors.
+
+package go1_12 // go1.12
+
+// numeric literals
+const (
+ _ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later"
+ _ = 0b111 // ERROR "binary literals requires go1.13 or later"
+ _ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
+ _ = 0xabc // ok
+ _ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
+
+ _ = 0B111 // ERROR "binary"
+ _ = 0O567 // ERROR "octal"
+ _ = 0Xabc // ok
+ _ = 0X0P1 // ERROR "hexadecimal floating-point"
+
+ _ = 1_000i // ERROR "underscores"
+ _ = 0b111i // ERROR "binary"
+ _ = 0o567i // ERROR "octal"
+ _ = 0xabci // ERROR "hexadecimal floating-point"
+ _ = 0x0p1i // ERROR "hexadecimal floating-point"
+)
+
+// signed shift counts
+var (
+ s int
+ _ = 1 << s // ERROR "invalid operation: signed shift count s \(variable of type int\) requires go1.13 or later"
+ _ = 1 >> s // ERROR "signed shift count"
+)
diff --git a/src/cmd/compile/internal/types2/testdata/go1_13.src b/src/cmd/compile/internal/types2/testdata/go1_13.src
new file mode 100644
index 0000000000..93cb4c72a7
--- /dev/null
+++ b/src/cmd/compile/internal/types2/testdata/go1_13.src
@@ -0,0 +1,21 @@
+// Copyright 2021 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.
+
+// Check Go language version-specific errors.
+
+package go1_13 // go1.13
+
+// interface embedding
+
+type I interface { m() }
+
+type _ interface {
+ m()
+ I // ERROR "duplicate method m"
+}
+
+type _ interface {
+ I
+ I // ERROR "duplicate method m"
+}
diff --git a/src/cmd/compile/internal/types2/testdata/go1_8.src b/src/cmd/compile/internal/types2/testdata/go1_8.src
new file mode 100644
index 0000000000..0f3ba9443b
--- /dev/null
+++ b/src/cmd/compile/internal/types2/testdata/go1_8.src
@@ -0,0 +1,10 @@
+// Copyright 2021 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.
+
+// Check Go language version-specific errors.
+
+package go1_8 // go1.8
+
+// type alias declarations
+type any /* ERROR type aliases requires go1.9 or later */ = interface{}
diff --git a/src/cmd/compile/internal/types2/testdata/typeparams.go2 b/src/cmd/compile/internal/types2/testdata/typeparams.go2
index 04f563029f..41306b6e23 100644
--- a/src/cmd/compile/internal/types2/testdata/typeparams.go2
+++ b/src/cmd/compile/internal/types2/testdata/typeparams.go2
@@ -19,6 +19,10 @@ func _[_ any](x int) int
func _[T any](T /* ERROR redeclared */ T)()
func _[T, T /* ERROR redeclared */ any]()
+// Constraints (incl. any) may be parenthesized.
+func _[_ (any)]() {}
+func _[_ (interface{})]() {}
+
func reverse[T any](list []T) []T {
rlist := make([]T, len(list))
i := len(list)
diff --git a/src/cmd/compile/internal/types2/type.go b/src/cmd/compile/internal/types2/type.go
index 7e51a138b5..52bd99deab 100644
--- a/src/cmd/compile/internal/types2/type.go
+++ b/src/cmd/compile/internal/types2/type.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2011 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.
@@ -18,67 +17,10 @@ type Type interface {
// client packages (here for backward-compatibility).
Underlying() Type
- // Under returns the true expanded underlying type.
- // If it doesn't exist, the result is Typ[Invalid].
- // Under must only be called when a type is known
- // to be fully set up.
- Under() Type
-
// String returns a string representation of a type.
String() string
-
- // Converters
- // A converter must only be called when a type is
- // known to be fully set up. A converter returns
- // a type's operational type (see comment for optype)
- // or nil if the type is receiver is not of the
- // respective type.
- Basic() *Basic
- Array() *Array
- Slice() *Slice
- Struct() *Struct
- Pointer() *Pointer
- Tuple() *Tuple
- Signature() *Signature
- Sum() *Sum
- Interface() *Interface
- Map() *Map
- Chan() *Chan
-
- // If the receiver for Named and TypeParam is of
- // the respective type (possibly after unpacking
- // an instance type), these methods return that
- // type. Otherwise the result is nil.
- Named() *Named
- TypeParam() *TypeParam
}
-// aType implements default type behavior
-type aType struct{}
-
-// These methods must be implemented by each type.
-func (aType) Underlying() Type { panic("unreachable") }
-func (aType) Under() Type { panic("unreachable") }
-func (aType) String() string { panic("unreachable") }
-
-// Each type is implementing its version of these methods
-// (Basic must implement Basic, etc.), the other methods
-// are inherited.
-func (aType) Basic() *Basic { return nil }
-func (aType) Array() *Array { return nil }
-func (aType) Slice() *Slice { return nil }
-func (aType) Struct() *Struct { return nil }
-func (aType) Pointer() *Pointer { return nil }
-func (aType) Tuple() *Tuple { return nil }
-func (aType) Signature() *Signature { return nil }
-func (aType) Sum() *Sum { return nil }
-func (aType) Interface() *Interface { return nil }
-func (aType) Map() *Map { return nil }
-func (aType) Chan() *Chan { return nil }
-
-func (aType) Named() *Named { return nil }
-func (aType) TypeParam() *TypeParam { return nil }
-
// BasicKind describes the kind of basic type.
type BasicKind int
@@ -142,7 +84,6 @@ type Basic struct {
kind BasicKind
info BasicInfo
name string
- aType
}
// Kind returns the kind of basic type b.
@@ -158,7 +99,6 @@ func (b *Basic) Name() string { return b.name }
type Array struct {
len int64
elem Type
- aType
}
// NewArray returns a new array type for the given element type and length.
@@ -175,7 +115,6 @@ func (a *Array) Elem() Type { return a.elem }
// A Slice represents a slice type.
type Slice struct {
elem Type
- aType
}
// NewSlice returns a new slice type for the given element type.
@@ -188,7 +127,6 @@ func (s *Slice) Elem() Type { return s.elem }
type Struct struct {
fields []*Var
tags []string // field tags; nil if there are no tags
- aType
}
// NewStruct returns a new struct with the given fields and corresponding field tags.
@@ -225,7 +163,6 @@ func (s *Struct) Tag(i int) string {
// A Pointer represents a pointer type.
type Pointer struct {
base Type // element type
- aType
}
// NewPointer returns a new pointer type for the given element (base) type.
@@ -239,7 +176,6 @@ func (p *Pointer) Elem() Type { return p.base }
// assignments; they are not first class types of Go.
type Tuple struct {
vars []*Var
- aType
}
// NewTuple returns a new tuple for the given variables.
@@ -247,31 +183,11 @@ func NewTuple(x ...*Var) *Tuple {
if len(x) > 0 {
return &Tuple{vars: x}
}
+ // TODO(gri) Don't represent empty tuples with a (*Tuple)(nil) pointer;
+ // it's too subtle and causes problems.
return nil
}
-// We cannot rely on the embedded X() *X methods because (*Tuple)(nil)
-// is a valid *Tuple value but (*Tuple)(nil).X() would panic without
-// these implementations. At the moment we only need X = Basic, Named,
-// but add all because missing one leads to very confusing bugs.
-// TODO(gri) Don't represent empty tuples with a (*Tuple)(nil) pointer;
-// it's too subtle and causes problems.
-func (*Tuple) Basic() *Basic { return nil }
-func (*Tuple) Array() *Array { return nil }
-func (*Tuple) Slice() *Slice { return nil }
-func (*Tuple) Struct() *Struct { return nil }
-func (*Tuple) Pointer() *Pointer { return nil }
-
-// func (*Tuple) Tuple() *Tuple // implemented below
-func (*Tuple) Signature() *Signature { return nil }
-func (*Tuple) Sum() *Sum { return nil }
-func (*Tuple) Interface() *Interface { return nil }
-func (*Tuple) Map() *Map { return nil }
-func (*Tuple) Chan() *Chan { return nil }
-
-func (*Tuple) Named() *Named { return nil }
-func (*Tuple) TypeParam() *TypeParam { return nil }
-
// Len returns the number variables of tuple t.
func (t *Tuple) Len() int {
if t != nil {
@@ -290,14 +206,13 @@ type Signature struct {
// and store it in the Func Object) because when type-checking a function
// literal we call the general type checker which returns a general Type.
// We then unpack the *Signature and use the scope for the literal body.
- rparams []*TypeName // reveiver type parameters from left to right; or nil
+ rparams []*TypeName // receiver type parameters from left to right; or nil
tparams []*TypeName // type parameters from left to right; or nil
scope *Scope // function scope, present for package-local signatures
recv *Var // nil if not a method
params *Tuple // (incoming) parameters from left to right; or nil
results *Tuple // (outgoing) results from left to right; or nil
variadic bool // true if the last parameter's type is of the form ...T (or string, for append built-in only)
- aType
}
// NewSignature returns a new function type for the given receiver, parameters,
@@ -346,7 +261,6 @@ func (s *Signature) Variadic() bool { return s.variadic }
// first class types of Go.
type Sum struct {
types []Type // types are unique
- aType
}
// NewSum returns a new Sum type consisting of the provided
@@ -398,8 +312,6 @@ type Interface struct {
allTypes Type // intersection of all embedded and locally declared types (TODO(gri) need better field name)
obj Object // type declaration defining this interface; or nil (for better error messages)
-
- aType
}
// unpack unpacks a type into a list of types.
@@ -408,7 +320,7 @@ func unpack(typ Type) []Type {
if typ == nil {
return nil
}
- if sum := typ.Sum(); sum != nil {
+ if sum := asSum(typ); sum != nil {
return sum.types
}
return []Type{typ}
@@ -530,10 +442,7 @@ func (t *Interface) Empty() bool {
return len(t.allMethods) == 0 && t.allTypes == nil
}
return !t.iterate(func(t *Interface) bool {
- if len(t.methods) > 0 || t.types != nil {
- return true
- }
- return false
+ return len(t.methods) > 0 || t.types != nil
}, nil)
}
@@ -545,10 +454,7 @@ func (t *Interface) HasTypeList() bool {
}
return t.iterate(func(t *Interface) bool {
- if t.types != nil {
- return true
- }
- return false
+ return t.types != nil
}, nil)
}
@@ -594,7 +500,7 @@ func (t *Interface) iterate(f func(*Interface) bool, seen map[*Interface]bool) b
}
for _, e := range t.embeddeds {
// e should be an interface but be careful (it may be invalid)
- if e := e.Interface(); e != nil {
+ if e := asInterface(e); e != nil {
// Cyclic interfaces such as "type E interface { E }" are not permitted
// but they are still constructed and we need to detect such cycles.
if seen[e] {
@@ -622,7 +528,7 @@ func (t *Interface) isSatisfiedBy(typ Type) bool {
return true
}
types := unpack(t.allTypes)
- return includes(types, typ) || includes(types, typ.Under())
+ return includes(types, typ) || includes(types, under(typ))
}
// Complete computes the interface's method set. It must be called by users of
@@ -660,8 +566,8 @@ func (t *Interface) Complete() *Interface {
allTypes := t.types
for _, typ := range t.embeddeds {
- utyp := typ.Under()
- etyp := utyp.Interface()
+ utyp := under(typ)
+ etyp := asInterface(utyp)
if etyp == nil {
if utyp != Typ[Invalid] {
panic(fmt.Sprintf("%s is not an interface", typ))
@@ -695,7 +601,6 @@ func (t *Interface) Complete() *Interface {
// A Map represents a map type.
type Map struct {
key, elem Type
- aType
}
// NewMap returns a new map for the given key and element types.
@@ -713,7 +618,6 @@ func (m *Map) Elem() Type { return m.elem }
type Chan struct {
dir ChanDir
elem Type
- aType
}
// A ChanDir value indicates a channel direction.
@@ -739,7 +643,7 @@ func (c *Chan) Elem() Type { return c.elem }
// A Named represents a named (defined) type.
type Named struct {
- check *Checker // for Named.Under implementation
+ check *Checker // for Named.under implementation
info typeInfo // for cycle detection
obj *TypeName // corresponding declared object
orig Type // type (on RHS of declaration) this *Named type is derived of (for cycle reporting)
@@ -747,7 +651,6 @@ type Named struct {
tparams []*TypeName // type parameters, or nil
targs []Type // type arguments (after instantiation), or nil
methods []*Func // methods declared for this type (not the method set of this type); signatures are type-checked lazily
- aType
}
// NewNamed returns a new named type for the given type name, underlying type, and associated methods.
@@ -775,21 +678,6 @@ func (check *Checker) NewNamed(obj *TypeName, underlying Type, methods []*Func)
// Obj returns the type name for the named type t.
func (t *Named) Obj() *TypeName { return t.obj }
-// Converter methods
-func (t *Named) Basic() *Basic { return t.Under().Basic() }
-func (t *Named) Array() *Array { return t.Under().Array() }
-func (t *Named) Slice() *Slice { return t.Under().Slice() }
-func (t *Named) Struct() *Struct { return t.Under().Struct() }
-func (t *Named) Pointer() *Pointer { return t.Under().Pointer() }
-func (t *Named) Tuple() *Tuple { return t.Under().Tuple() }
-func (t *Named) Signature() *Signature { return t.Under().Signature() }
-func (t *Named) Interface() *Interface { return t.Under().Interface() }
-func (t *Named) Map() *Map { return t.Under().Map() }
-func (t *Named) Chan() *Chan { return t.Under().Chan() }
-
-// func (t *Named) Named() *Named // declared below
-func (t *Named) TypeParam() *TypeParam { return t.Under().TypeParam() }
-
// TODO(gri) Come up with a better representation and API to distinguish
// between parameterized instantiated and non-instantiated types.
@@ -834,12 +722,10 @@ type TypeParam struct {
obj *TypeName // corresponding type name
index int // parameter index
bound Type // *Named or *Interface; underlying type is always *Interface
- aType
}
-func (t *TypeParam) Obj() *TypeName {
- return t.obj
-}
+// Obj returns the type name for the type parameter t.
+func (t *TypeParam) Obj() *TypeName { return t.obj }
// NewTypeParam returns a new TypeParam.
func (check *Checker) NewTypeParam(obj *TypeName, index int, bound Type) *TypeParam {
@@ -853,56 +739,41 @@ func (check *Checker) NewTypeParam(obj *TypeName, index int, bound Type) *TypePa
}
func (t *TypeParam) Bound() *Interface {
- iface := t.bound.Interface()
+ iface := asInterface(t.bound)
// use the type bound position if we have one
pos := nopos
if n, _ := t.bound.(*Named); n != nil {
pos = n.obj.pos
}
+ // TODO(gri) switch this to an unexported method on Checker.
t.check.completeInterface(pos, iface)
return iface
}
// optype returns a type's operational type. Except for
// type parameters, the operational type is the same
-// as the underlying type (as returned by Under). For
+// as the underlying type (as returned by under). For
// Type parameters, the operational type is determined
// by the corresponding type bound's type list. The
// result may be the bottom or top type, but it is never
// the incoming type parameter.
func optype(typ Type) Type {
- if t := typ.TypeParam(); t != nil {
+ if t := asTypeParam(typ); t != nil {
// If the optype is typ, return the top type as we have
// no information. It also prevents infinite recursion
- // via the TypeParam converter methods. This can happen
+ // via the asTypeParam converter function. This can happen
// for a type parameter list of the form:
// (type T interface { type T }).
// See also issue #39680.
if u := t.Bound().allTypes; u != nil && u != typ {
- // u != typ and u is a type parameter => u.Under() != typ, so this is ok
- return u.Under()
+ // u != typ and u is a type parameter => under(u) != typ, so this is ok
+ return under(u)
}
return theTop
}
- return typ
+ return under(typ)
}
-// Converter methods
-func (t *TypeParam) Basic() *Basic { return optype(t).Basic() }
-func (t *TypeParam) Array() *Array { return optype(t).Array() }
-func (t *TypeParam) Slice() *Slice { return optype(t).Slice() }
-func (t *TypeParam) Struct() *Struct { return optype(t).Struct() }
-func (t *TypeParam) Pointer() *Pointer { return optype(t).Pointer() }
-func (t *TypeParam) Tuple() *Tuple { return optype(t).Tuple() }
-func (t *TypeParam) Signature() *Signature { return optype(t).Signature() }
-func (t *TypeParam) Sum() *Sum { return optype(t).Sum() }
-func (t *TypeParam) Interface() *Interface { return optype(t).Interface() }
-func (t *TypeParam) Map() *Map { return optype(t).Map() }
-func (t *TypeParam) Chan() *Chan { return optype(t).Chan() }
-
-// func (t *TypeParam) Named() *Named // Named does not unpack type parameters
-// func (t *TypeParam) TypeParam() *TypeParam // declared below
-
// An instance represents an instantiated generic type syntactically
// (without expanding the instantiation). Type instances appear only
// during type-checking and are replaced by their fully instantiated
@@ -914,25 +785,8 @@ type instance struct {
targs []Type // type arguments
poslist []syntax.Pos // position of each targ; for error reporting only
value Type // base(targs...) after instantiation or Typ[Invalid]; nil if not yet set
- aType
}
-// Converter methods
-func (t *instance) Basic() *Basic { return t.Under().Basic() }
-func (t *instance) Array() *Array { return t.Under().Array() }
-func (t *instance) Slice() *Slice { return t.Under().Slice() }
-func (t *instance) Struct() *Struct { return t.Under().Struct() }
-func (t *instance) Pointer() *Pointer { return t.Under().Pointer() }
-func (t *instance) Tuple() *Tuple { return t.Under().Tuple() }
-func (t *instance) Signature() *Signature { return t.Under().Signature() }
-func (t *instance) Sum() *Sum { return t.Under().Sum() }
-func (t *instance) Interface() *Interface { return t.Under().Interface() }
-func (t *instance) Map() *Map { return t.Under().Map() }
-func (t *instance) Chan() *Chan { return t.Under().Chan() }
-
-func (t *instance) Named() *Named { return t.expand().Named() }
-func (t *instance) TypeParam() *TypeParam { return t.expand().TypeParam() }
-
// expand returns the instantiated (= expanded) type of t.
// The result is either an instantiated *Named type, or
// Typ[Invalid] if there was an error.
@@ -972,9 +826,7 @@ func init() { expandf = expand }
// It is the underlying type of a type parameter that
// cannot be satisfied by any type, usually because
// the intersection of type constraints left nothing).
-type bottom struct {
- aType
-}
+type bottom struct{}
// theBottom is the singleton bottom type.
var theBottom = &bottom{}
@@ -984,29 +836,11 @@ var theBottom = &bottom{}
// can be satisfied by any type (ignoring methods),
// usually because the type constraint has no type
// list.
-type top struct {
- aType
-}
+type top struct{}
// theTop is the singleton top type.
var theTop = &top{}
-// Type-specific implementations of type converters.
-func (t *Basic) Basic() *Basic { return t }
-func (t *Array) Array() *Array { return t }
-func (t *Slice) Slice() *Slice { return t }
-func (t *Struct) Struct() *Struct { return t }
-func (t *Pointer) Pointer() *Pointer { return t }
-func (t *Tuple) Tuple() *Tuple { return t }
-func (t *Signature) Signature() *Signature { return t }
-func (t *Sum) Sum() *Sum { return t }
-func (t *Interface) Interface() *Interface { return t }
-func (t *Map) Map() *Map { return t }
-func (t *Chan) Chan() *Chan { return t }
-
-func (t *Named) Named() *Named { return t }
-func (t *TypeParam) TypeParam() *TypeParam { return t }
-
// Type-specific implementations of Underlying.
func (t *Basic) Underlying() Type { return t }
func (t *Array) Underlying() Type { return t }
@@ -1025,25 +859,6 @@ func (t *instance) Underlying() Type { return t }
func (t *bottom) Underlying() Type { return t }
func (t *top) Underlying() Type { return t }
-// Type-specific implementations of Under.
-func (t *Basic) Under() Type { return t }
-func (t *Array) Under() Type { return t }
-func (t *Slice) Under() Type { return t }
-func (t *Struct) Under() Type { return t }
-func (t *Pointer) Under() Type { return t }
-func (t *Tuple) Under() Type { return t }
-func (t *Signature) Under() Type { return t }
-func (t *Sum) Under() Type { return t } // TODO(gri) is this correct?
-func (t *Interface) Under() Type { return t }
-func (t *Map) Under() Type { return t }
-func (t *Chan) Under() Type { return t }
-
-// see decl.go for implementation of Named.Under
-func (t *TypeParam) Under() Type { return t }
-func (t *instance) Under() Type { return t.expand().Under() }
-func (t *bottom) Under() Type { return t }
-func (t *top) Under() Type { return t }
-
// Type-specific implementations of String.
func (t *Basic) String() string { return TypeString(t, nil) }
func (t *Array) String() string { return TypeString(t, nil) }
@@ -1061,3 +876,94 @@ func (t *TypeParam) String() string { return TypeString(t, nil) }
func (t *instance) String() string { return TypeString(t, nil) }
func (t *bottom) String() string { return TypeString(t, nil) }
func (t *top) String() string { return TypeString(t, nil) }
+
+// under returns the true expanded underlying type.
+// If it doesn't exist, the result is Typ[Invalid].
+// under must only be called when a type is known
+// to be fully set up.
+func under(t Type) Type {
+ // TODO(gri) is this correct for *Sum?
+ if n := asNamed(t); n != nil {
+ return n.under()
+ }
+ return t
+}
+
+// Converters
+//
+// A converter must only be called when a type is
+// known to be fully set up. A converter returns
+// a type's operational type (see comment for optype)
+// or nil if the type argument is not of the
+// respective type.
+
+func asBasic(t Type) *Basic {
+ op, _ := optype(t).(*Basic)
+ return op
+}
+
+func asArray(t Type) *Array {
+ op, _ := optype(t).(*Array)
+ return op
+}
+
+func asSlice(t Type) *Slice {
+ op, _ := optype(t).(*Slice)
+ return op
+}
+
+func asStruct(t Type) *Struct {
+ op, _ := optype(t).(*Struct)
+ return op
+}
+
+func asPointer(t Type) *Pointer {
+ op, _ := optype(t).(*Pointer)
+ return op
+}
+
+// asTuple is not needed - not provided
+
+func asSignature(t Type) *Signature {
+ op, _ := optype(t).(*Signature)
+ return op
+}
+
+func asSum(t Type) *Sum {
+ op, _ := optype(t).(*Sum)
+ return op
+}
+
+func asInterface(t Type) *Interface {
+ op, _ := optype(t).(*Interface)
+ return op
+}
+
+func asMap(t Type) *Map {
+ op, _ := optype(t).(*Map)
+ return op
+}
+
+func asChan(t Type) *Chan {
+ op, _ := optype(t).(*Chan)
+ return op
+}
+
+// If the argument to asNamed and asTypeParam is of the respective types
+// (possibly after expanding an instance type), these methods return that type.
+// Otherwise the result is nil.
+
+func asNamed(t Type) *Named {
+ e, _ := expand(t).(*Named)
+ return e
+}
+
+func asTypeParam(t Type) *TypeParam {
+ u, _ := under(t).(*TypeParam)
+ return u
+}
+
+// Exported for the compiler.
+
+func AsPointer(t Type) *Pointer { return asPointer(t) }
+func AsNamed(t Type) *Named { return asNamed(t) }
diff --git a/src/cmd/compile/internal/types2/typestring.go b/src/cmd/compile/internal/types2/typestring.go
index 6b6d7ad2be..40016697b7 100644
--- a/src/cmd/compile/internal/types2/typestring.go
+++ b/src/cmd/compile/internal/types2/typestring.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2013 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.
@@ -99,9 +98,15 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
buf.WriteString("<nil>")
case *Basic:
- if t.kind == UnsafePointer {
- buf.WriteString("unsafe.")
+ // exported basic types go into package unsafe
+ // (currently this is just unsafe.Pointer)
+ if isExported(t.name) {
+ if obj, _ := Unsafe.scope.Lookup(t.name).(*TypeName); obj != nil {
+ writeTypeName(buf, obj, qf)
+ break
+ }
}
+
if gcCompatibilityMode {
// forget the alias names
switch t.kind {
@@ -127,19 +132,14 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
if i > 0 {
buf.WriteString("; ")
}
- buf.WriteString(f.name)
- if f.embedded {
- // emphasize that the embedded field's name
- // doesn't match the field's type name
- if f.name != embeddedFieldName(f.typ) {
- buf.WriteString(" /* = ")
- writeType(buf, f.typ, qf, visited)
- buf.WriteString(" */")
- }
- } else {
+ // This doesn't do the right thing for embedded type
+ // aliases where we should print the alias name, not
+ // the aliased type (see issue #44410).
+ if !f.embedded {
+ buf.WriteString(f.name)
buf.WriteByte(' ')
- writeType(buf, f.typ, qf, visited)
}
+ writeType(buf, f.typ, qf, visited)
if tag := t.Tag(i); tag != "" {
fmt.Fprintf(buf, " %q", tag)
}
@@ -314,33 +314,16 @@ func writeTypeList(buf *bytes.Buffer, list []Type, qf Qualifier, visited []Type)
}
func writeTParamList(buf *bytes.Buffer, list []*TypeName, qf Qualifier, visited []Type) {
- // bound returns the type bound for tname. The result is never nil.
- bound := func(tname *TypeName) Type {
- // be careful to avoid crashes in case of inconsistencies
- if t, _ := tname.typ.(*TypeParam); t != nil && t.bound != nil {
- return t.bound
- }
- return &emptyInterface
- }
-
- // If a single type bound is not the empty interface, we have to write them all.
- var writeBounds bool
- for _, p := range list {
- // bound(p) should be an interface but be careful (it may be invalid)
- b := bound(p).Interface()
- if b != nil && !b.Empty() {
- writeBounds = true
- break
- }
- }
- writeBounds = true // always write the bounds for new type parameter list syntax
-
buf.WriteString("[")
var prev Type
for i, p := range list {
- b := bound(p)
+ // TODO(gri) support 'any' sugar here.
+ var b Type = &emptyInterface
+ if t, _ := p.typ.(*TypeParam); t != nil && t.bound != nil {
+ b = t.bound
+ }
if i > 0 {
- if writeBounds && b != prev {
+ if b != prev {
// type bound changed - write previous one before advancing
buf.WriteByte(' ')
writeType(buf, prev, qf, visited)
@@ -355,7 +338,7 @@ func writeTParamList(buf *bytes.Buffer, list []*TypeName, qf Qualifier, visited
buf.WriteString(p.name)
}
}
- if writeBounds && prev != nil {
+ if prev != nil {
buf.WriteByte(' ')
writeType(buf, prev, qf, visited)
}
@@ -395,7 +378,7 @@ func writeTuple(buf *bytes.Buffer, tup *Tuple, variadic bool, qf Qualifier, visi
} else {
// special case:
// append(s, "foo"...) leads to signature func([]byte, string...)
- if t := typ.Basic(); t == nil || t.kind != String {
+ if t := asBasic(typ); t == nil || t.kind != String {
panic("internal error: string type expected")
}
writeType(buf, typ, qf, visited)
@@ -441,25 +424,6 @@ func writeSignature(buf *bytes.Buffer, sig *Signature, qf Qualifier, visited []T
writeTuple(buf, sig.results, false, qf, visited)
}
-// embeddedFieldName returns an embedded field's name given its type.
-// The result is "" if the type doesn't have an embedded field name.
-func embeddedFieldName(typ Type) string {
- switch t := typ.(type) {
- case *Basic:
- return t.name
- case *Named:
- return t.obj.name
- case *Pointer:
- // *T is ok, but **T is not
- if _, ok := t.base.(*Pointer); !ok {
- return embeddedFieldName(t.base)
- }
- case *instance:
- return t.base.obj.name
- }
- return "" // not a (pointer to) a defined type
-}
-
// subscript returns the decimal (utf8) representation of x using subscript digits.
func subscript(x uint64) string {
const w = len("₀") // all digits 0...9 have the same utf8 width
diff --git a/src/cmd/compile/internal/types2/typestring_test.go b/src/cmd/compile/internal/types2/typestring_test.go
index f1f7e34bf8..97a4fdf73d 100644
--- a/src/cmd/compile/internal/types2/typestring_test.go
+++ b/src/cmd/compile/internal/types2/typestring_test.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2012 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.
diff --git a/src/cmd/compile/internal/types2/typexpr.go b/src/cmd/compile/internal/types2/typexpr.go
index b758c0f358..02f9b2804d 100644
--- a/src/cmd/compile/internal/types2/typexpr.go
+++ b/src/cmd/compile/internal/types2/typexpr.go
@@ -138,11 +138,11 @@ func (check *Checker) varType(e syntax.Expr) Type {
// ordinaryType reports an error if typ is an interface type containing
// type lists or is (or embeds) the predeclared type comparable.
func (check *Checker) ordinaryType(pos syntax.Pos, typ Type) {
- // We don't want to call Under() (via Interface) or complete interfaces while we
+ // We don't want to call under() (via Interface) or complete interfaces while we
// are in the middle of type-checking parameter declarations that might belong to
// interface methods. Delay this check to the end of type-checking.
check.atEnd(func() {
- if t := typ.Interface(); t != nil {
+ if t := asInterface(typ); t != nil {
check.completeInterface(pos, t) // TODO(gri) is this the correct position?
if t.allTypes != nil {
check.softErrorf(pos, "interface contains type constraints (%s)", t.allTypes)
@@ -302,7 +302,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []
// Also: Don't report an error via genericType since it will be reported
// again when we type-check the signature.
// TODO(gri) maybe the receiver should be marked as invalid instead?
- if recv := check.genericType(rname, false).Named(); recv != nil {
+ if recv := asNamed(check.genericType(rname, false)); recv != nil {
recvTParams = recv.tparams
}
}
@@ -382,7 +382,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []
// (ignore invalid types - error was reported before)
if t := rtyp; t != Typ[Invalid] {
var err string
- if T := t.Named(); T != nil {
+ if T := asNamed(t); T != nil {
// spec: "The type denoted by T is called the receiver base type; it must not
// be a pointer or interface type and it must be declared in the same package
// as the method."
@@ -393,7 +393,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []
err = ""
}
} else {
- switch u := optype(T.Under()).(type) {
+ switch u := optype(T).(type) {
case *Basic:
// unsafe.Pointer is treated like a regular pointer
if u.kind == UnsafePointer {
@@ -403,7 +403,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []
err = "pointer or interface type"
}
}
- } else if T := t.Basic(); T != nil {
+ } else if T := asBasic(t); T != nil {
err = "basic or unnamed type"
if check.conf.CompilerErrorMessages {
check.errorf(recv.pos, "cannot define new methods on non-local type %s", recv.typ)
@@ -426,7 +426,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *syntax.Field, tparams []
}
// goTypeName returns the Go type name for typ and
-// removes any occurences of "types." from that name.
+// removes any occurrences of "types." from that name.
func goTypeName(typ Type) string {
return strings.Replace(fmt.Sprintf("%T", typ), "types.", "", -1) // strings.ReplaceAll is not available in Go 1.4
}
@@ -442,7 +442,7 @@ func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) {
check.indent--
var under Type
if T != nil {
- // Calling Under() here may lead to endless instantiations.
+ // Calling under() here may lead to endless instantiations.
// Test case: type T[P any] *T[P]
// TODO(gri) investigate if that's a bug or to be expected
// (see also analogous comment in Checker.instantiate).
@@ -575,7 +575,7 @@ func (check *Checker) typInternal(e0 syntax.Expr, def *Named) (T Type) {
check.atEnd(func() {
if !Comparable(typ.key) {
var why string
- if typ.key.TypeParam() != nil {
+ if asTypeParam(typ.key) != nil {
why = " (missing comparable constraint)"
}
check.errorf(e.Key, "invalid map key type %s%s", typ.key, why)
@@ -644,7 +644,7 @@ func (check *Checker) instantiatedType(x syntax.Expr, targs []syntax.Expr, def *
if b == Typ[Invalid] {
return b // error already reported
}
- base := b.Named()
+ base := asNamed(b)
if base == nil {
unreachable() // should have been caught by genericType
}
@@ -710,7 +710,7 @@ func (check *Checker) arrayLength(e syntax.Expr) int64 {
}
// typeList provides the list of types corresponding to the incoming expression list.
-// If an error occured, the result is nil, but all list elements were type-checked.
+// If an error occurred, the result is nil, but all list elements were type-checked.
func (check *Checker) typeList(list []syntax.Expr) []Type {
res := make([]Type, len(list)) // res != nil even if len(list) == 0
for i, x := range list {
@@ -943,9 +943,13 @@ func (check *Checker) completeInterface(pos syntax.Pos, ityp *Interface) {
check.errorf(pos, "duplicate method %s", m.name)
check.errorf(mpos[other.(*Func)], "\tother declaration of %s", m.name) // secondary error, \t indented
default:
- // check method signatures after all types are computed (issue #33656)
+ // We have a duplicate method name in an embedded (not explicitly declared) method.
+ // Check method signatures after all types are computed (issue #33656).
+ // If we're pre-go1.14 (overlapping embeddings are not permitted), report that
+ // error here as well (even though we could do it eagerly) because it's the same
+ // error message.
check.atEnd(func() {
- if !check.identical(m.typ, other.Type()) {
+ if !check.allowVersion(m.pkg, 1, 14) || !check.identical(m.typ, other.Type()) {
check.errorf(pos, "duplicate method %s", m.name)
check.errorf(mpos[other.(*Func)], "\tother declaration of %s", m.name) // secondary error, \t indented
}
@@ -963,8 +967,8 @@ func (check *Checker) completeInterface(pos syntax.Pos, ityp *Interface) {
posList := check.posMap[ityp]
for i, typ := range ityp.embeddeds {
pos := posList[i] // embedding position
- utyp := typ.Under()
- etyp := utyp.Interface()
+ utyp := under(typ)
+ etyp := asInterface(utyp)
if etyp == nil {
if utyp != Typ[Invalid] {
var format string
@@ -1041,7 +1045,7 @@ func (a byUniqueTypeName) Less(i, j int) bool { return sortName(a[i]) < sortName
func (a byUniqueTypeName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func sortName(t Type) string {
- if named := t.Named(); named != nil {
+ if named := asNamed(t); named != nil {
return named.obj.Id()
}
return ""
@@ -1155,12 +1159,12 @@ func (check *Checker) structType(styp *Struct, e *syntax.StructType) {
// Because we have a name, typ must be of the form T or *T, where T is the name
// of a (named or alias) type, and t (= deref(typ)) must be the type of T.
// We must delay this check to the end because we don't want to instantiate
- // (via t.Under()) a possibly incomplete type.
+ // (via under(t)) a possibly incomplete type.
embeddedTyp := typ // for closure below
embeddedPos := pos
check.atEnd(func() {
t, isPtr := deref(embeddedTyp)
- switch t := optype(t.Under()).(type) {
+ switch t := optype(t).(type) {
case *Basic:
if t == Typ[Invalid] {
// error was reported before
@@ -1200,8 +1204,6 @@ func embeddedFieldIdent(e syntax.Expr) *syntax.Name {
return e.Sel
case *syntax.IndexExpr:
return embeddedFieldIdent(e.X)
- case *syntax.ParenExpr:
- return embeddedFieldIdent(e.X)
}
return nil // invalid embedded field
}
@@ -1222,7 +1224,7 @@ func (check *Checker) collectTypeConstraints(pos syntax.Pos, types []syntax.Expr
// Note: This is a quadratic algorithm, but type lists tend to be short.
check.atEnd(func() {
for i, t := range list {
- if t := t.Interface(); t != nil {
+ if t := asInterface(t); t != nil {
check.completeInterface(types[i].Pos(), t)
}
if includes(list[:i], t) {
diff --git a/src/cmd/compile/internal/types2/unify.go b/src/cmd/compile/internal/types2/unify.go
index ab19c5a38b..d2ea2b952b 100644
--- a/src/cmd/compile/internal/types2/unify.go
+++ b/src/cmd/compile/internal/types2/unify.go
@@ -211,13 +211,13 @@ func (u *unifier) nify(x, y Type, p *ifacePair) bool {
// match a type name against an unnamed type literal, consider
// the underlying type of the named type.
// (Subtle: We use isNamed to include any type with a name (incl.
- // basic types and type parameters. We use Named() because we only
+ // basic types and type parameters. We use asNamed because we only
// want *Named types.)
switch {
- case !isNamed(x) && y != nil && y.Named() != nil:
- return u.nify(x, y.Under(), p)
- case x != nil && x.Named() != nil && !isNamed(y):
- return u.nify(x.Under(), y, p)
+ case !isNamed(x) && y != nil && asNamed(y) != nil:
+ return u.nify(x, under(y), p)
+ case x != nil && asNamed(x) != nil && !isNamed(y):
+ return u.nify(under(x), y, p)
}
}
diff --git a/src/cmd/compile/internal/types2/universe.go b/src/cmd/compile/internal/types2/universe.go
index f3dd53af1f..3654ab4945 100644
--- a/src/cmd/compile/internal/types2/universe.go
+++ b/src/cmd/compile/internal/types2/universe.go
@@ -1,4 +1,3 @@
-// UNREVIEWED
// Copyright 2011 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.
@@ -35,39 +34,39 @@ var (
// Use Universe.Lookup("byte").Type() to obtain the specific
// alias basic type named "byte" (and analogous for "rune").
var Typ = [...]*Basic{
- Invalid: {Invalid, 0, "invalid type", aType{}},
-
- Bool: {Bool, IsBoolean, "bool", aType{}},
- Int: {Int, IsInteger, "int", aType{}},
- Int8: {Int8, IsInteger, "int8", aType{}},
- Int16: {Int16, IsInteger, "int16", aType{}},
- Int32: {Int32, IsInteger, "int32", aType{}},
- Int64: {Int64, IsInteger, "int64", aType{}},
- Uint: {Uint, IsInteger | IsUnsigned, "uint", aType{}},
- Uint8: {Uint8, IsInteger | IsUnsigned, "uint8", aType{}},
- Uint16: {Uint16, IsInteger | IsUnsigned, "uint16", aType{}},
- Uint32: {Uint32, IsInteger | IsUnsigned, "uint32", aType{}},
- Uint64: {Uint64, IsInteger | IsUnsigned, "uint64", aType{}},
- Uintptr: {Uintptr, IsInteger | IsUnsigned, "uintptr", aType{}},
- Float32: {Float32, IsFloat, "float32", aType{}},
- Float64: {Float64, IsFloat, "float64", aType{}},
- Complex64: {Complex64, IsComplex, "complex64", aType{}},
- Complex128: {Complex128, IsComplex, "complex128", aType{}},
- String: {String, IsString, "string", aType{}},
- UnsafePointer: {UnsafePointer, 0, "Pointer", aType{}},
-
- UntypedBool: {UntypedBool, IsBoolean | IsUntyped, "untyped bool", aType{}},
- UntypedInt: {UntypedInt, IsInteger | IsUntyped, "untyped int", aType{}},
- UntypedRune: {UntypedRune, IsInteger | IsUntyped, "untyped rune", aType{}},
- UntypedFloat: {UntypedFloat, IsFloat | IsUntyped, "untyped float", aType{}},
- UntypedComplex: {UntypedComplex, IsComplex | IsUntyped, "untyped complex", aType{}},
- UntypedString: {UntypedString, IsString | IsUntyped, "untyped string", aType{}},
- UntypedNil: {UntypedNil, IsUntyped, "untyped nil", aType{}},
+ Invalid: {Invalid, 0, "invalid type"},
+
+ Bool: {Bool, IsBoolean, "bool"},
+ Int: {Int, IsInteger, "int"},
+ Int8: {Int8, IsInteger, "int8"},
+ Int16: {Int16, IsInteger, "int16"},
+ Int32: {Int32, IsInteger, "int32"},
+ Int64: {Int64, IsInteger, "int64"},
+ Uint: {Uint, IsInteger | IsUnsigned, "uint"},
+ Uint8: {Uint8, IsInteger | IsUnsigned, "uint8"},
+ Uint16: {Uint16, IsInteger | IsUnsigned, "uint16"},
+ Uint32: {Uint32, IsInteger | IsUnsigned, "uint32"},
+ Uint64: {Uint64, IsInteger | IsUnsigned, "uint64"},
+ Uintptr: {Uintptr, IsInteger | IsUnsigned, "uintptr"},
+ Float32: {Float32, IsFloat, "float32"},
+ Float64: {Float64, IsFloat, "float64"},
+ Complex64: {Complex64, IsComplex, "complex64"},
+ Complex128: {Complex128, IsComplex, "complex128"},
+ String: {String, IsString, "string"},
+ UnsafePointer: {UnsafePointer, 0, "Pointer"},
+
+ UntypedBool: {UntypedBool, IsBoolean | IsUntyped, "untyped bool"},
+ UntypedInt: {UntypedInt, IsInteger | IsUntyped, "untyped int"},
+ UntypedRune: {UntypedRune, IsInteger | IsUntyped, "untyped rune"},
+ UntypedFloat: {UntypedFloat, IsFloat | IsUntyped, "untyped float"},
+ UntypedComplex: {UntypedComplex, IsComplex | IsUntyped, "untyped complex"},
+ UntypedString: {UntypedString, IsString | IsUntyped, "untyped string"},
+ UntypedNil: {UntypedNil, IsUntyped, "untyped nil"},
}
var aliases = [...]*Basic{
- {Byte, IsInteger | IsUnsigned, "byte", aType{}},
- {Rune, IsInteger, "rune", aType{}},
+ {Byte, IsInteger | IsUnsigned, "byte"},
+ {Rune, IsInteger, "rune"},
}
func defPredeclaredTypes() {
@@ -256,7 +255,7 @@ func def(obj Object) {
return // nothing to do
}
// fix Obj link for named types
- if typ := obj.Type().Named(); typ != nil {
+ if typ := asNamed(obj.Type()); typ != nil {
typ.obj = obj.(*TypeName)
}
// exported identifiers go into package unsafe
diff --git a/src/cmd/compile/internal/types2/version.go b/src/cmd/compile/internal/types2/version.go
new file mode 100644
index 0000000000..cb497f048e
--- /dev/null
+++ b/src/cmd/compile/internal/types2/version.go
@@ -0,0 +1,81 @@
+// Copyright 2021 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.
+
+package types2
+
+import (
+ "cmd/compile/internal/syntax"
+ "fmt"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+// langCompat reports an error if the representation of a numeric
+// literal is not compatible with the current language version.
+func (check *Checker) langCompat(lit *syntax.BasicLit) {
+ s := lit.Value
+ if len(s) <= 2 || check.allowVersion(check.pkg, 1, 13) {
+ return
+ }
+ // len(s) > 2
+ if strings.Contains(s, "_") {
+ check.errorf(lit, "underscores in numeric literals requires go1.13 or later")
+ return
+ }
+ if s[0] != '0' {
+ return
+ }
+ radix := s[1]
+ if radix == 'b' || radix == 'B' {
+ check.errorf(lit, "binary literals requires go1.13 or later")
+ return
+ }
+ if radix == 'o' || radix == 'O' {
+ check.errorf(lit, "0o/0O-style octal literals requires go1.13 or later")
+ return
+ }
+ if lit.Kind != syntax.IntLit && (radix == 'x' || radix == 'X') {
+ check.errorf(lit, "hexadecimal floating-point literals requires go1.13 or later")
+ }
+}
+
+// allowVersion reports whether the given package
+// is allowed to use version major.minor.
+func (check *Checker) allowVersion(pkg *Package, major, minor int) bool {
+ // We assume that imported packages have all been checked,
+ // so we only have to check for the local package.
+ if pkg != check.pkg {
+ return true
+ }
+ ma, mi := check.version.major, check.version.minor
+ return ma == 0 && mi == 0 || ma > major || ma == major && mi >= minor
+}
+
+type version struct {
+ major, minor int
+}
+
+// parseGoVersion parses a Go version string (such as "go1.12")
+// and returns the version, or an error. If s is the empty
+// string, the version is 0.0.
+func parseGoVersion(s string) (v version, err error) {
+ if s == "" {
+ return
+ }
+ matches := goVersionRx.FindStringSubmatch(s)
+ if matches == nil {
+ err = fmt.Errorf(`should be something like "go1.12"`)
+ return
+ }
+ v.major, err = strconv.Atoi(matches[1])
+ if err != nil {
+ return
+ }
+ v.minor, err = strconv.Atoi(matches[2])
+ return
+}
+
+// goVersionRx matches a Go version string, e.g. "go1.12".
+var goVersionRx = regexp.MustCompile(`^go([1-9][0-9]*)\.(0|[1-9][0-9]*)$`)
diff --git a/src/cmd/compile/internal/walk/assign.go b/src/cmd/compile/internal/walk/assign.go
index 230b544148..44622c741d 100644
--- a/src/cmd/compile/internal/walk/assign.go
+++ b/src/cmd/compile/internal/walk/assign.go
@@ -270,7 +270,7 @@ func ascompatet(nl ir.Nodes, nr *types.Type) []ir.Node {
}
res := ir.NewResultExpr(base.Pos, nil, types.BADWIDTH)
- res.Offset = base.Ctxt.FixedFrameSize() + r.Offset
+ res.Index = int64(i)
res.SetType(r.Type)
res.SetTypecheck(1)
diff --git a/src/cmd/compile/internal/walk/expr.go b/src/cmd/compile/internal/walk/expr.go
index d7a20206c8..7b65db5100 100644
--- a/src/cmd/compile/internal/walk/expr.go
+++ b/src/cmd/compile/internal/walk/expr.go
@@ -480,8 +480,12 @@ func walkAddString(n *ir.AddStringExpr, init *ir.Nodes) ir.Node {
// walkCall walks an OCALLFUNC, OCALLINTER, or OCALLMETH node.
func walkCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
- if n.Op() == ir.OCALLINTER {
+ if n.Op() == ir.OCALLINTER || n.Op() == ir.OCALLMETH {
+ // We expect both interface call reflect.Type.Method and concrete
+ // call reflect.(*rtype).Method.
usemethod(n)
+ }
+ if n.Op() == ir.OCALLINTER {
reflectdata.MarkUsedIfaceMethod(n)
}
@@ -899,6 +903,16 @@ func usemethod(n *ir.CallExpr) {
}
}
+ // Don't mark reflect.(*rtype).Method, etc. themselves in the reflect package.
+ // Those functions may be alive via the itab, which should not cause all methods
+ // alive. We only want to mark their callers.
+ if base.Ctxt.Pkgpath == "reflect" {
+ switch ir.CurFunc.Nname.Sym().Name { // TODO: is there a better way than hardcoding the names?
+ case "(*rtype).Method", "(*rtype).MethodByName", "(*interfaceType).Method", "(*interfaceType).MethodByName":
+ return
+ }
+ }
+
// Note: Don't rely on res0.Type.String() since its formatting depends on multiple factors
// (including global variables such as numImports - was issue #19028).
// Also need to check for reflect package itself (see Issue #38515).
diff --git a/src/cmd/compile/internal/walk/select.go b/src/cmd/compile/internal/walk/select.go
index 873be289dc..d2b67ddf55 100644
--- a/src/cmd/compile/internal/walk/select.go
+++ b/src/cmd/compile/internal/walk/select.go
@@ -106,7 +106,7 @@ func walkSelectCases(cases []*ir.CommClause) []ir.Node {
ir.SetPos(n)
r := ir.NewIfStmt(base.Pos, nil, nil, nil)
*r.PtrInit() = cas.Init()
- var call ir.Node
+ var cond ir.Node
switch n.Op() {
default:
base.Fatalf("select %v", n.Op())
@@ -115,7 +115,7 @@ func walkSelectCases(cases []*ir.CommClause) []ir.Node {
// if selectnbsend(c, v) { body } else { default body }
n := n.(*ir.SendStmt)
ch := n.Chan
- call = mkcall1(chanfn("selectnbsend", 2, ch.Type()), types.Types[types.TBOOL], r.PtrInit(), ch, n.Value)
+ cond = mkcall1(chanfn("selectnbsend", 2, ch.Type()), types.Types[types.TBOOL], r.PtrInit(), ch, n.Value)
case ir.OSELRECV2:
n := n.(*ir.AssignListStmt)
@@ -125,18 +125,14 @@ func walkSelectCases(cases []*ir.CommClause) []ir.Node {
if ir.IsBlank(elem) {
elem = typecheck.NodNil()
}
- if ir.IsBlank(n.Lhs[1]) {
- // if selectnbrecv(&v, c) { body } else { default body }
- call = mkcall1(chanfn("selectnbrecv", 2, ch.Type()), types.Types[types.TBOOL], r.PtrInit(), elem, ch)
- } else {
- // TODO(cuonglm): make this use selectnbrecv()
- // if selectnbrecv2(&v, &received, c) { body } else { default body }
- receivedp := typecheck.Expr(typecheck.NodAddr(n.Lhs[1]))
- call = mkcall1(chanfn("selectnbrecv2", 2, ch.Type()), types.Types[types.TBOOL], r.PtrInit(), elem, receivedp, ch)
- }
+ cond = typecheck.Temp(types.Types[types.TBOOL])
+ fn := chanfn("selectnbrecv", 2, ch.Type())
+ call := mkcall1(fn, fn.Type().Results(), r.PtrInit(), elem, ch)
+ as := ir.NewAssignListStmt(r.Pos(), ir.OAS2, []ir.Node{cond, n.Lhs[1]}, []ir.Node{call})
+ r.PtrInit().Append(typecheck.Stmt(as))
}
- r.Cond = typecheck.Expr(call)
+ r.Cond = typecheck.Expr(cond)
r.Body = cas.Body
r.Else = append(dflt.Init(), dflt.Body...)
return []ir.Node{r, ir.NewBranchStmt(base.Pos, ir.OBREAK, nil)}
diff --git a/src/cmd/compile/internal/walk/stmt.go b/src/cmd/compile/internal/walk/stmt.go
index 46a621c2ba..0c851506cb 100644
--- a/src/cmd/compile/internal/walk/stmt.go
+++ b/src/cmd/compile/internal/walk/stmt.go
@@ -253,15 +253,22 @@ func wrapCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
}
}
+ wrapArgs := n.Args
+ // If there's a receiver argument, it needs to be passed through the wrapper too.
+ if n.Op() == ir.OCALLMETH || n.Op() == ir.OCALLINTER {
+ recv := n.X.(*ir.SelectorExpr).X
+ wrapArgs = append([]ir.Node{recv}, wrapArgs...)
+ }
+
// origArgs keeps track of what argument is uintptr-unsafe/unsafe-uintptr conversion.
- origArgs := make([]ir.Node, len(n.Args))
+ origArgs := make([]ir.Node, len(wrapArgs))
var funcArgs []*ir.Field
- for i, arg := range n.Args {
+ for i, arg := range wrapArgs {
s := typecheck.LookupNum("a", i)
if !isBuiltinCall && arg.Op() == ir.OCONVNOP && arg.Type().IsUintptr() && arg.(*ir.ConvExpr).X.Type().IsUnsafePtr() {
origArgs[i] = arg
arg = arg.(*ir.ConvExpr).X
- n.Args[i] = arg
+ wrapArgs[i] = arg
}
funcArgs = append(funcArgs, ir.NewField(base.Pos, s, nil, arg.Type()))
}
@@ -278,6 +285,12 @@ func wrapCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
}
args[i] = ir.NewConvExpr(base.Pos, origArg.Op(), origArg.Type(), args[i])
}
+ if n.Op() == ir.OCALLMETH || n.Op() == ir.OCALLINTER {
+ // Move wrapped receiver argument back to its appropriate place.
+ recv := typecheck.Expr(args[0])
+ n.X.(*ir.SelectorExpr).X = recv
+ args = args[1:]
+ }
call := ir.NewCallExpr(base.Pos, n.Op(), n.X, args)
if !isBuiltinCall {
call.SetOp(ir.OCALL)
@@ -291,6 +304,6 @@ func wrapCall(n *ir.CallExpr, init *ir.Nodes) ir.Node {
typecheck.Stmts(fn.Body)
typecheck.Target.Decls = append(typecheck.Target.Decls, fn)
- call = ir.NewCallExpr(base.Pos, ir.OCALL, fn.Nname, n.Args)
+ call = ir.NewCallExpr(base.Pos, ir.OCALL, fn.Nname, wrapArgs)
return walkExpr(typecheck.Stmt(call), init)
}
diff --git a/src/cmd/compile/internal/x86/ssa.go b/src/cmd/compile/internal/x86/ssa.go
index 00dfa07bf7..62982f4c6d 100644
--- a/src/cmd/compile/internal/x86/ssa.go
+++ b/src/cmd/compile/internal/x86/ssa.go
@@ -161,31 +161,19 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.Op386PXOR,
ssa.Op386ADCL,
ssa.Op386SBBL:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
- opregreg(s, v.Op.Asm(), r, v.Args[1].Reg())
+ opregreg(s, v.Op.Asm(), v.Reg(), v.Args[1].Reg())
case ssa.Op386ADDLcarry, ssa.Op386SUBLcarry:
// output 0 is carry/borrow, output 1 is the low 32 bits.
- r := v.Reg0()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output[0] not in same register %s", v.LongString())
- }
- opregreg(s, v.Op.Asm(), r, v.Args[1].Reg())
+ opregreg(s, v.Op.Asm(), v.Reg0(), v.Args[1].Reg())
case ssa.Op386ADDLconstcarry, ssa.Op386SUBLconstcarry:
// output 0 is carry/borrow, output 1 is the low 32 bits.
- r := v.Reg0()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output[0] not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg0()
case ssa.Op386DIVL, ssa.Op386DIVW,
ssa.Op386DIVLU, ssa.Op386DIVWU,
@@ -306,20 +294,16 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
// compute (x+y)/2 unsigned.
// Do a 32-bit add, the overflow goes into the carry.
// Shift right once and pull the carry back into the 31st bit.
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(x86.AADDL)
p.From.Type = obj.TYPE_REG
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
p.From.Reg = v.Args[1].Reg()
p = s.Prog(x86.ARCRL)
p.From.Type = obj.TYPE_CONST
p.From.Offset = 1
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.Op386ADDLconst:
r := v.Reg()
@@ -358,7 +342,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
p.To.Reg = r
- p.SetFrom3(obj.Addr{Type: obj.TYPE_REG, Reg: v.Args[0].Reg()})
+ p.SetFrom3Reg(v.Args[0].Reg())
case ssa.Op386SUBLconst,
ssa.Op386ADCLconst,
@@ -370,15 +354,11 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssa.Op386SHRLconst, ssa.Op386SHRWconst, ssa.Op386SHRBconst,
ssa.Op386SARLconst, ssa.Op386SARWconst, ssa.Op386SARBconst,
ssa.Op386ROLLconst, ssa.Op386ROLWconst, ssa.Op386ROLBconst:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_CONST
p.From.Offset = v.AuxInt
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.Op386SBBLcarrymask:
r := v.Reg()
p := s.Prog(v.Op.Asm())
@@ -536,9 +516,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssagen.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
case ssa.Op386ADDLload, ssa.Op386SUBLload, ssa.Op386MULLload,
ssa.Op386ANDLload, ssa.Op386ORLload, ssa.Op386XORLload,
ssa.Op386ADDSDload, ssa.Op386ADDSSload, ssa.Op386SUBSDload, ssa.Op386SUBSSload,
@@ -549,9 +526,6 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
ssagen.AddAux(&p.From, v)
p.To.Type = obj.TYPE_REG
p.To.Reg = v.Reg()
- if v.Reg() != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
case ssa.Op386MOVSSstore, ssa.Op386MOVSDstore, ssa.Op386MOVLstore, ssa.Op386MOVWstore, ssa.Op386MOVBstore,
ssa.Op386ADDLmodify, ssa.Op386SUBLmodify, ssa.Op386ANDLmodify, ssa.Op386ORLmodify, ssa.Op386XORLmodify:
p := s.Prog(v.Op.Asm())
@@ -781,16 +755,12 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
case ssa.Op386NEGL,
ssa.Op386BSWAPL,
ssa.Op386NOTL:
- r := v.Reg()
- if r != v.Args[0].Reg() {
- v.Fatalf("input[0] and output not in same register %s", v.LongString())
- }
p := s.Prog(v.Op.Asm())
p.To.Type = obj.TYPE_REG
- p.To.Reg = r
+ p.To.Reg = v.Reg()
case ssa.Op386BSFL, ssa.Op386BSFW,
ssa.Op386BSRL, ssa.Op386BSRW,
- ssa.Op386SQRTSD:
+ ssa.Op386SQRTSS, ssa.Op386SQRTSD:
p := s.Prog(v.Op.Asm())
p.From.Type = obj.TYPE_REG
p.From.Reg = v.Args[0].Reg()
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index c8c3212d16..158cedbadc 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -111,9 +111,6 @@ func xinit() {
fatalf("$GOROOT must be set")
}
goroot = filepath.Clean(b)
- if modRoot := findModuleRoot(goroot); modRoot != "" {
- fatalf("found go.mod file in %s: $GOROOT must not be inside a module", modRoot)
- }
b = os.Getenv("GOROOT_FINAL")
if b == "" {
@@ -241,6 +238,9 @@ func xinit() {
os.Setenv("LANGUAGE", "en_US.UTF8")
workdir = xworkdir()
+ if err := ioutil.WriteFile(pathf("%s/go.mod", workdir), []byte("module bootstrap"), 0666); err != nil {
+ fatalf("cannot write stub go.mod: %s", err)
+ }
xatexit(rmworkdir)
tooldir = pathf("%s/pkg/tool/%s_%s", goroot, gohostos, gohostarch)
@@ -982,6 +982,11 @@ func matchtag(tag string) bool {
}
return !matchtag(tag[1:])
}
+ if os.Getenv("GOEXPERIMENT") == "regabi" && tag == "goexperiment.regabi" {
+ // TODO: maybe we can handle GOEXPERIMENT more generally.
+ // Or remove once we commit to regabi (#40724).
+ return true
+ }
return tag == "gc" || tag == goos || tag == goarch || tag == "cmd_go_bootstrap" || tag == "go1.1" ||
(goos == "android" && tag == "linux") ||
(goos == "illumos" && tag == "solaris") ||
@@ -1500,11 +1505,11 @@ func goCmd(goBinary string, cmd string, args ...string) {
goCmd = append(goCmd, "-p=1")
}
- run(goroot, ShowOutput|CheckExit, append(goCmd, args...)...)
+ run(workdir, ShowOutput|CheckExit, append(goCmd, args...)...)
}
func checkNotStale(goBinary string, targets ...string) {
- out := run(goroot, CheckExit,
+ out := run(workdir, CheckExit,
append([]string{
goBinary,
"list", "-gcflags=all=" + gogcflags, "-ldflags=all=" + goldflags,
@@ -1514,7 +1519,7 @@ func checkNotStale(goBinary string, targets ...string) {
os.Setenv("GODEBUG", "gocachehash=1")
for _, target := range []string{"runtime/internal/sys", "cmd/dist", "cmd/link"} {
if strings.Contains(out, "STALE "+target) {
- run(goroot, ShowOutput|CheckExit, goBinary, "list", "-f={{.ImportPath}} {{.Stale}}", target)
+ run(workdir, ShowOutput|CheckExit, goBinary, "list", "-f={{.ImportPath}} {{.Stale}}", target)
break
}
}
@@ -1575,6 +1580,7 @@ var cgoEnabled = map[string]bool{
"windows/386": true,
"windows/amd64": true,
"windows/arm": false,
+ "windows/arm64": false,
}
// List of platforms which are supported but not complete yet. These get
@@ -1609,20 +1615,6 @@ func checkCC() {
}
}
-func findModuleRoot(dir string) (root string) {
- for {
- if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() {
- return dir
- }
- d := filepath.Dir(dir)
- if d == dir {
- break
- }
- dir = d
- }
- return ""
-}
-
func defaulttarg() string {
// xgetwd might return a path with symlinks fully resolved, and if
// there happens to be symlinks in goroot, then the hasprefix test
@@ -1765,6 +1757,8 @@ func IsRuntimePackagePath(pkgpath string) bool {
rval = true
case "syscall":
rval = true
+ case "crypto/x509/internal/macos": // libc function wrappers need to be ABIInternal
+ rval = true
default:
rval = strings.HasPrefix(pkgpath, "runtime/internal")
}
diff --git a/src/cmd/dist/sys_default.go b/src/cmd/dist/sys_default.go
index 821dc273d6..e87c84ce3e 100644
--- a/src/cmd/dist/sys_default.go
+++ b/src/cmd/dist/sys_default.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package main
diff --git a/src/cmd/dist/sys_windows.go b/src/cmd/dist/sys_windows.go
index 2f6a1b0dce..265f729d0f 100644
--- a/src/cmd/dist/sys_windows.go
+++ b/src/cmd/dist/sys_windows.go
@@ -29,10 +29,13 @@ type systeminfo struct {
wProcessorRevision uint16
}
+// See https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-system_info
const (
PROCESSOR_ARCHITECTURE_AMD64 = 9
PROCESSOR_ARCHITECTURE_INTEL = 0
PROCESSOR_ARCHITECTURE_ARM = 5
+ PROCESSOR_ARCHITECTURE_ARM64 = 12
+ PROCESSOR_ARCHITECTURE_IA64 = 6
)
var sysinfo systeminfo
@@ -46,6 +49,8 @@ func sysinit() {
gohostarch = "386"
case PROCESSOR_ARCHITECTURE_ARM:
gohostarch = "arm"
+ case PROCESSOR_ARCHITECTURE_ARM64:
+ gohostarch = "arm64"
default:
fatalf("unknown processor architecture")
}
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 365a77a156..0c8e2c56bc 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -444,8 +444,12 @@ func (t *tester) registerTests() {
fatalf("Error running go list std cmd: %v:\n%s", err, cmd.Stderr)
}
pkgs := strings.Fields(string(all))
- for _, pkg := range pkgs {
- t.registerStdTest(pkg, true)
+ if false {
+ // Disable -G=3 option for standard tests for now, since
+ // they are flaky on the builder.
+ for _, pkg := range pkgs {
+ t.registerStdTest(pkg, true /* -G=3 flag */)
+ }
}
for _, pkg := range pkgs {
t.registerStdTest(pkg, false)
@@ -743,14 +747,6 @@ func (t *tester) registerTests() {
}
}
- // Doc tests only run on builders.
- // They find problems approximately never.
- if goos != "js" && goos != "android" && !t.iOS() && os.Getenv("GO_BUILDER_NAME") != "" {
- t.registerTest("doc_progs", "../doc/progs", "go", "run", "run.go")
- t.registerTest("wiki", "../doc/articles/wiki", t.goTest(), ".")
- t.registerTest("codewalk", "../doc/codewalk", t.goTest(), "codewalk_test.go")
- }
-
if goos != "android" && !t.iOS() {
// There are no tests in this directory, only benchmarks.
// Check that the test binary builds but don't bother running it.
@@ -1637,7 +1633,7 @@ func raceDetectorSupported(goos, goarch string) bool {
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
case "darwin":
return goarch == "amd64" || goarch == "arm64"
- case "freebsd", "netbsd", "windows":
+ case "freebsd", "netbsd", "openbsd", "windows":
return goarch == "amd64"
default:
return false
diff --git a/src/cmd/dist/test_linux.go b/src/cmd/dist/test_linux.go
index b6d0aedbbf..43d28dc661 100644
--- a/src/cmd/dist/test_linux.go
+++ b/src/cmd/dist/test_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package main
diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go
index 0a419e465f..e99375f538 100644
--- a/src/cmd/dist/util.go
+++ b/src/cmd/dist/util.go
@@ -389,6 +389,10 @@ func xgetgoarm() string {
// sense to auto-detect the setting.
return "7"
}
+ if goos == "windows" {
+ // windows/arm only works with ARMv7 executables.
+ return "7"
+ }
if gohostarch != "arm" || goos != gohostos {
// Conservative default for cross-compilation.
return "5"
diff --git a/src/cmd/dist/util_gc.go b/src/cmd/dist/util_gc.go
index 17a0e6fbb5..875784d383 100644
--- a/src/cmd/dist/util_gc.go
+++ b/src/cmd/dist/util_gc.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !gccgo
+//go:build gc
+// +build gc
package main
diff --git a/src/cmd/dist/util_gccgo.go b/src/cmd/dist/util_gccgo.go
index dc897236fb..3255b80365 100644
--- a/src/cmd/dist/util_gccgo.go
+++ b/src/cmd/dist/util_gccgo.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gccgo
// +build gccgo
package main
diff --git a/src/cmd/go.mod b/src/cmd/go.mod
index 235e28f64f..ef05ca1ad1 100644
--- a/src/cmd/go.mod
+++ b/src/cmd/go.mod
@@ -6,7 +6,7 @@ require (
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
- golang.org/x/mod v0.4.1
- golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
- golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff
+ golang.org/x/mod v0.4.2-0.20210301144719-c8bb1bd8a2aa
+ golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e // indirect
+ golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f
)
diff --git a/src/cmd/go.sum b/src/cmd/go.sum
index 70aae0b4cc..77063f76af 100644
--- a/src/cmd/go.sum
+++ b/src/cmd/go.sum
@@ -13,9 +13,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/mod v0.4.1 h1:Kvvh58BN8Y9/lBi7hTekvtMpm07eUZ0ck5pRHpsMWrY=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.2-0.20210301144719-c8bb1bd8a2aa h1:Ci2bbuyE4ah9djFByg+fdNQcqc8DVSdcXbrWy6MBoEs=
+golang.org/x/mod v0.4.2-0.20210301144719-c8bb1bd8a2aa/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
@@ -25,14 +25,15 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso=
-golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e h1:f5mksnk+hgXHnImpZoWj64ja99j9zV7YUgrVG95uFE4=
+golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff h1:6EkB024TP1fu6cmQqeCNw685zYDVt5g8N1BXh755SQM=
-golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f h1:R8L2zr6nSvQoIIw/EiaPP6HfmxeiArf+Nh/CWTC60wQ=
+golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index da06e831ae..a125e94cea 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -596,7 +596,7 @@
//
// Usage:
//
-// go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]
+// go get [-d] [-t] [-u] [-v] [build flags] [packages]
//
// Get resolves its command-line arguments to packages at specific module versions,
// updates go.mod to require those versions, downloads source code into the
@@ -641,14 +641,6 @@
// When the -t and -u flags are used together, get will update
// test dependencies as well.
//
-// The -insecure flag permits fetching from repositories and resolving
-// custom domains using insecure schemes such as HTTP, and also bypassess
-// module sum validation using the checksum database. Use with caution.
-// This flag is deprecated and will be removed in a future version of go.
-// To permit the use of insecure schemes, use the GOINSECURE environment
-// variable instead. To bypass module sum validation, use GOPRIVATE or
-// GONOSUMDB. See 'go help environment' for details.
-//
// The -d flag instructs get not to build or install packages. get will only
// update go.mod and download source code needed to build packages.
//
@@ -1783,9 +1775,8 @@
// Comma-separated list of glob patterns (in the syntax of Go's path.Match)
// of module path prefixes that should always be fetched in an insecure
// manner. Only applies to dependencies that are being fetched directly.
-// Unlike the -insecure flag on 'go get', GOINSECURE does not disable
-// checksum database validation. GOPRIVATE or GONOSUMDB may be used
-// to achieve that.
+// GOINSECURE does not disable checksum database validation. GOPRIVATE or
+// GONOSUMDB may be used to achieve that.
// GOOS
// The operating system for which to compile code.
// Examples are linux, darwin, windows, netbsd.
@@ -1808,7 +1799,7 @@
// The directory where the go command will write
// temporary source files, packages, and binaries.
// GOVCS
-// Lists version control commands that may be used with matching servers.
+// Lists version control commands that may be used with matching servers.
// See 'go help vcs'.
//
// Environment variables for use with cgo:
@@ -2135,7 +2126,7 @@
// This help text, accessible as 'go help gopath-get' even in module-aware mode,
// describes 'go get' as it operates in legacy GOPATH mode.
//
-// Usage: go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages]
+// Usage: go get [-d] [-f] [-t] [-u] [-v] [-fix] [build flags] [packages]
//
// Get downloads the packages named by the import paths, along with their
// dependencies. It then installs the named packages, like 'go install'.
@@ -2151,13 +2142,6 @@
// The -fix flag instructs get to run the fix tool on the downloaded packages
// before resolving dependencies or building the code.
//
-// The -insecure flag permits fetching from repositories and resolving
-// custom domains using insecure schemes such as HTTP. Use with caution.
-// This flag is deprecated and will be removed in a future version of go.
-// The GOINSECURE environment variable should be used instead, since it
-// provides control over which packages may be retrieved using an insecure
-// scheme. See 'go help environment' for details.
-//
// The -t flag instructs get to also download the packages required to build
// the tests for the specified packages.
//
@@ -2342,7 +2326,7 @@
// will result in the following requests:
//
// https://example.org/pkg/foo?go-get=1 (preferred)
-// http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure)
+// http://example.org/pkg/foo?go-get=1 (fallback, only with use of correctly set GOINSECURE)
//
// If that page contains the meta tag
//
@@ -2410,6 +2394,17 @@
//
// For a detailed reference on modules, see https://golang.org/ref/mod.
//
+// By default, the go command may download modules from https://proxy.golang.org.
+// It may authenticate modules using the checksum database at
+// https://sum.golang.org. Both services are operated by the Go team at Google.
+// The privacy policies for these services are available at
+// https://proxy.golang.org/privacy and https://sum.golang.org/privacy,
+// respectively.
+//
+// The go command's download behavior may be configured using GOPROXY, GOSUMDB,
+// GOPRIVATE, and other environment variables. See 'go help environment'
+// and https://golang.org/ref/mod#private-module-privacy for more information.
+//
//
// Module authentication using go.sum
//
@@ -2868,20 +2863,23 @@
// legal reasons). Therefore, clients can still access public code served from
// Bazaar, Fossil, or Subversion repositories by default, because those downloads
// use the Go module mirror, which takes on the security risk of running the
-// version control commands, using a custom sandbox.
+// version control commands using a custom sandbox.
//
// The GOVCS variable can be used to change the allowed version control systems
// for specific packages (identified by a module or import path).
-// The GOVCS variable applies both when using modules and when using GOPATH.
-// When using modules, the patterns match against the module path.
-// When using GOPATH, the patterns match against the import path
-// corresponding to the root of the version control repository.
+// The GOVCS variable applies when building package in both module-aware mode
+// and GOPATH mode. When using modules, the patterns match against the module path.
+// When using GOPATH, the patterns match against the import path corresponding to
+// the root of the version control repository.
//
// The general form of the GOVCS setting is a comma-separated list of
// pattern:vcslist rules. The pattern is a glob pattern that must match
// one or more leading elements of the module or import path. The vcslist
// is a pipe-separated list of allowed version control commands, or "all"
-// to allow use of any known command, or "off" to allow nothing.
+// to allow use of any known command, or "off" to disallow all commands.
+// Note that if a module matches a pattern with vcslist "off", it may still be
+// downloaded if the origin server uses the "mod" scheme, which instructs the
+// go command to download the module using the GOPROXY protocol.
// The earliest matching pattern in the list applies, even if later patterns
// might also match.
//
@@ -2889,7 +2887,7 @@
//
// GOVCS=github.com:git,evil.com:off,*:git|hg
//
-// With this setting, code with an module or import path beginning with
+// With this setting, code with a module or import path beginning with
// github.com/ can only use git; paths on evil.com cannot use any version
// control command, and all other paths (* matches everything) can use
// only git or hg.
diff --git a/src/cmd/go/go11.go b/src/cmd/go/go11.go
index 7e383f4b5b..a1f2727825 100644
--- a/src/cmd/go/go11.go
+++ b/src/cmd/go/go11.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.1
// +build go1.1
package main
diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go
index 3ce32388d0..d14b2328bf 100644
--- a/src/cmd/go/go_test.go
+++ b/src/cmd/go/go_test.go
@@ -811,6 +811,7 @@ func TestNewReleaseRebuildsStalePackagesInGOPATH(t *testing.T) {
// so that we can change files.
for _, copydir := range []string{
"src/runtime",
+ "src/internal/abi",
"src/internal/bytealg",
"src/internal/cpu",
"src/math/bits",
diff --git a/src/cmd/go/go_unix_test.go b/src/cmd/go/go_unix_test.go
index f6e10ca59c..7d5ff9bbb7 100644
--- a/src/cmd/go/go_unix_test.go
+++ b/src/cmd/go/go_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package main_test
diff --git a/src/cmd/go/internal/base/signal_notunix.go b/src/cmd/go/internal/base/signal_notunix.go
index 9e869b03ea..5cc0b0f101 100644
--- a/src/cmd/go/internal/base/signal_notunix.go
+++ b/src/cmd/go/internal/base/signal_notunix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9 || windows
// +build plan9 windows
package base
diff --git a/src/cmd/go/internal/base/signal_unix.go b/src/cmd/go/internal/base/signal_unix.go
index 342775a118..cdc2658372 100644
--- a/src/cmd/go/internal/base/signal_unix.go
+++ b/src/cmd/go/internal/base/signal_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || js || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js linux netbsd openbsd solaris
package base
diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
index 322247962f..810189c15d 100644
--- a/src/cmd/go/internal/cfg/cfg.go
+++ b/src/cmd/go/internal/cfg/cfg.go
@@ -51,8 +51,6 @@ var (
ModCacheRW bool // -modcacherw flag
ModFile string // -modfile flag
- Insecure bool // -insecure flag
-
CmdName string // "build", "install", "list", "mod tidy", etc.
DebugActiongraph string // -debug-actiongraph flag (undocumented, unstable)
diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
index 6937187522..aad5d704e5 100644
--- a/src/cmd/go/internal/envcmd/env.go
+++ b/src/cmd/go/internal/envcmd/env.go
@@ -428,7 +428,7 @@ func checkEnvWrite(key, val string) error {
return fmt.Errorf("GOPATH entry is relative; must be absolute path: %q", val)
}
// Make sure CC and CXX are absolute paths
- case "CC", "CXX":
+ case "CC", "CXX", "GOMODCACHE":
if !filepath.IsAbs(val) && val != "" && val != filepath.Base(val) {
return fmt.Errorf("%s entry is relative; must be absolute path: %q", key, val)
}
diff --git a/src/cmd/go/internal/get/get.go b/src/cmd/go/internal/get/get.go
index 38ff3823f2..10eda1275e 100644
--- a/src/cmd/go/internal/get/get.go
+++ b/src/cmd/go/internal/get/get.go
@@ -26,7 +26,7 @@ import (
)
var CmdGet = &base.Command{
- UsageLine: "go get [-d] [-f] [-t] [-u] [-v] [-fix] [-insecure] [build flags] [packages]",
+ UsageLine: "go get [-d] [-f] [-t] [-u] [-v] [-fix] [build flags] [packages]",
Short: "download and install packages and dependencies",
Long: `
Get downloads the packages named by the import paths, along with their
@@ -43,13 +43,6 @@ of the original.
The -fix flag instructs get to run the fix tool on the downloaded packages
before resolving dependencies or building the code.
-The -insecure flag permits fetching from repositories and resolving
-custom domains using insecure schemes such as HTTP. Use with caution.
-This flag is deprecated and will be removed in a future version of go.
-The GOINSECURE environment variable should be used instead, since it
-provides control over which packages may be retrieved using an insecure
-scheme. See 'go help environment' for details.
-
The -t flag instructs get to also download the packages required to build
the tests for the specified packages.
@@ -105,17 +98,17 @@ Usage: ` + CmdGet.UsageLine + `
}
var (
- getD = CmdGet.Flag.Bool("d", false, "")
- getF = CmdGet.Flag.Bool("f", false, "")
- getT = CmdGet.Flag.Bool("t", false, "")
- getU = CmdGet.Flag.Bool("u", false, "")
- getFix = CmdGet.Flag.Bool("fix", false, "")
+ getD = CmdGet.Flag.Bool("d", false, "")
+ getF = CmdGet.Flag.Bool("f", false, "")
+ getT = CmdGet.Flag.Bool("t", false, "")
+ getU = CmdGet.Flag.Bool("u", false, "")
+ getFix = CmdGet.Flag.Bool("fix", false, "")
+ getInsecure = CmdGet.Flag.Bool("insecure", false, "")
)
func init() {
work.AddBuildFlags(CmdGet, work.OmitModFlag|work.OmitModCommonFlags)
CmdGet.Run = runGet // break init loop
- CmdGet.Flag.BoolVar(&cfg.Insecure, "insecure", cfg.Insecure, "")
}
func runGet(ctx context.Context, cmd *base.Command, args []string) {
@@ -129,8 +122,8 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
if *getF && !*getU {
base.Fatalf("go get: cannot use -f flag without -u")
}
- if cfg.Insecure {
- fmt.Fprintf(os.Stderr, "go get: -insecure flag is deprecated; see 'go help get' for details\n")
+ if *getInsecure {
+ base.Fatalf("go get: -insecure flag is no longer supported; use GOINSECURE instead")
}
// Disable any prompting for passwords by Git.
@@ -431,11 +424,11 @@ func downloadPackage(p *load.Package) error {
}
importPrefix = importPrefix[:slash]
}
- if err := module.CheckImportPath(importPrefix); err != nil {
+ if err := checkImportPath(importPrefix); err != nil {
return fmt.Errorf("%s: invalid import path: %v", p.ImportPath, err)
}
security := web.SecureOnly
- if cfg.Insecure || module.MatchPrefixPatterns(cfg.GOINSECURE, importPrefix) {
+ if module.MatchPrefixPatterns(cfg.GOINSECURE, importPrefix) {
security = web.Insecure
}
@@ -591,3 +584,31 @@ func selectTag(goVersion string, tags []string) (match string) {
}
return ""
}
+
+// checkImportPath is like module.CheckImportPath, but it forbids leading dots
+// in path elements. This can lead to 'go get' creating .git and other VCS
+// directories in places we might run VCS tools later.
+func checkImportPath(path string) error {
+ if err := module.CheckImportPath(path); err != nil {
+ return err
+ }
+ checkElem := func(elem string) error {
+ if elem[0] == '.' {
+ return fmt.Errorf("malformed import path %q: leading dot in path element", path)
+ }
+ return nil
+ }
+ elemStart := 0
+ for i, r := range path {
+ if r == '/' {
+ if err := checkElem(path[elemStart:]); err != nil {
+ return err
+ }
+ elemStart = i + 1
+ }
+ }
+ if err := checkElem(path[elemStart:]); err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/src/cmd/go/internal/help/helpdoc.go b/src/cmd/go/internal/help/helpdoc.go
index e07ad0e1db..2f86e4195d 100644
--- a/src/cmd/go/internal/help/helpdoc.go
+++ b/src/cmd/go/internal/help/helpdoc.go
@@ -251,7 +251,7 @@ For example,
will result in the following requests:
https://example.org/pkg/foo?go-get=1 (preferred)
- http://example.org/pkg/foo?go-get=1 (fallback, only with -insecure)
+ http://example.org/pkg/foo?go-get=1 (fallback, only with use of correctly set GOINSECURE)
If that page contains the meta tag
@@ -517,9 +517,8 @@ General-purpose environment variables:
Comma-separated list of glob patterns (in the syntax of Go's path.Match)
of module path prefixes that should always be fetched in an insecure
manner. Only applies to dependencies that are being fetched directly.
- Unlike the -insecure flag on 'go get', GOINSECURE does not disable
- checksum database validation. GOPRIVATE or GONOSUMDB may be used
- to achieve that.
+ GOINSECURE does not disable checksum database validation. GOPRIVATE or
+ GONOSUMDB may be used to achieve that.
GOOS
The operating system for which to compile code.
Examples are linux, darwin, windows, netbsd.
@@ -542,7 +541,7 @@ General-purpose environment variables:
The directory where the go command will write
temporary source files, packages, and binaries.
GOVCS
- Lists version control commands that may be used with matching servers.
+ Lists version control commands that may be used with matching servers.
See 'go help vcs'.
Environment variables for use with cgo:
diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
index 3a274a3ad1..8b12faf4cd 100644
--- a/src/cmd/go/internal/load/pkg.go
+++ b/src/cmd/go/internal/load/pkg.go
@@ -36,6 +36,8 @@ import (
"cmd/go/internal/str"
"cmd/go/internal/trace"
"cmd/internal/sys"
+
+ "golang.org/x/mod/module"
)
var IgnoreImports bool // control whether we ignore imports in packages
@@ -2090,6 +2092,9 @@ func validEmbedPattern(pattern string) bool {
// can't or won't be included in modules and therefore shouldn't be treated
// as existing for embedding.
func isBadEmbedName(name string) bool {
+ if err := module.CheckFilePath(name); err != nil {
+ return true
+ }
switch name {
// Empty string should be impossible but make it bad.
case "":
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go
index 1fa4327a89..a37b2ad6d1 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_fcntl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || (solaris && !illumos)
// +build aix solaris,!illumos
// This code implements the filelock API using POSIX 'fcntl' locks, which attach
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go
index bc480343fc..70f5d7a688 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_other.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !plan9 && !solaris && !windows
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!plan9,!solaris,!windows
package filelock
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go
index 0798ee469a..908afb6c8c 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_plan9.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package filelock
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go
index 2ac2052b8f..640d4406f4 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9
// +build !js,!plan9
package filelock_test
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_unix.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_unix.go
index ed07bac608..878a1e770d 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_unix.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build darwin dragonfly freebsd illumos linux netbsd openbsd
package filelock
diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_windows.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_windows.go
index 19de27eb9b..dd27ce92bd 100644
--- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_windows.go
+++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package filelock
diff --git a/src/cmd/go/internal/lockedfile/lockedfile_filelock.go b/src/cmd/go/internal/lockedfile/lockedfile_filelock.go
index efc66461ed..729df5c681 100644
--- a/src/cmd/go/internal/lockedfile/lockedfile_filelock.go
+++ b/src/cmd/go/internal/lockedfile/lockedfile_filelock.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package lockedfile
diff --git a/src/cmd/go/internal/lockedfile/lockedfile_plan9.go b/src/cmd/go/internal/lockedfile/lockedfile_plan9.go
index 70d6eddf2d..3d4b97d78e 100644
--- a/src/cmd/go/internal/lockedfile/lockedfile_plan9.go
+++ b/src/cmd/go/internal/lockedfile/lockedfile_plan9.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package lockedfile
diff --git a/src/cmd/go/internal/lockedfile/lockedfile_test.go b/src/cmd/go/internal/lockedfile/lockedfile_test.go
index 34327dd841..3acc6695a7 100644
--- a/src/cmd/go/internal/lockedfile/lockedfile_test.go
+++ b/src/cmd/go/internal/lockedfile/lockedfile_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// js does not support inter-process file locking.
+//go:build !js
// +build !js
package lockedfile_test
diff --git a/src/cmd/go/internal/lockedfile/transform_test.go b/src/cmd/go/internal/lockedfile/transform_test.go
index 407d48ea4a..b753346e7d 100644
--- a/src/cmd/go/internal/lockedfile/transform_test.go
+++ b/src/cmd/go/internal/lockedfile/transform_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// js does not support inter-process file locking.
+//go:build !js
// +build !js
package lockedfile_test
diff --git a/src/cmd/go/internal/modcmd/tidy.go b/src/cmd/go/internal/modcmd/tidy.go
index 3b83d87a8e..e7e63e6533 100644
--- a/src/cmd/go/internal/modcmd/tidy.go
+++ b/src/cmd/go/internal/modcmd/tidy.go
@@ -62,10 +62,11 @@ func runTidy(ctx context.Context, cmd *base.Command, args []string) {
modload.RootMode = modload.NeedRoot
modload.LoadPackages(ctx, modload.PackageOpts{
- Tags: imports.AnyTags(),
- ResolveMissingImports: true,
- LoadTests: true,
- AllowErrors: tidyE,
+ Tags: imports.AnyTags(),
+ VendorModulesInGOROOTSrc: true,
+ ResolveMissingImports: true,
+ LoadTests: true,
+ AllowErrors: tidyE,
}, "all")
modload.TidyBuildList()
diff --git a/src/cmd/go/internal/modcmd/vendor.go b/src/cmd/go/internal/modcmd/vendor.go
index d3ed9e00e2..2cd683b75c 100644
--- a/src/cmd/go/internal/modcmd/vendor.go
+++ b/src/cmd/go/internal/modcmd/vendor.go
@@ -64,10 +64,11 @@ func runVendor(ctx context.Context, cmd *base.Command, args []string) {
modload.RootMode = modload.NeedRoot
loadOpts := modload.PackageOpts{
- Tags: imports.AnyTags(),
- ResolveMissingImports: true,
- UseVendorAll: true,
- AllowErrors: vendorE,
+ Tags: imports.AnyTags(),
+ VendorModulesInGOROOTSrc: true,
+ ResolveMissingImports: true,
+ UseVendorAll: true,
+ AllowErrors: vendorE,
}
_, pkgs := modload.LoadPackages(ctx, loadOpts, "all")
diff --git a/src/cmd/go/internal/modcmd/why.go b/src/cmd/go/internal/modcmd/why.go
index a5f3e8afcb..79d257d198 100644
--- a/src/cmd/go/internal/modcmd/why.go
+++ b/src/cmd/go/internal/modcmd/why.go
@@ -68,10 +68,11 @@ func runWhy(ctx context.Context, cmd *base.Command, args []string) {
modload.RootMode = modload.NeedRoot
loadOpts := modload.PackageOpts{
- Tags: imports.AnyTags(),
- LoadTests: !*whyVendor,
- SilenceErrors: true,
- UseVendorAll: *whyVendor,
+ Tags: imports.AnyTags(),
+ VendorModulesInGOROOTSrc: true,
+ LoadTests: !*whyVendor,
+ SilenceErrors: true,
+ UseVendorAll: *whyVendor,
}
if *whyM {
diff --git a/src/cmd/go/internal/modfetch/bootstrap.go b/src/cmd/go/internal/modfetch/bootstrap.go
index e4020b0b41..ed694581a7 100644
--- a/src/cmd/go/internal/modfetch/bootstrap.go
+++ b/src/cmd/go/internal/modfetch/bootstrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cmd_go_bootstrap
// +build cmd_go_bootstrap
package modfetch
diff --git a/src/cmd/go/internal/modfetch/cache.go b/src/cmd/go/internal/modfetch/cache.go
index 3a2ff63721..9e751931a0 100644
--- a/src/cmd/go/internal/modfetch/cache.go
+++ b/src/cmd/go/internal/modfetch/cache.go
@@ -28,10 +28,8 @@ import (
)
func cacheDir(path string) (string, error) {
- if cfg.GOMODCACHE == "" {
- // modload.Init exits if GOPATH[0] is empty, and cfg.GOMODCACHE
- // is set to GOPATH[0]/pkg/mod if GOMODCACHE is empty, so this should never happen.
- return "", fmt.Errorf("internal error: cfg.GOMODCACHE not set")
+ if err := checkCacheDir(); err != nil {
+ return "", err
}
enc, err := module.EscapePath(path)
if err != nil {
@@ -64,10 +62,8 @@ func CachePath(m module.Version, suffix string) (string, error) {
// along with the directory if the directory does not exist or if the directory
// is not completely populated.
func DownloadDir(m module.Version) (string, error) {
- if cfg.GOMODCACHE == "" {
- // modload.Init exits if GOPATH[0] is empty, and cfg.GOMODCACHE
- // is set to GOPATH[0]/pkg/mod if GOMODCACHE is empty, so this should never happen.
- return "", fmt.Errorf("internal error: cfg.GOMODCACHE not set")
+ if err := checkCacheDir(); err != nil {
+ return "", err
}
enc, err := module.EscapePath(m.Path)
if err != nil {
@@ -134,10 +130,8 @@ func lockVersion(mod module.Version) (unlock func(), err error) {
// user's working directory.
// If err is nil, the caller MUST eventually call the unlock function.
func SideLock() (unlock func(), err error) {
- if cfg.GOMODCACHE == "" {
- // modload.Init exits if GOPATH[0] is empty, and cfg.GOMODCACHE
- // is set to GOPATH[0]/pkg/mod if GOMODCACHE is empty, so this should never happen.
- base.Fatalf("go: internal error: cfg.GOMODCACHE not set")
+ if err := checkCacheDir(); err != nil {
+ base.Fatalf("go: %v", err)
}
path := filepath.Join(cfg.GOMODCACHE, "cache", "lock")
@@ -633,3 +627,16 @@ func rewriteVersionList(dir string) {
base.Fatalf("go: failed to write version list: %v", err)
}
}
+
+func checkCacheDir() error {
+ if cfg.GOMODCACHE == "" {
+ // modload.Init exits if GOPATH[0] is empty, and cfg.GOMODCACHE
+ // is set to GOPATH[0]/pkg/mod if GOMODCACHE is empty, so this should never happen.
+ return fmt.Errorf("internal error: cfg.GOMODCACHE not set")
+ }
+
+ if !filepath.IsAbs(cfg.GOMODCACHE) {
+ return fmt.Errorf("GOMODCACHE entry is relative; must be absolute path: %q.\n", cfg.GOMODCACHE)
+ }
+ return nil
+}
diff --git a/src/cmd/go/internal/modfetch/codehost/shell.go b/src/cmd/go/internal/modfetch/codehost/shell.go
index ce8b501d53..0e9f381966 100644
--- a/src/cmd/go/internal/modfetch/codehost/shell.go
+++ b/src/cmd/go/internal/modfetch/codehost/shell.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Interactive debugging shell for codehost.Repo implementations.
diff --git a/src/cmd/go/internal/modfetch/fetch.go b/src/cmd/go/internal/modfetch/fetch.go
index c55c3cf253..d5ad277dd0 100644
--- a/src/cmd/go/internal/modfetch/fetch.go
+++ b/src/cmd/go/internal/modfetch/fetch.go
@@ -37,10 +37,8 @@ var downloadCache par.Cache
// local download cache and returns the name of the directory
// corresponding to the root of the module's file tree.
func Download(ctx context.Context, mod module.Version) (dir string, err error) {
- if cfg.GOMODCACHE == "" {
- // modload.Init exits if GOPATH[0] is empty, and cfg.GOMODCACHE
- // is set to GOPATH[0]/pkg/mod if GOMODCACHE is empty, so this should never happen.
- base.Fatalf("go: internal error: cfg.GOMODCACHE not set")
+ if err := checkCacheDir(); err != nil {
+ base.Fatalf("go: %v", err)
}
// The par.Cache here avoids duplicate work.
diff --git a/src/cmd/go/internal/modfetch/insecure.go b/src/cmd/go/internal/modfetch/insecure.go
deleted file mode 100644
index 012d05f29d..0000000000
--- a/src/cmd/go/internal/modfetch/insecure.go
+++ /dev/null
@@ -1,16 +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.
-
-package modfetch
-
-import (
- "cmd/go/internal/cfg"
-
- "golang.org/x/mod/module"
-)
-
-// allowInsecure reports whether we are allowed to fetch this path in an insecure manner.
-func allowInsecure(path string) bool {
- return cfg.Insecure || module.MatchPrefixPatterns(cfg.GOINSECURE, path)
-}
diff --git a/src/cmd/go/internal/modfetch/repo.go b/src/cmd/go/internal/modfetch/repo.go
index af9e24cefd..ed9a52267a 100644
--- a/src/cmd/go/internal/modfetch/repo.go
+++ b/src/cmd/go/internal/modfetch/repo.go
@@ -267,7 +267,7 @@ var (
func lookupDirect(path string) (Repo, error) {
security := web.SecureOnly
- if allowInsecure(path) {
+ if module.MatchPrefixPatterns(cfg.GOINSECURE, path) {
security = web.Insecure
}
rr, err := vcs.RepoRootForImportPath(path, vcs.PreferMod, security)
@@ -312,7 +312,7 @@ func ImportRepoRev(path, rev string) (Repo, *RevInfo, error) {
// version control system, we ignore meta tags about modules
// and use only direct source control entries (get.IgnoreMod).
security := web.SecureOnly
- if allowInsecure(path) {
+ if module.MatchPrefixPatterns(cfg.GOINSECURE, path) {
security = web.Insecure
}
rr, err := vcs.RepoRootForImportPath(path, vcs.IgnoreMod, security)
diff --git a/src/cmd/go/internal/modfetch/sumdb.go b/src/cmd/go/internal/modfetch/sumdb.go
index 4fbc54d15c..118bb3d2d0 100644
--- a/src/cmd/go/internal/modfetch/sumdb.go
+++ b/src/cmd/go/internal/modfetch/sumdb.go
@@ -4,6 +4,7 @@
// Go checksum database lookup
+//go:build !cmd_go_bootstrap
// +build !cmd_go_bootstrap
package modfetch
@@ -33,7 +34,7 @@ import (
// useSumDB reports whether to use the Go checksum database for the given module.
func useSumDB(mod module.Version) bool {
- return cfg.GOSUMDB != "off" && !cfg.Insecure && !module.MatchPrefixPatterns(cfg.GONOSUMDB, mod.Path)
+ return cfg.GOSUMDB != "off" && !module.MatchPrefixPatterns(cfg.GONOSUMDB, mod.Path)
}
// lookupSumDB returns the Go checksum database's go.sum lines for the given module,
diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go
index 574f3e194d..9340a582e5 100644
--- a/src/cmd/go/internal/modget/get.go
+++ b/src/cmd/go/internal/modget/get.go
@@ -37,7 +37,6 @@ import (
"sync"
"cmd/go/internal/base"
- "cmd/go/internal/cfg"
"cmd/go/internal/imports"
"cmd/go/internal/load"
"cmd/go/internal/modload"
@@ -53,7 +52,7 @@ import (
var CmdGet = &base.Command{
// Note: -d -u are listed explicitly because they are the most common get flags.
// Do not send CLs removing them because they're covered by [get flags].
- UsageLine: "go get [-d] [-t] [-u] [-v] [-insecure] [build flags] [packages]",
+ UsageLine: "go get [-d] [-t] [-u] [-v] [build flags] [packages]",
Short: "add dependencies to current module and install them",
Long: `
Get resolves its command-line arguments to packages at specific module versions,
@@ -99,14 +98,6 @@ but changes the default to select patch releases.
When the -t and -u flags are used together, get will update
test dependencies as well.
-The -insecure flag permits fetching from repositories and resolving
-custom domains using insecure schemes such as HTTP, and also bypassess
-module sum validation using the checksum database. Use with caution.
-This flag is deprecated and will be removed in a future version of go.
-To permit the use of insecure schemes, use the GOINSECURE environment
-variable instead. To bypass module sum validation, use GOPRIVATE or
-GONOSUMDB. See 'go help environment' for details.
-
The -d flag instructs get not to build or install packages. get will only
update go.mod and download source code needed to build packages.
@@ -176,20 +167,23 @@ packages or when the mirror refuses to serve a public package (typically for
legal reasons). Therefore, clients can still access public code served from
Bazaar, Fossil, or Subversion repositories by default, because those downloads
use the Go module mirror, which takes on the security risk of running the
-version control commands, using a custom sandbox.
+version control commands using a custom sandbox.
The GOVCS variable can be used to change the allowed version control systems
for specific packages (identified by a module or import path).
-The GOVCS variable applies both when using modules and when using GOPATH.
-When using modules, the patterns match against the module path.
-When using GOPATH, the patterns match against the import path
-corresponding to the root of the version control repository.
+The GOVCS variable applies when building package in both module-aware mode
+and GOPATH mode. When using modules, the patterns match against the module path.
+When using GOPATH, the patterns match against the import path corresponding to
+the root of the version control repository.
The general form of the GOVCS setting is a comma-separated list of
pattern:vcslist rules. The pattern is a glob pattern that must match
one or more leading elements of the module or import path. The vcslist
is a pipe-separated list of allowed version control commands, or "all"
-to allow use of any known command, or "off" to allow nothing.
+to allow use of any known command, or "off" to disallow all commands.
+Note that if a module matches a pattern with vcslist "off", it may still be
+downloaded if the origin server uses the "mod" scheme, which instructs the
+go command to download the module using the GOPROXY protocol.
The earliest matching pattern in the list applies, even if later patterns
might also match.
@@ -197,7 +191,7 @@ For example, consider:
GOVCS=github.com:git,evil.com:off,*:git|hg
-With this setting, code with an module or import path beginning with
+With this setting, code with a module or import path beginning with
github.com/ can only use git; paths on evil.com cannot use any version
control command, and all other paths (* matches everything) can use
only git or hg.
@@ -224,13 +218,13 @@ variable for future go command invocations.
}
var (
- getD = CmdGet.Flag.Bool("d", false, "")
- getF = CmdGet.Flag.Bool("f", false, "")
- getFix = CmdGet.Flag.Bool("fix", false, "")
- getM = CmdGet.Flag.Bool("m", false, "")
- getT = CmdGet.Flag.Bool("t", false, "")
- getU upgradeFlag
- // -insecure is cfg.Insecure
+ getD = CmdGet.Flag.Bool("d", false, "")
+ getF = CmdGet.Flag.Bool("f", false, "")
+ getFix = CmdGet.Flag.Bool("fix", false, "")
+ getM = CmdGet.Flag.Bool("m", false, "")
+ getT = CmdGet.Flag.Bool("t", false, "")
+ getU upgradeFlag
+ getInsecure = CmdGet.Flag.Bool("insecure", false, "")
// -v is cfg.BuildV
)
@@ -261,7 +255,6 @@ func (v *upgradeFlag) String() string { return "" }
func init() {
work.AddBuildFlags(CmdGet, work.OmitModFlag)
CmdGet.Run = runGet // break init loop
- CmdGet.Flag.BoolVar(&cfg.Insecure, "insecure", cfg.Insecure, "")
CmdGet.Flag.Var(&getU, "u", "")
}
@@ -281,8 +274,8 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
if *getM {
base.Fatalf("go get: -m flag is no longer supported; consider -d to skip building packages")
}
- if cfg.Insecure {
- fmt.Fprintf(os.Stderr, "go get: -insecure flag is deprecated; see 'go help get' for details\n")
+ if *getInsecure {
+ base.Fatalf("go get: -insecure flag is no longer supported; use GOINSECURE instead")
}
load.ModResolveTests = *getT
@@ -307,7 +300,7 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
r.performWildcardQueries(ctx)
r.performPatternAllQueries(ctx)
- if changed := r.resolveCandidates(ctx, queries, nil); changed {
+ if changed := r.resolveQueries(ctx, queries); changed {
// 'go get' arguments can be (and often are) package patterns rather than
// (just) modules. A package can be provided by any module with a prefix
// of its import path, and a wildcard can even match packages in modules
@@ -344,12 +337,12 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
// - ambiguous import errors.
// TODO(#27899): Try to resolve ambiguous import errors automatically.
upgrades := r.findAndUpgradeImports(ctx, queries)
- if changed := r.resolveCandidates(ctx, nil, upgrades); changed {
+ if changed := r.applyUpgrades(ctx, upgrades); changed {
continue
}
r.findMissingWildcards(ctx)
- if changed := r.resolveCandidates(ctx, r.wildcardQueries, nil); changed {
+ if changed := r.resolveQueries(ctx, r.wildcardQueries); changed {
continue
}
@@ -380,10 +373,9 @@ func runGet(ctx context.Context, cmd *base.Command, args []string) {
pkgs := load.PackagesAndErrors(ctx, pkgPatterns)
load.CheckPackageErrors(pkgs)
work.InstallPackages(ctx, pkgPatterns, pkgs)
- // TODO(#40276): After Go 1.16, print a deprecation notice when building
- // and installing main packages. 'go install pkg' or
- // 'go install pkg@version' should be used instead.
- // Give the specific argument to use if possible.
+ // TODO(#40276): After Go 1.16, print a deprecation notice when building and
+ // installing main packages. 'go install pkg' or 'go install pkg@version'
+ // should be used instead. Give the specific argument to use if possible.
}
if !modload.HasModRoot() {
@@ -458,9 +450,8 @@ type resolver struct {
// that resolved the module to that version (the “reason”).
resolvedVersion map[string]versionReason
- buildList []module.Version
- buildListResolvedVersions int // len(resolvedVersion) when buildList was computed
- buildListVersion map[string]string // index of buildList (module path → version)
+ buildList []module.Version
+ buildListVersion map[string]string // index of buildList (module path → version)
initialVersion map[string]string // index of the initial build list at the start of 'go get'
@@ -1119,9 +1110,10 @@ func (r *resolver) findAndUpgradeImports(ctx context.Context, queries []*query)
// build list.
func (r *resolver) loadPackages(ctx context.Context, patterns []string, findPackage func(ctx context.Context, path string, m module.Version) (versionOk bool)) {
opts := modload.PackageOpts{
- Tags: imports.AnyTags(),
- LoadTests: *getT,
- SilenceErrors: true, // May be fixed by subsequent upgrades or downgrades.
+ Tags: imports.AnyTags(),
+ VendorModulesInGOROOTSrc: true,
+ LoadTests: *getT,
+ SilenceErrors: true, // May be fixed by subsequent upgrades or downgrades.
}
opts.AllowPackage = func(ctx context.Context, path string, m module.Version) error {
@@ -1174,24 +1166,19 @@ func (r *resolver) loadPackages(ctx context.Context, patterns []string, findPack
// to be updated before its dependencies can be loaded.
var errVersionChange = errors.New("version change needed")
-// resolveCandidates resolves candidates sets that are attached to the given
+// resolveQueries resolves candidate sets that are attached to the given
// queries and/or needed to provide the given missing-package dependencies.
//
-// resolveCandidates starts by resolving one module version from each
+// resolveQueries starts by resolving one module version from each
// unambiguous pathSet attached to the given queries.
//
// If no unambiguous query results in a change to the build list,
-// resolveCandidates modifies the build list by adding one module version from
-// each pathSet in missing, but does not mark those versions as resolved
-// (so they can still be modified by other queries).
-//
-// If that still does not result in any changes to the build list,
-// resolveCandidates revisits the ambiguous query candidates and resolves them
+// resolveQueries revisits the ambiguous query candidates and resolves them
// arbitrarily in order to guarantee forward progress.
//
// If all pathSets are resolved without any changes to the build list,
-// resolveCandidates returns with changed=false.
-func (r *resolver) resolveCandidates(ctx context.Context, queries []*query, upgrades []pathSet) (changed bool) {
+// resolveQueries returns with changed=false.
+func (r *resolver) resolveQueries(ctx context.Context, queries []*query) (changed bool) {
defer base.ExitIfErrors()
// Note: this is O(N²) with the number of pathSets in the worst case.
@@ -1245,12 +1232,52 @@ func (r *resolver) resolveCandidates(ctx context.Context, queries []*query, upgr
}
}
- if changed := r.updateBuildList(ctx, nil); changed {
- // The build list has changed, so disregard any missing packages: they might
- // now be determined by requirements in the build list, which we would
- // prefer to use instead of arbitrary "latest" versions.
- return true
+ if resolved > 0 {
+ if changed = r.updateBuildList(ctx, nil); changed {
+ // The build list has changed, so disregard any remaining ambiguous queries:
+ // they might now be determined by requirements in the build list, which we
+ // would prefer to use instead of arbitrary versions.
+ return true
+ }
+ }
+
+ // The build list will be the same on the next iteration as it was on this
+ // iteration, so any ambiguous queries will remain so. In order to make
+ // progress, resolve them arbitrarily but deterministically.
+ //
+ // If that results in conflicting versions, the user can re-run 'go get'
+ // with additional explicit versions for the conflicting packages or
+ // modules.
+ resolvedArbitrarily := 0
+ for _, q := range queries {
+ for _, cs := range q.candidates {
+ isPackage, m := r.chooseArbitrarily(cs)
+ if isPackage {
+ q.matchesPackages = true
+ }
+ r.resolve(q, m)
+ resolvedArbitrarily++
+ }
}
+ if resolvedArbitrarily > 0 {
+ changed = r.updateBuildList(ctx, nil)
+ }
+ return changed
+}
+
+// applyUpgrades disambiguates candidate sets that are needed to upgrade (or
+// provide) transitive dependencies imported by previously-resolved packages.
+//
+// applyUpgrades modifies the build list by adding one module version from each
+// pathSet in upgrades, then downgrading (or further upgrading) those modules as
+// needed to maintain any already-resolved versions of other modules.
+// applyUpgrades does not mark the new versions as resolved, so they can still
+// be further modified by other queries (such as wildcards).
+//
+// If all pathSets are resolved without any changes to the build list,
+// applyUpgrades returns with changed=false.
+func (r *resolver) applyUpgrades(ctx context.Context, upgrades []pathSet) (changed bool) {
+ defer base.ExitIfErrors()
// Arbitrarily add a "latest" version that provides each missing package, but
// do not mark the version as resolved: we still want to allow the explicit
@@ -1274,27 +1301,9 @@ func (r *resolver) resolveCandidates(ctx context.Context, queries []*query, upgr
tentative = append(tentative, m)
}
base.ExitIfErrors()
- if changed := r.updateBuildList(ctx, tentative); changed {
- return true
- }
- // The build list will be the same on the next iteration as it was on this
- // iteration, so any ambiguous queries will remain so. In order to make
- // progress, resolve them arbitrarily but deterministically.
- //
- // If that results in conflicting versions, the user can re-run 'go get'
- // with additional explicit versions for the conflicting packages or
- // modules.
- for _, q := range queries {
- for _, cs := range q.candidates {
- isPackage, m := r.chooseArbitrarily(cs)
- if isPackage {
- q.matchesPackages = true
- }
- r.resolve(q, m)
- }
- }
- return r.updateBuildList(ctx, nil)
+ changed = r.updateBuildList(ctx, tentative)
+ return changed
}
// disambiguate eliminates candidates from cs that conflict with other module
@@ -1441,9 +1450,10 @@ func (r *resolver) checkPackagesAndRetractions(ctx context.Context, pkgPatterns
// LoadPackages will print errors (since it has more context) but will not
// exit, since we need to load retractions later.
pkgOpts := modload.PackageOpts{
- LoadTests: *getT,
- ResolveMissingImports: false,
- AllowErrors: true,
+ VendorModulesInGOROOTSrc: true,
+ LoadTests: *getT,
+ ResolveMissingImports: false,
+ AllowErrors: true,
}
matches, pkgs := modload.LoadPackages(ctx, pkgOpts, pkgPatterns...)
for _, m := range matches {
@@ -1453,7 +1463,18 @@ func (r *resolver) checkPackagesAndRetractions(ctx context.Context, pkgPatterns
}
}
for _, pkg := range pkgs {
- if _, _, err := modload.Lookup("", false, pkg); err != nil {
+ if dir, _, err := modload.Lookup("", false, pkg); err != nil {
+ if dir != "" && errors.Is(err, imports.ErrNoGo) {
+ // Since dir is non-empty, we must have located source files
+ // associated with either the package or its test — ErrNoGo must
+ // indicate that none of those source files happen to apply in this
+ // configuration. If we are actually building the package (no -d
+ // flag), the compiler will report the problem; otherwise, assume that
+ // the user is going to build or test it in some other configuration
+ // and suppress the error.
+ continue
+ }
+
base.SetExitStatus(1)
if ambiguousErr := (*modload.AmbiguousImportError)(nil); errors.As(err, &ambiguousErr) {
for _, m := range ambiguousErr.Modules {
@@ -1501,7 +1522,7 @@ func (r *resolver) checkPackagesAndRetractions(ctx context.Context, pkgPatterns
}
}
if retractPath != "" {
- fmt.Fprintf(os.Stderr, "go: to switch to the latest unretracted version, run:\n\tgo get %s@latest", retractPath)
+ fmt.Fprintf(os.Stderr, "go: to switch to the latest unretracted version, run:\n\tgo get %s@latest\n", retractPath)
}
}
@@ -1601,11 +1622,10 @@ func (r *resolver) resolve(q *query, m module.Version) {
//
// If the additional modules conflict with the resolved versions, they will be
// downgraded to a non-conflicting version (possibly "none").
+//
+// If the resulting build list is the same as the one resulting from the last
+// call to updateBuildList, updateBuildList returns with changed=false.
func (r *resolver) updateBuildList(ctx context.Context, additions []module.Version) (changed bool) {
- if len(additions) == 0 && len(r.resolvedVersion) == r.buildListResolvedVersions {
- return false
- }
-
defer base.ExitIfErrors()
resolved := make([]module.Version, 0, len(r.resolvedVersion))
@@ -1636,7 +1656,6 @@ func (r *resolver) updateBuildList(ctx context.Context, additions []module.Versi
}
buildList := modload.LoadAllModules(ctx)
- r.buildListResolvedVersions = len(r.resolvedVersion)
if reflect.DeepEqual(r.buildList, buildList) {
return false
}
diff --git a/src/cmd/go/internal/modload/build.go b/src/cmd/go/internal/modload/build.go
index 8ad5f834de..5a151b4802 100644
--- a/src/cmd/go/internal/modload/build.go
+++ b/src/cmd/go/internal/modload/build.go
@@ -113,7 +113,11 @@ func addVersions(ctx context.Context, m *modinfo.ModulePublic, listRetracted boo
if listRetracted {
allowed = CheckExclusions
}
- m.Versions, _ = versions(ctx, m.Path, allowed)
+ var err error
+ m.Versions, err = versions(ctx, m.Path, allowed)
+ if err != nil && m.Error == nil {
+ m.Error = &modinfo.ModuleError{Err: err.Error()}
+ }
}
// addRetraction fills in m.Retracted if the module was retracted by its author.
diff --git a/src/cmd/go/internal/modload/help.go b/src/cmd/go/internal/modload/help.go
index 1cb58961be..fd39ddd94e 100644
--- a/src/cmd/go/internal/modload/help.go
+++ b/src/cmd/go/internal/modload/help.go
@@ -6,8 +6,6 @@ package modload
import "cmd/go/internal/base"
-// TODO(rsc): The "module code layout" section needs to be written.
-
var HelpModules = &base.Command{
UsageLine: "modules",
Short: "modules, module versions, and more",
@@ -22,6 +20,17 @@ For a series of tutorials on modules, see
https://golang.org/doc/tutorial/create-module.
For a detailed reference on modules, see https://golang.org/ref/mod.
+
+By default, the go command may download modules from https://proxy.golang.org.
+It may authenticate modules using the checksum database at
+https://sum.golang.org. Both services are operated by the Go team at Google.
+The privacy policies for these services are available at
+https://proxy.golang.org/privacy and https://sum.golang.org/privacy,
+respectively.
+
+The go command's download behavior may be configured using GOPROXY, GOSUMDB,
+GOPRIVATE, and other environment variables. See 'go help environment'
+and https://golang.org/ref/mod#private-module-privacy for more information.
`,
}
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index bc8d17e0a5..4de5ac9303 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -539,9 +539,10 @@ func fixVersion(ctx context.Context, fixed *bool) modfile.VersionFixer {
}
}
if vers != "" && module.CanonicalVersion(vers) == vers {
- if err := module.CheckPathMajor(vers, pathMajor); err == nil {
- return vers, nil
+ if err := module.CheckPathMajor(vers, pathMajor); err != nil {
+ return "", module.VersionError(module.Version{Path: path, Version: vers}, err)
}
+ return vers, nil
}
info, err := Query(ctx, path, vers, "", nil)
diff --git a/src/cmd/go/internal/modload/list.go b/src/cmd/go/internal/modload/list.go
index 3491f941cd..de16c2f786 100644
--- a/src/cmd/go/internal/modload/list.go
+++ b/src/cmd/go/internal/modload/list.go
@@ -136,17 +136,9 @@ func listModules(ctx context.Context, args []string, listVersions, listRetracted
if listVersions {
// Don't make the user provide an explicit '@latest' when they're
// explicitly asking what the available versions are.
- // Instead, resolve the module, even if it isn't an existing dependency.
- info, err := Query(ctx, arg, "latest", "", nil)
- if err == nil {
- mod := moduleInfo(ctx, module.Version{Path: arg, Version: info.Version}, false, listRetracted)
- mods = append(mods, mod)
- } else {
- mods = append(mods, &modinfo.ModulePublic{
- Path: arg,
- Error: modinfoError(arg, "", err),
- })
- }
+ // Instead, return a modinfo without a version,
+ // to which we can attach the requested version list.
+ mods = append(mods, &modinfo.ModulePublic{Path: arg})
continue
}
if cfg.BuildMod == "vendor" {
diff --git a/src/cmd/go/internal/modload/load.go b/src/cmd/go/internal/modload/load.go
index 6d87acc6d3..0dba49e40e 100644
--- a/src/cmd/go/internal/modload/load.go
+++ b/src/cmd/go/internal/modload/load.go
@@ -134,6 +134,11 @@ type PackageOpts struct {
// If nil, treated as equivalent to imports.Tags().
Tags map[string]bool
+ // VendorModulesInGOROOTSrc indicates that if we are within a module in
+ // GOROOT/src, packages in the module's vendor directory should be resolved as
+ // actual module dependencies (instead of standard-library packages).
+ VendorModulesInGOROOTSrc bool
+
// ResolveMissingImports indicates that we should attempt to add module
// dependencies as needed to resolve imports of packages that are not found.
//
@@ -1170,13 +1175,13 @@ func (ld *loader) stdVendor(parentPath, path string) string {
}
if str.HasPathPrefix(parentPath, "cmd") {
- if Target.Path != "cmd" {
+ if !ld.VendorModulesInGOROOTSrc || Target.Path != "cmd" {
vendorPath := pathpkg.Join("cmd", "vendor", path)
if _, err := os.Stat(filepath.Join(cfg.GOROOTsrc, filepath.FromSlash(vendorPath))); err == nil {
return vendorPath
}
}
- } else if Target.Path != "std" || str.HasPathPrefix(parentPath, "vendor") {
+ } else if !ld.VendorModulesInGOROOTSrc || Target.Path != "std" || str.HasPathPrefix(parentPath, "vendor") {
// If we are outside of the 'std' module, resolve imports from within 'std'
// to the vendor directory.
//
diff --git a/src/cmd/go/internal/modload/stat_openfile.go b/src/cmd/go/internal/modload/stat_openfile.go
index 5842b858f0..368f893198 100644
--- a/src/cmd/go/internal/modload/stat_openfile.go
+++ b/src/cmd/go/internal/modload/stat_openfile.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (js && wasm) || plan9
// +build js,wasm plan9
// On plan9, per http://9p.io/magic/man2html/2/access: “Since file permissions
diff --git a/src/cmd/go/internal/modload/stat_unix.go b/src/cmd/go/internal/modload/stat_unix.go
index f49278ec3a..e079d73990 100644
--- a/src/cmd/go/internal/modload/stat_unix.go
+++ b/src/cmd/go/internal/modload/stat_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package modload
diff --git a/src/cmd/go/internal/modload/stat_windows.go b/src/cmd/go/internal/modload/stat_windows.go
index 0ac2391347..825e60b27a 100644
--- a/src/cmd/go/internal/modload/stat_windows.go
+++ b/src/cmd/go/internal/modload/stat_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package modload
diff --git a/src/cmd/go/internal/mvs/mvs.go b/src/cmd/go/internal/mvs/mvs.go
index b630b610f1..e30a40c97e 100644
--- a/src/cmd/go/internal/mvs/mvs.go
+++ b/src/cmd/go/internal/mvs/mvs.go
@@ -41,6 +41,11 @@ type Reqs interface {
// Note that v1 < v2 can be written Max(v1, v2) != v1
// and similarly v1 <= v2 can be written Max(v1, v2) == v2.
Max(v1, v2 string) string
+}
+
+// An UpgradeReqs is a Reqs that can also identify available upgrades.
+type UpgradeReqs interface {
+ Reqs
// Upgrade returns the upgraded version of m,
// for use during an UpgradeAll operation.
@@ -54,6 +59,11 @@ type Reqs interface {
// TODO(rsc): Upgrade must be able to return errors,
// but should "no latest version" just return m instead?
Upgrade(m module.Version) (module.Version, error)
+}
+
+// A DowngradeReqs is a Reqs that can also identify available downgrades.
+type DowngradeReqs interface {
+ Reqs
// Previous returns the version of m.Path immediately prior to m.Version,
// or "none" if no such version is known.
@@ -293,10 +303,15 @@ func Req(target module.Version, base []string, reqs Reqs) ([]module.Version, err
}
// First walk the base modules that must be listed.
var min []module.Version
+ haveBase := map[string]bool{}
for _, path := range base {
+ if haveBase[path] {
+ continue
+ }
m := module.Version{Path: path, Version: max[path]}
min = append(min, m)
walk(m)
+ haveBase[path] = true
}
// Now the reverse postorder to bring in anything else.
for i := len(postorder) - 1; i >= 0; i-- {
@@ -318,7 +333,7 @@ func Req(target module.Version, base []string, reqs Reqs) ([]module.Version, err
// UpgradeAll returns a build list for the target module
// in which every module is upgraded to its latest version.
-func UpgradeAll(target module.Version, reqs Reqs) ([]module.Version, error) {
+func UpgradeAll(target module.Version, reqs UpgradeReqs) ([]module.Version, error) {
return buildList(target, reqs, func(m module.Version) (module.Version, error) {
if m.Path == target.Path {
return target, nil
@@ -330,7 +345,7 @@ func UpgradeAll(target module.Version, reqs Reqs) ([]module.Version, error) {
// Upgrade returns a build list for the target module
// in which the given additional modules are upgraded.
-func Upgrade(target module.Version, reqs Reqs, upgrade ...module.Version) ([]module.Version, error) {
+func Upgrade(target module.Version, reqs UpgradeReqs, upgrade ...module.Version) ([]module.Version, error) {
list, err := reqs.Required(target)
if err != nil {
return nil, err
@@ -369,11 +384,20 @@ func Upgrade(target module.Version, reqs Reqs, upgrade ...module.Version) ([]mod
// The versions to be downgraded may be unreachable from reqs.Latest and
// reqs.Previous, but the methods of reqs must otherwise handle such versions
// correctly.
-func Downgrade(target module.Version, reqs Reqs, downgrade ...module.Version) ([]module.Version, error) {
- list, err := reqs.Required(target)
+func Downgrade(target module.Version, reqs DowngradeReqs, downgrade ...module.Version) ([]module.Version, error) {
+ // Per https://research.swtch.com/vgo-mvs#algorithm_4:
+ // “To avoid an unnecessary downgrade to E 1.1, we must also add a new
+ // requirement on E 1.2. We can apply Algorithm R to find the minimal set of
+ // new requirements to write to go.mod.”
+ //
+ // In order to generate those new requirements, we need to identify versions
+ // for every module in the build list — not just reqs.Required(target).
+ list, err := BuildList(target, reqs)
if err != nil {
return nil, err
}
+ list = list[1:] // remove target
+
max := make(map[string]string)
for _, r := range list {
max[r.Path] = r.Version
@@ -406,6 +430,9 @@ func Downgrade(target module.Version, reqs Reqs, downgrade ...module.Version) ([
}
added[m] = true
if v, ok := max[m.Path]; ok && reqs.Max(m.Version, v) != v {
+ // m would upgrade an existing dependency — it is not a strict downgrade,
+ // and because it was already present as a dependency, it could affect the
+ // behavior of other relevant packages.
exclude(m)
return
}
@@ -422,6 +449,7 @@ func Downgrade(target module.Version, reqs Reqs, downgrade ...module.Version) ([
// is transient (we couldn't download go.mod), return the error from
// Downgrade. Currently, we can't tell what kind of error it is.
exclude(m)
+ return
}
for _, r := range list {
add(r)
@@ -433,8 +461,8 @@ func Downgrade(target module.Version, reqs Reqs, downgrade ...module.Version) ([
}
}
- var out []module.Version
- out = append(out, target)
+ downgraded := make([]module.Version, 0, len(list)+1)
+ downgraded = append(downgraded, target)
List:
for _, r := range list {
add(r)
@@ -461,10 +489,49 @@ List:
add(p)
r = p
}
- out = append(out, r)
+ downgraded = append(downgraded, r)
}
- return out, nil
+ // The downgrades we computed above only downgrade to versions enumerated by
+ // reqs.Previous. However, reqs.Previous omits some versions — such as
+ // pseudo-versions and retracted versions — that may be selected as transitive
+ // requirements of other modules.
+ //
+ // If one of those requirements pulls the version back up above the version
+ // identified by reqs.Previous, then the transitive dependencies of that that
+ // initially-downgraded version should no longer matter — in particular, we
+ // should not add new dependencies on module paths that nothing else in the
+ // updated module graph even requires.
+ //
+ // In order to eliminate those spurious dependencies, we recompute the build
+ // list with the actual versions of the downgraded modules as selected by MVS,
+ // instead of our initial downgrades.
+ // (See the downhiddenartifact and downhiddencross test cases).
+ actual, err := BuildList(target, &override{
+ target: target,
+ list: downgraded,
+ Reqs: reqs,
+ })
+ if err != nil {
+ return nil, err
+ }
+ actualVersion := make(map[string]string, len(actual))
+ for _, m := range actual {
+ actualVersion[m.Path] = m.Version
+ }
+
+ downgraded = downgraded[:0]
+ for _, m := range list {
+ if v, ok := actualVersion[m.Path]; ok {
+ downgraded = append(downgraded, module.Version{Path: m.Path, Version: v})
+ }
+ }
+
+ return BuildList(target, &override{
+ target: target,
+ list: downgraded,
+ Reqs: reqs,
+ })
}
type override struct {
diff --git a/src/cmd/go/internal/mvs/mvs_test.go b/src/cmd/go/internal/mvs/mvs_test.go
index 721cd9635c..598ed66688 100644
--- a/src/cmd/go/internal/mvs/mvs_test.go
+++ b/src/cmd/go/internal/mvs/mvs_test.go
@@ -28,10 +28,11 @@ D4: E2 F1
D5: E2
G1: C4
A2: B1 C4 D4
-build A: A B1 C2 D4 E2 F1
-upgrade* A: A B1 C4 D5 E2 F1 G1
-upgrade A C4: A B1 C4 D4 E2 F1 G1
-downgrade A2 D2: A2 C4 D2
+build A: A B1 C2 D4 E2 F1
+upgrade* A: A B1 C4 D5 E2 F1 G1
+upgrade A C4: A B1 C4 D4 E2 F1 G1
+build A2: A2 B1 C4 D4 E2 F1 G1
+downgrade A2 D2: A2 C4 D2 E2 F1 G1
name: trim
A: B1 C2
@@ -68,7 +69,7 @@ B2: D1
C: D2
D1: E2
D2: E1
-build A: A B1 C D2 E1
+build A: A B1 C D2 E1
upgrade A B2: A B2 C D2 E2
name: cross1R
@@ -136,17 +137,17 @@ name: cross5
A: D1
D1: E2
D2: E1
-build A: A D1 E2
-upgrade* A: A D2 E2
-upgrade A D2: A D2 E2
+build A: A D1 E2
+upgrade* A: A D2 E2
+upgrade A D2: A D2 E2
upgradereq A D2: D2 E2
name: cross6
A: D2
D1: E2
D2: E1
-build A: A D2 E1
-upgrade* A: A D2 E2
+build A: A D2 E1
+upgrade* A: A D2 E2
upgrade A E2: A D2 E2
name: cross7
@@ -175,7 +176,7 @@ B1: D1
B2:
C2:
D2:
-build A: A B1 C1 D1
+build A: A B1 C1 D1
upgrade* A: A B2 C2 D2
name: simplify
@@ -194,7 +195,7 @@ B4:
B5.hidden:
C2:
C3:
-build A: A B1 C1
+build A: A B1 C1
upgrade* A: A B4 C3
name: up2
@@ -206,15 +207,15 @@ B4:
B5.hidden:
C2:
C3:
-build A: A B5.hidden C1
+build A: A B5.hidden C1
upgrade* A: A B5.hidden C3
name: down1
A: B2
B1: C1
B2: C2
-build A: A B2 C2
-downgrade A C1: A B1
+build A: A B2 C2
+downgrade A C1: A B1 C1
name: down2
A: B2 E2
@@ -227,19 +228,113 @@ D2: B2
E2: D2
E1:
F1:
-downgrade A F1: A B1 E1
+build A: A B2 C2 D2 E2 F2
+downgrade A F1: A B1 C1 D1 E1 F1
+
+# https://research.swtch.com/vgo-mvs#algorithm_4:
+# “[D]owngrades are constrained to only downgrade packages, not also upgrade
+# them; if an upgrade before downgrade is needed, the user must ask for it
+# explicitly.”
+#
+# Here, downgrading B2 to B1 upgrades C1 to C2, and C2 does not depend on D2.
+# However, C2 would be an upgrade — not a downgrade — so B1 must also be
+# rejected.
+name: downcross1
+A: B2 C1
+B1: C2
+B2: C1
+C1: D2
+C2:
+D1:
+D2:
+build A: A B2 C1 D2
+downgrade A D1: A D1
+
+# https://research.swtch.com/vgo-mvs#algorithm_4:
+# “Unlike upgrades, downgrades must work by removing requirements, not adding
+# them.”
+#
+# However, downgrading a requirement may introduce a new requirement on a
+# previously-unrequired module. If each dependency's requirements are complete
+# (“tidy”), that can't change the behavior of any other package whose version is
+# not also being downgraded, so we should allow it.
+name: downcross2
+A: B2
+B1: C1
+B2: D2
+C1:
+D1:
+D2:
+build A: A B2 D2
+downgrade A D1: A B1 C1 D1
name: downcycle
A: A B2
B2: A
B1:
+build A: A B2
downgrade A B1: A B1
+# Both B3 and C2 require D2.
+# If we downgrade D to D1, then in isolation B3 would downgrade to B1,
+# because B2 is hidden — B1 is the next-highest version that is not hidden.
+# However, if we downgrade D, we will also downgrade C to C1.
+# And C1 requires B2.hidden, and B2.hidden also meets our requirements:
+# it is compatible with D1 and a strict downgrade from B3.
+#
+# Since neither the initial nor the final build list includes B1,
+# and the nothing in the final downgraded build list requires E at all,
+# no dependency on E1 (required by only B1) should be introduced.
+#
+name: downhiddenartifact
+A: B3 C2
+A1: B3
+B1: E1
+B2.hidden:
+B3: D2
+C1: B2.hidden
+C2: D2
+D1:
+D2:
+build A1: A1 B3 D2
+downgrade A1 D1: A1 B1 D1 E1
+build A: A B3 C2 D2
+downgrade A D1: A B2.hidden C1 D1
+
+# Both B3 and C3 require D2.
+# If we downgrade D to D1, then in isolation B3 would downgrade to B1,
+# and C3 would downgrade to C1.
+# But C1 requires B2.hidden, and B1 requires C2.hidden, so we can't
+# downgrade to either of those without pulling the other back up a little.
+#
+# B2.hidden and C2.hidden are both compatible with D1, so that still
+# meets our requirements — but then we're in an odd state in which
+# B and C have both been downgraded to hidden versions, without any
+# remaining requirements to explain how those hidden versions got there.
+#
+# TODO(bcmills): Would it be better to force downgrades to land on non-hidden
+# versions?
+# In this case, that would remove the dependencies on B and C entirely.
+#
+name: downhiddencross
+A: B3 C3
+B1: C2.hidden
+B2.hidden:
+B3: D2
+C1: B2.hidden
+C2.hidden:
+C3: D2
+D1:
+D2:
+build A: A B3 C3 D2
+downgrade A D1: A B2.hidden C2.hidden D1
+
# golang.org/issue/25542.
name: noprev1
A: B4 C2
B2.hidden:
C2:
+build A: A B4 C2
downgrade A B2.hidden: A B2.hidden C2
name: noprev2
@@ -247,6 +342,7 @@ A: B4 C2
B2.hidden:
B1:
C2:
+build A: A B4 C2
downgrade A B2.hidden: A B2.hidden C2
name: noprev3
@@ -254,6 +350,7 @@ A: B4 C2
B3:
B2.hidden:
C2:
+build A: A B4 C2
downgrade A B2.hidden: A B2.hidden C2
# Cycles involving the target.
@@ -264,9 +361,9 @@ A: B1
B1: A1
B2: A2
B3: A3
-build A: A B1
+build A: A B1
upgrade A B2: A B2
-upgrade* A: A B3
+upgrade* A: A B3
# golang.org/issue/29773:
# Requirements of older versions of the target
@@ -280,7 +377,7 @@ B2: A2
C1: A2
C2:
D2:
-build A: A B1 C1 D1
+build A: A B1 C1 D1
upgrade* A: A B2 C2 D2
# Cycles with multiple possible solutions.
@@ -293,23 +390,23 @@ B2: C2
C1:
C2: B2
build M: M A1 B2 C2
-req M: A1 B2
-req M A: A1 B2
-req M C: A1 C2
+req M: A1 B2
+req M A: A1 B2
+req M C: A1 C2
# Requirement minimization.
name: req1
A: B1 C1 D1 E1 F1
B1: C1 E1 F1
-req A: B1 D1
+req A: B1 D1
req A C: B1 C1 D1
name: req2
A: G1 H1
G1: H1
H1: G1
-req A: G1
+req A: G1
req A G: G1
req A H: H1
@@ -326,7 +423,20 @@ M: Anone B1 D1 E1
B1: Cnone D1
E1: Fnone
build M: M B1 D1 E1
-req M: B1 E1
+req M: B1 E1
+
+name: reqdup
+M: A1 B1
+A1: B1
+B1:
+req M A A: A1
+
+name: reqcross
+M: A1 B1 C1
+A1: B1 C1
+B1: C1
+C1:
+req M A B: A1 B1
`
func Test(t *testing.T) {
diff --git a/src/cmd/go/internal/renameio/renameio_test.go b/src/cmd/go/internal/renameio/renameio_test.go
index 5b2ed83624..dc3c1415db 100644
--- a/src/cmd/go/internal/renameio/renameio_test.go
+++ b/src/cmd/go/internal/renameio/renameio_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package renameio
diff --git a/src/cmd/go/internal/renameio/umask_test.go b/src/cmd/go/internal/renameio/umask_test.go
index 65e4fa587b..bed45af6ed 100644
--- a/src/cmd/go/internal/renameio/umask_test.go
+++ b/src/cmd/go/internal/renameio/umask_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9 && !windows && !js
// +build !plan9,!windows,!js
package renameio
diff --git a/src/cmd/go/internal/robustio/robustio_flaky.go b/src/cmd/go/internal/robustio/robustio_flaky.go
index 5bd44bd345..d5c241857b 100644
--- a/src/cmd/go/internal/robustio/robustio_flaky.go
+++ b/src/cmd/go/internal/robustio/robustio_flaky.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows || darwin
// +build windows darwin
package robustio
diff --git a/src/cmd/go/internal/robustio/robustio_other.go b/src/cmd/go/internal/robustio/robustio_other.go
index 6fe7b7e4e4..3a20cac6cf 100644
--- a/src/cmd/go/internal/robustio/robustio_other.go
+++ b/src/cmd/go/internal/robustio/robustio_other.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !darwin
// +build !windows,!darwin
package robustio
diff --git a/src/cmd/go/internal/search/search.go b/src/cmd/go/internal/search/search.go
index 18738cf59e..faf3a321dd 100644
--- a/src/cmd/go/internal/search/search.go
+++ b/src/cmd/go/internal/search/search.go
@@ -571,7 +571,6 @@ func IsRelativePath(pattern string) bool {
// If so, InDir returns an equivalent path relative to dir.
// If not, InDir returns an empty string.
// InDir makes some effort to succeed even in the presence of symbolic links.
-// TODO(rsc): Replace internal/test.inDir with a call to this function for Go 1.12.
func InDir(path, dir string) string {
if rel := inDirLex(path, dir); rel != "" {
return rel
diff --git a/src/cmd/go/internal/test/genflags.go b/src/cmd/go/internal/test/genflags.go
index 30334b0f30..9277de7fee 100644
--- a/src/cmd/go/internal/test/genflags.go
+++ b/src/cmd/go/internal/test/genflags.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 7fc9e8fbdc..ea9dfbe4e8 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -29,6 +29,7 @@ import (
"cmd/go/internal/cfg"
"cmd/go/internal/load"
"cmd/go/internal/lockedfile"
+ "cmd/go/internal/search"
"cmd/go/internal/str"
"cmd/go/internal/trace"
"cmd/go/internal/work"
@@ -1499,7 +1500,7 @@ func computeTestInputsID(a *work.Action, testlog []byte) (cache.ActionID, error)
if !filepath.IsAbs(name) {
name = filepath.Join(pwd, name)
}
- if a.Package.Root == "" || !inDir(name, a.Package.Root) {
+ if a.Package.Root == "" || search.InDir(name, a.Package.Root) == "" {
// Do not recheck files outside the module, GOPATH, or GOROOT root.
break
}
@@ -1508,7 +1509,7 @@ func computeTestInputsID(a *work.Action, testlog []byte) (cache.ActionID, error)
if !filepath.IsAbs(name) {
name = filepath.Join(pwd, name)
}
- if a.Package.Root == "" || !inDir(name, a.Package.Root) {
+ if a.Package.Root == "" || search.InDir(name, a.Package.Root) == "" {
// Do not recheck files outside the module, GOPATH, or GOROOT root.
break
}
@@ -1526,18 +1527,6 @@ func computeTestInputsID(a *work.Action, testlog []byte) (cache.ActionID, error)
return sum, nil
}
-func inDir(path, dir string) bool {
- if str.HasFilePathPrefix(path, dir) {
- return true
- }
- xpath, err1 := filepath.EvalSymlinks(path)
- xdir, err2 := filepath.EvalSymlinks(dir)
- if err1 == nil && err2 == nil && str.HasFilePathPrefix(xpath, xdir) {
- return true
- }
- return false
-}
-
func hashGetenv(name string) cache.ActionID {
h := cache.NewHash("getenv")
v, ok := os.LookupEnv(name)
diff --git a/src/cmd/go/internal/vet/vetflag.go b/src/cmd/go/internal/vet/vetflag.go
index 5bf5cf4446..b5b3c462ff 100644
--- a/src/cmd/go/internal/vet/vetflag.go
+++ b/src/cmd/go/internal/vet/vetflag.go
@@ -184,7 +184,8 @@ func exitWithUsage() {
if vetTool != "" {
cmd = vetTool
}
- fmt.Fprintf(os.Stderr, "Run '%s -help' for the vet tool's flags.\n", cmd)
+ fmt.Fprintf(os.Stderr, "Run '%s help' for a full list of flags and analyzers.\n", cmd)
+ fmt.Fprintf(os.Stderr, "Run '%s -help' for an overview.\n", cmd)
base.SetExitStatus(2)
base.Exit()
diff --git a/src/cmd/go/internal/web/bootstrap.go b/src/cmd/go/internal/web/bootstrap.go
index 781702100a..08686cdfcf 100644
--- a/src/cmd/go/internal/web/bootstrap.go
+++ b/src/cmd/go/internal/web/bootstrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cmd_go_bootstrap
// +build cmd_go_bootstrap
// This code is compiled only into the bootstrap 'go' binary.
diff --git a/src/cmd/go/internal/web/http.go b/src/cmd/go/internal/web/http.go
index 72fa2b2ca6..f177278eba 100644
--- a/src/cmd/go/internal/web/http.go
+++ b/src/cmd/go/internal/web/http.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !cmd_go_bootstrap
// +build !cmd_go_bootstrap
// This code is compiled into the real 'go' binary, but it is not
@@ -27,7 +28,7 @@ import (
"cmd/internal/browser"
)
-// impatientInsecureHTTPClient is used in -insecure mode,
+// impatientInsecureHTTPClient is used with GOINSECURE,
// when we're connecting to https servers that might not be there
// or might be using self-signed certificates.
var impatientInsecureHTTPClient = &http.Client{
diff --git a/src/cmd/go/internal/web/url_other.go b/src/cmd/go/internal/web/url_other.go
index 2641ee62bf..453af402b4 100644
--- a/src/cmd/go/internal/web/url_other.go
+++ b/src/cmd/go/internal/web/url_other.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package web
diff --git a/src/cmd/go/internal/web/url_other_test.go b/src/cmd/go/internal/web/url_other_test.go
index aa5663355e..4d6ed2ec7f 100644
--- a/src/cmd/go/internal/web/url_other_test.go
+++ b/src/cmd/go/internal/web/url_other_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package web
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
index 422e83c224..3980c5f898 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
@@ -1841,6 +1841,7 @@ var objectMagic = [][]byte{
{0xCE, 0xFA, 0xED, 0xFE}, // Mach-O little-endian 32-bit
{0xCF, 0xFA, 0xED, 0xFE}, // Mach-O little-endian 64-bit
{0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00}, // PE (Windows) as generated by 6l/8l and gcc
+ {0x4d, 0x5a, 0x78, 0x00, 0x01, 0x00}, // PE (Windows) as generated by llvm for dll
{0x00, 0x00, 0x01, 0xEB}, // Plan 9 i386
{0x00, 0x00, 0x8a, 0x97}, // Plan 9 amd64
{0x00, 0x00, 0x06, 0x47}, // Plan 9 arm
@@ -2598,9 +2599,19 @@ func (b *Builder) gccArchArgs() []string {
case "s390x":
return []string{"-m64", "-march=z196"}
case "mips64", "mips64le":
- return []string{"-mabi=64"}
+ args := []string{"-mabi=64"}
+ if cfg.GOMIPS64 == "hardfloat" {
+ return append(args, "-mhard-float")
+ } else if cfg.GOMIPS64 == "softfloat" {
+ return append(args, "-msoft-float")
+ }
case "mips", "mipsle":
- return []string{"-mabi=32", "-march=mips32"}
+ args := []string{"-mabi=32", "-march=mips32"}
+ if cfg.GOMIPS == "hardfloat" {
+ return append(args, "-mhard-float", "-mfp32", "-mno-odd-spreg")
+ } else if cfg.GOMIPS == "softfloat" {
+ return append(args, "-msoft-float")
+ }
case "ppc64":
if cfg.Goos == "aix" {
return []string{"-maix64"}
diff --git a/src/cmd/go/internal/work/testgo.go b/src/cmd/go/internal/work/testgo.go
index 931f49a069..8b77871b23 100644
--- a/src/cmd/go/internal/work/testgo.go
+++ b/src/cmd/go/internal/work/testgo.go
@@ -4,6 +4,7 @@
// This file contains extra hooks for testing the go command.
+//go:build testgo
// +build testgo
package work
diff --git a/src/cmd/go/testdata/mod/example.com_split-incompatible_subpkg_v0.1.0.txt b/src/cmd/go/testdata/mod/example.com_split-incompatible_subpkg_v0.1.0.txt
index 8f9e49176c..edf5d48788 100644
--- a/src/cmd/go/testdata/mod/example.com_split-incompatible_subpkg_v0.1.0.txt
+++ b/src/cmd/go/testdata/mod/example.com_split-incompatible_subpkg_v0.1.0.txt
@@ -1,6 +1,6 @@
Written by hand.
Test case for getting a package that has been moved to a nested module,
-with a +incompatible verison (and thus no go.mod file) at the root module.
+with a +incompatible version (and thus no go.mod file) at the root module.
-- .mod --
module example.com/split-incompatible/subpkg
diff --git a/src/cmd/go/testdata/script/build_overlay.txt b/src/cmd/go/testdata/script/build_overlay.txt
index b11cd96014..2932b94e6c 100644
--- a/src/cmd/go/testdata/script/build_overlay.txt
+++ b/src/cmd/go/testdata/script/build_overlay.txt
@@ -238,7 +238,7 @@ void say_hello();
void say_hello() { puts("hello cgo\n"); fflush(stdout); }
-- m/overlay/asm_gc.s --
-// +build !gccgo
+// +build gc
TEXT ·foo(SB),0,$0
RET
diff --git a/src/cmd/go/testdata/script/env_write.txt b/src/cmd/go/testdata/script/env_write.txt
index bda1e57826..4fa39df104 100644
--- a/src/cmd/go/testdata/script/env_write.txt
+++ b/src/cmd/go/testdata/script/env_write.txt
@@ -173,3 +173,9 @@ go env -w GOOS=linux GOARCH=mips
env GOOS=windows
! go env -u GOOS
stderr 'unsupported GOOS/GOARCH.*windows/mips$'
+
+# go env -w should reject relative paths in GOMODCACHE environment.
+! go env -w GOMODCACHE=~/test
+stderr 'go env -w: GOMODCACHE entry is relative; must be absolute path: "~/test"'
+! go env -w GOMODCACHE=./test
+stderr 'go env -w: GOMODCACHE entry is relative; must be absolute path: "./test"'
diff --git a/src/cmd/go/testdata/script/get_404_meta.txt b/src/cmd/go/testdata/script/get_404_meta.txt
index b71cc7fe01..ec4f8d3243 100644
--- a/src/cmd/go/testdata/script/get_404_meta.txt
+++ b/src/cmd/go/testdata/script/get_404_meta.txt
@@ -3,9 +3,10 @@
[!net] skip
[!exec:git] skip
+env GONOSUMDB=bazil.org,github.com,golang.org
env GO111MODULE=off
-go get -d -insecure bazil.org/fuse/fs/fstestutil
+go get -d bazil.org/fuse/fs/fstestutil
env GO111MODULE=on
env GOPROXY=direct
-go get -d -insecure bazil.org/fuse/fs/fstestutil
+go get -d bazil.org/fuse/fs/fstestutil
diff --git a/src/cmd/go/testdata/script/get_insecure.txt b/src/cmd/go/testdata/script/get_insecure.txt
index 36ad2c05b7..69930f7107 100644
--- a/src/cmd/go/testdata/script/get_insecure.txt
+++ b/src/cmd/go/testdata/script/get_insecure.txt
@@ -12,10 +12,12 @@ env GO111MODULE=off
# GOPATH: Try go get -d of HTTP-only repo (should fail).
! go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
-# GOPATH: Try again with -insecure (should succeed).
-go get -d -insecure insecure.go-get-issue-15410.appspot.com/pkg/p
+# GOPATH: Try again with GOINSECURE (should succeed).
+env GOINSECURE=insecure.go-get-issue-15410.appspot.com
+go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
-# GOPATH: Try updating without -insecure (should fail).
+# GOPATH: Try updating without GOINSECURE (should fail).
+env GOINSECURE=''
! go get -d -u -f insecure.go-get-issue-15410.appspot.com/pkg/p
# Modules: Set up
@@ -29,10 +31,14 @@ env GOPROXY=''
# Modules: Try go get -d of HTTP-only repo (should fail).
! go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
-# Modules: Try again with -insecure (should succeed).
-go get -d -insecure insecure.go-get-issue-15410.appspot.com/pkg/p
+# Modules: Try again with GOINSECURE (should succeed).
+env GOINSECURE=insecure.go-get-issue-15410.appspot.com
+env GONOSUMDB=insecure.go-get-issue-15410.appspot.com
+go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
-# Modules: Try updating without -insecure (should fail).
+# Modules: Try updating without GOINSECURE (should fail).
+env GOINSECURE=''
+env GONOSUMDB=''
! go get -d -u -f insecure.go-get-issue-15410.appspot.com/pkg/p
go list -m ...
@@ -48,4 +54,4 @@ func main() {
os.Exit(1)
}
-- module_file --
-module m \ No newline at end of file
+module m
diff --git a/src/cmd/go/testdata/script/get_insecure_custom_domain.txt b/src/cmd/go/testdata/script/get_insecure_custom_domain.txt
index a4a6fd428f..7eba42e873 100644
--- a/src/cmd/go/testdata/script/get_insecure_custom_domain.txt
+++ b/src/cmd/go/testdata/script/get_insecure_custom_domain.txt
@@ -3,4 +3,6 @@
env GO111MODULE=off
! go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
-go get -d -insecure insecure.go-get-issue-15410.appspot.com/pkg/p
+
+env GOINSECURE=insecure.go-get-issue-15410.appspot.com
+go get -d insecure.go-get-issue-15410.appspot.com/pkg/p
diff --git a/src/cmd/go/testdata/script/get_insecure_deprecated.txt b/src/cmd/go/testdata/script/get_insecure_deprecated.txt
deleted file mode 100644
index 7f5f5c7877..0000000000
--- a/src/cmd/go/testdata/script/get_insecure_deprecated.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# GOPATH: Set up
-env GO111MODULE=off
-
-# GOPATH: Fetch without insecure, no warning
-! go get test
-! stderr 'go get: -insecure flag is deprecated; see ''go help get'' for details'
-
-# GOPATH: Fetch with insecure, should warn
-! go get -insecure test
-stderr 'go get: -insecure flag is deprecated; see ''go help get'' for details'
-
-# Modules: Set up
-env GO111MODULE=on
-
-# Modules: Fetch without insecure, no warning
-! go get test
-! stderr 'go get: -insecure flag is deprecated; see ''go help get'' for details'
-
-# Modules: Fetch with insecure, should warn
-! go get -insecure test
-stderr 'go get: -insecure flag is deprecated; see ''go help get'' for details'
diff --git a/src/cmd/go/testdata/script/get_insecure_no_longer_supported.txt b/src/cmd/go/testdata/script/get_insecure_no_longer_supported.txt
new file mode 100644
index 0000000000..2517664dd0
--- /dev/null
+++ b/src/cmd/go/testdata/script/get_insecure_no_longer_supported.txt
@@ -0,0 +1,13 @@
+# GOPATH: Set up
+env GO111MODULE=off
+
+# GOPATH: Fetch with insecure, should error
+! go get -insecure test
+stderr 'go get: -insecure flag is no longer supported; use GOINSECURE instead'
+
+# Modules: Set up
+env GO111MODULE=on
+
+# Modules: Fetch with insecure, should error
+! go get -insecure test
+stderr 'go get: -insecure flag is no longer supported; use GOINSECURE instead'
diff --git a/src/cmd/go/testdata/script/get_insecure_redirect.txt b/src/cmd/go/testdata/script/get_insecure_redirect.txt
index 0478d1f75d..fb5f26951c 100644
--- a/src/cmd/go/testdata/script/get_insecure_redirect.txt
+++ b/src/cmd/go/testdata/script/get_insecure_redirect.txt
@@ -1,4 +1,4 @@
-# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure.
+# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure (now replaced by GOINSECURE).
# golang.org/issue/34049: 'go get' would panic in case of an insecure redirect in GOPATH mode
[!net] skip
@@ -9,4 +9,5 @@ env GO111MODULE=off
! go get -d vcs-test.golang.org/insecure/go/insecure
stderr 'redirected .* to insecure URL'
-go get -d -insecure vcs-test.golang.org/insecure/go/insecure
+env GOINSECURE=vcs-test.golang.org/insecure/go/insecure
+go get -d vcs-test.golang.org/insecure/go/insecure
diff --git a/src/cmd/go/testdata/script/get_insecure_update.txt b/src/cmd/go/testdata/script/get_insecure_update.txt
index 4511c98c56..e1a1a23d47 100644
--- a/src/cmd/go/testdata/script/get_insecure_update.txt
+++ b/src/cmd/go/testdata/script/get_insecure_update.txt
@@ -5,8 +5,10 @@ env GO111MODULE=off
# Clone the repo via HTTP manually.
exec git clone -q http://github.com/golang/example github.com/golang/example
-# Update without -insecure should fail.
-# Update with -insecure should succeed.
+# Update without GOINSECURE should fail.
# We need -f to ignore import comments.
! go get -d -u -f github.com/golang/example/hello
-go get -d -u -f -insecure github.com/golang/example/hello
+
+# Update with GOINSECURE should succeed.
+env GOINSECURE=github.com/golang/example/hello
+go get -d -u -f github.com/golang/example/hello
diff --git a/src/cmd/go/testdata/script/help.txt b/src/cmd/go/testdata/script/help.txt
index 9752ede2e3..26a0194be5 100644
--- a/src/cmd/go/testdata/script/help.txt
+++ b/src/cmd/go/testdata/script/help.txt
@@ -34,9 +34,10 @@ stderr 'Run ''go help mod'' for usage.'
# Earlier versions of Go printed the same as 'go -h' here.
# Also make sure we print the short help line.
! go vet -h
-stderr 'usage: go vet'
-stderr 'Run ''go help vet'' for details'
-stderr 'Run ''go tool vet -help'' for the vet tool''s flags'
+stderr 'usage: go vet .*'
+stderr 'Run ''go help vet'' for details.'
+stderr 'Run ''go tool vet help'' for a full list of flags and analyzers.'
+stderr 'Run ''go tool vet -help'' for an overview.'
# Earlier versions of Go printed a large document here, instead of these two
# lines.
diff --git a/src/cmd/go/testdata/script/list_std_stale.txt b/src/cmd/go/testdata/script/list_std_stale.txt
new file mode 100644
index 0000000000..e5c1f334fd
--- /dev/null
+++ b/src/cmd/go/testdata/script/list_std_stale.txt
@@ -0,0 +1,31 @@
+# https://golang.org/issue/44725: packages in std should not be reported as stale,
+# regardless of whether they are listed from within or outside GOROOT/src.
+
+# Control case: net should not be stale at the start of the test,
+# and should depend on vendor/golang.org/… instead of golang.org/….
+
+! stale net
+
+go list -deps net
+stdout '^vendor/golang.org/x/net'
+! stdout '^golang.org/x/net'
+
+# Net should also not be stale when viewed from within GOROOT/src,
+# and should still report the same package dependencies.
+
+cd $GOROOT/src
+! stale net
+
+go list -deps net
+stdout '^vendor/golang.org/x/net'
+! stdout '^golang.org/x/net'
+
+
+# However, 'go mod' and 'go get' subcommands should report the original module
+# dependencies, not the vendored packages.
+
+[!net] stop
+
+env GOPROXY=
+go mod why -m golang.org/x/net
+stdout '^# golang.org/x/net\nnet\ngolang.org/x/net'
diff --git a/src/cmd/go/testdata/script/mod_cache_dir.txt b/src/cmd/go/testdata/script/mod_cache_dir.txt
new file mode 100644
index 0000000000..7284ccf8ba
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_cache_dir.txt
@@ -0,0 +1,11 @@
+env GO111MODULE=on
+
+# Go should reject relative paths in GOMODCACHE environment.
+
+env GOMODCACHE="~/test"
+! go get example.com/tools/cmd/hello
+stderr 'must be absolute path'
+
+env GOMODCACHE="./test"
+! go get example.com/tools/cmd/hello
+stderr 'must be absolute path'
diff --git a/src/cmd/go/testdata/script/mod_edit.txt b/src/cmd/go/testdata/script/mod_edit.txt
index d7e681e831..9da69306da 100644
--- a/src/cmd/go/testdata/script/mod_edit.txt
+++ b/src/cmd/go/testdata/script/mod_edit.txt
@@ -16,9 +16,9 @@ cmpenv go.mod $WORK/go.mod.init
cmpenv go.mod $WORK/go.mod.init
# go mod edits
-go mod edit -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z' -retract=v1.6.0 -retract=[v1.1.0,v1.2.0] -retract=[v1.3.0,v1.4.0] -retract=v1.0.0
+go mod edit -droprequire=x.1 -require=x.1@v1.0.0 -require=x.2@v1.1.0 -droprequire=x.2 -exclude='x.1 @ v1.2.0' -exclude=x.1@v1.2.1 -exclude=x.1@v2.0.0+incompatible -replace=x.1@v1.3.0=y.1@v1.4.0 -replace='x.1@v1.4.0 = ../z' -retract=v1.6.0 -retract=[v1.1.0,v1.2.0] -retract=[v1.3.0,v1.4.0] -retract=v1.0.0
cmpenv go.mod $WORK/go.mod.edit1
-go mod edit -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0 -dropretract=v1.0.0 -dropretract=[v1.1.0,v1.2.0]
+go mod edit -droprequire=x.1 -dropexclude=x.1@v1.2.1 -dropexclude=x.1@v2.0.0+incompatible -dropreplace=x.1@v1.3.0 -require=x.3@v1.99.0 -dropretract=v1.0.0 -dropretract=[v1.1.0,v1.2.0]
cmpenv go.mod $WORK/go.mod.edit2
# -exclude and -retract reject invalid versions.
@@ -27,6 +27,17 @@ stderr '^go mod: -exclude=example.com/m@bad: version "bad" invalid: must be of t
! go mod edit -retract=bad
stderr '^go mod: -retract=bad: version "bad" invalid: must be of the form v1.2.3$'
+! go mod edit -exclude=example.com/m@v2.0.0
+stderr '^go mod: -exclude=example.com/m@v2\.0\.0: version "v2\.0\.0" invalid: should be v2\.0\.0\+incompatible \(or module example\.com/m/v2\)$'
+
+! go mod edit -exclude=example.com/m/v2@v1.0.0
+stderr '^go mod: -exclude=example.com/m/v2@v1\.0\.0: version "v1\.0\.0" invalid: should be v2, not v1$'
+
+! go mod edit -exclude=gopkg.in/example.v1@v2.0.0
+stderr '^go mod: -exclude=gopkg\.in/example\.v1@v2\.0\.0: version "v2\.0\.0" invalid: should be v1, not v2$'
+
+cmpenv go.mod $WORK/go.mod.edit2
+
# go mod edit -json
go mod edit -json
cmpenv stdout $WORK/go.mod.json
@@ -88,6 +99,7 @@ require x.1 v1.0.0
exclude (
x.1 v1.2.0
x.1 v1.2.1
+ x.1 v2.0.0+incompatible
)
replace (
diff --git a/src/cmd/go/testdata/script/mod_empty_err.txt b/src/cmd/go/testdata/script/mod_empty_err.txt
index 982e6b2e51..c4359bcccc 100644
--- a/src/cmd/go/testdata/script/mod_empty_err.txt
+++ b/src/cmd/go/testdata/script/mod_empty_err.txt
@@ -1,4 +1,4 @@
-# This test checks error messages for non-existant packages in module mode.
+# This test checks error messages for non-existent packages in module mode.
# Veries golang.org/issue/35414
env GO111MODULE=on
cd $WORK
diff --git a/src/cmd/go/testdata/script/mod_get_downadd_indirect.txt b/src/cmd/go/testdata/script/mod_get_downadd_indirect.txt
new file mode 100644
index 0000000000..efc38f77c8
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_downadd_indirect.txt
@@ -0,0 +1,81 @@
+# This test illustrates a case where downgrading one module may upgrade another.
+# Compare to the downcross2 test case in cmd/go/internal/mvs/mvs_test.go.
+
+# The initial package import graph used in this test looks like:
+#
+# a ---- b ---- d
+#
+# The module dependency graph originally looks like:
+#
+# a ---- b.2 ---- d.2
+#
+# b.1 ---- c.1
+#
+# If we downgrade module d to version 1, we must downgrade b as well.
+# If that downgrade selects b version 1, we will add a new dependency on module c.
+
+cp go.mod go.mod.orig
+go mod tidy
+cmp go.mod.orig go.mod
+
+go get -d example.com/d@v0.1.0
+go list -m all
+stdout '^example.com/b v0.1.0 '
+stdout '^example.com/c v0.1.0 '
+stdout '^example.com/d v0.1.0 '
+
+-- go.mod --
+module example.com/a
+
+go 1.15
+
+require example.com/b v0.2.0
+
+replace (
+ example.com/b v0.1.0 => ./b1
+ example.com/b v0.2.0 => ./b2
+ example.com/c v0.1.0 => ./c
+ example.com/d v0.1.0 => ./d
+ example.com/d v0.2.0 => ./d
+)
+-- a.go --
+package a
+
+import _ "example.com/b"
+
+-- b1/go.mod --
+module example.com/b
+
+go 1.15
+
+require example.com/c v0.1.0
+-- b1/b.go --
+package b
+
+import _ "example.com/c"
+
+-- b2/go.mod --
+module example.com/b
+
+go 1.15
+
+require example.com/d v0.2.0
+-- b2/b.go --
+package b
+
+import _ "example.com/d"
+
+-- c/go.mod --
+module example.com/c
+
+go 1.15
+
+-- c/c.go --
+package c
+
+-- d/go.mod --
+module example.com/d
+
+go 1.15
+-- d/d.go --
+package d
diff --git a/src/cmd/go/testdata/script/mod_get_downup_artifact.txt b/src/cmd/go/testdata/script/mod_get_downup_artifact.txt
new file mode 100644
index 0000000000..b35d4c4fd0
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_downup_artifact.txt
@@ -0,0 +1,165 @@
+# This test illustrates a case where an upgrade–downgrade–upgrade cycle can
+# result in upgrades of otherwise-irrelevant dependencies.
+#
+# This case has no corresponding test in the mvs package, because it is an
+# artifact that results from the composition of *multiple* MVS operations.
+
+# The initial package import graph used in the test looks like:
+#
+# m ---- a
+# | |
+# +----- b
+# | |
+# +----- c
+# |
+# +----- d
+#
+# b version 2 adds its own import of package d.
+#
+# The module dependency graph initially looks like:
+#
+# m ---- a.1
+# | |
+# +----- b.1
+# | |
+# +----- c.1
+# |
+# +----- d.1
+#
+# b.2 ---- c.2
+# |
+# +------ d.2
+# |
+# +------ e.1
+#
+# If we upgrade module b to version 2, we will upgrade c and d and add a new
+# dependency on e. If b version 2 is disallowed because of any of those
+# dependencies, the other dependencies should not be upgraded as a side-effect.
+
+cp go.mod go.mod.orig
+go mod tidy
+cmp go.mod go.mod.orig
+
+go list -m all
+stdout '^example.com/a v0.1.0 '
+stdout '^example.com/b v0.1.0 '
+stdout '^example.com/c v0.1.0 '
+stdout '^example.com/d v0.1.0 '
+! stdout '^example.com/e '
+
+# b is imported by a, so the -u flag would normally upgrade it to v0.2.0.
+# However, that would conflict with the explicit c@v0.1.0 constraint,
+# so b must remain at v0.1.0.
+#
+# If we're not careful, we might temporarily add b@v0.2.0 and pull in its
+# upgrades of module d and addition of module e, which are not relevant to
+# b@v0.1.0 and should not be added to the main module's dependencies.
+
+go get -u -d example.com/a@latest example.com/c@v0.1.0
+
+go list -m all
+stdout '^example.com/a v0.1.0 '
+stdout '^example.com/b v0.1.0 '
+stdout '^example.com/c v0.1.0 '
+
+ # BUG: d should remain at v0.1.0, because it is not transitively imported by a
+ # with b@v0.1.0. Today, it is spuriously upgraded to v0.2.0.
+stdout '^example.com/d v0.2.0 '
+
+ # BUG: e should not be added, because it is not transitively imported by a
+ # with b@v0.1.0. Today, it is spuriously added.
+stdout '^example.com/e v0.1.0 '
+
+-- go.mod --
+module example.com/m
+
+go 1.16
+
+require (
+ example.com/a v0.1.0
+ example.com/b v0.1.0
+ example.com/c v0.1.0
+ example.com/d v0.1.0
+)
+
+replace (
+ example.com/a v0.1.0 => ./a1
+ example.com/b v0.1.0 => ./b1
+ example.com/b v0.2.0 => ./b2
+ example.com/c v0.1.0 => ./c
+ example.com/c v0.2.0 => ./c
+ example.com/d v0.1.0 => ./d
+ example.com/d v0.2.0 => ./d
+ example.com/e v0.1.0 => ./e
+)
+-- m.go --
+package m
+
+import (
+ _ "example.com/a"
+ _ "example.com/b"
+ _ "example.com/c"
+ _ "example.com/d"
+)
+
+-- a1/go.mod --
+module example.com/a
+
+go 1.16
+
+require example.com/b v0.1.0
+-- a1/a.go --
+package a
+
+import _ "example.com/b"
+
+-- b1/go.mod --
+module example.com/b
+
+go 1.16
+
+require example.com/c v0.1.0
+-- b1/b.go --
+package b
+
+import _ "example.com/c"
+
+-- b2/go.mod --
+module example.com/b
+
+go 1.16
+
+require (
+ example.com/c v0.2.0
+ example.com/d v0.2.0
+ example.com/e v0.1.0
+)
+-- b2/b.go --
+package b
+
+import (
+ "example.com/c"
+ "example.com/d"
+ "example.com/e"
+)
+
+-- c/go.mod --
+module example.com/c
+
+go 1.16
+-- c/c.go --
+package c
+
+-- d/go.mod --
+module example.com/d
+
+go 1.16
+-- d/d.go --
+package d
+
+-- e/go.mod --
+module example.com/e
+
+go 1.16
+-- e/e.go --
+package e
diff --git a/src/cmd/go/testdata/script/mod_get_downup_indirect.txt b/src/cmd/go/testdata/script/mod_get_downup_indirect.txt
new file mode 100644
index 0000000000..ced1dcd6b1
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_downup_indirect.txt
@@ -0,0 +1,101 @@
+# This test illustrates a case where downgrading one module may upgrade another.
+# Compare to the downcross1 test case in cmd/go/internal/mvs/mvs_test.go.
+
+# The package import graph used in this test looks like:
+#
+# a ---- b
+# \ \
+# \ \
+# ----- c ---- d
+#
+# The module dependency graph originally looks like:
+#
+# a ---- b.2
+# \ \
+# \ \
+# ----- c.1 ---- d.2
+#
+# b.1 ---- c.2
+#
+# If we downgrade module d to version 1, we must downgrade b as well.
+# If that downgrade selects b version 1, we will upgrade module c to version 2.
+# So 'go get d@1' should instead downgrade both b and c to "none".
+
+cp go.mod go.mod.orig
+go mod tidy
+cmp go.mod.orig go.mod
+
+go get -d example.com/d@v0.1.0
+go list -m all
+! stdout '^example.com/b '
+! stdout '^example.com/c '
+stdout '^example.com/d v0.1.0 '
+
+-- go.mod --
+module example.com/a
+
+go 1.15
+
+require (
+ example.com/b v0.2.0
+ example.com/c v0.1.0
+)
+
+replace (
+ example.com/b v0.1.0 => ./b1
+ example.com/b v0.2.0 => ./b2
+ example.com/c v0.1.0 => ./c1
+ example.com/c v0.2.0 => ./c2
+ example.com/d v0.1.0 => ./d
+ example.com/d v0.2.0 => ./d
+)
+-- a.go --
+package a
+
+import (
+ _ "example.com/b"
+ _ "example.com/c"
+)
+
+-- b1/go.mod --
+module example.com/b
+
+go 1.15
+
+require example.com/c v0.2.0
+-- b1/b.go --
+package b
+
+import _ "example.com/c"
+
+-- b2/go.mod --
+module example.com/b
+
+go 1.15
+
+require example.com/c v0.1.0
+-- b2/b.go --
+package b
+
+import _ "example.com/c"
+
+-- c1/go.mod --
+module example.com/c
+
+go 1.15
+
+require example.com/d v0.2.0
+-- c1/c.go --
+package c
+
+-- c2/go.mod --
+module example.com/c
+
+go 1.15
+-- c2/c.go --
+package c
+
+-- d/go.mod --
+module example.com/d
+
+go 1.15
diff --git a/src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt b/src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt
new file mode 100644
index 0000000000..c49615cecb
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_downup_pseudo_artifact.txt
@@ -0,0 +1,129 @@
+# This test illustrates a case where an upgrade–downgrade–upgrade cycle could
+# add extraneous dependencies due to another module depending on an
+# otherwise-unlisted version (such as a pseudo-version).
+#
+# This case corresponds to the "downhiddenartifact" test in the mvs package.
+
+# The initial package import graph used in the test looks like:
+#
+# a --- b
+# \ \
+# \ \
+# c --- d
+#
+# The module dependency graph initially looks like:
+#
+# a --- b.3
+# \ \
+# \ \
+# c.2 --- d.2
+#
+# c.1 --- b.2 (pseudo)
+#
+# b.1 --- e.1
+
+cp go.mod go.mod.orig
+go mod tidy
+cmp go.mod.orig go.mod
+
+# When we downgrade d.2 to d.1, no dependency on e should be added
+# because nothing else in the module or import graph requires it.
+go get -d example.net/d@v0.1.0
+
+go list -m all
+stdout '^example.net/b v0.2.1-0.20210219000000-000000000000 '
+stdout '^example.net/c v0.1.0 '
+stdout '^example.net/d v0.1.0 '
+! stdout '^example.net/e '
+
+-- go.mod --
+module example.net/a
+
+go 1.16
+
+require (
+ example.net/b v0.3.0
+ example.net/c v0.2.0
+)
+
+replace (
+ example.net/b v0.1.0 => ./b1
+ example.net/b v0.2.1-0.20210219000000-000000000000 => ./b2
+ example.net/b v0.3.0 => ./b3
+ example.net/c v0.1.0 => ./c1
+ example.net/c v0.2.0 => ./c2
+ example.net/d v0.1.0 => ./d
+ example.net/d v0.2.0 => ./d
+ example.net/e v0.1.0 => ./e
+)
+-- a.go --
+package a
+
+import (
+ _ "example.net/b"
+ _ "example.net/c"
+)
+
+-- b1/go.mod --
+module example.net/b
+
+go 1.16
+
+require example.net/e v0.1.0
+-- b1/b.go --
+package b
+
+import _ "example.net/e"
+
+-- b2/go.mod --
+module example.net/b
+
+go 1.16
+-- b2/b.go --
+package b
+
+-- b3/go.mod --
+module example.net/b
+
+go 1.16
+
+require example.net/d v0.2.0
+-- b3/b.go --
+package b
+
+import _ "example.net/d"
+-- c1/go.mod --
+module example.net/c
+
+go 1.16
+
+require example.net/b v0.2.1-0.20210219000000-000000000000
+-- c1/c.go --
+package c
+
+import _ "example.net/b"
+
+-- c2/go.mod --
+module example.net/c
+
+go 1.16
+
+require example.net/d v0.2.0
+-- c2/c.go --
+package c
+
+import _ "example.net/d"
+
+-- d/go.mod --
+module example.net/d
+
+go 1.16
+-- d/d.go --
+package d
+
+-- e/go.mod --
+module example.net/e
+
+go 1.16
+-- e/e.go --
+package e
diff --git a/src/cmd/go/testdata/script/mod_get_insecure_redirect.txt b/src/cmd/go/testdata/script/mod_get_insecure_redirect.txt
index 3755f17633..2e12834495 100644
--- a/src/cmd/go/testdata/script/mod_get_insecure_redirect.txt
+++ b/src/cmd/go/testdata/script/mod_get_insecure_redirect.txt
@@ -1,4 +1,4 @@
-# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure.
+# golang.org/issue/29591: 'go get' was following plain-HTTP redirects even without -insecure (now replaced by GOINSECURE).
[!net] skip
[!exec:git] skip
@@ -10,8 +10,6 @@ env GOSUMDB=off
! go get -d vcs-test.golang.org/insecure/go/insecure
stderr 'redirected .* to insecure URL'
-go get -d -insecure vcs-test.golang.org/insecure/go/insecure
-
# insecure host
env GOINSECURE=vcs-test.golang.org
go clean -modcache
diff --git a/src/cmd/go/testdata/script/mod_get_pkgtags.txt b/src/cmd/go/testdata/script/mod_get_pkgtags.txt
new file mode 100644
index 0000000000..c0a57f3fab
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_get_pkgtags.txt
@@ -0,0 +1,116 @@
+# https://golang.org/issue/44106
+# 'go get' should fetch the transitive dependencies of packages regardless of
+# tags, but shouldn't error out if the package is missing tag-guarded
+# dependencies.
+
+# Control case: just adding the top-level module to the go.mod file does not
+# fetch its dependencies.
+
+go mod edit -require example.net/tools@v0.1.0
+! go list -deps example.net/cmd/tool
+stderr '^module example\.net/cmd provides package example\.net/cmd/tool and is replaced but not required; to add it:\n\tgo get example\.net/cmd@v0\.1\.0$'
+go mod edit -droprequire example.net/tools
+
+
+# 'go get -d' makes a best effort to fetch those dependencies, but shouldn't
+# error out if dependencies of tag-guarded files are missing.
+
+go get -d example.net/tools@v0.1.0
+
+! go list example.net/tools
+stderr '^package example.net/tools: build constraints exclude all Go files in .*[/\\]tools$'
+
+go list -tags=tools -e -deps example.net/tools
+stdout '^example.net/cmd/tool$'
+stdout '^example.net/missing$'
+
+go list -deps example.net/cmd/tool
+
+! go list example.net/missing
+stderr '^no required module provides package example.net/missing; to add it:\n\tgo get example.net/missing$'
+
+
+# https://golang.org/issue/29268
+# 'go get' should fetch modules whose roots contain test-only packages, but
+# without the -t flag shouldn't error out if the test has missing dependencies.
+
+go get -d example.net/testonly@v0.1.0
+
+# With the -t flag, the test dependencies must resolve successfully.
+! go get -d -t example.net/testonly@v0.1.0
+stderr '^example.net/testonly tested by\n\texample.net/testonly\.test imports\n\texample.net/missing: cannot find module providing package example.net/missing$'
+
+
+# 'go get -d' should succeed for a module path that does not contain a package,
+# but fail for a non-package subdirectory of a module.
+
+! go get -d example.net/missing/subdir@v0.1.0
+stderr '^go get: module example.net/missing@v0.1.0 found \(replaced by ./missing\), but does not contain package example.net/missing/subdir$'
+
+go get -d example.net/missing@v0.1.0
+
+
+# Getting the subdirectory should continue to fail even if the corresponding
+# module is already present in the build list.
+
+! go get -d example.net/missing/subdir@v0.1.0
+stderr '^go get: module example.net/missing@v0.1.0 found \(replaced by ./missing\), but does not contain package example.net/missing/subdir$'
+
+
+-- go.mod --
+module example.net/m
+
+go 1.15
+
+replace (
+ example.net/tools v0.1.0 => ./tools
+ example.net/cmd v0.1.0 => ./cmd
+ example.net/testonly v0.1.0 => ./testonly
+ example.net/missing v0.1.0 => ./missing
+)
+
+-- tools/go.mod --
+module example.net/tools
+
+go 1.15
+
+// Requirements intentionally omitted.
+
+-- tools/tools.go --
+// +build tools
+
+package tools
+
+import (
+ _ "example.net/cmd/tool"
+ _ "example.net/missing"
+)
+
+-- cmd/go.mod --
+module example.net/cmd
+
+go 1.16
+-- cmd/tool/tool.go --
+package main
+
+func main() {}
+
+-- testonly/go.mod --
+module example.net/testonly
+
+go 1.15
+-- testonly/testonly_test.go --
+package testonly_test
+
+import _ "example.net/missing"
+
+func Test(t *testing.T) {}
+
+-- missing/go.mod --
+module example.net/missing
+
+go 1.15
+-- missing/README.txt --
+There are no Go source files here.
+-- missing/subdir/README.txt --
+There are no Go source files here either.
diff --git a/src/cmd/go/testdata/script/mod_get_retract.txt b/src/cmd/go/testdata/script/mod_get_retract.txt
index fe0ac88629..560fa7bfb2 100644
--- a/src/cmd/go/testdata/script/mod_get_retract.txt
+++ b/src/cmd/go/testdata/script/mod_get_retract.txt
@@ -11,7 +11,7 @@ cp go.mod.orig go.mod
go mod edit -require example.com/retract/self/prev@v1.9.0
go get -d example.com/retract/self/prev
stderr '^go: warning: example.com/retract/self/prev@v1.9.0: retracted by module author: self$'
-stderr '^go: to switch to the latest unretracted version, run:\n\tgo get example.com/retract/self/prev@latest$'
+stderr '^go: to switch to the latest unretracted version, run:\n\tgo get example.com/retract/self/prev@latest\n$'
go list -m example.com/retract/self/prev
stdout '^example.com/retract/self/prev v1.9.0$'
diff --git a/src/cmd/go/testdata/script/mod_invalid_path.txt b/src/cmd/go/testdata/script/mod_invalid_path.txt
index 667828839f..c8c075daae 100644
--- a/src/cmd/go/testdata/script/mod_invalid_path.txt
+++ b/src/cmd/go/testdata/script/mod_invalid_path.txt
@@ -23,6 +23,20 @@ cd $WORK/gopath/src/badname
! go list .
stderr 'invalid module path'
+# Test that an import path containing an element with a leading dot is valid,
+# but such a module path is not.
+# Verifies #43985.
+cd $WORK/gopath/src/dotname
+go list ./.dot
+stdout '^example.com/dotname/.dot$'
+go list ./use
+stdout '^example.com/dotname/use$'
+! go list -m example.com/dotname/.dot@latest
+stderr '^go list -m: example.com/dotname/.dot@latest: malformed module path "example.com/dotname/.dot": leading dot in path element$'
+go get -d example.com/dotname/.dot
+go get -d example.com/dotname/use
+go mod tidy
+
-- mod/go.mod --
-- mod/foo.go --
@@ -38,3 +52,13 @@ module .\.
-- badname/foo.go --
package badname
+-- dotname/go.mod --
+module example.com/dotname
+
+go 1.16
+-- dotname/.dot/dot.go --
+package dot
+-- dotname/use/use.go --
+package use
+
+import _ "example.com/dotname/.dot"
diff --git a/src/cmd/go/testdata/script/mod_list_std.txt b/src/cmd/go/testdata/script/mod_list_std.txt
index baf7908ab9..f4e0433d8a 100644
--- a/src/cmd/go/testdata/script/mod_list_std.txt
+++ b/src/cmd/go/testdata/script/mod_list_std.txt
@@ -48,18 +48,20 @@ stdout ^vendor/golang.org/x/crypto/internal/subtle
! stdout ^golang\.org/x
# Within the std module, the dependencies of the non-vendored packages within
-# std should appear to come from modules, but they should be loaded from the
-# vendor directory (just like ordinary vendored module dependencies).
+# std should appear to be packages beginning with 'vendor/', not 'golang.org/…'
+# module dependencies.
go list all
-stdout ^golang.org/x/
+! stdout ^golang.org/x/
! stdout ^std/
! stdout ^cmd/
-! stdout ^vendor/
+stdout ^vendor/
go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' std
-! stdout ^vendor/golang.org/x/net/http2/hpack
-stdout ^golang.org/x/net/http2/hpack
+! stdout .
+
+# However, the 'golang.org/…' module dependencies should resolve to those same
+# directories.
go list -f '{{.Dir}}' golang.org/x/net/http2/hpack
stdout $GOROOT[/\\]src[/\\]vendor
diff --git a/src/cmd/go/testdata/script/mod_load_badchain.txt b/src/cmd/go/testdata/script/mod_load_badchain.txt
index c0c382bfa6..32d9fb24d1 100644
--- a/src/cmd/go/testdata/script/mod_load_badchain.txt
+++ b/src/cmd/go/testdata/script/mod_load_badchain.txt
@@ -74,8 +74,7 @@ go get: example.com/badchain/c@v1.0.0 updating to
module declares its path as: badchain.example.com/c
but was required as: example.com/badchain/c
-- update-a-expected --
-go get: example.com/badchain/a@v1.0.0 updating to
- example.com/badchain/a@v1.1.0 requires
+go get: example.com/badchain/a@v1.1.0 requires
example.com/badchain/b@v1.1.0 requires
example.com/badchain/c@v1.1.0: parsing go.mod:
module declares its path as: badchain.example.com/c
diff --git a/src/cmd/go/testdata/script/mod_outside.txt b/src/cmd/go/testdata/script/mod_outside.txt
index 8f01b5d242..7b45f1a209 100644
--- a/src/cmd/go/testdata/script/mod_outside.txt
+++ b/src/cmd/go/testdata/script/mod_outside.txt
@@ -200,7 +200,7 @@ stderr 'needmod[/\\]needmod.go:10:2: no required module provides package example
go install cmd/addr2line
! stderr .
-# 'go run' with a verison should fail due to syntax.
+# 'go run' with a version should fail due to syntax.
! go run example.com/printversion@v1.0.0
stderr 'can only use path@version syntax with'
diff --git a/src/cmd/go/testdata/script/mod_proxy_https.txt b/src/cmd/go/testdata/script/mod_proxy_https.txt
index a23090cd0a..a5e28dd0b9 100644
--- a/src/cmd/go/testdata/script/mod_proxy_https.txt
+++ b/src/cmd/go/testdata/script/mod_proxy_https.txt
@@ -10,6 +10,7 @@ stderr 'invalid proxy URL.*proxydir'
# GOPROXY HTTPS paths may elide the "https://" prefix.
# (See golang.org/issue/32191.)
env GOPROXY=proxy.golang.org
+env GOSUMDB=
go list -versions -m golang.org/x/text
-- go.mod --
diff --git a/src/cmd/go/testdata/script/mod_retract_fix_version.txt b/src/cmd/go/testdata/script/mod_retract_fix_version.txt
new file mode 100644
index 0000000000..e45758b627
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_retract_fix_version.txt
@@ -0,0 +1,48 @@
+# retract must not be used without a module directive.
+! go list -m all
+stderr 'go.mod:3: no module directive found, so retract cannot be used$'
+
+# Commands that update go.mod should fix non-canonical versions in
+# retract directives.
+# Verifies #44494.
+go mod edit -module=rsc.io/quote/v2
+! go list -m all
+stderr '^go: updates to go.mod needed; to update it:\n\tgo mod tidy$'
+go mod tidy
+go list -m all
+cmp go.mod go.mod.want
+
+# If a retracted version doesn't match the module's major version suffx,
+# an error should be reported.
+! go mod edit -retract=v3.0.1
+stderr '^go mod: -retract=v3.0.1: version "v3.0.1" invalid: should be v2, not v3$'
+cp go.mod.mismatch-v2 go.mod
+! go list -m all
+stderr 'go.mod:3: retract rsc.io/quote/v2: version "v3.0.1" invalid: should be v2, not v3$'
+
+cp go.mod.mismatch-v1 go.mod
+! go list -m all
+stderr 'go.mod:3: retract rsc.io/quote: version "v3.0.1" invalid: should be v0 or v1, not v3$'
+
+-- go.mod --
+go 1.16
+
+retract latest
+-- go.mod.want --
+go 1.16
+
+retract v2.0.1
+
+module rsc.io/quote/v2
+-- go.mod.mismatch-v2 --
+go 1.16
+
+retract v3.0.1
+
+module rsc.io/quote/v2
+-- go.mod.mismatch-v1 --
+go 1.16
+
+retract v3.0.1
+
+module rsc.io/quote
diff --git a/src/cmd/go/testdata/script/mod_retract_versions.txt b/src/cmd/go/testdata/script/mod_retract_versions.txt
new file mode 100644
index 0000000000..961a0a1fa3
--- /dev/null
+++ b/src/cmd/go/testdata/script/mod_retract_versions.txt
@@ -0,0 +1,17 @@
+# https://golang.org/issue/44296: the --versions flag should not affect
+# the version reported by 'go list' in case of retractions.
+
+env FMT='{{.Path}}{{with .Error}}: {{printf "%q" .Err}}{{end}} {{printf "%q" .Version}}{{with .Versions}} {{.}}{{end}}'
+
+go list -m -e -f $FMT example.com/retract/self/pseudo
+stdout '^example.com/retract/self/pseudo: "module example.com/retract/self/pseudo: not a known dependency" ""$'
+
+go list -m -e -f $FMT example.com/retract/self/pseudo@latest
+stdout '^example.com/retract/self/pseudo: "module example.com/retract/self/pseudo: no matching versions for query \\"latest\\"" "latest"$'
+
+
+go list -m -e -f $FMT --versions example.com/retract/self/pseudo
+stdout '^example.com/retract/self/pseudo ""$'
+
+go list -m -e -f $FMT --versions example.com/retract/self/pseudo@latest
+stdout '^example.com/retract/self/pseudo: "module example.com/retract/self/pseudo: no matching versions for query \\"latest\\"" "latest"$'
diff --git a/src/cmd/go/testdata/script/mod_std_vendor.txt b/src/cmd/go/testdata/script/mod_std_vendor.txt
index fb954d74ed..c3cde52953 100644
--- a/src/cmd/go/testdata/script/mod_std_vendor.txt
+++ b/src/cmd/go/testdata/script/mod_std_vendor.txt
@@ -36,11 +36,11 @@ stderr 'use of vendored package'
# When run within the 'std' module, 'go list -test' should report vendored
-# transitive dependencies at their original module paths.
+# transitive dependencies at their vendored paths.
cd $GOROOT/src
go list -test -f '{{range .Deps}}{{.}}{{"\n"}}{{end}}' net/http
-stdout ^golang.org/x/net/http2/hpack
-! stdout ^vendor/golang.org/x/net/http2/hpack
+! stdout ^golang.org/x/net/http2/hpack
+stdout ^vendor/golang.org/x/net/http2/hpack
-- go.mod --
module m
diff --git a/src/cmd/go/testdata/script/mod_sumdb_cache.txt b/src/cmd/go/testdata/script/mod_sumdb_cache.txt
index 2937b2e4dc..1b38475fb5 100644
--- a/src/cmd/go/testdata/script/mod_sumdb_cache.txt
+++ b/src/cmd/go/testdata/script/mod_sumdb_cache.txt
@@ -43,12 +43,5 @@ env GOPROXY=$proxy/sumdb-504
! go get -d rsc.io/quote@v1.5.2
stderr 504
-# but -insecure bypasses the checksum lookup entirely
-env GOINSECURE=
-go get -d -insecure rsc.io/quote@v1.5.2
-
-# and then it is in go.sum again
-go get -d rsc.io/quote@v1.5.2
-
-- go.mod.orig --
module m
diff --git a/src/cmd/go/testdata/script/test_chatty_parallel_fail.txt b/src/cmd/go/testdata/script/test_chatty_parallel_fail.txt
index 3f7360b659..3b2791cb89 100644
--- a/src/cmd/go/testdata/script/test_chatty_parallel_fail.txt
+++ b/src/cmd/go/testdata/script/test_chatty_parallel_fail.txt
@@ -14,7 +14,7 @@ stdout -count=1 '{"Time":"[0-9TZ:.+-]{20,40}","Action":"output","Package":"comma
stdout -count=1 '{"Time":"[0-9TZ:.+-]{20,40}","Action":"output","Package":"command-line-arguments","Test":"TestChattyParallel/sub-2","Output":"=== CONT TestChattyParallel/sub-2\\n"}\n{"Time":"[0-9TZ:.+-]{20,40}","Action":"output","Package":"command-line-arguments","Test":"TestChattyParallel/sub-2","Output":" chatty_parallel_test.go:38: error from sub-2\\n"}'
-- chatty_parallel_test.go --
-package chatty_paralell_test
+package chatty_parallel_test
import (
"testing"
diff --git a/src/cmd/go/testdata/script/test_chatty_parallel_success.txt b/src/cmd/go/testdata/script/test_chatty_parallel_success.txt
index 4a86d74f19..58b5ab7267 100644
--- a/src/cmd/go/testdata/script/test_chatty_parallel_success.txt
+++ b/src/cmd/go/testdata/script/test_chatty_parallel_success.txt
@@ -13,7 +13,7 @@ stdout -count=2 '{"Time":"[0-9TZ:.+-]{20,40}","Action":"output","Package":"comma
stdout -count=2 '{"Time":"[0-9TZ:.+-]{20,40}","Action":"output","Package":"command-line-arguments","Test":"TestChattyParallel/sub-2","Output":"=== CONT TestChattyParallel/sub-2\\n"}\n{"Time":"[0-9TZ:.+-]{20,40}","Action":"output","Package":"command-line-arguments","Test":"TestChattyParallel/sub-2","Output":" chatty_parallel_test.go:32: this is sub-2\\n"}'
-- chatty_parallel_test.go --
-package chatty_paralell_test
+package chatty_parallel_test
import (
"testing"
diff --git a/src/cmd/go/testdata/script/test_chatty_parallel_success_sleepy.txt b/src/cmd/go/testdata/script/test_chatty_parallel_success_sleepy.txt
index 5952a87bea..e651a7ed24 100644
--- a/src/cmd/go/testdata/script/test_chatty_parallel_success_sleepy.txt
+++ b/src/cmd/go/testdata/script/test_chatty_parallel_success_sleepy.txt
@@ -5,7 +5,7 @@ go test -parallel 3 chatty_parallel_test.go -v
stdout '--- PASS: TestFast \([0-9.]{4}s\)\n=== CONT TestSlow\n chatty_parallel_test.go:31: this is the second TestSlow log\n--- PASS: TestSlow \([0-9.]{4}s\)'
-- chatty_parallel_test.go --
-package chatty_paralell_test
+package chatty_parallel_test
import (
"testing"
diff --git a/src/cmd/go2go/testdata/go2path/src/chans/chans_test.go2 b/src/cmd/go2go/testdata/go2path/src/chans/chans_test.go2
index 8bafbc9e98..7410f51692 100644
--- a/src/cmd/go2go/testdata/go2path/src/chans/chans_test.go2
+++ b/src/cmd/go2go/testdata/go2path/src/chans/chans_test.go2
@@ -72,7 +72,7 @@ func TestFilter(t *testing.T) {
}
func TestSink(t *testing.T) {
- c := Sink(int)(context.Background())
+ c := Sink[int](context.Background())
after := time.NewTimer(time.Minute)
defer after.Stop()
send := func(v int) {
@@ -141,7 +141,7 @@ func TestExclusiveTry(t *testing.T) {
}
func TestRanger(t *testing.T) {
- s, r := Ranger(int)()
+ s, r := Ranger[int]()
ctx := context.Background()
go func() {
diff --git a/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2 b/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2
index a7bb15742f..74801998f6 100644
--- a/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2
+++ b/src/cmd/go2go/testdata/go2path/src/gsort/gsort_test.go2
@@ -86,7 +86,7 @@ func TestSortSliceFn(t *testing.T) {
c := make([][]int, len(slicesToSort))
copy(c, slicesToSort)
SliceFn(c, sorter)
- if !slices.EqualFn(c, sortedSlices, func(a, b []int) bool { return slices.Equal(int)(a, b) }) {
+ if !slices.EqualFn(c, sortedSlices, func(a, b []int) bool { return slices.Equal[int](a, b) }) {
t.Errorf("got %v, want %v", c, sortedSlices)
}
}
diff --git a/src/cmd/go2go/testdata/go2path/src/list/list_test.go2 b/src/cmd/go2go/testdata/go2path/src/list/list_test.go2
index 0671c76848..7e48364896 100644
--- a/src/cmd/go2go/testdata/go2path/src/list/list_test.go2
+++ b/src/cmd/go2go/testdata/go2path/src/list/list_test.go2
@@ -64,7 +64,7 @@ func checkListPointers[TElem any](t *testing.T, l *List[TElem], es []*Element[TE
}
func TestList(t *testing.T) {
- l := New(string)()
+ l := New[string]()
checkListPointers(t, l, []*(Element[string]){})
// Single element list
diff --git a/src/cmd/go2go/testdata/go2path/src/maps/maps_test.go2 b/src/cmd/go2go/testdata/go2path/src/maps/maps_test.go2
index 5a3aa4438d..7ee965fce5 100644
--- a/src/cmd/go2go/testdata/go2path/src/maps/maps_test.go2
+++ b/src/cmd/go2go/testdata/go2path/src/maps/maps_test.go2
@@ -57,7 +57,7 @@ func TestEqual(t *testing.T) {
if Equal(nil, m1) {
t.Errorf("Equal(nil, %v) = true, want false", m1)
}
- if !Equal(int, int)(nil, nil) {
+ if !Equal[int, int](nil, nil) {
t.Error("Equal(nil, nil) = false, want true")
}
if ms := map[int]int{1: 2}; Equal(m1, ms) {
diff --git a/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2 b/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2
index e1ea5dc5dd..5293b0e445 100644
--- a/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2
+++ b/src/cmd/go2go/testdata/go2path/src/orderedmap/orderedmap.go2
@@ -99,7 +99,7 @@ type keyValue[K, V any] struct {
// iterate returns an iterator that traverses the map.
func (m *Map[K, V]) Iterate() *Iterator[K, V] {
- sender, receiver := chans.Ranger(keyValue[K, V])()
+ sender, receiver := chans.Ranger[keyValue[K, V]]()
var f func(*node[K, V]) bool
f = func(n *node[K, V]) bool {
if n == nil {
diff --git a/src/cmd/go2go/testdata/go2path/src/slices/slices.go2 b/src/cmd/go2go/testdata/go2path/src/slices/slices.go2
index 990ad43f63..cc3cb0c7d2 100644
--- a/src/cmd/go2go/testdata/go2path/src/slices/slices.go2
+++ b/src/cmd/go2go/testdata/go2path/src/slices/slices.go2
@@ -81,7 +81,7 @@ func Max[Elem constraints.Ordered](s []Elem) Elem {
var zero Elem
return zero
}
- return Reduce(s[1:], s[0], alg.Max(Elem))
+ return Reduce(s[1:], s[0], alg.Max[Elem])
}
// Min returns the minimum element in a slice of some ordered type.
@@ -91,7 +91,7 @@ func Min[Elem constraints.Ordered](s []Elem) Elem {
var zero Elem
return zero
}
- return Reduce(s[1:], s[0], alg.Min(Elem))
+ return Reduce(s[1:], s[0], alg.Min[Elem])
}
// Append adds values to the end of a slice, returning a new slice.
diff --git a/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2 b/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2
index c90474a8b2..745f8fff5b 100644
--- a/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2
+++ b/src/cmd/go2go/testdata/go2path/src/slices/slices_test.go2
@@ -49,10 +49,10 @@ func offByOne[Elem constraints.Integer](a, b Elem) bool {
func TestEqualFn(t *testing.T) {
s1 := []int{1, 2, 3}
s2 := []int{2, 3, 4}
- if EqualFn(s1, s1, offByOne(int)) {
+ if EqualFn(s1, s1, offByOne[int]) {
t.Errorf("EqualFn(%v, %v, offByOne) = true, want false", s1, s1)
}
- if !EqualFn(s1, s2, offByOne(int)) {
+ if !EqualFn(s1, s2, offByOne[int]) {
t.Errorf("EqualFn(%v, %v, offByOne) = false, want true", s1, s2)
}
@@ -62,7 +62,7 @@ func TestEqualFn(t *testing.T) {
t.Errorf("EqualFn(%v, %v, strings.EqualFold) = false, want true", s3, s4)
}
- if !EqualFn(s1[:0], nil, offByOne(int)) {
+ if !EqualFn(s1[:0], nil, offByOne[int]) {
t.Errorf("EqualFn(%v, nil, offByOne) = false, want true", s1[:0])
}
}
diff --git a/src/cmd/gofmt/doc.go b/src/cmd/gofmt/doc.go
index e340665594..68476e7d44 100644
--- a/src/cmd/gofmt/doc.go
+++ b/src/cmd/gofmt/doc.go
@@ -26,6 +26,9 @@ The flags are:
Do not print reformatted sources to standard output.
If a file's formatting is different from gofmt's, print its name
to standard output.
+ -G
+ Allow generic code, using type parameters.
+ See golang.org/issues/43651 for more information.
-r rule
Apply the rewrite rule to the source before reformatting.
-s
diff --git a/src/cmd/gofmt/gofmt.go b/src/cmd/gofmt/gofmt.go
index a43cda1986..da5a04d291 100644
--- a/src/cmd/gofmt/gofmt.go
+++ b/src/cmd/gofmt/gofmt.go
@@ -33,6 +33,10 @@ var (
doDiff = flag.Bool("d", false, "display diffs instead of rewriting files")
allErrors = flag.Bool("e", false, "report all errors (not just the first 10 on different lines)")
+ // allowTypeParams controls whether type parameters are allowed in the code
+ // being formatted. It is enabled for go1.18 in gofmt_go1.18.go.
+ allowTypeParams = false
+
// debugging
cpuprofile = flag.String("cpuprofile", "", "write cpu profile to this file")
)
@@ -47,6 +51,10 @@ const (
//
// This value is defined in go/printer specifically for go/format and cmd/gofmt.
printerNormalizeNumbers = 1 << 30
+
+ // parseTypeParams tells go/parser to parse type parameters. Must be kept in
+ // sync with go/parser/interface.go.
+ parseTypeParams parser.Mode = 1 << 30
)
var (
@@ -68,10 +76,13 @@ func usage() {
func initParserMode() {
// Keep this in sync with go/format/format.go.
- parserMode = parser.ParseComments | parser.ParseTypeParams
+ parserMode = parser.ParseComments
if *allErrors {
parserMode |= parser.AllErrors
}
+ if allowTypeParams {
+ parserMode |= parseTypeParams
+ }
}
func isGoFile(f fs.DirEntry) bool {
diff --git a/src/cmd/gofmt/gofmt_go1.18.go b/src/cmd/gofmt/gofmt_go1.18.go
new file mode 100644
index 0000000000..be7b46b5ed
--- /dev/null
+++ b/src/cmd/gofmt/gofmt_go1.18.go
@@ -0,0 +1,12 @@
+// Copyright 2021 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.
+
+//go:build go1.18
+// +build go1.18
+
+package main
+
+func init() {
+ allowTypeParams = true
+}
diff --git a/src/cmd/gofmt/gofmt_go2go.go b/src/cmd/gofmt/gofmt_go2go.go
new file mode 100644
index 0000000000..06a141f1ed
--- /dev/null
+++ b/src/cmd/gofmt/gofmt_go2go.go
@@ -0,0 +1,10 @@
+// Copyright 2021 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.
+
+package main
+
+func init() {
+ // Type parameters are allowed on the go2go branch.
+ allowTypeParams = true
+}
diff --git a/src/cmd/gofmt/gofmt_test.go b/src/cmd/gofmt/gofmt_test.go
index bf2adfe64c..9e2239a692 100644
--- a/src/cmd/gofmt/gofmt_test.go
+++ b/src/cmd/gofmt/gofmt_test.go
@@ -77,6 +77,9 @@ func runTest(t *testing.T, in, out string) {
case "-stdin":
// fake flag - pretend input is from stdin
stdin = true
+ case "-G":
+ // fake flag - allow parsing type parameters
+ allowTypeParams = true
default:
t.Errorf("unrecognized flag name: %s", name)
}
diff --git a/src/cmd/gofmt/testdata/typeparams.golden b/src/cmd/gofmt/testdata/typeparams.golden
new file mode 100644
index 0000000000..35f08d1379
--- /dev/null
+++ b/src/cmd/gofmt/testdata/typeparams.golden
@@ -0,0 +1,35 @@
+// Copyright 2020 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.
+
+//gofmt -G
+
+package typeparams
+
+type T[P any] struct{}
+type T[P1, P2, P3 any] struct{}
+
+type T[P C] struct{}
+type T[P1, P2, P3 C] struct{}
+
+type T[P C[P]] struct{}
+type T[P1, P2, P3 C[P1, P2, P3]] struct{}
+
+func f[P any](x P)
+func f[P1, P2, P3 any](x1 P1, x2 P2, x3 P3) struct{}
+
+func f[P interface{}](x P)
+func f[P1, P2, P3 interface {
+ m1(P1)
+ type P2, P3
+}](x1 P1, x2 P2, x3 P3) struct{}
+func f[P any](T1[P], T2[P]) T3[P]
+
+func (x T[P]) m()
+func (T[P]) m(x T[P]) P
+
+func _() {
+ type _ []T[P]
+ var _ []T[P]
+ _ = []T[P]{}
+}
diff --git a/src/cmd/gofmt/testdata/typeparams.input b/src/cmd/gofmt/testdata/typeparams.input
new file mode 100644
index 0000000000..7f3212c8e4
--- /dev/null
+++ b/src/cmd/gofmt/testdata/typeparams.input
@@ -0,0 +1,32 @@
+// Copyright 2020 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.
+
+//gofmt -G
+
+package typeparams
+
+type T[ P any] struct{}
+type T[P1, P2, P3 any] struct{}
+
+type T[P C] struct{}
+type T[P1,P2, P3 C] struct{}
+
+type T[P C[P]] struct{}
+type T[P1, P2, P3 C[P1,P2,P3]] struct{}
+
+func f[P any](x P)
+func f[P1, P2, P3 any](x1 P1, x2 P2, x3 P3) struct{}
+
+func f[P interface{}](x P)
+func f[P1, P2, P3 interface{ m1(P1); type P2, P3 }](x1 P1, x2 P2, x3 P3) struct{}
+func f[P any](T1[P], T2[P]) T3[P]
+
+func (x T[P]) m()
+func ((T[P])) m(x T[P]) P
+
+func _() {
+ type _ []T[P]
+ var _ []T[P]
+ _ = []T[P]{}
+}
diff --git a/src/cmd/internal/archive/archive_test.go b/src/cmd/internal/archive/archive_test.go
index cb4eb842b4..c284a9cf0d 100644
--- a/src/cmd/internal/archive/archive_test.go
+++ b/src/cmd/internal/archive/archive_test.go
@@ -173,7 +173,7 @@ func TestParseGoobj(t *testing.T) {
continue
}
if e.Type != EntryGoObj {
- t.Errorf("wrong type of object: wnat EntryGoObj, got %v", e.Type)
+ t.Errorf("wrong type of object: want EntryGoObj, got %v", e.Type)
}
if !bytes.Contains(e.Obj.TextHeader, []byte(runtime.GOARCH)) {
t.Errorf("text header does not contain GOARCH %s: %q", runtime.GOARCH, e.Obj.TextHeader)
@@ -204,7 +204,7 @@ func TestParseArchive(t *testing.T) {
continue
}
if e.Type != EntryGoObj {
- t.Errorf("wrong type of object: wnat EntryGoObj, got %v", e.Type)
+ t.Errorf("wrong type of object: want EntryGoObj, got %v", e.Type)
}
if !bytes.Contains(e.Obj.TextHeader, []byte(runtime.GOARCH)) {
t.Errorf("text header does not contain GOARCH %s: %q", runtime.GOARCH, e.Obj.TextHeader)
diff --git a/src/cmd/internal/bio/buf_mmap.go b/src/cmd/internal/bio/buf_mmap.go
index 4b43d74f26..b9755c7e50 100644
--- a/src/cmd/internal/bio/buf_mmap.go
+++ b/src/cmd/internal/bio/buf_mmap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package bio
diff --git a/src/cmd/internal/bio/buf_nommap.go b/src/cmd/internal/bio/buf_nommap.go
index f43c67ac2d..533a93180c 100644
--- a/src/cmd/internal/bio/buf_nommap.go
+++ b/src/cmd/internal/bio/buf_nommap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd
// +build !darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd
package bio
diff --git a/src/cmd/internal/diff/diff.go b/src/cmd/internal/diff/diff.go
index c0ca2f3106..0ec2d7f8f9 100644
--- a/src/cmd/internal/diff/diff.go
+++ b/src/cmd/internal/diff/diff.go
@@ -7,6 +7,7 @@
package diff
import (
+ "bytes"
exec "internal/execabs"
"io/ioutil"
"os"
@@ -38,6 +39,25 @@ func Diff(prefix string, b1, b2 []byte) ([]byte, error) {
// Ignore that failure as long as we get output.
err = nil
}
+
+ // If we are on Windows and the diff is Cygwin diff,
+ // machines can get into a state where every Cygwin
+ // command works fine but prints a useless message like:
+ //
+ // Cygwin WARNING:
+ // Couldn't compute FAST_CWD pointer. This typically occurs if you're using
+ // an older Cygwin version on a newer Windows. Please update to the latest
+ // available Cygwin version from https://cygwin.com/. If the problem persists,
+ // please see https://cygwin.com/problems.html
+ //
+ // Skip over that message and just return the actual diff.
+ if len(data) > 0 && !bytes.HasPrefix(data, []byte("--- ")) {
+ i := bytes.Index(data, []byte("\n--- "))
+ if i >= 0 && i < 80*10 && bytes.Contains(data[:i], []byte("://cygwin.com/")) {
+ data = data[i+1:]
+ }
+ }
+
return data, err
}
diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go
index 8de4096f06..70d792fec6 100644
--- a/src/cmd/internal/dwarf/dwarf.go
+++ b/src/cmd/internal/dwarf/dwarf.go
@@ -318,8 +318,6 @@ const (
)
// Index into the abbrevs table below.
-// Keep in sync with ispubname() and ispubtype() in ld/dwarf.go.
-// ispubtype considers >= NULLTYPE public
const (
DW_ABRV_NULL = iota
DW_ABRV_COMPUNIT
@@ -1257,7 +1255,7 @@ func PutAbstractFunc(ctxt Context, s *FnState) error {
// its corresponding 'abstract' DIE (containing location-independent
// attributes such as name, type, etc). Inlined subroutine DIEs can
// have other inlined subroutine DIEs as children.
-func PutInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error {
+func putInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error {
ic := s.InlCalls.Calls[callIdx]
callee := ic.AbsFunSym
@@ -1268,7 +1266,7 @@ func PutInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error
Uleb128put(ctxt, s.Info, int64(abbrev))
if logDwarf {
- ctxt.Logf("PutInlinedFunc(caller=%v,callee=%v,abbrev=%d)\n", callersym, callee, abbrev)
+ ctxt.Logf("putInlinedFunc(caller=%v,callee=%v,abbrev=%d)\n", callersym, callee, abbrev)
}
// Abstract origin.
@@ -1304,7 +1302,7 @@ func PutInlinedFunc(ctxt Context, s *FnState, callersym Sym, callIdx int) error
// Children of this inline.
for _, sib := range inlChildren(callIdx, &s.InlCalls) {
absfn := s.InlCalls.Calls[sib].AbsFunSym
- err := PutInlinedFunc(ctxt, s, absfn, sib)
+ err := putInlinedFunc(ctxt, s, absfn, sib)
if err != nil {
return err
}
@@ -1346,7 +1344,7 @@ func PutConcreteFunc(ctxt Context, s *FnState) error {
// Inlined subroutines.
for _, sib := range inlChildren(-1, &s.InlCalls) {
absfn := s.InlCalls.Calls[sib].AbsFunSym
- err := PutInlinedFunc(ctxt, s, absfn, sib)
+ err := putInlinedFunc(ctxt, s, absfn, sib)
if err != nil {
return err
}
@@ -1394,7 +1392,7 @@ func PutDefaultFunc(ctxt Context, s *FnState) error {
// Inlined subroutines.
for _, sib := range inlChildren(-1, &s.InlCalls) {
absfn := s.InlCalls.Calls[sib].AbsFunSym
- err := PutInlinedFunc(ctxt, s, absfn, sib)
+ err := putInlinedFunc(ctxt, s, absfn, sib)
if err != nil {
return err
}
@@ -1600,14 +1598,6 @@ func putvar(ctxt Context, s *FnState, v *Var, absfn Sym, fnabbrev, inlIndex int,
// Var has no children => no terminator
}
-// VarsByOffset attaches the methods of sort.Interface to []*Var,
-// sorting in increasing StackOffset.
-type VarsByOffset []*Var
-
-func (s VarsByOffset) Len() int { return len(s) }
-func (s VarsByOffset) Less(i, j int) bool { return s[i].StackOffset < s[j].StackOffset }
-func (s VarsByOffset) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-
// byChildIndex implements sort.Interface for []*dwarf.Var by child index.
type byChildIndex []*Var
diff --git a/src/cmd/internal/goobj/funcinfo.go b/src/cmd/internal/goobj/funcinfo.go
index 2cca8f6c4e..6d33a10a51 100644
--- a/src/cmd/internal/goobj/funcinfo.go
+++ b/src/cmd/internal/goobj/funcinfo.go
@@ -19,9 +19,10 @@ type CUFileIndex uint32
//
// TODO: make each pcdata a separate symbol?
type FuncInfo struct {
- Args uint32
- Locals uint32
- FuncID objabi.FuncID
+ Args uint32
+ Locals uint32
+ FuncID objabi.FuncID
+ FuncFlag objabi.FuncFlag
Pcsp SymRef
Pcfile SymRef
@@ -35,6 +36,9 @@ type FuncInfo struct {
}
func (a *FuncInfo) Write(w *bytes.Buffer) {
+ writeUint8 := func(x uint8) {
+ w.WriteByte(x)
+ }
var b [4]byte
writeUint32 := func(x uint32) {
binary.LittleEndian.PutUint32(b[:], x)
@@ -47,8 +51,10 @@ func (a *FuncInfo) Write(w *bytes.Buffer) {
writeUint32(a.Args)
writeUint32(a.Locals)
- writeUint32(uint32(a.FuncID))
-
+ writeUint8(uint8(a.FuncID))
+ writeUint8(uint8(a.FuncFlag))
+ writeUint8(0) // pad to uint32 boundary
+ writeUint8(0)
writeSymRef(a.Pcsp)
writeSymRef(a.Pcfile)
writeSymRef(a.Pcline)
@@ -72,46 +78,6 @@ func (a *FuncInfo) Write(w *bytes.Buffer) {
}
}
-func (a *FuncInfo) Read(b []byte) {
- readUint32 := func() uint32 {
- x := binary.LittleEndian.Uint32(b)
- b = b[4:]
- return x
- }
- readSymIdx := func() SymRef {
- return SymRef{readUint32(), readUint32()}
- }
-
- a.Args = readUint32()
- a.Locals = readUint32()
- a.FuncID = objabi.FuncID(readUint32())
-
- a.Pcsp = readSymIdx()
- a.Pcfile = readSymIdx()
- a.Pcline = readSymIdx()
- a.Pcinline = readSymIdx()
- a.Pcdata = make([]SymRef, readUint32())
- for i := range a.Pcdata {
- a.Pcdata[i] = readSymIdx()
- }
-
- funcdataofflen := readUint32()
- a.Funcdataoff = make([]uint32, funcdataofflen)
- for i := range a.Funcdataoff {
- a.Funcdataoff[i] = readUint32()
- }
- filelen := readUint32()
- a.File = make([]CUFileIndex, filelen)
- for i := range a.File {
- a.File[i] = CUFileIndex(readUint32())
- }
- inltreelen := readUint32()
- a.InlTree = make([]InlTreeNode, inltreelen)
- for i := range a.InlTree {
- b = a.InlTree[i].Read(b)
- }
-}
-
// FuncInfoLengths is a cache containing a roadmap of offsets and
// lengths for things within a serialized FuncInfo. Each length field
// stores the number of items (e.g. files, inltree nodes, etc), and the
@@ -159,7 +125,9 @@ func (*FuncInfo) ReadArgs(b []byte) uint32 { return binary.LittleEndian.Uint32(b
func (*FuncInfo) ReadLocals(b []byte) uint32 { return binary.LittleEndian.Uint32(b[4:]) }
-func (*FuncInfo) ReadFuncID(b []byte) uint32 { return binary.LittleEndian.Uint32(b[8:]) }
+func (*FuncInfo) ReadFuncID(b []byte) objabi.FuncID { return objabi.FuncID(b[8]) }
+
+func (*FuncInfo) ReadFuncFlag(b []byte) objabi.FuncFlag { return objabi.FuncFlag(b[9]) }
func (*FuncInfo) ReadPcsp(b []byte) SymRef {
return SymRef{binary.LittleEndian.Uint32(b[12:]), binary.LittleEndian.Uint32(b[16:])}
diff --git a/src/cmd/internal/goobj/mkbuiltin.go b/src/cmd/internal/goobj/mkbuiltin.go
index 22608e7e69..4e46970648 100644
--- a/src/cmd/internal/goobj/mkbuiltin.go
+++ b/src/cmd/internal/goobj/mkbuiltin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generate builtinlist.go from cmd/compile/internal/gc/builtin/runtime.go.
diff --git a/src/cmd/internal/goobj/objfile.go b/src/cmd/internal/goobj/objfile.go
index e6447e455d..247cc695f0 100644
--- a/src/cmd/internal/goobj/objfile.go
+++ b/src/cmd/internal/goobj/objfile.go
@@ -298,7 +298,6 @@ const (
SymFlagNoSplit
SymFlagReflectMethod
SymFlagGoType
- SymFlagTopFrame
)
// Sym.Flag2
@@ -332,7 +331,6 @@ func (s *Sym) Leaf() bool { return s.Flag()&SymFlagLeaf != 0 }
func (s *Sym) NoSplit() bool { return s.Flag()&SymFlagNoSplit != 0 }
func (s *Sym) ReflectMethod() bool { return s.Flag()&SymFlagReflectMethod != 0 }
func (s *Sym) IsGoType() bool { return s.Flag()&SymFlagGoType != 0 }
-func (s *Sym) TopFrame() bool { return s.Flag()&SymFlagTopFrame != 0 }
func (s *Sym) UsedInIface() bool { return s.Flag2()&SymFlagUsedInIface != 0 }
func (s *Sym) IsItab() bool { return s.Flag2()&SymFlagItab != 0 }
@@ -483,7 +481,7 @@ func (r *RefFlags) SetFlag2(x uint8) { r[9] = x }
func (r *RefFlags) Write(w *Writer) { w.Bytes(r[:]) }
-// Used to construct an artifically large array type when reading an
+// Used to construct an artificially large array type when reading an
// item from the object file relocs section or aux sym section (needs
// to work on 32-bit as well as 64-bit). See issue 41621.
const huge = (1<<31 - 1) / RelocSize
diff --git a/src/cmd/internal/goobj/objfile_test.go b/src/cmd/internal/goobj/objfile_test.go
index c6fd427c15..99d02a1bf1 100644
--- a/src/cmd/internal/goobj/objfile_test.go
+++ b/src/cmd/internal/goobj/objfile_test.go
@@ -9,6 +9,11 @@ import (
"bytes"
"cmd/internal/bio"
"cmd/internal/objabi"
+ "fmt"
+ "internal/testenv"
+ "io/ioutil"
+ "os"
+ "os/exec"
"testing"
)
@@ -69,3 +74,60 @@ func TestReadWrite(t *testing.T) {
t.Errorf("read Aux2 mismatch: got %v %v", a2.Type(), a2.Sym())
}
}
+
+var issue41621prolog = `
+package main
+var lines = []string{
+`
+
+var issue41621epilog = `
+}
+func getLines() []string {
+ return lines
+}
+func main() {
+ println(getLines())
+}
+`
+
+func TestIssue41621LargeNumberOfRelocations(t *testing.T) {
+ if testing.Short() || (objabi.GOARCH != "amd64") {
+ t.Skipf("Skipping large number of relocations test in short mode or on %s", objabi.GOARCH)
+ }
+ testenv.MustHaveGoBuild(t)
+
+ tmpdir, err := ioutil.TempDir("", "lotsofrelocs")
+ if err != nil {
+ t.Fatalf("can't create temp directory: %v\n", err)
+ }
+ defer os.RemoveAll(tmpdir)
+
+ // Emit testcase.
+ var w bytes.Buffer
+ fmt.Fprintf(&w, issue41621prolog)
+ for i := 0; i < 1048576+13; i++ {
+ fmt.Fprintf(&w, "\t\"%d\",\n", i)
+ }
+ fmt.Fprintf(&w, issue41621epilog)
+ err = ioutil.WriteFile(tmpdir+"/large.go", w.Bytes(), 0666)
+ if err != nil {
+ t.Fatalf("can't write output: %v\n", err)
+ }
+
+ // Emit go.mod
+ w.Reset()
+ fmt.Fprintf(&w, "module issue41621\n\ngo 1.12\n")
+ err = ioutil.WriteFile(tmpdir+"/go.mod", w.Bytes(), 0666)
+ if err != nil {
+ t.Fatalf("can't write output: %v\n", err)
+ }
+ w.Reset()
+
+ // Build.
+ cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", "large")
+ cmd.Dir = tmpdir
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Fatalf("Build failed: %v, output: %s", err, out)
+ }
+}
diff --git a/src/cmd/internal/obj/arm/obj5.go b/src/cmd/internal/obj/arm/obj5.go
index 29d3a5867d..7de04302d9 100644
--- a/src/cmd/internal/obj/arm/obj5.go
+++ b/src/cmd/internal/obj/arm/obj5.go
@@ -34,6 +34,7 @@ import (
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/sys"
+ "log"
)
var progedit_tlsfallback *obj.LSym
@@ -613,6 +614,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.From.Reg = REGSP
}
}
+
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
+ f := c.cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
+ }
+ }
}
}
diff --git a/src/cmd/internal/obj/arm64/a.out.go b/src/cmd/internal/obj/arm64/a.out.go
index 1d1bea505c..7ab9c1475f 100644
--- a/src/cmd/internal/obj/arm64/a.out.go
+++ b/src/cmd/internal/obj/arm64/a.out.go
@@ -239,7 +239,7 @@ const (
REGCTXT = REG_R26 // environment for closures
REGTMP = REG_R27 // reserved for liblink
REGG = REG_R28 // G
- REGFP = REG_R29 // frame pointer, unused in the Go toolchain
+ REGFP = REG_R29 // frame pointer
REGLINK = REG_R30
// ARM64 uses R31 as both stack pointer and zero register,
diff --git a/src/cmd/internal/obj/arm64/obj7.go b/src/cmd/internal/obj/arm64/obj7.go
index 0baf51973a..8f7648e5d5 100644
--- a/src/cmd/internal/obj/arm64/obj7.go
+++ b/src/cmd/internal/obj/arm64/obj7.go
@@ -35,6 +35,7 @@ import (
"cmd/internal/objabi"
"cmd/internal/src"
"cmd/internal/sys"
+ "log"
"math"
)
@@ -621,25 +622,24 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
prologueEnd.Pos = prologueEnd.Pos.WithXlogue(src.PosPrologueEnd)
- if objabi.Framepointer_enabled {
- q1 = obj.Appendp(q1, c.newprog)
- q1.Pos = p.Pos
- q1.As = AMOVD
- q1.From.Type = obj.TYPE_REG
- q1.From.Reg = REGFP
- q1.To.Type = obj.TYPE_MEM
- q1.To.Reg = REGSP
- q1.To.Offset = -8
-
- q1 = obj.Appendp(q1, c.newprog)
- q1.Pos = p.Pos
- q1.As = ASUB
- q1.From.Type = obj.TYPE_CONST
- q1.From.Offset = 8
- q1.Reg = REGSP
- q1.To.Type = obj.TYPE_REG
- q1.To.Reg = REGFP
- }
+ // Frame pointer.
+ q1 = obj.Appendp(q1, c.newprog)
+ q1.Pos = p.Pos
+ q1.As = AMOVD
+ q1.From.Type = obj.TYPE_REG
+ q1.From.Reg = REGFP
+ q1.To.Type = obj.TYPE_MEM
+ q1.To.Reg = REGSP
+ q1.To.Offset = -8
+
+ q1 = obj.Appendp(q1, c.newprog)
+ q1.Pos = p.Pos
+ q1.As = ASUB
+ q1.From.Type = obj.TYPE_CONST
+ q1.From.Offset = 8
+ q1.Reg = REGSP
+ q1.To.Type = obj.TYPE_REG
+ q1.To.Reg = REGFP
if c.cursym.Func().Text.From.Sym.Wrapper() {
// if(g->panic != nil && g->panic->argp == FP) g->panic->argp = bottom-of-frame
@@ -764,28 +764,26 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.To.Reg = REGSP
p.Spadj = -c.autosize
- if objabi.Framepointer_enabled {
- p = obj.Appendp(p, c.newprog)
- p.As = ASUB
- p.From.Type = obj.TYPE_CONST
- p.From.Offset = 8
- p.Reg = REGSP
- p.To.Type = obj.TYPE_REG
- p.To.Reg = REGFP
- }
+ // Frame pointer.
+ p = obj.Appendp(p, c.newprog)
+ p.As = ASUB
+ p.From.Type = obj.TYPE_CONST
+ p.From.Offset = 8
+ p.Reg = REGSP
+ p.To.Type = obj.TYPE_REG
+ p.To.Reg = REGFP
}
} else {
/* want write-back pre-indexed SP+autosize -> SP, loading REGLINK*/
- if objabi.Framepointer_enabled {
- p.As = AMOVD
- p.From.Type = obj.TYPE_MEM
- p.From.Reg = REGSP
- p.From.Offset = -8
- p.To.Type = obj.TYPE_REG
- p.To.Reg = REGFP
- p = obj.Appendp(p, c.newprog)
- }
+ // Frame pointer.
+ p.As = AMOVD
+ p.From.Type = obj.TYPE_MEM
+ p.From.Reg = REGSP
+ p.From.Offset = -8
+ p.To.Type = obj.TYPE_REG
+ p.To.Reg = REGFP
+ p = obj.Appendp(p, c.newprog)
aoffset := c.autosize
@@ -820,6 +818,28 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
}
}
+ // If enabled, this code emits 'MOV PC, R27' before every 'MOV LR, PC',
+ // so that if you are debugging a low-level crash where PC and LR are zero,
+ // you can look at R27 to see what jumped to the zero.
+ // This is useful when bringing up Go on a new system.
+ // (There is similar code in ../ppc64/obj9.go:/if.false.)
+ const debugRETZERO = false
+ if debugRETZERO {
+ if p.As != obj.ARET {
+ q = newprog()
+ q.Pos = p.Pos
+ q.Link = p.Link
+ p.Link = q
+ p = q
+ }
+ p.As = AADR
+ p.From.Type = obj.TYPE_BRANCH
+ p.From.Offset = 0
+ p.To.Type = obj.TYPE_REG
+ p.To.Reg = REGTMP
+
+ }
+
if p.As != obj.ARET {
q = newprog()
q.Pos = p.Pos
@@ -865,109 +885,120 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
}
case obj.ADUFFCOPY:
- if objabi.Framepointer_enabled {
- // ADR ret_addr, R27
- // STP (FP, R27), -24(SP)
- // SUB 24, SP, FP
- // DUFFCOPY
- // ret_addr:
- // SUB 8, SP, FP
-
- q1 := p
- // copy DUFFCOPY from q1 to q4
- q4 := obj.Appendp(p, c.newprog)
- q4.Pos = p.Pos
- q4.As = obj.ADUFFCOPY
- q4.To = p.To
-
- q1.As = AADR
- q1.From.Type = obj.TYPE_BRANCH
- q1.To.Type = obj.TYPE_REG
- q1.To.Reg = REG_R27
-
- q2 := obj.Appendp(q1, c.newprog)
- q2.Pos = p.Pos
- q2.As = ASTP
- q2.From.Type = obj.TYPE_REGREG
- q2.From.Reg = REGFP
- q2.From.Offset = int64(REG_R27)
- q2.To.Type = obj.TYPE_MEM
- q2.To.Reg = REGSP
- q2.To.Offset = -24
-
- // maintaine FP for DUFFCOPY
- q3 := obj.Appendp(q2, c.newprog)
- q3.Pos = p.Pos
- q3.As = ASUB
- q3.From.Type = obj.TYPE_CONST
- q3.From.Offset = 24
- q3.Reg = REGSP
- q3.To.Type = obj.TYPE_REG
- q3.To.Reg = REGFP
-
- q5 := obj.Appendp(q4, c.newprog)
- q5.Pos = p.Pos
- q5.As = ASUB
- q5.From.Type = obj.TYPE_CONST
- q5.From.Offset = 8
- q5.Reg = REGSP
- q5.To.Type = obj.TYPE_REG
- q5.To.Reg = REGFP
- q1.From.SetTarget(q5)
- p = q5
- }
+ // ADR ret_addr, R27
+ // STP (FP, R27), -24(SP)
+ // SUB 24, SP, FP
+ // DUFFCOPY
+ // ret_addr:
+ // SUB 8, SP, FP
+
+ q1 := p
+ // copy DUFFCOPY from q1 to q4
+ q4 := obj.Appendp(p, c.newprog)
+ q4.Pos = p.Pos
+ q4.As = obj.ADUFFCOPY
+ q4.To = p.To
+
+ q1.As = AADR
+ q1.From.Type = obj.TYPE_BRANCH
+ q1.To.Type = obj.TYPE_REG
+ q1.To.Reg = REG_R27
+
+ q2 := obj.Appendp(q1, c.newprog)
+ q2.Pos = p.Pos
+ q2.As = ASTP
+ q2.From.Type = obj.TYPE_REGREG
+ q2.From.Reg = REGFP
+ q2.From.Offset = int64(REG_R27)
+ q2.To.Type = obj.TYPE_MEM
+ q2.To.Reg = REGSP
+ q2.To.Offset = -24
+
+ // maintain FP for DUFFCOPY
+ q3 := obj.Appendp(q2, c.newprog)
+ q3.Pos = p.Pos
+ q3.As = ASUB
+ q3.From.Type = obj.TYPE_CONST
+ q3.From.Offset = 24
+ q3.Reg = REGSP
+ q3.To.Type = obj.TYPE_REG
+ q3.To.Reg = REGFP
+
+ q5 := obj.Appendp(q4, c.newprog)
+ q5.Pos = p.Pos
+ q5.As = ASUB
+ q5.From.Type = obj.TYPE_CONST
+ q5.From.Offset = 8
+ q5.Reg = REGSP
+ q5.To.Type = obj.TYPE_REG
+ q5.To.Reg = REGFP
+ q1.From.SetTarget(q5)
+ p = q5
case obj.ADUFFZERO:
- if objabi.Framepointer_enabled {
- // ADR ret_addr, R27
- // STP (FP, R27), -24(SP)
- // SUB 24, SP, FP
- // DUFFZERO
- // ret_addr:
- // SUB 8, SP, FP
-
- q1 := p
- // copy DUFFZERO from q1 to q4
- q4 := obj.Appendp(p, c.newprog)
- q4.Pos = p.Pos
- q4.As = obj.ADUFFZERO
- q4.To = p.To
-
- q1.As = AADR
- q1.From.Type = obj.TYPE_BRANCH
- q1.To.Type = obj.TYPE_REG
- q1.To.Reg = REG_R27
-
- q2 := obj.Appendp(q1, c.newprog)
- q2.Pos = p.Pos
- q2.As = ASTP
- q2.From.Type = obj.TYPE_REGREG
- q2.From.Reg = REGFP
- q2.From.Offset = int64(REG_R27)
- q2.To.Type = obj.TYPE_MEM
- q2.To.Reg = REGSP
- q2.To.Offset = -24
-
- // maintaine FP for DUFFZERO
- q3 := obj.Appendp(q2, c.newprog)
- q3.Pos = p.Pos
- q3.As = ASUB
- q3.From.Type = obj.TYPE_CONST
- q3.From.Offset = 24
- q3.Reg = REGSP
- q3.To.Type = obj.TYPE_REG
- q3.To.Reg = REGFP
-
- q5 := obj.Appendp(q4, c.newprog)
- q5.Pos = p.Pos
- q5.As = ASUB
- q5.From.Type = obj.TYPE_CONST
- q5.From.Offset = 8
- q5.Reg = REGSP
- q5.To.Type = obj.TYPE_REG
- q5.To.Reg = REGFP
- q1.From.SetTarget(q5)
- p = q5
+ // ADR ret_addr, R27
+ // STP (FP, R27), -24(SP)
+ // SUB 24, SP, FP
+ // DUFFZERO
+ // ret_addr:
+ // SUB 8, SP, FP
+
+ q1 := p
+ // copy DUFFZERO from q1 to q4
+ q4 := obj.Appendp(p, c.newprog)
+ q4.Pos = p.Pos
+ q4.As = obj.ADUFFZERO
+ q4.To = p.To
+
+ q1.As = AADR
+ q1.From.Type = obj.TYPE_BRANCH
+ q1.To.Type = obj.TYPE_REG
+ q1.To.Reg = REG_R27
+
+ q2 := obj.Appendp(q1, c.newprog)
+ q2.Pos = p.Pos
+ q2.As = ASTP
+ q2.From.Type = obj.TYPE_REGREG
+ q2.From.Reg = REGFP
+ q2.From.Offset = int64(REG_R27)
+ q2.To.Type = obj.TYPE_MEM
+ q2.To.Reg = REGSP
+ q2.To.Offset = -24
+
+ // maintain FP for DUFFZERO
+ q3 := obj.Appendp(q2, c.newprog)
+ q3.Pos = p.Pos
+ q3.As = ASUB
+ q3.From.Type = obj.TYPE_CONST
+ q3.From.Offset = 24
+ q3.Reg = REGSP
+ q3.To.Type = obj.TYPE_REG
+ q3.To.Reg = REGFP
+
+ q5 := obj.Appendp(q4, c.newprog)
+ q5.Pos = p.Pos
+ q5.As = ASUB
+ q5.From.Type = obj.TYPE_CONST
+ q5.From.Offset = 8
+ q5.Reg = REGSP
+ q5.To.Type = obj.TYPE_REG
+ q5.To.Reg = REGFP
+ q1.From.SetTarget(q5)
+ p = q5
+ }
+
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
+ f := c.cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
}
}
}
diff --git a/src/cmd/internal/obj/link.go b/src/cmd/internal/obj/link.go
index 35cb53cbf6..c74de779d2 100644
--- a/src/cmd/internal/obj/link.go
+++ b/src/cmd/internal/obj/link.go
@@ -39,6 +39,7 @@ import (
"cmd/internal/sys"
"fmt"
"sync"
+ "sync/atomic"
)
// An Addr is an argument to an instruction.
@@ -359,7 +360,21 @@ func (p *Prog) SetFrom3(a Addr) {
p.RestArgs = []AddrPos{{a, Source}}
}
-// SetTo2 assings []Args{{a, 1}} to p.RestArgs when the second destination
+// SetFrom3Reg calls p.SetFrom3 with a register Addr containing reg.
+//
+// Deprecated: for the same reasons as Prog.GetFrom3.
+func (p *Prog) SetFrom3Reg(reg int16) {
+ p.SetFrom3(Addr{Type: TYPE_REG, Reg: reg})
+}
+
+// SetFrom3Const calls p.SetFrom3 with a const Addr containing x.
+//
+// Deprecated: for the same reasons as Prog.GetFrom3.
+func (p *Prog) SetFrom3Const(off int64) {
+ p.SetFrom3(Addr{Type: TYPE_CONST, Offset: off})
+}
+
+// SetTo2 assigns []Args{{a, 1}} to p.RestArgs when the second destination
// operand does not fit into prog.RegTo2.
func (p *Prog) SetTo2(a Addr) {
p.RestArgs = []AddrPos{{a, Destination}}
@@ -453,6 +468,7 @@ type FuncInfo struct {
Locals int32
Align int32
FuncID objabi.FuncID
+ FuncFlag objabi.FuncFlag
Text *Prog
Autot map[*LSym]struct{}
Pcln Pcln
@@ -618,10 +634,6 @@ const (
// target of an inline during compilation
AttrWasInlined
- // TopFrame means that this function is an entry point and unwinders should not
- // keep unwinding beyond this frame.
- AttrTopFrame
-
// Indexed indicates this symbol has been assigned with an index (when using the
// new object file format).
AttrIndexed
@@ -647,37 +659,51 @@ const (
attrABIBase
)
-func (a Attribute) DuplicateOK() bool { return a&AttrDuplicateOK != 0 }
-func (a Attribute) MakeTypelink() bool { return a&AttrMakeTypelink != 0 }
-func (a Attribute) CFunc() bool { return a&AttrCFunc != 0 }
-func (a Attribute) NoSplit() bool { return a&AttrNoSplit != 0 }
-func (a Attribute) Leaf() bool { return a&AttrLeaf != 0 }
-func (a Attribute) OnList() bool { return a&AttrOnList != 0 }
-func (a Attribute) ReflectMethod() bool { return a&AttrReflectMethod != 0 }
-func (a Attribute) Local() bool { return a&AttrLocal != 0 }
-func (a Attribute) Wrapper() bool { return a&AttrWrapper != 0 }
-func (a Attribute) NeedCtxt() bool { return a&AttrNeedCtxt != 0 }
-func (a Attribute) NoFrame() bool { return a&AttrNoFrame != 0 }
-func (a Attribute) Static() bool { return a&AttrStatic != 0 }
-func (a Attribute) WasInlined() bool { return a&AttrWasInlined != 0 }
-func (a Attribute) TopFrame() bool { return a&AttrTopFrame != 0 }
-func (a Attribute) Indexed() bool { return a&AttrIndexed != 0 }
-func (a Attribute) UsedInIface() bool { return a&AttrUsedInIface != 0 }
-func (a Attribute) ContentAddressable() bool { return a&AttrContentAddressable != 0 }
-func (a Attribute) ABIWrapper() bool { return a&AttrABIWrapper != 0 }
+func (a *Attribute) load() Attribute { return Attribute(atomic.LoadUint32((*uint32)(a))) }
+
+func (a *Attribute) DuplicateOK() bool { return a.load()&AttrDuplicateOK != 0 }
+func (a *Attribute) MakeTypelink() bool { return a.load()&AttrMakeTypelink != 0 }
+func (a *Attribute) CFunc() bool { return a.load()&AttrCFunc != 0 }
+func (a *Attribute) NoSplit() bool { return a.load()&AttrNoSplit != 0 }
+func (a *Attribute) Leaf() bool { return a.load()&AttrLeaf != 0 }
+func (a *Attribute) OnList() bool { return a.load()&AttrOnList != 0 }
+func (a *Attribute) ReflectMethod() bool { return a.load()&AttrReflectMethod != 0 }
+func (a *Attribute) Local() bool { return a.load()&AttrLocal != 0 }
+func (a *Attribute) Wrapper() bool { return a.load()&AttrWrapper != 0 }
+func (a *Attribute) NeedCtxt() bool { return a.load()&AttrNeedCtxt != 0 }
+func (a *Attribute) NoFrame() bool { return a.load()&AttrNoFrame != 0 }
+func (a *Attribute) Static() bool { return a.load()&AttrStatic != 0 }
+func (a *Attribute) WasInlined() bool { return a.load()&AttrWasInlined != 0 }
+func (a *Attribute) Indexed() bool { return a.load()&AttrIndexed != 0 }
+func (a *Attribute) UsedInIface() bool { return a.load()&AttrUsedInIface != 0 }
+func (a *Attribute) ContentAddressable() bool { return a.load()&AttrContentAddressable != 0 }
+func (a *Attribute) ABIWrapper() bool { return a.load()&AttrABIWrapper != 0 }
func (a *Attribute) Set(flag Attribute, value bool) {
- if value {
- *a |= flag
- } else {
- *a &^= flag
+ for {
+ v0 := a.load()
+ v := v0
+ if value {
+ v |= flag
+ } else {
+ v &^= flag
+ }
+ if atomic.CompareAndSwapUint32((*uint32)(a), uint32(v0), uint32(v)) {
+ break
+ }
}
}
-func (a Attribute) ABI() ABI { return ABI(a / attrABIBase) }
+func (a *Attribute) ABI() ABI { return ABI(a.load() / attrABIBase) }
func (a *Attribute) SetABI(abi ABI) {
const mask = 1 // Only one ABI bit for now.
- *a = (*a &^ (mask * attrABIBase)) | Attribute(abi)*attrABIBase
+ for {
+ v0 := a.load()
+ v := (v0 &^ (mask * attrABIBase)) | Attribute(abi)*attrABIBase
+ if atomic.CompareAndSwapUint32((*uint32)(a), uint32(v0), uint32(v)) {
+ break
+ }
+ }
}
var textAttrStrings = [...]struct {
@@ -697,14 +723,13 @@ var textAttrStrings = [...]struct {
{bit: AttrNoFrame, s: "NOFRAME"},
{bit: AttrStatic, s: "STATIC"},
{bit: AttrWasInlined, s: ""},
- {bit: AttrTopFrame, s: "TOPFRAME"},
{bit: AttrIndexed, s: ""},
{bit: AttrContentAddressable, s: ""},
{bit: AttrABIWrapper, s: "ABIWRAPPER"},
}
-// TextAttrString formats a for printing in as part of a TEXT prog.
-func (a Attribute) TextAttrString() string {
+// String formats a for printing in as part of a TEXT prog.
+func (a Attribute) String() string {
var s string
for _, x := range textAttrStrings {
if a&x.bit != 0 {
@@ -730,6 +755,18 @@ func (a Attribute) TextAttrString() string {
return s
}
+// TextAttrString formats the symbol attributes for printing in as part of a TEXT prog.
+func (s *LSym) TextAttrString() string {
+ attr := s.Attribute.String()
+ if s.Func().FuncFlag&objabi.FuncFlag_TOPFRAME != 0 {
+ if attr != "" {
+ attr += "|"
+ }
+ attr += "TOPFRAME"
+ }
+ return attr
+}
+
func (s *LSym) String() string {
return s.Name
}
diff --git a/src/cmd/internal/obj/mips/obj0.go b/src/cmd/internal/obj/mips/obj0.go
index 135a8df3aa..91bba90d41 100644
--- a/src/cmd/internal/obj/mips/obj0.go
+++ b/src/cmd/internal/obj/mips/obj0.go
@@ -35,6 +35,7 @@ import (
"cmd/internal/sys"
"encoding/binary"
"fmt"
+ "log"
"math"
)
@@ -536,6 +537,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.From.Reg = REGSP
}
}
+
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
+ f := c.cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
+ }
+ }
}
if c.ctxt.Arch.Family == sys.MIPS {
diff --git a/src/cmd/internal/obj/objfile.go b/src/cmd/internal/obj/objfile.go
index bb58b4f0c2..b031afbc36 100644
--- a/src/cmd/internal/obj/objfile.go
+++ b/src/cmd/internal/obj/objfile.go
@@ -330,9 +330,6 @@ func (w *writer) Sym(s *LSym) {
if s.ReflectMethod() {
flag |= goobj.SymFlagReflectMethod
}
- if s.TopFrame() {
- flag |= goobj.SymFlagTopFrame
- }
if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' && s.Type == objabi.SRODATA {
flag |= goobj.SymFlagGoType
}
@@ -386,7 +383,7 @@ func (w *writer) Sym(s *LSym) {
func (w *writer) Hash64(s *LSym) {
if !s.ContentAddressable() || len(s.R) != 0 {
- panic("Hash of non-content-addresable symbol")
+ panic("Hash of non-content-addressable symbol")
}
b := contentHash64(s)
w.Bytes(b[:])
@@ -394,7 +391,7 @@ func (w *writer) Hash64(s *LSym) {
func (w *writer) Hash(s *LSym) {
if !s.ContentAddressable() {
- panic("Hash of non-content-addresable symbol")
+ panic("Hash of non-content-addressable symbol")
}
b := w.contentHash(s)
w.Bytes(b[:])
@@ -673,9 +670,10 @@ func genFuncInfoSyms(ctxt *Link) {
continue
}
o := goobj.FuncInfo{
- Args: uint32(fn.Args),
- Locals: uint32(fn.Locals),
- FuncID: objabi.FuncID(fn.FuncID),
+ Args: uint32(fn.Args),
+ Locals: uint32(fn.Locals),
+ FuncID: fn.FuncID,
+ FuncFlag: fn.FuncFlag,
}
pc := &fn.Pcln
o.Pcsp = makeSymRef(preparePcSym(pc.Pcsp))
@@ -788,7 +786,7 @@ func (ctxt *Link) writeSymDebugNamed(s *LSym, name string) {
if s.NoSplit() {
fmt.Fprintf(ctxt.Bso, "nosplit ")
}
- if s.TopFrame() {
+ if s.Func() != nil && s.Func().FuncFlag&objabi.FuncFlag_TOPFRAME != 0 {
fmt.Fprintf(ctxt.Bso, "topframe ")
}
fmt.Fprintf(ctxt.Bso, "size=%d", s.Size)
diff --git a/src/cmd/internal/obj/pcln.go b/src/cmd/internal/obj/pcln.go
index 67c4f9a62b..7af81335fb 100644
--- a/src/cmd/internal/obj/pcln.go
+++ b/src/cmd/internal/obj/pcln.go
@@ -37,7 +37,7 @@ func funcpctab(ctxt *Link, func_ *LSym, desc string, valfunc func(*Link, *LSym,
oldval := val
fn := func_.Func()
if fn.Text == nil {
- // Return the emtpy symbol we've built so far.
+ // Return the empty symbol we've built so far.
return sym
}
diff --git a/src/cmd/internal/obj/plist.go b/src/cmd/internal/obj/plist.go
index 679ce7eb8f..177083261c 100644
--- a/src/cmd/internal/obj/plist.go
+++ b/src/cmd/internal/obj/plist.go
@@ -134,6 +134,7 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) {
}
name := strings.Replace(s.Name, "\"\"", ctxt.Pkgpath, -1)
s.Func().FuncID = objabi.GetFuncID(name, flag&WRAPPER != 0)
+ s.Func().FuncFlag = toFuncFlag(flag)
s.Set(AttrOnList, true)
s.Set(AttrDuplicateOK, flag&DUPOK != 0)
s.Set(AttrNoSplit, flag&NOSPLIT != 0)
@@ -142,7 +143,6 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) {
s.Set(AttrABIWrapper, flag&ABIWRAPPER != 0)
s.Set(AttrNeedCtxt, flag&NEEDCTXT != 0)
s.Set(AttrNoFrame, flag&NOFRAME != 0)
- s.Set(AttrTopFrame, flag&TOPFRAME != 0)
s.Type = objabi.STEXT
ctxt.Text = append(ctxt.Text, s)
@@ -150,6 +150,14 @@ func (ctxt *Link) InitTextSym(s *LSym, flag int) {
ctxt.dwarfSym(s)
}
+func toFuncFlag(flag int) objabi.FuncFlag {
+ var out objabi.FuncFlag
+ if flag&TOPFRAME != 0 {
+ out |= objabi.FuncFlag_TOPFRAME
+ }
+ return out
+}
+
func (ctxt *Link) Globl(s *LSym, size int64, flag int) {
if s.OnList() {
ctxt.Diag("symbol %s listed multiple times", s.Name)
diff --git a/src/cmd/internal/obj/ppc64/asm9.go b/src/cmd/internal/obj/ppc64/asm9.go
index 41e263b2c0..97b4cb2317 100644
--- a/src/cmd/internal/obj/ppc64/asm9.go
+++ b/src/cmd/internal/obj/ppc64/asm9.go
@@ -73,558 +73,564 @@ type Optab struct {
param int16
}
-// This optab contains a list of opcodes with the operand
-// combinations that are implemented. Not all opcodes are in this
-// table, but are added later in buildop by calling opset for those
-// opcodes which allow the same operand combinations as an opcode
-// already in the table.
+// optab contains an array to be sliced of accepted operand combinations for an
+// instruction. Unused arguments and fields are not explicitly enumerated, and
+// should not be listed for clarity. Unused arguments and values should always
+// assume the default value for the given type.
//
-// The type field in the Optabl identifies the case in asmout where
-// the instruction word is assembled.
+// optab does not list every valid ppc64 opcode, it enumerates representative
+// operand combinations for a class of instruction. The variable oprange indexes
+// all valid ppc64 opcodes.
+//
+// oprange is initialized to point a slice within optab which contains the valid
+// operand combinations for a given instruction. This is initialized from buildop.
+//
+// Likewise, each slice of optab is dynamically sorted using the ocmp Sort interface
+// to arrange entries to minimize text size of each opcode.
var optab = []Optab{
- {obj.ATEXT, C_LEXT, C_NONE, C_NONE, C_TEXTSIZE, 0, 0, 0},
- {obj.ATEXT, C_LEXT, C_NONE, C_LCON, C_TEXTSIZE, 0, 0, 0},
- {obj.ATEXT, C_ADDR, C_NONE, C_NONE, C_TEXTSIZE, 0, 0, 0},
- {obj.ATEXT, C_ADDR, C_NONE, C_LCON, C_TEXTSIZE, 0, 0, 0},
+ {as: obj.ATEXT, a1: C_LEXT, a4: C_TEXTSIZE, type_: 0, size: 0},
+ {as: obj.ATEXT, a1: C_LEXT, a3: C_LCON, a4: C_TEXTSIZE, type_: 0, size: 0},
+ {as: obj.ATEXT, a1: C_ADDR, a4: C_TEXTSIZE, type_: 0, size: 0},
+ {as: obj.ATEXT, a1: C_ADDR, a3: C_LCON, a4: C_TEXTSIZE, type_: 0, size: 0},
/* move register */
- {AMOVD, C_REG, C_NONE, C_NONE, C_REG, 1, 4, 0},
- {AMOVB, C_REG, C_NONE, C_NONE, C_REG, 12, 4, 0},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_REG, 13, 4, 0},
- {AMOVW, C_REG, C_NONE, C_NONE, C_REG, 12, 4, 0},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_REG, 13, 4, 0},
- {AADD, C_REG, C_REG, C_NONE, C_REG, 2, 4, 0},
- {AADD, C_REG, C_NONE, C_NONE, C_REG, 2, 4, 0},
- {AADD, C_SCON, C_REG, C_NONE, C_REG, 4, 4, 0},
- {AADD, C_SCON, C_NONE, C_NONE, C_REG, 4, 4, 0},
- {AADD, C_ADDCON, C_REG, C_NONE, C_REG, 4, 4, 0},
- {AADD, C_ADDCON, C_NONE, C_NONE, C_REG, 4, 4, 0},
- {AADD, C_UCON, C_REG, C_NONE, C_REG, 20, 4, 0},
- {AADD, C_UCON, C_NONE, C_NONE, C_REG, 20, 4, 0},
- {AADD, C_ANDCON, C_REG, C_NONE, C_REG, 22, 8, 0},
- {AADD, C_ANDCON, C_NONE, C_NONE, C_REG, 22, 8, 0},
- {AADD, C_LCON, C_REG, C_NONE, C_REG, 22, 12, 0},
- {AADD, C_LCON, C_NONE, C_NONE, C_REG, 22, 12, 0},
- {AADDIS, C_ADDCON, C_REG, C_NONE, C_REG, 20, 4, 0},
- {AADDIS, C_ADDCON, C_NONE, C_NONE, C_REG, 20, 4, 0},
- {AADDC, C_REG, C_REG, C_NONE, C_REG, 2, 4, 0},
- {AADDC, C_REG, C_NONE, C_NONE, C_REG, 2, 4, 0},
- {AADDC, C_ADDCON, C_REG, C_NONE, C_REG, 4, 4, 0},
- {AADDC, C_ADDCON, C_NONE, C_NONE, C_REG, 4, 4, 0},
- {AADDC, C_LCON, C_REG, C_NONE, C_REG, 22, 12, 0},
- {AADDC, C_LCON, C_NONE, C_NONE, C_REG, 22, 12, 0},
- {AAND, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0}, /* logical, no literal */
- {AAND, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {AANDCC, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0},
- {AANDCC, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {AANDCC, C_ANDCON, C_NONE, C_NONE, C_REG, 58, 4, 0},
- {AANDCC, C_ANDCON, C_REG, C_NONE, C_REG, 58, 4, 0},
- {AANDCC, C_UCON, C_NONE, C_NONE, C_REG, 59, 4, 0},
- {AANDCC, C_UCON, C_REG, C_NONE, C_REG, 59, 4, 0},
- {AANDCC, C_ADDCON, C_NONE, C_NONE, C_REG, 23, 8, 0},
- {AANDCC, C_ADDCON, C_REG, C_NONE, C_REG, 23, 8, 0},
- {AANDCC, C_LCON, C_NONE, C_NONE, C_REG, 23, 12, 0},
- {AANDCC, C_LCON, C_REG, C_NONE, C_REG, 23, 12, 0},
- {AANDISCC, C_ANDCON, C_NONE, C_NONE, C_REG, 59, 4, 0},
- {AANDISCC, C_ANDCON, C_REG, C_NONE, C_REG, 59, 4, 0},
- {AMULLW, C_REG, C_REG, C_NONE, C_REG, 2, 4, 0},
- {AMULLW, C_REG, C_NONE, C_NONE, C_REG, 2, 4, 0},
- {AMULLW, C_ADDCON, C_REG, C_NONE, C_REG, 4, 4, 0},
- {AMULLW, C_ADDCON, C_NONE, C_NONE, C_REG, 4, 4, 0},
- {AMULLW, C_ANDCON, C_REG, C_NONE, C_REG, 4, 4, 0},
- {AMULLW, C_ANDCON, C_NONE, C_NONE, C_REG, 4, 4, 0},
- {AMULLW, C_LCON, C_REG, C_NONE, C_REG, 22, 12, 0},
- {AMULLW, C_LCON, C_NONE, C_NONE, C_REG, 22, 12, 0},
- {ASUBC, C_REG, C_REG, C_NONE, C_REG, 10, 4, 0},
- {ASUBC, C_REG, C_NONE, C_NONE, C_REG, 10, 4, 0},
- {ASUBC, C_REG, C_NONE, C_ADDCON, C_REG, 27, 4, 0},
- {ASUBC, C_REG, C_NONE, C_LCON, C_REG, 28, 12, 0},
- {AOR, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0}, /* logical, literal not cc (or/xor) */
- {AOR, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {AOR, C_ANDCON, C_NONE, C_NONE, C_REG, 58, 4, 0},
- {AOR, C_ANDCON, C_REG, C_NONE, C_REG, 58, 4, 0},
- {AOR, C_UCON, C_NONE, C_NONE, C_REG, 59, 4, 0},
- {AOR, C_UCON, C_REG, C_NONE, C_REG, 59, 4, 0},
- {AOR, C_ADDCON, C_NONE, C_NONE, C_REG, 23, 8, 0},
- {AOR, C_ADDCON, C_REG, C_NONE, C_REG, 23, 8, 0},
- {AOR, C_LCON, C_NONE, C_NONE, C_REG, 23, 12, 0},
- {AOR, C_LCON, C_REG, C_NONE, C_REG, 23, 12, 0},
- {AORIS, C_ANDCON, C_NONE, C_NONE, C_REG, 59, 4, 0},
- {AORIS, C_ANDCON, C_REG, C_NONE, C_REG, 59, 4, 0},
- {ADIVW, C_REG, C_REG, C_NONE, C_REG, 2, 4, 0}, /* op r1[,r2],r3 */
- {ADIVW, C_REG, C_NONE, C_NONE, C_REG, 2, 4, 0},
- {ASUB, C_REG, C_REG, C_NONE, C_REG, 10, 4, 0}, /* op r2[,r1],r3 */
- {ASUB, C_REG, C_NONE, C_NONE, C_REG, 10, 4, 0},
- {ASLW, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {ASLW, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0},
- {ASLD, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {ASLD, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0},
- {ASLD, C_SCON, C_REG, C_NONE, C_REG, 25, 4, 0},
- {ASLD, C_SCON, C_NONE, C_NONE, C_REG, 25, 4, 0},
- {AEXTSWSLI, C_SCON, C_NONE, C_NONE, C_REG, 25, 4, 0},
- {AEXTSWSLI, C_SCON, C_REG, C_NONE, C_REG, 25, 4, 0},
- {ASLW, C_SCON, C_REG, C_NONE, C_REG, 57, 4, 0},
- {ASLW, C_SCON, C_NONE, C_NONE, C_REG, 57, 4, 0},
- {ASRAW, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {ASRAW, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0},
- {ASRAW, C_SCON, C_REG, C_NONE, C_REG, 56, 4, 0},
- {ASRAW, C_SCON, C_NONE, C_NONE, C_REG, 56, 4, 0},
- {ASRAD, C_REG, C_NONE, C_NONE, C_REG, 6, 4, 0},
- {ASRAD, C_REG, C_REG, C_NONE, C_REG, 6, 4, 0},
- {ASRAD, C_SCON, C_REG, C_NONE, C_REG, 56, 4, 0},
- {ASRAD, C_SCON, C_NONE, C_NONE, C_REG, 56, 4, 0},
- {ARLWMI, C_SCON, C_REG, C_LCON, C_REG, 62, 4, 0},
- {ARLWMI, C_REG, C_REG, C_LCON, C_REG, 63, 4, 0},
- {ACLRLSLWI, C_SCON, C_REG, C_LCON, C_REG, 62, 4, 0},
- {ARLDMI, C_SCON, C_REG, C_LCON, C_REG, 30, 4, 0},
- {ARLDC, C_SCON, C_REG, C_LCON, C_REG, 29, 4, 0},
- {ARLDCL, C_SCON, C_REG, C_LCON, C_REG, 29, 4, 0},
- {ARLDCL, C_REG, C_REG, C_LCON, C_REG, 14, 4, 0},
- {ARLDICL, C_REG, C_REG, C_LCON, C_REG, 14, 4, 0},
- {ARLDICL, C_SCON, C_REG, C_LCON, C_REG, 14, 4, 0},
- {ARLDCL, C_REG, C_NONE, C_LCON, C_REG, 14, 4, 0},
- {AFADD, C_FREG, C_NONE, C_NONE, C_FREG, 2, 4, 0},
- {AFADD, C_FREG, C_FREG, C_NONE, C_FREG, 2, 4, 0},
- {AFABS, C_FREG, C_NONE, C_NONE, C_FREG, 33, 4, 0},
- {AFABS, C_NONE, C_NONE, C_NONE, C_FREG, 33, 4, 0},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_FREG, 33, 4, 0},
- {AFMADD, C_FREG, C_FREG, C_FREG, C_FREG, 34, 4, 0},
- {AFMUL, C_FREG, C_NONE, C_NONE, C_FREG, 32, 4, 0},
- {AFMUL, C_FREG, C_FREG, C_NONE, C_FREG, 32, 4, 0},
+ {as: AMOVD, a1: C_REG, a4: C_REG, type_: 1, size: 4},
+ {as: AMOVB, a1: C_REG, a4: C_REG, type_: 12, size: 4},
+ {as: AMOVBZ, a1: C_REG, a4: C_REG, type_: 13, size: 4},
+ {as: AMOVW, a1: C_REG, a4: C_REG, type_: 12, size: 4},
+ {as: AMOVWZ, a1: C_REG, a4: C_REG, type_: 13, size: 4},
+ {as: AADD, a1: C_REG, a2: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: AADD, a1: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: AADD, a1: C_SCON, a2: C_REG, a4: C_REG, type_: 4, size: 4},
+ {as: AADD, a1: C_SCON, a4: C_REG, type_: 4, size: 4},
+ {as: AADD, a1: C_ADDCON, a2: C_REG, a4: C_REG, type_: 4, size: 4},
+ {as: AADD, a1: C_ADDCON, a4: C_REG, type_: 4, size: 4},
+ {as: AADD, a1: C_UCON, a2: C_REG, a4: C_REG, type_: 20, size: 4},
+ {as: AADD, a1: C_UCON, a4: C_REG, type_: 20, size: 4},
+ {as: AADD, a1: C_ANDCON, a2: C_REG, a4: C_REG, type_: 22, size: 8},
+ {as: AADD, a1: C_ANDCON, a4: C_REG, type_: 22, size: 8},
+ {as: AADD, a1: C_LCON, a2: C_REG, a4: C_REG, type_: 22, size: 12},
+ {as: AADD, a1: C_LCON, a4: C_REG, type_: 22, size: 12},
+ {as: AADDIS, a1: C_ADDCON, a2: C_REG, a4: C_REG, type_: 20, size: 4},
+ {as: AADDIS, a1: C_ADDCON, a4: C_REG, type_: 20, size: 4},
+ {as: AADDC, a1: C_REG, a2: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: AADDC, a1: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: AADDC, a1: C_ADDCON, a2: C_REG, a4: C_REG, type_: 4, size: 4},
+ {as: AADDC, a1: C_ADDCON, a4: C_REG, type_: 4, size: 4},
+ {as: AADDC, a1: C_LCON, a2: C_REG, a4: C_REG, type_: 22, size: 12},
+ {as: AADDC, a1: C_LCON, a4: C_REG, type_: 22, size: 12},
+ {as: AAND, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4}, /* logical, no literal */
+ {as: AAND, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: AANDCC, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: AANDCC, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: AANDCC, a1: C_ANDCON, a4: C_REG, type_: 58, size: 4},
+ {as: AANDCC, a1: C_ANDCON, a2: C_REG, a4: C_REG, type_: 58, size: 4},
+ {as: AANDCC, a1: C_UCON, a4: C_REG, type_: 59, size: 4},
+ {as: AANDCC, a1: C_UCON, a2: C_REG, a4: C_REG, type_: 59, size: 4},
+ {as: AANDCC, a1: C_ADDCON, a4: C_REG, type_: 23, size: 8},
+ {as: AANDCC, a1: C_ADDCON, a2: C_REG, a4: C_REG, type_: 23, size: 8},
+ {as: AANDCC, a1: C_LCON, a4: C_REG, type_: 23, size: 12},
+ {as: AANDCC, a1: C_LCON, a2: C_REG, a4: C_REG, type_: 23, size: 12},
+ {as: AANDISCC, a1: C_ANDCON, a4: C_REG, type_: 59, size: 4},
+ {as: AANDISCC, a1: C_ANDCON, a2: C_REG, a4: C_REG, type_: 59, size: 4},
+ {as: AMULLW, a1: C_REG, a2: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: AMULLW, a1: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: AMULLW, a1: C_ADDCON, a2: C_REG, a4: C_REG, type_: 4, size: 4},
+ {as: AMULLW, a1: C_ADDCON, a4: C_REG, type_: 4, size: 4},
+ {as: AMULLW, a1: C_ANDCON, a2: C_REG, a4: C_REG, type_: 4, size: 4},
+ {as: AMULLW, a1: C_ANDCON, a4: C_REG, type_: 4, size: 4},
+ {as: AMULLW, a1: C_LCON, a2: C_REG, a4: C_REG, type_: 22, size: 12},
+ {as: AMULLW, a1: C_LCON, a4: C_REG, type_: 22, size: 12},
+ {as: ASUBC, a1: C_REG, a2: C_REG, a4: C_REG, type_: 10, size: 4},
+ {as: ASUBC, a1: C_REG, a4: C_REG, type_: 10, size: 4},
+ {as: ASUBC, a1: C_REG, a3: C_ADDCON, a4: C_REG, type_: 27, size: 4},
+ {as: ASUBC, a1: C_REG, a3: C_LCON, a4: C_REG, type_: 28, size: 12},
+ {as: AOR, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4}, /* logical, literal not cc (or/xor) */
+ {as: AOR, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: AOR, a1: C_ANDCON, a4: C_REG, type_: 58, size: 4},
+ {as: AOR, a1: C_ANDCON, a2: C_REG, a4: C_REG, type_: 58, size: 4},
+ {as: AOR, a1: C_UCON, a4: C_REG, type_: 59, size: 4},
+ {as: AOR, a1: C_UCON, a2: C_REG, a4: C_REG, type_: 59, size: 4},
+ {as: AOR, a1: C_ADDCON, a4: C_REG, type_: 23, size: 8},
+ {as: AOR, a1: C_ADDCON, a2: C_REG, a4: C_REG, type_: 23, size: 8},
+ {as: AOR, a1: C_LCON, a4: C_REG, type_: 23, size: 12},
+ {as: AOR, a1: C_LCON, a2: C_REG, a4: C_REG, type_: 23, size: 12},
+ {as: AORIS, a1: C_ANDCON, a4: C_REG, type_: 59, size: 4},
+ {as: AORIS, a1: C_ANDCON, a2: C_REG, a4: C_REG, type_: 59, size: 4},
+ {as: ADIVW, a1: C_REG, a2: C_REG, a4: C_REG, type_: 2, size: 4}, /* op r1[,r2],r3 */
+ {as: ADIVW, a1: C_REG, a4: C_REG, type_: 2, size: 4},
+ {as: ASUB, a1: C_REG, a2: C_REG, a4: C_REG, type_: 10, size: 4}, /* op r2[,r1],r3 */
+ {as: ASUB, a1: C_REG, a4: C_REG, type_: 10, size: 4},
+ {as: ASLW, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASLW, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASLD, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASLD, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASLD, a1: C_SCON, a2: C_REG, a4: C_REG, type_: 25, size: 4},
+ {as: ASLD, a1: C_SCON, a4: C_REG, type_: 25, size: 4},
+ {as: AEXTSWSLI, a1: C_SCON, a4: C_REG, type_: 25, size: 4},
+ {as: AEXTSWSLI, a1: C_SCON, a2: C_REG, a4: C_REG, type_: 25, size: 4},
+ {as: ASLW, a1: C_SCON, a2: C_REG, a4: C_REG, type_: 57, size: 4},
+ {as: ASLW, a1: C_SCON, a4: C_REG, type_: 57, size: 4},
+ {as: ASRAW, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASRAW, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASRAW, a1: C_SCON, a2: C_REG, a4: C_REG, type_: 56, size: 4},
+ {as: ASRAW, a1: C_SCON, a4: C_REG, type_: 56, size: 4},
+ {as: ASRAD, a1: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASRAD, a1: C_REG, a2: C_REG, a4: C_REG, type_: 6, size: 4},
+ {as: ASRAD, a1: C_SCON, a2: C_REG, a4: C_REG, type_: 56, size: 4},
+ {as: ASRAD, a1: C_SCON, a4: C_REG, type_: 56, size: 4},
+ {as: ARLWMI, a1: C_SCON, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 62, size: 4},
+ {as: ARLWMI, a1: C_REG, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 63, size: 4},
+ {as: ACLRLSLWI, a1: C_SCON, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 62, size: 4},
+ {as: ARLDMI, a1: C_SCON, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 30, size: 4},
+ {as: ARLDC, a1: C_SCON, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 29, size: 4},
+ {as: ARLDCL, a1: C_SCON, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 29, size: 4},
+ {as: ARLDCL, a1: C_REG, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 14, size: 4},
+ {as: ARLDICL, a1: C_REG, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 14, size: 4},
+ {as: ARLDICL, a1: C_SCON, a2: C_REG, a3: C_LCON, a4: C_REG, type_: 14, size: 4},
+ {as: ARLDCL, a1: C_REG, a3: C_LCON, a4: C_REG, type_: 14, size: 4},
+ {as: AFADD, a1: C_FREG, a4: C_FREG, type_: 2, size: 4},
+ {as: AFADD, a1: C_FREG, a2: C_FREG, a4: C_FREG, type_: 2, size: 4},
+ {as: AFABS, a1: C_FREG, a4: C_FREG, type_: 33, size: 4},
+ {as: AFABS, a4: C_FREG, type_: 33, size: 4},
+ {as: AFMOVD, a1: C_FREG, a4: C_FREG, type_: 33, size: 4},
+ {as: AFMADD, a1: C_FREG, a2: C_FREG, a3: C_FREG, a4: C_FREG, type_: 34, size: 4},
+ {as: AFMUL, a1: C_FREG, a4: C_FREG, type_: 32, size: 4},
+ {as: AFMUL, a1: C_FREG, a2: C_FREG, a4: C_FREG, type_: 32, size: 4},
/* store, short offset */
- {AMOVD, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVW, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVWZ, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVBZ, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVBZU, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVB, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVBU, C_REG, C_REG, C_NONE, C_ZOREG, 7, 4, REGZERO},
- {AMOVD, C_REG, C_NONE, C_NONE, C_SEXT, 7, 4, REGSB},
- {AMOVW, C_REG, C_NONE, C_NONE, C_SEXT, 7, 4, REGSB},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_SEXT, 7, 4, REGSB},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_SEXT, 7, 4, REGSB},
- {AMOVB, C_REG, C_NONE, C_NONE, C_SEXT, 7, 4, REGSB},
- {AMOVD, C_REG, C_NONE, C_NONE, C_SAUTO, 7, 4, REGSP},
- {AMOVW, C_REG, C_NONE, C_NONE, C_SAUTO, 7, 4, REGSP},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_SAUTO, 7, 4, REGSP},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_SAUTO, 7, 4, REGSP},
- {AMOVB, C_REG, C_NONE, C_NONE, C_SAUTO, 7, 4, REGSP},
- {AMOVD, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AMOVW, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AMOVBZU, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AMOVB, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AMOVBU, C_REG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
+ {as: AMOVD, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVBZ, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVBZU, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVB, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVBU, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVD, a1: C_REG, a4: C_SEXT, type_: 7, size: 4, param: REGSB},
+ {as: AMOVW, a1: C_REG, a4: C_SEXT, type_: 7, size: 4, param: REGSB},
+ {as: AMOVWZ, a1: C_REG, a4: C_SEXT, type_: 7, size: 4, param: REGSB},
+ {as: AMOVBZ, a1: C_REG, a4: C_SEXT, type_: 7, size: 4, param: REGSB},
+ {as: AMOVB, a1: C_REG, a4: C_SEXT, type_: 7, size: 4, param: REGSB},
+ {as: AMOVD, a1: C_REG, a4: C_SAUTO, type_: 7, size: 4, param: REGSP},
+ {as: AMOVW, a1: C_REG, a4: C_SAUTO, type_: 7, size: 4, param: REGSP},
+ {as: AMOVWZ, a1: C_REG, a4: C_SAUTO, type_: 7, size: 4, param: REGSP},
+ {as: AMOVBZ, a1: C_REG, a4: C_SAUTO, type_: 7, size: 4, param: REGSP},
+ {as: AMOVB, a1: C_REG, a4: C_SAUTO, type_: 7, size: 4, param: REGSP},
+ {as: AMOVD, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVBZ, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVBZU, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVB, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AMOVBU, a1: C_REG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
/* load, short offset */
- {AMOVD, C_ZOREG, C_REG, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVW, C_ZOREG, C_REG, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVWZ, C_ZOREG, C_REG, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVBZ, C_ZOREG, C_REG, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVBZU, C_ZOREG, C_REG, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVB, C_ZOREG, C_REG, C_NONE, C_REG, 9, 8, REGZERO},
- {AMOVBU, C_ZOREG, C_REG, C_NONE, C_REG, 9, 8, REGZERO},
- {AMOVD, C_SEXT, C_NONE, C_NONE, C_REG, 8, 4, REGSB},
- {AMOVW, C_SEXT, C_NONE, C_NONE, C_REG, 8, 4, REGSB},
- {AMOVWZ, C_SEXT, C_NONE, C_NONE, C_REG, 8, 4, REGSB},
- {AMOVBZ, C_SEXT, C_NONE, C_NONE, C_REG, 8, 4, REGSB},
- {AMOVB, C_SEXT, C_NONE, C_NONE, C_REG, 9, 8, REGSB},
- {AMOVD, C_SAUTO, C_NONE, C_NONE, C_REG, 8, 4, REGSP},
- {AMOVW, C_SAUTO, C_NONE, C_NONE, C_REG, 8, 4, REGSP},
- {AMOVWZ, C_SAUTO, C_NONE, C_NONE, C_REG, 8, 4, REGSP},
- {AMOVBZ, C_SAUTO, C_NONE, C_NONE, C_REG, 8, 4, REGSP},
- {AMOVB, C_SAUTO, C_NONE, C_NONE, C_REG, 9, 8, REGSP},
- {AMOVD, C_SOREG, C_NONE, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVW, C_SOREG, C_NONE, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVWZ, C_SOREG, C_NONE, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVBZ, C_SOREG, C_NONE, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVBZU, C_SOREG, C_NONE, C_NONE, C_REG, 8, 4, REGZERO},
- {AMOVB, C_SOREG, C_NONE, C_NONE, C_REG, 9, 8, REGZERO},
- {AMOVBU, C_SOREG, C_NONE, C_NONE, C_REG, 9, 8, REGZERO},
+ {as: AMOVD, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVBZ, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVBZU, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVB, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 9, size: 8, param: REGZERO},
+ {as: AMOVBU, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 9, size: 8, param: REGZERO},
+ {as: AMOVD, a1: C_SEXT, a4: C_REG, type_: 8, size: 4, param: REGSB},
+ {as: AMOVW, a1: C_SEXT, a4: C_REG, type_: 8, size: 4, param: REGSB},
+ {as: AMOVWZ, a1: C_SEXT, a4: C_REG, type_: 8, size: 4, param: REGSB},
+ {as: AMOVBZ, a1: C_SEXT, a4: C_REG, type_: 8, size: 4, param: REGSB},
+ {as: AMOVB, a1: C_SEXT, a4: C_REG, type_: 9, size: 8, param: REGSB},
+ {as: AMOVD, a1: C_SAUTO, a4: C_REG, type_: 8, size: 4, param: REGSP},
+ {as: AMOVW, a1: C_SAUTO, a4: C_REG, type_: 8, size: 4, param: REGSP},
+ {as: AMOVWZ, a1: C_SAUTO, a4: C_REG, type_: 8, size: 4, param: REGSP},
+ {as: AMOVBZ, a1: C_SAUTO, a4: C_REG, type_: 8, size: 4, param: REGSP},
+ {as: AMOVB, a1: C_SAUTO, a4: C_REG, type_: 9, size: 8, param: REGSP},
+ {as: AMOVD, a1: C_SOREG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_SOREG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_SOREG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVBZ, a1: C_SOREG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVBZU, a1: C_SOREG, a4: C_REG, type_: 8, size: 4, param: REGZERO},
+ {as: AMOVB, a1: C_SOREG, a4: C_REG, type_: 9, size: 8, param: REGZERO},
+ {as: AMOVBU, a1: C_SOREG, a4: C_REG, type_: 9, size: 8, param: REGZERO},
/* store, long offset */
- {AMOVD, C_REG, C_NONE, C_NONE, C_LEXT, 35, 8, REGSB},
- {AMOVW, C_REG, C_NONE, C_NONE, C_LEXT, 35, 8, REGSB},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_LEXT, 35, 8, REGSB},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_LEXT, 35, 8, REGSB},
- {AMOVB, C_REG, C_NONE, C_NONE, C_LEXT, 35, 8, REGSB},
- {AMOVD, C_REG, C_NONE, C_NONE, C_LAUTO, 35, 8, REGSP},
- {AMOVW, C_REG, C_NONE, C_NONE, C_LAUTO, 35, 8, REGSP},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_LAUTO, 35, 8, REGSP},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_LAUTO, 35, 8, REGSP},
- {AMOVB, C_REG, C_NONE, C_NONE, C_LAUTO, 35, 8, REGSP},
- {AMOVD, C_REG, C_NONE, C_NONE, C_LOREG, 35, 8, REGZERO},
- {AMOVW, C_REG, C_NONE, C_NONE, C_LOREG, 35, 8, REGZERO},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_LOREG, 35, 8, REGZERO},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_LOREG, 35, 8, REGZERO},
- {AMOVB, C_REG, C_NONE, C_NONE, C_LOREG, 35, 8, REGZERO},
- {AMOVD, C_REG, C_NONE, C_NONE, C_ADDR, 74, 8, 0},
- {AMOVW, C_REG, C_NONE, C_NONE, C_ADDR, 74, 8, 0},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_ADDR, 74, 8, 0},
- {AMOVBZ, C_REG, C_NONE, C_NONE, C_ADDR, 74, 8, 0},
- {AMOVB, C_REG, C_NONE, C_NONE, C_ADDR, 74, 8, 0},
+ {as: AMOVD, a1: C_REG, a4: C_LEXT, type_: 35, size: 8, param: REGSB},
+ {as: AMOVW, a1: C_REG, a4: C_LEXT, type_: 35, size: 8, param: REGSB},
+ {as: AMOVWZ, a1: C_REG, a4: C_LEXT, type_: 35, size: 8, param: REGSB},
+ {as: AMOVBZ, a1: C_REG, a4: C_LEXT, type_: 35, size: 8, param: REGSB},
+ {as: AMOVB, a1: C_REG, a4: C_LEXT, type_: 35, size: 8, param: REGSB},
+ {as: AMOVD, a1: C_REG, a4: C_LAUTO, type_: 35, size: 8, param: REGSP},
+ {as: AMOVW, a1: C_REG, a4: C_LAUTO, type_: 35, size: 8, param: REGSP},
+ {as: AMOVWZ, a1: C_REG, a4: C_LAUTO, type_: 35, size: 8, param: REGSP},
+ {as: AMOVBZ, a1: C_REG, a4: C_LAUTO, type_: 35, size: 8, param: REGSP},
+ {as: AMOVB, a1: C_REG, a4: C_LAUTO, type_: 35, size: 8, param: REGSP},
+ {as: AMOVD, a1: C_REG, a4: C_LOREG, type_: 35, size: 8, param: REGZERO},
+ {as: AMOVW, a1: C_REG, a4: C_LOREG, type_: 35, size: 8, param: REGZERO},
+ {as: AMOVWZ, a1: C_REG, a4: C_LOREG, type_: 35, size: 8, param: REGZERO},
+ {as: AMOVBZ, a1: C_REG, a4: C_LOREG, type_: 35, size: 8, param: REGZERO},
+ {as: AMOVB, a1: C_REG, a4: C_LOREG, type_: 35, size: 8, param: REGZERO},
+ {as: AMOVD, a1: C_REG, a4: C_ADDR, type_: 74, size: 8},
+ {as: AMOVW, a1: C_REG, a4: C_ADDR, type_: 74, size: 8},
+ {as: AMOVWZ, a1: C_REG, a4: C_ADDR, type_: 74, size: 8},
+ {as: AMOVBZ, a1: C_REG, a4: C_ADDR, type_: 74, size: 8},
+ {as: AMOVB, a1: C_REG, a4: C_ADDR, type_: 74, size: 8},
/* load, long offset */
- {AMOVD, C_LEXT, C_NONE, C_NONE, C_REG, 36, 8, REGSB},
- {AMOVW, C_LEXT, C_NONE, C_NONE, C_REG, 36, 8, REGSB},
- {AMOVWZ, C_LEXT, C_NONE, C_NONE, C_REG, 36, 8, REGSB},
- {AMOVBZ, C_LEXT, C_NONE, C_NONE, C_REG, 36, 8, REGSB},
- {AMOVB, C_LEXT, C_NONE, C_NONE, C_REG, 37, 12, REGSB},
- {AMOVD, C_LAUTO, C_NONE, C_NONE, C_REG, 36, 8, REGSP},
- {AMOVW, C_LAUTO, C_NONE, C_NONE, C_REG, 36, 8, REGSP},
- {AMOVWZ, C_LAUTO, C_NONE, C_NONE, C_REG, 36, 8, REGSP},
- {AMOVBZ, C_LAUTO, C_NONE, C_NONE, C_REG, 36, 8, REGSP},
- {AMOVB, C_LAUTO, C_NONE, C_NONE, C_REG, 37, 12, REGSP},
- {AMOVD, C_LOREG, C_NONE, C_NONE, C_REG, 36, 8, REGZERO},
- {AMOVW, C_LOREG, C_NONE, C_NONE, C_REG, 36, 8, REGZERO},
- {AMOVWZ, C_LOREG, C_NONE, C_NONE, C_REG, 36, 8, REGZERO},
- {AMOVBZ, C_LOREG, C_NONE, C_NONE, C_REG, 36, 8, REGZERO},
- {AMOVB, C_LOREG, C_NONE, C_NONE, C_REG, 37, 12, REGZERO},
- {AMOVD, C_ADDR, C_NONE, C_NONE, C_REG, 75, 8, 0},
- {AMOVW, C_ADDR, C_NONE, C_NONE, C_REG, 75, 8, 0},
- {AMOVWZ, C_ADDR, C_NONE, C_NONE, C_REG, 75, 8, 0},
- {AMOVBZ, C_ADDR, C_NONE, C_NONE, C_REG, 75, 8, 0},
- {AMOVB, C_ADDR, C_NONE, C_NONE, C_REG, 76, 12, 0},
-
- {AMOVD, C_TLS_LE, C_NONE, C_NONE, C_REG, 79, 4, 0},
- {AMOVD, C_TLS_IE, C_NONE, C_NONE, C_REG, 80, 8, 0},
-
- {AMOVD, C_GOTADDR, C_NONE, C_NONE, C_REG, 81, 8, 0},
- {AMOVD, C_TOCADDR, C_NONE, C_NONE, C_REG, 95, 8, 0},
+ {as: AMOVD, a1: C_LEXT, a4: C_REG, type_: 36, size: 8, param: REGSB},
+ {as: AMOVW, a1: C_LEXT, a4: C_REG, type_: 36, size: 8, param: REGSB},
+ {as: AMOVWZ, a1: C_LEXT, a4: C_REG, type_: 36, size: 8, param: REGSB},
+ {as: AMOVBZ, a1: C_LEXT, a4: C_REG, type_: 36, size: 8, param: REGSB},
+ {as: AMOVB, a1: C_LEXT, a4: C_REG, type_: 37, size: 12, param: REGSB},
+ {as: AMOVD, a1: C_LAUTO, a4: C_REG, type_: 36, size: 8, param: REGSP},
+ {as: AMOVW, a1: C_LAUTO, a4: C_REG, type_: 36, size: 8, param: REGSP},
+ {as: AMOVWZ, a1: C_LAUTO, a4: C_REG, type_: 36, size: 8, param: REGSP},
+ {as: AMOVBZ, a1: C_LAUTO, a4: C_REG, type_: 36, size: 8, param: REGSP},
+ {as: AMOVB, a1: C_LAUTO, a4: C_REG, type_: 37, size: 12, param: REGSP},
+ {as: AMOVD, a1: C_LOREG, a4: C_REG, type_: 36, size: 8, param: REGZERO},
+ {as: AMOVW, a1: C_LOREG, a4: C_REG, type_: 36, size: 8, param: REGZERO},
+ {as: AMOVWZ, a1: C_LOREG, a4: C_REG, type_: 36, size: 8, param: REGZERO},
+ {as: AMOVBZ, a1: C_LOREG, a4: C_REG, type_: 36, size: 8, param: REGZERO},
+ {as: AMOVB, a1: C_LOREG, a4: C_REG, type_: 37, size: 12, param: REGZERO},
+ {as: AMOVD, a1: C_ADDR, a4: C_REG, type_: 75, size: 8},
+ {as: AMOVW, a1: C_ADDR, a4: C_REG, type_: 75, size: 8},
+ {as: AMOVWZ, a1: C_ADDR, a4: C_REG, type_: 75, size: 8},
+ {as: AMOVBZ, a1: C_ADDR, a4: C_REG, type_: 75, size: 8},
+ {as: AMOVB, a1: C_ADDR, a4: C_REG, type_: 76, size: 12},
+
+ {as: AMOVD, a1: C_TLS_LE, a4: C_REG, type_: 79, size: 4},
+ {as: AMOVD, a1: C_TLS_IE, a4: C_REG, type_: 80, size: 8},
+
+ {as: AMOVD, a1: C_GOTADDR, a4: C_REG, type_: 81, size: 8},
+ {as: AMOVD, a1: C_TOCADDR, a4: C_REG, type_: 95, size: 8},
/* load constant */
- {AMOVD, C_SECON, C_NONE, C_NONE, C_REG, 3, 4, REGSB},
- {AMOVD, C_SACON, C_NONE, C_NONE, C_REG, 3, 4, REGSP},
- {AMOVD, C_LECON, C_NONE, C_NONE, C_REG, 26, 8, REGSB},
- {AMOVD, C_LACON, C_NONE, C_NONE, C_REG, 26, 8, REGSP},
- {AMOVD, C_ADDCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVD, C_ANDCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVW, C_SECON, C_NONE, C_NONE, C_REG, 3, 4, REGSB}, /* TO DO: check */
- {AMOVW, C_SACON, C_NONE, C_NONE, C_REG, 3, 4, REGSP},
- {AMOVW, C_LECON, C_NONE, C_NONE, C_REG, 26, 8, REGSB},
- {AMOVW, C_LACON, C_NONE, C_NONE, C_REG, 26, 8, REGSP},
- {AMOVW, C_ADDCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVW, C_ANDCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVWZ, C_SECON, C_NONE, C_NONE, C_REG, 3, 4, REGSB}, /* TO DO: check */
- {AMOVWZ, C_SACON, C_NONE, C_NONE, C_REG, 3, 4, REGSP},
- {AMOVWZ, C_LECON, C_NONE, C_NONE, C_REG, 26, 8, REGSB},
- {AMOVWZ, C_LACON, C_NONE, C_NONE, C_REG, 26, 8, REGSP},
- {AMOVWZ, C_ADDCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVWZ, C_ANDCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
+ {as: AMOVD, a1: C_SECON, a4: C_REG, type_: 3, size: 4, param: REGSB},
+ {as: AMOVD, a1: C_SACON, a4: C_REG, type_: 3, size: 4, param: REGSP},
+ {as: AMOVD, a1: C_LECON, a4: C_REG, type_: 26, size: 8, param: REGSB},
+ {as: AMOVD, a1: C_LACON, a4: C_REG, type_: 26, size: 8, param: REGSP},
+ {as: AMOVD, a1: C_ADDCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVD, a1: C_ANDCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_SECON, a4: C_REG, type_: 3, size: 4, param: REGSB}, /* TO DO: check */
+ {as: AMOVW, a1: C_SACON, a4: C_REG, type_: 3, size: 4, param: REGSP},
+ {as: AMOVW, a1: C_LECON, a4: C_REG, type_: 26, size: 8, param: REGSB},
+ {as: AMOVW, a1: C_LACON, a4: C_REG, type_: 26, size: 8, param: REGSP},
+ {as: AMOVW, a1: C_ADDCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_ANDCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_SECON, a4: C_REG, type_: 3, size: 4, param: REGSB}, /* TO DO: check */
+ {as: AMOVWZ, a1: C_SACON, a4: C_REG, type_: 3, size: 4, param: REGSP},
+ {as: AMOVWZ, a1: C_LECON, a4: C_REG, type_: 26, size: 8, param: REGSB},
+ {as: AMOVWZ, a1: C_LACON, a4: C_REG, type_: 26, size: 8, param: REGSP},
+ {as: AMOVWZ, a1: C_ADDCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_ANDCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
/* load unsigned/long constants (TO DO: check) */
- {AMOVD, C_UCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVD, C_LCON, C_NONE, C_NONE, C_REG, 19, 8, 0},
- {AMOVW, C_UCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVW, C_LCON, C_NONE, C_NONE, C_REG, 19, 8, 0},
- {AMOVWZ, C_UCON, C_NONE, C_NONE, C_REG, 3, 4, REGZERO},
- {AMOVWZ, C_LCON, C_NONE, C_NONE, C_REG, 19, 8, 0},
- {AMOVHBR, C_ZOREG, C_REG, C_NONE, C_REG, 45, 4, 0},
- {AMOVHBR, C_ZOREG, C_NONE, C_NONE, C_REG, 45, 4, 0},
- {AMOVHBR, C_REG, C_REG, C_NONE, C_ZOREG, 44, 4, 0},
- {AMOVHBR, C_REG, C_NONE, C_NONE, C_ZOREG, 44, 4, 0},
- {ASYSCALL, C_NONE, C_NONE, C_NONE, C_NONE, 5, 4, 0},
- {ASYSCALL, C_REG, C_NONE, C_NONE, C_NONE, 77, 12, 0},
- {ASYSCALL, C_SCON, C_NONE, C_NONE, C_NONE, 77, 12, 0},
- {ABEQ, C_NONE, C_NONE, C_NONE, C_SBRA, 16, 4, 0},
- {ABEQ, C_CREG, C_NONE, C_NONE, C_SBRA, 16, 4, 0},
- {ABR, C_NONE, C_NONE, C_NONE, C_LBRA, 11, 4, 0},
- {ABR, C_NONE, C_NONE, C_NONE, C_LBRAPIC, 11, 8, 0},
- {ABC, C_SCON, C_REG, C_NONE, C_SBRA, 16, 4, 0},
- {ABC, C_SCON, C_REG, C_NONE, C_LBRA, 17, 4, 0},
- {ABR, C_NONE, C_NONE, C_NONE, C_LR, 18, 4, 0},
- {ABR, C_NONE, C_NONE, C_SCON, C_LR, 18, 4, 0},
- {ABR, C_NONE, C_NONE, C_NONE, C_CTR, 18, 4, 0},
- {ABR, C_REG, C_NONE, C_NONE, C_CTR, 18, 4, 0},
- {ABR, C_NONE, C_NONE, C_NONE, C_ZOREG, 15, 8, 0},
- {ABC, C_NONE, C_REG, C_NONE, C_LR, 18, 4, 0},
- {ABC, C_NONE, C_REG, C_NONE, C_CTR, 18, 4, 0},
- {ABC, C_SCON, C_REG, C_NONE, C_LR, 18, 4, 0},
- {ABC, C_SCON, C_REG, C_NONE, C_CTR, 18, 4, 0},
- {ABC, C_NONE, C_NONE, C_NONE, C_ZOREG, 15, 8, 0},
- {AFMOVD, C_SEXT, C_NONE, C_NONE, C_FREG, 8, 4, REGSB},
- {AFMOVD, C_SAUTO, C_NONE, C_NONE, C_FREG, 8, 4, REGSP},
- {AFMOVD, C_SOREG, C_NONE, C_NONE, C_FREG, 8, 4, REGZERO},
- {AFMOVD, C_LEXT, C_NONE, C_NONE, C_FREG, 36, 8, REGSB},
- {AFMOVD, C_LAUTO, C_NONE, C_NONE, C_FREG, 36, 8, REGSP},
- {AFMOVD, C_LOREG, C_NONE, C_NONE, C_FREG, 36, 8, REGZERO},
- {AFMOVD, C_ZCON, C_NONE, C_NONE, C_FREG, 24, 4, 0},
- {AFMOVD, C_ADDCON, C_NONE, C_NONE, C_FREG, 24, 8, 0},
- {AFMOVD, C_ADDR, C_NONE, C_NONE, C_FREG, 75, 8, 0},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_SEXT, 7, 4, REGSB},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_SAUTO, 7, 4, REGSP},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_SOREG, 7, 4, REGZERO},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_LEXT, 35, 8, REGSB},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_LAUTO, 35, 8, REGSP},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_LOREG, 35, 8, REGZERO},
- {AFMOVD, C_FREG, C_NONE, C_NONE, C_ADDR, 74, 8, 0},
- {AFMOVSX, C_ZOREG, C_REG, C_NONE, C_FREG, 45, 4, 0},
- {AFMOVSX, C_ZOREG, C_NONE, C_NONE, C_FREG, 45, 4, 0},
- {AFMOVSX, C_FREG, C_REG, C_NONE, C_ZOREG, 44, 4, 0},
- {AFMOVSX, C_FREG, C_NONE, C_NONE, C_ZOREG, 44, 4, 0},
- {AFMOVSZ, C_ZOREG, C_REG, C_NONE, C_FREG, 45, 4, 0},
- {AFMOVSZ, C_ZOREG, C_NONE, C_NONE, C_FREG, 45, 4, 0},
- {ASYNC, C_NONE, C_NONE, C_NONE, C_NONE, 46, 4, 0},
- {AWORD, C_LCON, C_NONE, C_NONE, C_NONE, 40, 4, 0},
- {ADWORD, C_LCON, C_NONE, C_NONE, C_NONE, 31, 8, 0},
- {ADWORD, C_DCON, C_NONE, C_NONE, C_NONE, 31, 8, 0},
- {AADDME, C_REG, C_NONE, C_NONE, C_REG, 47, 4, 0},
- {AEXTSB, C_REG, C_NONE, C_NONE, C_REG, 48, 4, 0},
- {AEXTSB, C_NONE, C_NONE, C_NONE, C_REG, 48, 4, 0},
- {AISEL, C_LCON, C_REG, C_REG, C_REG, 84, 4, 0},
- {AISEL, C_ZCON, C_REG, C_REG, C_REG, 84, 4, 0},
- {ANEG, C_REG, C_NONE, C_NONE, C_REG, 47, 4, 0},
- {ANEG, C_NONE, C_NONE, C_NONE, C_REG, 47, 4, 0},
- {AREM, C_REG, C_NONE, C_NONE, C_REG, 50, 12, 0},
- {AREM, C_REG, C_REG, C_NONE, C_REG, 50, 12, 0},
- {AREMU, C_REG, C_NONE, C_NONE, C_REG, 50, 16, 0},
- {AREMU, C_REG, C_REG, C_NONE, C_REG, 50, 16, 0},
- {AREMD, C_REG, C_NONE, C_NONE, C_REG, 51, 12, 0},
- {AREMD, C_REG, C_REG, C_NONE, C_REG, 51, 12, 0},
- {AMTFSB0, C_SCON, C_NONE, C_NONE, C_NONE, 52, 4, 0},
- {AMOVFL, C_FPSCR, C_NONE, C_NONE, C_FREG, 53, 4, 0},
- {AMOVFL, C_FREG, C_NONE, C_NONE, C_FPSCR, 64, 4, 0},
- {AMOVFL, C_FREG, C_NONE, C_LCON, C_FPSCR, 64, 4, 0},
- {AMOVFL, C_LCON, C_NONE, C_NONE, C_FPSCR, 65, 4, 0},
- {AMOVD, C_MSR, C_NONE, C_NONE, C_REG, 54, 4, 0}, /* mfmsr */
- {AMOVD, C_REG, C_NONE, C_NONE, C_MSR, 54, 4, 0}, /* mtmsrd */
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_MSR, 54, 4, 0}, /* mtmsr */
+ {as: AMOVD, a1: C_UCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVD, a1: C_LCON, a4: C_REG, type_: 19, size: 8},
+ {as: AMOVW, a1: C_UCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVW, a1: C_LCON, a4: C_REG, type_: 19, size: 8},
+ {as: AMOVWZ, a1: C_UCON, a4: C_REG, type_: 3, size: 4, param: REGZERO},
+ {as: AMOVWZ, a1: C_LCON, a4: C_REG, type_: 19, size: 8},
+ {as: AMOVHBR, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 45, size: 4},
+ {as: AMOVHBR, a1: C_ZOREG, a4: C_REG, type_: 45, size: 4},
+ {as: AMOVHBR, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: AMOVHBR, a1: C_REG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: ASYSCALL, type_: 5, size: 4},
+ {as: ASYSCALL, a1: C_REG, type_: 77, size: 12},
+ {as: ASYSCALL, a1: C_SCON, type_: 77, size: 12},
+ {as: ABEQ, a4: C_SBRA, type_: 16, size: 4},
+ {as: ABEQ, a1: C_CREG, a4: C_SBRA, type_: 16, size: 4},
+ {as: ABR, a4: C_LBRA, type_: 11, size: 4},
+ {as: ABR, a4: C_LBRAPIC, type_: 11, size: 8},
+ {as: ABC, a1: C_SCON, a2: C_REG, a4: C_SBRA, type_: 16, size: 4},
+ {as: ABC, a1: C_SCON, a2: C_REG, a4: C_LBRA, type_: 17, size: 4},
+ {as: ABR, a4: C_LR, type_: 18, size: 4},
+ {as: ABR, a3: C_SCON, a4: C_LR, type_: 18, size: 4},
+ {as: ABR, a4: C_CTR, type_: 18, size: 4},
+ {as: ABR, a1: C_REG, a4: C_CTR, type_: 18, size: 4},
+ {as: ABR, a4: C_ZOREG, type_: 15, size: 8},
+ {as: ABC, a2: C_REG, a4: C_LR, type_: 18, size: 4},
+ {as: ABC, a2: C_REG, a4: C_CTR, type_: 18, size: 4},
+ {as: ABC, a1: C_SCON, a2: C_REG, a4: C_LR, type_: 18, size: 4},
+ {as: ABC, a1: C_SCON, a2: C_REG, a4: C_CTR, type_: 18, size: 4},
+ {as: ABC, a4: C_ZOREG, type_: 15, size: 8},
+ {as: AFMOVD, a1: C_SEXT, a4: C_FREG, type_: 8, size: 4, param: REGSB},
+ {as: AFMOVD, a1: C_SAUTO, a4: C_FREG, type_: 8, size: 4, param: REGSP},
+ {as: AFMOVD, a1: C_SOREG, a4: C_FREG, type_: 8, size: 4, param: REGZERO},
+ {as: AFMOVD, a1: C_LEXT, a4: C_FREG, type_: 36, size: 8, param: REGSB},
+ {as: AFMOVD, a1: C_LAUTO, a4: C_FREG, type_: 36, size: 8, param: REGSP},
+ {as: AFMOVD, a1: C_LOREG, a4: C_FREG, type_: 36, size: 8, param: REGZERO},
+ {as: AFMOVD, a1: C_ZCON, a4: C_FREG, type_: 24, size: 4},
+ {as: AFMOVD, a1: C_ADDCON, a4: C_FREG, type_: 24, size: 8},
+ {as: AFMOVD, a1: C_ADDR, a4: C_FREG, type_: 75, size: 8},
+ {as: AFMOVD, a1: C_FREG, a4: C_SEXT, type_: 7, size: 4, param: REGSB},
+ {as: AFMOVD, a1: C_FREG, a4: C_SAUTO, type_: 7, size: 4, param: REGSP},
+ {as: AFMOVD, a1: C_FREG, a4: C_SOREG, type_: 7, size: 4, param: REGZERO},
+ {as: AFMOVD, a1: C_FREG, a4: C_LEXT, type_: 35, size: 8, param: REGSB},
+ {as: AFMOVD, a1: C_FREG, a4: C_LAUTO, type_: 35, size: 8, param: REGSP},
+ {as: AFMOVD, a1: C_FREG, a4: C_LOREG, type_: 35, size: 8, param: REGZERO},
+ {as: AFMOVD, a1: C_FREG, a4: C_ADDR, type_: 74, size: 8},
+ {as: AFMOVSX, a1: C_ZOREG, a2: C_REG, a4: C_FREG, type_: 45, size: 4},
+ {as: AFMOVSX, a1: C_ZOREG, a4: C_FREG, type_: 45, size: 4},
+ {as: AFMOVSX, a1: C_FREG, a2: C_REG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: AFMOVSX, a1: C_FREG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: AFMOVSZ, a1: C_ZOREG, a2: C_REG, a4: C_FREG, type_: 45, size: 4},
+ {as: AFMOVSZ, a1: C_ZOREG, a4: C_FREG, type_: 45, size: 4},
+ {as: ASYNC, type_: 46, size: 4},
+ {as: AWORD, a1: C_LCON, type_: 40, size: 4},
+ {as: ADWORD, a1: C_LCON, type_: 31, size: 8},
+ {as: ADWORD, a1: C_DCON, type_: 31, size: 8},
+ {as: AADDME, a1: C_REG, a4: C_REG, type_: 47, size: 4},
+ {as: AEXTSB, a1: C_REG, a4: C_REG, type_: 48, size: 4},
+ {as: AEXTSB, a4: C_REG, type_: 48, size: 4},
+ {as: AISEL, a1: C_LCON, a2: C_REG, a3: C_REG, a4: C_REG, type_: 84, size: 4},
+ {as: AISEL, a1: C_ZCON, a2: C_REG, a3: C_REG, a4: C_REG, type_: 84, size: 4},
+ {as: ANEG, a1: C_REG, a4: C_REG, type_: 47, size: 4},
+ {as: ANEG, a4: C_REG, type_: 47, size: 4},
+ {as: AREM, a1: C_REG, a4: C_REG, type_: 50, size: 12},
+ {as: AREM, a1: C_REG, a2: C_REG, a4: C_REG, type_: 50, size: 12},
+ {as: AREMU, a1: C_REG, a4: C_REG, type_: 50, size: 16},
+ {as: AREMU, a1: C_REG, a2: C_REG, a4: C_REG, type_: 50, size: 16},
+ {as: AREMD, a1: C_REG, a4: C_REG, type_: 51, size: 12},
+ {as: AREMD, a1: C_REG, a2: C_REG, a4: C_REG, type_: 51, size: 12},
+ {as: AMTFSB0, a1: C_SCON, type_: 52, size: 4},
+ {as: AMOVFL, a1: C_FPSCR, a4: C_FREG, type_: 53, size: 4},
+ {as: AMOVFL, a1: C_FREG, a4: C_FPSCR, type_: 64, size: 4},
+ {as: AMOVFL, a1: C_FREG, a3: C_LCON, a4: C_FPSCR, type_: 64, size: 4},
+ {as: AMOVFL, a1: C_LCON, a4: C_FPSCR, type_: 65, size: 4},
+ {as: AMOVD, a1: C_MSR, a4: C_REG, type_: 54, size: 4}, /* mfmsr */
+ {as: AMOVD, a1: C_REG, a4: C_MSR, type_: 54, size: 4}, /* mtmsrd */
+ {as: AMOVWZ, a1: C_REG, a4: C_MSR, type_: 54, size: 4}, /* mtmsr */
/* Other ISA 2.05+ instructions */
- {APOPCNTD, C_REG, C_NONE, C_NONE, C_REG, 93, 4, 0}, /* population count, x-form */
- {ACMPB, C_REG, C_REG, C_NONE, C_REG, 92, 4, 0}, /* compare byte, x-form */
- {ACMPEQB, C_REG, C_REG, C_NONE, C_CREG, 92, 4, 0}, /* compare equal byte, x-form, ISA 3.0 */
- {ACMPEQB, C_REG, C_NONE, C_NONE, C_REG, 70, 4, 0},
- {AFTDIV, C_FREG, C_FREG, C_NONE, C_SCON, 92, 4, 0}, /* floating test for sw divide, x-form */
- {AFTSQRT, C_FREG, C_NONE, C_NONE, C_SCON, 93, 4, 0}, /* floating test for sw square root, x-form */
- {ACOPY, C_REG, C_NONE, C_NONE, C_REG, 92, 4, 0}, /* copy/paste facility, x-form */
- {ADARN, C_SCON, C_NONE, C_NONE, C_REG, 92, 4, 0}, /* deliver random number, x-form */
- {ALDMX, C_SOREG, C_NONE, C_NONE, C_REG, 45, 4, 0}, /* load doubleword monitored, x-form */
- {AMADDHD, C_REG, C_REG, C_REG, C_REG, 83, 4, 0}, /* multiply-add high/low doubleword, va-form */
- {AADDEX, C_REG, C_REG, C_SCON, C_REG, 94, 4, 0}, /* add extended using alternate carry, z23-form */
- {ACRAND, C_CREG, C_NONE, C_NONE, C_CREG, 2, 4, 0}, /* logical ops for condition registers xl-form */
+ {as: APOPCNTD, a1: C_REG, a4: C_REG, type_: 93, size: 4}, /* population count, x-form */
+ {as: ACMPB, a1: C_REG, a2: C_REG, a4: C_REG, type_: 92, size: 4}, /* compare byte, x-form */
+ {as: ACMPEQB, a1: C_REG, a2: C_REG, a4: C_CREG, type_: 92, size: 4}, /* compare equal byte, x-form, ISA 3.0 */
+ {as: ACMPEQB, a1: C_REG, a4: C_REG, type_: 70, size: 4},
+ {as: AFTDIV, a1: C_FREG, a2: C_FREG, a4: C_SCON, type_: 92, size: 4}, /* floating test for sw divide, x-form */
+ {as: AFTSQRT, a1: C_FREG, a4: C_SCON, type_: 93, size: 4}, /* floating test for sw square root, x-form */
+ {as: ACOPY, a1: C_REG, a4: C_REG, type_: 92, size: 4}, /* copy/paste facility, x-form */
+ {as: ADARN, a1: C_SCON, a4: C_REG, type_: 92, size: 4}, /* deliver random number, x-form */
+ {as: ALDMX, a1: C_SOREG, a4: C_REG, type_: 45, size: 4}, /* load doubleword monitored, x-form */
+ {as: AMADDHD, a1: C_REG, a2: C_REG, a3: C_REG, a4: C_REG, type_: 83, size: 4}, /* multiply-add high/low doubleword, va-form */
+ {as: AADDEX, a1: C_REG, a2: C_REG, a3: C_SCON, a4: C_REG, type_: 94, size: 4}, /* add extended using alternate carry, z23-form */
+ {as: ACRAND, a1: C_CREG, a4: C_CREG, type_: 2, size: 4}, /* logical ops for condition registers xl-form */
/* Vector instructions */
/* Vector load */
- {ALV, C_SOREG, C_NONE, C_NONE, C_VREG, 45, 4, 0}, /* vector load, x-form */
+ {as: ALV, a1: C_SOREG, a4: C_VREG, type_: 45, size: 4}, /* vector load, x-form */
/* Vector store */
- {ASTV, C_VREG, C_NONE, C_NONE, C_SOREG, 44, 4, 0}, /* vector store, x-form */
+ {as: ASTV, a1: C_VREG, a4: C_SOREG, type_: 44, size: 4}, /* vector store, x-form */
/* Vector logical */
- {AVAND, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector and, vx-form */
- {AVOR, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector or, vx-form */
+ {as: AVAND, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector and, vx-form */
+ {as: AVOR, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector or, vx-form */
/* Vector add */
- {AVADDUM, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector add unsigned modulo, vx-form */
- {AVADDCU, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector add & write carry unsigned, vx-form */
- {AVADDUS, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector add unsigned saturate, vx-form */
- {AVADDSS, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector add signed saturate, vx-form */
- {AVADDE, C_VREG, C_VREG, C_VREG, C_VREG, 83, 4, 0}, /* vector add extended, va-form */
+ {as: AVADDUM, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector add unsigned modulo, vx-form */
+ {as: AVADDCU, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector add & write carry unsigned, vx-form */
+ {as: AVADDUS, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector add unsigned saturate, vx-form */
+ {as: AVADDSS, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector add signed saturate, vx-form */
+ {as: AVADDE, a1: C_VREG, a2: C_VREG, a3: C_VREG, a4: C_VREG, type_: 83, size: 4}, /* vector add extended, va-form */
/* Vector subtract */
- {AVSUBUM, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector subtract unsigned modulo, vx-form */
- {AVSUBCU, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector subtract & write carry unsigned, vx-form */
- {AVSUBUS, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector subtract unsigned saturate, vx-form */
- {AVSUBSS, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector subtract signed saturate, vx-form */
- {AVSUBE, C_VREG, C_VREG, C_VREG, C_VREG, 83, 4, 0}, /* vector subtract extended, va-form */
+ {as: AVSUBUM, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector subtract unsigned modulo, vx-form */
+ {as: AVSUBCU, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector subtract & write carry unsigned, vx-form */
+ {as: AVSUBUS, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector subtract unsigned saturate, vx-form */
+ {as: AVSUBSS, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector subtract signed saturate, vx-form */
+ {as: AVSUBE, a1: C_VREG, a2: C_VREG, a3: C_VREG, a4: C_VREG, type_: 83, size: 4}, /* vector subtract extended, va-form */
/* Vector multiply */
- {AVMULESB, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 9}, /* vector multiply, vx-form */
- {AVPMSUM, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector polynomial multiply & sum, vx-form */
- {AVMSUMUDM, C_VREG, C_VREG, C_VREG, C_VREG, 83, 4, 0}, /* vector multiply-sum, va-form */
+ {as: AVMULESB, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4, param: 9}, /* vector multiply, vx-form */
+ {as: AVPMSUM, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector polynomial multiply & sum, vx-form */
+ {as: AVMSUMUDM, a1: C_VREG, a2: C_VREG, a3: C_VREG, a4: C_VREG, type_: 83, size: 4}, /* vector multiply-sum, va-form */
/* Vector rotate */
- {AVR, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector rotate, vx-form */
+ {as: AVR, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector rotate, vx-form */
/* Vector shift */
- {AVS, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector shift, vx-form */
- {AVSA, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector shift algebraic, vx-form */
- {AVSOI, C_ANDCON, C_VREG, C_VREG, C_VREG, 83, 4, 0}, /* vector shift by octet immediate, va-form */
+ {as: AVS, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector shift, vx-form */
+ {as: AVSA, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector shift algebraic, vx-form */
+ {as: AVSOI, a1: C_ANDCON, a2: C_VREG, a3: C_VREG, a4: C_VREG, type_: 83, size: 4}, /* vector shift by octet immediate, va-form */
/* Vector count */
- {AVCLZ, C_VREG, C_NONE, C_NONE, C_VREG, 85, 4, 0}, /* vector count leading zeros, vx-form */
- {AVPOPCNT, C_VREG, C_NONE, C_NONE, C_VREG, 85, 4, 0}, /* vector population count, vx-form */
+ {as: AVCLZ, a1: C_VREG, a4: C_VREG, type_: 85, size: 4}, /* vector count leading zeros, vx-form */
+ {as: AVPOPCNT, a1: C_VREG, a4: C_VREG, type_: 85, size: 4}, /* vector population count, vx-form */
/* Vector compare */
- {AVCMPEQ, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector compare equal, vc-form */
- {AVCMPGT, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector compare greater than, vc-form */
- {AVCMPNEZB, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector compare not equal, vx-form */
+ {as: AVCMPEQ, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector compare equal, vc-form */
+ {as: AVCMPGT, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector compare greater than, vc-form */
+ {as: AVCMPNEZB, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector compare not equal, vx-form */
/* Vector merge */
- {AVMRGOW, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector merge odd word, vx-form */
+ {as: AVMRGOW, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector merge odd word, vx-form */
/* Vector permute */
- {AVPERM, C_VREG, C_VREG, C_VREG, C_VREG, 83, 4, 0}, /* vector permute, va-form */
+ {as: AVPERM, a1: C_VREG, a2: C_VREG, a3: C_VREG, a4: C_VREG, type_: 83, size: 4}, /* vector permute, va-form */
/* Vector bit permute */
- {AVBPERMQ, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector bit permute, vx-form */
+ {as: AVBPERMQ, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector bit permute, vx-form */
/* Vector select */
- {AVSEL, C_VREG, C_VREG, C_VREG, C_VREG, 83, 4, 0}, /* vector select, va-form */
+ {as: AVSEL, a1: C_VREG, a2: C_VREG, a3: C_VREG, a4: C_VREG, type_: 83, size: 4}, /* vector select, va-form */
/* Vector splat */
- {AVSPLTB, C_SCON, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector splat, vx-form */
- {AVSPLTB, C_ADDCON, C_VREG, C_NONE, C_VREG, 82, 4, 0},
- {AVSPLTISB, C_SCON, C_NONE, C_NONE, C_VREG, 82, 4, 0}, /* vector splat immediate, vx-form */
- {AVSPLTISB, C_ADDCON, C_NONE, C_NONE, C_VREG, 82, 4, 0},
+ {as: AVSPLTB, a1: C_SCON, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector splat, vx-form */
+ {as: AVSPLTB, a1: C_ADDCON, a2: C_VREG, a4: C_VREG, type_: 82, size: 4},
+ {as: AVSPLTISB, a1: C_SCON, a4: C_VREG, type_: 82, size: 4}, /* vector splat immediate, vx-form */
+ {as: AVSPLTISB, a1: C_ADDCON, a4: C_VREG, type_: 82, size: 4},
/* Vector AES */
- {AVCIPH, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector AES cipher, vx-form */
- {AVNCIPH, C_VREG, C_VREG, C_NONE, C_VREG, 82, 4, 0}, /* vector AES inverse cipher, vx-form */
- {AVSBOX, C_VREG, C_NONE, C_NONE, C_VREG, 82, 4, 0}, /* vector AES subbytes, vx-form */
+ {as: AVCIPH, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector AES cipher, vx-form */
+ {as: AVNCIPH, a1: C_VREG, a2: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector AES inverse cipher, vx-form */
+ {as: AVSBOX, a1: C_VREG, a4: C_VREG, type_: 82, size: 4}, /* vector AES subbytes, vx-form */
/* Vector SHA */
- {AVSHASIGMA, C_ANDCON, C_VREG, C_ANDCON, C_VREG, 82, 4, 0}, /* vector SHA sigma, vx-form */
+ {as: AVSHASIGMA, a1: C_ANDCON, a2: C_VREG, a3: C_ANDCON, a4: C_VREG, type_: 82, size: 4}, /* vector SHA sigma, vx-form */
/* VSX vector load */
- {ALXVD2X, C_SOREG, C_NONE, C_NONE, C_VSREG, 87, 4, 0}, /* vsx vector load, xx1-form */
- {ALXV, C_SOREG, C_NONE, C_NONE, C_VSREG, 96, 4, 0}, /* vsx vector load, dq-form */
- {ALXVL, C_REG, C_REG, C_NONE, C_VSREG, 98, 4, 0}, /* vsx vector load length */
+ {as: ALXVD2X, a1: C_SOREG, a4: C_VSREG, type_: 87, size: 4}, /* vsx vector load, xx1-form */
+ {as: ALXV, a1: C_SOREG, a4: C_VSREG, type_: 96, size: 4}, /* vsx vector load, dq-form */
+ {as: ALXVL, a1: C_REG, a2: C_REG, a4: C_VSREG, type_: 98, size: 4}, /* vsx vector load length */
/* VSX vector store */
- {ASTXVD2X, C_VSREG, C_NONE, C_NONE, C_SOREG, 86, 4, 0}, /* vsx vector store, xx1-form */
- {ASTXV, C_VSREG, C_NONE, C_NONE, C_SOREG, 97, 4, 0}, /* vsx vector store, dq-form */
- {ASTXVL, C_VSREG, C_REG, C_NONE, C_REG, 99, 4, 0}, /* vsx vector store with length x-form */
+ {as: ASTXVD2X, a1: C_VSREG, a4: C_SOREG, type_: 86, size: 4}, /* vsx vector store, xx1-form */
+ {as: ASTXV, a1: C_VSREG, a4: C_SOREG, type_: 97, size: 4}, /* vsx vector store, dq-form */
+ {as: ASTXVL, a1: C_VSREG, a2: C_REG, a4: C_REG, type_: 99, size: 4}, /* vsx vector store with length x-form */
/* VSX scalar load */
- {ALXSDX, C_SOREG, C_NONE, C_NONE, C_VSREG, 87, 4, 0}, /* vsx scalar load, xx1-form */
+ {as: ALXSDX, a1: C_SOREG, a4: C_VSREG, type_: 87, size: 4}, /* vsx scalar load, xx1-form */
/* VSX scalar store */
- {ASTXSDX, C_VSREG, C_NONE, C_NONE, C_SOREG, 86, 4, 0}, /* vsx scalar store, xx1-form */
+ {as: ASTXSDX, a1: C_VSREG, a4: C_SOREG, type_: 86, size: 4}, /* vsx scalar store, xx1-form */
/* VSX scalar as integer load */
- {ALXSIWAX, C_SOREG, C_NONE, C_NONE, C_VSREG, 87, 4, 0}, /* vsx scalar as integer load, xx1-form */
+ {as: ALXSIWAX, a1: C_SOREG, a4: C_VSREG, type_: 87, size: 4}, /* vsx scalar as integer load, xx1-form */
/* VSX scalar store as integer */
- {ASTXSIWX, C_VSREG, C_NONE, C_NONE, C_SOREG, 86, 4, 0}, /* vsx scalar as integer store, xx1-form */
+ {as: ASTXSIWX, a1: C_VSREG, a4: C_SOREG, type_: 86, size: 4}, /* vsx scalar as integer store, xx1-form */
/* VSX move from VSR */
- {AMFVSRD, C_VSREG, C_NONE, C_NONE, C_REG, 88, 4, 0}, /* vsx move from vsr, xx1-form */
- {AMFVSRD, C_FREG, C_NONE, C_NONE, C_REG, 88, 4, 0},
- {AMFVSRD, C_VREG, C_NONE, C_NONE, C_REG, 88, 4, 0},
+ {as: AMFVSRD, a1: C_VSREG, a4: C_REG, type_: 88, size: 4}, /* vsx move from vsr, xx1-form */
+ {as: AMFVSRD, a1: C_FREG, a4: C_REG, type_: 88, size: 4},
+ {as: AMFVSRD, a1: C_VREG, a4: C_REG, type_: 88, size: 4},
/* VSX move to VSR */
- {AMTVSRD, C_REG, C_NONE, C_NONE, C_VSREG, 88, 4, 0}, /* vsx move to vsr, xx1-form */
- {AMTVSRD, C_REG, C_REG, C_NONE, C_VSREG, 88, 4, 0},
- {AMTVSRD, C_REG, C_NONE, C_NONE, C_FREG, 88, 4, 0},
- {AMTVSRD, C_REG, C_NONE, C_NONE, C_VREG, 88, 4, 0},
+ {as: AMTVSRD, a1: C_REG, a4: C_VSREG, type_: 88, size: 4}, /* vsx move to vsr, xx1-form */
+ {as: AMTVSRD, a1: C_REG, a2: C_REG, a4: C_VSREG, type_: 88, size: 4},
+ {as: AMTVSRD, a1: C_REG, a4: C_FREG, type_: 88, size: 4},
+ {as: AMTVSRD, a1: C_REG, a4: C_VREG, type_: 88, size: 4},
/* VSX logical */
- {AXXLAND, C_VSREG, C_VSREG, C_NONE, C_VSREG, 90, 4, 0}, /* vsx and, xx3-form */
- {AXXLOR, C_VSREG, C_VSREG, C_NONE, C_VSREG, 90, 4, 0}, /* vsx or, xx3-form */
+ {as: AXXLAND, a1: C_VSREG, a2: C_VSREG, a4: C_VSREG, type_: 90, size: 4}, /* vsx and, xx3-form */
+ {as: AXXLOR, a1: C_VSREG, a2: C_VSREG, a4: C_VSREG, type_: 90, size: 4}, /* vsx or, xx3-form */
/* VSX select */
- {AXXSEL, C_VSREG, C_VSREG, C_VSREG, C_VSREG, 91, 4, 0}, /* vsx select, xx4-form */
+ {as: AXXSEL, a1: C_VSREG, a2: C_VSREG, a3: C_VSREG, a4: C_VSREG, type_: 91, size: 4}, /* vsx select, xx4-form */
/* VSX merge */
- {AXXMRGHW, C_VSREG, C_VSREG, C_NONE, C_VSREG, 90, 4, 0}, /* vsx merge, xx3-form */
+ {as: AXXMRGHW, a1: C_VSREG, a2: C_VSREG, a4: C_VSREG, type_: 90, size: 4}, /* vsx merge, xx3-form */
/* VSX splat */
- {AXXSPLTW, C_VSREG, C_NONE, C_SCON, C_VSREG, 89, 4, 0}, /* vsx splat, xx2-form */
- {AXXSPLTIB, C_SCON, C_NONE, C_NONE, C_VSREG, 100, 4, 0}, /* vsx splat, xx2-form */
+ {as: AXXSPLTW, a1: C_VSREG, a3: C_SCON, a4: C_VSREG, type_: 89, size: 4}, /* vsx splat, xx2-form */
+ {as: AXXSPLTIB, a1: C_SCON, a4: C_VSREG, type_: 100, size: 4}, /* vsx splat, xx2-form */
/* VSX permute */
- {AXXPERM, C_VSREG, C_VSREG, C_NONE, C_VSREG, 90, 4, 0}, /* vsx permute, xx3-form */
+ {as: AXXPERM, a1: C_VSREG, a2: C_VSREG, a4: C_VSREG, type_: 90, size: 4}, /* vsx permute, xx3-form */
/* VSX shift */
- {AXXSLDWI, C_VSREG, C_VSREG, C_SCON, C_VSREG, 90, 4, 0}, /* vsx shift immediate, xx3-form */
+ {as: AXXSLDWI, a1: C_VSREG, a2: C_VSREG, a3: C_SCON, a4: C_VSREG, type_: 90, size: 4}, /* vsx shift immediate, xx3-form */
/* VSX reverse bytes */
- {AXXBRQ, C_VSREG, C_NONE, C_NONE, C_VSREG, 101, 4, 0}, /* vsx reverse bytes */
+ {as: AXXBRQ, a1: C_VSREG, a4: C_VSREG, type_: 101, size: 4}, /* vsx reverse bytes */
/* VSX scalar FP-FP conversion */
- {AXSCVDPSP, C_VSREG, C_NONE, C_NONE, C_VSREG, 89, 4, 0}, /* vsx scalar fp-fp conversion, xx2-form */
+ {as: AXSCVDPSP, a1: C_VSREG, a4: C_VSREG, type_: 89, size: 4}, /* vsx scalar fp-fp conversion, xx2-form */
/* VSX vector FP-FP conversion */
- {AXVCVDPSP, C_VSREG, C_NONE, C_NONE, C_VSREG, 89, 4, 0}, /* vsx vector fp-fp conversion, xx2-form */
+ {as: AXVCVDPSP, a1: C_VSREG, a4: C_VSREG, type_: 89, size: 4}, /* vsx vector fp-fp conversion, xx2-form */
/* VSX scalar FP-integer conversion */
- {AXSCVDPSXDS, C_VSREG, C_NONE, C_NONE, C_VSREG, 89, 4, 0}, /* vsx scalar fp-integer conversion, xx2-form */
+ {as: AXSCVDPSXDS, a1: C_VSREG, a4: C_VSREG, type_: 89, size: 4}, /* vsx scalar fp-integer conversion, xx2-form */
/* VSX scalar integer-FP conversion */
- {AXSCVSXDDP, C_VSREG, C_NONE, C_NONE, C_VSREG, 89, 4, 0}, /* vsx scalar integer-fp conversion, xx2-form */
+ {as: AXSCVSXDDP, a1: C_VSREG, a4: C_VSREG, type_: 89, size: 4}, /* vsx scalar integer-fp conversion, xx2-form */
/* VSX vector FP-integer conversion */
- {AXVCVDPSXDS, C_VSREG, C_NONE, C_NONE, C_VSREG, 89, 4, 0}, /* vsx vector fp-integer conversion, xx2-form */
+ {as: AXVCVDPSXDS, a1: C_VSREG, a4: C_VSREG, type_: 89, size: 4}, /* vsx vector fp-integer conversion, xx2-form */
/* VSX vector integer-FP conversion */
- {AXVCVSXDDP, C_VSREG, C_NONE, C_NONE, C_VSREG, 89, 4, 0}, /* vsx vector integer-fp conversion, xx2-form */
+ {as: AXVCVSXDDP, a1: C_VSREG, a4: C_VSREG, type_: 89, size: 4}, /* vsx vector integer-fp conversion, xx2-form */
/* 64-bit special registers */
- {AMOVD, C_REG, C_NONE, C_NONE, C_SPR, 66, 4, 0},
- {AMOVD, C_REG, C_NONE, C_NONE, C_LR, 66, 4, 0},
- {AMOVD, C_REG, C_NONE, C_NONE, C_CTR, 66, 4, 0},
- {AMOVD, C_REG, C_NONE, C_NONE, C_XER, 66, 4, 0},
- {AMOVD, C_SPR, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVD, C_LR, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVD, C_CTR, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVD, C_XER, C_NONE, C_NONE, C_REG, 66, 4, 0},
+ {as: AMOVD, a1: C_REG, a4: C_SPR, type_: 66, size: 4},
+ {as: AMOVD, a1: C_REG, a4: C_LR, type_: 66, size: 4},
+ {as: AMOVD, a1: C_REG, a4: C_CTR, type_: 66, size: 4},
+ {as: AMOVD, a1: C_REG, a4: C_XER, type_: 66, size: 4},
+ {as: AMOVD, a1: C_SPR, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVD, a1: C_LR, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVD, a1: C_CTR, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVD, a1: C_XER, a4: C_REG, type_: 66, size: 4},
/* 32-bit special registers (gloss over sign-extension or not?) */
- {AMOVW, C_REG, C_NONE, C_NONE, C_SPR, 66, 4, 0},
- {AMOVW, C_REG, C_NONE, C_NONE, C_CTR, 66, 4, 0},
- {AMOVW, C_REG, C_NONE, C_NONE, C_XER, 66, 4, 0},
- {AMOVW, C_SPR, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVW, C_XER, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_SPR, 66, 4, 0},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_CTR, 66, 4, 0},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_XER, 66, 4, 0},
- {AMOVWZ, C_SPR, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVWZ, C_XER, C_NONE, C_NONE, C_REG, 66, 4, 0},
- {AMOVFL, C_FPSCR, C_NONE, C_NONE, C_CREG, 73, 4, 0},
- {AMOVFL, C_CREG, C_NONE, C_NONE, C_CREG, 67, 4, 0},
- {AMOVW, C_CREG, C_NONE, C_NONE, C_REG, 68, 4, 0},
- {AMOVWZ, C_CREG, C_NONE, C_NONE, C_REG, 68, 4, 0},
- {AMOVFL, C_REG, C_NONE, C_NONE, C_LCON, 69, 4, 0},
- {AMOVFL, C_REG, C_NONE, C_NONE, C_CREG, 69, 4, 0},
- {AMOVW, C_REG, C_NONE, C_NONE, C_CREG, 69, 4, 0},
- {AMOVWZ, C_REG, C_NONE, C_NONE, C_CREG, 69, 4, 0},
- {ACMP, C_REG, C_NONE, C_NONE, C_REG, 70, 4, 0},
- {ACMP, C_REG, C_REG, C_NONE, C_REG, 70, 4, 0},
- {ACMP, C_REG, C_NONE, C_NONE, C_ADDCON, 71, 4, 0},
- {ACMP, C_REG, C_REG, C_NONE, C_ADDCON, 71, 4, 0},
- {ACMPU, C_REG, C_NONE, C_NONE, C_REG, 70, 4, 0},
- {ACMPU, C_REG, C_REG, C_NONE, C_REG, 70, 4, 0},
- {ACMPU, C_REG, C_NONE, C_NONE, C_ANDCON, 71, 4, 0},
- {ACMPU, C_REG, C_REG, C_NONE, C_ANDCON, 71, 4, 0},
- {AFCMPO, C_FREG, C_NONE, C_NONE, C_FREG, 70, 4, 0},
- {AFCMPO, C_FREG, C_REG, C_NONE, C_FREG, 70, 4, 0},
- {ATW, C_LCON, C_REG, C_NONE, C_REG, 60, 4, 0},
- {ATW, C_LCON, C_REG, C_NONE, C_ADDCON, 61, 4, 0},
- {ADCBF, C_ZOREG, C_NONE, C_NONE, C_NONE, 43, 4, 0},
- {ADCBF, C_SOREG, C_NONE, C_NONE, C_NONE, 43, 4, 0},
- {ADCBF, C_ZOREG, C_REG, C_NONE, C_SCON, 43, 4, 0},
- {ADCBF, C_SOREG, C_NONE, C_NONE, C_SCON, 43, 4, 0},
- {AECOWX, C_REG, C_REG, C_NONE, C_ZOREG, 44, 4, 0},
- {AECIWX, C_ZOREG, C_REG, C_NONE, C_REG, 45, 4, 0},
- {AECOWX, C_REG, C_NONE, C_NONE, C_ZOREG, 44, 4, 0},
- {AECIWX, C_ZOREG, C_NONE, C_NONE, C_REG, 45, 4, 0},
- {ALDAR, C_ZOREG, C_NONE, C_NONE, C_REG, 45, 4, 0},
- {ALDAR, C_ZOREG, C_NONE, C_ANDCON, C_REG, 45, 4, 0},
- {AEIEIO, C_NONE, C_NONE, C_NONE, C_NONE, 46, 4, 0},
- {ATLBIE, C_REG, C_NONE, C_NONE, C_NONE, 49, 4, 0},
- {ATLBIE, C_SCON, C_NONE, C_NONE, C_REG, 49, 4, 0},
- {ASLBMFEE, C_REG, C_NONE, C_NONE, C_REG, 55, 4, 0},
- {ASLBMTE, C_REG, C_NONE, C_NONE, C_REG, 55, 4, 0},
- {ASTSW, C_REG, C_NONE, C_NONE, C_ZOREG, 44, 4, 0},
- {ASTSW, C_REG, C_NONE, C_LCON, C_ZOREG, 41, 4, 0},
- {ALSW, C_ZOREG, C_NONE, C_NONE, C_REG, 45, 4, 0},
- {ALSW, C_ZOREG, C_NONE, C_LCON, C_REG, 42, 4, 0},
- {obj.AUNDEF, C_NONE, C_NONE, C_NONE, C_NONE, 78, 4, 0},
- {obj.APCDATA, C_LCON, C_NONE, C_NONE, C_LCON, 0, 0, 0},
- {obj.AFUNCDATA, C_SCON, C_NONE, C_NONE, C_ADDR, 0, 0, 0},
- {obj.ANOP, C_NONE, C_NONE, C_NONE, C_NONE, 0, 0, 0},
- {obj.ANOP, C_LCON, C_NONE, C_NONE, C_NONE, 0, 0, 0}, // NOP operand variations added for #40689
- {obj.ANOP, C_REG, C_NONE, C_NONE, C_NONE, 0, 0, 0}, // to preserve previous behavior
- {obj.ANOP, C_FREG, C_NONE, C_NONE, C_NONE, 0, 0, 0},
- {obj.ADUFFZERO, C_NONE, C_NONE, C_NONE, C_LBRA, 11, 4, 0}, // same as ABR/ABL
- {obj.ADUFFCOPY, C_NONE, C_NONE, C_NONE, C_LBRA, 11, 4, 0}, // same as ABR/ABL
- {obj.APCALIGN, C_LCON, C_NONE, C_NONE, C_NONE, 0, 0, 0}, // align code
-
- {obj.AXXX, C_NONE, C_NONE, C_NONE, C_NONE, 0, 4, 0},
+ {as: AMOVW, a1: C_REG, a4: C_SPR, type_: 66, size: 4},
+ {as: AMOVW, a1: C_REG, a4: C_CTR, type_: 66, size: 4},
+ {as: AMOVW, a1: C_REG, a4: C_XER, type_: 66, size: 4},
+ {as: AMOVW, a1: C_SPR, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVW, a1: C_XER, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVWZ, a1: C_REG, a4: C_SPR, type_: 66, size: 4},
+ {as: AMOVWZ, a1: C_REG, a4: C_CTR, type_: 66, size: 4},
+ {as: AMOVWZ, a1: C_REG, a4: C_XER, type_: 66, size: 4},
+ {as: AMOVWZ, a1: C_SPR, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVWZ, a1: C_XER, a4: C_REG, type_: 66, size: 4},
+ {as: AMOVFL, a1: C_FPSCR, a4: C_CREG, type_: 73, size: 4},
+ {as: AMOVFL, a1: C_CREG, a4: C_CREG, type_: 67, size: 4},
+ {as: AMOVW, a1: C_CREG, a4: C_REG, type_: 68, size: 4},
+ {as: AMOVWZ, a1: C_CREG, a4: C_REG, type_: 68, size: 4},
+ {as: AMOVFL, a1: C_REG, a4: C_LCON, type_: 69, size: 4},
+ {as: AMOVFL, a1: C_REG, a4: C_CREG, type_: 69, size: 4},
+ {as: AMOVW, a1: C_REG, a4: C_CREG, type_: 69, size: 4},
+ {as: AMOVWZ, a1: C_REG, a4: C_CREG, type_: 69, size: 4},
+ {as: ACMP, a1: C_REG, a4: C_REG, type_: 70, size: 4},
+ {as: ACMP, a1: C_REG, a2: C_REG, a4: C_REG, type_: 70, size: 4},
+ {as: ACMP, a1: C_REG, a4: C_ADDCON, type_: 71, size: 4},
+ {as: ACMP, a1: C_REG, a2: C_REG, a4: C_ADDCON, type_: 71, size: 4},
+ {as: ACMPU, a1: C_REG, a4: C_REG, type_: 70, size: 4},
+ {as: ACMPU, a1: C_REG, a2: C_REG, a4: C_REG, type_: 70, size: 4},
+ {as: ACMPU, a1: C_REG, a4: C_ANDCON, type_: 71, size: 4},
+ {as: ACMPU, a1: C_REG, a2: C_REG, a4: C_ANDCON, type_: 71, size: 4},
+ {as: AFCMPO, a1: C_FREG, a4: C_FREG, type_: 70, size: 4},
+ {as: AFCMPO, a1: C_FREG, a2: C_REG, a4: C_FREG, type_: 70, size: 4},
+ {as: ATW, a1: C_LCON, a2: C_REG, a4: C_REG, type_: 60, size: 4},
+ {as: ATW, a1: C_LCON, a2: C_REG, a4: C_ADDCON, type_: 61, size: 4},
+ {as: ADCBF, a1: C_ZOREG, type_: 43, size: 4},
+ {as: ADCBF, a1: C_SOREG, type_: 43, size: 4},
+ {as: ADCBF, a1: C_ZOREG, a2: C_REG, a4: C_SCON, type_: 43, size: 4},
+ {as: ADCBF, a1: C_SOREG, a4: C_SCON, type_: 43, size: 4},
+ {as: AECOWX, a1: C_REG, a2: C_REG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: AECIWX, a1: C_ZOREG, a2: C_REG, a4: C_REG, type_: 45, size: 4},
+ {as: AECOWX, a1: C_REG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: AECIWX, a1: C_ZOREG, a4: C_REG, type_: 45, size: 4},
+ {as: ALDAR, a1: C_ZOREG, a4: C_REG, type_: 45, size: 4},
+ {as: ALDAR, a1: C_ZOREG, a3: C_ANDCON, a4: C_REG, type_: 45, size: 4},
+ {as: AEIEIO, type_: 46, size: 4},
+ {as: ATLBIE, a1: C_REG, type_: 49, size: 4},
+ {as: ATLBIE, a1: C_SCON, a4: C_REG, type_: 49, size: 4},
+ {as: ASLBMFEE, a1: C_REG, a4: C_REG, type_: 55, size: 4},
+ {as: ASLBMTE, a1: C_REG, a4: C_REG, type_: 55, size: 4},
+ {as: ASTSW, a1: C_REG, a4: C_ZOREG, type_: 44, size: 4},
+ {as: ASTSW, a1: C_REG, a3: C_LCON, a4: C_ZOREG, type_: 41, size: 4},
+ {as: ALSW, a1: C_ZOREG, a4: C_REG, type_: 45, size: 4},
+ {as: ALSW, a1: C_ZOREG, a3: C_LCON, a4: C_REG, type_: 42, size: 4},
+ {as: obj.AUNDEF, type_: 78, size: 4},
+ {as: obj.APCDATA, a1: C_LCON, a4: C_LCON, type_: 0, size: 0},
+ {as: obj.AFUNCDATA, a1: C_SCON, a4: C_ADDR, type_: 0, size: 0},
+ {as: obj.ANOP, type_: 0, size: 0},
+ {as: obj.ANOP, a1: C_LCON, type_: 0, size: 0}, // NOP operand variations added for #40689
+ {as: obj.ANOP, a1: C_REG, type_: 0, size: 0}, // to preserve previous behavior
+ {as: obj.ANOP, a1: C_FREG, type_: 0, size: 0},
+ {as: obj.ADUFFZERO, a4: C_LBRA, type_: 11, size: 4}, // same as ABR/ABL
+ {as: obj.ADUFFCOPY, a4: C_LBRA, type_: 11, size: 4}, // same as ABR/ABL
+ {as: obj.APCALIGN, a1: C_LCON, type_: 0, size: 0}, // align code
+
+ {as: obj.AXXX, type_: 0, size: 4},
}
var oprange [ALAST & obj.AMask][]Optab
diff --git a/src/cmd/internal/obj/ppc64/obj9.go b/src/cmd/internal/obj/ppc64/obj9.go
index fddf552156..a77be29cf0 100644
--- a/src/cmd/internal/obj/ppc64/obj9.go
+++ b/src/cmd/internal/obj/ppc64/obj9.go
@@ -34,6 +34,7 @@ import (
"cmd/internal/objabi"
"cmd/internal/src"
"cmd/internal/sys"
+ "log"
)
func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
@@ -984,6 +985,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.From.Reg = REGSP
}
}
+
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 && p.As != ACMPU {
+ f := c.cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
+ }
+ }
}
}
diff --git a/src/cmd/internal/obj/riscv/obj.go b/src/cmd/internal/obj/riscv/obj.go
index 9257a6453a..391c2486ca 100644
--- a/src/cmd/internal/obj/riscv/obj.go
+++ b/src/cmd/internal/obj/riscv/obj.go
@@ -25,6 +25,7 @@ import (
"cmd/internal/objabi"
"cmd/internal/sys"
"fmt"
+ "log"
)
func buildop(ctxt *obj.Link) {}
@@ -119,7 +120,7 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
switch p.To.Name {
case obj.NAME_NONE:
p.As = AJALR
- case obj.NAME_EXTERN:
+ case obj.NAME_EXTERN, obj.NAME_STATIC:
// Handled in preprocess.
default:
ctxt.Diag("unsupported name %d for %v", p.To.Name, p)
@@ -267,7 +268,7 @@ func rewriteMOV(ctxt *obj.Link, newprog obj.ProgAlloc, p *obj.Prog) {
p.As = movToStore(p.As)
p.To.Reg = addrToReg(p.To)
- case obj.NAME_EXTERN:
+ case obj.NAME_EXTERN, obj.NAME_STATIC:
// AUIPC $off_hi, TMP
// S $off_lo, TMP, R
as := p.As
@@ -301,7 +302,10 @@ func rewriteMOV(ctxt *obj.Link, newprog obj.ProgAlloc, p *obj.Prog) {
// LUI top20bits(c), R
// ADD bottom12bits(c), R, R
if p.As != AMOV {
- ctxt.Diag("unsupported constant load at %v", p)
+ ctxt.Diag("%v: unsupported constant load", p)
+ }
+ if p.To.Type != obj.TYPE_REG {
+ ctxt.Diag("%v: constant load must target register", p)
}
off := p.From.Offset
to := p.To
@@ -666,7 +670,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
switch p.To.Type {
case obj.TYPE_MEM:
switch p.To.Name {
- case obj.NAME_EXTERN:
+ case obj.NAME_EXTERN, obj.NAME_STATIC:
// JMP to symbol.
jalrToSym(ctxt, p, newprog, REG_ZERO)
}
@@ -716,6 +720,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.Spadj = int32(-p.From.Offset)
}
}
+
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
+ f := cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ f.FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s %v\n", cursym.Name, p)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
+ }
+ }
}
// Rewrite MOV pseudo-instructions. This cannot be done in
diff --git a/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go b/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go
index 279aeb2c32..3fa95222ff 100644
--- a/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go
+++ b/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.go
@@ -25,84 +25,73 @@ func testBLTU(a, b int64) (r bool)
func testBLTZ(a int64) (r bool)
func testBNEZ(a int64) (r bool)
+func testGoBGE(a, b int64) bool { return a >= b }
+func testGoBGEU(a, b int64) bool { return uint64(a) >= uint64(b) }
+func testGoBGT(a, b int64) bool { return a > b }
+func testGoBGTU(a, b int64) bool { return uint64(a) > uint64(b) }
+func testGoBLE(a, b int64) bool { return a <= b }
+func testGoBLEU(a, b int64) bool { return uint64(a) <= uint64(b) }
+func testGoBLT(a, b int64) bool { return a < b }
+func testGoBLTZ(a, b int64) bool { return uint64(a) < uint64(b) }
+
func TestBranchCondition(t *testing.T) {
tests := []struct {
ins string
a int64
b int64
fn func(a, b int64) bool
+ goFn func(a, b int64) bool
want bool
}{
- {"BGE", 0, 1, testBGE, false},
- {"BGE", 0, 0, testBGE, true},
- {"BGE", 0, -1, testBGE, true},
- {"BGE", -1, 0, testBGE, false},
- {"BGE", 1, 0, testBGE, true},
- {"BGEU", 0, 1, testBGEU, false},
- {"BGEU", 0, 0, testBGEU, true},
- {"BGEU", 0, -1, testBGEU, false},
- {"BGEU", -1, 0, testBGEU, true},
- {"BGEU", 1, 0, testBGEU, true},
- {"BGT", 0, 1, testBGT, false},
- {"BGT", 0, 0, testBGT, false},
- {"BGT", 0, -1, testBGT, true},
- {"BGT", -1, 0, testBGT, false},
- {"BGT", 1, 0, testBGT, true},
- {"BGTU", 0, 1, testBGTU, false},
- {"BGTU", 0, 0, testBGTU, false},
- {"BGTU", 0, -1, testBGTU, false},
- {"BGTU", -1, 0, testBGTU, true},
- {"BGTU", 1, 0, testBGTU, true},
- {"BLE", 0, 1, testBLE, true},
- {"BLE", 0, 0, testBLE, true},
- {"BLE", 0, -1, testBLE, false},
- {"BLE", -1, 0, testBLE, true},
- {"BLE", 1, 0, testBLE, false},
- {"BLEU", 0, 1, testBLEU, true},
- {"BLEU", 0, 0, testBLEU, true},
- {"BLEU", 0, -1, testBLEU, true},
- {"BLEU", -1, 0, testBLEU, false},
- {"BLEU", 1, 0, testBLEU, false},
- {"BLT", 0, 1, testBLT, true},
- {"BLT", 0, 0, testBLT, false},
- {"BLT", 0, -1, testBLT, false},
- {"BLT", -1, 0, testBLT, true},
- {"BLT", 1, 0, testBLT, false},
- {"BLTU", 0, 1, testBLTU, true},
- {"BLTU", 0, 0, testBLTU, false},
- {"BLTU", 0, -1, testBLTU, true},
- {"BLTU", -1, 0, testBLTU, false},
- {"BLTU", 1, 0, testBLTU, false},
+ {"BGE", 0, 1, testBGE, testGoBGE, false},
+ {"BGE", 0, 0, testBGE, testGoBGE, true},
+ {"BGE", 0, -1, testBGE, testGoBGE, true},
+ {"BGE", -1, 0, testBGE, testGoBGE, false},
+ {"BGE", 1, 0, testBGE, testGoBGE, true},
+ {"BGEU", 0, 1, testBGEU, testGoBGEU, false},
+ {"BGEU", 0, 0, testBGEU, testGoBGEU, true},
+ {"BGEU", 0, -1, testBGEU, testGoBGEU, false},
+ {"BGEU", -1, 0, testBGEU, testGoBGEU, true},
+ {"BGEU", 1, 0, testBGEU, testGoBGEU, true},
+ {"BGT", 0, 1, testBGT, testGoBGT, false},
+ {"BGT", 0, 0, testBGT, testGoBGT, false},
+ {"BGT", 0, -1, testBGT, testGoBGT, true},
+ {"BGT", -1, 0, testBGT, testGoBGT, false},
+ {"BGT", 1, 0, testBGT, testGoBGT, true},
+ {"BGTU", 0, 1, testBGTU, testGoBGTU, false},
+ {"BGTU", 0, 0, testBGTU, testGoBGTU, false},
+ {"BGTU", 0, -1, testBGTU, testGoBGTU, false},
+ {"BGTU", -1, 0, testBGTU, testGoBGTU, true},
+ {"BGTU", 1, 0, testBGTU, testGoBGTU, true},
+ {"BLE", 0, 1, testBLE, testGoBLE, true},
+ {"BLE", 0, 0, testBLE, testGoBLE, true},
+ {"BLE", 0, -1, testBLE, testGoBLE, false},
+ {"BLE", -1, 0, testBLE, testGoBLE, true},
+ {"BLE", 1, 0, testBLE, testGoBLE, false},
+ {"BLEU", 0, 1, testBLEU, testGoBLEU, true},
+ {"BLEU", 0, 0, testBLEU, testGoBLEU, true},
+ {"BLEU", 0, -1, testBLEU, testGoBLEU, true},
+ {"BLEU", -1, 0, testBLEU, testGoBLEU, false},
+ {"BLEU", 1, 0, testBLEU, testGoBLEU, false},
+ {"BLT", 0, 1, testBLT, testGoBLT, true},
+ {"BLT", 0, 0, testBLT, testGoBLT, false},
+ {"BLT", 0, -1, testBLT, testGoBLT, false},
+ {"BLT", -1, 0, testBLT, testGoBLT, true},
+ {"BLT", 1, 0, testBLT, testGoBLT, false},
+ {"BLTU", 0, 1, testBLTU, testGoBLTU, true},
+ {"BLTU", 0, 0, testBLTU, testGoBLTU, false},
+ {"BLTU", 0, -1, testBLTU, testGoBLTU, true},
+ {"BLTU", -1, 0, testBLTU, testGoBLTU, false},
+ {"BLTU", 1, 0, testBLTU, testGoBLTU, false},
}
for _, test := range tests {
t.Run(test.ins, func(t *testing.T) {
- var fn func(a, b int64) bool
- switch test.ins {
- case "BGE":
- fn = func(a, b int64) bool { return a >= b }
- case "BGEU":
- fn = func(a, b int64) bool { return uint64(a) >= uint64(b) }
- case "BGT":
- fn = func(a, b int64) bool { return a > b }
- case "BGTU":
- fn = func(a, b int64) bool { return uint64(a) > uint64(b) }
- case "BLE":
- fn = func(a, b int64) bool { return a <= b }
- case "BLEU":
- fn = func(a, b int64) bool { return uint64(a) <= uint64(b) }
- case "BLT":
- fn = func(a, b int64) bool { return a < b }
- case "BLTU":
- fn = func(a, b int64) bool { return uint64(a) < uint64(b) }
- default:
- t.Fatalf("Unknown instruction %q", test.ins)
- }
- if got := fn(test.a, test.b); got != test.want {
- t.Errorf("Go %v %v, %v = %v, want %v", test.ins, test.a, test.b, got, test.want)
- }
if got := test.fn(test.a, test.b); got != test.want {
t.Errorf("Assembly %v %v, %v = %v, want %v", test.ins, test.a, test.b, got, test.want)
}
+ if got := test.goFn(test.a, test.b); got != test.want {
+ t.Errorf("Go %v %v, %v = %v, want %v", test.ins, test.a, test.b, got, test.want)
+ }
})
}
}
diff --git a/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.s b/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.s
index 8dd6f563af..cce296feb5 100644
--- a/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.s
+++ b/src/cmd/internal/obj/riscv/testdata/testbranch/branch_test.s
@@ -7,7 +7,7 @@
#include "textflag.h"
// func testBEQZ(a int64) (r bool)
-TEXT ·testBEQZ(SB),NOSPLIT,$0-0
+TEXT ·testBEQZ(SB),NOSPLIT,$0-9
MOV a+0(FP), X5
MOV $1, X6
BEQZ X5, b
@@ -17,7 +17,7 @@ b:
RET
// func testBGE(a, b int64) (r bool)
-TEXT ·testBGE(SB),NOSPLIT,$0-0
+TEXT ·testBGE(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -28,7 +28,7 @@ b:
RET
// func testBGEU(a, b int64) (r bool)
-TEXT ·testBGEU(SB),NOSPLIT,$0-0
+TEXT ·testBGEU(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -39,7 +39,7 @@ b:
RET
// func testBGEZ(a int64) (r bool)
-TEXT ·testBGEZ(SB),NOSPLIT,$0-0
+TEXT ·testBGEZ(SB),NOSPLIT,$0-9
MOV a+0(FP), X5
MOV $1, X6
BGEZ X5, b
@@ -49,7 +49,7 @@ b:
RET
// func testBGT(a, b int64) (r bool)
-TEXT ·testBGT(SB),NOSPLIT,$0-0
+TEXT ·testBGT(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -60,7 +60,7 @@ b:
RET
// func testBGTU(a, b int64) (r bool)
-TEXT ·testBGTU(SB),NOSPLIT,$0-0
+TEXT ·testBGTU(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -71,7 +71,7 @@ b:
RET
// func testBGTZ(a int64) (r bool)
-TEXT ·testBGTZ(SB),NOSPLIT,$0-0
+TEXT ·testBGTZ(SB),NOSPLIT,$0-9
MOV a+0(FP), X5
MOV $1, X6
BGTZ X5, b
@@ -81,7 +81,7 @@ b:
RET
// func testBLE(a, b int64) (r bool)
-TEXT ·testBLE(SB),NOSPLIT,$0-0
+TEXT ·testBLE(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -92,7 +92,7 @@ b:
RET
// func testBLEU(a, b int64) (r bool)
-TEXT ·testBLEU(SB),NOSPLIT,$0-0
+TEXT ·testBLEU(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -103,7 +103,7 @@ b:
RET
// func testBLEZ(a int64) (r bool)
-TEXT ·testBLEZ(SB),NOSPLIT,$0-0
+TEXT ·testBLEZ(SB),NOSPLIT,$0-9
MOV a+0(FP), X5
MOV $1, X6
BLEZ X5, b
@@ -113,7 +113,7 @@ b:
RET
// func testBLT(a, b int64) (r bool)
-TEXT ·testBLT(SB),NOSPLIT,$0-0
+TEXT ·testBLT(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -124,7 +124,7 @@ b:
RET
// func testBLTU(a, b int64) (r bool)
-TEXT ·testBLTU(SB),NOSPLIT,$0-0
+TEXT ·testBLTU(SB),NOSPLIT,$0-17
MOV a+0(FP), X5
MOV b+8(FP), X6
MOV $1, X7
@@ -135,7 +135,7 @@ b:
RET
// func testBLTZ(a int64) (r bool)
-TEXT ·testBLTZ(SB),NOSPLIT,$0-0
+TEXT ·testBLTZ(SB),NOSPLIT,$0-9
MOV a+0(FP), X5
MOV $1, X6
BLTZ X5, b
@@ -145,7 +145,7 @@ b:
RET
// func testBNEZ(a int64) (r bool)
-TEXT ·testBNEZ(SB),NOSPLIT,$0-0
+TEXT ·testBNEZ(SB),NOSPLIT,$0-9
MOV a+0(FP), X5
MOV $1, X6
BNEZ X5, b
diff --git a/src/cmd/internal/obj/s390x/objz.go b/src/cmd/internal/obj/s390x/objz.go
index 970cf827d6..a02c4fc17f 100644
--- a/src/cmd/internal/obj/s390x/objz.go
+++ b/src/cmd/internal/obj/s390x/objz.go
@@ -33,6 +33,7 @@ import (
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/sys"
+ "log"
"math"
)
@@ -545,6 +546,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p.From.Reg = REGSP
}
}
+
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
+ f := c.cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s\n", c.cursym.Name)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
+ }
+ }
}
if wasSplit {
c.stacksplitPost(pLast, pPre, pPreempt, autosize) // emit post part of split check
diff --git a/src/cmd/internal/obj/stringer.go b/src/cmd/internal/obj/stringer.go
index f67b89091c..a4d507d49a 100644
--- a/src/cmd/internal/obj/stringer.go
+++ b/src/cmd/internal/obj/stringer.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This is a mini version of the stringer tool customized for the Anames table
diff --git a/src/cmd/internal/obj/util.go b/src/cmd/internal/obj/util.go
index b9bacb7a22..1c34b4e833 100644
--- a/src/cmd/internal/obj/util.go
+++ b/src/cmd/internal/obj/util.go
@@ -187,7 +187,7 @@ func (p *Prog) WriteInstructionString(w io.Writer) {
// In short, print one of these two:
// TEXT foo(SB), DUPOK|NOSPLIT, $0
// TEXT foo(SB), $0
- s := p.From.Sym.Attribute.TextAttrString()
+ s := p.From.Sym.TextAttrString()
if s != "" {
fmt.Fprintf(w, "%s%s", sep, s)
sep = ", "
diff --git a/src/cmd/internal/obj/x86/a.out.go b/src/cmd/internal/obj/x86/a.out.go
index 30c1a6a445..3be4b59da4 100644
--- a/src/cmd/internal/obj/x86/a.out.go
+++ b/src/cmd/internal/obj/x86/a.out.go
@@ -263,6 +263,7 @@ const (
FREGRET = REG_X0
REGSP = REG_SP
REGCTXT = REG_DX
+ REGG = REG_R14 // g register in ABIInternal
REGEXT = REG_R15 // compiler allocates external registers R15 down
FREGMIN = REG_X0 + 5 // first register variable
FREGEXT = REG_X0 + 15 // first external register
diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go
index a6b85ac4a0..fa670d5c18 100644
--- a/src/cmd/internal/obj/x86/asm6.go
+++ b/src/cmd/internal/obj/x86/asm6.go
@@ -1887,7 +1887,7 @@ func lookForJCC(p *obj.Prog) *obj.Prog {
func fusedJump(p *obj.Prog) (bool, uint8) {
var fusedSize uint8
- // The first instruction in a macro fused pair may be preceeded by the LOCK prefix,
+ // The first instruction in a macro fused pair may be preceded by the LOCK prefix,
// or possibly an XACQUIRE/XRELEASE prefix followed by a LOCK prefix. If it is, we
// need to be careful to insert any padding before the locks rather than directly after them.
diff --git a/src/cmd/internal/obj/x86/obj6.go b/src/cmd/internal/obj/x86/obj6.go
index 1674db626f..bc3a3b4bbe 100644
--- a/src/cmd/internal/obj/x86/obj6.go
+++ b/src/cmd/internal/obj/x86/obj6.go
@@ -35,6 +35,7 @@ import (
"cmd/internal/objabi"
"cmd/internal/src"
"cmd/internal/sys"
+ "log"
"math"
"strings"
)
@@ -637,13 +638,19 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
}
}
+ var regg int16
if !p.From.Sym.NoSplit() || (p.From.Sym.Wrapper() && !p.From.Sym.ABIWrapper()) {
- p = obj.Appendp(p, newprog)
- p = load_g_cx(ctxt, p, newprog) // load g into CX
+ if ctxt.Arch.Family == sys.AMD64 && objabi.Regabi_enabled != 0 && cursym.ABI() == obj.ABIInternal {
+ regg = REGG // use the g register directly in ABIInternal
+ } else {
+ p = obj.Appendp(p, newprog)
+ p = load_g_cx(ctxt, p, newprog) // load g into CX
+ regg = REG_CX
+ }
}
if !cursym.Func().Text.From.Sym.NoSplit() {
- p = stacksplit(ctxt, cursym, p, newprog, autoffset, int32(textarg)) // emit split check
+ p = stacksplit(ctxt, cursym, p, newprog, autoffset, int32(textarg), regg) // emit split check
}
// Delve debugger would like the next instruction to be noted as the end of the function prologue.
@@ -695,7 +702,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
// g._panic.argp = bottom-of-frame
// }
//
- // MOVQ g_panic(CX), BX
+ // MOVQ g_panic(g), BX
// TESTQ BX, BX
// JNE checkargp
// end:
@@ -718,7 +725,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
p = obj.Appendp(p, newprog)
p.As = AMOVQ
p.From.Type = obj.TYPE_MEM
- p.From.Reg = REG_CX
+ p.From.Reg = regg
p.From.Offset = 4 * int64(ctxt.Arch.PtrSize) // g_panic
p.To.Type = obj.TYPE_REG
p.To.Reg = REG_BX
@@ -833,6 +840,20 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
switch p.As {
default:
+ if p.To.Type == obj.TYPE_REG && p.To.Reg == REG_SP && p.As != ACMPL && p.As != ACMPQ {
+ f := cursym.Func()
+ if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
+ f.FuncFlag |= objabi.FuncFlag_SPWRITE
+ if ctxt.Debugvlog || !ctxt.IsAsm {
+ ctxt.Logf("auto-SPWRITE: %s %v\n", cursym.Name, p)
+ if !ctxt.IsAsm {
+ ctxt.Diag("invalid auto-SPWRITE in non-assembly")
+ ctxt.DiagFlush()
+ log.Fatalf("bad SPWRITE")
+ }
+ }
+ }
+ }
continue
case APUSHL, APUSHFL:
@@ -969,9 +990,9 @@ func load_g_cx(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) *obj.Prog {
// Append code to p to check for stack split.
// Appends to (does not overwrite) p.
-// Assumes g is in CX.
+// Assumes g is in rg.
// Returns last new instruction.
-func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgAlloc, framesize int32, textarg int32) *obj.Prog {
+func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgAlloc, framesize int32, textarg int32, rg int16) *obj.Prog {
cmp := ACMPQ
lea := ALEAQ
mov := AMOVQ
@@ -993,7 +1014,8 @@ func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgA
p.As = cmp
p.From.Type = obj.TYPE_REG
p.From.Reg = REG_SP
- indir_cx(ctxt, &p.To)
+ p.To.Type = obj.TYPE_MEM
+ p.To.Reg = rg
p.To.Offset = 2 * int64(ctxt.Arch.PtrSize) // G.stackguard0
if cursym.CFunc() {
p.To.Offset = 3 * int64(ctxt.Arch.PtrSize) // G.stackguard1
@@ -1021,7 +1043,8 @@ func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgA
p.As = cmp
p.From.Type = obj.TYPE_REG
p.From.Reg = REG_AX
- indir_cx(ctxt, &p.To)
+ p.To.Type = obj.TYPE_MEM
+ p.To.Reg = rg
p.To.Offset = 2 * int64(ctxt.Arch.PtrSize) // G.stackguard0
if cursym.CFunc() {
p.To.Offset = 3 * int64(ctxt.Arch.PtrSize) // G.stackguard1
@@ -1047,7 +1070,8 @@ func stacksplit(ctxt *obj.Link, cursym *obj.LSym, p *obj.Prog, newprog obj.ProgA
p = obj.Appendp(p, newprog)
p.As = mov
- indir_cx(ctxt, &p.From)
+ p.From.Type = obj.TYPE_MEM
+ p.From.Reg = rg
p.From.Offset = 2 * int64(ctxt.Arch.PtrSize) // G.stackguard0
if cursym.CFunc() {
p.From.Offset = 3 * int64(ctxt.Arch.PtrSize) // G.stackguard1
diff --git a/src/cmd/internal/objabi/funcid.go b/src/cmd/internal/objabi/funcid.go
index 1d098ee172..6e188e31bb 100644
--- a/src/cmd/internal/objabi/funcid.go
+++ b/src/cmd/internal/objabi/funcid.go
@@ -4,97 +4,89 @@
package objabi
+import "strings"
+
+// A FuncFlag records bits about a function, passed to the runtime.
+type FuncFlag uint8
+
+// Note: This list must match the list in runtime/symtab.go.
+const (
+ FuncFlag_TOPFRAME = 1 << iota
+ FuncFlag_SPWRITE
+)
+
// A FuncID identifies particular functions that need to be treated
// specially by the runtime.
// Note that in some situations involving plugins, there may be multiple
// copies of a particular special runtime function.
-// Note: this list must match the list in runtime/symtab.go.
type FuncID uint8
+// Note: this list must match the list in runtime/symtab.go.
const (
FuncID_normal FuncID = iota // not a special function
- FuncID_runtime_main
+ FuncID_asmcgocall
+ FuncID_asyncPreempt
+ FuncID_cgocallback
+ FuncID_debugCallV1
+ FuncID_externalthreadhandler
+ FuncID_gcBgMarkWorker
FuncID_goexit
+ FuncID_gogo
+ FuncID_gopanic
+ FuncID_handleAsyncEvent
FuncID_jmpdefer
FuncID_mcall
FuncID_morestack
FuncID_mstart
+ FuncID_panicwrap
FuncID_rt0_go
- FuncID_asmcgocall
- FuncID_sigpanic
FuncID_runfinq
- FuncID_gcBgMarkWorker
- FuncID_systemstack_switch
+ FuncID_runtime_main
+ FuncID_sigpanic
FuncID_systemstack
- FuncID_cgocallback
- FuncID_gogo
- FuncID_externalthreadhandler
- FuncID_debugCallV1
- FuncID_gopanic
- FuncID_panicwrap
- FuncID_handleAsyncEvent
- FuncID_asyncPreempt
+ FuncID_systemstack_switch
FuncID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.)
)
+var funcIDs = map[string]FuncID{
+ "asmcgocall": FuncID_asmcgocall,
+ "asyncPreempt": FuncID_asyncPreempt,
+ "cgocallback": FuncID_cgocallback,
+ "debugCallV1": FuncID_debugCallV1,
+ "externalthreadhandler": FuncID_externalthreadhandler,
+ "gcBgMarkWorker": FuncID_gcBgMarkWorker,
+ "go": FuncID_rt0_go,
+ "goexit": FuncID_goexit,
+ "gogo": FuncID_gogo,
+ "gopanic": FuncID_gopanic,
+ "handleAsyncEvent": FuncID_handleAsyncEvent,
+ "jmpdefer": FuncID_jmpdefer,
+ "main": FuncID_runtime_main,
+ "mcall": FuncID_mcall,
+ "morestack": FuncID_morestack,
+ "mstart": FuncID_mstart,
+ "panicwrap": FuncID_panicwrap,
+ "runfinq": FuncID_runfinq,
+ "sigpanic": FuncID_sigpanic,
+ "switch": FuncID_systemstack_switch,
+ "systemstack": FuncID_systemstack,
+
+ // Don't show in call stack but otherwise not special.
+ "deferreturn": FuncID_wrapper,
+ "runOpenDeferFrame": FuncID_wrapper,
+ "reflectcallSave": FuncID_wrapper,
+}
+
// Get the function ID for the named function in the named file.
// The function should be package-qualified.
func GetFuncID(name string, isWrapper bool) FuncID {
if isWrapper {
return FuncID_wrapper
}
- switch name {
- case "runtime.main":
- return FuncID_runtime_main
- case "runtime.goexit":
- return FuncID_goexit
- case "runtime.jmpdefer":
- return FuncID_jmpdefer
- case "runtime.mcall":
- return FuncID_mcall
- case "runtime.morestack":
- return FuncID_morestack
- case "runtime.mstart":
- return FuncID_mstart
- case "runtime.rt0_go":
- return FuncID_rt0_go
- case "runtime.asmcgocall":
- return FuncID_asmcgocall
- case "runtime.sigpanic":
- return FuncID_sigpanic
- case "runtime.runfinq":
- return FuncID_runfinq
- case "runtime.gcBgMarkWorker":
- return FuncID_gcBgMarkWorker
- case "runtime.systemstack_switch":
- return FuncID_systemstack_switch
- case "runtime.systemstack":
- return FuncID_systemstack
- case "runtime.cgocallback":
- return FuncID_cgocallback
- case "runtime.gogo":
- return FuncID_gogo
- case "runtime.externalthreadhandler":
- return FuncID_externalthreadhandler
- case "runtime.debugCallV1":
- return FuncID_debugCallV1
- case "runtime.gopanic":
- return FuncID_gopanic
- case "runtime.panicwrap":
- return FuncID_panicwrap
- case "runtime.handleAsyncEvent":
- return FuncID_handleAsyncEvent
- case "runtime.asyncPreempt":
- return FuncID_asyncPreempt
- case "runtime.deferreturn":
- // Don't show in the call stack (used when invoking defer functions)
- return FuncID_wrapper
- case "runtime.runOpenDeferFrame":
- // Don't show in the call stack (used when invoking defer functions)
- return FuncID_wrapper
- case "runtime.reflectcallSave":
- // Don't show in the call stack (used when invoking defer functions)
- return FuncID_wrapper
+ if strings.HasPrefix(name, "runtime.") {
+ if id, ok := funcIDs[name[len("runtime."):]]; ok {
+ return id
+ }
}
return FuncID_normal
}
diff --git a/src/cmd/internal/objabi/path.go b/src/cmd/internal/objabi/path.go
index fd1c9981c6..1a0784cf7f 100644
--- a/src/cmd/internal/objabi/path.go
+++ b/src/cmd/internal/objabi/path.go
@@ -56,6 +56,8 @@ func IsRuntimePackagePath(pkgpath string) bool {
rval = true
case "syscall":
rval = true
+ case "crypto/x509/internal/macos": // libc function wrappers need to be ABIInternal
+ rval = true
default:
rval = strings.HasPrefix(pkgpath, "runtime/internal")
}
diff --git a/src/cmd/internal/objabi/util.go b/src/cmd/internal/objabi/util.go
index a73ab479a1..1f99f8ed5d 100644
--- a/src/cmd/internal/objabi/util.go
+++ b/src/cmd/internal/objabi/util.go
@@ -137,7 +137,7 @@ func init() {
}
// Note: must agree with runtime.framepointer_enabled.
-var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios")
+var Framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64"
func addexp(s string) {
// Could do general integer parsing here, but the runtime copy doesn't yet.
diff --git a/src/cmd/internal/objfile/pe.go b/src/cmd/internal/objfile/pe.go
index b20cda9a44..9088866fcf 100644
--- a/src/cmd/internal/objfile/pe.go
+++ b/src/cmd/internal/objfile/pe.go
@@ -189,6 +189,8 @@ func (f *peFile) goarch() string {
return "amd64"
case pe.IMAGE_FILE_MACHINE_ARMNT:
return "arm"
+ case pe.IMAGE_FILE_MACHINE_ARM64:
+ return "arm64"
default:
return ""
}
diff --git a/src/cmd/internal/sys/supported.go b/src/cmd/internal/sys/supported.go
index ef7c017bd4..291acf0862 100644
--- a/src/cmd/internal/sys/supported.go
+++ b/src/cmd/internal/sys/supported.go
@@ -15,7 +15,7 @@ func RaceDetectorSupported(goos, goarch string) bool {
return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
case "darwin":
return goarch == "amd64" || goarch == "arm64"
- case "freebsd", "netbsd", "windows":
+ case "freebsd", "netbsd", "openbsd", "windows":
return goarch == "amd64"
default:
return false
diff --git a/src/cmd/link/dwarf_test.go b/src/cmd/link/dwarf_test.go
index db710bed6a..d0284ad4f5 100644
--- a/src/cmd/link/dwarf_test.go
+++ b/src/cmd/link/dwarf_test.go
@@ -91,7 +91,8 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string)
exe = filepath.Join(tmpDir, "go.o")
}
- if runtime.GOOS == "darwin" {
+ darwinSymbolTestIsTooFlaky := true // Turn this off, it is too flaky -- See #32218
+ if runtime.GOOS == "darwin" && !darwinSymbolTestIsTooFlaky {
if _, err = exec.LookPath("symbols"); err == nil {
// Ensure Apple's tooling can parse our object for symbols.
out, err = exec.Command("symbols", exe).CombinedOutput()
diff --git a/src/cmd/link/elf_test.go b/src/cmd/link/elf_test.go
index 20754d09f5..b4441297e6 100644
--- a/src/cmd/link/elf_test.go
+++ b/src/cmd/link/elf_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package main
diff --git a/src/cmd/link/internal/arm/asm.go b/src/cmd/link/internal/arm/asm.go
index 755b472694..03caeae7be 100644
--- a/src/cmd/link/internal/arm/asm.go
+++ b/src/cmd/link/internal/arm/asm.go
@@ -370,10 +370,16 @@ func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
r := relocs.At(ri)
switch r.Type() {
case objabi.R_CALLARM:
- // r.Add is the instruction
- // low 24-bit encodes the target address
- t := (ldr.SymValue(rs) + int64(signext24(r.Add()&0xffffff)*4) - (ldr.SymValue(s) + int64(r.Off()))) / 4
- if t > 0x7fffff || t < -0x800000 || (*ld.FlagDebugTramp > 1 && ldr.SymPkg(s) != ldr.SymPkg(rs)) {
+ var t int64
+ // ldr.SymValue(rs) == 0 indicates a cross-package jump to a function that is not yet
+ // laid out. Conservatively use a trampoline. This should be rare, as we lay out packages
+ // in dependency order.
+ if ldr.SymValue(rs) != 0 {
+ // r.Add is the instruction
+ // low 24-bit encodes the target address
+ t = (ldr.SymValue(rs) + int64(signext24(r.Add()&0xffffff)*4) - (ldr.SymValue(s) + int64(r.Off()))) / 4
+ }
+ if t > 0x7fffff || t < -0x800000 || ldr.SymValue(rs) == 0 || (*ld.FlagDebugTramp > 1 && ldr.SymPkg(s) != ldr.SymPkg(rs)) {
// direct call too far, need to insert trampoline.
// look up existing trampolines first. if we found one within the range
// of direct call, we can reuse it. otherwise create a new one.
@@ -445,7 +451,7 @@ func gentramp(arch *sys.Arch, linkmode ld.LinkMode, ldr *loader.Loader, tramp *l
arch.ByteOrder.PutUint32(P[8:], o3)
tramp.SetData(P)
- if linkmode == ld.LinkExternal {
+ if linkmode == ld.LinkExternal || ldr.SymValue(target) == 0 {
r, _ := tramp.AddRel(objabi.R_ADDR)
r.SetOff(8)
r.SetSiz(4)
diff --git a/src/cmd/link/internal/arm64/asm.go b/src/cmd/link/internal/arm64/asm.go
index 14a20a17d5..72093268c2 100644
--- a/src/cmd/link/internal/arm64/asm.go
+++ b/src/cmd/link/internal/arm64/asm.go
@@ -568,6 +568,40 @@ func machoreloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sy
return true
}
+func pereloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, sectoff int64) bool {
+ var v uint32
+
+ rs := r.Xsym
+ rt := r.Type
+
+ if ldr.SymDynid(rs) < 0 {
+ ldr.Errorf(s, "reloc %d (%s) to non-coff symbol %s type=%d (%s)", rt, sym.RelocName(arch, rt), ldr.SymName(rs), ldr.SymType(rs), ldr.SymType(rs))
+ return false
+ }
+
+ out.Write32(uint32(sectoff))
+ out.Write32(uint32(ldr.SymDynid(rs)))
+
+ switch rt {
+ default:
+ return false
+
+ case objabi.R_DWARFSECREF:
+ v = ld.IMAGE_REL_ARM64_SECREL
+
+ case objabi.R_ADDR:
+ if r.Size == 8 {
+ v = ld.IMAGE_REL_ARM64_ADDR64
+ } else {
+ v = ld.IMAGE_REL_ARM64_ADDR32
+ }
+ }
+
+ out.Write16(uint16(v))
+
+ return true
+}
+
func archreloc(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r loader.Reloc, s loader.Sym, val int64) (int64, int, bool) {
const noExtReloc = 0
const isOk = true
diff --git a/src/cmd/link/internal/arm64/obj.go b/src/cmd/link/internal/arm64/obj.go
index bd13295e61..18a32531e9 100644
--- a/src/cmd/link/internal/arm64/obj.go
+++ b/src/cmd/link/internal/arm64/obj.go
@@ -58,6 +58,7 @@ func Init() (*sys.Arch, ld.Arch) {
GenSymsLate: gensymlate,
Machoreloc1: machoreloc1,
MachorelocSize: 8,
+ PEreloc1: pereloc1,
Androiddynld: "/system/bin/linker64",
Linuxdynld: "/lib/ld-linux-aarch64.so.1",
@@ -108,5 +109,9 @@ func archinit(ctxt *ld.Link) {
if *ld.FlagRound == -1 {
*ld.FlagRound = 16384 // 16K page alignment
}
+
+ case objabi.Hwindows: /* PE executable */
+ // ld.HEADR, ld.FlagTextAddr, ld.FlagRound are set in ld.Peinit
+ return
}
}
diff --git a/src/cmd/link/internal/ld/config.go b/src/cmd/link/internal/ld/config.go
index d1e06239a5..291b28e11c 100644
--- a/src/cmd/link/internal/ld/config.go
+++ b/src/cmd/link/internal/ld/config.go
@@ -8,7 +8,6 @@ import (
"cmd/internal/objabi"
"cmd/internal/sys"
"fmt"
- "log"
)
// A BuildMode indicates the sort of object we are building.
@@ -36,7 +35,7 @@ func (mode *BuildMode) Set(s string) error {
return fmt.Errorf("invalid buildmode: %q", s)
case "exe":
switch objabi.GOOS + "/" + objabi.GOARCH {
- case "darwin/arm64", "windows/arm": // On these platforms, everything is PIE
+ case "darwin/arm64", "windows/arm", "windows/arm64": // On these platforms, everything is PIE
*mode = BuildModePIE
default:
*mode = BuildModeExe
@@ -65,7 +64,7 @@ func (mode *BuildMode) Set(s string) error {
}
case "windows":
switch objabi.GOARCH {
- case "amd64", "386", "arm":
+ case "amd64", "386", "arm", "arm64":
default:
return badmode()
}
@@ -181,7 +180,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
if ctxt.Debugvlog > 1 {
defer func() {
if res {
- log.Printf("external linking is forced by: %s\n", reason)
+ ctxt.Logf("external linking is forced by: %s\n", reason)
}
}()
}
@@ -220,7 +219,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
case BuildModePIE:
switch objabi.GOOS + "/" + objabi.GOARCH {
case "linux/amd64", "linux/arm64", "android/arm64":
- case "windows/386", "windows/amd64", "windows/arm":
+ case "windows/386", "windows/amd64", "windows/arm", "windows/arm64":
case "darwin/amd64", "darwin/arm64":
default:
// Internal linking does not support TLS_IE.
diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go
index 6013e0ab0a..92d38bb63e 100644
--- a/src/cmd/link/internal/ld/data.go
+++ b/src/cmd/link/internal/ld/data.go
@@ -55,6 +55,7 @@ func isRuntimeDepPkg(pkg string) bool {
switch pkg {
case "runtime",
"sync/atomic", // runtime may call to sync/atomic, due to go:linkname
+ "internal/abi", // used by reflectcall (and maybe more)
"internal/bytealg", // for IndexByte
"internal/cpu": // for cpu features
return true
@@ -106,14 +107,12 @@ func trampoline(ctxt *Link, s loader.Sym) {
}
rs = ldr.ResolveABIAlias(rs)
if ldr.SymValue(rs) == 0 && (ldr.SymType(rs) != sym.SDYNIMPORT && ldr.SymType(rs) != sym.SUNDEFEXT) {
- if ldr.SymPkg(rs) != ldr.SymPkg(s) {
- if !isRuntimeDepPkg(ldr.SymPkg(s)) || !isRuntimeDepPkg(ldr.SymPkg(rs)) {
- ctxt.Errorf(s, "unresolved inter-package jump to %s(%s) from %s", ldr.SymName(rs), ldr.SymPkg(rs), ldr.SymPkg(s))
- }
- // runtime and its dependent packages may call to each other.
- // they are fine, as they will be laid down together.
+ if ldr.SymPkg(rs) == ldr.SymPkg(s) {
+ continue // symbols in the same package are laid out together
+ }
+ if isRuntimeDepPkg(ldr.SymPkg(s)) && isRuntimeDepPkg(ldr.SymPkg(rs)) {
+ continue // runtime packages are laid out together
}
- continue
}
thearch.Trampoline(ctxt, ldr, ri, rs, s)
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index 245076a83a..ebde41499e 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -24,6 +24,7 @@ type deadcodePass struct {
ifaceMethod map[methodsig]bool // methods declared in reached interfaces
markableMethods []methodref // methods of reached types
reflectSeen bool // whether we have seen a reflect method call
+ dynlink bool
methodsigstmp []methodsig // scratch buffer for decoding method signatures
}
@@ -34,6 +35,7 @@ func (d *deadcodePass) init() {
if objabi.Fieldtrack_enabled != 0 {
d.ldr.Reachparent = make([]loader.Sym, d.ldr.NSym())
}
+ d.dynlink = d.ctxt.DynlinkingGo()
if d.ctxt.BuildMode == BuildModeShared {
// Mark all symbols defined in this library as reachable when
@@ -91,6 +93,10 @@ func (d *deadcodePass) init() {
names = append(names, exp)
}
+ if d.ctxt.Debugvlog > 1 {
+ d.ctxt.Logf("deadcode start names: %v\n", names)
+ }
+
for _, name := range names {
// Mark symbol as a data/ABI0 symbol.
d.mark(d.ldr.Lookup(name, 0), 0)
@@ -111,6 +117,11 @@ func (d *deadcodePass) flood() {
var usedInIface bool
if isgotype {
+ if d.dynlink {
+ // When dynaamic linking, a type may be passed across DSO
+ // boundary and get converted to interface at the other side.
+ d.ldr.SetAttrUsedInIface(symIdx, true)
+ }
usedInIface = d.ldr.AttrUsedInIface(symIdx)
}
diff --git a/src/cmd/link/internal/ld/dwarf.go b/src/cmd/link/internal/ld/dwarf.go
index 2ab9a55e96..561f6f1475 100644
--- a/src/cmd/link/internal/ld/dwarf.go
+++ b/src/cmd/link/internal/ld/dwarf.go
@@ -1454,7 +1454,7 @@ func (d *dwctxt) writeframes(fs loader.Sym) dwarfSecInfo {
// Emit a FDE, Section 6.4.1.
// First build the section contents into a byte buffer.
deltaBuf = deltaBuf[:0]
- if haslr && d.ldr.AttrTopFrame(fn) {
+ if haslr && fi.TopFrame() {
// Mark the link register as having an undefined value.
// This stops call stack unwinders progressing any further.
// TODO: similar mark on non-LR architectures.
@@ -1480,7 +1480,7 @@ func (d *dwctxt) writeframes(fs loader.Sym) dwarfSecInfo {
spdelta += int64(d.arch.PtrSize)
}
- if haslr && !d.ldr.AttrTopFrame(fn) {
+ if haslr && !fi.TopFrame() {
// TODO(bryanpkc): This is imprecise. In general, the instruction
// that stores the return address to the stack frame is not the
// same one that allocates the frame.
diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go
index 37b2dc640d..d3e598b312 100644
--- a/src/cmd/link/internal/ld/elf.go
+++ b/src/cmd/link/internal/ld/elf.go
@@ -519,6 +519,90 @@ func elfwriteinterp(out *OutBuf) int {
return int(sh.Size)
}
+// member of .gnu.attributes of MIPS for fpAbi
+const (
+ // No floating point is present in the module (default)
+ MIPS_FPABI_NONE = 0
+ // FP code in the module uses the FP32 ABI for a 32-bit ABI
+ MIPS_FPABI_ANY = 1
+ // FP code in the module only uses single precision ABI
+ MIPS_FPABI_SINGLE = 2
+ // FP code in the module uses soft-float ABI
+ MIPS_FPABI_SOFT = 3
+ // FP code in the module assumes an FPU with FR=1 and has 12
+ // callee-saved doubles. Historic, no longer supported.
+ MIPS_FPABI_HIST = 4
+ // FP code in the module uses the FPXX ABI
+ MIPS_FPABI_FPXX = 5
+ // FP code in the module uses the FP64 ABI
+ MIPS_FPABI_FP64 = 6
+ // FP code in the module uses the FP64A ABI
+ MIPS_FPABI_FP64A = 7
+)
+
+func elfMipsAbiFlags(sh *ElfShdr, startva uint64, resoff uint64) int {
+ n := 24
+ sh.Addr = startva + resoff - uint64(n)
+ sh.Off = resoff - uint64(n)
+ sh.Size = uint64(n)
+ sh.Type = uint32(elf.SHT_MIPS_ABIFLAGS)
+ sh.Flags = uint64(elf.SHF_ALLOC)
+
+ return n
+}
+
+//typedef struct
+//{
+// /* Version of flags structure. */
+// uint16_t version;
+// /* The level of the ISA: 1-5, 32, 64. */
+// uint8_t isa_level;
+// /* The revision of ISA: 0 for MIPS V and below, 1-n otherwise. */
+// uint8_t isa_rev;
+// /* The size of general purpose registers. */
+// uint8_t gpr_size;
+// /* The size of co-processor 1 registers. */
+// uint8_t cpr1_size;
+// /* The size of co-processor 2 registers. */
+// uint8_t cpr2_size;
+// /* The floating-point ABI. */
+// uint8_t fp_abi;
+// /* Processor-specific extension. */
+// uint32_t isa_ext;
+// /* Mask of ASEs used. */
+// uint32_t ases;
+// /* Mask of general flags. */
+// uint32_t flags1;
+// uint32_t flags2;
+//} Elf_Internal_ABIFlags_v0;
+func elfWriteMipsAbiFlags(ctxt *Link) int {
+ sh := elfshname(".MIPS.abiflags")
+ ctxt.Out.SeekSet(int64(sh.Off))
+ ctxt.Out.Write16(0) // version
+ ctxt.Out.Write8(32) // isaLevel
+ ctxt.Out.Write8(1) // isaRev
+ ctxt.Out.Write8(1) // gprSize
+ ctxt.Out.Write8(1) // cpr1Size
+ ctxt.Out.Write8(0) // cpr2Size
+ if objabi.GOMIPS == "softfloat" {
+ ctxt.Out.Write8(MIPS_FPABI_SOFT) // fpAbi
+ } else {
+ // Go cannot make sure non odd-number-fpr is used (ie, in load a double from memory).
+ // So, we mark the object is MIPS I style paired float/double register scheme,
+ // aka MIPS_FPABI_ANY. If we mark the object as FPXX, the kernel may use FR=1 mode,
+ // then we meet some problem.
+ // Note: MIPS_FPABI_ANY is bad naming: in fact it is MIPS I style FPR usage.
+ // It is not for 'ANY'.
+ // TODO: switch to FPXX after be sure that no odd-number-fpr is used.
+ ctxt.Out.Write8(MIPS_FPABI_ANY) // fpAbi
+ }
+ ctxt.Out.Write32(0) // isaExt
+ ctxt.Out.Write32(0) // ases
+ ctxt.Out.Write32(0) // flags1
+ ctxt.Out.Write32(0) // flags2
+ return int(sh.Size)
+}
+
func elfnote(sh *ElfShdr, startva uint64, resoff uint64, sz int) int {
n := 3*4 + uint64(sz) + resoff%4
@@ -1204,6 +1288,10 @@ func (ctxt *Link) doelf() {
shstrtab.Addstring(".noptrbss")
shstrtab.Addstring("__libfuzzer_extra_counters")
shstrtab.Addstring(".go.buildinfo")
+ if ctxt.IsMIPS() {
+ shstrtab.Addstring(".MIPS.abiflags")
+ shstrtab.Addstring(".gnu.attributes")
+ }
// generate .tbss section for dynamic internal linker or external
// linking, so that various binutils could correctly calculate
@@ -1254,6 +1342,10 @@ func (ctxt *Link) doelf() {
shstrtab.Addstring(elfRelType + ".data.rel.ro")
}
shstrtab.Addstring(elfRelType + ".go.buildinfo")
+ if ctxt.IsMIPS() {
+ shstrtab.Addstring(elfRelType + ".MIPS.abiflags")
+ shstrtab.Addstring(elfRelType + ".gnu.attributes")
+ }
// add a .note.GNU-stack section to mark the stack as non-executable
shstrtab.Addstring(".note.GNU-stack")
@@ -1445,6 +1537,36 @@ func (ctxt *Link) doelf() {
if ctxt.LinkMode == LinkExternal && *flagBuildid != "" {
addgonote(ctxt, ".note.go.buildid", ELF_NOTE_GOBUILDID_TAG, []byte(*flagBuildid))
}
+
+
+ //type mipsGnuAttributes struct {
+ // version uint8 // 'A'
+ // length uint32 // 15 including itself
+ // gnu [4]byte // "gnu\0"
+ // tag uint8 // 1:file, 2: section, 3: symbol, 1 here
+ // taglen uint32 // tag length, including tag, 7 here
+ // tagfp uint8 // 4
+ // fpAbi uint8 // see .MIPS.abiflags
+ //}
+ if ctxt.IsMIPS() {
+ gnuattributes := ldr.CreateSymForUpdate(".gnu.attributes", 0)
+ gnuattributes.SetType(sym.SELFROSECT)
+ gnuattributes.SetReachable(true)
+ gnuattributes.AddUint8('A') // version 'A'
+ gnuattributes.AddUint32(ctxt.Arch, 15) // length 15 including itself
+ gnuattributes.AddBytes([]byte("gnu\x00")) // "gnu\0"
+ gnuattributes.AddUint8(1) // 1:file, 2: section, 3: symbol, 1 here
+ gnuattributes.AddUint32(ctxt.Arch, 7) // tag length, including tag, 7 here
+ gnuattributes.AddUint8(4) // 4 for FP, 8 for MSA
+ if objabi.GOMIPS == "softfloat" {
+ gnuattributes.AddUint8(MIPS_FPABI_SOFT)
+ } else {
+ // Note: MIPS_FPABI_ANY is bad naming: in fact it is MIPS I style FPR usage.
+ // It is not for 'ANY'.
+ // TODO: switch to FPXX after be sure that no odd-number-fpr is used.
+ gnuattributes.AddUint8(MIPS_FPABI_ANY)
+ }
+ }
}
// Do not write DT_NULL. elfdynhash will finish it.
@@ -1910,6 +2032,25 @@ elfobj:
shsym(sh, ldr, ldr.Lookup(".shstrtab", 0))
eh.Shstrndx = uint16(sh.shnum)
+ if ctxt.IsMIPS() {
+ sh = elfshname(".MIPS.abiflags")
+ sh.Type = uint32(elf.SHT_MIPS_ABIFLAGS)
+ sh.Flags = uint64(elf.SHF_ALLOC)
+ sh.Addralign = 8
+ resoff -= int64(elfMipsAbiFlags(sh, uint64(startva), uint64(resoff)))
+
+ ph := newElfPhdr()
+ ph.Type = elf.PT_MIPS_ABIFLAGS
+ ph.Flags = elf.PF_R
+ phsh(ph, sh)
+
+ sh = elfshname(".gnu.attributes")
+ sh.Type = uint32(elf.SHT_GNU_ATTRIBUTES)
+ sh.Addralign = 1
+ ldr := ctxt.loader
+ shsym(sh, ldr, ldr.Lookup(".gnu.attributes", 0))
+ }
+
// put these sections early in the list
if !*FlagS {
elfshname(".symtab")
@@ -2029,6 +2170,10 @@ elfobj:
if !*FlagD {
a += int64(elfwriteinterp(ctxt.Out))
}
+ if ctxt.IsMIPS() {
+ a += int64(elfWriteMipsAbiFlags(ctxt))
+ }
+
if ctxt.LinkMode != LinkExternal {
if ctxt.HeadType == objabi.Hnetbsd {
a += int64(elfwritenetbsdsig(ctxt.Out))
diff --git a/src/cmd/link/internal/ld/elf_test.go b/src/cmd/link/internal/ld/elf_test.go
index 776fc1b4f9..70e743fa65 100644
--- a/src/cmd/link/internal/ld/elf_test.go
+++ b/src/cmd/link/internal/ld/elf_test.go
@@ -1,3 +1,4 @@
+//go:build cgo
// +build cgo
// Copyright 2019 The Go Authors. All rights reserved.
diff --git a/src/cmd/link/internal/ld/execarchive.go b/src/cmd/link/internal/ld/execarchive.go
index 4687c624de..918b86cdc5 100644
--- a/src/cmd/link/internal/ld/execarchive.go
+++ b/src/cmd/link/internal/ld/execarchive.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !wasm && !windows
// +build !wasm,!windows
package ld
diff --git a/src/cmd/link/internal/ld/execarchive_noexec.go b/src/cmd/link/internal/ld/execarchive_noexec.go
index a70dea9fda..5e1f2669d3 100644
--- a/src/cmd/link/internal/ld/execarchive_noexec.go
+++ b/src/cmd/link/internal/ld/execarchive_noexec.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build wasm || windows
// +build wasm windows
package ld
diff --git a/src/cmd/link/internal/ld/fallocate_test.go b/src/cmd/link/internal/ld/fallocate_test.go
index 244b70f061..56d2321826 100644
--- a/src/cmd/link/internal/ld/fallocate_test.go
+++ b/src/cmd/link/internal/ld/fallocate_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || linux
// +build darwin linux
package ld
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index 17d5040827..517b0f6930 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -489,10 +489,16 @@ func (ctxt *Link) loadlib() {
case 0:
// nothing to do
case 1, 2:
- flags = loader.FlagStrictDups
+ flags |= loader.FlagStrictDups
default:
log.Fatalf("invalid -strictdups flag value %d", *FlagStrictDups)
}
+ if !*flagAbiWrap || ctxt.linkShared {
+ // Use ABI aliases if ABI wrappers are not used.
+ // TODO: for now we still use ABI aliases in shared linkage, even if
+ // the wrapper is enabled.
+ flags |= loader.FlagUseABIAlias
+ }
elfsetstring1 := func(str string, off int) { elfsetstring(ctxt, 0, str, off) }
ctxt.loader = loader.NewLoader(flags, elfsetstring1, &ctxt.ErrorReporter.ErrorReporter)
ctxt.ErrorReporter.SymName = func(s loader.Sym) string {
@@ -1337,8 +1343,6 @@ func (ctxt *Link) hostlink() {
if ctxt.HeadType == objabi.Hdarwin {
argv = append(argv, "-dynamiclib")
} else {
- // ELF.
- argv = append(argv, "-Wl,-Bsymbolic")
if ctxt.UseRelro() {
argv = append(argv, "-Wl,-z,relro")
}
@@ -1351,6 +1355,8 @@ func (ctxt *Link) hostlink() {
// Pass -z nodelete to mark the shared library as
// non-closeable: a dlclose will do nothing.
argv = append(argv, "-Wl,-z,nodelete")
+ // Only pass Bsymbolic on non-Windows.
+ argv = append(argv, "-Wl,-Bsymbolic")
}
}
case BuildModeShared:
@@ -1821,7 +1827,11 @@ func ldobj(ctxt *Link, f *bio.Reader, lib *sym.Library, length int64, pn string,
return ldhostobj(ldmacho, ctxt.HeadType, f, pkg, length, pn, file)
}
- if /* x86 */ c1 == 0x4c && c2 == 0x01 || /* x86_64 */ c1 == 0x64 && c2 == 0x86 || /* armv7 */ c1 == 0xc4 && c2 == 0x01 {
+ switch c1<<8 | c2 {
+ case 0x4c01, // 386
+ 0x6486, // amd64
+ 0xc401, // arm
+ 0x64aa: // arm64
ldpe := func(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
textp, rsrc, err := loadpe.Load(ctxt.loader, ctxt.Arch, ctxt.IncVersion(), f, pkg, length, pn)
if err != nil {
@@ -2091,6 +2101,26 @@ func ldshlibsyms(ctxt *Link, shlib string) {
Errorf(nil, "cannot read symbols from shared library: %s", libpath)
return
}
+
+ // collect text symbol ABI versions.
+ symabi := make(map[string]int) // map (unmangled) symbol name to version
+ if *flagAbiWrap {
+ for _, elfsym := range syms {
+ if elf.ST_TYPE(elfsym.Info) != elf.STT_FUNC {
+ continue
+ }
+ // Demangle the name. Keep in sync with symtab.go:putelfsym.
+ if strings.HasSuffix(elfsym.Name, ".abiinternal") {
+ // ABIInternal symbol has mangled name, so the primary symbol is ABI0.
+ symabi[strings.TrimSuffix(elfsym.Name, ".abiinternal")] = 0
+ }
+ if strings.HasSuffix(elfsym.Name, ".abi0") {
+ // ABI0 symbol has mangled name, so the primary symbol is ABIInternal.
+ symabi[strings.TrimSuffix(elfsym.Name, ".abi0")] = sym.SymVerABIInternal
+ }
+ }
+ }
+
for _, elfsym := range syms {
if elf.ST_TYPE(elfsym.Info) == elf.STT_NOTYPE || elf.ST_TYPE(elfsym.Info) == elf.STT_SECTION {
continue
@@ -2099,12 +2129,23 @@ func ldshlibsyms(ctxt *Link, shlib string) {
// Symbols whose names start with "type." are compiler
// generated, so make functions with that prefix internal.
ver := 0
+ symname := elfsym.Name // (unmangled) symbol name
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC && strings.HasPrefix(elfsym.Name, "type.") {
ver = sym.SymVerABIInternal
+ } else if *flagAbiWrap && elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC {
+ if strings.HasSuffix(elfsym.Name, ".abiinternal") {
+ ver = sym.SymVerABIInternal
+ symname = strings.TrimSuffix(elfsym.Name, ".abiinternal")
+ } else if strings.HasSuffix(elfsym.Name, ".abi0") {
+ ver = 0
+ symname = strings.TrimSuffix(elfsym.Name, ".abi0")
+ } else if abi, ok := symabi[elfsym.Name]; ok {
+ ver = abi
+ }
}
l := ctxt.loader
- s := l.LookupOrCreateSym(elfsym.Name, ver)
+ s := l.LookupOrCreateSym(symname, ver)
// Because loadlib above loads all .a files before loading
// any shared libraries, any non-dynimport symbols we find
@@ -2129,6 +2170,10 @@ func ldshlibsyms(ctxt *Link, shlib string) {
}
}
+ if symname != elfsym.Name {
+ l.SetSymExtname(s, elfsym.Name)
+ }
+
// For function symbols, we don't know what ABI is
// available, so alias it under both ABIs.
//
@@ -2137,7 +2182,12 @@ func ldshlibsyms(ctxt *Link, shlib string) {
// mangle Go function names in the .so to include the
// ABI.
if elf.ST_TYPE(elfsym.Info) == elf.STT_FUNC && ver == 0 {
- alias := ctxt.loader.LookupOrCreateSym(elfsym.Name, sym.SymVerABIInternal)
+ if *flagAbiWrap {
+ if _, ok := symabi[symname]; ok {
+ continue // only use alias for functions w/o ABI wrappers
+ }
+ }
+ alias := ctxt.loader.LookupOrCreateSym(symname, sym.SymVerABIInternal)
if l.SymType(alias) != 0 {
continue
}
diff --git a/src/cmd/link/internal/ld/main.go b/src/cmd/link/internal/ld/main.go
index cbd811846b..68dee18598 100644
--- a/src/cmd/link/internal/ld/main.go
+++ b/src/cmd/link/internal/ld/main.go
@@ -116,7 +116,7 @@ func Main(arch *sys.Arch, theArch Arch) {
}
final := gorootFinal()
- addstrdata1(ctxt, "runtime/internal/sys.DefaultGoroot="+final)
+ addstrdata1(ctxt, "runtime.defaultGOROOT="+final)
addstrdata1(ctxt, "cmd/internal/objabi.defaultGOROOT="+final)
// TODO(matloob): define these above and then check flag values here
diff --git a/src/cmd/link/internal/ld/outbuf_mmap.go b/src/cmd/link/internal/ld/outbuf_mmap.go
index 807fe24375..40a3222788 100644
--- a/src/cmd/link/internal/ld/outbuf_mmap.go
+++ b/src/cmd/link/internal/ld/outbuf_mmap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build aix darwin dragonfly freebsd linux netbsd openbsd
package ld
diff --git a/src/cmd/link/internal/ld/outbuf_nofallocate.go b/src/cmd/link/internal/ld/outbuf_nofallocate.go
index 6bf96bcb2b..6564bd54a3 100644
--- a/src/cmd/link/internal/ld/outbuf_nofallocate.go
+++ b/src/cmd/link/internal/ld/outbuf_nofallocate.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !darwin && !linux
// +build !darwin,!linux
package ld
diff --git a/src/cmd/link/internal/ld/outbuf_nommap.go b/src/cmd/link/internal/ld/outbuf_nommap.go
index 6b4025384b..c870fa2c18 100644
--- a/src/cmd/link/internal/ld/outbuf_nommap.go
+++ b/src/cmd/link/internal/ld/outbuf_nommap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !windows
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!windows
package ld
diff --git a/src/cmd/link/internal/ld/outbuf_notdarwin.go b/src/cmd/link/internal/ld/outbuf_notdarwin.go
index 8c5666f216..f9caa413e3 100644
--- a/src/cmd/link/internal/ld/outbuf_notdarwin.go
+++ b/src/cmd/link/internal/ld/outbuf_notdarwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !darwin
// +build !darwin
package ld
diff --git a/src/cmd/link/internal/ld/pcln.go b/src/cmd/link/internal/ld/pcln.go
index 72bf33e611..61b64f4f5a 100644
--- a/src/cmd/link/internal/ld/pcln.go
+++ b/src/cmd/link/internal/ld/pcln.go
@@ -50,7 +50,7 @@ type pclntab struct {
}
// addGeneratedSym adds a generator symbol to pclntab, returning the new Sym.
-// It is the caller's responsibilty to save they symbol in state.
+// It is the caller's responsibility to save they symbol in state.
func (state *pclntab) addGeneratedSym(ctxt *Link, name string, size int64, f generatorFunc) loader.Sym {
size = Rnd(size, int64(ctxt.Arch.PtrSize))
state.size += size
@@ -360,7 +360,7 @@ func (state *pclntab) generateFilenameTabs(ctxt *Link, compUnits []*sym.Compilat
// then not loading extra filenames), and just use the hash value of the
// symbol name to do this cataloging.
//
- // TOOD: Store filenames as symbols. (Note this would be easiest if you
+ // TODO: Store filenames as symbols. (Note this would be easiest if you
// also move strings to ALWAYS using the larger content addressable hash
// function, and use that hash value for uniqueness testing.)
cuEntries := make([]goobj.CUFileIndex, len(compUnits))
@@ -796,7 +796,14 @@ func writeFuncs(ctxt *Link, sb *loader.SymbolBuilder, funcs []loader.Sym, inlSym
}
off = uint32(sb.SetUint8(ctxt.Arch, int64(off), uint8(funcID)))
- off += 2 // pad
+ // flag uint8
+ var flag objabi.FuncFlag
+ if fi.Valid() {
+ flag = fi.FuncFlag()
+ }
+ off = uint32(sb.SetUint8(ctxt.Arch, int64(off), uint8(flag)))
+
+ off += 1 // pad
// nfuncdata must be the final entry.
funcdata, funcdataoff = funcData(fi, 0, funcdata, funcdataoff)
diff --git a/src/cmd/link/internal/ld/pe.go b/src/cmd/link/internal/ld/pe.go
index 5edaf54dd2..a0aba866dc 100644
--- a/src/cmd/link/internal/ld/pe.go
+++ b/src/cmd/link/internal/ld/pe.go
@@ -42,11 +42,11 @@ type IMAGE_EXPORT_DIRECTORY struct {
AddressOfNameOrdinals uint32
}
-const (
- PEBASE = 0x00400000
-)
-
var (
+ // PEBASE is the base address for the executable.
+ // It is small for 32-bit and large for 64-bit.
+ PEBASE int64
+
// SectionAlignment must be greater than or equal to FileAlignment.
// The default is the page size for the architecture.
PESECTALIGN int64 = 0x1000
@@ -66,9 +66,12 @@ const (
IMAGE_SCN_MEM_WRITE = 0x80000000
IMAGE_SCN_MEM_DISCARDABLE = 0x2000000
IMAGE_SCN_LNK_NRELOC_OVFL = 0x1000000
+ IMAGE_SCN_ALIGN_4BYTES = 0x300000
+ IMAGE_SCN_ALIGN_8BYTES = 0x400000
IMAGE_SCN_ALIGN_32BYTES = 0x600000
)
+// See https://docs.microsoft.com/en-us/windows/win32/debug/pe-format.
// TODO(crawshaw): add these constants to debug/pe.
const (
// TODO: the Microsoft doco says IMAGE_SYM_DTYPE_ARRAY is 3 and IMAGE_SYM_DTYPE_FUNCTION is 2
@@ -95,6 +98,25 @@ const (
IMAGE_REL_ARM_BRANCH11 = 0x0004
IMAGE_REL_ARM_SECREL = 0x000F
+ IMAGE_REL_ARM64_ABSOLUTE = 0x0000
+ IMAGE_REL_ARM64_ADDR32 = 0x0001
+ IMAGE_REL_ARM64_ADDR32NB = 0x0002
+ IMAGE_REL_ARM64_BRANCH26 = 0x0003
+ IMAGE_REL_ARM64_PAGEBASE_REL21 = 0x0004
+ IMAGE_REL_ARM64_REL21 = 0x0005
+ IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006
+ IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007
+ IMAGE_REL_ARM64_SECREL = 0x0008
+ IMAGE_REL_ARM64_SECREL_LOW12A = 0x0009
+ IMAGE_REL_ARM64_SECREL_HIGH12A = 0x000A
+ IMAGE_REL_ARM64_SECREL_LOW12L = 0x000B
+ IMAGE_REL_ARM64_TOKEN = 0x000C
+ IMAGE_REL_ARM64_SECTION = 0x000D
+ IMAGE_REL_ARM64_ADDR64 = 0x000E
+ IMAGE_REL_ARM64_BRANCH19 = 0x000F
+ IMAGE_REL_ARM64_BRANCH14 = 0x0010
+ IMAGE_REL_ARM64_REL32 = 0x0011
+
IMAGE_REL_BASED_HIGHLOW = 3
IMAGE_REL_BASED_DIR64 = 10
)
@@ -316,8 +338,8 @@ func (sect *peSection) checkOffset(off int64) {
// checkSegment verifies COFF section sect matches address
// and file offset provided in segment seg.
func (sect *peSection) checkSegment(seg *sym.Segment) {
- if seg.Vaddr-PEBASE != uint64(sect.virtualAddress) {
- Errorf(nil, "%s.VirtualAddress = %#x, want %#x", sect.name, uint64(int64(sect.virtualAddress)), uint64(int64(seg.Vaddr-PEBASE)))
+ if seg.Vaddr-uint64(PEBASE) != uint64(sect.virtualAddress) {
+ Errorf(nil, "%s.VirtualAddress = %#x, want %#x", sect.name, uint64(int64(sect.virtualAddress)), uint64(int64(seg.Vaddr-uint64(PEBASE))))
errorexit()
}
if seg.Fileoff != uint64(sect.pointerToRawData) {
@@ -398,14 +420,16 @@ func (f *peFile) addSection(name string, sectsize int, filesize int) *peSection
name: name,
shortName: name,
index: len(f.sections) + 1,
- virtualSize: uint32(sectsize),
virtualAddress: f.nextSectOffset,
pointerToRawData: f.nextFileOffset,
}
f.nextSectOffset = uint32(Rnd(int64(f.nextSectOffset)+int64(sectsize), PESECTALIGN))
if filesize > 0 {
+ sect.virtualSize = uint32(sectsize)
sect.sizeOfRawData = uint32(Rnd(int64(filesize), PEFILEALIGN))
f.nextFileOffset += sect.sizeOfRawData
+ } else {
+ sect.sizeOfRawData = uint32(sectsize)
}
f.sections = append(f.sections, sect)
return sect
@@ -456,18 +480,19 @@ func (f *peFile) addInitArray(ctxt *Link) *peSection {
// However, the entire Go runtime is initialized from just one function, so it is unlikely
// that this will need to grow in the future.
var size int
+ var alignment uint32
switch objabi.GOARCH {
default:
Exitf("peFile.addInitArray: unsupported GOARCH=%q\n", objabi.GOARCH)
- case "386":
+ case "386", "arm":
size = 4
- case "amd64":
+ alignment = IMAGE_SCN_ALIGN_4BYTES
+ case "amd64", "arm64":
size = 8
- case "arm":
- size = 4
+ alignment = IMAGE_SCN_ALIGN_8BYTES
}
sect := f.addSection(".ctors", size, size)
- sect.characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ
+ sect.characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ | IMAGE_SCN_MEM_WRITE | alignment
sect.sizeOfRawData = uint32(size)
ctxt.Out.SeekSet(int64(sect.pointerToRawData))
sect.checkOffset(ctxt.Out.Offset())
@@ -477,7 +502,7 @@ func (f *peFile) addInitArray(ctxt *Link) *peSection {
switch objabi.GOARCH {
case "386", "arm":
ctxt.Out.Write32(uint32(addr))
- case "amd64":
+ case "amd64", "arm64":
ctxt.Out.Write64(addr)
}
return sect
@@ -594,6 +619,8 @@ dwarfLoop:
ctxt.Out.Write16(IMAGE_REL_AMD64_ADDR64)
case "arm":
ctxt.Out.Write16(IMAGE_REL_ARM_ADDR32)
+ case "arm64":
+ ctxt.Out.Write16(IMAGE_REL_ARM64_ADDR64)
}
return 1
})
@@ -788,6 +815,8 @@ func (f *peFile) writeFileHeader(ctxt *Link) {
fh.Machine = pe.IMAGE_FILE_MACHINE_I386
case sys.ARM:
fh.Machine = pe.IMAGE_FILE_MACHINE_ARMNT
+ case sys.ARM64:
+ fh.Machine = pe.IMAGE_FILE_MACHINE_ARM64
}
fh.NumberOfSections = uint16(len(f.sections))
@@ -852,8 +881,8 @@ func (f *peFile) writeOptionalHeader(ctxt *Link) {
}
oh64.BaseOfCode = f.textSect.virtualAddress
oh.BaseOfCode = f.textSect.virtualAddress
- oh64.ImageBase = PEBASE
- oh.ImageBase = PEBASE
+ oh64.ImageBase = uint64(PEBASE)
+ oh.ImageBase = uint32(PEBASE)
oh64.SectionAlignment = uint32(PESECTALIGN)
oh.SectionAlignment = uint32(PESECTALIGN)
oh64.FileAlignment = uint32(PEFILEALIGN)
@@ -891,13 +920,7 @@ func (f *peFile) writeOptionalHeader(ctxt *Link) {
oh.DllCharacteristics |= pe.IMAGE_DLLCHARACTERISTICS_NX_COMPAT
// The DLL can be relocated at load time.
- switch ctxt.Arch.Family {
- case sys.AMD64, sys.I386:
- if ctxt.BuildMode == BuildModePIE {
- oh64.DllCharacteristics |= pe.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
- oh.DllCharacteristics |= pe.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
- }
- case sys.ARM:
+ if needPEBaseReloc(ctxt) {
oh64.DllCharacteristics |= pe.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
oh.DllCharacteristics |= pe.IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
}
@@ -975,18 +998,23 @@ var pefile peFile
func Peinit(ctxt *Link) {
var l int
- switch ctxt.Arch.Family {
- // 64-bit architectures
- case sys.AMD64:
+ if ctxt.Arch.PtrSize == 8 {
+ // 64-bit architectures
pe64 = 1
+ PEBASE = 1 << 32
+ if ctxt.Arch.Family == sys.AMD64 {
+ // TODO(rsc): For cgo we currently use 32-bit relocations
+ // that fail when PEBASE is too large.
+ // We need to fix this, but for now, use a smaller PEBASE.
+ PEBASE = 1 << 22
+ }
var oh64 pe.OptionalHeader64
l = binary.Size(&oh64)
-
- // 32-bit architectures
- default:
+ } else {
+ // 32-bit architectures
+ PEBASE = 1 << 22
var oh pe.OptionalHeader32
l = binary.Size(&oh)
-
}
if ctxt.LinkMode == LinkExternal {
@@ -1210,7 +1238,7 @@ func addimports(ctxt *Link, datsect *peSection) {
endoff := ctxt.Out.Offset()
// write FirstThunks (allocated in .data section)
- ftbase := uint64(ldr.SymValue(dynamic)) - uint64(datsect.virtualAddress) - PEBASE
+ ftbase := uint64(ldr.SymValue(dynamic)) - uint64(datsect.virtualAddress) - uint64(PEBASE)
ctxt.Out.SeekSet(int64(uint64(datsect.pointerToRawData) + ftbase))
for d := dr; d != nil; d = d.next {
@@ -1463,17 +1491,18 @@ func addPEBaseRelocSym(ldr *loader.Loader, s loader.Sym, rt *peBaseRelocTable) {
}
}
+func needPEBaseReloc(ctxt *Link) bool {
+ // Non-PIE x86 binaries don't need the base relocation table.
+ // Everyone else does.
+ if (ctxt.Arch.Family == sys.I386 || ctxt.Arch.Family == sys.AMD64) && ctxt.BuildMode != BuildModePIE {
+ return false
+ }
+ return true
+}
+
func addPEBaseReloc(ctxt *Link) {
- // Arm does not work without base relocation table.
- // 386 and amd64 will only require the table for BuildModePIE.
- switch ctxt.Arch.Family {
- default:
+ if !needPEBaseReloc(ctxt) {
return
- case sys.I386, sys.AMD64:
- if ctxt.BuildMode != BuildModePIE {
- return
- }
- case sys.ARM:
}
var rt peBaseRelocTable
@@ -1562,12 +1591,6 @@ func addpersrc(ctxt *Link) {
}
func asmbPe(ctxt *Link) {
- switch ctxt.Arch.Family {
- default:
- Exitf("unknown PE architecture: %v", ctxt.Arch.Family)
- case sys.AMD64, sys.I386, sys.ARM:
- }
-
t := pefile.addSection(".text", int(Segtext.Length), int(Segtext.Length))
t.characteristics = IMAGE_SCN_CNT_CODE | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ
if ctxt.LinkMode == LinkExternal {
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go
index 971cc432ff..c05309a141 100644
--- a/src/cmd/link/internal/loader/loader.go
+++ b/src/cmd/link/internal/loader/loader.go
@@ -241,7 +241,6 @@ type Loader struct {
attrExternal Bitmap // external symbols, indexed by ext sym index
attrReadOnly map[Sym]bool // readonly data for this sym
- attrTopFrame map[Sym]struct{} // top frame symbols
attrSpecial map[Sym]struct{} // "special" frame symbols
attrCgoExportDynamic map[Sym]struct{} // "cgo_export_dynamic" symbols
attrCgoExportStatic map[Sym]struct{} // "cgo_export_static" symbols
@@ -322,6 +321,7 @@ type extSymPayload struct {
const (
// Loader.flags
FlagStrictDups = 1 << iota
+ FlagUseABIAlias
)
func NewLoader(flags uint32, elfsetstring elfsetstringFunc, reporter *ErrorReporter) *Loader {
@@ -348,7 +348,6 @@ func NewLoader(flags uint32, elfsetstring elfsetstringFunc, reporter *ErrorRepor
plt: make(map[Sym]int32),
got: make(map[Sym]int32),
dynid: make(map[Sym]int32),
- attrTopFrame: make(map[Sym]struct{}),
attrSpecial: make(map[Sym]struct{}),
attrCgoExportDynamic: make(map[Sym]struct{}),
attrCgoExportStatic: make(map[Sym]struct{}),
@@ -1008,24 +1007,6 @@ func (l *Loader) SetAttrExternal(i Sym, v bool) {
}
}
-// AttrTopFrame returns true for a function symbol that is an entry
-// point, meaning that unwinders should stop when they hit this
-// function.
-func (l *Loader) AttrTopFrame(i Sym) bool {
- _, ok := l.attrTopFrame[i]
- return ok
-}
-
-// SetAttrTopFrame sets the "top frame" property for a symbol (see
-// AttrTopFrame).
-func (l *Loader) SetAttrTopFrame(i Sym, v bool) {
- if v {
- l.attrTopFrame[i] = struct{}{}
- } else {
- delete(l.attrTopFrame, i)
- }
-}
-
// AttrSpecial returns true for a symbols that do not have their
// address (i.e. Value) computed by the usual mechanism of
// data.go:dodata() & data.go:address().
@@ -1566,7 +1547,7 @@ func (l *Loader) SymUnit(i Sym) *sym.CompilationUnit {
// regular compiler-generated Go symbols), but in the case of
// building with "-linkshared" (when a symbol is read from a
// shared library), will hold the library name.
-// NOTE: this correspondes to sym.Symbol.File field.
+// NOTE: this corresponds to sym.Symbol.File field.
func (l *Loader) SymPkg(i Sym) string {
if f, ok := l.symPkg[i]; ok {
return f
@@ -1904,7 +1885,11 @@ func (fi *FuncInfo) Locals() int {
}
func (fi *FuncInfo) FuncID() objabi.FuncID {
- return objabi.FuncID((*goobj.FuncInfo)(nil).ReadFuncID(fi.data))
+ return (*goobj.FuncInfo)(nil).ReadFuncID(fi.data)
+}
+
+func (fi *FuncInfo) FuncFlag() objabi.FuncFlag {
+ return (*goobj.FuncInfo)(nil).ReadFuncFlag(fi.data)
}
func (fi *FuncInfo) Pcsp() Sym {
@@ -1991,6 +1976,13 @@ func (fi *FuncInfo) File(k int) goobj.CUFileIndex {
return (*goobj.FuncInfo)(nil).ReadFile(fi.data, fi.lengths.FileOff, uint32(k))
}
+// TopFrame returns true if the function associated with this FuncInfo
+// is an entry point, meaning that unwinders should stop when they hit
+// this function.
+func (fi *FuncInfo) TopFrame() bool {
+ return (fi.FuncFlag() & objabi.FuncFlag_TOPFRAME) != 0
+}
+
type InlTreeNode struct {
Parent int32
File goobj.CUFileIndex
@@ -2150,9 +2142,6 @@ func (st *loadState) preloadSyms(r *oReader, kind int) {
}
gi := st.addSym(name, v, r, i, kind, osym)
r.syms[i] = gi
- if osym.TopFrame() {
- l.SetAttrTopFrame(gi, true)
- }
if osym.Local() {
l.SetAttrLocal(gi, true)
}
@@ -2270,6 +2259,9 @@ func abiToVer(abi uint16, localSymVersion int) int {
// symbol. If the sym in question is not an alias, the sym itself is
// returned.
func (l *Loader) ResolveABIAlias(s Sym) Sym {
+ if l.flags&FlagUseABIAlias == 0 {
+ return s
+ }
if s == 0 {
return 0
}
@@ -2407,7 +2399,6 @@ func (l *Loader) CopyAttributes(src Sym, dst Sym) {
// when copying attributes from a dupOK ABI wrapper symbol to
// the real target symbol (which may not be marked dupOK).
}
- l.SetAttrTopFrame(dst, l.AttrTopFrame(src))
l.SetAttrSpecial(dst, l.AttrSpecial(src))
l.SetAttrCgoExportDynamic(dst, l.AttrCgoExportDynamic(src))
l.SetAttrCgoExportStatic(dst, l.AttrCgoExportStatic(src))
diff --git a/src/cmd/link/internal/loadpe/ldpe.go b/src/cmd/link/internal/loadpe/ldpe.go
index a5c025de8f..f474dfb276 100644
--- a/src/cmd/link/internal/loadpe/ldpe.go
+++ b/src/cmd/link/internal/loadpe/ldpe.go
@@ -115,6 +115,24 @@ const (
IMAGE_REL_THUMB_BRANCH24 = 0x0014
IMAGE_REL_THUMB_BLX23 = 0x0015
IMAGE_REL_ARM_PAIR = 0x0016
+ IMAGE_REL_ARM64_ABSOLUTE = 0x0000
+ IMAGE_REL_ARM64_ADDR32 = 0x0001
+ IMAGE_REL_ARM64_ADDR32NB = 0x0002
+ IMAGE_REL_ARM64_BRANCH26 = 0x0003
+ IMAGE_REL_ARM64_PAGEBASE_REL21 = 0x0004
+ IMAGE_REL_ARM64_REL21 = 0x0005
+ IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006
+ IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007
+ IMAGE_REL_ARM64_SECREL = 0x0008
+ IMAGE_REL_ARM64_SECREL_LOW12A = 0x0009
+ IMAGE_REL_ARM64_SECREL_HIGH12A = 0x000A
+ IMAGE_REL_ARM64_SECREL_LOW12L = 0x000B
+ IMAGE_REL_ARM64_TOKEN = 0x000C
+ IMAGE_REL_ARM64_SECTION = 0x000D
+ IMAGE_REL_ARM64_ADDR64 = 0x000E
+ IMAGE_REL_ARM64_BRANCH19 = 0x000F
+ IMAGE_REL_ARM64_BRANCH14 = 0x0010
+ IMAGE_REL_ARM64_REL32 = 0x0011
)
// TODO(crawshaw): de-duplicate these symbols with cmd/internal/ld, ideally in debug/pe.
@@ -321,6 +339,17 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, input *bio.Read
rAdd = int64(int32(binary.LittleEndian.Uint32(sectdata[rsect][rOff:])))
}
+
+ case sys.ARM64:
+ switch r.Type {
+ default:
+ return nil, nil, fmt.Errorf("%s: %v: unknown ARM64 relocation type %v", pn, sectsyms[rsect], r.Type)
+
+ case IMAGE_REL_ARM64_ADDR32, IMAGE_REL_ARM64_ADDR32NB:
+ rType = objabi.R_ADDR
+
+ rAdd = int64(int32(binary.LittleEndian.Uint32(sectdata[rsect][rOff:])))
+ }
}
// ld -r could generate multiple section symbols for the
diff --git a/src/cmd/link/internal/ppc64/asm.go b/src/cmd/link/internal/ppc64/asm.go
index 5bf3898eb9..602f0b5299 100644
--- a/src/cmd/link/internal/ppc64/asm.go
+++ b/src/cmd/link/internal/ppc64/asm.go
@@ -656,13 +656,19 @@ func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
relocs := ldr.Relocs(s)
r := relocs.At(ri)
- t := ldr.SymValue(rs) + r.Add() - (ldr.SymValue(s) + int64(r.Off()))
+ var t int64
+ // ldr.SymValue(rs) == 0 indicates a cross-package jump to a function that is not yet
+ // laid out. Conservatively use a trampoline. This should be rare, as we lay out packages
+ // in dependency order.
+ if ldr.SymValue(rs) != 0 {
+ t = ldr.SymValue(rs) + r.Add() - (ldr.SymValue(s) + int64(r.Off()))
+ }
switch r.Type() {
case objabi.R_CALLPOWER:
// If branch offset is too far then create a trampoline.
- if (ctxt.IsExternal() && ldr.SymSect(s) != ldr.SymSect(rs)) || (ctxt.IsInternal() && int64(int32(t<<6)>>6) != t) || (*ld.FlagDebugTramp > 1 && ldr.SymPkg(s) != ldr.SymPkg(rs)) {
+ if (ctxt.IsExternal() && ldr.SymSect(s) != ldr.SymSect(rs)) || (ctxt.IsInternal() && int64(int32(t<<6)>>6) != t) || ldr.SymValue(rs) == 0 || (*ld.FlagDebugTramp > 1 && ldr.SymPkg(s) != ldr.SymPkg(rs)) {
var tramp loader.Sym
for i := 0; ; i++ {
@@ -749,7 +755,7 @@ func gentramp(ctxt *ld.Link, ldr *loader.Loader, tramp *loader.SymbolBuilder, ta
// With external linking, the target address must be
// relocated using LO and HA
- if ctxt.IsExternal() {
+ if ctxt.IsExternal() || ldr.SymValue(target) == 0 {
r, _ := tramp.AddRel(objabi.R_ADDRPOWER)
r.SetOff(0)
r.SetSiz(8) // generates 2 relocations: HA + LO
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index 8153c0b31b..9c69ccca43 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -583,7 +583,7 @@ TEXT ·alignPc(SB),NOSPLIT, $0-0
`
// TestFuncAlign verifies that the address of a function can be aligned
-// with a specfic value on arm64.
+// with a specific value on arm64.
func TestFuncAlign(t *testing.T) {
if runtime.GOARCH != "arm64" || runtime.GOOS != "linux" {
t.Skip("skipping on non-linux/arm64 platform")
@@ -753,23 +753,24 @@ func TestIndexMismatch(t *testing.T) {
}
}
-func TestPErsrc(t *testing.T) {
+func TestPErsrcBinutils(t *testing.T) {
// Test that PE rsrc section is handled correctly (issue 39658).
testenv.MustHaveGoBuild(t)
- if runtime.GOARCH != "amd64" || runtime.GOOS != "windows" {
- t.Skipf("this is a windows/amd64-only test")
+ if (runtime.GOARCH != "386" && runtime.GOARCH != "amd64") || runtime.GOOS != "windows" {
+ // This test is limited to amd64 and 386, because binutils is limited as such
+ t.Skipf("this is only for windows/amd64 and windows/386")
}
t.Parallel()
- tmpdir, err := ioutil.TempDir("", "TestPErsrc")
+ tmpdir, err := ioutil.TempDir("", "TestPErsrcBinutils")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpdir)
- pkgdir := filepath.Join("testdata", "testPErsrc")
+ pkgdir := filepath.Join("testdata", "pe-binutils")
exe := filepath.Join(tmpdir, "a.exe")
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe)
cmd.Dir = pkgdir
@@ -787,19 +788,36 @@ func TestPErsrc(t *testing.T) {
if !bytes.Contains(b, []byte("Hello Gophers!")) {
t.Fatalf("binary does not contain expected content")
}
+}
+
+func TestPErsrcLLVM(t *testing.T) {
+ // Test that PE rsrc section is handled correctly (issue 39658).
+ testenv.MustHaveGoBuild(t)
+
+ if runtime.GOOS != "windows" {
+ t.Skipf("this is a windows-only test")
+ }
+
+ t.Parallel()
+
+ tmpdir, err := ioutil.TempDir("", "TestPErsrcLLVM")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(tmpdir)
- pkgdir = filepath.Join("testdata", "testPErsrc-complex")
- exe = filepath.Join(tmpdir, "a.exe")
- cmd = exec.Command(testenv.GoToolPath(t), "build", "-o", exe)
+ pkgdir := filepath.Join("testdata", "pe-llvm")
+ exe := filepath.Join(tmpdir, "a.exe")
+ cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", exe)
cmd.Dir = pkgdir
// cmd.Env = append(os.Environ(), "GOOS=windows", "GOARCH=amd64") // uncomment if debugging in a cross-compiling environment
- out, err = cmd.CombinedOutput()
+ out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("building failed: %v, output:\n%s", err, out)
}
// Check that the binary contains the rsrc data
- b, err = ioutil.ReadFile(exe)
+ b, err := ioutil.ReadFile(exe)
if err != nil {
t.Fatalf("reading output failed: %v", err)
}
diff --git a/src/cmd/link/testdata/testPErsrc/main.go b/src/cmd/link/testdata/pe-binutils/main.go
index 5eb66fb9cc..14ea6f9e0f 100644
--- a/src/cmd/link/testdata/testPErsrc/main.go
+++ b/src/cmd/link/testdata/pe-binutils/main.go
@@ -4,10 +4,9 @@
// Test that a PE rsrc section is handled correctly (issue 39658).
//
-// rsrc.syso is created with:
-// windres -i a.rc -o rsrc.syso -O coff
-// on windows-amd64-2016 builder, where a.rc is a text file with
-// the following content:
+// rsrc.syso is created using binutils with:
+// {x86_64,i686}-w64-mingw32-windres -i a.rc -o rsrc_$GOARCH.syso -O coff
+// where a.rc is a text file with the following content:
//
// resname RCDATA {
// "Hello Gophers!\0",
diff --git a/src/cmd/link/testdata/pe-binutils/rsrc_386.syso b/src/cmd/link/testdata/pe-binutils/rsrc_386.syso
new file mode 100644
index 0000000000..b4abc58abe
--- /dev/null
+++ b/src/cmd/link/testdata/pe-binutils/rsrc_386.syso
Binary files differ
diff --git a/src/cmd/link/testdata/testPErsrc/rsrc.syso b/src/cmd/link/testdata/pe-binutils/rsrc_amd64.syso
index 0d9699da04..0d9699da04 100644
--- a/src/cmd/link/testdata/testPErsrc/rsrc.syso
+++ b/src/cmd/link/testdata/pe-binutils/rsrc_amd64.syso
Binary files differ
diff --git a/src/cmd/link/testdata/testPErsrc-complex/main.go b/src/cmd/link/testdata/pe-llvm/main.go
index affd6eada2..099a71a3ff 100644
--- a/src/cmd/link/testdata/testPErsrc-complex/main.go
+++ b/src/cmd/link/testdata/pe-llvm/main.go
@@ -6,8 +6,8 @@
// have been created by llvm-rc or msvc's rc.exe, which means there's the
// @feat.00 symbol as well as split .rsrc$00 and .rsrc$01 section to deal with.
//
-// rsrc.syso is created with:
-// windres -i a.rc -o rsrc.syso -O coff
+// rsrc.syso is created using llvm with:
+// {i686,x86_64,armv7,arm64}-w64-mingw32-windres -i a.rc -o rsrc_$GOARCH.syso -O coff
// where this windres calls into llvm-rc and llvm-cvtres. The source file,
// a.rc, simply contains a reference to its own bytes:
//
diff --git a/src/cmd/link/testdata/pe-llvm/rsrc_386.syso b/src/cmd/link/testdata/pe-llvm/rsrc_386.syso
new file mode 100644
index 0000000000..21126c9954
--- /dev/null
+++ b/src/cmd/link/testdata/pe-llvm/rsrc_386.syso
Binary files differ
diff --git a/src/cmd/link/testdata/testPErsrc-complex/rsrc.syso b/src/cmd/link/testdata/pe-llvm/rsrc_amd64.syso
index eff630b8a2..56f9260b0a 100644
--- a/src/cmd/link/testdata/testPErsrc-complex/rsrc.syso
+++ b/src/cmd/link/testdata/pe-llvm/rsrc_amd64.syso
Binary files differ
diff --git a/src/cmd/link/testdata/pe-llvm/rsrc_arm.syso b/src/cmd/link/testdata/pe-llvm/rsrc_arm.syso
new file mode 100644
index 0000000000..c93a1e9ba0
--- /dev/null
+++ b/src/cmd/link/testdata/pe-llvm/rsrc_arm.syso
Binary files differ
diff --git a/src/cmd/link/testdata/pe-llvm/rsrc_arm64.syso b/src/cmd/link/testdata/pe-llvm/rsrc_arm64.syso
new file mode 100644
index 0000000000..7849638ddd
--- /dev/null
+++ b/src/cmd/link/testdata/pe-llvm/rsrc_arm64.syso
Binary files differ
diff --git a/src/cmd/nm/nm_cgo_test.go b/src/cmd/nm/nm_cgo_test.go
index e0414e6b22..536e87e4ae 100644
--- a/src/cmd/nm/nm_cgo_test.go
+++ b/src/cmd/nm/nm_cgo_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo
// +build cgo
package main
diff --git a/src/cmd/pprof/readlineui.go b/src/cmd/pprof/readlineui.go
index 0c9fafdad7..dbbb9c2787 100644
--- a/src/cmd/pprof/readlineui.go
+++ b/src/cmd/pprof/readlineui.go
@@ -5,6 +5,7 @@
// This file contains a driver.UI implementation
// that provides the readline functionality if possible.
+//go:build (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows) && !appengine && !android
// +build darwin dragonfly freebsd linux netbsd openbsd solaris windows
// +build !appengine
// +build !android
diff --git a/src/cmd/trace/annotations_test.go b/src/cmd/trace/annotations_test.go
index 9c2d027366..acd5693c7d 100644
--- a/src/cmd/trace/annotations_test.go
+++ b/src/cmd/trace/annotations_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package main
diff --git a/src/cmd/trace/trace_test.go b/src/cmd/trace/trace_test.go
index ea0cc6f880..2b1a68d7f3 100644
--- a/src/cmd/trace/trace_test.go
+++ b/src/cmd/trace/trace_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package main
diff --git a/src/cmd/trace/trace_unix_test.go b/src/cmd/trace/trace_unix_test.go
index c569b40bb2..8dc56a8c7b 100644
--- a/src/cmd/trace/trace_unix_test.go
+++ b/src/cmd/trace/trace_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package main
diff --git a/src/cmd/vendor/golang.org/x/mod/modfile/rule.go b/src/cmd/vendor/golang.org/x/mod/modfile/rule.go
index c6a189dbe0..f8c9384985 100644
--- a/src/cmd/vendor/golang.org/x/mod/modfile/rule.go
+++ b/src/cmd/vendor/golang.org/x/mod/modfile/rule.go
@@ -125,6 +125,12 @@ func (f *File) AddComment(text string) {
type VersionFixer func(path, version string) (string, error)
+// errDontFix is returned by a VersionFixer to indicate the version should be
+// left alone, even if it's not canonical.
+var dontFixRetract VersionFixer = func(_, vers string) (string, error) {
+ return vers, nil
+}
+
// Parse parses the data, reported in errors as being from file,
// into a File struct. It applies fix, if non-nil, to canonicalize all module versions found.
func Parse(file string, data []byte, fix VersionFixer) (*File, error) {
@@ -142,7 +148,7 @@ func ParseLax(file string, data []byte, fix VersionFixer) (*File, error) {
return parseToFile(file, data, fix, false)
}
-func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (*File, error) {
+func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (parsed *File, err error) {
fs, err := parse(file, data)
if err != nil {
return nil, err
@@ -150,8 +156,18 @@ func parseToFile(file string, data []byte, fix VersionFixer, strict bool) (*File
f := &File{
Syntax: fs,
}
-
var errs ErrorList
+
+ // fix versions in retract directives after the file is parsed.
+ // We need the module path to fix versions, and it might be at the end.
+ defer func() {
+ oldLen := len(errs)
+ f.fixRetract(fix, &errs)
+ if len(errs) > oldLen {
+ parsed, err = nil, errs
+ }
+ }()
+
for _, x := range fs.Stmt {
switch x := x.(type) {
case *Line:
@@ -370,7 +386,7 @@ func (f *File) add(errs *ErrorList, block *LineBlock, line *Line, verb string, a
case "retract":
rationale := parseRetractRationale(block, line)
- vi, err := parseVersionInterval(verb, &args, fix)
+ vi, err := parseVersionInterval(verb, "", &args, dontFixRetract)
if err != nil {
if strict {
wrapError(err)
@@ -397,6 +413,47 @@ func (f *File) add(errs *ErrorList, block *LineBlock, line *Line, verb string, a
}
}
+// fixRetract applies fix to each retract directive in f, appending any errors
+// to errs.
+//
+// Most versions are fixed as we parse the file, but for retract directives,
+// the relevant module path is the one specified with the module directive,
+// and that might appear at the end of the file (or not at all).
+func (f *File) fixRetract(fix VersionFixer, errs *ErrorList) {
+ if fix == nil {
+ return
+ }
+ path := ""
+ if f.Module != nil {
+ path = f.Module.Mod.Path
+ }
+ var r *Retract
+ wrapError := func(err error) {
+ *errs = append(*errs, Error{
+ Filename: f.Syntax.Name,
+ Pos: r.Syntax.Start,
+ Err: err,
+ })
+ }
+
+ for _, r = range f.Retract {
+ if path == "" {
+ wrapError(errors.New("no module directive found, so retract cannot be used"))
+ return // only print the first one of these
+ }
+
+ args := r.Syntax.Token
+ if args[0] == "retract" {
+ args = args[1:]
+ }
+ vi, err := parseVersionInterval("retract", path, &args, fix)
+ if err != nil {
+ wrapError(err)
+ }
+ r.VersionInterval = vi
+ }
+}
+
// isIndirect reports whether line has a "// indirect" comment,
// meaning it is in go.mod only for its effect on indirect dependencies,
// so that it can be dropped entirely once the effective version of the
@@ -491,13 +548,13 @@ func AutoQuote(s string) string {
return s
}
-func parseVersionInterval(verb string, args *[]string, fix VersionFixer) (VersionInterval, error) {
+func parseVersionInterval(verb string, path string, args *[]string, fix VersionFixer) (VersionInterval, error) {
toks := *args
if len(toks) == 0 || toks[0] == "(" {
return VersionInterval{}, fmt.Errorf("expected '[' or version")
}
if toks[0] != "[" {
- v, err := parseVersion(verb, "", &toks[0], fix)
+ v, err := parseVersion(verb, path, &toks[0], fix)
if err != nil {
return VersionInterval{}, err
}
@@ -509,7 +566,7 @@ func parseVersionInterval(verb string, args *[]string, fix VersionFixer) (Versio
if len(toks) == 0 {
return VersionInterval{}, fmt.Errorf("expected version after '['")
}
- low, err := parseVersion(verb, "", &toks[0], fix)
+ low, err := parseVersion(verb, path, &toks[0], fix)
if err != nil {
return VersionInterval{}, err
}
@@ -523,7 +580,7 @@ func parseVersionInterval(verb string, args *[]string, fix VersionFixer) (Versio
if len(toks) == 0 {
return VersionInterval{}, fmt.Errorf("expected version after ','")
}
- high, err := parseVersion(verb, "", &toks[0], fix)
+ high, err := parseVersion(verb, path, &toks[0], fix)
if err != nil {
return VersionInterval{}, err
}
@@ -631,8 +688,7 @@ func parseVersion(verb string, path string, s *string, fix VersionFixer) (string
}
}
if fix != nil {
- var err error
- t, err = fix(path, t)
+ fixed, err := fix(path, t)
if err != nil {
if err, ok := err.(*module.ModuleError); ok {
return "", &Error{
@@ -643,19 +699,23 @@ func parseVersion(verb string, path string, s *string, fix VersionFixer) (string
}
return "", err
}
+ t = fixed
+ } else {
+ cv := module.CanonicalVersion(t)
+ if cv == "" {
+ return "", &Error{
+ Verb: verb,
+ ModPath: path,
+ Err: &module.InvalidVersionError{
+ Version: t,
+ Err: errors.New("must be of the form v1.2.3"),
+ },
+ }
+ }
+ t = cv
}
- if v := module.CanonicalVersion(t); v != "" {
- *s = v
- return *s, nil
- }
- return "", &Error{
- Verb: verb,
- ModPath: path,
- Err: &module.InvalidVersionError{
- Version: t,
- Err: errors.New("must be of the form v1.2.3"),
- },
- }
+ *s = t
+ return *s, nil
}
func modulePathMajor(path string) (string, error) {
@@ -835,11 +895,8 @@ func (f *File) DropRequire(path string) error {
// AddExclude adds a exclude statement to the mod file. Errors if the provided
// version is not a canonical version string
func (f *File) AddExclude(path, vers string) error {
- if !isCanonicalVersion(vers) {
- return &module.InvalidVersionError{
- Version: vers,
- Err: errors.New("must be of the form v1.2.3"),
- }
+ if err := checkCanonicalVersion(path, vers); err != nil {
+ return err
}
var hint *Line
@@ -916,17 +973,15 @@ func (f *File) DropReplace(oldPath, oldVers string) error {
// AddRetract adds a retract statement to the mod file. Errors if the provided
// version interval does not consist of canonical version strings
func (f *File) AddRetract(vi VersionInterval, rationale string) error {
- if !isCanonicalVersion(vi.High) {
- return &module.InvalidVersionError{
- Version: vi.High,
- Err: errors.New("must be of the form v1.2.3"),
- }
+ var path string
+ if f.Module != nil {
+ path = f.Module.Mod.Path
}
- if !isCanonicalVersion(vi.Low) {
- return &module.InvalidVersionError{
- Version: vi.Low,
- Err: errors.New("must be of the form v1.2.3"),
- }
+ if err := checkCanonicalVersion(path, vi.High); err != nil {
+ return err
+ }
+ if err := checkCanonicalVersion(path, vi.Low); err != nil {
+ return err
}
r := &Retract{
@@ -1086,8 +1141,40 @@ func lineRetractLess(li, lj *Line) bool {
return semver.Compare(vii.High, vij.High) > 0
}
-// isCanonicalVersion tests if the provided version string represents a valid
-// canonical version.
-func isCanonicalVersion(vers string) bool {
- return vers != "" && semver.Canonical(vers) == vers
+// checkCanonicalVersion returns a non-nil error if vers is not a canonical
+// version string or does not match the major version of path.
+//
+// If path is non-empty, the error text suggests a format with a major version
+// corresponding to the path.
+func checkCanonicalVersion(path, vers string) error {
+ _, pathMajor, pathMajorOk := module.SplitPathVersion(path)
+
+ if vers == "" || vers != module.CanonicalVersion(vers) {
+ if pathMajor == "" {
+ return &module.InvalidVersionError{
+ Version: vers,
+ Err: fmt.Errorf("must be of the form v1.2.3"),
+ }
+ }
+ return &module.InvalidVersionError{
+ Version: vers,
+ Err: fmt.Errorf("must be of the form %s.2.3", module.PathMajorPrefix(pathMajor)),
+ }
+ }
+
+ if pathMajorOk {
+ if err := module.CheckPathMajor(vers, pathMajor); err != nil {
+ if pathMajor == "" {
+ // In this context, the user probably wrote "v2.3.4" when they meant
+ // "v2.3.4+incompatible". Suggest that instead of "v0 or v1".
+ return &module.InvalidVersionError{
+ Version: vers,
+ Err: fmt.Errorf("should be %s+incompatible (or module %s/%v)", vers, path, semver.Major(vers)),
+ }
+ }
+ return err
+ }
+ }
+
+ return nil
}
diff --git a/src/cmd/vendor/golang.org/x/mod/module/module.go b/src/cmd/vendor/golang.org/x/mod/module/module.go
index c1c5263c42..272baeef17 100644
--- a/src/cmd/vendor/golang.org/x/mod/module/module.go
+++ b/src/cmd/vendor/golang.org/x/mod/module/module.go
@@ -270,7 +270,7 @@ func fileNameOK(r rune) bool {
// CheckPath checks that a module path is valid.
// A valid module path is a valid import path, as checked by CheckImportPath,
-// with two additional constraints.
+// with three additional constraints.
// First, the leading path element (up to the first slash, if any),
// by convention a domain name, must contain only lower-case ASCII letters,
// ASCII digits, dots (U+002E), and dashes (U+002D);
@@ -280,8 +280,9 @@ func fileNameOK(r rune) bool {
// and must not contain any dots. For paths beginning with "gopkg.in/",
// this second requirement is replaced by a requirement that the path
// follow the gopkg.in server's conventions.
+// Third, no path element may begin with a dot.
func CheckPath(path string) error {
- if err := checkPath(path, false); err != nil {
+ if err := checkPath(path, modulePath); err != nil {
return fmt.Errorf("malformed module path %q: %v", path, err)
}
i := strings.Index(path, "/")
@@ -315,7 +316,7 @@ func CheckPath(path string) error {
//
// A valid path element is a non-empty string made up of
// ASCII letters, ASCII digits, and limited ASCII punctuation: - . _ and ~.
-// It must not begin or end with a dot (U+002E), nor contain two dots in a row.
+// It must not end with a dot (U+002E), nor contain two dots in a row.
//
// The element prefix up to the first dot must not be a reserved file name
// on Windows, regardless of case (CON, com1, NuL, and so on). The element
@@ -326,19 +327,29 @@ func CheckPath(path string) error {
// top-level package documentation for additional information about
// subtleties of Unicode.
func CheckImportPath(path string) error {
- if err := checkPath(path, false); err != nil {
+ if err := checkPath(path, importPath); err != nil {
return fmt.Errorf("malformed import path %q: %v", path, err)
}
return nil
}
+// pathKind indicates what kind of path we're checking. Module paths,
+// import paths, and file paths have different restrictions.
+type pathKind int
+
+const (
+ modulePath pathKind = iota
+ importPath
+ filePath
+)
+
// checkPath checks that a general path is valid.
// It returns an error describing why but not mentioning path.
// Because these checks apply to both module paths and import paths,
// the caller is expected to add the "malformed ___ path %q: " prefix.
// fileName indicates whether the final element of the path is a file name
// (as opposed to a directory name).
-func checkPath(path string, fileName bool) error {
+func checkPath(path string, kind pathKind) error {
if !utf8.ValidString(path) {
return fmt.Errorf("invalid UTF-8")
}
@@ -357,35 +368,34 @@ func checkPath(path string, fileName bool) error {
elemStart := 0
for i, r := range path {
if r == '/' {
- if err := checkElem(path[elemStart:i], fileName); err != nil {
+ if err := checkElem(path[elemStart:i], kind); err != nil {
return err
}
elemStart = i + 1
}
}
- if err := checkElem(path[elemStart:], fileName); err != nil {
+ if err := checkElem(path[elemStart:], kind); err != nil {
return err
}
return nil
}
// checkElem checks whether an individual path element is valid.
-// fileName indicates whether the element is a file name (not a directory name).
-func checkElem(elem string, fileName bool) error {
+func checkElem(elem string, kind pathKind) error {
if elem == "" {
return fmt.Errorf("empty path element")
}
if strings.Count(elem, ".") == len(elem) {
return fmt.Errorf("invalid path element %q", elem)
}
- if elem[0] == '.' && !fileName {
+ if elem[0] == '.' && kind == modulePath {
return fmt.Errorf("leading dot in path element")
}
if elem[len(elem)-1] == '.' {
return fmt.Errorf("trailing dot in path element")
}
charOK := pathOK
- if fileName {
+ if kind == filePath {
charOK = fileNameOK
}
for _, r := range elem {
@@ -406,7 +416,7 @@ func checkElem(elem string, fileName bool) error {
}
}
- if fileName {
+ if kind == filePath {
// don't check for Windows short-names in file names. They're
// only an issue for import paths.
return nil
@@ -444,7 +454,7 @@ func checkElem(elem string, fileName bool) error {
// top-level package documentation for additional information about
// subtleties of Unicode.
func CheckFilePath(path string) error {
- if err := checkPath(path, true); err != nil {
+ if err := checkPath(path, filePath); err != nil {
return fmt.Errorf("malformed file path %q: %v", path, err)
}
return nil
@@ -647,7 +657,7 @@ func EscapePath(path string) (escaped string, err error) {
// Versions are allowed to be in non-semver form but must be valid file names
// and not contain exclamation marks.
func EscapeVersion(v string) (escaped string, err error) {
- if err := checkElem(v, true); err != nil || strings.Contains(v, "!") {
+ if err := checkElem(v, filePath); err != nil || strings.Contains(v, "!") {
return "", &InvalidVersionError{
Version: v,
Err: fmt.Errorf("disallowed version string"),
@@ -706,7 +716,7 @@ func UnescapeVersion(escaped string) (v string, err error) {
if !ok {
return "", fmt.Errorf("invalid escaped version %q", escaped)
}
- if err := checkElem(v, true); err != nil {
+ if err := checkElem(v, filePath); err != nil {
return "", fmt.Errorf("invalid escaped version %q: %v", v, err)
}
return v, nil
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh b/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
index c0f9f2d523..ca98cb485f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
+++ b/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
@@ -65,6 +65,7 @@ includes_Darwin='
#include <sys/ptrace.h>
#include <sys/select.h>
#include <sys/socket.h>
+#include <sys/un.h>
#include <sys/sockio.h>
#include <sys/sys_domain.h>
#include <sys/sysctl.h>
@@ -204,6 +205,7 @@ struct ltchars {
#include <linux/devlink.h>
#include <linux/dm-ioctl.h>
#include <linux/errqueue.h>
+#include <linux/ethtool_netlink.h>
#include <linux/falloc.h>
#include <linux/fanotify.h>
#include <linux/filter.h>
@@ -479,7 +481,7 @@ ccflags="$@"
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
- $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
+ $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
$2 ~ /^TP_STATUS_/ ||
$2 ~ /^FALLOC_/ ||
$2 == "ICMPV6_FILTER" ||
@@ -561,7 +563,9 @@ ccflags="$@"
$2 ~ /^(HDIO|WIN|SMART)_/ ||
$2 ~ /^CRYPTO_/ ||
$2 ~ /^TIPC_/ ||
+ $2 !~ "DEVLINK_RELOAD_LIMITS_VALID_MASK" &&
$2 ~ /^DEVLINK_/ ||
+ $2 ~ /^ETHTOOL_/ ||
$2 ~ /^LWTUNNEL_IP/ ||
$2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ ||
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ptrace_darwin.go b/src/cmd/vendor/golang.org/x/sys/unix/ptrace_darwin.go
new file mode 100644
index 0000000000..fc568b5403
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ptrace_darwin.go
@@ -0,0 +1,11 @@
+// Copyright 2020 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.
+
+// +build darwin,!ios
+
+package unix
+
+func ptrace(request int, pid int, addr uintptr, data uintptr) error {
+ return ptrace1(request, pid, addr, data)
+}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ptrace_ios.go b/src/cmd/vendor/golang.org/x/sys/unix/ptrace_ios.go
new file mode 100644
index 0000000000..183441c9a5
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ptrace_ios.go
@@ -0,0 +1,11 @@
+// Copyright 2020 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.
+
+// +build ios
+
+package unix
+
+func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
+ return ENOTSUP
+}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go
index 4408153822..423dcced7e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go
@@ -419,8 +419,8 @@ func (w WaitStatus) TrapCause() int { return -1 }
//sys Mknod(path string, mode uint32, dev int) (err error)
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64
-//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
+//sys Open(path string, mode int, perm uint32) (fd int, err error) = open64
+//sys Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
//sys read(fd int, p []byte) (n int, err error)
//sys Readlink(path string, buf []byte) (n int, err error)
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
@@ -439,8 +439,8 @@ func (w WaitStatus) TrapCause() int { return -1 }
//sysnb Times(tms *Tms) (ticks uintptr, err error)
//sysnb Umask(mask int) (oldmask int)
//sysnb Uname(buf *Utsname) (err error)
-//sys Unlink(path string) (err error)
-//sys Unlinkat(dirfd int, path string, flags int) (err error)
+//sys Unlink(path string) (err error)
+//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
//sys write(fd int, p []byte) (n int, err error)
//sys readlen(fd int, p *byte, np int) (n int, err error) = read
@@ -514,7 +514,7 @@ func Munmap(b []byte) (err error) {
//sys Munlock(b []byte) (err error)
//sys Munlockall() (err error)
-//sysnb pipe(p *[2]_C_int) (err error)
+//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go
index bc634a280a..678fb27777 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go
@@ -318,7 +318,7 @@ func Getsockname(fd int) (sa Sockaddr, err error) {
return anyToSockaddr(fd, &rsa)
}
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
+//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
// GetsockoptString returns the string value of the socket option opt for the
// socket associated with fd at the given socket level.
@@ -332,8 +332,8 @@ func GetsockoptString(fd, level, opt int) (string, error) {
return string(buf[:vallen-1]), nil
}
-//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
-//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
+//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
+//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
@@ -626,7 +626,7 @@ func Futimes(fd int, tv []Timeval) error {
return futimes(fd, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
}
-//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
+//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {
if len(fds) == 0 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go
index b625738900..e771a3c5ef 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go
@@ -119,13 +119,16 @@ type attrList struct {
Forkattr uint32
}
-//sysnb pipe() (r int, w int, err error)
+//sysnb pipe(p *[2]int32) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
}
- p[0], p[1], err = pipe()
+ var x [2]int32
+ err = pipe(&x)
+ p[0] = int(x[0])
+ p[1] = int(x[1])
return
}
@@ -269,7 +272,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
options)
}
-//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
+//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
// Darwin doesn't support SYS_UTIMENSAT
@@ -317,7 +320,7 @@ func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
return err
}
-//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
+//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
func Uname(uname *Utsname) error {
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
@@ -375,6 +378,15 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
return
}
+// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct.
+// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
+func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
+ x := new(Xucred)
+ vallen := _Socklen(unsafe.Sizeof(Xucred{}))
+ err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
+ return x, err
+}
+
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
/*
@@ -469,8 +481,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Unmount(path string, flags int) (err error)
//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
+//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
+//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
index 6c1f4ab95b..ee065fcf2d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
@@ -45,6 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
-//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
+//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
index 0582ae256e..7a1f64a7b6 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
@@ -45,6 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
-//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
+//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
index c6a9733b4c..d30735c5d6 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
@@ -6,7 +6,7 @@ package unix
import "syscall"
-func ptrace(request int, pid int, addr uintptr, data uintptr) error {
+func ptrace1(request int, pid int, addr uintptr, data uintptr) error {
return ENOTSUP
}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
index 253afa4de5..9f85fd4046 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
@@ -45,6 +45,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
//sys Lstat(path string, stat *Stat_t) (err error)
-//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
+//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
//sys Stat(path string, stat *Stat_t) (err error)
//sys Statfs(path string, stat *Statfs_t) (err error)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index a4f2944a24..474141b625 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -95,7 +95,7 @@ func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
-//sysnb pipe() (r int, w int, err error)
+//sysnb pipe() (r int, w int, err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
@@ -105,16 +105,13 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(flags int) (r int, w int, err error)
-func Pipe2(p []int, flags int) error {
+func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
return EINVAL
}
- var pp [2]_C_int
- err := pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
+ p[0], p[1], err = pipe2(flags)
return err
}
@@ -170,7 +167,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
-//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
+//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
func sysctlUname(mib []_C_int, old *byte, oldlen *uintptr) error {
err := sysctl(mib, old, oldlen, nil, 0)
@@ -337,8 +334,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Unmount(path string, flags int) (err error)
//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
+//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
+//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go
index acc00c2e6a..15af63dd55 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go
@@ -188,9 +188,9 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
return ENOSYS
}
-//sys ioctl(fd int, req uint, arg uintptr) (err error)
+//sys ioctl(fd int, req uint, arg uintptr) (err error)
-//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
+//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
func Uname(uname *Utsname) error {
mib := []_C_int{CTL_KERN, KERN_OSTYPE}
@@ -665,8 +665,8 @@ func PtraceSingleStep(pid int) (err error) {
//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Unmount(path string, flags int) (err error)
//sys write(fd int, p []byte) (n int, err error)
-//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
-//sys munmap(addr uintptr, length uintptr) (err error)
+//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
+//sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go
index bbc4f3ea54..7a2d4120fc 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go
@@ -75,16 +75,3 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
}
return
}
-
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
-
-func Pipe2(p []int, flags int) error {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err := pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return err
-}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
index 28be1306ec..1b21035700 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -1482,8 +1482,8 @@ func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error
return keyctlRestrictKeyringByType(KEYCTL_RESTRICT_KEYRING, ringid, keyType, restriction)
}
-//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
-//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
+//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
+//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
var msg Msghdr
@@ -1860,8 +1860,8 @@ func Getpgrp() (pid int) {
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
-//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
-//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
+//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
+//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
//sys read(fd int, p []byte) (n int, err error)
//sys Removexattr(path string, attr string) (err error)
@@ -1934,9 +1934,9 @@ func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
//sys Syncfs(fd int) (err error)
//sysnb Sysinfo(info *Sysinfo_t) (err error)
//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
-//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error)
-//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error)
-//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error)
+//sysnb TimerfdCreate(clockid int, flags int) (fd int, err error)
+//sysnb TimerfdGettime(fd int, currValue *ItimerSpec) (err error)
+//sysnb TimerfdSettime(fd int, flags int, newValue *ItimerSpec, oldValue *ItimerSpec) (err error)
//sysnb Tgkill(tgid int, tid int, sig syscall.Signal) (err error)
//sysnb Times(tms *Tms) (ticks uintptr, err error)
//sysnb Umask(mask int) (oldmask int)
@@ -2196,8 +2196,8 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return EACCES
}
-//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT
-//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT
+//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT
+//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT
// fileHandle is the argument to nameToHandleAt and openByHandleAt. We
// originally tried to generate it via unix/linux/types.go with "type
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go
index c97c2ee53e..70e61bd5db 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go
@@ -31,7 +31,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
@@ -98,7 +98,7 @@ type rlimit32 struct {
Max uint32
}
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
+//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
const rlimInf32 = ^uint32(0)
const rlimInf64 = ^uint64(0)
@@ -129,7 +129,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
return
}
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
+//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
func Setrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, rlim, nil)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
index 72efe86ed4..4be2acd32b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
@@ -138,7 +138,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
index 496837b1e3..322b8e0fb9 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm.go
@@ -35,7 +35,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
@@ -129,8 +129,8 @@ func Utime(path string, buf *Utimbuf) error {
//sys utimes(path string, times *[2]Timeval) (err error)
-//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
-//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
+//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
+//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Truncate(path string, length int64) (err error) = SYS_TRUNCATE64
//sys Ftruncate(fd int, length int64) (err error) = SYS_FTRUNCATE64
@@ -177,7 +177,7 @@ type rlimit32 struct {
Max uint32
}
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT
+//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_UGETRLIMIT
const rlimInf32 = ^uint32(0)
const rlimInf64 = ^uint64(0)
@@ -208,7 +208,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
return
}
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
+//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
func Setrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, rlim, nil)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
index c6de6b9134..9315cf415b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go
@@ -155,7 +155,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
index f0287476cd..5fc8a47f41 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
@@ -104,7 +104,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
index c11328111d..20b9825f87 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
@@ -112,7 +112,7 @@ func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: int32(sec), Usec: int32(usec)}
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
@@ -125,7 +125,7 @@ func Pipe2(p []int, flags int) (err error) {
return
}
-//sysnb pipe() (p1 int, p2 int, err error)
+//sysnb pipe() (p1 int, p2 int, err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
@@ -153,7 +153,7 @@ type rlimit32 struct {
Max uint32
}
-//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
+//sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT
func Getrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, nil, rlim)
@@ -181,7 +181,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
return
}
-//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
+//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
func Setrlimit(resource int, rlim *Rlimit) (err error) {
err = prlimit(0, resource, rlim, nil)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
index 349374409b..5162c39b0e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go
@@ -99,7 +99,7 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
-//sysnb pipe(p *[2]_C_int) (err error)
+//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
@@ -112,7 +112,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
index b0b1505565..a6a66ece09 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go
@@ -154,7 +154,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
index 2363f74991..fcef0d1daf 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
@@ -76,7 +76,7 @@ func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: usec}
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
index d389f1518f..3b88044830 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go
@@ -115,7 +115,7 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
-//sysnb pipe(p *[2]_C_int) (err error)
+//sysnb pipe(p *[2]_C_int) (err error)
func Pipe(p []int) (err error) {
if len(p) != 2 {
@@ -128,7 +128,7 @@ func Pipe(p []int) (err error) {
return
}
-//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
func Pipe2(p []int, flags int) (err error) {
if len(p) != 2 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd.go
index 1e6843b4c3..853d5f0f43 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_netbsd.go
@@ -110,7 +110,8 @@ func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
-//sysnb pipe() (fd1 int, fd2 int, err error)
+//sysnb pipe() (fd1 int, fd2 int, err error)
+
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
@@ -119,7 +120,21 @@ func Pipe(p []int) (err error) {
return
}
-//sys Getdents(fd int, buf []byte) (n int, err error)
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+
+func Pipe2(p []int, flags int) error {
+ if len(p) != 2 {
+ return EINVAL
+ }
+ var pp [2]_C_int
+ err := pipe2(&pp, flags)
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
+ return err
+}
+
+//sys Getdents(fd int, buf []byte) (n int, err error)
+
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
n, err = Getdents(fd, buf)
if err != nil || basep == nil {
@@ -159,7 +174,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
-//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
+//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) {
var value Ptmget
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd.go
index 6a50b50bd6..22b5503850 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_openbsd.go
@@ -92,7 +92,7 @@ func Pipe2(p []int, flags int) error {
return err
}
-//sys Getdents(fd int, buf []byte) (n int, err error)
+//sys Getdents(fd int, buf []byte) (n int, err error)
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
n, err = Getdents(fd, buf)
if err != nil || basep == nil {
@@ -154,7 +154,7 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
//sys ioctl(fd int, req uint, arg uintptr) (err error)
-//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
+//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go b/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go
index fee6e99528..169497f062 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/syscall_solaris.go
@@ -68,6 +68,19 @@ func Pipe(p []int) (err error) {
return nil
}
+//sysnb pipe2(p *[2]_C_int, flags int) (err error)
+
+func Pipe2(p []int, flags int) error {
+ if len(p) != 2 {
+ return EINVAL
+ }
+ var pp [2]_C_int
+ err := pipe2(&pp, flags)
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
+ return err
+}
+
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL
@@ -566,7 +579,7 @@ func IoctlGetTermio(fd int, req uint) (*Termio, error) {
return &value, err
}
-//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
+//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
func Poll(fds []PollFd, timeout int) (n int, err error) {
if len(fds) == 0 {
@@ -669,6 +682,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Statvfs(path string, vfsstat *Statvfs_t) (err error)
//sys Symlink(path string, link string) (err error)
//sys Sync() (err error)
+//sys Sysconf(which int) (n int64, err error)
//sysnb Times(tms *Tms) (ticks uintptr, err error)
//sys Truncate(path string, length int64) (err error)
//sys Fsync(fd int) (err error)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/timestruct.go b/src/cmd/vendor/golang.org/x/sys/unix/timestruct.go
index 4a672f5694..103604299e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/timestruct.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/timestruct.go
@@ -8,12 +8,10 @@ package unix
import "time"
-// TimespecToNsec converts a Timespec value into a number of
-// nanoseconds since the Unix epoch.
-func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
+// TimespecToNSec returns the time stored in ts as nanoseconds.
+func TimespecToNsec(ts Timespec) int64 { return ts.Nano() }
-// NsecToTimespec takes a number of nanoseconds since the Unix epoch
-// and returns the corresponding Timespec value.
+// NsecToTimespec converts a number of nanoseconds into a Timespec.
func NsecToTimespec(nsec int64) Timespec {
sec := nsec / 1e9
nsec = nsec % 1e9
@@ -42,12 +40,10 @@ func TimeToTimespec(t time.Time) (Timespec, error) {
return ts, nil
}
-// TimevalToNsec converts a Timeval value into a number of nanoseconds
-// since the Unix epoch.
-func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
+// TimevalToNsec returns the time stored in tv as nanoseconds.
+func TimevalToNsec(tv Timeval) int64 { return tv.Nano() }
-// NsecToTimeval takes a number of nanoseconds since the Unix epoch
-// and returns the corresponding Timeval value.
+// NsecToTimeval converts a number of nanoseconds into a Timeval.
func NsecToTimeval(nsec int64) Timeval {
nsec += 999 // round up to microsecond
usec := nsec % 1e9 / 1e3
@@ -59,24 +55,22 @@ func NsecToTimeval(nsec int64) Timeval {
return setTimeval(sec, usec)
}
-// Unix returns ts as the number of seconds and nanoseconds elapsed since the
-// Unix epoch.
+// Unix returns the time stored in ts as seconds plus nanoseconds.
func (ts *Timespec) Unix() (sec int64, nsec int64) {
return int64(ts.Sec), int64(ts.Nsec)
}
-// Unix returns tv as the number of seconds and nanoseconds elapsed since the
-// Unix epoch.
+// Unix returns the time stored in tv as seconds plus nanoseconds.
func (tv *Timeval) Unix() (sec int64, nsec int64) {
return int64(tv.Sec), int64(tv.Usec) * 1000
}
-// Nano returns ts as the number of nanoseconds elapsed since the Unix epoch.
+// Nano returns the time stored in ts as nanoseconds.
func (ts *Timespec) Nano() int64 {
return int64(ts.Sec)*1e9 + int64(ts.Nsec)
}
-// Nano returns tv as the number of nanoseconds elapsed since the Unix epoch.
+// Nano returns the time stored in tv as nanoseconds.
func (tv *Timeval) Nano() int64 {
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
index fea5dfaadb..dcb96c26c0 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
@@ -32,7 +32,7 @@ const (
AF_LAT = 0xe
AF_LINK = 0x12
AF_LOCAL = 0x1
- AF_MAX = 0x28
+ AF_MAX = 0x29
AF_NATM = 0x1f
AF_NDRV = 0x1b
AF_NETBIOS = 0x21
@@ -49,6 +49,7 @@ const (
AF_UNIX = 0x1
AF_UNSPEC = 0x0
AF_UTUN = 0x26
+ AF_VSOCK = 0x28
ALTWERASE = 0x200
ATTR_BIT_MAP_COUNT = 0x5
ATTR_CMN_ACCESSMASK = 0x20000
@@ -83,7 +84,7 @@ const (
ATTR_CMN_PAROBJID = 0x80
ATTR_CMN_RETURNED_ATTRS = 0x80000000
ATTR_CMN_SCRIPT = 0x100
- ATTR_CMN_SETMASK = 0x41c7ff00
+ ATTR_CMN_SETMASK = 0x51c7ff00
ATTR_CMN_USERACCESS = 0x200000
ATTR_CMN_UUID = 0x800000
ATTR_CMN_VALIDMASK = 0xffffffff
@@ -357,7 +358,7 @@ const (
DLT_LINUX_SLL = 0x71
DLT_LOOP = 0x6c
DLT_LTALK = 0x72
- DLT_MATCHING_MAX = 0xf5
+ DLT_MATCHING_MAX = 0x10a
DLT_MATCHING_MIN = 0x68
DLT_MFR = 0xb6
DLT_MOST = 0xd3
@@ -398,6 +399,7 @@ const (
DLT_SYMANTEC_FIREWALL = 0x63
DLT_TZSP = 0x80
DLT_USB = 0xba
+ DLT_USB_DARWIN = 0x10a
DLT_USB_LINUX = 0xbd
DLT_USB_LINUX_MMAPPED = 0xdc
DLT_USER0 = 0x93
@@ -442,8 +444,8 @@ const (
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
- EVFILT_SYSCOUNT = 0xf
- EVFILT_THREADMARKER = 0xf
+ EVFILT_SYSCOUNT = 0x11
+ EVFILT_THREADMARKER = 0x11
EVFILT_TIMER = -0x7
EVFILT_USER = -0xa
EVFILT_VM = -0xc
@@ -481,9 +483,12 @@ const (
FSOPT_NOINMEMUPDATE = 0x2
FSOPT_PACK_INVAL_ATTRS = 0x8
FSOPT_REPORT_FULLSIZE = 0x4
+ FSOPT_RETURN_REALDEV = 0x200
F_ADDFILESIGS = 0x3d
F_ADDFILESIGS_FOR_DYLD_SIM = 0x53
+ F_ADDFILESIGS_INFO = 0x67
F_ADDFILESIGS_RETURN = 0x61
+ F_ADDFILESUPPL = 0x68
F_ADDSIGS = 0x3b
F_ALLOCATEALL = 0x4
F_ALLOCATECONTIG = 0x2
@@ -505,8 +510,10 @@ const (
F_GETOWN = 0x5
F_GETPATH = 0x32
F_GETPATH_MTMINFO = 0x47
+ F_GETPATH_NOFIRMLINK = 0x66
F_GETPROTECTIONCLASS = 0x3f
F_GETPROTECTIONLEVEL = 0x4d
+ F_GETSIGSINFO = 0x69
F_GLOBAL_NOCACHE = 0x37
F_LOG2PHYS = 0x31
F_LOG2PHYS_EXT = 0x41
@@ -531,6 +538,7 @@ const (
F_SETPROTECTIONCLASS = 0x40
F_SETSIZE = 0x2b
F_SINGLE_WRITER = 0x4c
+ F_SPECULATIVE_READ = 0x65
F_THAW_FS = 0x36
F_TRANSCODEKEY = 0x4b
F_TRIM_ACTIVE_FILE = 0x64
@@ -562,6 +570,7 @@ const (
IFF_UP = 0x1
IFNAMSIZ = 0x10
IFT_1822 = 0x2
+ IFT_6LOWPAN = 0x40
IFT_AAL5 = 0x31
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
@@ -766,6 +775,9 @@ const (
IPV6_2292PKTINFO = 0x13
IPV6_2292PKTOPTIONS = 0x19
IPV6_2292RTHDR = 0x18
+ IPV6_ADDR_MC_FLAGS_PREFIX = 0x20
+ IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10
+ IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30
IPV6_BINDV6ONLY = 0x1b
IPV6_BOUND_IF = 0x7d
IPV6_CHECKSUM = 0x1a
@@ -775,7 +787,7 @@ const (
IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
- IPV6_FLOW_ECN_MASK = 0x300
+ IPV6_FLOW_ECN_MASK = 0x3000
IPV6_FRAGTTL = 0x3c
IPV6_FW_ADD = 0x1e
IPV6_FW_DEL = 0x1f
@@ -818,6 +830,7 @@ const (
IP_DEFAULT_MULTICAST_LOOP = 0x1
IP_DEFAULT_MULTICAST_TTL = 0x1
IP_DF = 0x4000
+ IP_DONTFRAG = 0x1c
IP_DROP_MEMBERSHIP = 0xd
IP_DROP_SOURCE_MEMBERSHIP = 0x47
IP_DUMMYNET_CONFIGURE = 0x3c
@@ -889,6 +902,12 @@ const (
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
+ LOCAL_PEERCRED = 0x1
+ LOCAL_PEEREPID = 0x3
+ LOCAL_PEEREUUID = 0x5
+ LOCAL_PEERPID = 0x2
+ LOCAL_PEERTOKEN = 0x6
+ LOCAL_PEERUUID = 0x4
LOCK_EX = 0x2
LOCK_NB = 0x4
LOCK_SH = 0x1
@@ -904,6 +923,7 @@ const (
MADV_SEQUENTIAL = 0x2
MADV_WILLNEED = 0x3
MADV_ZERO_WIRED_PAGES = 0x6
+ MAP_32BIT = 0x8000
MAP_ANON = 0x1000
MAP_ANONYMOUS = 0x1000
MAP_COPY = 0x2
@@ -920,6 +940,17 @@ const (
MAP_RESILIENT_CODESIGN = 0x2000
MAP_RESILIENT_MEDIA = 0x4000
MAP_SHARED = 0x1
+ MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000
+ MAP_UNIX03 = 0x40000
+ MCAST_BLOCK_SOURCE = 0x54
+ MCAST_EXCLUDE = 0x2
+ MCAST_INCLUDE = 0x1
+ MCAST_JOIN_GROUP = 0x50
+ MCAST_JOIN_SOURCE_GROUP = 0x52
+ MCAST_LEAVE_GROUP = 0x51
+ MCAST_LEAVE_SOURCE_GROUP = 0x53
+ MCAST_UNBLOCK_SOURCE = 0x55
+ MCAST_UNDEFINED = 0x0
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_ASYNC = 0x40
@@ -931,6 +962,7 @@ const (
MNT_DOVOLFS = 0x8000
MNT_DWAIT = 0x4
MNT_EXPORTED = 0x100
+ MNT_EXT_ROOT_DATA_VOL = 0x1
MNT_FORCE = 0x80000
MNT_IGNORE_OWNERSHIP = 0x200000
MNT_JOURNALED = 0x800000
@@ -947,12 +979,15 @@ const (
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
+ MNT_REMOVABLE = 0x200
MNT_ROOTFS = 0x4000
+ MNT_SNAPSHOT = 0x40000000
+ MNT_STRICTATIME = 0x80000000
MNT_SYNCHRONOUS = 0x2
MNT_UNION = 0x20
MNT_UNKNOWNPERMISSIONS = 0x200000
MNT_UPDATE = 0x10000
- MNT_VISFLAGMASK = 0x17f0f5ff
+ MNT_VISFLAGMASK = 0xd7f0f7ff
MNT_WAIT = 0x1
MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4
@@ -963,6 +998,7 @@ const (
MSG_HAVEMORE = 0x2000
MSG_HOLD = 0x800
MSG_NEEDSA = 0x10000
+ MSG_NOSIGNAL = 0x80000
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_RCVMORE = 0x4000
@@ -979,9 +1015,10 @@ const (
NET_RT_DUMP = 0x1
NET_RT_DUMP2 = 0x7
NET_RT_FLAGS = 0x2
+ NET_RT_FLAGS_PRIV = 0xa
NET_RT_IFLIST = 0x3
NET_RT_IFLIST2 = 0x6
- NET_RT_MAXID = 0xa
+ NET_RT_MAXID = 0xb
NET_RT_STAT = 0x4
NET_RT_TRASH = 0x5
NFDBITS = 0x20
@@ -1019,6 +1056,7 @@ const (
NOTE_LEEWAY = 0x10
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
+ NOTE_MACHTIME = 0x100
NOTE_MACH_CONTINUOUS_TIME = 0x80
NOTE_NONE = 0x80
NOTE_NSECONDS = 0x4
@@ -1065,6 +1103,7 @@ const (
O_NDELAY = 0x4
O_NOCTTY = 0x20000
O_NOFOLLOW = 0x100
+ O_NOFOLLOW_ANY = 0x20000000
O_NONBLOCK = 0x4
O_POPUP = 0x80000000
O_RDONLY = 0x0
@@ -1136,6 +1175,7 @@ const (
RTF_BROADCAST = 0x400000
RTF_CLONING = 0x100
RTF_CONDEMNED = 0x2000000
+ RTF_DEAD = 0x20000000
RTF_DELCLONE = 0x80
RTF_DONE = 0x40
RTF_DYNAMIC = 0x10
@@ -1143,6 +1183,7 @@ const (
RTF_HOST = 0x4
RTF_IFREF = 0x4000000
RTF_IFSCOPE = 0x1000000
+ RTF_LLDATA = 0x400
RTF_LLINFO = 0x400
RTF_LOCAL = 0x200000
RTF_MODIFIED = 0x20
@@ -1210,6 +1251,7 @@ const (
SIOCGDRVSPEC = 0xc028697b
SIOCGETVLAN = 0xc020697f
SIOCGHIWAT = 0x40047301
+ SIOCGIF6LOWPAN = 0xc02069c5
SIOCGIFADDR = 0xc0206921
SIOCGIFALTMTU = 0xc0206948
SIOCGIFASYNCMAP = 0xc020697c
@@ -1220,6 +1262,7 @@ const (
SIOCGIFDEVMTU = 0xc0206944
SIOCGIFDSTADDR = 0xc0206922
SIOCGIFFLAGS = 0xc0206911
+ SIOCGIFFUNCTIONALTYPE = 0xc02069ad
SIOCGIFGENERIC = 0xc020693a
SIOCGIFKPI = 0xc0206987
SIOCGIFMAC = 0xc0206982
@@ -1233,6 +1276,7 @@ const (
SIOCGIFSTATUS = 0xc331693d
SIOCGIFVLAN = 0xc020697f
SIOCGIFWAKEFLAGS = 0xc0206988
+ SIOCGIFXMEDIA = 0xc02c6948
SIOCGLOWAT = 0x40047303
SIOCGPGRP = 0x40047309
SIOCIFCREATE = 0xc0206978
@@ -1243,6 +1287,7 @@ const (
SIOCSDRVSPEC = 0x8028697b
SIOCSETVLAN = 0x8020697e
SIOCSHIWAT = 0x80047300
+ SIOCSIF6LOWPAN = 0x802069c4
SIOCSIFADDR = 0x8020690c
SIOCSIFALTMTU = 0x80206945
SIOCSIFASYNCMAP = 0x8020697d
@@ -1270,6 +1315,7 @@ const (
SOCK_RDM = 0x4
SOCK_SEQPACKET = 0x5
SOCK_STREAM = 0x1
+ SOL_LOCAL = 0x0
SOL_SOCKET = 0xffff
SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x2
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
index b40fb1f696..8602b13633 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
@@ -32,7 +32,7 @@ const (
AF_LAT = 0xe
AF_LINK = 0x12
AF_LOCAL = 0x1
- AF_MAX = 0x28
+ AF_MAX = 0x29
AF_NATM = 0x1f
AF_NDRV = 0x1b
AF_NETBIOS = 0x21
@@ -49,6 +49,7 @@ const (
AF_UNIX = 0x1
AF_UNSPEC = 0x0
AF_UTUN = 0x26
+ AF_VSOCK = 0x28
ALTWERASE = 0x200
ATTR_BIT_MAP_COUNT = 0x5
ATTR_CMN_ACCESSMASK = 0x20000
@@ -83,7 +84,7 @@ const (
ATTR_CMN_PAROBJID = 0x80
ATTR_CMN_RETURNED_ATTRS = 0x80000000
ATTR_CMN_SCRIPT = 0x100
- ATTR_CMN_SETMASK = 0x41c7ff00
+ ATTR_CMN_SETMASK = 0x51c7ff00
ATTR_CMN_USERACCESS = 0x200000
ATTR_CMN_UUID = 0x800000
ATTR_CMN_VALIDMASK = 0xffffffff
@@ -357,7 +358,7 @@ const (
DLT_LINUX_SLL = 0x71
DLT_LOOP = 0x6c
DLT_LTALK = 0x72
- DLT_MATCHING_MAX = 0xf5
+ DLT_MATCHING_MAX = 0x10a
DLT_MATCHING_MIN = 0x68
DLT_MFR = 0xb6
DLT_MOST = 0xd3
@@ -398,6 +399,7 @@ const (
DLT_SYMANTEC_FIREWALL = 0x63
DLT_TZSP = 0x80
DLT_USB = 0xba
+ DLT_USB_DARWIN = 0x10a
DLT_USB_LINUX = 0xbd
DLT_USB_LINUX_MMAPPED = 0xdc
DLT_USER0 = 0x93
@@ -442,8 +444,8 @@ const (
EVFILT_PROC = -0x5
EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6
- EVFILT_SYSCOUNT = 0xf
- EVFILT_THREADMARKER = 0xf
+ EVFILT_SYSCOUNT = 0x11
+ EVFILT_THREADMARKER = 0x11
EVFILT_TIMER = -0x7
EVFILT_USER = -0xa
EVFILT_VM = -0xc
@@ -481,9 +483,12 @@ const (
FSOPT_NOINMEMUPDATE = 0x2
FSOPT_PACK_INVAL_ATTRS = 0x8
FSOPT_REPORT_FULLSIZE = 0x4
+ FSOPT_RETURN_REALDEV = 0x200
F_ADDFILESIGS = 0x3d
F_ADDFILESIGS_FOR_DYLD_SIM = 0x53
+ F_ADDFILESIGS_INFO = 0x67
F_ADDFILESIGS_RETURN = 0x61
+ F_ADDFILESUPPL = 0x68
F_ADDSIGS = 0x3b
F_ALLOCATEALL = 0x4
F_ALLOCATECONTIG = 0x2
@@ -505,8 +510,10 @@ const (
F_GETOWN = 0x5
F_GETPATH = 0x32
F_GETPATH_MTMINFO = 0x47
+ F_GETPATH_NOFIRMLINK = 0x66
F_GETPROTECTIONCLASS = 0x3f
F_GETPROTECTIONLEVEL = 0x4d
+ F_GETSIGSINFO = 0x69
F_GLOBAL_NOCACHE = 0x37
F_LOG2PHYS = 0x31
F_LOG2PHYS_EXT = 0x41
@@ -531,6 +538,7 @@ const (
F_SETPROTECTIONCLASS = 0x40
F_SETSIZE = 0x2b
F_SINGLE_WRITER = 0x4c
+ F_SPECULATIVE_READ = 0x65
F_THAW_FS = 0x36
F_TRANSCODEKEY = 0x4b
F_TRIM_ACTIVE_FILE = 0x64
@@ -562,6 +570,7 @@ const (
IFF_UP = 0x1
IFNAMSIZ = 0x10
IFT_1822 = 0x2
+ IFT_6LOWPAN = 0x40
IFT_AAL5 = 0x31
IFT_ARCNET = 0x23
IFT_ARCNETPLUS = 0x24
@@ -766,6 +775,9 @@ const (
IPV6_2292PKTINFO = 0x13
IPV6_2292PKTOPTIONS = 0x19
IPV6_2292RTHDR = 0x18
+ IPV6_ADDR_MC_FLAGS_PREFIX = 0x20
+ IPV6_ADDR_MC_FLAGS_TRANSIENT = 0x10
+ IPV6_ADDR_MC_FLAGS_UNICAST_BASED = 0x30
IPV6_BINDV6ONLY = 0x1b
IPV6_BOUND_IF = 0x7d
IPV6_CHECKSUM = 0x1a
@@ -775,7 +787,7 @@ const (
IPV6_FAITH = 0x1d
IPV6_FLOWINFO_MASK = 0xffffff0f
IPV6_FLOWLABEL_MASK = 0xffff0f00
- IPV6_FLOW_ECN_MASK = 0x300
+ IPV6_FLOW_ECN_MASK = 0x3000
IPV6_FRAGTTL = 0x3c
IPV6_FW_ADD = 0x1e
IPV6_FW_DEL = 0x1f
@@ -818,6 +830,7 @@ const (
IP_DEFAULT_MULTICAST_LOOP = 0x1
IP_DEFAULT_MULTICAST_TTL = 0x1
IP_DF = 0x4000
+ IP_DONTFRAG = 0x1c
IP_DROP_MEMBERSHIP = 0xd
IP_DROP_SOURCE_MEMBERSHIP = 0x47
IP_DUMMYNET_CONFIGURE = 0x3c
@@ -889,6 +902,12 @@ const (
KERN_OSRELEASE = 0x2
KERN_OSTYPE = 0x1
KERN_VERSION = 0x4
+ LOCAL_PEERCRED = 0x1
+ LOCAL_PEEREPID = 0x3
+ LOCAL_PEEREUUID = 0x5
+ LOCAL_PEERPID = 0x2
+ LOCAL_PEERTOKEN = 0x6
+ LOCAL_PEERUUID = 0x4
LOCK_EX = 0x2
LOCK_NB = 0x4
LOCK_SH = 0x1
@@ -904,6 +923,7 @@ const (
MADV_SEQUENTIAL = 0x2
MADV_WILLNEED = 0x3
MADV_ZERO_WIRED_PAGES = 0x6
+ MAP_32BIT = 0x8000
MAP_ANON = 0x1000
MAP_ANONYMOUS = 0x1000
MAP_COPY = 0x2
@@ -920,6 +940,17 @@ const (
MAP_RESILIENT_CODESIGN = 0x2000
MAP_RESILIENT_MEDIA = 0x4000
MAP_SHARED = 0x1
+ MAP_TRANSLATED_ALLOW_EXECUTE = 0x20000
+ MAP_UNIX03 = 0x40000
+ MCAST_BLOCK_SOURCE = 0x54
+ MCAST_EXCLUDE = 0x2
+ MCAST_INCLUDE = 0x1
+ MCAST_JOIN_GROUP = 0x50
+ MCAST_JOIN_SOURCE_GROUP = 0x52
+ MCAST_LEAVE_GROUP = 0x51
+ MCAST_LEAVE_SOURCE_GROUP = 0x53
+ MCAST_UNBLOCK_SOURCE = 0x55
+ MCAST_UNDEFINED = 0x0
MCL_CURRENT = 0x1
MCL_FUTURE = 0x2
MNT_ASYNC = 0x40
@@ -931,6 +962,7 @@ const (
MNT_DOVOLFS = 0x8000
MNT_DWAIT = 0x4
MNT_EXPORTED = 0x100
+ MNT_EXT_ROOT_DATA_VOL = 0x1
MNT_FORCE = 0x80000
MNT_IGNORE_OWNERSHIP = 0x200000
MNT_JOURNALED = 0x800000
@@ -947,12 +979,15 @@ const (
MNT_QUOTA = 0x2000
MNT_RDONLY = 0x1
MNT_RELOAD = 0x40000
+ MNT_REMOVABLE = 0x200
MNT_ROOTFS = 0x4000
+ MNT_SNAPSHOT = 0x40000000
+ MNT_STRICTATIME = 0x80000000
MNT_SYNCHRONOUS = 0x2
MNT_UNION = 0x20
MNT_UNKNOWNPERMISSIONS = 0x200000
MNT_UPDATE = 0x10000
- MNT_VISFLAGMASK = 0x17f0f5ff
+ MNT_VISFLAGMASK = 0xd7f0f7ff
MNT_WAIT = 0x1
MSG_CTRUNC = 0x20
MSG_DONTROUTE = 0x4
@@ -963,6 +998,7 @@ const (
MSG_HAVEMORE = 0x2000
MSG_HOLD = 0x800
MSG_NEEDSA = 0x10000
+ MSG_NOSIGNAL = 0x80000
MSG_OOB = 0x1
MSG_PEEK = 0x2
MSG_RCVMORE = 0x4000
@@ -979,9 +1015,10 @@ const (
NET_RT_DUMP = 0x1
NET_RT_DUMP2 = 0x7
NET_RT_FLAGS = 0x2
+ NET_RT_FLAGS_PRIV = 0xa
NET_RT_IFLIST = 0x3
NET_RT_IFLIST2 = 0x6
- NET_RT_MAXID = 0xa
+ NET_RT_MAXID = 0xb
NET_RT_STAT = 0x4
NET_RT_TRASH = 0x5
NFDBITS = 0x20
@@ -1019,6 +1056,7 @@ const (
NOTE_LEEWAY = 0x10
NOTE_LINK = 0x10
NOTE_LOWAT = 0x1
+ NOTE_MACHTIME = 0x100
NOTE_MACH_CONTINUOUS_TIME = 0x80
NOTE_NONE = 0x80
NOTE_NSECONDS = 0x4
@@ -1065,6 +1103,7 @@ const (
O_NDELAY = 0x4
O_NOCTTY = 0x20000
O_NOFOLLOW = 0x100
+ O_NOFOLLOW_ANY = 0x20000000
O_NONBLOCK = 0x4
O_POPUP = 0x80000000
O_RDONLY = 0x0
@@ -1136,6 +1175,7 @@ const (
RTF_BROADCAST = 0x400000
RTF_CLONING = 0x100
RTF_CONDEMNED = 0x2000000
+ RTF_DEAD = 0x20000000
RTF_DELCLONE = 0x80
RTF_DONE = 0x40
RTF_DYNAMIC = 0x10
@@ -1143,6 +1183,7 @@ const (
RTF_HOST = 0x4
RTF_IFREF = 0x4000000
RTF_IFSCOPE = 0x1000000
+ RTF_LLDATA = 0x400
RTF_LLINFO = 0x400
RTF_LOCAL = 0x200000
RTF_MODIFIED = 0x20
@@ -1210,6 +1251,7 @@ const (
SIOCGDRVSPEC = 0xc028697b
SIOCGETVLAN = 0xc020697f
SIOCGHIWAT = 0x40047301
+ SIOCGIF6LOWPAN = 0xc02069c5
SIOCGIFADDR = 0xc0206921
SIOCGIFALTMTU = 0xc0206948
SIOCGIFASYNCMAP = 0xc020697c
@@ -1220,6 +1262,7 @@ const (
SIOCGIFDEVMTU = 0xc0206944
SIOCGIFDSTADDR = 0xc0206922
SIOCGIFFLAGS = 0xc0206911
+ SIOCGIFFUNCTIONALTYPE = 0xc02069ad
SIOCGIFGENERIC = 0xc020693a
SIOCGIFKPI = 0xc0206987
SIOCGIFMAC = 0xc0206982
@@ -1233,6 +1276,7 @@ const (
SIOCGIFSTATUS = 0xc331693d
SIOCGIFVLAN = 0xc020697f
SIOCGIFWAKEFLAGS = 0xc0206988
+ SIOCGIFXMEDIA = 0xc02c6948
SIOCGLOWAT = 0x40047303
SIOCGPGRP = 0x40047309
SIOCIFCREATE = 0xc0206978
@@ -1243,6 +1287,7 @@ const (
SIOCSDRVSPEC = 0x8028697b
SIOCSETVLAN = 0x8020697e
SIOCSHIWAT = 0x80047300
+ SIOCSIF6LOWPAN = 0x802069c4
SIOCSIFADDR = 0x8020690c
SIOCSIFALTMTU = 0x80206945
SIOCSIFASYNCMAP = 0x8020697d
@@ -1270,6 +1315,7 @@ const (
SOCK_RDM = 0x4
SOCK_SEQPACKET = 0x5
SOCK_STREAM = 0x1
+ SOL_LOCAL = 0x0
SOL_SOCKET = 0xffff
SOMAXCONN = 0x80
SO_ACCEPTCONN = 0x2
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go
index b46110354d..c5e2f47930 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux.go
@@ -65,6 +65,7 @@ const (
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
+ ALG_SET_DRBG_ENTROPY = 0x6
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
@@ -179,8 +180,10 @@ const (
BPF_F_ANY_ALIGNMENT = 0x2
BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_REPLACE = 0x4
+ BPF_F_SLEEPABLE = 0x10
BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_TEST_RND_HI32 = 0x4
+ BPF_F_TEST_RUN_ON_CPU = 0x1
BPF_F_TEST_STATE_FREQ = 0x8
BPF_H = 0x8
BPF_IMM = 0x0
@@ -219,6 +222,7 @@ const (
BPF_NET_OFF = -0x100000
BPF_OBJ_NAME_LEN = 0x10
BPF_OR = 0x40
+ BPF_PSEUDO_BTF_ID = 0x3
BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
@@ -309,6 +313,7 @@ const (
CAN_J1939 = 0x7
CAN_MAX_DLC = 0x8
CAN_MAX_DLEN = 0x8
+ CAN_MAX_RAW_DLC = 0xf
CAN_MCNET = 0x5
CAN_MTU = 0x10
CAN_NPROTO = 0x8
@@ -429,10 +434,13 @@ const (
DEBUGFS_MAGIC = 0x64626720
DEVLINK_CMD_ESWITCH_MODE_GET = 0x1d
DEVLINK_CMD_ESWITCH_MODE_SET = 0x1e
+ DEVLINK_FLASH_OVERWRITE_IDENTIFIERS = 0x2
+ DEVLINK_FLASH_OVERWRITE_SETTINGS = 0x1
DEVLINK_GENL_MCGRP_CONFIG_NAME = "config"
DEVLINK_GENL_NAME = "devlink"
DEVLINK_GENL_VERSION = 0x1
DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14
+ DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS = 0x3
DEVMEM_MAGIC = 0x454d444d
DEVPTS_SUPER_MAGIC = 0x1cd1
DMA_BUF_MAGIC = 0x444d4142
@@ -477,9 +485,9 @@ const (
DM_UUID_FLAG = 0x4000
DM_UUID_LEN = 0x81
DM_VERSION = 0xc138fd00
- DM_VERSION_EXTRA = "-ioctl (2020-02-27)"
+ DM_VERSION_EXTRA = "-ioctl (2020-10-01)"
DM_VERSION_MAJOR = 0x4
- DM_VERSION_MINOR = 0x2a
+ DM_VERSION_MINOR = 0x2b
DM_VERSION_PATCHLEVEL = 0x0
DT_BLK = 0x6
DT_CHR = 0x2
@@ -520,6 +528,119 @@ const (
EPOLL_CTL_DEL = 0x2
EPOLL_CTL_MOD = 0x3
EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2
+ ESP_V4_FLOW = 0xa
+ ESP_V6_FLOW = 0xc
+ ETHER_FLOW = 0x12
+ ETHTOOL_BUSINFO_LEN = 0x20
+ ETHTOOL_EROMVERS_LEN = 0x20
+ ETHTOOL_FEC_AUTO = 0x2
+ ETHTOOL_FEC_BASER = 0x10
+ ETHTOOL_FEC_LLRS = 0x20
+ ETHTOOL_FEC_NONE = 0x1
+ ETHTOOL_FEC_OFF = 0x4
+ ETHTOOL_FEC_RS = 0x8
+ ETHTOOL_FLAG_ALL = 0x7
+ ETHTOOL_FLAG_COMPACT_BITSETS = 0x1
+ ETHTOOL_FLAG_OMIT_REPLY = 0x2
+ ETHTOOL_FLAG_STATS = 0x4
+ ETHTOOL_FLASHDEV = 0x33
+ ETHTOOL_FLASH_MAX_FILENAME = 0x80
+ ETHTOOL_FWVERS_LEN = 0x20
+ ETHTOOL_F_COMPAT = 0x4
+ ETHTOOL_F_UNSUPPORTED = 0x1
+ ETHTOOL_F_WISH = 0x2
+ ETHTOOL_GCHANNELS = 0x3c
+ ETHTOOL_GCOALESCE = 0xe
+ ETHTOOL_GDRVINFO = 0x3
+ ETHTOOL_GEEE = 0x44
+ ETHTOOL_GEEPROM = 0xb
+ ETHTOOL_GENL_NAME = "ethtool"
+ ETHTOOL_GENL_VERSION = 0x1
+ ETHTOOL_GET_DUMP_DATA = 0x40
+ ETHTOOL_GET_DUMP_FLAG = 0x3f
+ ETHTOOL_GET_TS_INFO = 0x41
+ ETHTOOL_GFEATURES = 0x3a
+ ETHTOOL_GFECPARAM = 0x50
+ ETHTOOL_GFLAGS = 0x25
+ ETHTOOL_GGRO = 0x2b
+ ETHTOOL_GGSO = 0x23
+ ETHTOOL_GLINK = 0xa
+ ETHTOOL_GLINKSETTINGS = 0x4c
+ ETHTOOL_GMODULEEEPROM = 0x43
+ ETHTOOL_GMODULEINFO = 0x42
+ ETHTOOL_GMSGLVL = 0x7
+ ETHTOOL_GPAUSEPARAM = 0x12
+ ETHTOOL_GPERMADDR = 0x20
+ ETHTOOL_GPFLAGS = 0x27
+ ETHTOOL_GPHYSTATS = 0x4a
+ ETHTOOL_GREGS = 0x4
+ ETHTOOL_GRINGPARAM = 0x10
+ ETHTOOL_GRSSH = 0x46
+ ETHTOOL_GRXCLSRLALL = 0x30
+ ETHTOOL_GRXCLSRLCNT = 0x2e
+ ETHTOOL_GRXCLSRULE = 0x2f
+ ETHTOOL_GRXCSUM = 0x14
+ ETHTOOL_GRXFH = 0x29
+ ETHTOOL_GRXFHINDIR = 0x38
+ ETHTOOL_GRXNTUPLE = 0x36
+ ETHTOOL_GRXRINGS = 0x2d
+ ETHTOOL_GSET = 0x1
+ ETHTOOL_GSG = 0x18
+ ETHTOOL_GSSET_INFO = 0x37
+ ETHTOOL_GSTATS = 0x1d
+ ETHTOOL_GSTRINGS = 0x1b
+ ETHTOOL_GTSO = 0x1e
+ ETHTOOL_GTUNABLE = 0x48
+ ETHTOOL_GTXCSUM = 0x16
+ ETHTOOL_GUFO = 0x21
+ ETHTOOL_GWOL = 0x5
+ ETHTOOL_MCGRP_MONITOR_NAME = "monitor"
+ ETHTOOL_NWAY_RST = 0x9
+ ETHTOOL_PERQUEUE = 0x4b
+ ETHTOOL_PHYS_ID = 0x1c
+ ETHTOOL_PHY_EDPD_DFLT_TX_MSECS = 0xffff
+ ETHTOOL_PHY_EDPD_DISABLE = 0x0
+ ETHTOOL_PHY_EDPD_NO_TX = 0xfffe
+ ETHTOOL_PHY_FAST_LINK_DOWN_OFF = 0xff
+ ETHTOOL_PHY_FAST_LINK_DOWN_ON = 0x0
+ ETHTOOL_PHY_GTUNABLE = 0x4e
+ ETHTOOL_PHY_STUNABLE = 0x4f
+ ETHTOOL_RESET = 0x34
+ ETHTOOL_RXNTUPLE_ACTION_CLEAR = -0x2
+ ETHTOOL_RXNTUPLE_ACTION_DROP = -0x1
+ ETHTOOL_RX_FLOW_SPEC_RING = 0xffffffff
+ ETHTOOL_RX_FLOW_SPEC_RING_VF = 0xff00000000
+ ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF = 0x20
+ ETHTOOL_SCHANNELS = 0x3d
+ ETHTOOL_SCOALESCE = 0xf
+ ETHTOOL_SEEE = 0x45
+ ETHTOOL_SEEPROM = 0xc
+ ETHTOOL_SET_DUMP = 0x3e
+ ETHTOOL_SFEATURES = 0x3b
+ ETHTOOL_SFECPARAM = 0x51
+ ETHTOOL_SFLAGS = 0x26
+ ETHTOOL_SGRO = 0x2c
+ ETHTOOL_SGSO = 0x24
+ ETHTOOL_SLINKSETTINGS = 0x4d
+ ETHTOOL_SMSGLVL = 0x8
+ ETHTOOL_SPAUSEPARAM = 0x13
+ ETHTOOL_SPFLAGS = 0x28
+ ETHTOOL_SRINGPARAM = 0x11
+ ETHTOOL_SRSSH = 0x47
+ ETHTOOL_SRXCLSRLDEL = 0x31
+ ETHTOOL_SRXCLSRLINS = 0x32
+ ETHTOOL_SRXCSUM = 0x15
+ ETHTOOL_SRXFH = 0x2a
+ ETHTOOL_SRXFHINDIR = 0x39
+ ETHTOOL_SRXNTUPLE = 0x35
+ ETHTOOL_SSET = 0x2
+ ETHTOOL_SSG = 0x19
+ ETHTOOL_STSO = 0x1f
+ ETHTOOL_STUNABLE = 0x49
+ ETHTOOL_STXCSUM = 0x17
+ ETHTOOL_SUFO = 0x22
+ ETHTOOL_SWOL = 0x6
+ ETHTOOL_TEST = 0x1a
ETH_P_1588 = 0x88f7
ETH_P_8021AD = 0x88a8
ETH_P_8021AH = 0x88e7
@@ -544,6 +665,7 @@ const (
ETH_P_CAIF = 0xf7
ETH_P_CAN = 0xc
ETH_P_CANFD = 0xd
+ ETH_P_CFM = 0x8902
ETH_P_CONTROL = 0x16
ETH_P_CUST = 0x6006
ETH_P_DDCMP = 0x6
@@ -714,7 +836,6 @@ const (
FSCRYPT_POLICY_FLAGS_PAD_4 = 0x0
FSCRYPT_POLICY_FLAGS_PAD_8 = 0x1
FSCRYPT_POLICY_FLAGS_PAD_MASK = 0x3
- FSCRYPT_POLICY_FLAGS_VALID = 0x1f
FSCRYPT_POLICY_FLAG_DIRECT_KEY = 0x4
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 = 0x10
FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 = 0x8
@@ -745,7 +866,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
- FS_POLICY_FLAGS_VALID = 0x1f
+ FS_POLICY_FLAGS_VALID = 0x7
FS_VERITY_FL = 0x100000
FS_VERITY_HASH_ALG_SHA256 = 0x1
FS_VERITY_HASH_ALG_SHA512 = 0x2
@@ -989,6 +1110,7 @@ const (
IPV6_DONTFRAG = 0x3e
IPV6_DROP_MEMBERSHIP = 0x15
IPV6_DSTOPTS = 0x3b
+ IPV6_FLOW = 0x11
IPV6_FREEBIND = 0x4e
IPV6_HDRINCL = 0x24
IPV6_HOPLIMIT = 0x34
@@ -1017,6 +1139,7 @@ const (
IPV6_PMTUDISC_WANT = 0x1
IPV6_RECVDSTOPTS = 0x3a
IPV6_RECVERR = 0x19
+ IPV6_RECVERR_RFC4884 = 0x1f
IPV6_RECVFRAGSIZE = 0x4d
IPV6_RECVHOPLIMIT = 0x33
IPV6_RECVHOPOPTS = 0x35
@@ -1038,6 +1161,7 @@ const (
IPV6_TRANSPARENT = 0x4b
IPV6_UNICAST_HOPS = 0x10
IPV6_UNICAST_IF = 0x4c
+ IPV6_USER_FLOW = 0xe
IPV6_V6ONLY = 0x1a
IPV6_XFRM_POLICY = 0x23
IP_ADD_MEMBERSHIP = 0x23
@@ -1080,6 +1204,7 @@ const (
IP_PMTUDISC_PROBE = 0x3
IP_PMTUDISC_WANT = 0x1
IP_RECVERR = 0xb
+ IP_RECVERR_RFC4884 = 0x1a
IP_RECVFRAGSIZE = 0x19
IP_RECVOPTS = 0x6
IP_RECVORIGDSTADDR = 0x14
@@ -1094,6 +1219,7 @@ const (
IP_TTL = 0x2
IP_UNBLOCK_SOURCE = 0x25
IP_UNICAST_IF = 0x32
+ IP_USER_FLOW = 0xd
IP_XFRM_POLICY = 0x11
ISOFS_SUPER_MAGIC = 0x9660
ISTRIP = 0x20
@@ -1331,6 +1457,7 @@ const (
MS_NOREMOTELOCK = 0x8000000
MS_NOSEC = 0x10000000
MS_NOSUID = 0x2
+ MS_NOSYMFOLLOW = 0x100
MS_NOUSER = -0x80000000
MS_POSIXACL = 0x10000
MS_PRIVATE = 0x40000
@@ -1572,7 +1699,7 @@ const (
PERF_MEM_REMOTE_REMOTE = 0x1
PERF_MEM_REMOTE_SHIFT = 0x25
PERF_MEM_SNOOPX_FWD = 0x1
- PERF_MEM_SNOOPX_SHIFT = 0x25
+ PERF_MEM_SNOOPX_SHIFT = 0x26
PERF_MEM_SNOOP_HIT = 0x4
PERF_MEM_SNOOP_HITM = 0x10
PERF_MEM_SNOOP_MISS = 0x8
@@ -1672,6 +1799,13 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
+ PR_MTE_TAG_MASK = 0x7fff8
+ PR_MTE_TAG_SHIFT = 0x3
+ PR_MTE_TCF_ASYNC = 0x4
+ PR_MTE_TCF_MASK = 0x6
+ PR_MTE_TCF_NONE = 0x0
+ PR_MTE_TCF_SHIFT = 0x1
+ PR_MTE_TCF_SYNC = 0x2
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
@@ -1709,6 +1843,7 @@ const (
PR_SET_SECCOMP = 0x16
PR_SET_SECUREBITS = 0x1c
PR_SET_SPECULATION_CTRL = 0x35
+ PR_SET_SYSCALL_USER_DISPATCH = 0x3b
PR_SET_TAGGED_ADDR_CTRL = 0x37
PR_SET_THP_DISABLE = 0x29
PR_SET_TIMERSLACK = 0x1d
@@ -1728,6 +1863,8 @@ const (
PR_SVE_SET_VL_ONEXEC = 0x40000
PR_SVE_VL_INHERIT = 0x20000
PR_SVE_VL_LEN_MASK = 0xffff
+ PR_SYS_DISPATCH_OFF = 0x0
+ PR_SYS_DISPATCH_ON = 0x1
PR_TAGGED_ADDR_ENABLE = 0x1
PR_TASK_PERF_EVENTS_DISABLE = 0x1f
PR_TASK_PERF_EVENTS_ENABLE = 0x20
@@ -1973,12 +2110,13 @@ const (
RTM_SETLINK = 0x13
RTM_SETNEIGHTBL = 0x43
RTNH_ALIGNTO = 0x4
- RTNH_COMPARE_MASK = 0x19
+ RTNH_COMPARE_MASK = 0x59
RTNH_F_DEAD = 0x1
RTNH_F_LINKDOWN = 0x10
RTNH_F_OFFLOAD = 0x8
RTNH_F_ONLINK = 0x4
RTNH_F_PERVASIVE = 0x2
+ RTNH_F_TRAP = 0x40
RTNH_F_UNRESOLVED = 0x20
RTN_MAX = 0xb
RTPROT_BABEL = 0x2a
@@ -2206,7 +2344,7 @@ const (
STATX_ATTR_APPEND = 0x20
STATX_ATTR_AUTOMOUNT = 0x1000
STATX_ATTR_COMPRESSED = 0x4
- STATX_ATTR_DAX = 0x2000
+ STATX_ATTR_DAX = 0x200000
STATX_ATTR_ENCRYPTED = 0x800
STATX_ATTR_IMMUTABLE = 0x10
STATX_ATTR_MOUNT_ROOT = 0x2000
@@ -2325,6 +2463,8 @@ const (
TCP_TX_DELAY = 0x25
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
+ TCP_V4_FLOW = 0x1
+ TCP_V6_FLOW = 0x5
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TFD_TIMER_ABSTIME = 0x1
@@ -2390,6 +2530,7 @@ const (
TIPC_NODE_STATE = 0x0
TIPC_OK = 0x0
TIPC_PUBLISHED = 0x1
+ TIPC_REKEYING_NOW = 0xffffffff
TIPC_RESERVED_TYPES = 0x40
TIPC_RETDATA = 0x2
TIPC_SERVICE_ADDR = 0x2
@@ -2446,10 +2587,12 @@ const (
VMADDR_CID_HOST = 0x2
VMADDR_CID_HYPERVISOR = 0x0
VMADDR_CID_LOCAL = 0x1
+ VMADDR_FLAG_TO_HOST = 0x1
VMADDR_PORT_ANY = 0xffffffff
VM_SOCKETS_INVALID_VERSION = 0xffffffff
VQUIT = 0x1
VT0 = 0x0
+ WAKE_MAGIC = 0x20
WALL = 0x40000000
WCLONE = 0x80000000
WCONTINUED = 0x8
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
index dd282c08b7..c8d5b324c7 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_386.go
@@ -4,7 +4,7 @@
// +build 386,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/_const.go
package unix
@@ -165,6 +165,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
+ PPPIOCBRIDGECHAN = 0x40047435
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
@@ -192,6 +193,7 @@ const (
PPPIOCSPASS = 0x40087447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
+ PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PR_SET_PTRACER_ANY = 0xffffffff
PTRACE_GETFPREGS = 0xe
@@ -268,6 +270,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -290,6 +293,7 @@ const (
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
index 82fc93c7bb..e605c08b0e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
@@ -4,7 +4,7 @@
// +build amd64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/_const.go
package unix
@@ -165,6 +165,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
+ PPPIOCBRIDGECHAN = 0x40047435
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
@@ -192,6 +193,7 @@ const (
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
+ PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
PTRACE_ARCH_PRCTL = 0x1e
@@ -269,6 +271,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -291,6 +294,7 @@ const (
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
index fe7094f276..0279fa1abd 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
@@ -4,7 +4,7 @@
// +build arm,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
+ PPPIOCBRIDGECHAN = 0x40047435
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x40087447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
+ PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PR_SET_PTRACER_ANY = 0xffffffff
PTRACE_GETCRUNCHREGS = 0x19
@@ -275,6 +277,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -297,6 +300,7 @@ const (
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
index 3b6cc58803..20c286a112 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
@@ -4,7 +4,7 @@
// +build arm64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go
package unix
@@ -166,6 +166,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
+ PPPIOCBRIDGECHAN = 0x40047435
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
@@ -193,9 +194,13 @@ const (
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
+ PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PROT_BTI = 0x10
+ PROT_MTE = 0x20
PR_SET_PTRACER_ANY = 0xffffffffffffffff
+ PTRACE_PEEKMTETAGS = 0x21
+ PTRACE_POKEMTETAGS = 0x22
PTRACE_SYSEMU = 0x1f
PTRACE_SYSEMU_SINGLESTEP = 0x20
RLIMIT_AS = 0x9
@@ -262,6 +267,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -284,6 +290,7 @@ const (
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
index ce3d9ae156..1785f33d66 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
@@ -4,7 +4,7 @@
// +build mips,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x80087447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PR_SET_PTRACER_ANY = 0xffffffff
PTRACE_GETFPREGS = 0xe
@@ -268,6 +270,7 @@ const (
SO_BROADCAST = 0x20
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -290,6 +293,7 @@ const (
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1e
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
SO_RCVBUF = 0x1002
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
index 7a85215ce5..acb1ef1bf5 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
@@ -4,7 +4,7 @@
// +build mips64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
PTRACE_GETFPREGS = 0xe
@@ -268,6 +270,7 @@ const (
SO_BROADCAST = 0x20
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -290,6 +293,7 @@ const (
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1e
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
SO_RCVBUF = 0x1002
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
index 07d4cc1bd5..468a4e68c7 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
@@ -4,7 +4,7 @@
// +build mips64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
PTRACE_GETFPREGS = 0xe
@@ -268,6 +270,7 @@ const (
SO_BROADCAST = 0x20
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -290,6 +293,7 @@ const (
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1e
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
SO_RCVBUF = 0x1002
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
index d4842ba1c2..6c9c7f2c76 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
@@ -4,7 +4,7 @@
// +build mipsle,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x80087447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PR_SET_PTRACER_ANY = 0xffffffff
PTRACE_GETFPREGS = 0xe
@@ -268,6 +270,7 @@ const (
SO_BROADCAST = 0x20
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -290,6 +293,7 @@ const (
SO_PEERCRED = 0x12
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1e
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x1028
SO_RCVBUF = 0x1002
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
index 941e20dace..8961206e5f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
@@ -4,7 +4,7 @@
// +build ppc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -165,6 +165,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -192,6 +193,7 @@ const (
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PROT_SAO = 0x10
PR_SET_PTRACER_ANY = 0xffffffffffffffff
@@ -327,6 +329,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -349,6 +352,7 @@ const (
SO_PEERCRED = 0x15
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
index 63d3bc5662..6bcf79dc2e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
@@ -4,7 +4,7 @@
// +build ppc64le,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -165,6 +165,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -192,6 +193,7 @@ const (
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PROT_SAO = 0x10
PR_SET_PTRACER_ANY = 0xffffffffffffffff
@@ -327,6 +329,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -349,6 +352,7 @@ const (
SO_PEERCRED = 0x15
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
index 490bee1ab1..e861d97f1c 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
@@ -4,7 +4,7 @@
// +build riscv64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
+ PPPIOCBRIDGECHAN = 0x40047435
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
+ PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
RLIMIT_AS = 0x9
@@ -256,6 +258,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -278,6 +281,7 @@ const (
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
index 467b8218e8..d39278bee5 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
@@ -4,7 +4,7 @@
// +build s390x,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go
package unix
@@ -163,6 +163,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
+ PPPIOCBRIDGECHAN = 0x40047435
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
@@ -190,6 +191,7 @@ const (
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
+ PPPIOCUNBRIDGECHAN = 0x7434
PPPIOCXFERUNIT = 0x744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
PTRACE_DISABLE_TE = 0x5010
@@ -329,6 +331,7 @@ const (
SO_BROADCAST = 0x6
SO_BSDCOMPAT = 0xe
SO_BUSY_POLL = 0x2e
+ SO_BUSY_POLL_BUDGET = 0x46
SO_CNX_ADVICE = 0x35
SO_COOKIE = 0x39
SO_DETACH_REUSEPORT_BPF = 0x44
@@ -351,6 +354,7 @@ const (
SO_PEERCRED = 0x11
SO_PEERGROUPS = 0x3b
SO_PEERSEC = 0x1f
+ SO_PREFER_BUSY_POLL = 0x45
SO_PROTOCOL = 0x26
SO_RCVBUF = 0x8
SO_RCVBUFFORCE = 0x21
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
index 79fbafbcf6..6a742fa7ee 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
@@ -4,7 +4,7 @@
// +build sparc64,linux
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go
package unix
@@ -168,6 +168,7 @@ const (
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
+ PPPIOCBRIDGECHAN = 0x80047435
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
@@ -195,6 +196,7 @@ const (
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
+ PPPIOCUNBRIDGECHAN = 0x20007434
PPPIOCXFERUNIT = 0x2000744e
PR_SET_PTRACER_ANY = 0xffffffffffffffff
PTRACE_GETFPAREGS = 0x14
@@ -322,6 +324,7 @@ const (
SO_BROADCAST = 0x20
SO_BSDCOMPAT = 0x400
SO_BUSY_POLL = 0x30
+ SO_BUSY_POLL_BUDGET = 0x49
SO_CNX_ADVICE = 0x37
SO_COOKIE = 0x3b
SO_DETACH_REUSEPORT_BPF = 0x47
@@ -344,6 +347,7 @@ const (
SO_PEERCRED = 0x40
SO_PEERGROUPS = 0x3d
SO_PEERSEC = 0x1e
+ SO_PREFER_BUSY_POLL = 0x48
SO_PROTOCOL = 0x1028
SO_RCVBUF = 0x1002
SO_RCVBUFFORCE = 0x100b
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
index 7f0f117d32..3877183483 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go
@@ -462,10 +462,8 @@ func libc_munlockall_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func pipe() (r int, w int, err error) {
- r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
- r = int(r0)
- w = int(r1)
+func pipe(p *[2]int32) (err error) {
+ _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -2381,7 +2379,7 @@ func libc_lstat64_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
+func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
index 2daf0bd628..508e5639bf 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
@@ -462,10 +462,8 @@ func libc_munlockall_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func pipe() (r int, w int, err error) {
- r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
- r = int(r0)
- w = int(r1)
+func pipe(p *[2]int32) (err error) {
+ _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -2381,7 +2379,7 @@ func libc_lstat64_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
+func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
index 8e79ad377b..c0c771f402 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go
@@ -462,10 +462,8 @@ func libc_munlockall_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func pipe() (r int, w int, err error) {
- r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
- r = int(r0)
- w = int(r1)
+func pipe(p *[2]int32) (err error) {
+ _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
index 23be592a9f..9b01a79c41 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
@@ -462,10 +462,8 @@ func libc_munlockall_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func pipe() (r int, w int, err error) {
- r0, r1, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), 0, 0, 0)
- r = int(r0)
- w = int(r1)
+func pipe(p *[2]int32) (err error) {
+ _, _, e1 := syscall_rawSyscall(funcPC(libc_pipe_trampoline), uintptr(unsafe.Pointer(p)), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
}
@@ -2381,7 +2379,7 @@ func libc_lstat_trampoline()
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
+func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
_, _, e1 := syscall_syscall6(funcPC(libc_ptrace_trampoline), uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
if e1 != 0 {
err = errnoErr(e1)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
index 1aaccd3615..104f77d5b8 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
@@ -362,8 +362,10 @@ func pipe() (r int, w int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func pipe2(p *[2]_C_int, flags int) (err error) {
- _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+func pipe2(flags int) (r int, w int, err error) {
+ r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(flags), 0, 0)
+ r = int(r0)
+ w = int(r1)
if e1 != 0 {
err = errnoErr(e1)
}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go
index d3af083f4e..665dd9e4b4 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go
@@ -14,22 +14,19 @@ import (
//go:cgo_import_dynamic libc_writev writev "libc.so"
//go:cgo_import_dynamic libc_pwritev pwritev "libc.so"
//go:cgo_import_dynamic libc_accept4 accept4 "libsocket.so"
-//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so"
//go:linkname procreadv libc_readv
//go:linkname procpreadv libc_preadv
//go:linkname procwritev libc_writev
//go:linkname procpwritev libc_pwritev
//go:linkname procaccept4 libc_accept4
-//go:linkname procpipe2 libc_pipe2
var (
procreadv,
procpreadv,
procwritev,
procpwritev,
- procaccept4,
- procpipe2 syscallFunc
+ procaccept4 syscallFunc
)
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
@@ -102,13 +99,3 @@ func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int,
}
return
}
-
-// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-
-func pipe2(p *[2]_C_int, flags int) (err error) {
- _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0)
- if e1 != 0 {
- err = e1
- }
- return
-}
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
index 3bbd9e39cd..1d6f71d99a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go
@@ -362,6 +362,16 @@ func pipe() (fd1 int, fd2 int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (err error) {
+ _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
index d8cf5012c2..82f50506ad 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go
@@ -362,6 +362,16 @@ func pipe() (fd1 int, fd2 int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (err error) {
+ _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
index 1153fe69b8..b4db55a0c8 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go
@@ -362,6 +362,16 @@ func pipe() (fd1 int, fd2 int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (err error) {
+ _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
index 24b4ebb41f..e9f6d7975a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go
@@ -362,6 +362,16 @@ func pipe() (fd1 int, fd2 int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (err error) {
+ _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
index a96165d4bf..9898ce1f47 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go
@@ -11,6 +11,7 @@ import (
)
//go:cgo_import_dynamic libc_pipe pipe "libc.so"
+//go:cgo_import_dynamic libc_pipe2 pipe2 "libc.so"
//go:cgo_import_dynamic libc_getsockname getsockname "libsocket.so"
//go:cgo_import_dynamic libc_getcwd getcwd "libc.so"
//go:cgo_import_dynamic libc_getgroups getgroups "libc.so"
@@ -114,6 +115,7 @@ import (
//go:cgo_import_dynamic libc_statvfs statvfs "libc.so"
//go:cgo_import_dynamic libc_symlink symlink "libc.so"
//go:cgo_import_dynamic libc_sync sync "libc.so"
+//go:cgo_import_dynamic libc_sysconf sysconf "libc.so"
//go:cgo_import_dynamic libc_times times "libc.so"
//go:cgo_import_dynamic libc_truncate truncate "libc.so"
//go:cgo_import_dynamic libc_fsync fsync "libc.so"
@@ -140,6 +142,7 @@ import (
//go:cgo_import_dynamic libc_recvfrom recvfrom "libsocket.so"
//go:linkname procpipe libc_pipe
+//go:linkname procpipe2 libc_pipe2
//go:linkname procgetsockname libc_getsockname
//go:linkname procGetcwd libc_getcwd
//go:linkname procgetgroups libc_getgroups
@@ -243,6 +246,7 @@ import (
//go:linkname procStatvfs libc_statvfs
//go:linkname procSymlink libc_symlink
//go:linkname procSync libc_sync
+//go:linkname procSysconf libc_sysconf
//go:linkname procTimes libc_times
//go:linkname procTruncate libc_truncate
//go:linkname procFsync libc_fsync
@@ -270,6 +274,7 @@ import (
var (
procpipe,
+ procpipe2,
procgetsockname,
procGetcwd,
procgetgroups,
@@ -373,6 +378,7 @@ var (
procStatvfs,
procSymlink,
procSync,
+ procSysconf,
procTimes,
procTruncate,
procFsync,
@@ -412,6 +418,16 @@ func pipe(p *[2]_C_int) (n int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (err error) {
+ _, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procpipe2)), 2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0, 0, 0, 0)
+ if e1 != 0 {
+ err = e1
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) {
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procgetsockname)), 3, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
if e1 != 0 {
@@ -1674,6 +1690,17 @@ func Sync() (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func Sysconf(which int) (n int64, err error) {
+ r0, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procSysconf)), 1, uintptr(which), 0, 0, 0, 0, 0)
+ n = int64(r0)
+ if e1 != 0 {
+ err = e1
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func Times(tms *Tms) (ticks uintptr, err error) {
r0, _, e1 := rawSysvicall6(uintptr(unsafe.Pointer(&procTimes)), 1, uintptr(unsafe.Pointer(tms)), 0, 0, 0, 0, 0)
ticks = uintptr(r0)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
index 0f5a3f6970..c80f3c7bdd 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go
@@ -435,4 +435,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
index 36d5219ef8..2369995cec 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go
@@ -357,4 +357,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
index 3622ba14b4..971c5af6d4 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go
@@ -399,4 +399,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
index 6193c3dc07..a5e410b24f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go
@@ -302,4 +302,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
index 640b974345..438a6ea4e6 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go
@@ -420,4 +420,6 @@ const (
SYS_OPENAT2 = 4437
SYS_PIDFD_GETFD = 4438
SYS_FACCESSAT2 = 4439
+ SYS_PROCESS_MADVISE = 4440
+ SYS_EPOLL_PWAIT2 = 4441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
index 3467fbb5ff..622472da22 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go
@@ -350,4 +350,6 @@ const (
SYS_OPENAT2 = 5437
SYS_PIDFD_GETFD = 5438
SYS_FACCESSAT2 = 5439
+ SYS_PROCESS_MADVISE = 5440
+ SYS_EPOLL_PWAIT2 = 5441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
index 0fc38d5a72..e029b989b8 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go
@@ -350,4 +350,6 @@ const (
SYS_OPENAT2 = 5437
SYS_PIDFD_GETFD = 5438
SYS_FACCESSAT2 = 5439
+ SYS_PROCESS_MADVISE = 5440
+ SYS_EPOLL_PWAIT2 = 5441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
index 999fd55bcc..86a497b58d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go
@@ -420,4 +420,6 @@ const (
SYS_OPENAT2 = 4437
SYS_PIDFD_GETFD = 4438
SYS_FACCESSAT2 = 4439
+ SYS_PROCESS_MADVISE = 4440
+ SYS_EPOLL_PWAIT2 = 4441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
index 1df0d79935..b6b0b5e602 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go
@@ -399,4 +399,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
index 4db39cca4d..b344db0146 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go
@@ -399,4 +399,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
index e692740144..9b8fa53dcc 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go
@@ -301,4 +301,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
index a585aec4e7..8261f72c0b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go
@@ -364,4 +364,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
index d047e567af..f4bbeb3db5 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go
@@ -378,4 +378,6 @@ const (
SYS_OPENAT2 = 437
SYS_PIDFD_GETFD = 438
SYS_FACCESSAT2 = 439
+ SYS_PROCESS_MADVISE = 440
+ SYS_EPOLL_PWAIT2 = 441
)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go
index 2c1f815e6f..295859c503 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go
@@ -219,6 +219,7 @@ const (
SizeofSockaddrUnix = 0x401
SizeofSockaddrDatalink = 0x80
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofIPv6MTUInfo = 0x20
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go
index b4a069ecbd..a9ee0ffd44 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go
@@ -223,6 +223,7 @@ const (
SizeofSockaddrUnix = 0x401
SizeofSockaddrDatalink = 0x80
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofIPv6MTUInfo = 0x20
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
index 080ffce325..bb39542f7a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
@@ -210,6 +210,13 @@ type RawSockaddrCtl struct {
type _Socklen uint32
+type Xucred struct {
+ Version uint32
+ Uid uint32
+ Ngroups int16
+ Groups [16]uint32
+}
+
type Linger struct {
Onoff int32
Linger int32
@@ -273,6 +280,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofSockaddrCtl = 0x20
+ SizeofXucred = 0x4c
SizeofLinger = 0x8
SizeofIovec = 0x10
SizeofIPMreq = 0x8
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
index c9492428bf..ec5b559272 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
@@ -210,6 +210,13 @@ type RawSockaddrCtl struct {
type _Socklen uint32
+type Xucred struct {
+ Version uint32
+ Uid uint32
+ Ngroups int16
+ Groups [16]uint32
+}
+
type Linger struct {
Onoff int32
Linger int32
@@ -273,6 +280,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofSockaddrCtl = 0x20
+ SizeofXucred = 0x4c
SizeofLinger = 0x8
SizeofIovec = 0x10
SizeofIPMreq = 0x8
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
index c4772df23b..85506a05d4 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go
@@ -234,6 +234,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
index 2a3ec615f7..3e9dad33e3 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go
@@ -313,6 +313,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
index e11e95499e..e00e615544 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go
@@ -309,6 +309,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
index b91c2ae0f0..5da13c871b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go
@@ -311,6 +311,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
index c6fe1d097d..995ecf9d4e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go
@@ -309,6 +309,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x36
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPMreqn = 0xc
SizeofIPv6Mreq = 0x14
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
index 504ef131fb..ddd655769d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux.go
@@ -288,7 +288,8 @@ type RawSockaddrVM struct {
Reserved1 uint16
Port uint32
Cid uint32
- Zero [4]uint8
+ Flags uint8
+ Zero [3]uint8
}
type RawSockaddrXDP struct {
@@ -999,7 +1000,7 @@ const (
PERF_SAMPLE_PHYS_ADDR = 0x80000
PERF_SAMPLE_AUX = 0x100000
PERF_SAMPLE_CGROUP = 0x200000
- PERF_SAMPLE_MAX = 0x400000
+ PERF_SAMPLE_MAX = 0x1000000
PERF_SAMPLE_BRANCH_USER_SHIFT = 0x0
PERF_SAMPLE_BRANCH_KERNEL_SHIFT = 0x1
PERF_SAMPLE_BRANCH_HV_SHIFT = 0x2
@@ -1381,6 +1382,11 @@ const (
IFLA_PROP_LIST = 0x34
IFLA_ALT_IFNAME = 0x35
IFLA_PERM_ADDRESS = 0x36
+ IFLA_PROTO_DOWN_REASON = 0x37
+ IFLA_PROTO_DOWN_REASON_UNSPEC = 0x0
+ IFLA_PROTO_DOWN_REASON_MASK = 0x1
+ IFLA_PROTO_DOWN_REASON_VALUE = 0x2
+ IFLA_PROTO_DOWN_REASON_MAX = 0x2
IFLA_INET_UNSPEC = 0x0
IFLA_INET_CONF = 0x1
IFLA_INET6_UNSPEC = 0x0
@@ -1475,6 +1481,7 @@ const (
IFLA_BRPORT_ISOLATED = 0x21
IFLA_BRPORT_BACKUP_PORT = 0x22
IFLA_BRPORT_MRP_RING_OPEN = 0x23
+ IFLA_BRPORT_MRP_IN_OPEN = 0x24
IFLA_INFO_UNSPEC = 0x0
IFLA_INFO_KIND = 0x1
IFLA_INFO_DATA = 0x2
@@ -1673,6 +1680,7 @@ const (
IFLA_HSR_SUPERVISION_ADDR = 0x4
IFLA_HSR_SEQ_NR = 0x5
IFLA_HSR_VERSION = 0x6
+ IFLA_HSR_PROTOCOL = 0x7
IFLA_STATS_UNSPEC = 0x0
IFLA_STATS_LINK_64 = 0x1
IFLA_STATS_LINK_XSTATS = 0x2
@@ -2217,10 +2225,12 @@ const (
)
const (
- NETNSA_NONE = 0x0
- NETNSA_NSID = 0x1
- NETNSA_PID = 0x2
- NETNSA_FD = 0x3
+ NETNSA_NONE = 0x0
+ NETNSA_NSID = 0x1
+ NETNSA_PID = 0x2
+ NETNSA_FD = 0x3
+ NETNSA_TARGET_NSID = 0x4
+ NETNSA_CURRENT_NSID = 0x5
)
type XDPRingOffset struct {
@@ -2370,281 +2380,309 @@ const (
)
const (
- BPF_REG_0 = 0x0
- BPF_REG_1 = 0x1
- BPF_REG_2 = 0x2
- BPF_REG_3 = 0x3
- BPF_REG_4 = 0x4
- BPF_REG_5 = 0x5
- BPF_REG_6 = 0x6
- BPF_REG_7 = 0x7
- BPF_REG_8 = 0x8
- BPF_REG_9 = 0x9
- BPF_REG_10 = 0xa
- BPF_MAP_CREATE = 0x0
- BPF_MAP_LOOKUP_ELEM = 0x1
- BPF_MAP_UPDATE_ELEM = 0x2
- BPF_MAP_DELETE_ELEM = 0x3
- BPF_MAP_GET_NEXT_KEY = 0x4
- BPF_PROG_LOAD = 0x5
- BPF_OBJ_PIN = 0x6
- BPF_OBJ_GET = 0x7
- BPF_PROG_ATTACH = 0x8
- BPF_PROG_DETACH = 0x9
- BPF_PROG_TEST_RUN = 0xa
- BPF_PROG_GET_NEXT_ID = 0xb
- BPF_MAP_GET_NEXT_ID = 0xc
- BPF_PROG_GET_FD_BY_ID = 0xd
- BPF_MAP_GET_FD_BY_ID = 0xe
- BPF_OBJ_GET_INFO_BY_FD = 0xf
- BPF_PROG_QUERY = 0x10
- BPF_RAW_TRACEPOINT_OPEN = 0x11
- BPF_BTF_LOAD = 0x12
- BPF_BTF_GET_FD_BY_ID = 0x13
- BPF_TASK_FD_QUERY = 0x14
- BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15
- BPF_MAP_FREEZE = 0x16
- BPF_BTF_GET_NEXT_ID = 0x17
- BPF_MAP_LOOKUP_BATCH = 0x18
- BPF_MAP_LOOKUP_AND_DELETE_BATCH = 0x19
- BPF_MAP_UPDATE_BATCH = 0x1a
- BPF_MAP_DELETE_BATCH = 0x1b
- BPF_LINK_CREATE = 0x1c
- BPF_LINK_UPDATE = 0x1d
- BPF_LINK_GET_FD_BY_ID = 0x1e
- BPF_LINK_GET_NEXT_ID = 0x1f
- BPF_ENABLE_STATS = 0x20
- BPF_ITER_CREATE = 0x21
- BPF_MAP_TYPE_UNSPEC = 0x0
- BPF_MAP_TYPE_HASH = 0x1
- BPF_MAP_TYPE_ARRAY = 0x2
- BPF_MAP_TYPE_PROG_ARRAY = 0x3
- BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4
- BPF_MAP_TYPE_PERCPU_HASH = 0x5
- BPF_MAP_TYPE_PERCPU_ARRAY = 0x6
- BPF_MAP_TYPE_STACK_TRACE = 0x7
- BPF_MAP_TYPE_CGROUP_ARRAY = 0x8
- BPF_MAP_TYPE_LRU_HASH = 0x9
- BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa
- BPF_MAP_TYPE_LPM_TRIE = 0xb
- BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc
- BPF_MAP_TYPE_HASH_OF_MAPS = 0xd
- BPF_MAP_TYPE_DEVMAP = 0xe
- BPF_MAP_TYPE_SOCKMAP = 0xf
- BPF_MAP_TYPE_CPUMAP = 0x10
- BPF_MAP_TYPE_XSKMAP = 0x11
- BPF_MAP_TYPE_SOCKHASH = 0x12
- BPF_MAP_TYPE_CGROUP_STORAGE = 0x13
- BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14
- BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15
- BPF_MAP_TYPE_QUEUE = 0x16
- BPF_MAP_TYPE_STACK = 0x17
- BPF_MAP_TYPE_SK_STORAGE = 0x18
- BPF_MAP_TYPE_DEVMAP_HASH = 0x19
- BPF_MAP_TYPE_STRUCT_OPS = 0x1a
- BPF_MAP_TYPE_RINGBUF = 0x1b
- BPF_PROG_TYPE_UNSPEC = 0x0
- BPF_PROG_TYPE_SOCKET_FILTER = 0x1
- BPF_PROG_TYPE_KPROBE = 0x2
- BPF_PROG_TYPE_SCHED_CLS = 0x3
- BPF_PROG_TYPE_SCHED_ACT = 0x4
- BPF_PROG_TYPE_TRACEPOINT = 0x5
- BPF_PROG_TYPE_XDP = 0x6
- BPF_PROG_TYPE_PERF_EVENT = 0x7
- BPF_PROG_TYPE_CGROUP_SKB = 0x8
- BPF_PROG_TYPE_CGROUP_SOCK = 0x9
- BPF_PROG_TYPE_LWT_IN = 0xa
- BPF_PROG_TYPE_LWT_OUT = 0xb
- BPF_PROG_TYPE_LWT_XMIT = 0xc
- BPF_PROG_TYPE_SOCK_OPS = 0xd
- BPF_PROG_TYPE_SK_SKB = 0xe
- BPF_PROG_TYPE_CGROUP_DEVICE = 0xf
- BPF_PROG_TYPE_SK_MSG = 0x10
- BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11
- BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12
- BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13
- BPF_PROG_TYPE_LIRC_MODE2 = 0x14
- BPF_PROG_TYPE_SK_REUSEPORT = 0x15
- BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16
- BPF_PROG_TYPE_CGROUP_SYSCTL = 0x17
- BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE = 0x18
- BPF_PROG_TYPE_CGROUP_SOCKOPT = 0x19
- BPF_PROG_TYPE_TRACING = 0x1a
- BPF_PROG_TYPE_STRUCT_OPS = 0x1b
- BPF_PROG_TYPE_EXT = 0x1c
- BPF_PROG_TYPE_LSM = 0x1d
- BPF_CGROUP_INET_INGRESS = 0x0
- BPF_CGROUP_INET_EGRESS = 0x1
- BPF_CGROUP_INET_SOCK_CREATE = 0x2
- BPF_CGROUP_SOCK_OPS = 0x3
- BPF_SK_SKB_STREAM_PARSER = 0x4
- BPF_SK_SKB_STREAM_VERDICT = 0x5
- BPF_CGROUP_DEVICE = 0x6
- BPF_SK_MSG_VERDICT = 0x7
- BPF_CGROUP_INET4_BIND = 0x8
- BPF_CGROUP_INET6_BIND = 0x9
- BPF_CGROUP_INET4_CONNECT = 0xa
- BPF_CGROUP_INET6_CONNECT = 0xb
- BPF_CGROUP_INET4_POST_BIND = 0xc
- BPF_CGROUP_INET6_POST_BIND = 0xd
- BPF_CGROUP_UDP4_SENDMSG = 0xe
- BPF_CGROUP_UDP6_SENDMSG = 0xf
- BPF_LIRC_MODE2 = 0x10
- BPF_FLOW_DISSECTOR = 0x11
- BPF_CGROUP_SYSCTL = 0x12
- BPF_CGROUP_UDP4_RECVMSG = 0x13
- BPF_CGROUP_UDP6_RECVMSG = 0x14
- BPF_CGROUP_GETSOCKOPT = 0x15
- BPF_CGROUP_SETSOCKOPT = 0x16
- BPF_TRACE_RAW_TP = 0x17
- BPF_TRACE_FENTRY = 0x18
- BPF_TRACE_FEXIT = 0x19
- BPF_MODIFY_RETURN = 0x1a
- BPF_LSM_MAC = 0x1b
- BPF_TRACE_ITER = 0x1c
- BPF_CGROUP_INET4_GETPEERNAME = 0x1d
- BPF_CGROUP_INET6_GETPEERNAME = 0x1e
- BPF_CGROUP_INET4_GETSOCKNAME = 0x1f
- BPF_CGROUP_INET6_GETSOCKNAME = 0x20
- BPF_XDP_DEVMAP = 0x21
- BPF_LINK_TYPE_UNSPEC = 0x0
- BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1
- BPF_LINK_TYPE_TRACING = 0x2
- BPF_LINK_TYPE_CGROUP = 0x3
- BPF_LINK_TYPE_ITER = 0x4
- BPF_LINK_TYPE_NETNS = 0x5
- BPF_ANY = 0x0
- BPF_NOEXIST = 0x1
- BPF_EXIST = 0x2
- BPF_F_LOCK = 0x4
- BPF_F_NO_PREALLOC = 0x1
- BPF_F_NO_COMMON_LRU = 0x2
- BPF_F_NUMA_NODE = 0x4
- BPF_F_RDONLY = 0x8
- BPF_F_WRONLY = 0x10
- BPF_F_STACK_BUILD_ID = 0x20
- BPF_F_ZERO_SEED = 0x40
- BPF_F_RDONLY_PROG = 0x80
- BPF_F_WRONLY_PROG = 0x100
- BPF_F_CLONE = 0x200
- BPF_F_MMAPABLE = 0x400
- BPF_STATS_RUN_TIME = 0x0
- BPF_STACK_BUILD_ID_EMPTY = 0x0
- BPF_STACK_BUILD_ID_VALID = 0x1
- BPF_STACK_BUILD_ID_IP = 0x2
- BPF_F_RECOMPUTE_CSUM = 0x1
- BPF_F_INVALIDATE_HASH = 0x2
- BPF_F_HDR_FIELD_MASK = 0xf
- BPF_F_PSEUDO_HDR = 0x10
- BPF_F_MARK_MANGLED_0 = 0x20
- BPF_F_MARK_ENFORCE = 0x40
- BPF_F_INGRESS = 0x1
- BPF_F_TUNINFO_IPV6 = 0x1
- BPF_F_SKIP_FIELD_MASK = 0xff
- BPF_F_USER_STACK = 0x100
- BPF_F_FAST_STACK_CMP = 0x200
- BPF_F_REUSE_STACKID = 0x400
- BPF_F_USER_BUILD_ID = 0x800
- BPF_F_ZERO_CSUM_TX = 0x2
- BPF_F_DONT_FRAGMENT = 0x4
- BPF_F_SEQ_NUMBER = 0x8
- BPF_F_INDEX_MASK = 0xffffffff
- BPF_F_CURRENT_CPU = 0xffffffff
- BPF_F_CTXLEN_MASK = 0xfffff00000000
- BPF_F_CURRENT_NETNS = -0x1
- BPF_CSUM_LEVEL_QUERY = 0x0
- BPF_CSUM_LEVEL_INC = 0x1
- BPF_CSUM_LEVEL_DEC = 0x2
- BPF_CSUM_LEVEL_RESET = 0x3
- BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
- BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
- BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
- BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
- BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
- BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20
- BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
- BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
- BPF_F_SYSCTL_BASE_NAME = 0x1
- BPF_SK_STORAGE_GET_F_CREATE = 0x1
- BPF_F_GET_BRANCH_RECORDS_SIZE = 0x1
- BPF_RB_NO_WAKEUP = 0x1
- BPF_RB_FORCE_WAKEUP = 0x2
- BPF_RB_AVAIL_DATA = 0x0
- BPF_RB_RING_SIZE = 0x1
- BPF_RB_CONS_POS = 0x2
- BPF_RB_PROD_POS = 0x3
- BPF_RINGBUF_BUSY_BIT = 0x80000000
- BPF_RINGBUF_DISCARD_BIT = 0x40000000
- BPF_RINGBUF_HDR_SZ = 0x8
- BPF_ADJ_ROOM_NET = 0x0
- BPF_ADJ_ROOM_MAC = 0x1
- BPF_HDR_START_MAC = 0x0
- BPF_HDR_START_NET = 0x1
- BPF_LWT_ENCAP_SEG6 = 0x0
- BPF_LWT_ENCAP_SEG6_INLINE = 0x1
- BPF_LWT_ENCAP_IP = 0x2
- BPF_OK = 0x0
- BPF_DROP = 0x2
- BPF_REDIRECT = 0x7
- BPF_LWT_REROUTE = 0x80
- BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
- BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
- BPF_SOCK_OPS_STATE_CB_FLAG = 0x4
- BPF_SOCK_OPS_RTT_CB_FLAG = 0x8
- BPF_SOCK_OPS_ALL_CB_FLAGS = 0xf
- BPF_SOCK_OPS_VOID = 0x0
- BPF_SOCK_OPS_TIMEOUT_INIT = 0x1
- BPF_SOCK_OPS_RWND_INIT = 0x2
- BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3
- BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4
- BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5
- BPF_SOCK_OPS_NEEDS_ECN = 0x6
- BPF_SOCK_OPS_BASE_RTT = 0x7
- BPF_SOCK_OPS_RTO_CB = 0x8
- BPF_SOCK_OPS_RETRANS_CB = 0x9
- BPF_SOCK_OPS_STATE_CB = 0xa
- BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb
- BPF_SOCK_OPS_RTT_CB = 0xc
- BPF_TCP_ESTABLISHED = 0x1
- BPF_TCP_SYN_SENT = 0x2
- BPF_TCP_SYN_RECV = 0x3
- BPF_TCP_FIN_WAIT1 = 0x4
- BPF_TCP_FIN_WAIT2 = 0x5
- BPF_TCP_TIME_WAIT = 0x6
- BPF_TCP_CLOSE = 0x7
- BPF_TCP_CLOSE_WAIT = 0x8
- BPF_TCP_LAST_ACK = 0x9
- BPF_TCP_LISTEN = 0xa
- BPF_TCP_CLOSING = 0xb
- BPF_TCP_NEW_SYN_RECV = 0xc
- BPF_TCP_MAX_STATES = 0xd
- TCP_BPF_IW = 0x3e9
- TCP_BPF_SNDCWND_CLAMP = 0x3ea
- BPF_DEVCG_ACC_MKNOD = 0x1
- BPF_DEVCG_ACC_READ = 0x2
- BPF_DEVCG_ACC_WRITE = 0x4
- BPF_DEVCG_DEV_BLOCK = 0x1
- BPF_DEVCG_DEV_CHAR = 0x2
- BPF_FIB_LOOKUP_DIRECT = 0x1
- BPF_FIB_LOOKUP_OUTPUT = 0x2
- BPF_FIB_LKUP_RET_SUCCESS = 0x0
- BPF_FIB_LKUP_RET_BLACKHOLE = 0x1
- BPF_FIB_LKUP_RET_UNREACHABLE = 0x2
- BPF_FIB_LKUP_RET_PROHIBIT = 0x3
- BPF_FIB_LKUP_RET_NOT_FWDED = 0x4
- BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5
- BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6
- BPF_FIB_LKUP_RET_NO_NEIGH = 0x7
- BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8
- BPF_FD_TYPE_RAW_TRACEPOINT = 0x0
- BPF_FD_TYPE_TRACEPOINT = 0x1
- BPF_FD_TYPE_KPROBE = 0x2
- BPF_FD_TYPE_KRETPROBE = 0x3
- BPF_FD_TYPE_UPROBE = 0x4
- BPF_FD_TYPE_URETPROBE = 0x5
- BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 0x1
- BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 0x2
- BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 0x4
+ BPF_REG_0 = 0x0
+ BPF_REG_1 = 0x1
+ BPF_REG_2 = 0x2
+ BPF_REG_3 = 0x3
+ BPF_REG_4 = 0x4
+ BPF_REG_5 = 0x5
+ BPF_REG_6 = 0x6
+ BPF_REG_7 = 0x7
+ BPF_REG_8 = 0x8
+ BPF_REG_9 = 0x9
+ BPF_REG_10 = 0xa
+ BPF_MAP_CREATE = 0x0
+ BPF_MAP_LOOKUP_ELEM = 0x1
+ BPF_MAP_UPDATE_ELEM = 0x2
+ BPF_MAP_DELETE_ELEM = 0x3
+ BPF_MAP_GET_NEXT_KEY = 0x4
+ BPF_PROG_LOAD = 0x5
+ BPF_OBJ_PIN = 0x6
+ BPF_OBJ_GET = 0x7
+ BPF_PROG_ATTACH = 0x8
+ BPF_PROG_DETACH = 0x9
+ BPF_PROG_TEST_RUN = 0xa
+ BPF_PROG_GET_NEXT_ID = 0xb
+ BPF_MAP_GET_NEXT_ID = 0xc
+ BPF_PROG_GET_FD_BY_ID = 0xd
+ BPF_MAP_GET_FD_BY_ID = 0xe
+ BPF_OBJ_GET_INFO_BY_FD = 0xf
+ BPF_PROG_QUERY = 0x10
+ BPF_RAW_TRACEPOINT_OPEN = 0x11
+ BPF_BTF_LOAD = 0x12
+ BPF_BTF_GET_FD_BY_ID = 0x13
+ BPF_TASK_FD_QUERY = 0x14
+ BPF_MAP_LOOKUP_AND_DELETE_ELEM = 0x15
+ BPF_MAP_FREEZE = 0x16
+ BPF_BTF_GET_NEXT_ID = 0x17
+ BPF_MAP_LOOKUP_BATCH = 0x18
+ BPF_MAP_LOOKUP_AND_DELETE_BATCH = 0x19
+ BPF_MAP_UPDATE_BATCH = 0x1a
+ BPF_MAP_DELETE_BATCH = 0x1b
+ BPF_LINK_CREATE = 0x1c
+ BPF_LINK_UPDATE = 0x1d
+ BPF_LINK_GET_FD_BY_ID = 0x1e
+ BPF_LINK_GET_NEXT_ID = 0x1f
+ BPF_ENABLE_STATS = 0x20
+ BPF_ITER_CREATE = 0x21
+ BPF_LINK_DETACH = 0x22
+ BPF_PROG_BIND_MAP = 0x23
+ BPF_MAP_TYPE_UNSPEC = 0x0
+ BPF_MAP_TYPE_HASH = 0x1
+ BPF_MAP_TYPE_ARRAY = 0x2
+ BPF_MAP_TYPE_PROG_ARRAY = 0x3
+ BPF_MAP_TYPE_PERF_EVENT_ARRAY = 0x4
+ BPF_MAP_TYPE_PERCPU_HASH = 0x5
+ BPF_MAP_TYPE_PERCPU_ARRAY = 0x6
+ BPF_MAP_TYPE_STACK_TRACE = 0x7
+ BPF_MAP_TYPE_CGROUP_ARRAY = 0x8
+ BPF_MAP_TYPE_LRU_HASH = 0x9
+ BPF_MAP_TYPE_LRU_PERCPU_HASH = 0xa
+ BPF_MAP_TYPE_LPM_TRIE = 0xb
+ BPF_MAP_TYPE_ARRAY_OF_MAPS = 0xc
+ BPF_MAP_TYPE_HASH_OF_MAPS = 0xd
+ BPF_MAP_TYPE_DEVMAP = 0xe
+ BPF_MAP_TYPE_SOCKMAP = 0xf
+ BPF_MAP_TYPE_CPUMAP = 0x10
+ BPF_MAP_TYPE_XSKMAP = 0x11
+ BPF_MAP_TYPE_SOCKHASH = 0x12
+ BPF_MAP_TYPE_CGROUP_STORAGE = 0x13
+ BPF_MAP_TYPE_REUSEPORT_SOCKARRAY = 0x14
+ BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE = 0x15
+ BPF_MAP_TYPE_QUEUE = 0x16
+ BPF_MAP_TYPE_STACK = 0x17
+ BPF_MAP_TYPE_SK_STORAGE = 0x18
+ BPF_MAP_TYPE_DEVMAP_HASH = 0x19
+ BPF_MAP_TYPE_STRUCT_OPS = 0x1a
+ BPF_MAP_TYPE_RINGBUF = 0x1b
+ BPF_MAP_TYPE_INODE_STORAGE = 0x1c
+ BPF_PROG_TYPE_UNSPEC = 0x0
+ BPF_PROG_TYPE_SOCKET_FILTER = 0x1
+ BPF_PROG_TYPE_KPROBE = 0x2
+ BPF_PROG_TYPE_SCHED_CLS = 0x3
+ BPF_PROG_TYPE_SCHED_ACT = 0x4
+ BPF_PROG_TYPE_TRACEPOINT = 0x5
+ BPF_PROG_TYPE_XDP = 0x6
+ BPF_PROG_TYPE_PERF_EVENT = 0x7
+ BPF_PROG_TYPE_CGROUP_SKB = 0x8
+ BPF_PROG_TYPE_CGROUP_SOCK = 0x9
+ BPF_PROG_TYPE_LWT_IN = 0xa
+ BPF_PROG_TYPE_LWT_OUT = 0xb
+ BPF_PROG_TYPE_LWT_XMIT = 0xc
+ BPF_PROG_TYPE_SOCK_OPS = 0xd
+ BPF_PROG_TYPE_SK_SKB = 0xe
+ BPF_PROG_TYPE_CGROUP_DEVICE = 0xf
+ BPF_PROG_TYPE_SK_MSG = 0x10
+ BPF_PROG_TYPE_RAW_TRACEPOINT = 0x11
+ BPF_PROG_TYPE_CGROUP_SOCK_ADDR = 0x12
+ BPF_PROG_TYPE_LWT_SEG6LOCAL = 0x13
+ BPF_PROG_TYPE_LIRC_MODE2 = 0x14
+ BPF_PROG_TYPE_SK_REUSEPORT = 0x15
+ BPF_PROG_TYPE_FLOW_DISSECTOR = 0x16
+ BPF_PROG_TYPE_CGROUP_SYSCTL = 0x17
+ BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE = 0x18
+ BPF_PROG_TYPE_CGROUP_SOCKOPT = 0x19
+ BPF_PROG_TYPE_TRACING = 0x1a
+ BPF_PROG_TYPE_STRUCT_OPS = 0x1b
+ BPF_PROG_TYPE_EXT = 0x1c
+ BPF_PROG_TYPE_LSM = 0x1d
+ BPF_PROG_TYPE_SK_LOOKUP = 0x1e
+ BPF_CGROUP_INET_INGRESS = 0x0
+ BPF_CGROUP_INET_EGRESS = 0x1
+ BPF_CGROUP_INET_SOCK_CREATE = 0x2
+ BPF_CGROUP_SOCK_OPS = 0x3
+ BPF_SK_SKB_STREAM_PARSER = 0x4
+ BPF_SK_SKB_STREAM_VERDICT = 0x5
+ BPF_CGROUP_DEVICE = 0x6
+ BPF_SK_MSG_VERDICT = 0x7
+ BPF_CGROUP_INET4_BIND = 0x8
+ BPF_CGROUP_INET6_BIND = 0x9
+ BPF_CGROUP_INET4_CONNECT = 0xa
+ BPF_CGROUP_INET6_CONNECT = 0xb
+ BPF_CGROUP_INET4_POST_BIND = 0xc
+ BPF_CGROUP_INET6_POST_BIND = 0xd
+ BPF_CGROUP_UDP4_SENDMSG = 0xe
+ BPF_CGROUP_UDP6_SENDMSG = 0xf
+ BPF_LIRC_MODE2 = 0x10
+ BPF_FLOW_DISSECTOR = 0x11
+ BPF_CGROUP_SYSCTL = 0x12
+ BPF_CGROUP_UDP4_RECVMSG = 0x13
+ BPF_CGROUP_UDP6_RECVMSG = 0x14
+ BPF_CGROUP_GETSOCKOPT = 0x15
+ BPF_CGROUP_SETSOCKOPT = 0x16
+ BPF_TRACE_RAW_TP = 0x17
+ BPF_TRACE_FENTRY = 0x18
+ BPF_TRACE_FEXIT = 0x19
+ BPF_MODIFY_RETURN = 0x1a
+ BPF_LSM_MAC = 0x1b
+ BPF_TRACE_ITER = 0x1c
+ BPF_CGROUP_INET4_GETPEERNAME = 0x1d
+ BPF_CGROUP_INET6_GETPEERNAME = 0x1e
+ BPF_CGROUP_INET4_GETSOCKNAME = 0x1f
+ BPF_CGROUP_INET6_GETSOCKNAME = 0x20
+ BPF_XDP_DEVMAP = 0x21
+ BPF_CGROUP_INET_SOCK_RELEASE = 0x22
+ BPF_XDP_CPUMAP = 0x23
+ BPF_SK_LOOKUP = 0x24
+ BPF_XDP = 0x25
+ BPF_LINK_TYPE_UNSPEC = 0x0
+ BPF_LINK_TYPE_RAW_TRACEPOINT = 0x1
+ BPF_LINK_TYPE_TRACING = 0x2
+ BPF_LINK_TYPE_CGROUP = 0x3
+ BPF_LINK_TYPE_ITER = 0x4
+ BPF_LINK_TYPE_NETNS = 0x5
+ BPF_LINK_TYPE_XDP = 0x6
+ BPF_ANY = 0x0
+ BPF_NOEXIST = 0x1
+ BPF_EXIST = 0x2
+ BPF_F_LOCK = 0x4
+ BPF_F_NO_PREALLOC = 0x1
+ BPF_F_NO_COMMON_LRU = 0x2
+ BPF_F_NUMA_NODE = 0x4
+ BPF_F_RDONLY = 0x8
+ BPF_F_WRONLY = 0x10
+ BPF_F_STACK_BUILD_ID = 0x20
+ BPF_F_ZERO_SEED = 0x40
+ BPF_F_RDONLY_PROG = 0x80
+ BPF_F_WRONLY_PROG = 0x100
+ BPF_F_CLONE = 0x200
+ BPF_F_MMAPABLE = 0x400
+ BPF_F_PRESERVE_ELEMS = 0x800
+ BPF_F_INNER_MAP = 0x1000
+ BPF_STATS_RUN_TIME = 0x0
+ BPF_STACK_BUILD_ID_EMPTY = 0x0
+ BPF_STACK_BUILD_ID_VALID = 0x1
+ BPF_STACK_BUILD_ID_IP = 0x2
+ BPF_F_RECOMPUTE_CSUM = 0x1
+ BPF_F_INVALIDATE_HASH = 0x2
+ BPF_F_HDR_FIELD_MASK = 0xf
+ BPF_F_PSEUDO_HDR = 0x10
+ BPF_F_MARK_MANGLED_0 = 0x20
+ BPF_F_MARK_ENFORCE = 0x40
+ BPF_F_INGRESS = 0x1
+ BPF_F_TUNINFO_IPV6 = 0x1
+ BPF_F_SKIP_FIELD_MASK = 0xff
+ BPF_F_USER_STACK = 0x100
+ BPF_F_FAST_STACK_CMP = 0x200
+ BPF_F_REUSE_STACKID = 0x400
+ BPF_F_USER_BUILD_ID = 0x800
+ BPF_F_ZERO_CSUM_TX = 0x2
+ BPF_F_DONT_FRAGMENT = 0x4
+ BPF_F_SEQ_NUMBER = 0x8
+ BPF_F_INDEX_MASK = 0xffffffff
+ BPF_F_CURRENT_CPU = 0xffffffff
+ BPF_F_CTXLEN_MASK = 0xfffff00000000
+ BPF_F_CURRENT_NETNS = -0x1
+ BPF_CSUM_LEVEL_QUERY = 0x0
+ BPF_CSUM_LEVEL_INC = 0x1
+ BPF_CSUM_LEVEL_DEC = 0x2
+ BPF_CSUM_LEVEL_RESET = 0x3
+ BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
+ BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
+ BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
+ BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
+ BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
+ BPF_F_ADJ_ROOM_NO_CSUM_RESET = 0x20
+ BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
+ BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
+ BPF_F_SYSCTL_BASE_NAME = 0x1
+ BPF_LOCAL_STORAGE_GET_F_CREATE = 0x1
+ BPF_SK_STORAGE_GET_F_CREATE = 0x1
+ BPF_F_GET_BRANCH_RECORDS_SIZE = 0x1
+ BPF_RB_NO_WAKEUP = 0x1
+ BPF_RB_FORCE_WAKEUP = 0x2
+ BPF_RB_AVAIL_DATA = 0x0
+ BPF_RB_RING_SIZE = 0x1
+ BPF_RB_CONS_POS = 0x2
+ BPF_RB_PROD_POS = 0x3
+ BPF_RINGBUF_BUSY_BIT = 0x80000000
+ BPF_RINGBUF_DISCARD_BIT = 0x40000000
+ BPF_RINGBUF_HDR_SZ = 0x8
+ BPF_SK_LOOKUP_F_REPLACE = 0x1
+ BPF_SK_LOOKUP_F_NO_REUSEPORT = 0x2
+ BPF_ADJ_ROOM_NET = 0x0
+ BPF_ADJ_ROOM_MAC = 0x1
+ BPF_HDR_START_MAC = 0x0
+ BPF_HDR_START_NET = 0x1
+ BPF_LWT_ENCAP_SEG6 = 0x0
+ BPF_LWT_ENCAP_SEG6_INLINE = 0x1
+ BPF_LWT_ENCAP_IP = 0x2
+ BPF_OK = 0x0
+ BPF_DROP = 0x2
+ BPF_REDIRECT = 0x7
+ BPF_LWT_REROUTE = 0x80
+ BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
+ BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
+ BPF_SOCK_OPS_STATE_CB_FLAG = 0x4
+ BPF_SOCK_OPS_RTT_CB_FLAG = 0x8
+ BPF_SOCK_OPS_PARSE_ALL_HDR_OPT_CB_FLAG = 0x10
+ BPF_SOCK_OPS_PARSE_UNKNOWN_HDR_OPT_CB_FLAG = 0x20
+ BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG = 0x40
+ BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7f
+ BPF_SOCK_OPS_VOID = 0x0
+ BPF_SOCK_OPS_TIMEOUT_INIT = 0x1
+ BPF_SOCK_OPS_RWND_INIT = 0x2
+ BPF_SOCK_OPS_TCP_CONNECT_CB = 0x3
+ BPF_SOCK_OPS_ACTIVE_ESTABLISHED_CB = 0x4
+ BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB = 0x5
+ BPF_SOCK_OPS_NEEDS_ECN = 0x6
+ BPF_SOCK_OPS_BASE_RTT = 0x7
+ BPF_SOCK_OPS_RTO_CB = 0x8
+ BPF_SOCK_OPS_RETRANS_CB = 0x9
+ BPF_SOCK_OPS_STATE_CB = 0xa
+ BPF_SOCK_OPS_TCP_LISTEN_CB = 0xb
+ BPF_SOCK_OPS_RTT_CB = 0xc
+ BPF_SOCK_OPS_PARSE_HDR_OPT_CB = 0xd
+ BPF_SOCK_OPS_HDR_OPT_LEN_CB = 0xe
+ BPF_SOCK_OPS_WRITE_HDR_OPT_CB = 0xf
+ BPF_TCP_ESTABLISHED = 0x1
+ BPF_TCP_SYN_SENT = 0x2
+ BPF_TCP_SYN_RECV = 0x3
+ BPF_TCP_FIN_WAIT1 = 0x4
+ BPF_TCP_FIN_WAIT2 = 0x5
+ BPF_TCP_TIME_WAIT = 0x6
+ BPF_TCP_CLOSE = 0x7
+ BPF_TCP_CLOSE_WAIT = 0x8
+ BPF_TCP_LAST_ACK = 0x9
+ BPF_TCP_LISTEN = 0xa
+ BPF_TCP_CLOSING = 0xb
+ BPF_TCP_NEW_SYN_RECV = 0xc
+ BPF_TCP_MAX_STATES = 0xd
+ TCP_BPF_IW = 0x3e9
+ TCP_BPF_SNDCWND_CLAMP = 0x3ea
+ TCP_BPF_DELACK_MAX = 0x3eb
+ TCP_BPF_RTO_MIN = 0x3ec
+ TCP_BPF_SYN = 0x3ed
+ TCP_BPF_SYN_IP = 0x3ee
+ TCP_BPF_SYN_MAC = 0x3ef
+ BPF_LOAD_HDR_OPT_TCP_SYN = 0x1
+ BPF_WRITE_HDR_TCP_CURRENT_MSS = 0x1
+ BPF_WRITE_HDR_TCP_SYNACK_COOKIE = 0x2
+ BPF_DEVCG_ACC_MKNOD = 0x1
+ BPF_DEVCG_ACC_READ = 0x2
+ BPF_DEVCG_ACC_WRITE = 0x4
+ BPF_DEVCG_DEV_BLOCK = 0x1
+ BPF_DEVCG_DEV_CHAR = 0x2
+ BPF_FIB_LOOKUP_DIRECT = 0x1
+ BPF_FIB_LOOKUP_OUTPUT = 0x2
+ BPF_FIB_LKUP_RET_SUCCESS = 0x0
+ BPF_FIB_LKUP_RET_BLACKHOLE = 0x1
+ BPF_FIB_LKUP_RET_UNREACHABLE = 0x2
+ BPF_FIB_LKUP_RET_PROHIBIT = 0x3
+ BPF_FIB_LKUP_RET_NOT_FWDED = 0x4
+ BPF_FIB_LKUP_RET_FWD_DISABLED = 0x5
+ BPF_FIB_LKUP_RET_UNSUPP_LWT = 0x6
+ BPF_FIB_LKUP_RET_NO_NEIGH = 0x7
+ BPF_FIB_LKUP_RET_FRAG_NEEDED = 0x8
+ BPF_FD_TYPE_RAW_TRACEPOINT = 0x0
+ BPF_FD_TYPE_TRACEPOINT = 0x1
+ BPF_FD_TYPE_KPROBE = 0x2
+ BPF_FD_TYPE_KRETPROBE = 0x3
+ BPF_FD_TYPE_UPROBE = 0x4
+ BPF_FD_TYPE_URETPROBE = 0x5
+ BPF_FLOW_DISSECTOR_F_PARSE_1ST_FRAG = 0x1
+ BPF_FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL = 0x2
+ BPF_FLOW_DISSECTOR_F_STOP_AT_ENCAP = 0x4
)
const (
@@ -2681,6 +2719,7 @@ const (
RTNLGRP_IPV4_MROUTE_R = 0x1e
RTNLGRP_IPV6_MROUTE_R = 0x1f
RTNLGRP_NEXTHOP = 0x20
+ RTNLGRP_BRVLAN = 0x21
)
type CapUserHeader struct {
@@ -2775,132 +2814,317 @@ const (
)
const (
- DEVLINK_CMD_UNSPEC = 0x0
- DEVLINK_CMD_GET = 0x1
- DEVLINK_CMD_SET = 0x2
- DEVLINK_CMD_NEW = 0x3
- DEVLINK_CMD_DEL = 0x4
- DEVLINK_CMD_PORT_GET = 0x5
- DEVLINK_CMD_PORT_SET = 0x6
- DEVLINK_CMD_PORT_NEW = 0x7
- DEVLINK_CMD_PORT_DEL = 0x8
- DEVLINK_CMD_PORT_SPLIT = 0x9
- DEVLINK_CMD_PORT_UNSPLIT = 0xa
- DEVLINK_CMD_SB_GET = 0xb
- DEVLINK_CMD_SB_SET = 0xc
- DEVLINK_CMD_SB_NEW = 0xd
- DEVLINK_CMD_SB_DEL = 0xe
- DEVLINK_CMD_SB_POOL_GET = 0xf
- DEVLINK_CMD_SB_POOL_SET = 0x10
- DEVLINK_CMD_SB_POOL_NEW = 0x11
- DEVLINK_CMD_SB_POOL_DEL = 0x12
- DEVLINK_CMD_SB_PORT_POOL_GET = 0x13
- DEVLINK_CMD_SB_PORT_POOL_SET = 0x14
- DEVLINK_CMD_SB_PORT_POOL_NEW = 0x15
- DEVLINK_CMD_SB_PORT_POOL_DEL = 0x16
- DEVLINK_CMD_SB_TC_POOL_BIND_GET = 0x17
- DEVLINK_CMD_SB_TC_POOL_BIND_SET = 0x18
- DEVLINK_CMD_SB_TC_POOL_BIND_NEW = 0x19
- DEVLINK_CMD_SB_TC_POOL_BIND_DEL = 0x1a
- DEVLINK_CMD_SB_OCC_SNAPSHOT = 0x1b
- DEVLINK_CMD_SB_OCC_MAX_CLEAR = 0x1c
- DEVLINK_CMD_ESWITCH_GET = 0x1d
- DEVLINK_CMD_ESWITCH_SET = 0x1e
- DEVLINK_CMD_DPIPE_TABLE_GET = 0x1f
- DEVLINK_CMD_DPIPE_ENTRIES_GET = 0x20
- DEVLINK_CMD_DPIPE_HEADERS_GET = 0x21
- DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET = 0x22
- DEVLINK_CMD_MAX = 0x48
- DEVLINK_PORT_TYPE_NOTSET = 0x0
- DEVLINK_PORT_TYPE_AUTO = 0x1
- DEVLINK_PORT_TYPE_ETH = 0x2
- DEVLINK_PORT_TYPE_IB = 0x3
- DEVLINK_SB_POOL_TYPE_INGRESS = 0x0
- DEVLINK_SB_POOL_TYPE_EGRESS = 0x1
- DEVLINK_SB_THRESHOLD_TYPE_STATIC = 0x0
- DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC = 0x1
- DEVLINK_ESWITCH_MODE_LEGACY = 0x0
- DEVLINK_ESWITCH_MODE_SWITCHDEV = 0x1
- DEVLINK_ESWITCH_INLINE_MODE_NONE = 0x0
- DEVLINK_ESWITCH_INLINE_MODE_LINK = 0x1
- DEVLINK_ESWITCH_INLINE_MODE_NETWORK = 0x2
- DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT = 0x3
- DEVLINK_ESWITCH_ENCAP_MODE_NONE = 0x0
- DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 0x1
- DEVLINK_ATTR_UNSPEC = 0x0
- DEVLINK_ATTR_BUS_NAME = 0x1
- DEVLINK_ATTR_DEV_NAME = 0x2
- DEVLINK_ATTR_PORT_INDEX = 0x3
- DEVLINK_ATTR_PORT_TYPE = 0x4
- DEVLINK_ATTR_PORT_DESIRED_TYPE = 0x5
- DEVLINK_ATTR_PORT_NETDEV_IFINDEX = 0x6
- DEVLINK_ATTR_PORT_NETDEV_NAME = 0x7
- DEVLINK_ATTR_PORT_IBDEV_NAME = 0x8
- DEVLINK_ATTR_PORT_SPLIT_COUNT = 0x9
- DEVLINK_ATTR_PORT_SPLIT_GROUP = 0xa
- DEVLINK_ATTR_SB_INDEX = 0xb
- DEVLINK_ATTR_SB_SIZE = 0xc
- DEVLINK_ATTR_SB_INGRESS_POOL_COUNT = 0xd
- DEVLINK_ATTR_SB_EGRESS_POOL_COUNT = 0xe
- DEVLINK_ATTR_SB_INGRESS_TC_COUNT = 0xf
- DEVLINK_ATTR_SB_EGRESS_TC_COUNT = 0x10
- DEVLINK_ATTR_SB_POOL_INDEX = 0x11
- DEVLINK_ATTR_SB_POOL_TYPE = 0x12
- DEVLINK_ATTR_SB_POOL_SIZE = 0x13
- DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE = 0x14
- DEVLINK_ATTR_SB_THRESHOLD = 0x15
- DEVLINK_ATTR_SB_TC_INDEX = 0x16
- DEVLINK_ATTR_SB_OCC_CUR = 0x17
- DEVLINK_ATTR_SB_OCC_MAX = 0x18
- DEVLINK_ATTR_ESWITCH_MODE = 0x19
- DEVLINK_ATTR_ESWITCH_INLINE_MODE = 0x1a
- DEVLINK_ATTR_DPIPE_TABLES = 0x1b
- DEVLINK_ATTR_DPIPE_TABLE = 0x1c
- DEVLINK_ATTR_DPIPE_TABLE_NAME = 0x1d
- DEVLINK_ATTR_DPIPE_TABLE_SIZE = 0x1e
- DEVLINK_ATTR_DPIPE_TABLE_MATCHES = 0x1f
- DEVLINK_ATTR_DPIPE_TABLE_ACTIONS = 0x20
- DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED = 0x21
- DEVLINK_ATTR_DPIPE_ENTRIES = 0x22
- DEVLINK_ATTR_DPIPE_ENTRY = 0x23
- DEVLINK_ATTR_DPIPE_ENTRY_INDEX = 0x24
- DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES = 0x25
- DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES = 0x26
- DEVLINK_ATTR_DPIPE_ENTRY_COUNTER = 0x27
- DEVLINK_ATTR_DPIPE_MATCH = 0x28
- DEVLINK_ATTR_DPIPE_MATCH_VALUE = 0x29
- DEVLINK_ATTR_DPIPE_MATCH_TYPE = 0x2a
- DEVLINK_ATTR_DPIPE_ACTION = 0x2b
- DEVLINK_ATTR_DPIPE_ACTION_VALUE = 0x2c
- DEVLINK_ATTR_DPIPE_ACTION_TYPE = 0x2d
- DEVLINK_ATTR_DPIPE_VALUE = 0x2e
- DEVLINK_ATTR_DPIPE_VALUE_MASK = 0x2f
- DEVLINK_ATTR_DPIPE_VALUE_MAPPING = 0x30
- DEVLINK_ATTR_DPIPE_HEADERS = 0x31
- DEVLINK_ATTR_DPIPE_HEADER = 0x32
- DEVLINK_ATTR_DPIPE_HEADER_NAME = 0x33
- DEVLINK_ATTR_DPIPE_HEADER_ID = 0x34
- DEVLINK_ATTR_DPIPE_HEADER_FIELDS = 0x35
- DEVLINK_ATTR_DPIPE_HEADER_GLOBAL = 0x36
- DEVLINK_ATTR_DPIPE_HEADER_INDEX = 0x37
- DEVLINK_ATTR_DPIPE_FIELD = 0x38
- DEVLINK_ATTR_DPIPE_FIELD_NAME = 0x39
- DEVLINK_ATTR_DPIPE_FIELD_ID = 0x3a
- DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH = 0x3b
- DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE = 0x3c
- DEVLINK_ATTR_PAD = 0x3d
- DEVLINK_ATTR_ESWITCH_ENCAP_MODE = 0x3e
- DEVLINK_ATTR_MAX = 0x94
- DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0
- DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1
- DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0
- DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY = 0x0
- DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC = 0x0
- DEVLINK_DPIPE_FIELD_IPV4_DST_IP = 0x0
- DEVLINK_DPIPE_FIELD_IPV6_DST_IP = 0x0
- DEVLINK_DPIPE_HEADER_ETHERNET = 0x0
- DEVLINK_DPIPE_HEADER_IPV4 = 0x1
- DEVLINK_DPIPE_HEADER_IPV6 = 0x2
+ DEVLINK_CMD_UNSPEC = 0x0
+ DEVLINK_CMD_GET = 0x1
+ DEVLINK_CMD_SET = 0x2
+ DEVLINK_CMD_NEW = 0x3
+ DEVLINK_CMD_DEL = 0x4
+ DEVLINK_CMD_PORT_GET = 0x5
+ DEVLINK_CMD_PORT_SET = 0x6
+ DEVLINK_CMD_PORT_NEW = 0x7
+ DEVLINK_CMD_PORT_DEL = 0x8
+ DEVLINK_CMD_PORT_SPLIT = 0x9
+ DEVLINK_CMD_PORT_UNSPLIT = 0xa
+ DEVLINK_CMD_SB_GET = 0xb
+ DEVLINK_CMD_SB_SET = 0xc
+ DEVLINK_CMD_SB_NEW = 0xd
+ DEVLINK_CMD_SB_DEL = 0xe
+ DEVLINK_CMD_SB_POOL_GET = 0xf
+ DEVLINK_CMD_SB_POOL_SET = 0x10
+ DEVLINK_CMD_SB_POOL_NEW = 0x11
+ DEVLINK_CMD_SB_POOL_DEL = 0x12
+ DEVLINK_CMD_SB_PORT_POOL_GET = 0x13
+ DEVLINK_CMD_SB_PORT_POOL_SET = 0x14
+ DEVLINK_CMD_SB_PORT_POOL_NEW = 0x15
+ DEVLINK_CMD_SB_PORT_POOL_DEL = 0x16
+ DEVLINK_CMD_SB_TC_POOL_BIND_GET = 0x17
+ DEVLINK_CMD_SB_TC_POOL_BIND_SET = 0x18
+ DEVLINK_CMD_SB_TC_POOL_BIND_NEW = 0x19
+ DEVLINK_CMD_SB_TC_POOL_BIND_DEL = 0x1a
+ DEVLINK_CMD_SB_OCC_SNAPSHOT = 0x1b
+ DEVLINK_CMD_SB_OCC_MAX_CLEAR = 0x1c
+ DEVLINK_CMD_ESWITCH_GET = 0x1d
+ DEVLINK_CMD_ESWITCH_SET = 0x1e
+ DEVLINK_CMD_DPIPE_TABLE_GET = 0x1f
+ DEVLINK_CMD_DPIPE_ENTRIES_GET = 0x20
+ DEVLINK_CMD_DPIPE_HEADERS_GET = 0x21
+ DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET = 0x22
+ DEVLINK_CMD_RESOURCE_SET = 0x23
+ DEVLINK_CMD_RESOURCE_DUMP = 0x24
+ DEVLINK_CMD_RELOAD = 0x25
+ DEVLINK_CMD_PARAM_GET = 0x26
+ DEVLINK_CMD_PARAM_SET = 0x27
+ DEVLINK_CMD_PARAM_NEW = 0x28
+ DEVLINK_CMD_PARAM_DEL = 0x29
+ DEVLINK_CMD_REGION_GET = 0x2a
+ DEVLINK_CMD_REGION_SET = 0x2b
+ DEVLINK_CMD_REGION_NEW = 0x2c
+ DEVLINK_CMD_REGION_DEL = 0x2d
+ DEVLINK_CMD_REGION_READ = 0x2e
+ DEVLINK_CMD_PORT_PARAM_GET = 0x2f
+ DEVLINK_CMD_PORT_PARAM_SET = 0x30
+ DEVLINK_CMD_PORT_PARAM_NEW = 0x31
+ DEVLINK_CMD_PORT_PARAM_DEL = 0x32
+ DEVLINK_CMD_INFO_GET = 0x33
+ DEVLINK_CMD_HEALTH_REPORTER_GET = 0x34
+ DEVLINK_CMD_HEALTH_REPORTER_SET = 0x35
+ DEVLINK_CMD_HEALTH_REPORTER_RECOVER = 0x36
+ DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE = 0x37
+ DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET = 0x38
+ DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR = 0x39
+ DEVLINK_CMD_FLASH_UPDATE = 0x3a
+ DEVLINK_CMD_FLASH_UPDATE_END = 0x3b
+ DEVLINK_CMD_FLASH_UPDATE_STATUS = 0x3c
+ DEVLINK_CMD_TRAP_GET = 0x3d
+ DEVLINK_CMD_TRAP_SET = 0x3e
+ DEVLINK_CMD_TRAP_NEW = 0x3f
+ DEVLINK_CMD_TRAP_DEL = 0x40
+ DEVLINK_CMD_TRAP_GROUP_GET = 0x41
+ DEVLINK_CMD_TRAP_GROUP_SET = 0x42
+ DEVLINK_CMD_TRAP_GROUP_NEW = 0x43
+ DEVLINK_CMD_TRAP_GROUP_DEL = 0x44
+ DEVLINK_CMD_TRAP_POLICER_GET = 0x45
+ DEVLINK_CMD_TRAP_POLICER_SET = 0x46
+ DEVLINK_CMD_TRAP_POLICER_NEW = 0x47
+ DEVLINK_CMD_TRAP_POLICER_DEL = 0x48
+ DEVLINK_CMD_HEALTH_REPORTER_TEST = 0x49
+ DEVLINK_CMD_MAX = 0x49
+ DEVLINK_PORT_TYPE_NOTSET = 0x0
+ DEVLINK_PORT_TYPE_AUTO = 0x1
+ DEVLINK_PORT_TYPE_ETH = 0x2
+ DEVLINK_PORT_TYPE_IB = 0x3
+ DEVLINK_SB_POOL_TYPE_INGRESS = 0x0
+ DEVLINK_SB_POOL_TYPE_EGRESS = 0x1
+ DEVLINK_SB_THRESHOLD_TYPE_STATIC = 0x0
+ DEVLINK_SB_THRESHOLD_TYPE_DYNAMIC = 0x1
+ DEVLINK_ESWITCH_MODE_LEGACY = 0x0
+ DEVLINK_ESWITCH_MODE_SWITCHDEV = 0x1
+ DEVLINK_ESWITCH_INLINE_MODE_NONE = 0x0
+ DEVLINK_ESWITCH_INLINE_MODE_LINK = 0x1
+ DEVLINK_ESWITCH_INLINE_MODE_NETWORK = 0x2
+ DEVLINK_ESWITCH_INLINE_MODE_TRANSPORT = 0x3
+ DEVLINK_ESWITCH_ENCAP_MODE_NONE = 0x0
+ DEVLINK_ESWITCH_ENCAP_MODE_BASIC = 0x1
+ DEVLINK_PORT_FLAVOUR_PHYSICAL = 0x0
+ DEVLINK_PORT_FLAVOUR_CPU = 0x1
+ DEVLINK_PORT_FLAVOUR_DSA = 0x2
+ DEVLINK_PORT_FLAVOUR_PCI_PF = 0x3
+ DEVLINK_PORT_FLAVOUR_PCI_VF = 0x4
+ DEVLINK_PORT_FLAVOUR_VIRTUAL = 0x5
+ DEVLINK_PORT_FLAVOUR_UNUSED = 0x6
+ DEVLINK_PARAM_CMODE_RUNTIME = 0x0
+ DEVLINK_PARAM_CMODE_DRIVERINIT = 0x1
+ DEVLINK_PARAM_CMODE_PERMANENT = 0x2
+ DEVLINK_PARAM_CMODE_MAX = 0x2
+ DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DRIVER = 0x0
+ DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_FLASH = 0x1
+ DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_DISK = 0x2
+ DEVLINK_PARAM_FW_LOAD_POLICY_VALUE_UNKNOWN = 0x3
+ DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_UNKNOWN = 0x0
+ DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_ALWAYS = 0x1
+ DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_NEVER = 0x2
+ DEVLINK_PARAM_RESET_DEV_ON_DRV_PROBE_VALUE_DISK = 0x3
+ DEVLINK_ATTR_STATS_RX_PACKETS = 0x0
+ DEVLINK_ATTR_STATS_RX_BYTES = 0x1
+ DEVLINK_ATTR_STATS_RX_DROPPED = 0x2
+ DEVLINK_ATTR_STATS_MAX = 0x2
+ DEVLINK_FLASH_OVERWRITE_SETTINGS_BIT = 0x0
+ DEVLINK_FLASH_OVERWRITE_IDENTIFIERS_BIT = 0x1
+ DEVLINK_FLASH_OVERWRITE_MAX_BIT = 0x1
+ DEVLINK_TRAP_ACTION_DROP = 0x0
+ DEVLINK_TRAP_ACTION_TRAP = 0x1
+ DEVLINK_TRAP_ACTION_MIRROR = 0x2
+ DEVLINK_TRAP_TYPE_DROP = 0x0
+ DEVLINK_TRAP_TYPE_EXCEPTION = 0x1
+ DEVLINK_TRAP_TYPE_CONTROL = 0x2
+ DEVLINK_ATTR_TRAP_METADATA_TYPE_IN_PORT = 0x0
+ DEVLINK_ATTR_TRAP_METADATA_TYPE_FA_COOKIE = 0x1
+ DEVLINK_RELOAD_ACTION_UNSPEC = 0x0
+ DEVLINK_RELOAD_ACTION_DRIVER_REINIT = 0x1
+ DEVLINK_RELOAD_ACTION_FW_ACTIVATE = 0x2
+ DEVLINK_RELOAD_ACTION_MAX = 0x2
+ DEVLINK_RELOAD_LIMIT_UNSPEC = 0x0
+ DEVLINK_RELOAD_LIMIT_NO_RESET = 0x1
+ DEVLINK_RELOAD_LIMIT_MAX = 0x1
+ DEVLINK_ATTR_UNSPEC = 0x0
+ DEVLINK_ATTR_BUS_NAME = 0x1
+ DEVLINK_ATTR_DEV_NAME = 0x2
+ DEVLINK_ATTR_PORT_INDEX = 0x3
+ DEVLINK_ATTR_PORT_TYPE = 0x4
+ DEVLINK_ATTR_PORT_DESIRED_TYPE = 0x5
+ DEVLINK_ATTR_PORT_NETDEV_IFINDEX = 0x6
+ DEVLINK_ATTR_PORT_NETDEV_NAME = 0x7
+ DEVLINK_ATTR_PORT_IBDEV_NAME = 0x8
+ DEVLINK_ATTR_PORT_SPLIT_COUNT = 0x9
+ DEVLINK_ATTR_PORT_SPLIT_GROUP = 0xa
+ DEVLINK_ATTR_SB_INDEX = 0xb
+ DEVLINK_ATTR_SB_SIZE = 0xc
+ DEVLINK_ATTR_SB_INGRESS_POOL_COUNT = 0xd
+ DEVLINK_ATTR_SB_EGRESS_POOL_COUNT = 0xe
+ DEVLINK_ATTR_SB_INGRESS_TC_COUNT = 0xf
+ DEVLINK_ATTR_SB_EGRESS_TC_COUNT = 0x10
+ DEVLINK_ATTR_SB_POOL_INDEX = 0x11
+ DEVLINK_ATTR_SB_POOL_TYPE = 0x12
+ DEVLINK_ATTR_SB_POOL_SIZE = 0x13
+ DEVLINK_ATTR_SB_POOL_THRESHOLD_TYPE = 0x14
+ DEVLINK_ATTR_SB_THRESHOLD = 0x15
+ DEVLINK_ATTR_SB_TC_INDEX = 0x16
+ DEVLINK_ATTR_SB_OCC_CUR = 0x17
+ DEVLINK_ATTR_SB_OCC_MAX = 0x18
+ DEVLINK_ATTR_ESWITCH_MODE = 0x19
+ DEVLINK_ATTR_ESWITCH_INLINE_MODE = 0x1a
+ DEVLINK_ATTR_DPIPE_TABLES = 0x1b
+ DEVLINK_ATTR_DPIPE_TABLE = 0x1c
+ DEVLINK_ATTR_DPIPE_TABLE_NAME = 0x1d
+ DEVLINK_ATTR_DPIPE_TABLE_SIZE = 0x1e
+ DEVLINK_ATTR_DPIPE_TABLE_MATCHES = 0x1f
+ DEVLINK_ATTR_DPIPE_TABLE_ACTIONS = 0x20
+ DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED = 0x21
+ DEVLINK_ATTR_DPIPE_ENTRIES = 0x22
+ DEVLINK_ATTR_DPIPE_ENTRY = 0x23
+ DEVLINK_ATTR_DPIPE_ENTRY_INDEX = 0x24
+ DEVLINK_ATTR_DPIPE_ENTRY_MATCH_VALUES = 0x25
+ DEVLINK_ATTR_DPIPE_ENTRY_ACTION_VALUES = 0x26
+ DEVLINK_ATTR_DPIPE_ENTRY_COUNTER = 0x27
+ DEVLINK_ATTR_DPIPE_MATCH = 0x28
+ DEVLINK_ATTR_DPIPE_MATCH_VALUE = 0x29
+ DEVLINK_ATTR_DPIPE_MATCH_TYPE = 0x2a
+ DEVLINK_ATTR_DPIPE_ACTION = 0x2b
+ DEVLINK_ATTR_DPIPE_ACTION_VALUE = 0x2c
+ DEVLINK_ATTR_DPIPE_ACTION_TYPE = 0x2d
+ DEVLINK_ATTR_DPIPE_VALUE = 0x2e
+ DEVLINK_ATTR_DPIPE_VALUE_MASK = 0x2f
+ DEVLINK_ATTR_DPIPE_VALUE_MAPPING = 0x30
+ DEVLINK_ATTR_DPIPE_HEADERS = 0x31
+ DEVLINK_ATTR_DPIPE_HEADER = 0x32
+ DEVLINK_ATTR_DPIPE_HEADER_NAME = 0x33
+ DEVLINK_ATTR_DPIPE_HEADER_ID = 0x34
+ DEVLINK_ATTR_DPIPE_HEADER_FIELDS = 0x35
+ DEVLINK_ATTR_DPIPE_HEADER_GLOBAL = 0x36
+ DEVLINK_ATTR_DPIPE_HEADER_INDEX = 0x37
+ DEVLINK_ATTR_DPIPE_FIELD = 0x38
+ DEVLINK_ATTR_DPIPE_FIELD_NAME = 0x39
+ DEVLINK_ATTR_DPIPE_FIELD_ID = 0x3a
+ DEVLINK_ATTR_DPIPE_FIELD_BITWIDTH = 0x3b
+ DEVLINK_ATTR_DPIPE_FIELD_MAPPING_TYPE = 0x3c
+ DEVLINK_ATTR_PAD = 0x3d
+ DEVLINK_ATTR_ESWITCH_ENCAP_MODE = 0x3e
+ DEVLINK_ATTR_RESOURCE_LIST = 0x3f
+ DEVLINK_ATTR_RESOURCE = 0x40
+ DEVLINK_ATTR_RESOURCE_NAME = 0x41
+ DEVLINK_ATTR_RESOURCE_ID = 0x42
+ DEVLINK_ATTR_RESOURCE_SIZE = 0x43
+ DEVLINK_ATTR_RESOURCE_SIZE_NEW = 0x44
+ DEVLINK_ATTR_RESOURCE_SIZE_VALID = 0x45
+ DEVLINK_ATTR_RESOURCE_SIZE_MIN = 0x46
+ DEVLINK_ATTR_RESOURCE_SIZE_MAX = 0x47
+ DEVLINK_ATTR_RESOURCE_SIZE_GRAN = 0x48
+ DEVLINK_ATTR_RESOURCE_UNIT = 0x49
+ DEVLINK_ATTR_RESOURCE_OCC = 0x4a
+ DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID = 0x4b
+ DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS = 0x4c
+ DEVLINK_ATTR_PORT_FLAVOUR = 0x4d
+ DEVLINK_ATTR_PORT_NUMBER = 0x4e
+ DEVLINK_ATTR_PORT_SPLIT_SUBPORT_NUMBER = 0x4f
+ DEVLINK_ATTR_PARAM = 0x50
+ DEVLINK_ATTR_PARAM_NAME = 0x51
+ DEVLINK_ATTR_PARAM_GENERIC = 0x52
+ DEVLINK_ATTR_PARAM_TYPE = 0x53
+ DEVLINK_ATTR_PARAM_VALUES_LIST = 0x54
+ DEVLINK_ATTR_PARAM_VALUE = 0x55
+ DEVLINK_ATTR_PARAM_VALUE_DATA = 0x56
+ DEVLINK_ATTR_PARAM_VALUE_CMODE = 0x57
+ DEVLINK_ATTR_REGION_NAME = 0x58
+ DEVLINK_ATTR_REGION_SIZE = 0x59
+ DEVLINK_ATTR_REGION_SNAPSHOTS = 0x5a
+ DEVLINK_ATTR_REGION_SNAPSHOT = 0x5b
+ DEVLINK_ATTR_REGION_SNAPSHOT_ID = 0x5c
+ DEVLINK_ATTR_REGION_CHUNKS = 0x5d
+ DEVLINK_ATTR_REGION_CHUNK = 0x5e
+ DEVLINK_ATTR_REGION_CHUNK_DATA = 0x5f
+ DEVLINK_ATTR_REGION_CHUNK_ADDR = 0x60
+ DEVLINK_ATTR_REGION_CHUNK_LEN = 0x61
+ DEVLINK_ATTR_INFO_DRIVER_NAME = 0x62
+ DEVLINK_ATTR_INFO_SERIAL_NUMBER = 0x63
+ DEVLINK_ATTR_INFO_VERSION_FIXED = 0x64
+ DEVLINK_ATTR_INFO_VERSION_RUNNING = 0x65
+ DEVLINK_ATTR_INFO_VERSION_STORED = 0x66
+ DEVLINK_ATTR_INFO_VERSION_NAME = 0x67
+ DEVLINK_ATTR_INFO_VERSION_VALUE = 0x68
+ DEVLINK_ATTR_SB_POOL_CELL_SIZE = 0x69
+ DEVLINK_ATTR_FMSG = 0x6a
+ DEVLINK_ATTR_FMSG_OBJ_NEST_START = 0x6b
+ DEVLINK_ATTR_FMSG_PAIR_NEST_START = 0x6c
+ DEVLINK_ATTR_FMSG_ARR_NEST_START = 0x6d
+ DEVLINK_ATTR_FMSG_NEST_END = 0x6e
+ DEVLINK_ATTR_FMSG_OBJ_NAME = 0x6f
+ DEVLINK_ATTR_FMSG_OBJ_VALUE_TYPE = 0x70
+ DEVLINK_ATTR_FMSG_OBJ_VALUE_DATA = 0x71
+ DEVLINK_ATTR_HEALTH_REPORTER = 0x72
+ DEVLINK_ATTR_HEALTH_REPORTER_NAME = 0x73
+ DEVLINK_ATTR_HEALTH_REPORTER_STATE = 0x74
+ DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT = 0x75
+ DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT = 0x76
+ DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS = 0x77
+ DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD = 0x78
+ DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER = 0x79
+ DEVLINK_ATTR_FLASH_UPDATE_FILE_NAME = 0x7a
+ DEVLINK_ATTR_FLASH_UPDATE_COMPONENT = 0x7b
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_MSG = 0x7c
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE = 0x7d
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL = 0x7e
+ DEVLINK_ATTR_PORT_PCI_PF_NUMBER = 0x7f
+ DEVLINK_ATTR_PORT_PCI_VF_NUMBER = 0x80
+ DEVLINK_ATTR_STATS = 0x81
+ DEVLINK_ATTR_TRAP_NAME = 0x82
+ DEVLINK_ATTR_TRAP_ACTION = 0x83
+ DEVLINK_ATTR_TRAP_TYPE = 0x84
+ DEVLINK_ATTR_TRAP_GENERIC = 0x85
+ DEVLINK_ATTR_TRAP_METADATA = 0x86
+ DEVLINK_ATTR_TRAP_GROUP_NAME = 0x87
+ DEVLINK_ATTR_RELOAD_FAILED = 0x88
+ DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS = 0x89
+ DEVLINK_ATTR_NETNS_FD = 0x8a
+ DEVLINK_ATTR_NETNS_PID = 0x8b
+ DEVLINK_ATTR_NETNS_ID = 0x8c
+ DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP = 0x8d
+ DEVLINK_ATTR_TRAP_POLICER_ID = 0x8e
+ DEVLINK_ATTR_TRAP_POLICER_RATE = 0x8f
+ DEVLINK_ATTR_TRAP_POLICER_BURST = 0x90
+ DEVLINK_ATTR_PORT_FUNCTION = 0x91
+ DEVLINK_ATTR_INFO_BOARD_SERIAL_NUMBER = 0x92
+ DEVLINK_ATTR_PORT_LANES = 0x93
+ DEVLINK_ATTR_PORT_SPLITTABLE = 0x94
+ DEVLINK_ATTR_PORT_EXTERNAL = 0x95
+ DEVLINK_ATTR_PORT_CONTROLLER_NUMBER = 0x96
+ DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT = 0x97
+ DEVLINK_ATTR_FLASH_UPDATE_OVERWRITE_MASK = 0x98
+ DEVLINK_ATTR_RELOAD_ACTION = 0x99
+ DEVLINK_ATTR_RELOAD_ACTIONS_PERFORMED = 0x9a
+ DEVLINK_ATTR_RELOAD_LIMITS = 0x9b
+ DEVLINK_ATTR_DEV_STATS = 0x9c
+ DEVLINK_ATTR_RELOAD_STATS = 0x9d
+ DEVLINK_ATTR_RELOAD_STATS_ENTRY = 0x9e
+ DEVLINK_ATTR_RELOAD_STATS_LIMIT = 0x9f
+ DEVLINK_ATTR_RELOAD_STATS_VALUE = 0xa0
+ DEVLINK_ATTR_REMOTE_RELOAD_STATS = 0xa1
+ DEVLINK_ATTR_RELOAD_ACTION_INFO = 0xa2
+ DEVLINK_ATTR_RELOAD_ACTION_STATS = 0xa3
+ DEVLINK_ATTR_MAX = 0xa3
+ DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0
+ DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1
+ DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0
+ DEVLINK_DPIPE_ACTION_TYPE_FIELD_MODIFY = 0x0
+ DEVLINK_DPIPE_FIELD_ETHERNET_DST_MAC = 0x0
+ DEVLINK_DPIPE_FIELD_IPV4_DST_IP = 0x0
+ DEVLINK_DPIPE_FIELD_IPV6_DST_IP = 0x0
+ DEVLINK_DPIPE_HEADER_ETHERNET = 0x0
+ DEVLINK_DPIPE_HEADER_IPV4 = 0x1
+ DEVLINK_DPIPE_HEADER_IPV6 = 0x2
+ DEVLINK_RESOURCE_UNIT_ENTRY = 0x0
+ DEVLINK_PORT_FUNCTION_ATTR_UNSPEC = 0x0
+ DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR = 0x1
+ DEVLINK_PORT_FUNCTION_ATTR_MAX = 0x1
)
type FsverityDigest struct {
@@ -2999,3 +3223,461 @@ const (
MPLS_IPTUNNEL_TTL = 0x2
MPLS_IPTUNNEL_MAX = 0x2
)
+
+const (
+ ETHTOOL_ID_UNSPEC = 0x0
+ ETHTOOL_RX_COPYBREAK = 0x1
+ ETHTOOL_TX_COPYBREAK = 0x2
+ ETHTOOL_PFC_PREVENTION_TOUT = 0x3
+ ETHTOOL_TUNABLE_UNSPEC = 0x0
+ ETHTOOL_TUNABLE_U8 = 0x1
+ ETHTOOL_TUNABLE_U16 = 0x2
+ ETHTOOL_TUNABLE_U32 = 0x3
+ ETHTOOL_TUNABLE_U64 = 0x4
+ ETHTOOL_TUNABLE_STRING = 0x5
+ ETHTOOL_TUNABLE_S8 = 0x6
+ ETHTOOL_TUNABLE_S16 = 0x7
+ ETHTOOL_TUNABLE_S32 = 0x8
+ ETHTOOL_TUNABLE_S64 = 0x9
+ ETHTOOL_PHY_ID_UNSPEC = 0x0
+ ETHTOOL_PHY_DOWNSHIFT = 0x1
+ ETHTOOL_PHY_FAST_LINK_DOWN = 0x2
+ ETHTOOL_PHY_EDPD = 0x3
+ ETHTOOL_LINK_EXT_STATE_AUTONEG = 0x0
+ ETHTOOL_LINK_EXT_STATE_LINK_TRAINING_FAILURE = 0x1
+ ETHTOOL_LINK_EXT_STATE_LINK_LOGICAL_MISMATCH = 0x2
+ ETHTOOL_LINK_EXT_STATE_BAD_SIGNAL_INTEGRITY = 0x3
+ ETHTOOL_LINK_EXT_STATE_NO_CABLE = 0x4
+ ETHTOOL_LINK_EXT_STATE_CABLE_ISSUE = 0x5
+ ETHTOOL_LINK_EXT_STATE_EEPROM_ISSUE = 0x6
+ ETHTOOL_LINK_EXT_STATE_CALIBRATION_FAILURE = 0x7
+ ETHTOOL_LINK_EXT_STATE_POWER_BUDGET_EXCEEDED = 0x8
+ ETHTOOL_LINK_EXT_STATE_OVERHEAT = 0x9
+ ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED = 0x1
+ ETHTOOL_LINK_EXT_SUBSTATE_AN_ACK_NOT_RECEIVED = 0x2
+ ETHTOOL_LINK_EXT_SUBSTATE_AN_NEXT_PAGE_EXCHANGE_FAILED = 0x3
+ ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_PARTNER_DETECTED_FORCE_MODE = 0x4
+ ETHTOOL_LINK_EXT_SUBSTATE_AN_FEC_MISMATCH_DURING_OVERRIDE = 0x5
+ ETHTOOL_LINK_EXT_SUBSTATE_AN_NO_HCD = 0x6
+ ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_FRAME_LOCK_NOT_ACQUIRED = 0x1
+ ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_INHIBIT_TIMEOUT = 0x2
+ ETHTOOL_LINK_EXT_SUBSTATE_LT_KR_LINK_PARTNER_DID_NOT_SET_RECEIVER_READY = 0x3
+ ETHTOOL_LINK_EXT_SUBSTATE_LT_REMOTE_FAULT = 0x4
+ ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_BLOCK_LOCK = 0x1
+ ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_ACQUIRE_AM_LOCK = 0x2
+ ETHTOOL_LINK_EXT_SUBSTATE_LLM_PCS_DID_NOT_GET_ALIGN_STATUS = 0x3
+ ETHTOOL_LINK_EXT_SUBSTATE_LLM_FC_FEC_IS_NOT_LOCKED = 0x4
+ ETHTOOL_LINK_EXT_SUBSTATE_LLM_RS_FEC_IS_NOT_LOCKED = 0x5
+ ETHTOOL_LINK_EXT_SUBSTATE_BSI_LARGE_NUMBER_OF_PHYSICAL_ERRORS = 0x1
+ ETHTOOL_LINK_EXT_SUBSTATE_BSI_UNSUPPORTED_RATE = 0x2
+ ETHTOOL_LINK_EXT_SUBSTATE_CI_UNSUPPORTED_CABLE = 0x1
+ ETHTOOL_LINK_EXT_SUBSTATE_CI_CABLE_TEST_FAILURE = 0x2
+ ETHTOOL_FLASH_ALL_REGIONS = 0x0
+ ETHTOOL_F_UNSUPPORTED__BIT = 0x0
+ ETHTOOL_F_WISH__BIT = 0x1
+ ETHTOOL_F_COMPAT__BIT = 0x2
+ ETHTOOL_FEC_NONE_BIT = 0x0
+ ETHTOOL_FEC_AUTO_BIT = 0x1
+ ETHTOOL_FEC_OFF_BIT = 0x2
+ ETHTOOL_FEC_RS_BIT = 0x3
+ ETHTOOL_FEC_BASER_BIT = 0x4
+ ETHTOOL_FEC_LLRS_BIT = 0x5
+ ETHTOOL_LINK_MODE_10baseT_Half_BIT = 0x0
+ ETHTOOL_LINK_MODE_10baseT_Full_BIT = 0x1
+ ETHTOOL_LINK_MODE_100baseT_Half_BIT = 0x2
+ ETHTOOL_LINK_MODE_100baseT_Full_BIT = 0x3
+ ETHTOOL_LINK_MODE_1000baseT_Half_BIT = 0x4
+ ETHTOOL_LINK_MODE_1000baseT_Full_BIT = 0x5
+ ETHTOOL_LINK_MODE_Autoneg_BIT = 0x6
+ ETHTOOL_LINK_MODE_TP_BIT = 0x7
+ ETHTOOL_LINK_MODE_AUI_BIT = 0x8
+ ETHTOOL_LINK_MODE_MII_BIT = 0x9
+ ETHTOOL_LINK_MODE_FIBRE_BIT = 0xa
+ ETHTOOL_LINK_MODE_BNC_BIT = 0xb
+ ETHTOOL_LINK_MODE_10000baseT_Full_BIT = 0xc
+ ETHTOOL_LINK_MODE_Pause_BIT = 0xd
+ ETHTOOL_LINK_MODE_Asym_Pause_BIT = 0xe
+ ETHTOOL_LINK_MODE_2500baseX_Full_BIT = 0xf
+ ETHTOOL_LINK_MODE_Backplane_BIT = 0x10
+ ETHTOOL_LINK_MODE_1000baseKX_Full_BIT = 0x11
+ ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT = 0x12
+ ETHTOOL_LINK_MODE_10000baseKR_Full_BIT = 0x13
+ ETHTOOL_LINK_MODE_10000baseR_FEC_BIT = 0x14
+ ETHTOOL_LINK_MODE_20000baseMLD2_Full_BIT = 0x15
+ ETHTOOL_LINK_MODE_20000baseKR2_Full_BIT = 0x16
+ ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT = 0x17
+ ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT = 0x18
+ ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT = 0x19
+ ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT = 0x1a
+ ETHTOOL_LINK_MODE_56000baseKR4_Full_BIT = 0x1b
+ ETHTOOL_LINK_MODE_56000baseCR4_Full_BIT = 0x1c
+ ETHTOOL_LINK_MODE_56000baseSR4_Full_BIT = 0x1d
+ ETHTOOL_LINK_MODE_56000baseLR4_Full_BIT = 0x1e
+ ETHTOOL_LINK_MODE_25000baseCR_Full_BIT = 0x1f
+ ETHTOOL_LINK_MODE_25000baseKR_Full_BIT = 0x20
+ ETHTOOL_LINK_MODE_25000baseSR_Full_BIT = 0x21
+ ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT = 0x22
+ ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT = 0x23
+ ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT = 0x24
+ ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT = 0x25
+ ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT = 0x26
+ ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT = 0x27
+ ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT = 0x28
+ ETHTOOL_LINK_MODE_1000baseX_Full_BIT = 0x29
+ ETHTOOL_LINK_MODE_10000baseCR_Full_BIT = 0x2a
+ ETHTOOL_LINK_MODE_10000baseSR_Full_BIT = 0x2b
+ ETHTOOL_LINK_MODE_10000baseLR_Full_BIT = 0x2c
+ ETHTOOL_LINK_MODE_10000baseLRM_Full_BIT = 0x2d
+ ETHTOOL_LINK_MODE_10000baseER_Full_BIT = 0x2e
+ ETHTOOL_LINK_MODE_2500baseT_Full_BIT = 0x2f
+ ETHTOOL_LINK_MODE_5000baseT_Full_BIT = 0x30
+ ETHTOOL_LINK_MODE_FEC_NONE_BIT = 0x31
+ ETHTOOL_LINK_MODE_FEC_RS_BIT = 0x32
+ ETHTOOL_LINK_MODE_FEC_BASER_BIT = 0x33
+ ETHTOOL_LINK_MODE_50000baseKR_Full_BIT = 0x34
+ ETHTOOL_LINK_MODE_50000baseSR_Full_BIT = 0x35
+ ETHTOOL_LINK_MODE_50000baseCR_Full_BIT = 0x36
+ ETHTOOL_LINK_MODE_50000baseLR_ER_FR_Full_BIT = 0x37
+ ETHTOOL_LINK_MODE_50000baseDR_Full_BIT = 0x38
+ ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT = 0x39
+ ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT = 0x3a
+ ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT = 0x3b
+ ETHTOOL_LINK_MODE_100000baseLR2_ER2_FR2_Full_BIT = 0x3c
+ ETHTOOL_LINK_MODE_100000baseDR2_Full_BIT = 0x3d
+ ETHTOOL_LINK_MODE_200000baseKR4_Full_BIT = 0x3e
+ ETHTOOL_LINK_MODE_200000baseSR4_Full_BIT = 0x3f
+ ETHTOOL_LINK_MODE_200000baseLR4_ER4_FR4_Full_BIT = 0x40
+ ETHTOOL_LINK_MODE_200000baseDR4_Full_BIT = 0x41
+ ETHTOOL_LINK_MODE_200000baseCR4_Full_BIT = 0x42
+ ETHTOOL_LINK_MODE_100baseT1_Full_BIT = 0x43
+ ETHTOOL_LINK_MODE_1000baseT1_Full_BIT = 0x44
+ ETHTOOL_LINK_MODE_400000baseKR8_Full_BIT = 0x45
+ ETHTOOL_LINK_MODE_400000baseSR8_Full_BIT = 0x46
+ ETHTOOL_LINK_MODE_400000baseLR8_ER8_FR8_Full_BIT = 0x47
+ ETHTOOL_LINK_MODE_400000baseDR8_Full_BIT = 0x48
+ ETHTOOL_LINK_MODE_400000baseCR8_Full_BIT = 0x49
+ ETHTOOL_LINK_MODE_FEC_LLRS_BIT = 0x4a
+ ETHTOOL_LINK_MODE_100000baseKR_Full_BIT = 0x4b
+ ETHTOOL_LINK_MODE_100000baseSR_Full_BIT = 0x4c
+ ETHTOOL_LINK_MODE_100000baseLR_ER_FR_Full_BIT = 0x4d
+ ETHTOOL_LINK_MODE_100000baseCR_Full_BIT = 0x4e
+ ETHTOOL_LINK_MODE_100000baseDR_Full_BIT = 0x4f
+ ETHTOOL_LINK_MODE_200000baseKR2_Full_BIT = 0x50
+ ETHTOOL_LINK_MODE_200000baseSR2_Full_BIT = 0x51
+ ETHTOOL_LINK_MODE_200000baseLR2_ER2_FR2_Full_BIT = 0x52
+ ETHTOOL_LINK_MODE_200000baseDR2_Full_BIT = 0x53
+ ETHTOOL_LINK_MODE_200000baseCR2_Full_BIT = 0x54
+ ETHTOOL_LINK_MODE_400000baseKR4_Full_BIT = 0x55
+ ETHTOOL_LINK_MODE_400000baseSR4_Full_BIT = 0x56
+ ETHTOOL_LINK_MODE_400000baseLR4_ER4_FR4_Full_BIT = 0x57
+ ETHTOOL_LINK_MODE_400000baseDR4_Full_BIT = 0x58
+ ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT = 0x59
+ ETHTOOL_LINK_MODE_100baseFX_Half_BIT = 0x5a
+ ETHTOOL_LINK_MODE_100baseFX_Full_BIT = 0x5b
+
+ ETHTOOL_MSG_USER_NONE = 0x0
+ ETHTOOL_MSG_STRSET_GET = 0x1
+ ETHTOOL_MSG_LINKINFO_GET = 0x2
+ ETHTOOL_MSG_LINKINFO_SET = 0x3
+ ETHTOOL_MSG_LINKMODES_GET = 0x4
+ ETHTOOL_MSG_LINKMODES_SET = 0x5
+ ETHTOOL_MSG_LINKSTATE_GET = 0x6
+ ETHTOOL_MSG_DEBUG_GET = 0x7
+ ETHTOOL_MSG_DEBUG_SET = 0x8
+ ETHTOOL_MSG_WOL_GET = 0x9
+ ETHTOOL_MSG_WOL_SET = 0xa
+ ETHTOOL_MSG_FEATURES_GET = 0xb
+ ETHTOOL_MSG_FEATURES_SET = 0xc
+ ETHTOOL_MSG_PRIVFLAGS_GET = 0xd
+ ETHTOOL_MSG_PRIVFLAGS_SET = 0xe
+ ETHTOOL_MSG_RINGS_GET = 0xf
+ ETHTOOL_MSG_RINGS_SET = 0x10
+ ETHTOOL_MSG_CHANNELS_GET = 0x11
+ ETHTOOL_MSG_CHANNELS_SET = 0x12
+ ETHTOOL_MSG_COALESCE_GET = 0x13
+ ETHTOOL_MSG_COALESCE_SET = 0x14
+ ETHTOOL_MSG_PAUSE_GET = 0x15
+ ETHTOOL_MSG_PAUSE_SET = 0x16
+ ETHTOOL_MSG_EEE_GET = 0x17
+ ETHTOOL_MSG_EEE_SET = 0x18
+ ETHTOOL_MSG_TSINFO_GET = 0x19
+ ETHTOOL_MSG_CABLE_TEST_ACT = 0x1a
+ ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 0x1b
+ ETHTOOL_MSG_TUNNEL_INFO_GET = 0x1c
+ ETHTOOL_MSG_USER_MAX = 0x1c
+ ETHTOOL_MSG_KERNEL_NONE = 0x0
+ ETHTOOL_MSG_STRSET_GET_REPLY = 0x1
+ ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2
+ ETHTOOL_MSG_LINKINFO_NTF = 0x3
+ ETHTOOL_MSG_LINKMODES_GET_REPLY = 0x4
+ ETHTOOL_MSG_LINKMODES_NTF = 0x5
+ ETHTOOL_MSG_LINKSTATE_GET_REPLY = 0x6
+ ETHTOOL_MSG_DEBUG_GET_REPLY = 0x7
+ ETHTOOL_MSG_DEBUG_NTF = 0x8
+ ETHTOOL_MSG_WOL_GET_REPLY = 0x9
+ ETHTOOL_MSG_WOL_NTF = 0xa
+ ETHTOOL_MSG_FEATURES_GET_REPLY = 0xb
+ ETHTOOL_MSG_FEATURES_SET_REPLY = 0xc
+ ETHTOOL_MSG_FEATURES_NTF = 0xd
+ ETHTOOL_MSG_PRIVFLAGS_GET_REPLY = 0xe
+ ETHTOOL_MSG_PRIVFLAGS_NTF = 0xf
+ ETHTOOL_MSG_RINGS_GET_REPLY = 0x10
+ ETHTOOL_MSG_RINGS_NTF = 0x11
+ ETHTOOL_MSG_CHANNELS_GET_REPLY = 0x12
+ ETHTOOL_MSG_CHANNELS_NTF = 0x13
+ ETHTOOL_MSG_COALESCE_GET_REPLY = 0x14
+ ETHTOOL_MSG_COALESCE_NTF = 0x15
+ ETHTOOL_MSG_PAUSE_GET_REPLY = 0x16
+ ETHTOOL_MSG_PAUSE_NTF = 0x17
+ ETHTOOL_MSG_EEE_GET_REPLY = 0x18
+ ETHTOOL_MSG_EEE_NTF = 0x19
+ ETHTOOL_MSG_TSINFO_GET_REPLY = 0x1a
+ ETHTOOL_MSG_CABLE_TEST_NTF = 0x1b
+ ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 0x1c
+ ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 0x1d
+ ETHTOOL_MSG_KERNEL_MAX = 0x1d
+ ETHTOOL_A_HEADER_UNSPEC = 0x0
+ ETHTOOL_A_HEADER_DEV_INDEX = 0x1
+ ETHTOOL_A_HEADER_DEV_NAME = 0x2
+ ETHTOOL_A_HEADER_FLAGS = 0x3
+ ETHTOOL_A_HEADER_MAX = 0x3
+ ETHTOOL_A_BITSET_BIT_UNSPEC = 0x0
+ ETHTOOL_A_BITSET_BIT_INDEX = 0x1
+ ETHTOOL_A_BITSET_BIT_NAME = 0x2
+ ETHTOOL_A_BITSET_BIT_VALUE = 0x3
+ ETHTOOL_A_BITSET_BIT_MAX = 0x3
+ ETHTOOL_A_BITSET_BITS_UNSPEC = 0x0
+ ETHTOOL_A_BITSET_BITS_BIT = 0x1
+ ETHTOOL_A_BITSET_BITS_MAX = 0x1
+ ETHTOOL_A_BITSET_UNSPEC = 0x0
+ ETHTOOL_A_BITSET_NOMASK = 0x1
+ ETHTOOL_A_BITSET_SIZE = 0x2
+ ETHTOOL_A_BITSET_BITS = 0x3
+ ETHTOOL_A_BITSET_VALUE = 0x4
+ ETHTOOL_A_BITSET_MASK = 0x5
+ ETHTOOL_A_BITSET_MAX = 0x5
+ ETHTOOL_A_STRING_UNSPEC = 0x0
+ ETHTOOL_A_STRING_INDEX = 0x1
+ ETHTOOL_A_STRING_VALUE = 0x2
+ ETHTOOL_A_STRING_MAX = 0x2
+ ETHTOOL_A_STRINGS_UNSPEC = 0x0
+ ETHTOOL_A_STRINGS_STRING = 0x1
+ ETHTOOL_A_STRINGS_MAX = 0x1
+ ETHTOOL_A_STRINGSET_UNSPEC = 0x0
+ ETHTOOL_A_STRINGSET_ID = 0x1
+ ETHTOOL_A_STRINGSET_COUNT = 0x2
+ ETHTOOL_A_STRINGSET_STRINGS = 0x3
+ ETHTOOL_A_STRINGSET_MAX = 0x3
+ ETHTOOL_A_STRINGSETS_UNSPEC = 0x0
+ ETHTOOL_A_STRINGSETS_STRINGSET = 0x1
+ ETHTOOL_A_STRINGSETS_MAX = 0x1
+ ETHTOOL_A_STRSET_UNSPEC = 0x0
+ ETHTOOL_A_STRSET_HEADER = 0x1
+ ETHTOOL_A_STRSET_STRINGSETS = 0x2
+ ETHTOOL_A_STRSET_COUNTS_ONLY = 0x3
+ ETHTOOL_A_STRSET_MAX = 0x3
+ ETHTOOL_A_LINKINFO_UNSPEC = 0x0
+ ETHTOOL_A_LINKINFO_HEADER = 0x1
+ ETHTOOL_A_LINKINFO_PORT = 0x2
+ ETHTOOL_A_LINKINFO_PHYADDR = 0x3
+ ETHTOOL_A_LINKINFO_TP_MDIX = 0x4
+ ETHTOOL_A_LINKINFO_TP_MDIX_CTRL = 0x5
+ ETHTOOL_A_LINKINFO_TRANSCEIVER = 0x6
+ ETHTOOL_A_LINKINFO_MAX = 0x6
+ ETHTOOL_A_LINKMODES_UNSPEC = 0x0
+ ETHTOOL_A_LINKMODES_HEADER = 0x1
+ ETHTOOL_A_LINKMODES_AUTONEG = 0x2
+ ETHTOOL_A_LINKMODES_OURS = 0x3
+ ETHTOOL_A_LINKMODES_PEER = 0x4
+ ETHTOOL_A_LINKMODES_SPEED = 0x5
+ ETHTOOL_A_LINKMODES_DUPLEX = 0x6
+ ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG = 0x7
+ ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE = 0x8
+ ETHTOOL_A_LINKMODES_MAX = 0x8
+ ETHTOOL_A_LINKSTATE_UNSPEC = 0x0
+ ETHTOOL_A_LINKSTATE_HEADER = 0x1
+ ETHTOOL_A_LINKSTATE_LINK = 0x2
+ ETHTOOL_A_LINKSTATE_SQI = 0x3
+ ETHTOOL_A_LINKSTATE_SQI_MAX = 0x4
+ ETHTOOL_A_LINKSTATE_EXT_STATE = 0x5
+ ETHTOOL_A_LINKSTATE_EXT_SUBSTATE = 0x6
+ ETHTOOL_A_LINKSTATE_MAX = 0x6
+ ETHTOOL_A_DEBUG_UNSPEC = 0x0
+ ETHTOOL_A_DEBUG_HEADER = 0x1
+ ETHTOOL_A_DEBUG_MSGMASK = 0x2
+ ETHTOOL_A_DEBUG_MAX = 0x2
+ ETHTOOL_A_WOL_UNSPEC = 0x0
+ ETHTOOL_A_WOL_HEADER = 0x1
+ ETHTOOL_A_WOL_MODES = 0x2
+ ETHTOOL_A_WOL_SOPASS = 0x3
+ ETHTOOL_A_WOL_MAX = 0x3
+ ETHTOOL_A_FEATURES_UNSPEC = 0x0
+ ETHTOOL_A_FEATURES_HEADER = 0x1
+ ETHTOOL_A_FEATURES_HW = 0x2
+ ETHTOOL_A_FEATURES_WANTED = 0x3
+ ETHTOOL_A_FEATURES_ACTIVE = 0x4
+ ETHTOOL_A_FEATURES_NOCHANGE = 0x5
+ ETHTOOL_A_FEATURES_MAX = 0x5
+ ETHTOOL_A_PRIVFLAGS_UNSPEC = 0x0
+ ETHTOOL_A_PRIVFLAGS_HEADER = 0x1
+ ETHTOOL_A_PRIVFLAGS_FLAGS = 0x2
+ ETHTOOL_A_PRIVFLAGS_MAX = 0x2
+ ETHTOOL_A_RINGS_UNSPEC = 0x0
+ ETHTOOL_A_RINGS_HEADER = 0x1
+ ETHTOOL_A_RINGS_RX_MAX = 0x2
+ ETHTOOL_A_RINGS_RX_MINI_MAX = 0x3
+ ETHTOOL_A_RINGS_RX_JUMBO_MAX = 0x4
+ ETHTOOL_A_RINGS_TX_MAX = 0x5
+ ETHTOOL_A_RINGS_RX = 0x6
+ ETHTOOL_A_RINGS_RX_MINI = 0x7
+ ETHTOOL_A_RINGS_RX_JUMBO = 0x8
+ ETHTOOL_A_RINGS_TX = 0x9
+ ETHTOOL_A_RINGS_MAX = 0x9
+ ETHTOOL_A_CHANNELS_UNSPEC = 0x0
+ ETHTOOL_A_CHANNELS_HEADER = 0x1
+ ETHTOOL_A_CHANNELS_RX_MAX = 0x2
+ ETHTOOL_A_CHANNELS_TX_MAX = 0x3
+ ETHTOOL_A_CHANNELS_OTHER_MAX = 0x4
+ ETHTOOL_A_CHANNELS_COMBINED_MAX = 0x5
+ ETHTOOL_A_CHANNELS_RX_COUNT = 0x6
+ ETHTOOL_A_CHANNELS_TX_COUNT = 0x7
+ ETHTOOL_A_CHANNELS_OTHER_COUNT = 0x8
+ ETHTOOL_A_CHANNELS_COMBINED_COUNT = 0x9
+ ETHTOOL_A_CHANNELS_MAX = 0x9
+ ETHTOOL_A_COALESCE_UNSPEC = 0x0
+ ETHTOOL_A_COALESCE_HEADER = 0x1
+ ETHTOOL_A_COALESCE_RX_USECS = 0x2
+ ETHTOOL_A_COALESCE_RX_MAX_FRAMES = 0x3
+ ETHTOOL_A_COALESCE_RX_USECS_IRQ = 0x4
+ ETHTOOL_A_COALESCE_RX_MAX_FRAMES_IRQ = 0x5
+ ETHTOOL_A_COALESCE_TX_USECS = 0x6
+ ETHTOOL_A_COALESCE_TX_MAX_FRAMES = 0x7
+ ETHTOOL_A_COALESCE_TX_USECS_IRQ = 0x8
+ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_IRQ = 0x9
+ ETHTOOL_A_COALESCE_STATS_BLOCK_USECS = 0xa
+ ETHTOOL_A_COALESCE_USE_ADAPTIVE_RX = 0xb
+ ETHTOOL_A_COALESCE_USE_ADAPTIVE_TX = 0xc
+ ETHTOOL_A_COALESCE_PKT_RATE_LOW = 0xd
+ ETHTOOL_A_COALESCE_RX_USECS_LOW = 0xe
+ ETHTOOL_A_COALESCE_RX_MAX_FRAMES_LOW = 0xf
+ ETHTOOL_A_COALESCE_TX_USECS_LOW = 0x10
+ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_LOW = 0x11
+ ETHTOOL_A_COALESCE_PKT_RATE_HIGH = 0x12
+ ETHTOOL_A_COALESCE_RX_USECS_HIGH = 0x13
+ ETHTOOL_A_COALESCE_RX_MAX_FRAMES_HIGH = 0x14
+ ETHTOOL_A_COALESCE_TX_USECS_HIGH = 0x15
+ ETHTOOL_A_COALESCE_TX_MAX_FRAMES_HIGH = 0x16
+ ETHTOOL_A_COALESCE_RATE_SAMPLE_INTERVAL = 0x17
+ ETHTOOL_A_COALESCE_MAX = 0x17
+ ETHTOOL_A_PAUSE_UNSPEC = 0x0
+ ETHTOOL_A_PAUSE_HEADER = 0x1
+ ETHTOOL_A_PAUSE_AUTONEG = 0x2
+ ETHTOOL_A_PAUSE_RX = 0x3
+ ETHTOOL_A_PAUSE_TX = 0x4
+ ETHTOOL_A_PAUSE_STATS = 0x5
+ ETHTOOL_A_PAUSE_MAX = 0x5
+ ETHTOOL_A_PAUSE_STAT_UNSPEC = 0x0
+ ETHTOOL_A_PAUSE_STAT_PAD = 0x1
+ ETHTOOL_A_PAUSE_STAT_TX_FRAMES = 0x2
+ ETHTOOL_A_PAUSE_STAT_RX_FRAMES = 0x3
+ ETHTOOL_A_PAUSE_STAT_MAX = 0x3
+ ETHTOOL_A_EEE_UNSPEC = 0x0
+ ETHTOOL_A_EEE_HEADER = 0x1
+ ETHTOOL_A_EEE_MODES_OURS = 0x2
+ ETHTOOL_A_EEE_MODES_PEER = 0x3
+ ETHTOOL_A_EEE_ACTIVE = 0x4
+ ETHTOOL_A_EEE_ENABLED = 0x5
+ ETHTOOL_A_EEE_TX_LPI_ENABLED = 0x6
+ ETHTOOL_A_EEE_TX_LPI_TIMER = 0x7
+ ETHTOOL_A_EEE_MAX = 0x7
+ ETHTOOL_A_TSINFO_UNSPEC = 0x0
+ ETHTOOL_A_TSINFO_HEADER = 0x1
+ ETHTOOL_A_TSINFO_TIMESTAMPING = 0x2
+ ETHTOOL_A_TSINFO_TX_TYPES = 0x3
+ ETHTOOL_A_TSINFO_RX_FILTERS = 0x4
+ ETHTOOL_A_TSINFO_PHC_INDEX = 0x5
+ ETHTOOL_A_TSINFO_MAX = 0x5
+ ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TEST_HEADER = 0x1
+ ETHTOOL_A_CABLE_TEST_MAX = 0x1
+ ETHTOOL_A_CABLE_RESULT_CODE_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_RESULT_CODE_OK = 0x1
+ ETHTOOL_A_CABLE_RESULT_CODE_OPEN = 0x2
+ ETHTOOL_A_CABLE_RESULT_CODE_SAME_SHORT = 0x3
+ ETHTOOL_A_CABLE_RESULT_CODE_CROSS_SHORT = 0x4
+ ETHTOOL_A_CABLE_PAIR_A = 0x0
+ ETHTOOL_A_CABLE_PAIR_B = 0x1
+ ETHTOOL_A_CABLE_PAIR_C = 0x2
+ ETHTOOL_A_CABLE_PAIR_D = 0x3
+ ETHTOOL_A_CABLE_RESULT_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_RESULT_PAIR = 0x1
+ ETHTOOL_A_CABLE_RESULT_CODE = 0x2
+ ETHTOOL_A_CABLE_RESULT_MAX = 0x2
+ ETHTOOL_A_CABLE_FAULT_LENGTH_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_FAULT_LENGTH_PAIR = 0x1
+ ETHTOOL_A_CABLE_FAULT_LENGTH_CM = 0x2
+ ETHTOOL_A_CABLE_FAULT_LENGTH_MAX = 0x2
+ ETHTOOL_A_CABLE_TEST_NTF_STATUS_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TEST_NTF_STATUS_STARTED = 0x1
+ ETHTOOL_A_CABLE_TEST_NTF_STATUS_COMPLETED = 0x2
+ ETHTOOL_A_CABLE_NEST_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_NEST_RESULT = 0x1
+ ETHTOOL_A_CABLE_NEST_FAULT_LENGTH = 0x2
+ ETHTOOL_A_CABLE_NEST_MAX = 0x2
+ ETHTOOL_A_CABLE_TEST_NTF_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TEST_NTF_HEADER = 0x1
+ ETHTOOL_A_CABLE_TEST_NTF_STATUS = 0x2
+ ETHTOOL_A_CABLE_TEST_NTF_NEST = 0x3
+ ETHTOOL_A_CABLE_TEST_NTF_MAX = 0x3
+ ETHTOOL_A_CABLE_TEST_TDR_CFG_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST = 0x1
+ ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST = 0x2
+ ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP = 0x3
+ ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR = 0x4
+ ETHTOOL_A_CABLE_TEST_TDR_CFG_MAX = 0x4
+ ETHTOOL_A_CABLE_TEST_TDR_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TEST_TDR_HEADER = 0x1
+ ETHTOOL_A_CABLE_TEST_TDR_CFG = 0x2
+ ETHTOOL_A_CABLE_TEST_TDR_MAX = 0x2
+ ETHTOOL_A_CABLE_AMPLITUDE_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_AMPLITUDE_PAIR = 0x1
+ ETHTOOL_A_CABLE_AMPLITUDE_mV = 0x2
+ ETHTOOL_A_CABLE_AMPLITUDE_MAX = 0x2
+ ETHTOOL_A_CABLE_PULSE_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_PULSE_mV = 0x1
+ ETHTOOL_A_CABLE_PULSE_MAX = 0x1
+ ETHTOOL_A_CABLE_STEP_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_STEP_FIRST_DISTANCE = 0x1
+ ETHTOOL_A_CABLE_STEP_LAST_DISTANCE = 0x2
+ ETHTOOL_A_CABLE_STEP_STEP_DISTANCE = 0x3
+ ETHTOOL_A_CABLE_STEP_MAX = 0x3
+ ETHTOOL_A_CABLE_TDR_NEST_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TDR_NEST_STEP = 0x1
+ ETHTOOL_A_CABLE_TDR_NEST_AMPLITUDE = 0x2
+ ETHTOOL_A_CABLE_TDR_NEST_PULSE = 0x3
+ ETHTOOL_A_CABLE_TDR_NEST_MAX = 0x3
+ ETHTOOL_A_CABLE_TEST_TDR_NTF_UNSPEC = 0x0
+ ETHTOOL_A_CABLE_TEST_TDR_NTF_HEADER = 0x1
+ ETHTOOL_A_CABLE_TEST_TDR_NTF_STATUS = 0x2
+ ETHTOOL_A_CABLE_TEST_TDR_NTF_NEST = 0x3
+ ETHTOOL_A_CABLE_TEST_TDR_NTF_MAX = 0x3
+ ETHTOOL_UDP_TUNNEL_TYPE_VXLAN = 0x0
+ ETHTOOL_UDP_TUNNEL_TYPE_GENEVE = 0x1
+ ETHTOOL_UDP_TUNNEL_TYPE_VXLAN_GPE = 0x2
+ ETHTOOL_A_TUNNEL_UDP_ENTRY_UNSPEC = 0x0
+ ETHTOOL_A_TUNNEL_UDP_ENTRY_PORT = 0x1
+ ETHTOOL_A_TUNNEL_UDP_ENTRY_TYPE = 0x2
+ ETHTOOL_A_TUNNEL_UDP_ENTRY_MAX = 0x2
+ ETHTOOL_A_TUNNEL_UDP_TABLE_UNSPEC = 0x0
+ ETHTOOL_A_TUNNEL_UDP_TABLE_SIZE = 0x1
+ ETHTOOL_A_TUNNEL_UDP_TABLE_TYPES = 0x2
+ ETHTOOL_A_TUNNEL_UDP_TABLE_ENTRY = 0x3
+ ETHTOOL_A_TUNNEL_UDP_TABLE_MAX = 0x3
+ ETHTOOL_A_TUNNEL_UDP_UNSPEC = 0x0
+ ETHTOOL_A_TUNNEL_UDP_TABLE = 0x1
+ ETHTOOL_A_TUNNEL_UDP_MAX = 0x1
+ ETHTOOL_A_TUNNEL_INFO_UNSPEC = 0x0
+ ETHTOOL_A_TUNNEL_INFO_HEADER = 0x1
+ ETHTOOL_A_TUNNEL_INFO_UDP_PORTS = 0x2
+ ETHTOOL_A_TUNNEL_INFO_MAX = 0x2
+)
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
index d54618aa61..088bd77e3b 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_386.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build 386,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
index 741d25be95..078d958ec9 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build amd64,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
index e8d982c3df..2d39122f41 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
index 311cf2155d..304cbd0453 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build arm64,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
index 1312bdf77f..7d9d57006a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
index 2a99348195..a1eb2577b0 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips64,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
index f964307b29..2e5ce3b6a6 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mips64le,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
index ca0fab2702..bbaa1200b6 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build mipsle,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
index 257e004247..0e6e8a7748 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build ppc64,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
index 980dd31736..7382f385fa 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build ppc64le,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
index d9fdab20b8..28d5522166 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build riscv64,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
index c25de8c679..a91a7a44bd 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build s390x,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
index 97fca65340..f824b2358d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
@@ -1,4 +1,4 @@
-// cgo -godefs -- -Wall -Werror -static -I/tmp/include linux/types.go | go run mkpost.go
+// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build sparc64,linux
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
index a89100c08a..3f11f88e3c 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go
@@ -248,6 +248,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
index 289184e0b3..0bed83af57 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go
@@ -255,6 +255,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
index 428c450e4c..e4e3bf736d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go
@@ -253,6 +253,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
index 6f1f2842cc..efac861bb7 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go
@@ -255,6 +255,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x14
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
index 61ea0019a2..80fa295f1d 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go
@@ -231,6 +231,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
index 87a493f68f..560dd6d08a 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go
@@ -235,6 +235,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
index d80836efab..0c1700fa43 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go
@@ -235,6 +235,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x8
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x1c
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go
index 4e158746f1..5b3e46633e 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go
@@ -231,6 +231,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go
index 992a1f8c01..62bff16709 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go
@@ -231,6 +231,7 @@ const (
SizeofSockaddrUnix = 0x6a
SizeofSockaddrDatalink = 0x20
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
index db817f3ba8..ca512aff7f 100644
--- a/src/cmd/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
+++ b/src/cmd/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go
@@ -234,6 +234,7 @@ const (
SizeofSockaddrUnix = 0x6e
SizeofSockaddrDatalink = 0xfc
SizeofLinger = 0x8
+ SizeofIovec = 0x10
SizeofIPMreq = 0x8
SizeofIPv6Mreq = 0x14
SizeofMsghdr = 0x30
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
index c71bad127d..0197df8727 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/syscall_windows.go
@@ -18,9 +18,11 @@ import (
)
type Handle uintptr
+type HWND uintptr
const (
InvalidHandle = ^Handle(0)
+ InvalidHWND = ^HWND(0)
// Flags for DefineDosDevice.
DDD_EXACT_MATCH_ON_REMOVE = 0x00000004
@@ -214,6 +216,10 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW
//sys OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (handle Handle, err error)
//sys ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) [failretval<=32] = shell32.ShellExecuteW
+//sys GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) = user32.GetWindowThreadProcessId
+//sys GetShellWindow() (shellWindow HWND) = user32.GetShellWindow
+//sys MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW
+//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx
//sys shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) = shell32.SHGetKnownFolderPath
//sys TerminateProcess(handle Handle, exitcode uint32) (err error)
//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error)
@@ -259,22 +265,35 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile
//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW
+//sys FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.FindFirstChangeNotificationW
+//sys FindNextChangeNotification(handle Handle) (err error)
+//sys FindCloseChangeNotification(handle Handle) (err error)
//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW
-//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) = crypt32.CertOpenStore
+//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) = crypt32.CertOpenStore
//sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) [failretval==nil] = crypt32.CertEnumCertificatesInStore
-//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore
+//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore
//sys CertCloseStore(store Handle, flags uint32) (err error) = crypt32.CertCloseStore
//sys CertDeleteCertificateFromStore(certContext *CertContext) (err error) = crypt32.CertDeleteCertificateFromStore
-//sys CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) = crypt32.CertGetCertificateChain
-//sys CertFreeCertificateChain(ctx *CertChainContext) = crypt32.CertFreeCertificateChain
-//sys CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) [failretval==nil] = crypt32.CertCreateCertificateContext
-//sys CertFreeCertificateContext(ctx *CertContext) (err error) = crypt32.CertFreeCertificateContext
-//sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy
+//sys CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) = crypt32.CertDuplicateCertificateContext
+//sys PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) = crypt32.PFXImportCertStore
+//sys CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) = crypt32.CertGetCertificateChain
+//sys CertFreeCertificateChain(ctx *CertChainContext) = crypt32.CertFreeCertificateChain
+//sys CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) [failretval==nil] = crypt32.CertCreateCertificateContext
+//sys CertFreeCertificateContext(ctx *CertContext) (err error) = crypt32.CertFreeCertificateContext
+//sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy
+//sys CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) = crypt32.CertGetNameStringW
+//sys CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) = crypt32.CertFindExtension
+//sys CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) = crypt32.CryptQueryObject
+//sys CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) = crypt32.CryptDecodeObject
+//sys CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptProtectData
+//sys CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) = crypt32.CryptUnprotectData
+//sys WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) = wintrust.WinVerifyTrustEx
//sys RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) = advapi32.RegOpenKeyExW
//sys RegCloseKey(key Handle) (regerrno error) = advapi32.RegCloseKey
//sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW
//sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW
//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
+//sys RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) = advapi32.RegNotifyChangeKeyValue
//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
//sys ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) = kernel32.ProcessIdToSessionId
//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
@@ -341,8 +360,6 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW
//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW
//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW
-//sys MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) [failretval==0] = user32.MessageBoxW
-//sys ExitWindowsEx(flags uint32, reason uint32) (err error) = user32.ExitWindowsEx
//sys InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint32, forceAppsClosed bool, rebootAfterShutdown bool, reason uint32) (err error) = advapi32.InitiateSystemShutdownExW
//sys SetProcessShutdownParameters(level uint32, flags uint32) (err error) = kernel32.SetProcessShutdownParameters
//sys GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) = kernel32.GetProcessShutdownParameters
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
index 265d797cac..fd4260762a 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/types_windows.go
@@ -227,7 +227,7 @@ const (
)
const (
- // filters for ReadDirectoryChangesW
+ // filters for ReadDirectoryChangesW and FindFirstChangeNotificationW
FILE_NOTIFY_CHANGE_FILE_NAME = 0x001
FILE_NOTIFY_CHANGE_DIR_NAME = 0x002
FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x004
@@ -249,24 +249,27 @@ const (
const (
// wincrypt.h
- PROV_RSA_FULL = 1
- PROV_RSA_SIG = 2
- PROV_DSS = 3
- PROV_FORTEZZA = 4
- PROV_MS_EXCHANGE = 5
- PROV_SSL = 6
- PROV_RSA_SCHANNEL = 12
- PROV_DSS_DH = 13
- PROV_EC_ECDSA_SIG = 14
- PROV_EC_ECNRA_SIG = 15
- PROV_EC_ECDSA_FULL = 16
- PROV_EC_ECNRA_FULL = 17
- PROV_DH_SCHANNEL = 18
- PROV_SPYRUS_LYNKS = 20
- PROV_RNG = 21
- PROV_INTEL_SEC = 22
- PROV_REPLACE_OWF = 23
- PROV_RSA_AES = 24
+ /* certenrolld_begin -- PROV_RSA_*/
+ PROV_RSA_FULL = 1
+ PROV_RSA_SIG = 2
+ PROV_DSS = 3
+ PROV_FORTEZZA = 4
+ PROV_MS_EXCHANGE = 5
+ PROV_SSL = 6
+ PROV_RSA_SCHANNEL = 12
+ PROV_DSS_DH = 13
+ PROV_EC_ECDSA_SIG = 14
+ PROV_EC_ECNRA_SIG = 15
+ PROV_EC_ECDSA_FULL = 16
+ PROV_EC_ECNRA_FULL = 17
+ PROV_DH_SCHANNEL = 18
+ PROV_SPYRUS_LYNKS = 20
+ PROV_RNG = 21
+ PROV_INTEL_SEC = 22
+ PROV_REPLACE_OWF = 23
+ PROV_RSA_AES = 24
+
+ /* dwFlags definitions for CryptAcquireContext */
CRYPT_VERIFYCONTEXT = 0xF0000000
CRYPT_NEWKEYSET = 0x00000008
CRYPT_DELETEKEYSET = 0x00000010
@@ -274,6 +277,17 @@ const (
CRYPT_SILENT = 0x00000040
CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080
+ /* Flags for PFXImportCertStore */
+ CRYPT_EXPORTABLE = 0x00000001
+ CRYPT_USER_PROTECTED = 0x00000002
+ CRYPT_USER_KEYSET = 0x00001000
+ PKCS12_PREFER_CNG_KSP = 0x00000100
+ PKCS12_ALWAYS_CNG_KSP = 0x00000200
+ PKCS12_ALLOW_OVERWRITE_KEY = 0x00004000
+ PKCS12_NO_PERSIST_KEY = 0x00008000
+ PKCS12_INCLUDE_EXTENDED_PROPERTIES = 0x00000010
+
+ /* Default usage match type is AND with value zero */
USAGE_MATCH_TYPE_AND = 0
USAGE_MATCH_TYPE_OR = 1
@@ -409,6 +423,71 @@ const (
CERT_CHAIN_POLICY_EV = 8
CERT_CHAIN_POLICY_SSL_F12 = 9
+ /* Certificate Store close flags */
+ CERT_CLOSE_STORE_FORCE_FLAG = 0x00000001
+ CERT_CLOSE_STORE_CHECK_FLAG = 0x00000002
+
+ /* CryptQueryObject object type */
+ CERT_QUERY_OBJECT_FILE = 1
+ CERT_QUERY_OBJECT_BLOB = 2
+
+ /* CryptQueryObject content type flags */
+ CERT_QUERY_CONTENT_CERT = 1
+ CERT_QUERY_CONTENT_CTL = 2
+ CERT_QUERY_CONTENT_CRL = 3
+ CERT_QUERY_CONTENT_SERIALIZED_STORE = 4
+ CERT_QUERY_CONTENT_SERIALIZED_CERT = 5
+ CERT_QUERY_CONTENT_SERIALIZED_CTL = 6
+ CERT_QUERY_CONTENT_SERIALIZED_CRL = 7
+ CERT_QUERY_CONTENT_PKCS7_SIGNED = 8
+ CERT_QUERY_CONTENT_PKCS7_UNSIGNED = 9
+ CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED = 10
+ CERT_QUERY_CONTENT_PKCS10 = 11
+ CERT_QUERY_CONTENT_PFX = 12
+ CERT_QUERY_CONTENT_CERT_PAIR = 13
+ CERT_QUERY_CONTENT_PFX_AND_LOAD = 14
+ CERT_QUERY_CONTENT_FLAG_CERT = (1 << CERT_QUERY_CONTENT_CERT)
+ CERT_QUERY_CONTENT_FLAG_CTL = (1 << CERT_QUERY_CONTENT_CTL)
+ CERT_QUERY_CONTENT_FLAG_CRL = (1 << CERT_QUERY_CONTENT_CRL)
+ CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE = (1 << CERT_QUERY_CONTENT_SERIALIZED_STORE)
+ CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT = (1 << CERT_QUERY_CONTENT_SERIALIZED_CERT)
+ CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL = (1 << CERT_QUERY_CONTENT_SERIALIZED_CTL)
+ CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL = (1 << CERT_QUERY_CONTENT_SERIALIZED_CRL)
+ CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED = (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED)
+ CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED = (1 << CERT_QUERY_CONTENT_PKCS7_UNSIGNED)
+ CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED = (1 << CERT_QUERY_CONTENT_PKCS7_SIGNED_EMBED)
+ CERT_QUERY_CONTENT_FLAG_PKCS10 = (1 << CERT_QUERY_CONTENT_PKCS10)
+ CERT_QUERY_CONTENT_FLAG_PFX = (1 << CERT_QUERY_CONTENT_PFX)
+ CERT_QUERY_CONTENT_FLAG_CERT_PAIR = (1 << CERT_QUERY_CONTENT_CERT_PAIR)
+ CERT_QUERY_CONTENT_FLAG_PFX_AND_LOAD = (1 << CERT_QUERY_CONTENT_PFX_AND_LOAD)
+ CERT_QUERY_CONTENT_FLAG_ALL = (CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_CTL | CERT_QUERY_CONTENT_FLAG_CRL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CTL | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CRL | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED_EMBED | CERT_QUERY_CONTENT_FLAG_PKCS10 | CERT_QUERY_CONTENT_FLAG_PFX | CERT_QUERY_CONTENT_FLAG_CERT_PAIR)
+ CERT_QUERY_CONTENT_FLAG_ALL_ISSUER_CERT = (CERT_QUERY_CONTENT_FLAG_CERT | CERT_QUERY_CONTENT_FLAG_SERIALIZED_STORE | CERT_QUERY_CONTENT_FLAG_SERIALIZED_CERT | CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED | CERT_QUERY_CONTENT_FLAG_PKCS7_UNSIGNED)
+
+ /* CryptQueryObject format type flags */
+ CERT_QUERY_FORMAT_BINARY = 1
+ CERT_QUERY_FORMAT_BASE64_ENCODED = 2
+ CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED = 3
+ CERT_QUERY_FORMAT_FLAG_BINARY = (1 << CERT_QUERY_FORMAT_BINARY)
+ CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED = (1 << CERT_QUERY_FORMAT_BASE64_ENCODED)
+ CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED = (1 << CERT_QUERY_FORMAT_ASN_ASCII_HEX_ENCODED)
+ CERT_QUERY_FORMAT_FLAG_ALL = (CERT_QUERY_FORMAT_FLAG_BINARY | CERT_QUERY_FORMAT_FLAG_BASE64_ENCODED | CERT_QUERY_FORMAT_FLAG_ASN_ASCII_HEX_ENCODED)
+
+ /* CertGetNameString name types */
+ CERT_NAME_EMAIL_TYPE = 1
+ CERT_NAME_RDN_TYPE = 2
+ CERT_NAME_ATTR_TYPE = 3
+ CERT_NAME_SIMPLE_DISPLAY_TYPE = 4
+ CERT_NAME_FRIENDLY_DISPLAY_TYPE = 5
+ CERT_NAME_DNS_TYPE = 6
+ CERT_NAME_URL_TYPE = 7
+ CERT_NAME_UPN_TYPE = 8
+
+ /* CertGetNameString flags */
+ CERT_NAME_ISSUER_FLAG = 0x1
+ CERT_NAME_DISABLE_IE4_UTF8_FLAG = 0x10000
+ CERT_NAME_SEARCH_ALL_NAMES_FLAG = 0x2
+ CERT_NAME_STR_ENABLE_PUNYCODE_FLAG = 0x00200000
+
/* AuthType values for SSLExtraCertChainPolicyPara struct */
AUTHTYPE_CLIENT = 1
AUTHTYPE_SERVER = 2
@@ -419,6 +498,22 @@ const (
SECURITY_FLAG_IGNORE_WRONG_USAGE = 0x00000200
SECURITY_FLAG_IGNORE_CERT_CN_INVALID = 0x00001000
SECURITY_FLAG_IGNORE_CERT_DATE_INVALID = 0x00002000
+
+ /* Flags for Crypt[Un]ProtectData */
+ CRYPTPROTECT_UI_FORBIDDEN = 0x1
+ CRYPTPROTECT_LOCAL_MACHINE = 0x4
+ CRYPTPROTECT_CRED_SYNC = 0x8
+ CRYPTPROTECT_AUDIT = 0x10
+ CRYPTPROTECT_NO_RECOVERY = 0x20
+ CRYPTPROTECT_VERIFY_PROTECTION = 0x40
+ CRYPTPROTECT_CRED_REGENERATE = 0x80
+
+ /* Flags for CryptProtectPromptStruct */
+ CRYPTPROTECT_PROMPT_ON_UNPROTECT = 1
+ CRYPTPROTECT_PROMPT_ON_PROTECT = 2
+ CRYPTPROTECT_PROMPT_RESERVED = 4
+ CRYPTPROTECT_PROMPT_STRONG = 8
+ CRYPTPROTECT_PROMPT_REQUIRE_STRONG = 16
)
const (
@@ -441,10 +536,58 @@ const (
REALTIME_PRIORITY_CLASS = 0x00000100
)
+/* wintrust.h constants for WinVerifyTrustEx */
+const (
+ WTD_UI_ALL = 1
+ WTD_UI_NONE = 2
+ WTD_UI_NOBAD = 3
+ WTD_UI_NOGOOD = 4
+
+ WTD_REVOKE_NONE = 0
+ WTD_REVOKE_WHOLECHAIN = 1
+
+ WTD_CHOICE_FILE = 1
+ WTD_CHOICE_CATALOG = 2
+ WTD_CHOICE_BLOB = 3
+ WTD_CHOICE_SIGNER = 4
+ WTD_CHOICE_CERT = 5
+
+ WTD_STATEACTION_IGNORE = 0x00000000
+ WTD_STATEACTION_VERIFY = 0x00000010
+ WTD_STATEACTION_CLOSE = 0x00000002
+ WTD_STATEACTION_AUTO_CACHE = 0x00000003
+ WTD_STATEACTION_AUTO_CACHE_FLUSH = 0x00000004
+
+ WTD_USE_IE4_TRUST_FLAG = 0x1
+ WTD_NO_IE4_CHAIN_FLAG = 0x2
+ WTD_NO_POLICY_USAGE_FLAG = 0x4
+ WTD_REVOCATION_CHECK_NONE = 0x10
+ WTD_REVOCATION_CHECK_END_CERT = 0x20
+ WTD_REVOCATION_CHECK_CHAIN = 0x40
+ WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT = 0x80
+ WTD_SAFER_FLAG = 0x100
+ WTD_HASH_ONLY_FLAG = 0x200
+ WTD_USE_DEFAULT_OSVER_CHECK = 0x400
+ WTD_LIFETIME_SIGNING_FLAG = 0x800
+ WTD_CACHE_ONLY_URL_RETRIEVAL = 0x1000
+ WTD_DISABLE_MD2_MD4 = 0x2000
+ WTD_MOTW = 0x4000
+
+ WTD_UICONTEXT_EXECUTE = 0
+ WTD_UICONTEXT_INSTALL = 1
+)
+
var (
OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00")
OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00")
OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00")
+
+ WINTRUST_ACTION_GENERIC_VERIFY_V2 = GUID{
+ Data1: 0xaac56b,
+ Data2: 0xcd44,
+ Data3: 0x11d0,
+ Data4: [8]byte{0x8c, 0xc2, 0x0, 0xc0, 0x4f, 0xc2, 0x95, 0xee},
+ }
)
// Pointer represents a pointer to an arbitrary Windows type.
@@ -1033,7 +1176,57 @@ type MibIfRow struct {
}
type CertInfo struct {
- // Not implemented
+ Version uint32
+ SerialNumber CryptIntegerBlob
+ SignatureAlgorithm CryptAlgorithmIdentifier
+ Issuer CertNameBlob
+ NotBefore Filetime
+ NotAfter Filetime
+ Subject CertNameBlob
+ SubjectPublicKeyInfo CertPublicKeyInfo
+ IssuerUniqueId CryptBitBlob
+ SubjectUniqueId CryptBitBlob
+ CountExtensions uint32
+ Extensions *CertExtension
+}
+
+type CertExtension struct {
+ ObjId *byte
+ Critical int32
+ Value CryptObjidBlob
+}
+
+type CryptAlgorithmIdentifier struct {
+ ObjId *byte
+ Parameters CryptObjidBlob
+}
+
+type CertPublicKeyInfo struct {
+ Algorithm CryptAlgorithmIdentifier
+ PublicKey CryptBitBlob
+}
+
+type DataBlob struct {
+ Size uint32
+ Data *byte
+}
+type CryptIntegerBlob DataBlob
+type CryptUintBlob DataBlob
+type CryptObjidBlob DataBlob
+type CertNameBlob DataBlob
+type CertRdnValueBlob DataBlob
+type CertBlob DataBlob
+type CrlBlob DataBlob
+type CryptDataBlob DataBlob
+type CryptHashBlob DataBlob
+type CryptDigestBlob DataBlob
+type CryptDerBlob DataBlob
+type CryptAttrBlob DataBlob
+
+type CryptBitBlob struct {
+ Size uint32
+ Data *byte
+ UnusedBits uint32
}
type CertContext struct {
@@ -1139,6 +1332,66 @@ type CertChainPolicyStatus struct {
ExtraPolicyStatus Pointer
}
+type CertPolicyInfo struct {
+ Identifier *byte
+ CountQualifiers uint32
+ Qualifiers *CertPolicyQualifierInfo
+}
+
+type CertPoliciesInfo struct {
+ Count uint32
+ PolicyInfos *CertPolicyInfo
+}
+
+type CertPolicyQualifierInfo struct {
+ // Not implemented
+}
+
+type CertStrongSignPara struct {
+ Size uint32
+ InfoChoice uint32
+ InfoOrSerializedInfoOrOID unsafe.Pointer
+}
+
+type CryptProtectPromptStruct struct {
+ Size uint32
+ PromptFlags uint32
+ App HWND
+ Prompt *uint16
+}
+
+type WinTrustData struct {
+ Size uint32
+ PolicyCallbackData uintptr
+ SIPClientData uintptr
+ UIChoice uint32
+ RevocationChecks uint32
+ UnionChoice uint32
+ FileOrCatalogOrBlobOrSgnrOrCert unsafe.Pointer
+ StateAction uint32
+ StateData Handle
+ URLReference *uint16
+ ProvFlags uint32
+ UIContext uint32
+ SignatureSettings *WinTrustSignatureSettings
+}
+
+type WinTrustFileInfo struct {
+ Size uint32
+ FilePath *uint16
+ File Handle
+ KnownSubject *GUID
+}
+
+type WinTrustSignatureSettings struct {
+ Size uint32
+ Index uint32
+ Flags uint32
+ SecondarySigs uint32
+ VerifiedSigIndex uint32
+ CryptoPolicy *CertStrongSignPara
+}
+
const (
// do not reorder
HKEY_CLASSES_ROOT = 0x80000000 + iota
@@ -1820,3 +2073,21 @@ const (
LOAD_LIBRARY_SEARCH_SYSTEM32_NO_FORWARDER = 0x00004000
LOAD_LIBRARY_OS_INTEGRITY_CONTINUITY = 0x00008000
)
+
+// RegNotifyChangeKeyValue notifyFilter flags.
+const (
+ // REG_NOTIFY_CHANGE_NAME notifies the caller if a subkey is added or deleted.
+ REG_NOTIFY_CHANGE_NAME = 0x00000001
+
+ // REG_NOTIFY_CHANGE_ATTRIBUTES notifies the caller of changes to the attributes of the key, such as the security descriptor information.
+ REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002
+
+ // REG_NOTIFY_CHANGE_LAST_SET notifies the caller of changes to a value of the key. This can include adding or deleting a value, or changing an existing value.
+ REG_NOTIFY_CHANGE_LAST_SET = 0x00000004
+
+ // REG_NOTIFY_CHANGE_SECURITY notifies the caller of changes to the security descriptor of the key.
+ REG_NOTIFY_CHANGE_SECURITY = 0x00000008
+
+ // REG_NOTIFY_THREAD_AGNOSTIC indicates that the lifetime of the registration must not be tied to the lifetime of the thread issuing the RegNotifyChangeKeyValue call. Note: This flag value is only supported in Windows 8 and later.
+ REG_NOTIFY_THREAD_AGNOSTIC = 0x10000000
+)
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/types_windows_arm64.go b/src/cmd/vendor/golang.org/x/sys/windows/types_windows_arm64.go
new file mode 100644
index 0000000000..fdddc0c70a
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/sys/windows/types_windows_arm64.go
@@ -0,0 +1,34 @@
+// Copyright 2011 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.
+
+package windows
+
+type WSAData struct {
+ Version uint16
+ HighVersion uint16
+ MaxSockets uint16
+ MaxUdpDg uint16
+ VendorInfo *byte
+ Description [WSADESCRIPTION_LEN + 1]byte
+ SystemStatus [WSASYS_STATUS_LEN + 1]byte
+}
+
+type Servent struct {
+ Name *byte
+ Aliases **byte
+ Proto *byte
+ Port uint16
+}
+
+type JOBOBJECT_BASIC_LIMIT_INFORMATION struct {
+ PerProcessUserTimeLimit int64
+ PerJobUserTimeLimit int64
+ LimitFlags uint32
+ MinimumWorkingSetSize uintptr
+ MaximumWorkingSetSize uintptr
+ ActiveProcessLimit uint32
+ Affinity uintptr
+ PriorityClass uint32
+ SchedulingClass uint32
+}
diff --git a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
index a933c0ee37..c38c59d772 100644
--- a/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
+++ b/src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go
@@ -51,6 +51,7 @@ var (
modshell32 = NewLazySystemDLL("shell32.dll")
moduser32 = NewLazySystemDLL("user32.dll")
moduserenv = NewLazySystemDLL("userenv.dll")
+ modwintrust = NewLazySystemDLL("wintrust.dll")
modws2_32 = NewLazySystemDLL("ws2_32.dll")
modwtsapi32 = NewLazySystemDLL("wtsapi32.dll")
@@ -117,6 +118,7 @@ var (
procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
procRegCloseKey = modadvapi32.NewProc("RegCloseKey")
procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW")
+ procRegNotifyChangeKeyValue = modadvapi32.NewProc("RegNotifyChangeKeyValue")
procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW")
procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW")
procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW")
@@ -142,13 +144,21 @@ var (
procCertCloseStore = modcrypt32.NewProc("CertCloseStore")
procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext")
procCertDeleteCertificateFromStore = modcrypt32.NewProc("CertDeleteCertificateFromStore")
+ procCertDuplicateCertificateContext = modcrypt32.NewProc("CertDuplicateCertificateContext")
procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore")
+ procCertFindExtension = modcrypt32.NewProc("CertFindExtension")
procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain")
procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext")
procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain")
+ procCertGetNameStringW = modcrypt32.NewProc("CertGetNameStringW")
procCertOpenStore = modcrypt32.NewProc("CertOpenStore")
procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW")
procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy")
+ procCryptDecodeObject = modcrypt32.NewProc("CryptDecodeObject")
+ procCryptProtectData = modcrypt32.NewProc("CryptProtectData")
+ procCryptQueryObject = modcrypt32.NewProc("CryptQueryObject")
+ procCryptUnprotectData = modcrypt32.NewProc("CryptUnprotectData")
+ procPFXImportCertStore = modcrypt32.NewProc("PFXImportCertStore")
procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W")
procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W")
procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree")
@@ -180,9 +190,12 @@ var (
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
procExitProcess = modkernel32.NewProc("ExitProcess")
procFindClose = modkernel32.NewProc("FindClose")
+ procFindCloseChangeNotification = modkernel32.NewProc("FindCloseChangeNotification")
+ procFindFirstChangeNotificationW = modkernel32.NewProc("FindFirstChangeNotificationW")
procFindFirstFileW = modkernel32.NewProc("FindFirstFileW")
procFindFirstVolumeMountPointW = modkernel32.NewProc("FindFirstVolumeMountPointW")
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
+ procFindNextChangeNotification = modkernel32.NewProc("FindNextChangeNotification")
procFindNextFileW = modkernel32.NewProc("FindNextFileW")
procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW")
procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW")
@@ -338,10 +351,13 @@ var (
procSHGetKnownFolderPath = modshell32.NewProc("SHGetKnownFolderPath")
procShellExecuteW = modshell32.NewProc("ShellExecuteW")
procExitWindowsEx = moduser32.NewProc("ExitWindowsEx")
+ procGetShellWindow = moduser32.NewProc("GetShellWindow")
+ procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId")
procMessageBoxW = moduser32.NewProc("MessageBoxW")
procCreateEnvironmentBlock = moduserenv.NewProc("CreateEnvironmentBlock")
procDestroyEnvironmentBlock = moduserenv.NewProc("DestroyEnvironmentBlock")
procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW")
+ procWinVerifyTrustEx = modwintrust.NewProc("WinVerifyTrustEx")
procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW")
procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW")
procWSACleanup = modws2_32.NewProc("WSACleanup")
@@ -931,6 +947,22 @@ func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reser
return
}
+func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, event Handle, asynchronous bool) (regerrno error) {
+ var _p0 uint32
+ if watchSubtree {
+ _p0 = 1
+ }
+ var _p1 uint32
+ if asynchronous {
+ _p1 = 1
+ }
+ r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0)
+ if r0 != 0 {
+ regerrno = syscall.Errno(r0)
+ }
+ return
+}
+
func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) {
r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0)
if r0 != 0 {
@@ -1163,6 +1195,12 @@ func CertDeleteCertificateFromStore(certContext *CertContext) (err error) {
return
}
+func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) {
+ r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0)
+ dupContext = (*CertContext)(unsafe.Pointer(r0))
+ return
+}
+
func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) {
r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0)
context = (*CertContext)(unsafe.Pointer(r0))
@@ -1172,6 +1210,12 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex
return
}
+func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) {
+ r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions)))
+ ret = (*CertExtension)(unsafe.Pointer(r0))
+ return
+}
+
func CertFreeCertificateChain(ctx *CertChainContext) {
syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0)
return
@@ -1193,6 +1237,12 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a
return
}
+func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) {
+ r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size))
+ chars = uint32(r0)
+ return
+}
+
func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) {
r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0)
handle = Handle(r0)
@@ -1219,6 +1269,47 @@ func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext
return
}
+func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) {
+ r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) {
+ r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) {
+ r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) {
+ r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) {
+ r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags))
+ store = Handle(r0)
+ if store == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) {
r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0)
same = r0 != 0
@@ -1489,6 +1580,36 @@ func FindClose(handle Handle) (err error) {
return
}
+func FindCloseChangeNotification(handle Handle) (err error) {
+ r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) {
+ var _p0 *uint16
+ _p0, err = syscall.UTF16PtrFromString(path)
+ if err != nil {
+ return
+ }
+ return _FindFirstChangeNotification(_p0, watchSubtree, notifyFilter)
+}
+
+func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) {
+ var _p1 uint32
+ if watchSubtree {
+ _p1 = 1
+ }
+ r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter))
+ handle = Handle(r0)
+ if handle == InvalidHandle {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) {
r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0)
handle = Handle(r0)
@@ -1516,6 +1637,14 @@ func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, er
return
}
+func FindNextChangeNotification(handle Handle) (err error) {
+ r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func findNextFile1(handle Handle, data *win32finddata1) (err error) {
r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0)
if r1 == 0 {
@@ -2862,7 +2991,22 @@ func ExitWindowsEx(flags uint32, reason uint32) (err error) {
return
}
-func MessageBox(hwnd Handle, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
+func GetShellWindow() (shellWindow HWND) {
+ r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0)
+ shellWindow = HWND(r0)
+ return
+}
+
+func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) {
+ r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0)
+ tid = uint32(r0)
+ if tid == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) {
r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0)
ret = int32(r0)
if ret == 0 {
@@ -2899,6 +3043,14 @@ func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) {
return
}
+func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) {
+ r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data)))
+ if r0 != 0 {
+ ret = syscall.Errno(r0)
+ }
+ return
+}
+
func FreeAddrInfoW(addrinfo *AddrinfoW) {
syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0)
return
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go
index 841b928578..c4407ad91f 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag.go
@@ -2,14 +2,17 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.16
+// +build go1.16
+
// Package buildtag defines an Analyzer that checks build tags.
package buildtag
import (
- "bytes"
- "fmt"
"go/ast"
+ "go/build/constraint"
"go/parser"
+ "go/token"
"strings"
"unicode"
@@ -52,118 +55,313 @@ func runBuildTag(pass *analysis.Pass) (interface{}, error) {
}
func checkGoFile(pass *analysis.Pass, f *ast.File) {
- pastCutoff := false
+ var check checker
+ check.init(pass)
+ defer check.finish()
+
for _, group := range f.Comments {
// A +build comment is ignored after or adjoining the package declaration.
if group.End()+1 >= f.Package {
- pastCutoff = true
+ check.plusBuildOK = false
}
-
- // "+build" is ignored within or after a /*...*/ comment.
- if !strings.HasPrefix(group.List[0].Text, "//") {
- pastCutoff = true
- continue
+ // A //go:build comment is ignored after the package declaration
+ // (but adjoining it is OK, in contrast to +build comments).
+ if group.Pos() >= f.Package {
+ check.goBuildOK = false
}
// Check each line of a //-comment.
for _, c := range group.List {
- if !strings.Contains(c.Text, "+build") {
- continue
- }
- if err := checkLine(c.Text, pastCutoff); err != nil {
- pass.Reportf(c.Pos(), "%s", err)
+ // "+build" is ignored within or after a /*...*/ comment.
+ if !strings.HasPrefix(c.Text, "//") {
+ check.plusBuildOK = false
}
+ check.comment(c.Slash, c.Text)
}
}
}
func checkOtherFile(pass *analysis.Pass, filename string) error {
+ var check checker
+ check.init(pass)
+ defer check.finish()
+
+ // We cannot use the Go parser, since this may not be a Go source file.
+ // Read the raw bytes instead.
content, tf, err := analysisutil.ReadFile(pass.Fset, filename)
if err != nil {
return err
}
- // We must look at the raw lines, as build tags may appear in non-Go
- // files such as assembly files.
- lines := bytes.SplitAfter(content, nl)
+ check.file(token.Pos(tf.Base()), string(content))
+ return nil
+}
+
+type checker struct {
+ pass *analysis.Pass
+ plusBuildOK bool // "+build" lines still OK
+ goBuildOK bool // "go:build" lines still OK
+ crossCheck bool // cross-check go:build and +build lines when done reading file
+ inStar bool // currently in a /* */ comment
+ goBuildPos token.Pos // position of first go:build line found
+ plusBuildPos token.Pos // position of first "+build" line found
+ goBuild constraint.Expr // go:build constraint found
+ plusBuild constraint.Expr // AND of +build constraints found
+}
+
+func (check *checker) init(pass *analysis.Pass) {
+ check.pass = pass
+ check.goBuildOK = true
+ check.plusBuildOK = true
+ check.crossCheck = true
+}
+func (check *checker) file(pos token.Pos, text string) {
// Determine cutpoint where +build comments are no longer valid.
// They are valid in leading // comments in the file followed by
// a blank line.
//
// This must be done as a separate pass because of the
// requirement that the comment be followed by a blank line.
- var cutoff int
- for i, line := range lines {
- line = bytes.TrimSpace(line)
- if !bytes.HasPrefix(line, slashSlash) {
- if len(line) > 0 {
- break
- }
- cutoff = i
+ var plusBuildCutoff int
+ fullText := text
+ for text != "" {
+ i := strings.Index(text, "\n")
+ if i < 0 {
+ i = len(text)
+ } else {
+ i++
+ }
+ offset := len(fullText) - len(text)
+ line := text[:i]
+ text = text[i:]
+ line = strings.TrimSpace(line)
+ if !strings.HasPrefix(line, "//") && line != "" {
+ break
+ }
+ if line == "" {
+ plusBuildCutoff = offset
}
}
- for i, line := range lines {
- line = bytes.TrimSpace(line)
- if !bytes.HasPrefix(line, slashSlash) {
- continue
+ // Process each line.
+ // Must stop once we hit goBuildOK == false
+ text = fullText
+ check.inStar = false
+ for text != "" {
+ i := strings.Index(text, "\n")
+ if i < 0 {
+ i = len(text)
+ } else {
+ i++
}
- if !bytes.Contains(line, []byte("+build")) {
+ offset := len(fullText) - len(text)
+ line := text[:i]
+ text = text[i:]
+ check.plusBuildOK = offset < plusBuildCutoff
+
+ if strings.HasPrefix(line, "//") {
+ check.comment(pos+token.Pos(offset), line)
continue
}
- if err := checkLine(string(line), i >= cutoff); err != nil {
- pass.Reportf(analysisutil.LineStart(tf, i+1), "%s", err)
- continue
+
+ // Keep looking for the point at which //go:build comments
+ // stop being allowed. Skip over, cut out any /* */ comments.
+ for {
+ line = strings.TrimSpace(line)
+ if check.inStar {
+ i := strings.Index(line, "*/")
+ if i < 0 {
+ line = ""
+ break
+ }
+ line = line[i+len("*/"):]
+ check.inStar = false
+ continue
+ }
+ if strings.HasPrefix(line, "/*") {
+ check.inStar = true
+ line = line[len("/*"):]
+ continue
+ }
+ break
+ }
+ if line != "" {
+ // Found non-comment non-blank line.
+ // Ends space for valid //go:build comments,
+ // but also ends the fraction of the file we can
+ // reliably parse. From this point on we might
+ // incorrectly flag "comments" inside multiline
+ // string constants or anything else (this might
+ // not even be a Go program). So stop.
+ break
}
}
- return nil
}
-// checkLine checks a line that starts with "//" and contains "+build".
-func checkLine(line string, pastCutoff bool) error {
- line = strings.TrimPrefix(line, "//")
- line = strings.TrimSpace(line)
-
- if strings.HasPrefix(line, "+build") {
- fields := strings.Fields(line)
- if fields[0] != "+build" {
- // Comment is something like +buildasdf not +build.
- return fmt.Errorf("possible malformed +build comment")
+func (check *checker) comment(pos token.Pos, text string) {
+ if strings.HasPrefix(text, "//") {
+ if strings.Contains(text, "+build") {
+ check.plusBuildLine(pos, text)
}
- if pastCutoff {
- return fmt.Errorf("+build comment must appear before package clause and be followed by a blank line")
+ if strings.Contains(text, "//go:build") {
+ check.goBuildLine(pos, text)
}
- if err := checkArguments(fields); err != nil {
- return err
+ }
+ if strings.HasPrefix(text, "/*") {
+ if i := strings.Index(text, "\n"); i >= 0 {
+ // multiline /* */ comment - process interior lines
+ check.inStar = true
+ i++
+ pos += token.Pos(i)
+ text = text[i:]
+ for text != "" {
+ i := strings.Index(text, "\n")
+ if i < 0 {
+ i = len(text)
+ } else {
+ i++
+ }
+ line := text[:i]
+ if strings.HasPrefix(line, "//") {
+ check.comment(pos, line)
+ }
+ pos += token.Pos(i)
+ text = text[i:]
+ }
+ check.inStar = false
+ }
+ }
+}
+
+func (check *checker) goBuildLine(pos token.Pos, line string) {
+ if !constraint.IsGoBuild(line) {
+ if !strings.HasPrefix(line, "//go:build") && constraint.IsGoBuild("//"+strings.TrimSpace(line[len("//"):])) {
+ check.pass.Reportf(pos, "malformed //go:build line (space between // and go:build)")
}
+ return
+ }
+ if !check.goBuildOK || check.inStar {
+ check.pass.Reportf(pos, "misplaced //go:build comment")
+ check.crossCheck = false
+ return
+ }
+
+ if check.goBuildPos == token.NoPos {
+ check.goBuildPos = pos
} else {
+ check.pass.Reportf(pos, "unexpected extra //go:build line")
+ check.crossCheck = false
+ }
+
+ // testing hack: stop at // ERROR
+ if i := strings.Index(line, " // ERROR "); i >= 0 {
+ line = line[:i]
+ }
+
+ x, err := constraint.Parse(line)
+ if err != nil {
+ check.pass.Reportf(pos, "%v", err)
+ check.crossCheck = false
+ return
+ }
+
+ if check.goBuild == nil {
+ check.goBuild = x
+ }
+}
+
+func (check *checker) plusBuildLine(pos token.Pos, line string) {
+ line = strings.TrimSpace(line)
+ if !constraint.IsPlusBuild(line) {
// Comment with +build but not at beginning.
- if !pastCutoff {
- return fmt.Errorf("possible malformed +build comment")
+ // Only report early in file.
+ if check.plusBuildOK && !strings.HasPrefix(line, "// want") {
+ check.pass.Reportf(pos, "possible malformed +build comment")
}
+ return
+ }
+ if !check.plusBuildOK { // inStar implies !plusBuildOK
+ check.pass.Reportf(pos, "misplaced +build comment")
+ check.crossCheck = false
}
- return nil
-}
-func checkArguments(fields []string) error {
+ if check.plusBuildPos == token.NoPos {
+ check.plusBuildPos = pos
+ }
+
+ // testing hack: stop at // ERROR
+ if i := strings.Index(line, " // ERROR "); i >= 0 {
+ line = line[:i]
+ }
+
+ fields := strings.Fields(line[len("//"):])
+ // IsPlusBuildConstraint check above implies fields[0] == "+build"
for _, arg := range fields[1:] {
for _, elem := range strings.Split(arg, ",") {
if strings.HasPrefix(elem, "!!") {
- return fmt.Errorf("invalid double negative in build constraint: %s", arg)
+ check.pass.Reportf(pos, "invalid double negative in build constraint: %s", arg)
+ check.crossCheck = false
+ continue
}
elem = strings.TrimPrefix(elem, "!")
for _, c := range elem {
if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' {
- return fmt.Errorf("invalid non-alphanumeric build constraint: %s", arg)
+ check.pass.Reportf(pos, "invalid non-alphanumeric build constraint: %s", arg)
+ check.crossCheck = false
+ break
}
}
}
}
- return nil
+
+ if check.crossCheck {
+ y, err := constraint.Parse(line)
+ if err != nil {
+ // Should never happen - constraint.Parse never rejects a // +build line.
+ // Also, we just checked the syntax above.
+ // Even so, report.
+ check.pass.Reportf(pos, "%v", err)
+ check.crossCheck = false
+ return
+ }
+ if check.plusBuild == nil {
+ check.plusBuild = y
+ } else {
+ check.plusBuild = &constraint.AndExpr{X: check.plusBuild, Y: y}
+ }
+ }
}
-var (
- nl = []byte("\n")
- slashSlash = []byte("//")
-)
+func (check *checker) finish() {
+ if !check.crossCheck || check.plusBuildPos == token.NoPos || check.goBuildPos == token.NoPos {
+ return
+ }
+
+ // Have both //go:build and // +build,
+ // with no errors found (crossCheck still true).
+ // Check they match.
+ var want constraint.Expr
+ lines, err := constraint.PlusBuildLines(check.goBuild)
+ if err != nil {
+ check.pass.Reportf(check.goBuildPos, "%v", err)
+ return
+ }
+ for _, line := range lines {
+ y, err := constraint.Parse(line)
+ if err != nil {
+ // Definitely should not happen, but not the user's fault.
+ // Do not report.
+ return
+ }
+ if want == nil {
+ want = y
+ } else {
+ want = &constraint.AndExpr{X: want, Y: y}
+ }
+ }
+ if want.String() != check.plusBuild.String() {
+ check.pass.Reportf(check.plusBuildPos, "+build lines do not match //go:build condition")
+ return
+ }
+}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag_old.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag_old.go
new file mode 100644
index 0000000000..e9234925f9
--- /dev/null
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag/buildtag_old.go
@@ -0,0 +1,174 @@
+// Copyright 2013 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.
+
+// TODO(rsc): Delete this file once Go 1.17 comes out and we can retire Go 1.15 support.
+
+//go:build !go1.16
+// +build !go1.16
+
+// Package buildtag defines an Analyzer that checks build tags.
+package buildtag
+
+import (
+ "bytes"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "strings"
+ "unicode"
+
+ "golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/analysis/passes/internal/analysisutil"
+)
+
+const Doc = "check that +build tags are well-formed and correctly located"
+
+var Analyzer = &analysis.Analyzer{
+ Name: "buildtag",
+ Doc: Doc,
+ Run: runBuildTag,
+}
+
+func runBuildTag(pass *analysis.Pass) (interface{}, error) {
+ for _, f := range pass.Files {
+ checkGoFile(pass, f)
+ }
+ for _, name := range pass.OtherFiles {
+ if err := checkOtherFile(pass, name); err != nil {
+ return nil, err
+ }
+ }
+ for _, name := range pass.IgnoredFiles {
+ if strings.HasSuffix(name, ".go") {
+ f, err := parser.ParseFile(pass.Fset, name, nil, parser.ParseComments)
+ if err != nil {
+ // Not valid Go source code - not our job to diagnose, so ignore.
+ return nil, nil
+ }
+ checkGoFile(pass, f)
+ } else {
+ if err := checkOtherFile(pass, name); err != nil {
+ return nil, err
+ }
+ }
+ }
+ return nil, nil
+}
+
+func checkGoFile(pass *analysis.Pass, f *ast.File) {
+ pastCutoff := false
+ for _, group := range f.Comments {
+ // A +build comment is ignored after or adjoining the package declaration.
+ if group.End()+1 >= f.Package {
+ pastCutoff = true
+ }
+
+ // "+build" is ignored within or after a /*...*/ comment.
+ if !strings.HasPrefix(group.List[0].Text, "//") {
+ pastCutoff = true
+ continue
+ }
+
+ // Check each line of a //-comment.
+ for _, c := range group.List {
+ if !strings.Contains(c.Text, "+build") {
+ continue
+ }
+ if err := checkLine(c.Text, pastCutoff); err != nil {
+ pass.Reportf(c.Pos(), "%s", err)
+ }
+ }
+ }
+}
+
+func checkOtherFile(pass *analysis.Pass, filename string) error {
+ content, tf, err := analysisutil.ReadFile(pass.Fset, filename)
+ if err != nil {
+ return err
+ }
+
+ // We must look at the raw lines, as build tags may appear in non-Go
+ // files such as assembly files.
+ lines := bytes.SplitAfter(content, nl)
+
+ // Determine cutpoint where +build comments are no longer valid.
+ // They are valid in leading // comments in the file followed by
+ // a blank line.
+ //
+ // This must be done as a separate pass because of the
+ // requirement that the comment be followed by a blank line.
+ var cutoff int
+ for i, line := range lines {
+ line = bytes.TrimSpace(line)
+ if !bytes.HasPrefix(line, slashSlash) {
+ if len(line) > 0 {
+ break
+ }
+ cutoff = i
+ }
+ }
+
+ for i, line := range lines {
+ line = bytes.TrimSpace(line)
+ if !bytes.HasPrefix(line, slashSlash) {
+ continue
+ }
+ if !bytes.Contains(line, []byte("+build")) {
+ continue
+ }
+ if err := checkLine(string(line), i >= cutoff); err != nil {
+ pass.Reportf(analysisutil.LineStart(tf, i+1), "%s", err)
+ continue
+ }
+ }
+ return nil
+}
+
+// checkLine checks a line that starts with "//" and contains "+build".
+func checkLine(line string, pastCutoff bool) error {
+ line = strings.TrimPrefix(line, "//")
+ line = strings.TrimSpace(line)
+
+ if strings.HasPrefix(line, "+build") {
+ fields := strings.Fields(line)
+ if fields[0] != "+build" {
+ // Comment is something like +buildasdf not +build.
+ return fmt.Errorf("possible malformed +build comment")
+ }
+ if pastCutoff {
+ return fmt.Errorf("+build comment must appear before package clause and be followed by a blank line")
+ }
+ if err := checkArguments(fields); err != nil {
+ return err
+ }
+ } else {
+ // Comment with +build but not at beginning.
+ if !pastCutoff {
+ return fmt.Errorf("possible malformed +build comment")
+ }
+ }
+ return nil
+}
+
+func checkArguments(fields []string) error {
+ for _, arg := range fields[1:] {
+ for _, elem := range strings.Split(arg, ",") {
+ if strings.HasPrefix(elem, "!!") {
+ return fmt.Errorf("invalid double negative in build constraint: %s", arg)
+ }
+ elem = strings.TrimPrefix(elem, "!")
+ for _, c := range elem {
+ if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' {
+ return fmt.Errorf("invalid non-alphanumeric build constraint: %s", arg)
+ }
+ }
+ }
+ }
+ return nil
+}
+
+var (
+ nl = []byte("\n")
+ slashSlash = []byte("//")
+)
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go
index a14e7eb55d..3ea91574dc 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go
@@ -8,22 +8,14 @@ package loopclosure
import (
"go/ast"
+ "go/types"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
"golang.org/x/tools/go/ast/inspector"
+ "golang.org/x/tools/go/types/typeutil"
)
-// TODO(adonovan): also report an error for the following structure,
-// which is often used to ensure that deferred calls do not accumulate
-// in a loop:
-//
-// for i, x := range c {
-// func() {
-// ...reference to i or x...
-// }()
-// }
-
const Doc = `check references to loop variables from within nested functions
This analyzer checks for references to loop variables from within a
@@ -95,16 +87,19 @@ func run(pass *analysis.Pass) (interface{}, error) {
if len(body.List) == 0 {
return
}
- var last *ast.CallExpr
+ // The function invoked in the last return statement.
+ var fun ast.Expr
switch s := body.List[len(body.List)-1].(type) {
case *ast.GoStmt:
- last = s.Call
+ fun = s.Call.Fun
case *ast.DeferStmt:
- last = s.Call
- default:
- return
+ fun = s.Call.Fun
+ case *ast.ExprStmt: // check for errgroup.Group.Go()
+ if call, ok := s.X.(*ast.CallExpr); ok {
+ fun = goInvokes(pass.TypesInfo, call)
+ }
}
- lit, ok := last.Fun.(*ast.FuncLit)
+ lit, ok := fun.(*ast.FuncLit)
if !ok {
return
}
@@ -128,3 +123,43 @@ func run(pass *analysis.Pass) (interface{}, error) {
})
return nil, nil
}
+
+// goInvokes returns a function expression that would be called asynchronously
+// (but not awaited) in another goroutine as a consequence of the call.
+// For example, given the g.Go call below, it returns the function literal expression.
+//
+// import "sync/errgroup"
+// var g errgroup.Group
+// g.Go(func() error { ... })
+//
+// Currently only "golang.org/x/sync/errgroup.Group()" is considered.
+func goInvokes(info *types.Info, call *ast.CallExpr) ast.Expr {
+ f := typeutil.StaticCallee(info, call)
+ // Note: Currently only supports: golang.org/x/sync/errgroup.Go.
+ if f == nil || f.Name() != "Go" {
+ return nil
+ }
+ recv := f.Type().(*types.Signature).Recv()
+ if recv == nil {
+ return nil
+ }
+ rtype, ok := recv.Type().(*types.Pointer)
+ if !ok {
+ return nil
+ }
+ named, ok := rtype.Elem().(*types.Named)
+ if !ok {
+ return nil
+ }
+ if named.Obj().Name() != "Group" {
+ return nil
+ }
+ pkg := f.Pkg()
+ if pkg == nil {
+ return nil
+ }
+ if pkg.Path() != "golang.org/x/sync/errgroup" {
+ return nil
+ }
+ return call.Args[0]
+}
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
index 713e1380ef..5424489f8b 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go
@@ -97,7 +97,7 @@ func Main(analyzers ...*analysis.Analyzer) {
Usage of %[1]s:
%.16[1]s unit.cfg # execute analysis specified by config file
- %.16[1]s help # general help
+ %.16[1]s help # general help, including listing analyzers and flags
%.16[1]s help name # help on specific analyzer and its flags
`, progname)
os.Exit(1)
diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go
index 9051456e39..3180f4abe1 100644
--- a/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go
+++ b/src/cmd/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker112.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.12
// +build go1.12
package unitchecker
diff --git a/src/cmd/vendor/modules.txt b/src/cmd/vendor/modules.txt
index e033984956..e4dfd32315 100644
--- a/src/cmd/vendor/modules.txt
+++ b/src/cmd/vendor/modules.txt
@@ -28,7 +28,7 @@ golang.org/x/arch/x86/x86asm
golang.org/x/crypto/ed25519
golang.org/x/crypto/ed25519/internal/edwards25519
golang.org/x/crypto/ssh/terminal
-# golang.org/x/mod v0.4.1
+# golang.org/x/mod v0.4.2-0.20210301144719-c8bb1bd8a2aa
## explicit
golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile
@@ -39,12 +39,12 @@ golang.org/x/mod/sumdb/dirhash
golang.org/x/mod/sumdb/note
golang.org/x/mod/sumdb/tlog
golang.org/x/mod/zip
-# golang.org/x/sys v0.0.0-20201204225414-ed752295db88
+# golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e
## explicit
golang.org/x/sys/internal/unsafeheader
golang.org/x/sys/unix
golang.org/x/sys/windows
-# golang.org/x/tools v0.0.0-20210107193943-4ed967dd8eff
+# golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f
## explicit
golang.org/x/tools/go/analysis
golang.org/x/tools/go/analysis/internal/analysisflags
diff --git a/src/cmd/vet/testdata/asm/asm1.s b/src/cmd/vet/testdata/asm/asm1.s
index a5bb6dd0af..050c498d12 100644
--- a/src/cmd/vet/testdata/asm/asm1.s
+++ b/src/cmd/vet/testdata/asm/asm1.s
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64
// +build amd64
TEXT ·arg1(SB),0,$0-2
diff --git a/src/cmd/vet/testdata/buildtag/buildtag.go b/src/cmd/vet/testdata/buildtag/buildtag.go
index c2fd6aaaf2..7371e6ef6f 100644
--- a/src/cmd/vet/testdata/buildtag/buildtag.go
+++ b/src/cmd/vet/testdata/buildtag/buildtag.go
@@ -4,12 +4,14 @@
// This file contains tests for the buildtag checker.
-// +builder // ERROR "possible malformed \+build comment"
+// ERRORNEXT "possible malformed [+]build comment"
+// +builder
// +build !ignore
package testdata
-// +build toolate // ERROR "build comment must appear before package clause and be followed by a blank line$"
+// ERRORNEXT "misplaced \+build comment"
+// +build toolate
var _ = 3
diff --git a/src/cmd/vet/testdata/buildtag/buildtag2.go b/src/cmd/vet/testdata/buildtag/buildtag2.go
new file mode 100644
index 0000000000..d8808dd6a2
--- /dev/null
+++ b/src/cmd/vet/testdata/buildtag/buildtag2.go
@@ -0,0 +1,22 @@
+// Copyright 2013 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.
+
+// This file contains tests for the buildtag checker.
+
+// ERRORNEXT "possible malformed [+]build comment"
+// +builder
+// +build !ignore
+
+package testdata
+
+// ERRORNEXT "misplaced \+build comment"
+// +build toolate
+// ERRORNEXT "misplaced //go:build comment"
+//go:build toolate
+
+var _ = 3
+
+var _ = `
+// +build notacomment
+`
diff --git a/src/cmd/vet/testdata/buildtag/buildtag3.go b/src/cmd/vet/testdata/buildtag/buildtag3.go
new file mode 100644
index 0000000000..241a7dbaac
--- /dev/null
+++ b/src/cmd/vet/testdata/buildtag/buildtag3.go
@@ -0,0 +1,15 @@
+// Copyright 2020 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.
+
+// This file contains tests for the buildtag checker.
+
+//go:build good
+// ERRORNEXT "[+]build lines do not match //go:build condition"
+// +build bad
+
+package testdata
+
+var _ = `
+// +build notacomment
+`
diff --git a/src/cmd/vet/testdata/buildtag/buildtag4.go b/src/cmd/vet/testdata/buildtag/buildtag4.go
new file mode 100644
index 0000000000..5b40d6951b
--- /dev/null
+++ b/src/cmd/vet/testdata/buildtag/buildtag4.go
@@ -0,0 +1,11 @@
+// Copyright 2020 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.
+
+// This file contains tests for the buildtag checker.
+
+//go:build !(bad || worse)
+// +build !bad
+// +build !worse
+
+package testdata
diff --git a/src/cmd/vet/testdata/buildtag/buildtag5.go b/src/cmd/vet/testdata/buildtag/buildtag5.go
new file mode 100644
index 0000000000..12aeb82b9b
--- /dev/null
+++ b/src/cmd/vet/testdata/buildtag/buildtag5.go
@@ -0,0 +1,11 @@
+// Copyright 2020 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.
+
+// This file contains tests for the buildtag checker.
+
+//go:build !(bad || worse)
+
+package testdata
+
+// +build other // ERROR "misplaced \+build comment"
diff --git a/src/io/ioutil/export_test.go b/src/cmd/vet/testdata/buildtag/buildtag6.s
index dff55f07e2..40fe14c5d6 100644
--- a/src/io/ioutil/export_test.go
+++ b/src/cmd/vet/testdata/buildtag/buildtag6.s
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package ioutil
+#include "go_asm.h"
+
+// ok because we cannot parse assembly files.
+// +build no
-var ErrPatternHasSeparator = errPatternHasSeparator
diff --git a/src/cmd/vet/testdata/buildtag/buildtag7.s b/src/cmd/vet/testdata/buildtag/buildtag7.s
new file mode 100644
index 0000000000..b622d48f1b
--- /dev/null
+++ b/src/cmd/vet/testdata/buildtag/buildtag7.s
@@ -0,0 +1,11 @@
+// Copyright 2020 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.
+
+// +build ignore
+
+#include "go_asm.h"
+
+// ok because we cannot parse assembly files
+// the assembler would complain if we did assemble this file.
+//go:build no
diff --git a/src/cmd/vet/testdata/tagtest/file1.go b/src/cmd/vet/testdata/tagtest/file1.go
index 47fe3c80af..2204524821 100644
--- a/src/cmd/vet/testdata/tagtest/file1.go
+++ b/src/cmd/vet/testdata/tagtest/file1.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build testtag
// +build testtag
package main
diff --git a/src/cmd/vet/testdata/tagtest/file2.go b/src/cmd/vet/testdata/tagtest/file2.go
index 1f45efcbf2..979b0d451d 100644
--- a/src/cmd/vet/testdata/tagtest/file2.go
+++ b/src/cmd/vet/testdata/tagtest/file2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !testtag
// +build !testtag
package main
diff --git a/src/cmd/vet/vet_test.go b/src/cmd/vet/vet_test.go
index d15d1ce377..50dd0735fa 100644
--- a/src/cmd/vet/vet_test.go
+++ b/src/cmd/vet/vet_test.go
@@ -334,8 +334,8 @@ type wantedError struct {
}
var (
- errRx = regexp.MustCompile(`// (?:GC_)?ERROR (.*)`)
- errAutoRx = regexp.MustCompile(`// (?:GC_)?ERRORAUTO (.*)`)
+ errRx = regexp.MustCompile(`// (?:GC_)?ERROR(NEXT)? (.*)`)
+ errAutoRx = regexp.MustCompile(`// (?:GC_)?ERRORAUTO(NEXT)? (.*)`)
errQuotesRx = regexp.MustCompile(`"([^"]*)"`)
lineRx = regexp.MustCompile(`LINE(([+-])([0-9]+))?`)
)
@@ -364,7 +364,10 @@ func wantedErrors(file, short string) (errs []wantedError) {
if m == nil {
continue
}
- all := m[1]
+ if m[1] == "NEXT" {
+ lineNum++
+ }
+ all := m[2]
mm := errQuotesRx.FindAllStringSubmatch(all, -1)
if mm == nil {
log.Fatalf("%s:%d: invalid errchk line: %s", file, lineNum, line)
diff --git a/src/context/benchmark_test.go b/src/context/benchmark_test.go
index 5d56863050..69d75fff18 100644
--- a/src/context/benchmark_test.go
+++ b/src/context/benchmark_test.go
@@ -138,3 +138,17 @@ func BenchmarkCheckCanceled(b *testing.B) {
}
})
}
+
+func BenchmarkContextCancelDone(b *testing.B) {
+ ctx, cancel := WithCancel(Background())
+ defer cancel()
+
+ b.RunParallel(func(pb *testing.PB) {
+ for pb.Next() {
+ select {
+ case <-ctx.Done():
+ default:
+ }
+ }
+ })
+}
diff --git a/src/context/context.go b/src/context/context.go
index b3fdb8277a..733c5f56d9 100644
--- a/src/context/context.go
+++ b/src/context/context.go
@@ -303,10 +303,8 @@ func parentCancelCtx(parent Context) (*cancelCtx, bool) {
if !ok {
return nil, false
}
- p.mu.Lock()
- ok = p.done == done
- p.mu.Unlock()
- if !ok {
+ pdone, _ := p.done.Load().(chan struct{})
+ if pdone != done {
return nil, false
}
return p, true
@@ -345,7 +343,7 @@ type cancelCtx struct {
Context
mu sync.Mutex // protects following fields
- done chan struct{} // created lazily, closed by first cancel call
+ done atomic.Value // of chan struct{}, created lazily, closed by first cancel call
children map[canceler]struct{} // set to nil by the first cancel call
err error // set to non-nil by the first cancel call
}
@@ -358,13 +356,18 @@ func (c *cancelCtx) Value(key interface{}) interface{} {
}
func (c *cancelCtx) Done() <-chan struct{} {
+ d := c.done.Load()
+ if d != nil {
+ return d.(chan struct{})
+ }
c.mu.Lock()
- if c.done == nil {
- c.done = make(chan struct{})
+ defer c.mu.Unlock()
+ d = c.done.Load()
+ if d == nil {
+ d = make(chan struct{})
+ c.done.Store(d)
}
- d := c.done
- c.mu.Unlock()
- return d
+ return d.(chan struct{})
}
func (c *cancelCtx) Err() error {
@@ -401,10 +404,11 @@ func (c *cancelCtx) cancel(removeFromParent bool, err error) {
return // already canceled
}
c.err = err
- if c.done == nil {
- c.done = closedchan
+ d, _ := c.done.Load().(chan struct{})
+ if d == nil {
+ c.done.Store(closedchan)
} else {
- close(c.done)
+ close(d)
}
for child := range c.children {
// NOTE: acquiring the child's lock while holding parent's lock.
diff --git a/src/context/context_test.go b/src/context/context_test.go
index 6b392a29da..84eef01da1 100644
--- a/src/context/context_test.go
+++ b/src/context/context_test.go
@@ -525,7 +525,7 @@ func XTestInterlockedCancels(t testingT) {
parent, cancelParent := WithCancel(Background())
child, cancelChild := WithCancel(parent)
go func() {
- parent.Done()
+ <-parent.Done()
cancelChild()
}()
cancelParent()
diff --git a/src/crypto/aes/aes_gcm.go b/src/crypto/aes/aes_gcm.go
index 49b78c3a8b..1de0e457a2 100644
--- a/src/crypto/aes/aes_gcm.go
+++ b/src/crypto/aes/aes_gcm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm64
// +build amd64 arm64
package aes
diff --git a/src/crypto/aes/cipher_asm.go b/src/crypto/aes/cipher_asm.go
index 646bdfa5c0..4251805ef9 100644
--- a/src/crypto/aes/cipher_asm.go
+++ b/src/crypto/aes/cipher_asm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm64
// +build amd64 arm64
package aes
diff --git a/src/crypto/aes/cipher_generic.go b/src/crypto/aes/cipher_generic.go
index 80a68b4ef0..22ce3be7f3 100644
--- a/src/crypto/aes/cipher_generic.go
+++ b/src/crypto/aes/cipher_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !s390x && !ppc64le && !arm64
// +build !amd64,!s390x,!ppc64le,!arm64
package aes
diff --git a/src/crypto/aes/gcm_ppc64le.go b/src/crypto/aes/gcm_ppc64le.go
index 084edddc4d..01b4e08757 100644
--- a/src/crypto/aes/gcm_ppc64le.go
+++ b/src/crypto/aes/gcm_ppc64le.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64le
// +build ppc64le
package aes
diff --git a/src/crypto/cipher/xor_generic.go b/src/crypto/cipher/xor_generic.go
index ca9c4bbf39..03208402d7 100644
--- a/src/crypto/cipher/xor_generic.go
+++ b/src/crypto/cipher/xor_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !ppc64 && !ppc64le && !arm64
// +build !amd64,!ppc64,!ppc64le,!arm64
package cipher
diff --git a/src/crypto/cipher/xor_ppc64x.go b/src/crypto/cipher/xor_ppc64x.go
index 8d2e43d327..f520208a37 100644
--- a/src/crypto/cipher/xor_ppc64x.go
+++ b/src/crypto/cipher/xor_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package cipher
diff --git a/src/crypto/ecdsa/ecdsa_noasm.go b/src/crypto/ecdsa/ecdsa_noasm.go
index 72196211e5..68670a4f93 100644
--- a/src/crypto/ecdsa/ecdsa_noasm.go
+++ b/src/crypto/ecdsa/ecdsa_noasm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !s390x
// +build !s390x
package ecdsa
diff --git a/src/crypto/ecdsa/ecdsa_s390x_test.go b/src/crypto/ecdsa/ecdsa_s390x_test.go
index a434575dbc..e8b16b3668 100644
--- a/src/crypto/ecdsa/ecdsa_s390x_test.go
+++ b/src/crypto/ecdsa/ecdsa_s390x_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x
// +build s390x
package ecdsa
diff --git a/src/crypto/elliptic/fuzz_test.go b/src/crypto/elliptic/fuzz_test.go
index b9209a789b..f5c9841a12 100644
--- a/src/crypto/elliptic/fuzz_test.go
+++ b/src/crypto/elliptic/fuzz_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm64 || ppc64le
// +build amd64 arm64 ppc64le
package elliptic
diff --git a/src/crypto/elliptic/p256.go b/src/crypto/elliptic/p256.go
index c23e414156..3bb7bb70b6 100644
--- a/src/crypto/elliptic/p256.go
+++ b/src/crypto/elliptic/p256.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !arm64
// +build !amd64,!arm64
package elliptic
diff --git a/src/crypto/elliptic/p256_asm.go b/src/crypto/elliptic/p256_asm.go
index 6cf7742e1b..c405718b5e 100644
--- a/src/crypto/elliptic/p256_asm.go
+++ b/src/crypto/elliptic/p256_asm.go
@@ -10,6 +10,7 @@
// https://link.springer.com/article/10.1007%2Fs13389-014-0090-x
// https://eprint.iacr.org/2013/816.pdf
+//go:build amd64 || arm64
// +build amd64 arm64
package elliptic
diff --git a/src/crypto/elliptic/p256_generic.go b/src/crypto/elliptic/p256_generic.go
index f74c607a88..8ad56638e9 100644
--- a/src/crypto/elliptic/p256_generic.go
+++ b/src/crypto/elliptic/p256_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !s390x && !arm64 && !ppc64le
// +build !amd64,!s390x,!arm64,!ppc64le
package elliptic
diff --git a/src/crypto/elliptic/p256_ppc64le.go b/src/crypto/elliptic/p256_ppc64le.go
index 160bdb12e3..40d9ed9d40 100644
--- a/src/crypto/elliptic/p256_ppc64le.go
+++ b/src/crypto/elliptic/p256_ppc64le.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64le
// +build ppc64le
package elliptic
diff --git a/src/crypto/elliptic/p256_s390x.go b/src/crypto/elliptic/p256_s390x.go
index 0d9478bfd6..91e613b631 100644
--- a/src/crypto/elliptic/p256_s390x.go
+++ b/src/crypto/elliptic/p256_s390x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x
// +build s390x
package elliptic
diff --git a/src/crypto/internal/subtle/aliasing.go b/src/crypto/internal/subtle/aliasing.go
index 812ce3c655..86e0f3cfe7 100644
--- a/src/crypto/internal/subtle/aliasing.go
+++ b/src/crypto/internal/subtle/aliasing.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !appengine
// +build !appengine
// Package subtle implements functions that are often useful in cryptographic
diff --git a/src/crypto/internal/subtle/aliasing_appengine.go b/src/crypto/internal/subtle/aliasing_appengine.go
index 844f901d18..35b442f7a2 100644
--- a/src/crypto/internal/subtle/aliasing_appengine.go
+++ b/src/crypto/internal/subtle/aliasing_appengine.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build appengine
// +build appengine
// Package subtle implements functions that are often useful in cryptographic
diff --git a/src/crypto/md5/gen.go b/src/crypto/md5/gen.go
index 1468924cbc..29729fad01 100644
--- a/src/crypto/md5/gen.go
+++ b/src/crypto/md5/gen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This program generates md5block.go
diff --git a/src/crypto/md5/md5block_decl.go b/src/crypto/md5/md5block_decl.go
index f251e03d7f..bc2d58c069 100644
--- a/src/crypto/md5/md5block_decl.go
+++ b/src/crypto/md5/md5block_decl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || 386 || arm || ppc64le || ppc64 || s390x || arm64
// +build amd64 386 arm ppc64le ppc64 s390x arm64
package md5
diff --git a/src/crypto/md5/md5block_generic.go b/src/crypto/md5/md5block_generic.go
index 0b46e70b60..ea4fbcd0b4 100644
--- a/src/crypto/md5/md5block_generic.go
+++ b/src/crypto/md5/md5block_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !386 && !arm && !ppc64le && !ppc64 && !s390x && !arm64
// +build !amd64,!386,!arm,!ppc64le,!ppc64,!s390x,!arm64
package md5
diff --git a/src/crypto/rand/eagain.go b/src/crypto/rand/eagain.go
index c9499715dc..85d4d9d47f 100644
--- a/src/crypto/rand/eagain.go
+++ b/src/crypto/rand/eagain.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package rand
diff --git a/src/crypto/rand/rand_batched.go b/src/crypto/rand/rand_batched.go
index 60267fd4bc..45e9351a31 100644
--- a/src/crypto/rand/rand_batched.go
+++ b/src/crypto/rand/rand_batched.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux || freebsd
// +build linux freebsd
package rand
diff --git a/src/crypto/rand/rand_batched_test.go b/src/crypto/rand/rand_batched_test.go
index 837db83f77..fd50735c7d 100644
--- a/src/crypto/rand/rand_batched_test.go
+++ b/src/crypto/rand/rand_batched_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux || freebsd
// +build linux freebsd
package rand
diff --git a/src/crypto/rand/rand_js.go b/src/crypto/rand/rand_js.go
index 7e939742ac..7ddc2b6169 100644
--- a/src/crypto/rand/rand_js.go
+++ b/src/crypto/rand/rand_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package rand
diff --git a/src/crypto/rand/rand_unix.go b/src/crypto/rand/rand_unix.go
index 548a5e4cb9..81277eb6a5 100644
--- a/src/crypto/rand/rand_unix.go
+++ b/src/crypto/rand/rand_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || plan9 || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9 solaris
// Unix cryptographically secure pseudorandom number
diff --git a/src/crypto/sha1/fallback_test.go b/src/crypto/sha1/fallback_test.go
index 08acd044d0..4bb8b3324f 100644
--- a/src/crypto/sha1/fallback_test.go
+++ b/src/crypto/sha1/fallback_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x
// +build s390x
package sha1
diff --git a/src/crypto/sha1/issue15617_test.go b/src/crypto/sha1/issue15617_test.go
index 98038e5807..436f78c745 100644
--- a/src/crypto/sha1/issue15617_test.go
+++ b/src/crypto/sha1/issue15617_test.go
@@ -1,3 +1,4 @@
+//go:build amd64 && (linux || darwin)
// +build amd64
// +build linux darwin
diff --git a/src/crypto/sha1/sha1block_decl.go b/src/crypto/sha1/sha1block_decl.go
index 9c7df4e40a..93054efa7c 100644
--- a/src/crypto/sha1/sha1block_decl.go
+++ b/src/crypto/sha1/sha1block_decl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm || 386 || s390x
// +build arm 386 s390x
package sha1
diff --git a/src/crypto/sha1/sha1block_generic.go b/src/crypto/sha1/sha1block_generic.go
index f95ea0eee4..feaba5a23a 100644
--- a/src/crypto/sha1/sha1block_generic.go
+++ b/src/crypto/sha1/sha1block_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !386 && !arm && !s390x && !arm64
// +build !amd64,!386,!arm,!s390x,!arm64
package sha1
diff --git a/src/crypto/sha256/fallback_test.go b/src/crypto/sha256/fallback_test.go
index 5917a4862a..7ce88cbb2a 100644
--- a/src/crypto/sha256/fallback_test.go
+++ b/src/crypto/sha256/fallback_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x
// +build s390x
package sha256
diff --git a/src/crypto/sha256/sha256block_decl.go b/src/crypto/sha256/sha256block_decl.go
index fe07e53b84..a6bb396f13 100644
--- a/src/crypto/sha256/sha256block_decl.go
+++ b/src/crypto/sha256/sha256block_decl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || amd64 || s390x || ppc64le
// +build 386 amd64 s390x ppc64le
package sha256
diff --git a/src/crypto/sha256/sha256block_generic.go b/src/crypto/sha256/sha256block_generic.go
index 61362f4126..620c048b93 100644
--- a/src/crypto/sha256/sha256block_generic.go
+++ b/src/crypto/sha256/sha256block_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !386 && !s390x && !ppc64le && !arm64
// +build !amd64,!386,!s390x,!ppc64le,!arm64
package sha256
diff --git a/src/crypto/sha512/fallback_test.go b/src/crypto/sha512/fallback_test.go
index 9024ce668a..faf732670a 100644
--- a/src/crypto/sha512/fallback_test.go
+++ b/src/crypto/sha512/fallback_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x
// +build s390x
package sha512
diff --git a/src/crypto/sha512/sha512block_amd64.go b/src/crypto/sha512/sha512block_amd64.go
index 18151cea24..e2386f29ab 100644
--- a/src/crypto/sha512/sha512block_amd64.go
+++ b/src/crypto/sha512/sha512block_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64
// +build amd64
package sha512
diff --git a/src/crypto/sha512/sha512block_decl.go b/src/crypto/sha512/sha512block_decl.go
index 613d1e02a3..6c22f44801 100644
--- a/src/crypto/sha512/sha512block_decl.go
+++ b/src/crypto/sha512/sha512block_decl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x || ppc64le
// +build s390x ppc64le
package sha512
diff --git a/src/crypto/sha512/sha512block_generic.go b/src/crypto/sha512/sha512block_generic.go
index 3eabd2c7c0..865a7356f1 100644
--- a/src/crypto/sha512/sha512block_generic.go
+++ b/src/crypto/sha512/sha512block_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !s390x && !ppc64le
// +build !amd64,!s390x,!ppc64le
package sha512
diff --git a/src/crypto/tls/generate_cert.go b/src/crypto/tls/generate_cert.go
index 1857185fe4..7ea90f8a7b 100644
--- a/src/crypto/tls/generate_cert.go
+++ b/src/crypto/tls/generate_cert.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generate a self-signed X.509 certificate for a TLS server. Outputs to
diff --git a/src/crypto/tls/handshake_client_test.go b/src/crypto/tls/handshake_client_test.go
index 12b0254123..0e6c5a6370 100644
--- a/src/crypto/tls/handshake_client_test.go
+++ b/src/crypto/tls/handshake_client_test.go
@@ -1528,7 +1528,7 @@ func testVerifyConnection(t *testing.T, version uint16) {
}
if c.DidResume {
return nil
- // The SCTs and OCSP Responce are dropped on resumption.
+ // The SCTs and OCSP Response are dropped on resumption.
// See http://golang.org/issue/39075.
}
if len(c.OCSPResponse) == 0 {
@@ -1569,7 +1569,7 @@ func testVerifyConnection(t *testing.T, version uint16) {
}
if c.DidResume {
return nil
- // The SCTs and OCSP Responce are dropped on resumption.
+ // The SCTs and OCSP Response are dropped on resumption.
// See http://golang.org/issue/39075.
}
if len(c.OCSPResponse) == 0 {
@@ -1619,7 +1619,7 @@ func testVerifyConnection(t *testing.T, version uint16) {
}
if c.DidResume {
return nil
- // The SCTs and OCSP Responce are dropped on resumption.
+ // The SCTs and OCSP Response are dropped on resumption.
// See http://golang.org/issue/39075.
}
if len(c.OCSPResponse) == 0 {
diff --git a/src/crypto/tls/handshake_unix_test.go b/src/crypto/tls/handshake_unix_test.go
index 72718544ae..19fc698676 100644
--- a/src/crypto/tls/handshake_unix_test.go
+++ b/src/crypto/tls/handshake_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package tls
diff --git a/src/crypto/x509/internal/macos/corefoundation.go b/src/crypto/x509/internal/macos/corefoundation.go
index 0572c6ccd8..abcdcdd91e 100644
--- a/src/crypto/x509/internal/macos/corefoundation.go
+++ b/src/crypto/x509/internal/macos/corefoundation.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin && !ios
// +build darwin,!ios
// Package macOS provides cgo-less wrappers for Core Foundation and
diff --git a/src/crypto/x509/internal/macos/corefoundation.s b/src/crypto/x509/internal/macos/corefoundation.s
index a4495d68dd..1ce39fac9d 100644
--- a/src/crypto/x509/internal/macos/corefoundation.s
+++ b/src/crypto/x509/internal/macos/corefoundation.s
@@ -6,21 +6,24 @@
#include "textflag.h"
-TEXT ·x509_CFArrayGetCount_trampoline(SB),NOSPLIT,$0-0
+// The trampolines are ABIInternal as they are address-taken in
+// Go code.
+
+TEXT ·x509_CFArrayGetCount_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFArrayGetCount(SB)
-TEXT ·x509_CFArrayGetValueAtIndex_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFArrayGetValueAtIndex_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFArrayGetValueAtIndex(SB)
-TEXT ·x509_CFDataGetBytePtr_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFDataGetBytePtr_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFDataGetBytePtr(SB)
-TEXT ·x509_CFDataGetLength_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFDataGetLength_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFDataGetLength(SB)
-TEXT ·x509_CFStringCreateWithBytes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFStringCreateWithBytes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFStringCreateWithBytes(SB)
-TEXT ·x509_CFRelease_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFRelease_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFRelease(SB)
-TEXT ·x509_CFDictionaryGetValueIfPresent_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFDictionaryGetValueIfPresent_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFDictionaryGetValueIfPresent(SB)
-TEXT ·x509_CFNumberGetValue_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFNumberGetValue_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFNumberGetValue(SB)
-TEXT ·x509_CFEqual_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_CFEqual_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_CFEqual(SB)
diff --git a/src/crypto/x509/internal/macos/security.go b/src/crypto/x509/internal/macos/security.go
index 3163e3a4f7..f346ff4c7f 100644
--- a/src/crypto/x509/internal/macos/security.go
+++ b/src/crypto/x509/internal/macos/security.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin && !ios
// +build darwin,!ios
package macOS
diff --git a/src/crypto/x509/internal/macos/security.s b/src/crypto/x509/internal/macos/security.s
index bd446dbcbe..bea265a5ef 100644
--- a/src/crypto/x509/internal/macos/security.s
+++ b/src/crypto/x509/internal/macos/security.s
@@ -6,11 +6,14 @@
#include "textflag.h"
-TEXT ·x509_SecTrustSettingsCopyCertificates_trampoline(SB),NOSPLIT,$0-0
+// The trampolines are ABIInternal as they are address-taken in
+// Go code.
+
+TEXT ·x509_SecTrustSettingsCopyCertificates_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_SecTrustSettingsCopyCertificates(SB)
-TEXT ·x509_SecItemExport_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_SecItemExport_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_SecItemExport(SB)
-TEXT ·x509_SecTrustSettingsCopyTrustSettings_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_SecTrustSettingsCopyTrustSettings_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_SecTrustSettingsCopyTrustSettings(SB)
-TEXT ·x509_SecPolicyCopyProperties_trampoline(SB),NOSPLIT,$0-0
+TEXT ·x509_SecPolicyCopyProperties_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP x509_SecPolicyCopyProperties(SB)
diff --git a/src/crypto/x509/root_bsd.go b/src/crypto/x509/root_bsd.go
index f04b6bd0d6..822e8573ff 100644
--- a/src/crypto/x509/root_bsd.go
+++ b/src/crypto/x509/root_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || netbsd || openbsd
// +build dragonfly freebsd netbsd openbsd
package x509
diff --git a/src/crypto/x509/root_darwin.go b/src/crypto/x509/root_darwin.go
index c9ea7e80f3..05593bb105 100644
--- a/src/crypto/x509/root_darwin.go
+++ b/src/crypto/x509/root_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !ios
// +build !ios
package x509
diff --git a/src/crypto/x509/root_ios.go b/src/crypto/x509/root_ios.go
index d2dfb62b77..50432f3d2c 100644
--- a/src/crypto/x509/root_ios.go
+++ b/src/crypto/x509/root_ios.go
@@ -1,8 +1,8 @@
// Code generated by root_ios_gen.go -version 55188.40.9; DO NOT EDIT.
// Update the version in root.go and regenerate with "go generate".
-// +build ios
-// +build !x509omitbundledroots
+//go:build ios && !x509omitbundledroots
+// +build ios,!x509omitbundledroots
package x509
diff --git a/src/crypto/x509/root_ios_gen.go b/src/crypto/x509/root_ios_gen.go
index 8bc6e7d9c4..05bd672d5d 100644
--- a/src/crypto/x509/root_ios_gen.go
+++ b/src/crypto/x509/root_ios_gen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generates root_ios.go.
diff --git a/src/crypto/x509/root_js.go b/src/crypto/x509/root_js.go
index 4e537a4fe5..f2c2c0af38 100644
--- a/src/crypto/x509/root_js.go
+++ b/src/crypto/x509/root_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package x509
diff --git a/src/crypto/x509/root_omit.go b/src/crypto/x509/root_omit.go
index 0055b3b862..81f2f112d0 100644
--- a/src/crypto/x509/root_omit.go
+++ b/src/crypto/x509/root_omit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ((darwin && arm64) || (darwin && amd64 && ios)) && x509omitbundledroots
// +build darwin,arm64 darwin,amd64,ios
// +build x509omitbundledroots
diff --git a/src/crypto/x509/root_omit_test.go b/src/crypto/x509/root_omit_test.go
index 5ab6c931de..158bd7f91a 100644
--- a/src/crypto/x509/root_omit_test.go
+++ b/src/crypto/x509/root_omit_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ((darwin && arm64) || (darwin && amd64 && ios)) && x509omitbundledroots
// +build darwin,arm64 darwin,amd64,ios
// +build x509omitbundledroots
diff --git a/src/crypto/x509/root_plan9.go b/src/crypto/x509/root_plan9.go
index 2dc4aaf5d7..2bdb2fe713 100644
--- a/src/crypto/x509/root_plan9.go
+++ b/src/crypto/x509/root_plan9.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package x509
diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go
index 262fc079d5..dede825edd 100644
--- a/src/crypto/x509/root_unix.go
+++ b/src/crypto/x509/root_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris
package x509
diff --git a/src/crypto/x509/root_unix_test.go b/src/crypto/x509/root_unix_test.go
index 878ed7c2fa..38038a65f3 100644
--- a/src/crypto/x509/root_unix_test.go
+++ b/src/crypto/x509/root_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build dragonfly freebsd linux netbsd openbsd solaris
package x509
diff --git a/src/crypto/x509/x509_test_import.go b/src/crypto/x509/x509_test_import.go
index b778df261a..ef3ee807bf 100644
--- a/src/crypto/x509/x509_test_import.go
+++ b/src/crypto/x509/x509_test_import.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This file is run by the x509 tests to ensure that a program with minimal
diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go
index 5bbcf20db2..f09396175a 100644
--- a/src/database/sql/driver/driver.go
+++ b/src/database/sql/driver/driver.go
@@ -115,6 +115,9 @@ type DriverContext interface {
// DriverContext's OpenConnector method, to allow drivers
// access to context and to avoid repeated parsing of driver
// configuration.
+//
+// If a Connector implements io.Closer, the sql package's DB.Close
+// method will call Close and return error (if any).
type Connector interface {
// Connect returns a connection to the database.
// Connect may return a cached connection (one previously
diff --git a/src/database/sql/fakedb_test.go b/src/database/sql/fakedb_test.go
index 7605a2a6d2..1bfd1118aa 100644
--- a/src/database/sql/fakedb_test.go
+++ b/src/database/sql/fakedb_test.go
@@ -56,6 +56,7 @@ type fakeConnector struct {
name string
waiter func(context.Context)
+ closed bool
}
func (c *fakeConnector) Connect(context.Context) (driver.Conn, error) {
@@ -68,6 +69,14 @@ func (c *fakeConnector) Driver() driver.Driver {
return fdriver
}
+func (c *fakeConnector) Close() error {
+ if c.closed {
+ return errors.New("fakedb: connector is closed")
+ }
+ c.closed = true
+ return nil
+}
+
type fakeDriverCtx struct {
fakeDriver
}
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index 726aadb899..37bcb0d091 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -850,6 +850,12 @@ func (db *DB) Close() error {
}
}
db.stop()
+ if c, ok := db.connector.(io.Closer); ok {
+ err1 := c.Close()
+ if err1 != nil {
+ err = err1
+ }
+ }
return err
}
diff --git a/src/database/sql/sql_test.go b/src/database/sql/sql_test.go
index c968852ade..c06e565ea9 100644
--- a/src/database/sql/sql_test.go
+++ b/src/database/sql/sql_test.go
@@ -431,25 +431,24 @@ func TestTxContextWait(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)
- ctx, cancel := context.WithTimeout(context.Background(), 15*time.Millisecond)
- defer cancel()
+ ctx, cancel := context.WithCancel(context.Background())
tx, err := db.BeginTx(ctx, nil)
if err != nil {
- // Guard against the context being canceled before BeginTx completes.
- if err == context.DeadlineExceeded {
- t.Skip("tx context canceled prior to first use")
- }
t.Fatal(err)
}
tx.keepConnOnRollback = false
+ go func() {
+ time.Sleep(15 * time.Millisecond)
+ cancel()
+ }()
// This will trigger the *fakeConn.Prepare method which will take time
// performing the query. The ctxDriverPrepare func will check the context
// after this and close the rows and return an error.
_, err = tx.QueryContext(ctx, "WAIT|1s|SELECT|people|age,name|")
- if err != context.DeadlineExceeded {
- t.Fatalf("expected QueryContext to error with context deadline exceeded but returned %v", err)
+ if err != context.Canceled {
+ t.Fatalf("expected QueryContext to error with context canceled but returned %v", err)
}
waitForFree(t, db, 5*time.Second, 0)
@@ -4060,9 +4059,18 @@ func TestOpenConnector(t *testing.T) {
}
defer db.Close()
- if _, is := db.connector.(*fakeConnector); !is {
+ c, ok := db.connector.(*fakeConnector)
+ if !ok {
t.Fatal("not using *fakeConnector")
}
+
+ if err := db.Close(); err != nil {
+ t.Fatal(err)
+ }
+
+ if !c.closed {
+ t.Fatal("connector is not closed")
+ }
}
type ctxOnlyDriver struct {
diff --git a/src/debug/elf/elf.go b/src/debug/elf/elf.go
index 2b777eabac..b04d874019 100644
--- a/src/debug/elf/elf.go
+++ b/src/debug/elf/elf.go
@@ -644,6 +644,7 @@ const (
SHT_GNU_VERSYM SectionType = 0x6fffffff /* GNU version symbol table */
SHT_HIOS SectionType = 0x6fffffff /* Last of OS specific semantics */
SHT_LOPROC SectionType = 0x70000000 /* reserved range for processor */
+ SHT_MIPS_ABIFLAGS SectionType = 0x7000002a /* .MIPS.abiflags */
SHT_HIPROC SectionType = 0x7fffffff /* specific section header types */
SHT_LOUSER SectionType = 0x80000000 /* reserved range for application */
SHT_HIUSER SectionType = 0xffffffff /* specific indexes */
@@ -675,6 +676,7 @@ var shtStrings = []intName{
{0x6ffffffe, "SHT_GNU_VERNEED"},
{0x6fffffff, "SHT_GNU_VERSYM"},
{0x70000000, "SHT_LOPROC"},
+ {0x7000002a, "SHT_MIPS_ABIFLAGS"},
{0x7fffffff, "SHT_HIPROC"},
{0x80000000, "SHT_LOUSER"},
{0xffffffff, "SHT_HIUSER"},
diff --git a/src/debug/pe/file.go b/src/debug/pe/file.go
index 7d763fff19..e50229e5a3 100644
--- a/src/debug/pe/file.go
+++ b/src/debug/pe/file.go
@@ -75,7 +75,7 @@ func NewFile(r io.ReaderAt) (*File, error) {
var sign [4]byte
r.ReadAt(sign[:], signoff)
if !(sign[0] == 'P' && sign[1] == 'E' && sign[2] == 0 && sign[3] == 0) {
- return nil, fmt.Errorf("Invalid PE COFF file signature of %v.", sign)
+ return nil, fmt.Errorf("invalid PE file signature: % x", sign)
}
base = signoff + 4
} else {
@@ -86,9 +86,14 @@ func NewFile(r io.ReaderAt) (*File, error) {
return nil, err
}
switch f.FileHeader.Machine {
- case IMAGE_FILE_MACHINE_UNKNOWN, IMAGE_FILE_MACHINE_ARMNT, IMAGE_FILE_MACHINE_AMD64, IMAGE_FILE_MACHINE_I386:
+ case IMAGE_FILE_MACHINE_AMD64,
+ IMAGE_FILE_MACHINE_ARM64,
+ IMAGE_FILE_MACHINE_ARMNT,
+ IMAGE_FILE_MACHINE_I386,
+ IMAGE_FILE_MACHINE_UNKNOWN:
+ // ok
default:
- return nil, fmt.Errorf("Unrecognised COFF file header machine value of 0x%x.", f.FileHeader.Machine)
+ return nil, fmt.Errorf("unrecognized PE machine: %#x", f.FileHeader.Machine)
}
var err error
@@ -112,7 +117,7 @@ func NewFile(r io.ReaderAt) (*File, error) {
// Seek past file header.
_, err = sr.Seek(base+int64(binary.Size(f.FileHeader)), seekStart)
if err != nil {
- return nil, fmt.Errorf("failure to seek past the file header: %v", err)
+ return nil, err
}
// Read optional header.
@@ -309,7 +314,7 @@ func (f *File) ImportedSymbols() ([]string, error) {
return nil, nil
}
- pe64 := f.Machine == IMAGE_FILE_MACHINE_AMD64
+ pe64 := f.Machine == IMAGE_FILE_MACHINE_AMD64 || f.Machine == IMAGE_FILE_MACHINE_ARM64
// grab the number of data directory entries
var dd_length uint32
diff --git a/src/debug/pe/file_cgo_test.go b/src/debug/pe/file_cgo_test.go
index 739671d73f..bba3a068d6 100644
--- a/src/debug/pe/file_cgo_test.go
+++ b/src/debug/pe/file_cgo_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo
// +build cgo
package pe
diff --git a/src/embed/embed.go b/src/embed/embed.go
index 5f984aaf71..7f2719d2a7 100644
--- a/src/embed/embed.go
+++ b/src/embed/embed.go
@@ -61,12 +61,15 @@
// The Go build system will recognize the directives and arrange for the declared variable
// (in the example above, content) to be populated with the matching files from the file system.
//
-// The //go:embed directive accepts multiple space-separated patterns for brevity,
-// but it can also be repeated, to avoid very long lines when there are many patterns.
-// The patterns are interpreted relative to the package directory containing the source file.
-// The path separator is a forward slash, even on Windows systems.
-// To allow for naming files with spaces in their names, patterns can be written
-// as Go double-quoted or back-quoted string literals.
+// The //go:embed directive accepts multiple space-separated patterns for
+// brevity, but it can also be repeated, to avoid very long lines when there are
+// many patterns. The patterns are interpreted relative to the package directory
+// containing the source file. The path separator is a forward slash, even on
+// Windows systems. Patterns may not contain ‘.’ or ‘..’ or empty path elements,
+// nor may they begin or end with a slash. To match everything in the current
+// directory, use ‘*’ instead of ‘.’. To allow for naming files with spaces in
+// their names, patterns can be written as Go double-quoted or back-quoted
+// string literals.
//
// If a pattern names a directory, all files in the subtree rooted at that directory are
// embedded (recursively), except that files with names beginning with ‘.’ or ‘_’
@@ -87,9 +90,6 @@
// Matches for empty directories are ignored. After that, each pattern in a //go:embed line
// must match at least one file or non-empty directory.
//
-// Patterns must not contain ‘.’ or ‘..’ path elements nor begin with a leading slash.
-// To match everything in the current directory, use ‘*’ instead of ‘.’.
-//
// If any patterns are invalid or have invalid matches, the build will fail.
//
// Strings and Bytes
diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go
index f9b9cb4930..cffc06dc9c 100644
--- a/src/encoding/asn1/asn1.go
+++ b/src/encoding/asn1/asn1.go
@@ -914,7 +914,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
structType := fieldType
for i := 0; i < structType.NumField(); i++ {
- if structType.Field(i).PkgPath != "" {
+ if !structType.Field(i).IsExported() {
err = StructuralError{"struct contains unexported fields"}
return
}
diff --git a/src/encoding/asn1/marshal.go b/src/encoding/asn1/marshal.go
index 0d34d5aa1e..5b4d786d49 100644
--- a/src/encoding/asn1/marshal.go
+++ b/src/encoding/asn1/marshal.go
@@ -488,7 +488,7 @@ func makeBody(value reflect.Value, params fieldParameters) (e encoder, err error
t := v.Type()
for i := 0; i < t.NumField(); i++ {
- if t.Field(i).PkgPath != "" {
+ if !t.Field(i).IsExported() {
return nil, StructuralError{"struct contains unexported fields"}
}
}
diff --git a/src/encoding/csv/fuzz.go b/src/encoding/csv/fuzz.go
index 8be21d5d28..a03fa83d8c 100644
--- a/src/encoding/csv/fuzz.go
+++ b/src/encoding/csv/fuzz.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gofuzz
// +build gofuzz
package csv
diff --git a/src/encoding/gob/debug.go b/src/encoding/gob/debug.go
index 8f93742f49..5965fea921 100644
--- a/src/encoding/gob/debug.go
+++ b/src/encoding/gob/debug.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// Delete the next line to include in the gob package.
+//go:build ignore
// +build ignore
package gob
diff --git a/src/encoding/gob/decgen.go b/src/encoding/gob/decgen.go
index 1c31e66625..994be877d9 100644
--- a/src/encoding/gob/decgen.go
+++ b/src/encoding/gob/decgen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// encgen writes the helper functions for encoding. Intended to be
diff --git a/src/encoding/gob/dump.go b/src/encoding/gob/dump.go
index 17238c98df..8c0bbc4ff2 100644
--- a/src/encoding/gob/dump.go
+++ b/src/encoding/gob/dump.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/encoding/gob/encgen.go b/src/encoding/gob/encgen.go
index 409b8c9d95..b562da177d 100644
--- a/src/encoding/gob/encgen.go
+++ b/src/encoding/gob/encgen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// encgen writes the helper functions for encoding. Intended to be
diff --git a/src/encoding/json/decode.go b/src/encoding/json/decode.go
index 86d8a69db7..a9917e72c7 100644
--- a/src/encoding/json/decode.go
+++ b/src/encoding/json/decode.go
@@ -200,16 +200,19 @@ func (n Number) Int64() (int64, error) {
return strconv.ParseInt(string(n), 10, 64)
}
+// An errorContext provides context for type errors during decoding.
+type errorContext struct {
+ Struct reflect.Type
+ FieldStack []string
+}
+
// decodeState represents the state while decoding a JSON value.
type decodeState struct {
- data []byte
- off int // next read offset in data
- opcode int // last read result
- scan scanner
- errorContext struct { // provides context for type errors
- Struct reflect.Type
- FieldStack []string
- }
+ data []byte
+ off int // next read offset in data
+ opcode int // last read result
+ scan scanner
+ errorContext *errorContext
savedError error
useNumber bool
disallowUnknownFields bool
@@ -229,10 +232,11 @@ func (d *decodeState) init(data []byte) *decodeState {
d.data = data
d.off = 0
d.savedError = nil
- d.errorContext.Struct = nil
-
- // Reuse the allocated space for the FieldStack slice.
- d.errorContext.FieldStack = d.errorContext.FieldStack[:0]
+ if d.errorContext != nil {
+ d.errorContext.Struct = nil
+ // Reuse the allocated space for the FieldStack slice.
+ d.errorContext.FieldStack = d.errorContext.FieldStack[:0]
+ }
return d
}
@@ -246,12 +250,11 @@ func (d *decodeState) saveError(err error) {
// addErrorContext returns a new error enhanced with information from d.errorContext
func (d *decodeState) addErrorContext(err error) error {
- if d.errorContext.Struct != nil || len(d.errorContext.FieldStack) > 0 {
+ if d.errorContext != nil && (d.errorContext.Struct != nil || len(d.errorContext.FieldStack) > 0) {
switch err := err.(type) {
case *UnmarshalTypeError:
err.Struct = d.errorContext.Struct.Name()
err.Field = strings.Join(d.errorContext.FieldStack, ".")
- return err
}
}
return err
@@ -657,7 +660,10 @@ func (d *decodeState) object(v reflect.Value) error {
}
var mapElem reflect.Value
- origErrorContext := d.errorContext
+ var origErrorContext errorContext
+ if d.errorContext != nil {
+ origErrorContext = *d.errorContext
+ }
for {
// Read opening " of string key or closing }.
@@ -732,6 +738,9 @@ func (d *decodeState) object(v reflect.Value) error {
}
subv = subv.Field(i)
}
+ if d.errorContext == nil {
+ d.errorContext = new(errorContext)
+ }
d.errorContext.FieldStack = append(d.errorContext.FieldStack, f.name)
d.errorContext.Struct = t
} else if d.disallowUnknownFields {
@@ -812,11 +821,13 @@ func (d *decodeState) object(v reflect.Value) error {
if d.opcode == scanSkipSpace {
d.scanWhile(scanSkipSpace)
}
- // Reset errorContext to its original state.
- // Keep the same underlying array for FieldStack, to reuse the
- // space and avoid unnecessary allocs.
- d.errorContext.FieldStack = d.errorContext.FieldStack[:len(origErrorContext.FieldStack)]
- d.errorContext.Struct = origErrorContext.Struct
+ if d.errorContext != nil {
+ // Reset errorContext to its original state.
+ // Keep the same underlying array for FieldStack, to reuse the
+ // space and avoid unnecessary allocs.
+ d.errorContext.FieldStack = d.errorContext.FieldStack[:len(origErrorContext.FieldStack)]
+ d.errorContext.Struct = origErrorContext.Struct
+ }
if d.opcode == scanEndObject {
break
}
diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index 483b9d8f2d..751f03d33d 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -1239,19 +1239,18 @@ func typeFields(t reflect.Type) structFields {
// Scan f.typ for fields to include.
for i := 0; i < f.typ.NumField(); i++ {
sf := f.typ.Field(i)
- isUnexported := sf.PkgPath != ""
if sf.Anonymous {
t := sf.Type
if t.Kind() == reflect.Ptr {
t = t.Elem()
}
- if isUnexported && t.Kind() != reflect.Struct {
+ if !sf.IsExported() && t.Kind() != reflect.Struct {
// Ignore embedded fields of unexported non-struct types.
continue
}
// Do not ignore embedded fields of unexported struct types
// since they may have exported fields.
- } else if isUnexported {
+ } else if !sf.IsExported() {
// Ignore unexported non-embedded fields.
continue
}
diff --git a/src/encoding/json/fuzz.go b/src/encoding/json/fuzz.go
index be03f0d7ff..d3fa2d1113 100644
--- a/src/encoding/json/fuzz.go
+++ b/src/encoding/json/fuzz.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gofuzz
// +build gofuzz
package json
diff --git a/src/encoding/xml/typeinfo.go b/src/encoding/xml/typeinfo.go
index f30fe58590..162724ef1a 100644
--- a/src/encoding/xml/typeinfo.go
+++ b/src/encoding/xml/typeinfo.go
@@ -60,7 +60,7 @@ func getTypeInfo(typ reflect.Type) (*typeInfo, error) {
n := typ.NumField()
for i := 0; i < n; i++ {
f := typ.Field(i)
- if (f.PkgPath != "" && !f.Anonymous) || f.Tag.Get("xml") == "-" {
+ if (!f.IsExported() && !f.Anonymous) || f.Tag.Get("xml") == "-" {
continue // Private field
}
diff --git a/src/go.mod b/src/go.mod
index 4ae14eea5c..999dc96787 100644
--- a/src/go.mod
+++ b/src/go.mod
@@ -5,6 +5,6 @@ go 1.16
require (
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11
- golang.org/x/sys v0.0.0-20201204225414-ed752295db88 // indirect
+ golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e // indirect
golang.org/x/text v0.3.4 // indirect
)
diff --git a/src/go.sum b/src/go.sum
index 5586aa9a4e..6dd5f4eafd 100644
--- a/src/go.sum
+++ b/src/go.sum
@@ -7,8 +7,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201204225414-ed752295db88 h1:KmZPnMocC93w341XZp26yTJg8Za7lhb2KhkYmixoeso=
-golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e h1:f5mksnk+hgXHnImpZoWj64ja99j9zV7YUgrVG95uFE4=
+golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
diff --git a/src/go/ast/ast.go b/src/go/ast/ast.go
index 2456020c5e..6eb4d13f4d 100644
--- a/src/go/ast/ast.go
+++ b/src/go/ast/ast.go
@@ -372,9 +372,13 @@ type (
Args []Expr // function arguments; or nil
Ellipsis token.Pos // position of "..." (token.NoPos if there is no "...")
Rparen token.Pos // position of ")"
- // TODO(rFindley) use a new ListExpr type rather than overloading CallExpr
- // via Brackets, as is done in the syntax package
- Brackets bool // if set, "[" and "]" are used instead of "(" and ")"
+ }
+
+ // A ListExpr node represents a list of expressions separated by commas.
+ // ListExpr nodes are used as index in IndexExpr nodes representing type
+ // or function instantiations with more than one type argument.
+ ListExpr struct {
+ ElemList []Expr
}
// A StarExpr node represents an expression of the form "*" Expression.
@@ -493,12 +497,18 @@ func (x *IndexExpr) Pos() token.Pos { return x.X.Pos() }
func (x *SliceExpr) Pos() token.Pos { return x.X.Pos() }
func (x *TypeAssertExpr) Pos() token.Pos { return x.X.Pos() }
func (x *CallExpr) Pos() token.Pos { return x.Fun.Pos() }
-func (x *StarExpr) Pos() token.Pos { return x.Star }
-func (x *UnaryExpr) Pos() token.Pos { return x.OpPos }
-func (x *BinaryExpr) Pos() token.Pos { return x.X.Pos() }
-func (x *KeyValueExpr) Pos() token.Pos { return x.Key.Pos() }
-func (x *ArrayType) Pos() token.Pos { return x.Lbrack }
-func (x *StructType) Pos() token.Pos { return x.Struct }
+func (x *ListExpr) Pos() token.Pos {
+ if len(x.ElemList) > 0 {
+ return x.ElemList[0].Pos()
+ }
+ return token.NoPos
+}
+func (x *StarExpr) Pos() token.Pos { return x.Star }
+func (x *UnaryExpr) Pos() token.Pos { return x.OpPos }
+func (x *BinaryExpr) Pos() token.Pos { return x.X.Pos() }
+func (x *KeyValueExpr) Pos() token.Pos { return x.Key.Pos() }
+func (x *ArrayType) Pos() token.Pos { return x.Lbrack }
+func (x *StructType) Pos() token.Pos { return x.Struct }
func (x *FuncType) Pos() token.Pos {
if x.Func.IsValid() || x.Params == nil { // see issue 3870
return x.Func
@@ -526,12 +536,18 @@ func (x *IndexExpr) End() token.Pos { return x.Rbrack + 1 }
func (x *SliceExpr) End() token.Pos { return x.Rbrack + 1 }
func (x *TypeAssertExpr) End() token.Pos { return x.Rparen + 1 }
func (x *CallExpr) End() token.Pos { return x.Rparen + 1 }
-func (x *StarExpr) End() token.Pos { return x.X.End() }
-func (x *UnaryExpr) End() token.Pos { return x.X.End() }
-func (x *BinaryExpr) End() token.Pos { return x.Y.End() }
-func (x *KeyValueExpr) End() token.Pos { return x.Value.End() }
-func (x *ArrayType) End() token.Pos { return x.Elt.End() }
-func (x *StructType) End() token.Pos { return x.Fields.End() }
+func (x *ListExpr) End() token.Pos {
+ if len(x.ElemList) > 0 {
+ return x.ElemList[len(x.ElemList)-1].End()
+ }
+ return token.NoPos
+}
+func (x *StarExpr) End() token.Pos { return x.X.End() }
+func (x *UnaryExpr) End() token.Pos { return x.X.End() }
+func (x *BinaryExpr) End() token.Pos { return x.Y.End() }
+func (x *KeyValueExpr) End() token.Pos { return x.Value.End() }
+func (x *ArrayType) End() token.Pos { return x.Elt.End() }
+func (x *StructType) End() token.Pos { return x.Fields.End() }
func (x *FuncType) End() token.Pos {
if x.Results != nil {
return x.Results.End()
@@ -557,6 +573,7 @@ func (*IndexExpr) exprNode() {}
func (*SliceExpr) exprNode() {}
func (*TypeAssertExpr) exprNode() {}
func (*CallExpr) exprNode() {}
+func (*ListExpr) exprNode() {}
func (*StarExpr) exprNode() {}
func (*UnaryExpr) exprNode() {}
func (*BinaryExpr) exprNode() {}
diff --git a/src/go/ast/example_test.go b/src/go/ast/example_test.go
index c2b35205bb..e3013f64be 100644
--- a/src/go/ast/example_test.go
+++ b/src/go/ast/example_test.go
@@ -119,23 +119,22 @@ func main() {
// 40 . . . . . . . }
// 41 . . . . . . . Ellipsis: -
// 42 . . . . . . . Rparen: 4:25
- // 43 . . . . . . . Brackets: false
- // 44 . . . . . . }
- // 45 . . . . . }
- // 46 . . . . }
- // 47 . . . . Rbrace: 5:1
- // 48 . . . }
- // 49 . . }
- // 50 . }
- // 51 . Scope: *ast.Scope {
- // 52 . . Objects: map[string]*ast.Object (len = 1) {
- // 53 . . . "main": *(obj @ 11)
- // 54 . . }
- // 55 . }
- // 56 . Unresolved: []*ast.Ident (len = 1) {
- // 57 . . 0: *(obj @ 29)
- // 58 . }
- // 59 }
+ // 43 . . . . . . }
+ // 44 . . . . . }
+ // 45 . . . . }
+ // 46 . . . . Rbrace: 5:1
+ // 47 . . . }
+ // 48 . . }
+ // 49 . }
+ // 50 . Scope: *ast.Scope {
+ // 51 . . Objects: map[string]*ast.Object (len = 1) {
+ // 52 . . . "main": *(obj @ 11)
+ // 53 . . }
+ // 54 . }
+ // 55 . Unresolved: []*ast.Ident (len = 1) {
+ // 56 . . 0: *(obj @ 29)
+ // 57 . }
+ // 58 }
}
// This example illustrates how to remove a variable declaration
diff --git a/src/go/build/build.go b/src/go/build/build.go
index 217fadf5bd..0732f6aa19 100644
--- a/src/go/build/build.go
+++ b/src/go/build/build.go
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"go/ast"
+ "go/build/constraint"
"go/doc"
"go/token"
exec "internal/execabs"
@@ -1423,7 +1424,7 @@ func (ctxt *Context) matchFile(dir, name string, allTags map[string]bool, binary
// Look for +build comments to accept or reject the file.
ok, sawBinaryOnly, err := ctxt.shouldBuild(info.header, allTags)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("%s: %v", name, err)
}
if !ok && !ctxt.UseAllFiles {
return nil, nil
@@ -1459,11 +1460,12 @@ var (
bSlashSlash = []byte(slashSlash)
bStarSlash = []byte(starSlash)
bSlashStar = []byte(slashStar)
+ bPlusBuild = []byte("+build")
goBuildComment = []byte("//go:build")
errGoBuildWithoutBuild = errors.New("//go:build comment without // +build comment")
- errMultipleGoBuild = errors.New("multiple //go:build comments") // unused in Go 1.(N-1)
+ errMultipleGoBuild = errors.New("multiple //go:build comments")
)
func isGoBuildComment(line []byte) bool {
@@ -1498,8 +1500,7 @@ var binaryOnlyComment = []byte("//go:binary-only-package")
// shouldBuild reports whether the file should be built
// and whether a //go:binary-only-package comment was found.
func (ctxt *Context) shouldBuild(content []byte, allTags map[string]bool) (shouldBuild, binaryOnly bool, err error) {
-
- // Pass 1. Identify leading run of // comments and blank lines,
+ // Identify leading run of // comments and blank lines,
// which must be followed by a blank line.
// Also identify any //go:build comments.
content, goBuild, sawBinaryOnly, err := parseFileHeader(content)
@@ -1507,44 +1508,42 @@ func (ctxt *Context) shouldBuild(content []byte, allTags map[string]bool) (shoul
return false, false, err
}
- // Pass 2. Process each +build line in the run.
- p := content
- shouldBuild = true
- sawBuild := false
- for len(p) > 0 {
- line := p
- if i := bytes.IndexByte(line, '\n'); i >= 0 {
- line, p = line[:i], p[i+1:]
- } else {
- p = p[len(p):]
- }
- line = bytes.TrimSpace(line)
- if !bytes.HasPrefix(line, bSlashSlash) {
- continue
+ // If //go:build line is present, it controls.
+ // Otherwise fall back to +build processing.
+ switch {
+ case goBuild != nil:
+ x, err := constraint.Parse(string(goBuild))
+ if err != nil {
+ return false, false, fmt.Errorf("parsing //go:build line: %v", err)
}
- line = bytes.TrimSpace(line[len(bSlashSlash):])
- if len(line) > 0 && line[0] == '+' {
- // Looks like a comment +line.
- f := strings.Fields(string(line))
- if f[0] == "+build" {
- sawBuild = true
- ok := false
- for _, tok := range f[1:] {
- if ctxt.match(tok, allTags) {
- ok = true
- }
- }
- if !ok {
+ shouldBuild = ctxt.eval(x, allTags)
+
+ default:
+ shouldBuild = true
+ p := content
+ for len(p) > 0 {
+ line := p
+ if i := bytes.IndexByte(line, '\n'); i >= 0 {
+ line, p = line[:i], p[i+1:]
+ } else {
+ p = p[len(p):]
+ }
+ line = bytes.TrimSpace(line)
+ if !bytes.HasPrefix(line, bSlashSlash) || !bytes.Contains(line, bPlusBuild) {
+ continue
+ }
+ text := string(line)
+ if !constraint.IsPlusBuild(text) {
+ continue
+ }
+ if x, err := constraint.Parse(text); err == nil {
+ if !ctxt.eval(x, allTags) {
shouldBuild = false
}
}
}
}
- if goBuild != nil && !sawBuild {
- return false, false, errGoBuildWithoutBuild
- }
-
return shouldBuild, sawBinaryOnly, nil
}
@@ -1580,7 +1579,7 @@ Lines:
}
if !inSlashStar && isGoBuildComment(line) {
- if false && goBuild != nil { // enabled in Go 1.N
+ if goBuild != nil {
return nil, nil, false, errMultipleGoBuild
}
goBuild = line
@@ -1649,7 +1648,7 @@ func (ctxt *Context) saveCgo(filename string, di *Package, cg *ast.CommentGroup)
if len(cond) > 0 {
ok := false
for _, c := range cond {
- if ctxt.match(c, nil) {
+ if ctxt.matchAuto(c, nil) {
ok = true
break
}
@@ -1831,50 +1830,44 @@ func splitQuoted(s string) (r []string, err error) {
return args, err
}
-// match reports whether the name is one of:
+// matchAuto interprets text as either a +build or //go:build expression (whichever works),
+// reporting whether the expression matches the build context.
//
+// matchAuto is only used for testing of tag evaluation
+// and in #cgo lines, which accept either syntax.
+func (ctxt *Context) matchAuto(text string, allTags map[string]bool) bool {
+ if strings.ContainsAny(text, "&|()") {
+ text = "//go:build " + text
+ } else {
+ text = "// +build " + text
+ }
+ x, err := constraint.Parse(text)
+ if err != nil {
+ return false
+ }
+ return ctxt.eval(x, allTags)
+}
+
+func (ctxt *Context) eval(x constraint.Expr, allTags map[string]bool) bool {
+ return x.Eval(func(tag string) bool { return ctxt.matchTag(tag, allTags) })
+}
+
+// matchTag reports whether the name is one of:
+//
+// cgo (if cgo is enabled)
// $GOOS
// $GOARCH
-// cgo (if cgo is enabled)
-// !cgo (if cgo is disabled)
// ctxt.Compiler
-// !ctxt.Compiler
+// linux (if GOOS = android)
+// solaris (if GOOS = illumos)
// tag (if tag is listed in ctxt.BuildTags or ctxt.ReleaseTags)
-// !tag (if tag is not listed in ctxt.BuildTags or ctxt.ReleaseTags)
-// a comma-separated list of any of these
//
-func (ctxt *Context) match(name string, allTags map[string]bool) bool {
- if name == "" {
- if allTags != nil {
- allTags[name] = true
- }
- return false
- }
- if i := strings.Index(name, ","); i >= 0 {
- // comma-separated list
- ok1 := ctxt.match(name[:i], allTags)
- ok2 := ctxt.match(name[i+1:], allTags)
- return ok1 && ok2
- }
- if strings.HasPrefix(name, "!!") { // bad syntax, reject always
- return false
- }
- if strings.HasPrefix(name, "!") { // negation
- return len(name) > 1 && !ctxt.match(name[1:], allTags)
- }
-
+// It records all consulted tags in allTags.
+func (ctxt *Context) matchTag(name string, allTags map[string]bool) bool {
if allTags != nil {
allTags[name] = true
}
- // Tags must be letters, digits, underscores or dots.
- // Unlike in Go identifiers, all digits are fine (e.g., "386").
- for _, c := range name {
- if !unicode.IsLetter(c) && !unicode.IsDigit(c) && c != '_' && c != '.' {
- return false
- }
- }
-
// special tags
if ctxt.CgoEnabled && name == "cgo" {
return true
@@ -1946,10 +1939,10 @@ func (ctxt *Context) goodOSArchFile(name string, allTags map[string]bool) bool {
}
n := len(l)
if n >= 2 && knownOS[l[n-2]] && knownArch[l[n-1]] {
- return ctxt.match(l[n-1], allTags) && ctxt.match(l[n-2], allTags)
+ return ctxt.matchTag(l[n-1], allTags) && ctxt.matchTag(l[n-2], allTags)
}
if n >= 1 && (knownOS[l[n-1]] || knownArch[l[n-1]]) {
- return ctxt.match(l[n-1], allTags)
+ return ctxt.matchTag(l[n-1], allTags)
}
return true
}
diff --git a/src/go/build/build_test.go b/src/go/build/build_test.go
index d8f264cac7..0762a150eb 100644
--- a/src/go/build/build_test.go
+++ b/src/go/build/build_test.go
@@ -30,7 +30,7 @@ func TestMatch(t *testing.T) {
match := func(tag string, want map[string]bool) {
t.Helper()
m := make(map[string]bool)
- if !ctxt.match(tag, m) {
+ if !ctxt.matchAuto(tag, m) {
t.Errorf("%s context should match %s, does not", what, tag)
}
if !reflect.DeepEqual(m, want) {
@@ -40,7 +40,7 @@ func TestMatch(t *testing.T) {
nomatch := func(tag string, want map[string]bool) {
t.Helper()
m := make(map[string]bool)
- if ctxt.match(tag, m) {
+ if ctxt.matchAuto(tag, m) {
t.Errorf("%s context should NOT match %s, does", what, tag)
}
if !reflect.DeepEqual(m, want) {
@@ -154,6 +154,13 @@ var shouldBuildTests = []struct {
shouldBuild: true,
},
{
+ name: "Yes2",
+ content: "//go:build yes\n" +
+ "package main\n",
+ tags: map[string]bool{"yes": true},
+ shouldBuild: true,
+ },
+ {
name: "Or",
content: "// +build no yes\n\n" +
"package main\n",
@@ -161,6 +168,13 @@ var shouldBuildTests = []struct {
shouldBuild: true,
},
{
+ name: "Or2",
+ content: "//go:build no || yes\n" +
+ "package main\n",
+ tags: map[string]bool{"yes": true, "no": true},
+ shouldBuild: true,
+ },
+ {
name: "And",
content: "// +build no,yes\n\n" +
"package main\n",
@@ -168,6 +182,13 @@ var shouldBuildTests = []struct {
shouldBuild: false,
},
{
+ name: "And2",
+ content: "//go:build no && yes\n" +
+ "package main\n",
+ tags: map[string]bool{"yes": true, "no": true},
+ shouldBuild: false,
+ },
+ {
name: "Cgo",
content: "// +build cgo\n\n" +
"// Copyright The Go Authors.\n\n" +
@@ -178,11 +199,22 @@ var shouldBuildTests = []struct {
shouldBuild: false,
},
{
+ name: "Cgo2",
+ content: "//go:build cgo\n" +
+ "// Copyright The Go Authors.\n\n" +
+ "// This package implements parsing of tags like\n" +
+ "// +build tag1\n" +
+ "package build",
+ tags: map[string]bool{"cgo": true},
+ shouldBuild: false,
+ },
+ {
name: "AfterPackage",
content: "// Copyright The Go Authors.\n\n" +
"package build\n\n" +
"// shouldBuild checks tags given by lines of the form\n" +
"// +build tag\n" +
+ "//go:build tag\n" +
"func shouldBuild(content []byte)\n",
tags: map[string]bool{},
shouldBuild: true,
@@ -195,6 +227,13 @@ var shouldBuildTests = []struct {
shouldBuild: true,
},
{
+ name: "TooClose2",
+ content: "//go:build yes\n" +
+ "package main\n",
+ tags: map[string]bool{"yes": true},
+ shouldBuild: true,
+ },
+ {
name: "TooCloseNo",
content: "// +build no\n" +
"package main\n",
@@ -202,6 +241,13 @@ var shouldBuildTests = []struct {
shouldBuild: true,
},
{
+ name: "TooCloseNo2",
+ content: "//go:build no\n" +
+ "package main\n",
+ tags: map[string]bool{"no": true},
+ shouldBuild: false,
+ },
+ {
name: "BinaryOnly",
content: "//go:binary-only-package\n" +
"// +build yes\n" +
@@ -211,41 +257,30 @@ var shouldBuildTests = []struct {
shouldBuild: true,
},
{
- name: "ValidGoBuild",
- content: "// +build yes\n\n" +
+ name: "BinaryOnly2",
+ content: "//go:binary-only-package\n" +
"//go:build no\n" +
"package main\n",
- tags: map[string]bool{"yes": true},
- shouldBuild: true,
- },
- {
- name: "MissingBuild",
- content: "//go:build no\n" +
- "package main\n",
- tags: map[string]bool{},
+ tags: map[string]bool{"no": true},
+ binaryOnly: true,
shouldBuild: false,
- err: errGoBuildWithoutBuild,
},
{
- name: "MissingBuild2",
- content: "/* */\n" +
- "// +build yes\n\n" +
+ name: "ValidGoBuild",
+ content: "// +build yes\n\n" +
"//go:build no\n" +
"package main\n",
- tags: map[string]bool{},
+ tags: map[string]bool{"no": true},
shouldBuild: false,
- err: errGoBuildWithoutBuild,
},
{
name: "MissingBuild2",
- content: "/*\n" +
+ content: "/* */\n" +
"// +build yes\n\n" +
- "*/\n" +
"//go:build no\n" +
"package main\n",
- tags: map[string]bool{},
+ tags: map[string]bool{"no": true},
shouldBuild: false,
- err: errGoBuildWithoutBuild,
},
{
name: "Comment1",
@@ -263,9 +298,8 @@ var shouldBuildTests = []struct {
"*/\n\n" +
"//go:build no\n" +
"package main\n",
- tags: map[string]bool{},
+ tags: map[string]bool{"no": true},
shouldBuild: false,
- err: errGoBuildWithoutBuild,
},
{
name: "Comment3",
@@ -274,9 +308,8 @@ var shouldBuildTests = []struct {
"*/\n\n" +
"//go:build no\n" +
"package main\n",
- tags: map[string]bool{},
+ tags: map[string]bool{"no": true},
shouldBuild: false,
- err: errGoBuildWithoutBuild,
},
{
name: "Comment4",
@@ -290,9 +323,8 @@ var shouldBuildTests = []struct {
content: "/**/\n" +
"//go:build no\n" +
"package main\n",
- tags: map[string]bool{},
+ tags: map[string]bool{"no": true},
shouldBuild: false,
- err: errGoBuildWithoutBuild,
},
}
diff --git a/src/go/build/constraint/expr.go b/src/go/build/constraint/expr.go
index 3b278702f8..1ef707ceac 100644
--- a/src/go/build/constraint/expr.go
+++ b/src/go/build/constraint/expr.go
@@ -355,8 +355,8 @@ func IsPlusBuild(line string) bool {
return ok
}
-// splitGoBuild splits apart the leading //go:build prefix in line from the build expression itself.
-// It returns "", false if the input is not a //go:build line or if the input contains multiple lines.
+// splitPlusBuild splits apart the leading // +build prefix in line from the build expression itself.
+// It returns "", false if the input is not a // +build line or if the input contains multiple lines.
func splitPlusBuild(line string) (expr string, ok bool) {
// A single trailing newline is OK; otherwise multiple lines are not.
if len(line) > 0 && line[len(line)-1] == '\n' {
diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go
index 322765cc56..094211b9c7 100644
--- a/src/go/build/deps_test.go
+++ b/src/go/build/deps_test.go
@@ -76,8 +76,12 @@ var depsRules = `
unicode/utf8, unicode/utf16, unicode,
unsafe;
+ # These packages depend only on unsafe.
+ unsafe
+ < internal/abi;
+
# RUNTIME is the core runtime group of packages, all of them very light-weight.
- internal/cpu, unsafe
+ internal/abi, internal/cpu, unsafe
< internal/bytealg
< internal/unsafeheader
< runtime/internal/sys
@@ -275,7 +279,10 @@ var depsRules = `
< go/ast
< go/parser;
- go/parser, text/tabwriter
+ FMT
+ < go/build/constraint;
+
+ go/build/constraint, go/parser, text/tabwriter
< go/printer
< go/format;
@@ -285,13 +292,10 @@ var depsRules = `
math/big, go/token
< go/constant;
- container/heap, go/constant, go/parser
+ container/heap, go/constant, go/parser, regexp
< go/types;
- FMT
- < go/build/constraint;
-
- go/doc, go/parser, internal/goroot, internal/goversion
+ go/build/constraint, go/doc, go/parser, internal/goroot, internal/goversion
< go/build;
DEBUG, go/build, go/types, text/scanner
diff --git a/src/go/build/gc.go b/src/go/build/gc.go
index 3025cd5681..e16e186e0d 100644
--- a/src/go/build/gc.go
+++ b/src/go/build/gc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gc
// +build gc
package build
diff --git a/src/go/build/gccgo.go b/src/go/build/gccgo.go
index c6aac9aa1b..c8ec7041fb 100644
--- a/src/go/build/gccgo.go
+++ b/src/go/build/gccgo.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gccgo
// +build gccgo
package build
diff --git a/src/go/doc/headscan.go b/src/go/doc/headscan.go
index fe26a0ea84..28cb84f91d 100644
--- a/src/go/doc/headscan.go
+++ b/src/go/doc/headscan.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/go/format/format.go b/src/go/format/format.go
index 279fc2e324..4d3644fb50 100644
--- a/src/go/format/format.go
+++ b/src/go/format/format.go
@@ -38,7 +38,13 @@ const (
var config = printer.Config{Mode: printerMode, Tabwidth: tabWidth}
-const parserMode = parser.ParseComments | parser.ParseTypeParams
+const (
+ parserMode = parser.ParseComments | parseTypeParams
+
+ // parseTypeParams tells go/parser to parse type parameters. Must be kept in
+ // sync with go/parser/interface.go.
+ parseTypeParams parser.Mode = 1 << 30
+)
// Node formats node in canonical gofmt style and writes the result to dst.
//
diff --git a/src/go/format/format_test.go b/src/go/format/format_test.go
index 27f4c74cdf..6cc0278b79 100644
--- a/src/go/format/format_test.go
+++ b/src/go/format/format_test.go
@@ -151,6 +151,10 @@ var tests = []string{
// erroneous programs
"ERROR1 + 2 +",
"ERRORx := 0",
+
+ // build comments
+ "// copyright\n\n//go:build x\n\npackage p\n",
+ "// copyright\n\n//go:build x\n// +build x\n\npackage p\n",
}
func String(s string) (string, error) {
diff --git a/src/go/go2go/go2go.go b/src/go/go2go/go2go.go
index b0c48736d8..7d8e978bb0 100644
--- a/src/go/go2go/go2go.go
+++ b/src/go/go2go/go2go.go
@@ -19,6 +19,10 @@ import (
"strings"
)
+// parseTypeParams tells go/parser to parse type parameters. Must be kept in
+// sync with go/parser/interface.go.
+const parseTypeParams parser.Mode = 1 << 30
+
// rewritePrefix is what we put at the start of each newly generated .go file.
const rewritePrefix = "// Code generated by go2go; DO NOT EDIT.\n\n"
@@ -125,7 +129,7 @@ func rewriteFilesInPath(importer *Importer, importPath, dir string, go2files []s
// for error messages.
func RewriteBuffer(importer *Importer, filename string, file []byte) ([]byte, error) {
fset := token.NewFileSet()
- pf, err := parser.ParseFile(fset, filename, file, parser.ParseTypeParams)
+ pf, err := parser.ParseFile(fset, filename, file, parseTypeParams)
if err != nil {
return nil, err
}
@@ -220,7 +224,7 @@ func checkGoFile(dir, f string) error {
func parseFiles(importer *Importer, dir string, go2files []string, fset *token.FileSet) ([]*ast.Package, error) {
pkgs := make(map[string]*ast.Package)
for _, go2f := range go2files {
- mode := parser.ParseTypeParams
+ mode := parseTypeParams
filename := filepath.Join(dir, go2f)
pf, err := parser.ParseFile(fset, filename, nil, mode)
diff --git a/src/go/go2go/importer.go b/src/go/go2go/importer.go
index 6c92730690..6bd2e8b602 100644
--- a/src/go/go2go/importer.go
+++ b/src/go/go2go/importer.go
@@ -66,11 +66,11 @@ var _ types.ImporterFrom = &Importer{}
// The tmpdir will become a GOPATH with translated files.
func NewImporter(tmpdir string) *Importer {
info := &types.Info{
- Types: make(map[ast.Expr]types.TypeAndValue),
- Inferred: make(map[ast.Expr]types.Inferred),
- Defs: make(map[*ast.Ident]types.Object),
- Uses: make(map[*ast.Ident]types.Object),
+ Types: make(map[ast.Expr]types.TypeAndValue),
+ Defs: make(map[*ast.Ident]types.Object),
+ Uses: make(map[*ast.Ident]types.Object),
}
+ types.SetInferred(info, make(map[ast.Expr]types.Inferred))
return &Importer{
defaultImporter: importer.Default().(types.ImporterFrom),
tmpdir: tmpdir,
diff --git a/src/go/go2go/instantiate.go b/src/go/go2go/instantiate.go
index e9566cb480..f6952d909f 100644
--- a/src/go/go2go/instantiate.go
+++ b/src/go/go2go/instantiate.go
@@ -197,10 +197,8 @@ func (t *translator) instantiateTypeDecl(qid qualifiedIdent, typ *types.Named, a
}
var tparams []ast.Expr
switch rtyp := rtyp.(type) {
- case *ast.CallExpr:
- tparams = rtyp.Args
case *ast.IndexExpr:
- tparams = []ast.Expr{rtyp.Index}
+ tparams = unpackExpr(rtyp.Index)
default:
panic("unexpected AST type")
}
@@ -709,7 +707,8 @@ func (t *translator) instantiateExpr(ta *typeArgs, e ast.Expr) ast.Expr {
case *ast.IndexExpr:
x := t.instantiateExpr(ta, e.X)
index := t.instantiateExpr(ta, e.Index)
- origInferred, haveInferred := t.importer.info.Inferred[e]
+ inferredInfo := types.GetInferred(t.importer.info)
+ origInferred, haveInferred := inferredInfo[e]
var newInferred types.Inferred
inferredChanged := false
if haveInferred {
@@ -731,7 +730,12 @@ func (t *translator) instantiateExpr(ta *typeArgs, e ast.Expr) ast.Expr {
Rbrack: e.Rbrack,
}
if haveInferred {
- t.importer.info.Inferred[r] = newInferred
+ inferredInfo[r] = newInferred
+ }
+ case *ast.ListExpr:
+ list, changed := t.instantiateExprList(ta, e.ElemList)
+ if changed {
+ r = &ast.ListExpr{ElemList: list}
}
case *ast.SliceExpr:
x := t.instantiateExpr(ta, e.X)
@@ -765,7 +769,8 @@ func (t *translator) instantiateExpr(ta *typeArgs, e ast.Expr) ast.Expr {
case *ast.CallExpr:
fun := t.instantiateExpr(ta, e.Fun)
args, argsChanged := t.instantiateExprList(ta, e.Args)
- origInferred, haveInferred := t.importer.info.Inferred[e]
+ inferredInfo := types.GetInferred(t.importer.info)
+ origInferred, haveInferred := inferredInfo[e]
var newInferred types.Inferred
inferredChanged := false
if haveInferred {
@@ -792,7 +797,7 @@ func (t *translator) instantiateExpr(ta *typeArgs, e ast.Expr) ast.Expr {
Rparen: e.Rparen,
}
if haveInferred {
- t.importer.info.Inferred[r] = newInferred
+ inferredInfo[r] = newInferred
}
case *ast.StarExpr:
x := t.instantiateExpr(ta, e.X)
diff --git a/src/go/go2go/rewrite.go b/src/go/go2go/rewrite.go
index 89a00e013b..0f9d4630ee 100644
--- a/src/go/go2go/rewrite.go
+++ b/src/go/go2go/rewrite.go
@@ -685,11 +685,11 @@ func (t *translator) translateExpr(pe *ast.Expr) {
case *ast.CallExpr:
if ftyp, ok := t.lookupType(e.Fun).(*types.Signature); ok && len(ftyp.TParams()) > 0 {
t.translateFunctionInstantiation(pe)
- } else if ntyp, ok := t.lookupType(e.Fun).(*types.Named); ok && len(ntyp.TParams()) > 0 && len(ntyp.TArgs()) == 0 {
- t.translateTypeInstantiation(pe)
}
t.translateExprList(e.Args)
t.translateExpr(&e.Fun)
+ case *ast.ListExpr:
+ t.translateExprList(e.ElemList)
case *ast.StarExpr:
t.translateExpr(&e.X)
case *ast.UnaryExpr:
@@ -1044,13 +1044,14 @@ func (t *translator) instantiationTypes(x ast.Expr) (argList []ast.Expr, typeLis
var args []ast.Expr
switch x := x.(type) {
case *ast.CallExpr:
- args = x.Args
+ // CallExprs may result in an implicit instantiation via type inference.
case *ast.IndexExpr:
- args = []ast.Expr{x.Index}
+ args = unpackExpr(x.Index)
default:
- panic("unexpected AST type")
+ panic(fmt.Sprintf("unexpected AST type %T", x))
}
- inferred, haveInferred := t.importer.info.Inferred[x]
+ inferredInfo := types.GetInferred(t.importer.info)
+ inferred, haveInferred := inferredInfo[x]
if !haveInferred {
argList = args
@@ -1085,6 +1086,17 @@ func (t *translator) instantiationTypes(x ast.Expr) (argList []ast.Expr, typeLis
return
}
+// unpackExpr unpacks an *ast.ListExpr into a list of ast.Expr.
+func unpackExpr(x ast.Expr) []ast.Expr {
+ if x, _ := x.(*ast.ListExpr); x != nil {
+ return x.ElemList
+ }
+ if x != nil {
+ return []ast.Expr{x}
+ }
+ return nil
+}
+
// lookupInstantiatedType looks for an existing instantiation of an
// instantiated type.
func (t *translator) lookupInstantiatedType(typ *types.Named) (types.Type, *ast.Ident) {
diff --git a/src/go/internal/gccgoimporter/gccgoinstallation_test.go b/src/go/internal/gccgoimporter/gccgoinstallation_test.go
index b332babc7b..df0188ace7 100644
--- a/src/go/internal/gccgoimporter/gccgoinstallation_test.go
+++ b/src/go/internal/gccgoimporter/gccgoinstallation_test.go
@@ -184,7 +184,7 @@ func TestInstallationImporter(t *testing.T) {
{pkgpath: "io", name: "ReadWriter", want: "type ReadWriter interface{Reader; Writer}"},
{pkgpath: "math", name: "Pi", want: "const Pi untyped float"},
{pkgpath: "math", name: "Sin", want: "func Sin(x float64) float64"},
- {pkgpath: "sort", name: "Ints", want: "func Ints(a []int)"},
+ {pkgpath: "sort", name: "Search", want: "func Search(n int, f func(int) bool) int"},
{pkgpath: "unsafe", name: "Pointer", want: "type Pointer"},
} {
runImporterTest(t, imp, nil, &test)
diff --git a/src/go/internal/gccgoimporter/importer_test.go b/src/go/internal/gccgoimporter/importer_test.go
index c5b520feb4..b3f39312be 100644
--- a/src/go/internal/gccgoimporter/importer_test.go
+++ b/src/go/internal/gccgoimporter/importer_test.go
@@ -94,7 +94,7 @@ var importerTests = [...]importerTest{
{pkgpath: "nointerface", name: "I", want: "type I int"},
{pkgpath: "issue29198", name: "FooServer", gccgoVersion: 7, want: "type FooServer struct{FooServer *FooServer; user string; ctx context.Context}"},
{pkgpath: "issue30628", name: "Apple", want: "type Apple struct{hey sync.RWMutex; x int; RQ [517]struct{Count uintptr; NumBytes uintptr; Last uintptr}}"},
- {pkgpath: "issue31540", name: "S", gccgoVersion: 7, want: "type S struct{b int; A2 /* = map[Y]Z */}"},
+ {pkgpath: "issue31540", name: "S", gccgoVersion: 7, want: "type S struct{b int; map[Y]Z}"}, // should want "type S struct{b int; A2}" (issue #44410)
{pkgpath: "issue34182", name: "T1", want: "type T1 struct{f *T2}"},
{pkgpath: "notinheap", name: "S", want: "type S struct{}"},
}
diff --git a/src/go/internal/gcimporter/iimport.go b/src/go/internal/gcimporter/iimport.go
index c59dd16533..a3184e7641 100644
--- a/src/go/internal/gcimporter/iimport.go
+++ b/src/go/internal/gcimporter/iimport.go
@@ -15,6 +15,7 @@ import (
"go/token"
"go/types"
"io"
+ "math/big"
"sort"
)
@@ -320,7 +321,9 @@ func (r *importReader) value() (typ types.Type, val constant.Value) {
val = constant.MakeString(r.string())
case types.IsInteger:
- val = r.mpint(b)
+ var x big.Int
+ r.mpint(&x, b)
+ val = constant.Make(&x)
case types.IsFloat:
val = r.mpfloat(b)
@@ -365,8 +368,8 @@ func intSize(b *types.Basic) (signed bool, maxBytes uint) {
return
}
-func (r *importReader) mpint(b *types.Basic) constant.Value {
- signed, maxBytes := intSize(b)
+func (r *importReader) mpint(x *big.Int, typ *types.Basic) {
+ signed, maxBytes := intSize(typ)
maxSmall := 256 - maxBytes
if signed {
@@ -385,7 +388,8 @@ func (r *importReader) mpint(b *types.Basic) constant.Value {
v = ^v
}
}
- return constant.MakeInt64(v)
+ x.SetInt64(v)
+ return
}
v := -n
@@ -395,39 +399,23 @@ func (r *importReader) mpint(b *types.Basic) constant.Value {
if v < 1 || uint(v) > maxBytes {
errorf("weird decoding: %v, %v => %v", n, signed, v)
}
-
- buf := make([]byte, v)
- io.ReadFull(&r.declReader, buf)
-
- // convert to little endian
- // TODO(gri) go/constant should have a more direct conversion function
- // (e.g., once it supports a big.Float based implementation)
- for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
- buf[i], buf[j] = buf[j], buf[i]
- }
-
- x := constant.MakeFromBytes(buf)
+ b := make([]byte, v)
+ io.ReadFull(&r.declReader, b)
+ x.SetBytes(b)
if signed && n&1 != 0 {
- x = constant.UnaryOp(token.SUB, x, 0)
+ x.Neg(x)
}
- return x
}
-func (r *importReader) mpfloat(b *types.Basic) constant.Value {
- x := r.mpint(b)
- if constant.Sign(x) == 0 {
- return x
- }
-
- exp := r.int64()
- switch {
- case exp > 0:
- x = constant.Shift(x, token.SHL, uint(exp))
- case exp < 0:
- d := constant.Shift(constant.MakeInt64(1), token.SHL, uint(-exp))
- x = constant.BinaryOp(x, token.QUO, d)
+func (r *importReader) mpfloat(typ *types.Basic) constant.Value {
+ var mant big.Int
+ r.mpint(&mant, typ)
+ var f big.Float
+ f.SetInt(&mant)
+ if f.Sign() != 0 {
+ f.SetMantExp(&f, int(r.int64()))
}
- return x
+ return constant.Make(&f)
}
func (r *importReader) ident() string {
diff --git a/src/go/parser/error_test.go b/src/go/parser/error_test.go
index 8e20b7b468..3caa3571e6 100644
--- a/src/go/parser/error_test.go
+++ b/src/go/parser/error_test.go
@@ -188,7 +188,7 @@ func TestErrors(t *testing.T) {
if !d.IsDir() && !strings.HasPrefix(name, ".") && (strings.HasSuffix(name, ".src") || strings.HasSuffix(name, ".go2")) {
mode := DeclarationErrors | AllErrors
if strings.HasSuffix(name, ".go2") {
- mode |= ParseTypeParams
+ mode |= parseTypeParams
}
checkErrors(t, filepath.Join(testdata, name), nil, mode, true)
}
diff --git a/src/go/parser/interface.go b/src/go/parser/interface.go
index b8b312463f..123faaee77 100644
--- a/src/go/parser/interface.go
+++ b/src/go/parser/interface.go
@@ -55,8 +55,14 @@ const (
Trace // print a trace of parsed productions
DeclarationErrors // report declaration errors
SpuriousErrors // same as AllErrors, for backward-compatibility
- ParseTypeParams // Placeholder. Will control the parsing of type parameters.
AllErrors = SpuriousErrors // report all errors (not just the first 10 on different lines)
+
+ // parseTypeParams controls the parsing of type parameters. Must be
+ // kept in sync with:
+ // go/printer/printer_test.go
+ // go/types/check_test.go
+ // cmd/gofmt/gofmt.go
+ parseTypeParams = 1 << 30
)
// ParseFile parses the source code of a single Go source file and returns
diff --git a/src/go/parser/parser.go b/src/go/parser/parser.go
index ccbcef8f26..ed1867b3b3 100644
--- a/src/go/parser/parser.go
+++ b/src/go/parser/parser.go
@@ -651,7 +651,7 @@ func (p *parser) parseQualifiedIdent(ident *ast.Ident) ast.Expr {
}
typ := p.parseTypeName(ident)
- if p.tok == token.LBRACK && p.mode&ParseTypeParams != 0 {
+ if p.tok == token.LBRACK && p.mode&parseTypeParams != 0 {
typ = p.parseTypeInstance(typ)
}
@@ -712,7 +712,7 @@ func (p *parser) parseArrayFieldOrTypeInstance(x *ast.Ident) (*ast.Ident, ast.Ex
// TODO(rfindley): consider changing parseRhsOrType so that this function variable
// is not needed.
argparser := p.parseRhsOrType
- if p.mode&ParseTypeParams == 0 {
+ if p.mode&parseTypeParams == 0 {
argparser = p.parseRhs
}
if p.tok != token.RBRACK {
@@ -742,19 +742,19 @@ func (p *parser) parseArrayFieldOrTypeInstance(x *ast.Ident) (*ast.Ident, ast.Ex
// x [P]E
return x, &ast.ArrayType{Lbrack: lbrack, Len: args[0], Elt: elt}
}
- if p.mode&ParseTypeParams == 0 {
+ if p.mode&parseTypeParams == 0 {
p.error(rbrack, "missing element type in array type expression")
return nil, &ast.BadExpr{From: args[0].Pos(), To: args[0].End()}
}
}
- if p.mode&ParseTypeParams == 0 {
+ if p.mode&parseTypeParams == 0 {
p.error(firstComma, "expected ']', found ','")
return x, &ast.BadExpr{From: args[0].Pos(), To: args[len(args)-1].End()}
}
// x[P], x[P1, P2], ...
- return nil, &ast.CallExpr{Fun: x, Lparen: lbrack, Args: args, Rparen: rbrack, Brackets: true}
+ return nil, &ast.IndexExpr{X: x, Lbrack: lbrack, Index: &ast.ListExpr{ElemList: args}, Rbrack: rbrack}
}
func (p *parser) parseFieldDecl(scope *ast.Scope) *ast.Field {
@@ -1045,7 +1045,7 @@ func (p *parser) parseParameters(scope *ast.Scope, acceptTParams bool) (tparams,
defer un(trace(p, "Parameters"))
}
- if p.mode&ParseTypeParams != 0 && acceptTParams && p.tok == token.LBRACK {
+ if p.mode&parseTypeParams != 0 && acceptTParams && p.tok == token.LBRACK {
opening := p.pos
p.next()
// [T any](params) syntax
@@ -1119,7 +1119,7 @@ func (p *parser) parseMethodSpec(scope *ast.Scope) *ast.Field {
x := p.parseTypeName(nil)
if ident, _ := x.(*ast.Ident); ident != nil {
switch {
- case p.tok == token.LBRACK && p.mode&ParseTypeParams != 0:
+ case p.tok == token.LBRACK && p.mode&parseTypeParams != 0:
// generic method or embedded instantiated type
lbrack := p.pos
p.next()
@@ -1153,7 +1153,7 @@ func (p *parser) parseMethodSpec(scope *ast.Scope) *ast.Field {
p.exprLev--
}
rbrack := p.expectClosing(token.RBRACK, "type argument list")
- typ = &ast.CallExpr{Fun: ident, Lparen: lbrack, Args: list, Rparen: rbrack, Brackets: true}
+ typ = &ast.IndexExpr{X: ident, Lbrack: lbrack, Index: &ast.ListExpr{ElemList: list}, Rbrack: rbrack}
}
case p.tok == token.LPAREN:
// ordinary method
@@ -1171,7 +1171,7 @@ func (p *parser) parseMethodSpec(scope *ast.Scope) *ast.Field {
} else {
// embedded, possibly instantiated type
typ = x
- if p.tok == token.LBRACK && p.mode&ParseTypeParams != 0 {
+ if p.tok == token.LBRACK && p.mode&parseTypeParams != 0 {
// embedded instantiated interface
typ = p.parseTypeInstance(typ)
}
@@ -1193,7 +1193,7 @@ func (p *parser) parseInterfaceType() *ast.InterfaceType {
lbrace := p.expect(token.LBRACE)
scope := ast.NewScope(nil) // interface scope
var list []*ast.Field
- for p.tok == token.IDENT || p.mode&ParseTypeParams != 0 && p.tok == token.TYPE {
+ for p.tok == token.IDENT || p.mode&parseTypeParams != 0 && p.tok == token.TYPE {
if p.tok == token.IDENT {
list = append(list, p.parseMethodSpec(scope))
} else {
@@ -1281,7 +1281,7 @@ func (p *parser) parseTypeInstance(typ ast.Expr) ast.Expr {
closing := p.expectClosing(token.RBRACK, "type argument list")
- return &ast.CallExpr{Fun: typ, Lparen: opening, Args: list, Rparen: closing, Brackets: true}
+ return &ast.IndexExpr{X: typ, Lbrack: opening, Index: &ast.ListExpr{ElemList: list}, Rbrack: closing}
}
// If the result is an identifier, it is not resolved.
@@ -1289,7 +1289,7 @@ func (p *parser) tryIdentOrType() ast.Expr {
switch p.tok {
case token.IDENT:
typ := p.parseTypeName(nil)
- if p.tok == token.LBRACK && p.mode&ParseTypeParams != 0 {
+ if p.tok == token.LBRACK && p.mode&parseTypeParams != 0 {
typ = p.parseTypeInstance(typ)
}
return typ
@@ -1485,8 +1485,9 @@ func (p *parser) parseIndexOrSliceOrInstance(x ast.Expr) ast.Expr {
// empty index, slice or index expressions are not permitted;
// accept them for parsing tolerance, but complain
p.errorExpected(p.pos, "operand")
+ rbrack := p.pos
p.next()
- return x
+ return &ast.BadExpr{From: x.Pos(), To: rbrack}
}
p.exprLev++
@@ -1551,13 +1552,13 @@ func (p *parser) parseIndexOrSliceOrInstance(x ast.Expr) ast.Expr {
return &ast.IndexExpr{X: x, Lbrack: lbrack, Index: index[0], Rbrack: rbrack}
}
- if p.mode&ParseTypeParams == 0 {
+ if p.mode&parseTypeParams == 0 {
p.error(firstComma, "expected ']' or ':', found ','")
return &ast.BadExpr{From: args[0].Pos(), To: args[len(args)-1].End()}
}
// instance expression
- return &ast.CallExpr{Fun: x, Lparen: lbrack, Args: args, Rparen: rbrack, Brackets: true}
+ return &ast.IndexExpr{X: x, Lbrack: lbrack, Index: &ast.ListExpr{ElemList: args}, Rbrack: rbrack}
}
func (p *parser) parseCallOrConversion(fun ast.Expr) *ast.CallExpr {
@@ -1754,7 +1755,14 @@ func (p *parser) parsePrimaryExpr(lhs bool) (x ast.Expr) {
default:
pos := p.pos
p.errorExpected(pos, "selector or type assertion")
- p.next() // make progress
+ // TODO(rFindley) The check for token.RBRACE below is a targeted fix
+ // to error recovery sufficient to make the x/tools tests to
+ // pass with the new parsing logic introduced for type
+ // parameters. Remove this once error recovery has been
+ // more generally reconsidered.
+ if p.tok != token.RBRACE {
+ p.next() // make progress
+ }
sel := &ast.Ident{NamePos: pos, Name: "_"}
x = &ast.SelectorExpr{X: x, Sel: sel}
}
@@ -1773,17 +1781,12 @@ func (p *parser) parsePrimaryExpr(lhs bool) (x ast.Expr) {
// type; accept it but complain if we have a complit
t := unparen(x)
// determine if '{' belongs to a composite literal or a block statement
- switch t := t.(type) {
+ switch t.(type) {
case *ast.BadExpr, *ast.Ident, *ast.SelectorExpr:
if p.exprLev < 0 {
return
}
// x is possibly a composite literal type
- case *ast.CallExpr:
- if !t.Brackets || p.exprLev < 0 {
- return
- }
- // x is possibly a composite literal type
case *ast.IndexExpr:
if p.exprLev < 0 {
return
@@ -2693,7 +2696,7 @@ func (p *parser) parseTypeSpec(doc *ast.CommentGroup, _ token.Pos, _ token.Token
p.exprLev++
x := p.parseExpr(true) // we don't know yet if we're a lhs or rhs expr
p.exprLev--
- if name0, _ := x.(*ast.Ident); p.mode&ParseTypeParams != 0 && name0 != nil && p.tok != token.RBRACK {
+ if name0, _ := x.(*ast.Ident); p.mode&parseTypeParams != 0 && name0 != nil && p.tok != token.RBRACK {
// generic type [T any];
p.parseGenericType(spec, lbrack, name0, token.RBRACK)
} else {
diff --git a/src/go/parser/short_test.go b/src/go/parser/short_test.go
index 3676c27559..b21dd0aa60 100644
--- a/src/go/parser/short_test.go
+++ b/src/go/parser/short_test.go
@@ -64,8 +64,8 @@ var valids = []string{
}
// validWithTParamsOnly holds source code examples that are valid if
-// ParseTypeParams is set, but invalid if not. When checking with the
-// ParseTypeParams set, errors are ignored.
+// parseTypeParams is set, but invalid if not. When checking with the
+// parseTypeParams set, errors are ignored.
var validWithTParamsOnly = []string{
`package p; type _ []T[ /* ERROR "expected ';', found '\['" */ int]`,
`package p; type T[P any /* ERROR "expected ']', found any" */ ] struct { P }`,
@@ -131,10 +131,10 @@ func TestValid(t *testing.T) {
})
t.Run("tparams", func(t *testing.T) {
for _, src := range valids {
- checkErrors(t, src, src, DeclarationErrors|AllErrors|ParseTypeParams, false)
+ checkErrors(t, src, src, DeclarationErrors|AllErrors|parseTypeParams, false)
}
for _, src := range validWithTParamsOnly {
- checkErrors(t, src, src, DeclarationErrors|AllErrors|ParseTypeParams, false)
+ checkErrors(t, src, src, DeclarationErrors|AllErrors|parseTypeParams, false)
}
})
}
@@ -142,7 +142,7 @@ func TestValid(t *testing.T) {
// TestSingle is useful to track down a problem with a single short test program.
func TestSingle(t *testing.T) {
const src = `package p; var _ = T[P]{}`
- checkErrors(t, src, src, DeclarationErrors|AllErrors|ParseTypeParams, true)
+ checkErrors(t, src, src, DeclarationErrors|AllErrors|parseTypeParams, true)
}
var invalids = []string{
@@ -261,10 +261,10 @@ func TestInvalid(t *testing.T) {
})
t.Run("tparams", func(t *testing.T) {
for _, src := range invalids {
- checkErrors(t, src, src, DeclarationErrors|AllErrors|ParseTypeParams, true)
+ checkErrors(t, src, src, DeclarationErrors|AllErrors|parseTypeParams, true)
}
for _, src := range invalidTParamErrs {
- checkErrors(t, src, src, DeclarationErrors|AllErrors|ParseTypeParams, true)
+ checkErrors(t, src, src, DeclarationErrors|AllErrors|parseTypeParams, true)
}
})
}
diff --git a/src/go/parser/testdata/issue44504.src b/src/go/parser/testdata/issue44504.src
new file mode 100644
index 0000000000..7791f4a809
--- /dev/null
+++ b/src/go/parser/testdata/issue44504.src
@@ -0,0 +1,13 @@
+// Copyright 2021 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.
+
+// Test case for issue 44504: panic due to duplicate resolution of slice/index
+// operands. We should not try to resolve a LHS expression with invalid syntax.
+
+package p
+
+func _() {
+ var items []bool
+ items[] /* ERROR "operand" */ = false
+}
diff --git a/src/go/printer/gobuild.go b/src/go/printer/gobuild.go
new file mode 100644
index 0000000000..f00492d077
--- /dev/null
+++ b/src/go/printer/gobuild.go
@@ -0,0 +1,170 @@
+// Copyright 2020 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.
+
+package printer
+
+import (
+ "go/build/constraint"
+ "sort"
+ "text/tabwriter"
+)
+
+func (p *printer) fixGoBuildLines() {
+ if len(p.goBuild)+len(p.plusBuild) == 0 {
+ return
+ }
+
+ // Find latest possible placement of //go:build and // +build comments.
+ // That's just after the last blank line before we find a non-comment.
+ // (We'll add another blank line after our comment block.)
+ // When we start dropping // +build comments, we can skip over /* */ comments too.
+ // Note that we are processing tabwriter input, so every comment
+ // begins and ends with a tabwriter.Escape byte.
+ // And some newlines have turned into \f bytes.
+ insert := 0
+ for pos := 0; ; {
+ // Skip leading space at beginning of line.
+ blank := true
+ for pos < len(p.output) && (p.output[pos] == ' ' || p.output[pos] == '\t') {
+ pos++
+ }
+ // Skip over // comment if any.
+ if pos+3 < len(p.output) && p.output[pos] == tabwriter.Escape && p.output[pos+1] == '/' && p.output[pos+2] == '/' {
+ blank = false
+ for pos < len(p.output) && !isNL(p.output[pos]) {
+ pos++
+ }
+ }
+ // Skip over \n at end of line.
+ if pos >= len(p.output) || !isNL(p.output[pos]) {
+ break
+ }
+ pos++
+
+ if blank {
+ insert = pos
+ }
+ }
+
+ // If there is a //go:build comment before the place we identified,
+ // use that point instead. (Earlier in the file is always fine.)
+ if len(p.goBuild) > 0 && p.goBuild[0] < insert {
+ insert = p.goBuild[0]
+ } else if len(p.plusBuild) > 0 && p.plusBuild[0] < insert {
+ insert = p.plusBuild[0]
+ }
+
+ var x constraint.Expr
+ switch len(p.goBuild) {
+ case 0:
+ // Synthesize //go:build expression from // +build lines.
+ for _, pos := range p.plusBuild {
+ y, err := constraint.Parse(p.commentTextAt(pos))
+ if err != nil {
+ x = nil
+ break
+ }
+ if x == nil {
+ x = y
+ } else {
+ x = &constraint.AndExpr{X: x, Y: y}
+ }
+ }
+ case 1:
+ // Parse //go:build expression.
+ x, _ = constraint.Parse(p.commentTextAt(p.goBuild[0]))
+ }
+
+ var block []byte
+ if x == nil {
+ // Don't have a valid //go:build expression to treat as truth.
+ // Bring all the lines together but leave them alone.
+ // Note that these are already tabwriter-escaped.
+ for _, pos := range p.goBuild {
+ block = append(block, p.lineAt(pos)...)
+ }
+ for _, pos := range p.plusBuild {
+ block = append(block, p.lineAt(pos)...)
+ }
+ } else {
+ block = append(block, tabwriter.Escape)
+ block = append(block, "//go:build "...)
+ block = append(block, x.String()...)
+ block = append(block, tabwriter.Escape, '\n')
+ if len(p.plusBuild) > 0 {
+ lines, err := constraint.PlusBuildLines(x)
+ if err != nil {
+ lines = []string{"// +build error: " + err.Error()}
+ }
+ for _, line := range lines {
+ block = append(block, tabwriter.Escape)
+ block = append(block, line...)
+ block = append(block, tabwriter.Escape, '\n')
+ }
+ }
+ }
+ block = append(block, '\n')
+
+ // Build sorted list of lines to delete from remainder of output.
+ toDelete := append(p.goBuild, p.plusBuild...)
+ sort.Ints(toDelete)
+
+ // Collect output after insertion point, with lines deleted, into after.
+ var after []byte
+ start := insert
+ for _, end := range toDelete {
+ if end < start {
+ continue
+ }
+ after = appendLines(after, p.output[start:end])
+ start = end + len(p.lineAt(end))
+ }
+ after = appendLines(after, p.output[start:])
+ if n := len(after); n >= 2 && isNL(after[n-1]) && isNL(after[n-2]) {
+ after = after[:n-1]
+ }
+
+ p.output = p.output[:insert]
+ p.output = append(p.output, block...)
+ p.output = append(p.output, after...)
+}
+
+// appendLines is like append(x, y...)
+// but it avoids creating doubled blank lines,
+// which would not be gofmt-standard output.
+// It assumes that only whole blocks of lines are being appended,
+// not line fragments.
+func appendLines(x, y []byte) []byte {
+ if len(y) > 0 && isNL(y[0]) && // y starts in blank line
+ (len(x) == 0 || len(x) >= 2 && isNL(x[len(x)-1]) && isNL(x[len(x)-2])) { // x is empty or ends in blank line
+ y = y[1:] // delete y's leading blank line
+ }
+ return append(x, y...)
+}
+
+func (p *printer) lineAt(start int) []byte {
+ pos := start
+ for pos < len(p.output) && !isNL(p.output[pos]) {
+ pos++
+ }
+ if pos < len(p.output) {
+ pos++
+ }
+ return p.output[start:pos]
+}
+
+func (p *printer) commentTextAt(start int) string {
+ if start < len(p.output) && p.output[start] == tabwriter.Escape {
+ start++
+ }
+ pos := start
+ for pos < len(p.output) && p.output[pos] != tabwriter.Escape && !isNL(p.output[pos]) {
+ pos++
+ }
+ return string(p.output[start:pos])
+}
+
+func isNL(b byte) bool {
+ return b == '\n' || b == '\f'
+}
diff --git a/src/go/printer/nodes.go b/src/go/printer/nodes.go
index cc795532b0..1c0a14ec15 100644
--- a/src/go/printer/nodes.go
+++ b/src/go/printer/nodes.go
@@ -870,7 +870,11 @@ func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
// TODO(gri): should treat[] like parentheses and undo one level of depth
p.expr1(x.X, token.HighestPrec, 1)
p.print(x.Lbrack, token.LBRACK)
- p.expr0(x.Index, depth+1)
+ if e, _ := x.Index.(*ast.ListExpr); e != nil {
+ p.exprList(x.Lbrack, e.ElemList, depth+1, commaTerm, x.Rbrack, false)
+ } else {
+ p.expr0(x.Index, depth+1)
+ }
p.print(x.Rbrack, token.RBRACK)
case *ast.SliceExpr:
@@ -919,32 +923,25 @@ func (p *printer) expr1(expr ast.Expr, prec1, depth int) {
depth++
}
var wasIndented bool
- if x.Brackets {
+ if _, ok := x.Fun.(*ast.FuncType); ok {
+ // conversions to literal function types require parentheses around the type
+ p.print(token.LPAREN)
wasIndented = p.possibleSelectorExpr(x.Fun, token.HighestPrec, depth)
- p.print(x.Lparen, token.LBRACK)
- p.exprList(x.Lparen, x.Args, depth, commaTerm, x.Rparen, false)
- p.print(x.Rparen, token.RBRACK)
+ p.print(token.RPAREN)
} else {
- if _, ok := x.Fun.(*ast.FuncType); ok {
- // conversions to literal function types require parentheses around the type
- p.print(token.LPAREN)
- wasIndented = p.possibleSelectorExpr(x.Fun, token.HighestPrec, depth)
- p.print(token.RPAREN)
- } else {
- wasIndented = p.possibleSelectorExpr(x.Fun, token.HighestPrec, depth)
- }
- p.print(x.Lparen, token.LPAREN)
- if x.Ellipsis.IsValid() {
- p.exprList(x.Lparen, x.Args, depth, 0, x.Ellipsis, false)
- p.print(x.Ellipsis, token.ELLIPSIS)
- if x.Rparen.IsValid() && p.lineFor(x.Ellipsis) < p.lineFor(x.Rparen) {
- p.print(token.COMMA, formfeed)
- }
- } else {
- p.exprList(x.Lparen, x.Args, depth, commaTerm, x.Rparen, false)
+ wasIndented = p.possibleSelectorExpr(x.Fun, token.HighestPrec, depth)
+ }
+ p.print(x.Lparen, token.LPAREN)
+ if x.Ellipsis.IsValid() {
+ p.exprList(x.Lparen, x.Args, depth, 0, x.Ellipsis, false)
+ p.print(x.Ellipsis, token.ELLIPSIS)
+ if x.Rparen.IsValid() && p.lineFor(x.Ellipsis) < p.lineFor(x.Rparen) {
+ p.print(token.COMMA, formfeed)
}
- p.print(x.Rparen, token.RPAREN)
+ } else {
+ p.exprList(x.Lparen, x.Args, depth, commaTerm, x.Rparen, false)
}
+ p.print(x.Rparen, token.RPAREN)
if wasIndented {
p.print(unindent)
}
diff --git a/src/go/printer/printer.go b/src/go/printer/printer.go
index 0077afeaff..f02c1b847b 100644
--- a/src/go/printer/printer.go
+++ b/src/go/printer/printer.go
@@ -8,6 +8,7 @@ package printer
import (
"fmt"
"go/ast"
+ "go/build/constraint"
"go/token"
"io"
"os"
@@ -64,6 +65,8 @@ type printer struct {
lastTok token.Token // last token printed (token.ILLEGAL if it's whitespace)
prevOpen token.Token // previous non-brace "open" token (, [, or token.ILLEGAL
wsbuf []whiteSpace // delayed white space
+ goBuild []int // start index of all //go:build comments in output
+ plusBuild []int // start index of all // +build comments in output
// Positions
// The out position differs from the pos position when the result
@@ -649,6 +652,11 @@ func (p *printer) writeComment(comment *ast.Comment) {
// shortcut common case of //-style comments
if text[1] == '/' {
+ if constraint.IsGoBuild(text) {
+ p.goBuild = append(p.goBuild, len(p.output))
+ } else if constraint.IsPlusBuild(text) {
+ p.plusBuild = append(p.plusBuild, len(p.output))
+ }
p.writeString(pos, trimRight(text), true)
return
}
@@ -1122,6 +1130,8 @@ func (p *printer) printNode(node interface{}) error {
// get comments ready for use
p.nextComment()
+ p.print(pmode(0))
+
// format node
switch n := node.(type) {
case ast.Expr:
@@ -1313,6 +1323,10 @@ func (cfg *Config) fprint(output io.Writer, fset *token.FileSet, node interface{
p.impliedSemi = false // EOF acts like a newline
p.flush(token.Position{Offset: infinity, Line: infinity}, token.EOF)
+ // output is buffered in p.output now.
+ // fix //go:build and // +build comments if needed.
+ p.fixGoBuildLines()
+
// redirect output through a trimmer to eliminate trailing whitespace
// (Input to a tabwriter must be untrimmed since trailing tabs provide
// formatting information. The tabwriter could provide trimming
diff --git a/src/go/printer/printer_test.go b/src/go/printer/printer_test.go
index b15dcbf000..e03c2df063 100644
--- a/src/go/printer/printer_test.go
+++ b/src/go/printer/printer_test.go
@@ -19,6 +19,10 @@ import (
"time"
)
+// parseTypeParams tells go/parser to parse type parameters. Must be kept in
+// sync with go/parser/interface.go.
+const parseTypeParams parser.Mode = 1 << 30
+
const (
dataDir = "testdata"
tabwidth = 8
@@ -35,6 +39,7 @@ const (
rawFormat
normNumber
idempotent
+ allowTypeParams
)
// format parses src, prints the corresponding AST, verifies the resulting
@@ -42,7 +47,11 @@ const (
// if any.
func format(src []byte, mode checkMode) ([]byte, error) {
// parse src
- f, err := parser.ParseFile(fset, "", src, parser.ParseComments|parser.ParseTypeParams)
+ parseMode := parser.ParseComments
+ if mode&allowTypeParams != 0 {
+ parseMode |= parseTypeParams
+ }
+ f, err := parser.ParseFile(fset, "", src, parseMode)
if err != nil {
return nil, fmt.Errorf("parse: %s\n%s", err, src)
}
@@ -70,7 +79,7 @@ func format(src []byte, mode checkMode) ([]byte, error) {
// make sure formatted output is syntactically correct
res := buf.Bytes()
- if _, err := parser.ParseFile(fset, "", res, parser.ParseTypeParams); err != nil {
+ if _, err := parser.ParseFile(fset, "", res, parseTypeParams); err != nil {
return nil, fmt.Errorf("re-parse: %s\n%s", err, buf.Bytes())
}
@@ -88,8 +97,11 @@ func lineAt(text []byte, offs int) []byte {
// diff compares a and b.
func diff(aname, bname string, a, b []byte) error {
- var buf bytes.Buffer // holding long error message
+ if bytes.Equal(a, b) {
+ return nil
+ }
+ var buf bytes.Buffer // holding long error message
// compare lengths
if len(a) != len(b) {
fmt.Fprintf(&buf, "\nlength changed: len(%s) = %d, len(%s) = %d", aname, len(a), bname, len(b))
@@ -97,7 +109,7 @@ func diff(aname, bname string, a, b []byte) error {
// compare contents
line := 1
- offs := 1
+ offs := 0
for i := 0; i < len(a) && i < len(b); i++ {
ch := a[i]
if ch != b[i] {
@@ -112,10 +124,8 @@ func diff(aname, bname string, a, b []byte) error {
}
}
- if buf.Len() > 0 {
- return errors.New(buf.String())
- }
- return nil
+ fmt.Fprintf(&buf, "\n%s:\n%s\n%s:\n%s", aname, a, bname, b)
+ return errors.New(buf.String())
}
func runcheck(t *testing.T, source, golden string, mode checkMode) {
@@ -200,13 +210,20 @@ var data = []entry{
{"linebreaks.input", "linebreaks.golden", idempotent},
{"expressions.input", "expressions.golden", idempotent},
{"expressions.input", "expressions.raw", rawFormat | idempotent},
- {"declarations.input", "declarations.golden", 0},
+ {"declarations.input", "declarations.golden", allowTypeParams},
{"statements.input", "statements.golden", 0},
{"slow.input", "slow.golden", idempotent},
{"complit.input", "complit.x", export},
{"go2numbers.input", "go2numbers.golden", idempotent},
{"go2numbers.input", "go2numbers.norm", normNumber | idempotent},
- {"generics.input", "generics.golden", idempotent},
+ {"generics.input", "generics.golden", idempotent | allowTypeParams},
+ {"gobuild1.input", "gobuild1.golden", idempotent},
+ {"gobuild2.input", "gobuild2.golden", idempotent},
+ {"gobuild3.input", "gobuild3.golden", idempotent},
+ {"gobuild4.input", "gobuild4.golden", idempotent},
+ {"gobuild5.input", "gobuild5.golden", idempotent},
+ {"gobuild6.input", "gobuild6.golden", idempotent},
+ {"gobuild7.input", "gobuild7.golden", idempotent},
}
func TestFiles(t *testing.T) {
diff --git a/src/go/printer/testdata/gobuild1.golden b/src/go/printer/testdata/gobuild1.golden
new file mode 100644
index 0000000000..649da40e91
--- /dev/null
+++ b/src/go/printer/testdata/gobuild1.golden
@@ -0,0 +1,6 @@
+//go:build x
+// +build x
+
+package p
+
+func f()
diff --git a/src/go/printer/testdata/gobuild1.input b/src/go/printer/testdata/gobuild1.input
new file mode 100644
index 0000000000..6538ee61af
--- /dev/null
+++ b/src/go/printer/testdata/gobuild1.input
@@ -0,0 +1,7 @@
+package p
+
+//go:build x
+
+func f()
+
+// +build y
diff --git a/src/go/printer/testdata/gobuild2.golden b/src/go/printer/testdata/gobuild2.golden
new file mode 100644
index 0000000000..c46fd34c55
--- /dev/null
+++ b/src/go/printer/testdata/gobuild2.golden
@@ -0,0 +1,8 @@
+//go:build x
+// +build x
+
+// other comment
+
+package p
+
+func f()
diff --git a/src/go/printer/testdata/gobuild2.input b/src/go/printer/testdata/gobuild2.input
new file mode 100644
index 0000000000..f0f772a7b2
--- /dev/null
+++ b/src/go/printer/testdata/gobuild2.input
@@ -0,0 +1,9 @@
+// +build y
+
+// other comment
+
+package p
+
+func f()
+
+//go:build x
diff --git a/src/go/printer/testdata/gobuild3.golden b/src/go/printer/testdata/gobuild3.golden
new file mode 100644
index 0000000000..db92c5787e
--- /dev/null
+++ b/src/go/printer/testdata/gobuild3.golden
@@ -0,0 +1,10 @@
+// other comment
+
+//go:build x
+// +build x
+
+// yet another comment
+
+package p
+
+func f()
diff --git a/src/go/printer/testdata/gobuild3.input b/src/go/printer/testdata/gobuild3.input
new file mode 100644
index 0000000000..d0c97b27ad
--- /dev/null
+++ b/src/go/printer/testdata/gobuild3.input
@@ -0,0 +1,11 @@
+// other comment
+
+// +build y
+
+// yet another comment
+
+package p
+
+//go:build x
+
+func f()
diff --git a/src/go/printer/testdata/gobuild4.golden b/src/go/printer/testdata/gobuild4.golden
new file mode 100644
index 0000000000..b16477f9ad
--- /dev/null
+++ b/src/go/printer/testdata/gobuild4.golden
@@ -0,0 +1,6 @@
+//go:build (x || y) && z
+// +build x y
+// +build z
+
+// doc comment
+package p
diff --git a/src/go/printer/testdata/gobuild4.input b/src/go/printer/testdata/gobuild4.input
new file mode 100644
index 0000000000..29d5a0ae14
--- /dev/null
+++ b/src/go/printer/testdata/gobuild4.input
@@ -0,0 +1,5 @@
+// doc comment
+package p
+
+// +build x y
+// +build z
diff --git a/src/go/printer/testdata/gobuild5.golden b/src/go/printer/testdata/gobuild5.golden
new file mode 100644
index 0000000000..2808a53cce
--- /dev/null
+++ b/src/go/printer/testdata/gobuild5.golden
@@ -0,0 +1,4 @@
+//go:build !(x || y) && z
+// +build !x,!y,z
+
+package p
diff --git a/src/go/printer/testdata/gobuild5.input b/src/go/printer/testdata/gobuild5.input
new file mode 100644
index 0000000000..ec5815cdc6
--- /dev/null
+++ b/src/go/printer/testdata/gobuild5.input
@@ -0,0 +1,4 @@
+//go:build !(x || y) && z
+// +build something else
+
+package p
diff --git a/src/go/printer/testdata/gobuild6.golden b/src/go/printer/testdata/gobuild6.golden
new file mode 100644
index 0000000000..abb1e2acbb
--- /dev/null
+++ b/src/go/printer/testdata/gobuild6.golden
@@ -0,0 +1,5 @@
+//go:build !(x || y) && z
+
+// no +build line
+
+package p
diff --git a/src/go/printer/testdata/gobuild6.input b/src/go/printer/testdata/gobuild6.input
new file mode 100644
index 0000000000..162189754f
--- /dev/null
+++ b/src/go/printer/testdata/gobuild6.input
@@ -0,0 +1,4 @@
+//go:build !(x || y) && z
+// no +build line
+
+package p
diff --git a/src/go/printer/testdata/gobuild7.golden b/src/go/printer/testdata/gobuild7.golden
new file mode 100644
index 0000000000..bf41dd4b59
--- /dev/null
+++ b/src/go/printer/testdata/gobuild7.golden
@@ -0,0 +1,11 @@
+// Copyright 2013 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.
+
+// TODO(rsc): Delete this file once Go 1.17 comes out and we can retire Go 1.15 support.
+
+//go:build !go1.16
+// +build !go1.16
+
+// Package buildtag defines an Analyzer that checks build tags.
+package buildtag
diff --git a/src/go/printer/testdata/gobuild7.input b/src/go/printer/testdata/gobuild7.input
new file mode 100644
index 0000000000..bf41dd4b59
--- /dev/null
+++ b/src/go/printer/testdata/gobuild7.input
@@ -0,0 +1,11 @@
+// Copyright 2013 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.
+
+// TODO(rsc): Delete this file once Go 1.17 comes out and we can retire Go 1.15 support.
+
+//go:build !go1.16
+// +build !go1.16
+
+// Package buildtag defines an Analyzer that checks build tags.
+package buildtag
diff --git a/src/go/token/position.go b/src/go/token/position.go
index a21f5fd056..bbcd8b022b 100644
--- a/src/go/token/position.go
+++ b/src/go/token/position.go
@@ -540,7 +540,7 @@ func searchInts(a []int, x int) int {
// TODO(gri): Remove this when compilers have caught up.
i, j := 0, len(a)
for i < j {
- h := i + (j-i)/2 // avoid overflow when computing h
+ h := i + (j-i)>>1 // avoid overflow when computing h
// i ≤ h < j
if a[h] <= x {
i = h + 1
diff --git a/src/go/token/position_bench_test.go b/src/go/token/position_bench_test.go
new file mode 100644
index 0000000000..41be7285b7
--- /dev/null
+++ b/src/go/token/position_bench_test.go
@@ -0,0 +1,24 @@
+// Copyright 2021 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.
+
+package token
+
+import (
+ "testing"
+)
+
+func BenchmarkSearchInts(b *testing.B) {
+ data := make([]int, 10000)
+ for i := 0; i < 10000; i++ {
+ data[i] = i
+ }
+ const x = 8
+ if r := searchInts(data, x); r != x {
+ b.Errorf("got index = %d; want %d", r, x)
+ }
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ searchInts(data, x)
+ }
+}
diff --git a/src/go/types/api.go b/src/go/types/api.go
index ec12fcf380..436c23099b 100644
--- a/src/go/types/api.go
+++ b/src/go/types/api.go
@@ -101,6 +101,13 @@ type ImporterFrom interface {
// A Config specifies the configuration for type checking.
// The zero value for Config is a ready-to-use default configuration.
type Config struct {
+ // GoVersion describes the accepted Go language version. The string
+ // must follow the format "go%d.%d" (e.g. "go1.12") or it must be
+ // empty; an empty string indicates the latest language version.
+ // If the format is invalid, invoking the type checker will cause a
+ // panic.
+ GoVersion string
+
// If IgnoreFuncBodies is set, function bodies are not
// type-checked.
IgnoreFuncBodies bool
@@ -177,11 +184,11 @@ type Info struct {
// qualified identifiers are collected in the Uses map.
Types map[ast.Expr]TypeAndValue
- // Inferred maps calls of parameterized functions that use
- // type inference to the inferred type arguments and signature
+ // _Inferred maps calls of parameterized functions that use
+ // type inference to the _Inferred type arguments and signature
// of the function called. The recorded "call" expression may be
// an *ast.CallExpr (as in f(x)), or an *ast.IndexExpr (s in f[T]).
- Inferred map[ast.Expr]Inferred
+ _Inferred map[ast.Expr]_Inferred
// Defs maps identifiers to the objects they define (including
// package names, dots "." of dot-imports, and blank "_" identifiers).
@@ -339,9 +346,9 @@ func (tv TypeAndValue) HasOk() bool {
return tv.mode == commaok || tv.mode == mapindex
}
-// Inferred reports the inferred type arguments and signature
+// _Inferred reports the _Inferred type arguments and signature
// for a parameterized function call that uses type inference.
-type Inferred struct {
+type _Inferred struct {
Targs []Type
Sig *Signature
}
diff --git a/src/go/types/api_go1.18.go b/src/go/types/api_go1.18.go
new file mode 100644
index 0000000000..d98f4ef0dc
--- /dev/null
+++ b/src/go/types/api_go1.18.go
@@ -0,0 +1,22 @@
+// Copyright 2021 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.
+
+//go:build go1.18
+// +build go1.18
+
+package types
+
+import (
+ "go/ast"
+)
+
+type Inferred = _Inferred
+
+func GetInferred(info *Info) map[ast.Expr]Inferred {
+ return info._Inferred
+}
+
+func SetInferred(info *Info, inferred map[ast.Expr]Inferred) {
+ info._Inferred = inferred
+}
diff --git a/src/go/types/api_go1.18_test.go b/src/go/types/api_go1.18_test.go
new file mode 100644
index 0000000000..bbbf70581d
--- /dev/null
+++ b/src/go/types/api_go1.18_test.go
@@ -0,0 +1,138 @@
+// Copyright 2021 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.
+
+//go:build go1.18
+
+package types_test
+
+import (
+ "fmt"
+ "go/ast"
+ "testing"
+
+ . "go/types"
+)
+
+func TestInferredInfo(t *testing.T) {
+ var tests = []struct {
+ src string
+ fun string
+ targs []string
+ sig string
+ }{
+ {genericPkg + `p0; func f[T any](T); func _() { f(42) }`,
+ `f`,
+ []string{`int`},
+ `func(int)`,
+ },
+ {genericPkg + `p1; func f[T any](T) T; func _() { f('@') }`,
+ `f`,
+ []string{`rune`},
+ `func(rune) rune`,
+ },
+ {genericPkg + `p2; func f[T any](...T) T; func _() { f(0i) }`,
+ `f`,
+ []string{`complex128`},
+ `func(...complex128) complex128`,
+ },
+ {genericPkg + `p3; func f[A, B, C any](A, *B, []C); func _() { f(1.2, new(string), []byte{}) }`,
+ `f`,
+ []string{`float64`, `string`, `byte`},
+ `func(float64, *string, []byte)`,
+ },
+ {genericPkg + `p4; func f[A, B any](A, *B, ...[]B); func _() { f(1.2, new(byte)) }`,
+ `f`,
+ []string{`float64`, `byte`},
+ `func(float64, *byte, ...[]byte)`,
+ },
+
+ {genericPkg + `s1; func f[T any, P interface{type *T}](x T); func _(x string) { f(x) }`,
+ `f`,
+ []string{`string`, `*string`},
+ `func(x string)`,
+ },
+ {genericPkg + `s2; func f[T any, P interface{type *T}](x []T); func _(x []int) { f(x) }`,
+ `f`,
+ []string{`int`, `*int`},
+ `func(x []int)`,
+ },
+ {genericPkg + `s3; type C[T any] interface{type chan<- T}; func f[T any, P C[T]](x []T); func _(x []int) { f(x) }`,
+ `f`,
+ []string{`int`, `chan<- int`},
+ `func(x []int)`,
+ },
+ {genericPkg + `s4; type C[T any] interface{type chan<- T}; func f[T any, P C[T], Q C[[]*P]](x []T); func _(x []int) { f(x) }`,
+ `f`,
+ []string{`int`, `chan<- int`, `chan<- []*chan<- int`},
+ `func(x []int)`,
+ },
+
+ {genericPkg + `t1; func f[T any, P interface{type *T}]() T; func _() { _ = f[string] }`,
+ `f`,
+ []string{`string`, `*string`},
+ `func() string`,
+ },
+ {genericPkg + `t2; type C[T any] interface{type chan<- T}; func f[T any, P C[T]]() []T; func _() { _ = f[int] }`,
+ `f`,
+ []string{`int`, `chan<- int`},
+ `func() []int`,
+ },
+ {genericPkg + `t3; type C[T any] interface{type chan<- T}; func f[T any, P C[T], Q C[[]*P]]() []T; func _() { _ = f[int] }`,
+ `f`,
+ []string{`int`, `chan<- int`, `chan<- []*chan<- int`},
+ `func() []int`,
+ },
+ }
+
+ for _, test := range tests {
+ info := Info{}
+ SetInferred(&info, make(map[ast.Expr]Inferred))
+ name, err := mayTypecheck(t, "InferredInfo", test.src, &info)
+ if err != nil {
+ t.Errorf("package %s: %v", name, err)
+ continue
+ }
+
+ // look for inferred type arguments and signature
+ var targs []Type
+ var sig *Signature
+ for call, inf := range GetInferred(&info) {
+ var fun ast.Expr
+ switch x := call.(type) {
+ case *ast.CallExpr:
+ fun = x.Fun
+ case *ast.IndexExpr:
+ fun = x.X
+ default:
+ panic(fmt.Sprintf("unexpected call expression type %T", call))
+ }
+ if ExprString(fun) == test.fun {
+ targs = inf.Targs
+ sig = inf.Sig
+ break
+ }
+ }
+ if targs == nil {
+ t.Errorf("package %s: no inferred information found for %s", name, test.fun)
+ continue
+ }
+
+ // check that type arguments are correct
+ if len(targs) != len(test.targs) {
+ t.Errorf("package %s: got %d type arguments; want %d", name, len(targs), len(test.targs))
+ continue
+ }
+ for i, targ := range targs {
+ if got := targ.String(); got != test.targs[i] {
+ t.Errorf("package %s, %d. type argument: got %s; want %s", name, i, got, test.targs[i])
+ continue
+ }
+ }
+
+ // check that signature is correct
+ if got := sig.String(); got != test.sig {
+ t.Errorf("package %s: got %s; want %s", name, got, test.sig)
+ }
+ }
+}
diff --git a/src/go/types/api_go2go.go b/src/go/types/api_go2go.go
new file mode 100644
index 0000000000..45ce10252c
--- /dev/null
+++ b/src/go/types/api_go2go.go
@@ -0,0 +1,22 @@
+// Copyright 2021 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.
+
+package types
+
+import (
+ "go/ast"
+)
+
+// This file exposes additional API methods related to type parameters, for use
+// in the go2go rewriter.
+
+type Inferred = _Inferred
+
+func GetInferred(info *Info) map[ast.Expr]Inferred {
+ return info._Inferred
+}
+
+func SetInferred(info *Info, inferred map[ast.Expr]Inferred) {
+ info._Inferred = inferred
+}
diff --git a/src/go/types/api_test.go b/src/go/types/api_test.go
index 014cd5282e..0226a857bd 100644
--- a/src/go/types/api_test.go
+++ b/src/go/types/api_test.go
@@ -49,7 +49,7 @@ const genericPkg = "package generic_"
func modeForSource(src string) parser.Mode {
if strings.HasPrefix(src, genericPkg) {
- return parser.ParseTypeParams
+ return parseTypeParams
}
return 0
}
@@ -188,6 +188,9 @@ func TestValuesInfo(t *testing.T) {
}
func TestTypesInfo(t *testing.T) {
+ // Test sources that are not expected to typecheck must start with the broken prefix.
+ const broken = "package broken_"
+
var tests = []struct {
src string
expr string // expression
@@ -200,6 +203,39 @@ func TestTypesInfo(t *testing.T) {
{`package b3; var x interface{} = 0i`, `0i`, `complex128`},
{`package b4; var x interface{} = "foo"`, `"foo"`, `string`},
+ // uses of nil
+ {`package n0; var _ *int = nil`, `nil`, `untyped nil`},
+ {`package n1; var _ func() = nil`, `nil`, `untyped nil`},
+ {`package n2; var _ []byte = nil`, `nil`, `untyped nil`},
+ {`package n3; var _ map[int]int = nil`, `nil`, `untyped nil`},
+ {`package n4; var _ chan int = nil`, `nil`, `untyped nil`},
+ {`package n5; var _ interface{} = nil`, `nil`, `untyped nil`},
+ {`package n6; import "unsafe"; var _ unsafe.Pointer = nil`, `nil`, `untyped nil`},
+
+ {`package n10; var (x *int; _ = x == nil)`, `nil`, `untyped nil`},
+ {`package n11; var (x func(); _ = x == nil)`, `nil`, `untyped nil`},
+ {`package n12; var (x []byte; _ = x == nil)`, `nil`, `untyped nil`},
+ {`package n13; var (x map[int]int; _ = x == nil)`, `nil`, `untyped nil`},
+ {`package n14; var (x chan int; _ = x == nil)`, `nil`, `untyped nil`},
+ {`package n15; var (x interface{}; _ = x == nil)`, `nil`, `untyped nil`},
+ {`package n15; import "unsafe"; var (x unsafe.Pointer; _ = x == nil)`, `nil`, `untyped nil`},
+
+ {`package n20; var _ = (*int)(nil)`, `nil`, `untyped nil`},
+ {`package n21; var _ = (func())(nil)`, `nil`, `untyped nil`},
+ {`package n22; var _ = ([]byte)(nil)`, `nil`, `untyped nil`},
+ {`package n23; var _ = (map[int]int)(nil)`, `nil`, `untyped nil`},
+ {`package n24; var _ = (chan int)(nil)`, `nil`, `untyped nil`},
+ {`package n25; var _ = (interface{})(nil)`, `nil`, `untyped nil`},
+ {`package n26; import "unsafe"; var _ = unsafe.Pointer(nil)`, `nil`, `untyped nil`},
+
+ {`package n30; func f(*int) { f(nil) }`, `nil`, `untyped nil`},
+ {`package n31; func f(func()) { f(nil) }`, `nil`, `untyped nil`},
+ {`package n32; func f([]byte) { f(nil) }`, `nil`, `untyped nil`},
+ {`package n33; func f(map[int]int) { f(nil) }`, `nil`, `untyped nil`},
+ {`package n34; func f(chan int) { f(nil) }`, `nil`, `untyped nil`},
+ {`package n35; func f(interface{}) { f(nil) }`, `nil`, `untyped nil`},
+ {`package n35; import "unsafe"; func f(unsafe.Pointer) { f(nil) }`, `nil`, `untyped nil`},
+
// comma-ok expressions
{`package p0; var x interface{}; var _, _ = x.(int)`,
`x.(int)`,
@@ -281,25 +317,27 @@ func TestTypesInfo(t *testing.T) {
},
// tests for broken code that doesn't parse or type-check
- {`package x0; func _() { var x struct {f string}; x.f := 0 }`, `x.f`, `string`},
- {`package x1; func _() { var z string; type x struct {f string}; y := &x{q: z}}`, `z`, `string`},
- {`package x2; func _() { var a, b string; type x struct {f string}; z := &x{f: a, f: b,}}`, `b`, `string`},
- {`package x3; var x = panic("");`, `panic`, `func(interface{})`},
+ {broken + `x0; func _() { var x struct {f string}; x.f := 0 }`, `x.f`, `string`},
+ {broken + `x1; func _() { var z string; type x struct {f string}; y := &x{q: z}}`, `z`, `string`},
+ {broken + `x2; func _() { var a, b string; type x struct {f string}; z := &x{f: a; f: b;}}`, `b`, `string`},
+ {broken + `x3; var x = panic("");`, `panic`, `func(interface{})`},
{`package x4; func _() { panic("") }`, `panic`, `func(interface{})`},
- {`package x5; func _() { var x map[string][...]int; x = map[string][...]int{"": {1,2,3}} }`, `x`, `map[string][-1]int`},
+ {broken + `x5; func _() { var x map[string][...]int; x = map[string][...]int{"": {1,2,3}} }`, `x`, `map[string][-1]int`},
// parameterized functions
- {genericPkg + `p0; func f[T any](T); var _ = f(int)`, `f`, `func[T₁ any](T₁)`},
- {genericPkg + `p1; func f[T any](T); var _ = f(int)`, `f(int)`, `func(int)`},
- {genericPkg + `p2; func f[T any](T); var _ = f(42)`, `f`, `func[T₁ any](T₁)`},
- {genericPkg + `p2; func f[T any](T); var _ = f(42)`, `f(42)`, `()`},
+ {genericPkg + `p0; func f[T any](T); var _ = f[int]`, `f`, `func[T₁ interface{}](T₁)`},
+ {genericPkg + `p1; func f[T any](T); var _ = f[int]`, `f[int]`, `func(int)`},
+ {genericPkg + `p2; func f[T any](T); func _() { f(42) }`, `f`, `func[T₁ interface{}](T₁)`},
+ {genericPkg + `p3; func f[T any](T); func _() { f(42) }`, `f(42)`, `()`},
// type parameters
{genericPkg + `t0; type t[] int; var _ t`, `t`, `generic_t0.t`}, // t[] is a syntax error that is ignored in this test in favor of t
- {genericPkg + `t1; type t[P any] int; var _ t[int]`, `t`, `generic_t1.t[P₁ any]`},
+ {genericPkg + `t1; type t[P any] int; var _ t[int]`, `t`, `generic_t1.t[P₁ interface{}]`},
{genericPkg + `t2; type t[P interface{}] int; var _ t[int]`, `t`, `generic_t2.t[P₁ interface{}]`},
{genericPkg + `t3; type t[P, Q interface{}] int; var _ t[int, int]`, `t`, `generic_t3.t[P₁, Q₂ interface{}]`},
- {genericPkg + `t4; type t[P, Q interface{ m() }] int; var _ t[int, int]`, `t`, `generic_t4.t[P₁, Q₂ interface{m()}]`},
+
+ // TODO (rFindley): compare with types2, which resolves the type broken_t4.t[P₁, Q₂ interface{m()}] here
+ {broken + `t4; type t[P, Q interface{ m() }] int; var _ t[int, int]`, `t`, `broken_t4.t`},
// instantiated types must be sanitized
{genericPkg + `g0; type t[P any] int; var x struct{ f t[int] }; var _ = x.f`, `x.f`, `generic_g0.t[int]`},
@@ -307,7 +345,17 @@ func TestTypesInfo(t *testing.T) {
for _, test := range tests {
info := Info{Types: make(map[ast.Expr]TypeAndValue)}
- name, _ := mayTypecheck(t, "TypesInfo", test.src, &info)
+ var name string
+ if strings.HasPrefix(test.src, broken) {
+ var err error
+ name, err = mayTypecheck(t, "TypesInfo", test.src, &info)
+ if err == nil {
+ t.Errorf("package %s: expected to fail but passed", name)
+ continue
+ }
+ } else {
+ name = mustTypecheck(t, "TypesInfo", test.src, &info)
+ }
// look for expression type
var typ Type
@@ -329,128 +377,6 @@ func TestTypesInfo(t *testing.T) {
}
}
-func TestInferredInfo(t *testing.T) {
- var tests = []struct {
- src string
- fun string
- targs []string
- sig string
- }{
- {genericPkg + `p0; func f[T any](T); func _() { f(42) }`,
- `f`,
- []string{`int`},
- `func(int)`,
- },
- {genericPkg + `p1; func f[T any](T) T; func _() { f('@') }`,
- `f`,
- []string{`rune`},
- `func(rune) rune`,
- },
- {genericPkg + `p2; func f[T any](...T) T; func _() { f(0i) }`,
- `f`,
- []string{`complex128`},
- `func(...complex128) complex128`,
- },
- {genericPkg + `p3; func f[A, B, C any](A, *B, []C); func _() { f(1.2, new(string), []byte{}) }`,
- `f`,
- []string{`float64`, `string`, `byte`},
- `func(float64, *string, []byte)`,
- },
- {genericPkg + `p4; func f[A, B any](A, *B, ...[]B); func _() { f(1.2, new(byte)) }`,
- `f`,
- []string{`float64`, `byte`},
- `func(float64, *byte, ...[]byte)`,
- },
-
- {genericPkg + `s1; func f[T any, P interface{type *T}](x T); func _(x string) { f(x) }`,
- `f`,
- []string{`string`, `*string`},
- `func(x string)`,
- },
- {genericPkg + `s2; func f[T any, P interface{type *T}](x []T); func _(x []int) { f(x) }`,
- `f`,
- []string{`int`, `*int`},
- `func(x []int)`,
- },
- {genericPkg + `s3; type C[T any] interface{type chan<- T}; func f[T any, P C[T]](x []T); func _(x []int) { f(x) }`,
- `f`,
- []string{`int`, `chan<- int`},
- `func(x []int)`,
- },
- {genericPkg + `s4; type C[T any] interface{type chan<- T}; func f[T any, P C[T], Q C[[]*P]](x []T); func _(x []int) { f(x) }`,
- `f`,
- []string{`int`, `chan<- int`, `chan<- []*chan<- int`},
- `func(x []int)`,
- },
-
- {genericPkg + `t1; func f[T any, P interface{type *T}]() T; func _() { _ = f[string] }`,
- `f`,
- []string{`string`, `*string`},
- `func() string`,
- },
- {genericPkg + `t2; type C[T any] interface{type chan<- T}; func f[T any, P C[T]]() []T; func _() { _ = f[int] }`,
- `f`,
- []string{`int`, `chan<- int`},
- `func() []int`,
- },
- {genericPkg + `t3; type C[T any] interface{type chan<- T}; func f[T any, P C[T], Q C[[]*P]]() []T; func _() { _ = f[int] }`,
- `f`,
- []string{`int`, `chan<- int`, `chan<- []*chan<- int`},
- `func() []int`,
- },
- }
-
- for _, test := range tests {
- info := Info{Inferred: make(map[ast.Expr]Inferred)}
- name, err := mayTypecheck(t, "InferredInfo", test.src, &info)
- if err != nil {
- t.Errorf("package %s: %v", name, err)
- continue
- }
-
- // look for inferred type arguments and signature
- var targs []Type
- var sig *Signature
- for call, inf := range info.Inferred {
- var fun ast.Expr
- switch x := call.(type) {
- case *ast.CallExpr:
- fun = x.Fun
- case *ast.IndexExpr:
- fun = x.X
- default:
- panic(fmt.Sprintf("unexpected call expression type %T", call))
- }
- if ExprString(fun) == test.fun {
- targs = inf.Targs
- sig = inf.Sig
- break
- }
- }
- if targs == nil {
- t.Errorf("package %s: no inferred information found for %s", name, test.fun)
- continue
- }
-
- // check that type arguments are correct
- if len(targs) != len(test.targs) {
- t.Errorf("package %s: got %d type arguments; want %d", name, len(targs), len(test.targs))
- continue
- }
- for i, targ := range targs {
- if got := targ.String(); got != test.targs[i] {
- t.Errorf("package %s, %d. type argument: got %s; want %s", name, i, got, test.targs[i])
- continue
- }
- }
-
- // check that signature is correct
- if got := sig.String(); got != test.sig {
- t.Errorf("package %s: got %s; want %s", name, got, test.sig)
- }
- }
-}
-
func TestDefsInfo(t *testing.T) {
var tests = []struct {
src string
diff --git a/src/go/types/assignments.go b/src/go/types/assignments.go
index 3aa06e8939..f223cb7574 100644
--- a/src/go/types/assignments.go
+++ b/src/go/types/assignments.go
@@ -303,6 +303,20 @@ func (check *Checker) assignVars(lhs, origRHS []ast.Expr) {
}
}
+// unpack unpacks an *ast.ListExpr into a list of ast.Expr.
+// TODO(gri) Should find a more efficient solution that doesn't
+// require introduction of a new slice for simple
+// expressions.
+func unpackExpr(x ast.Expr) []ast.Expr {
+ if x, _ := x.(*ast.ListExpr); x != nil {
+ return x.ElemList
+ }
+ if x != nil {
+ return []ast.Expr{x}
+ }
+ return nil
+}
+
func (check *Checker) shortVarDecl(pos positioner, lhs, rhs []ast.Expr) {
top := len(check.delayed)
scope := check.scope
diff --git a/src/go/types/builtins.go b/src/go/types/builtins.go
index 28697d9087..3df82fffda 100644
--- a/src/go/types/builtins.go
+++ b/src/go/types/builtins.go
@@ -179,7 +179,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
mode = value
}
- case *Sum:
+ case *_Sum:
if t.is(func(t Type) bool {
switch t := under(t).(type) {
case *Basic:
@@ -374,8 +374,8 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
return
}
- if ok, code := x.assignableTo(check, m.key, nil); !ok {
- check.invalidArg(x, code, "%s is not assignable to %s", x, m.key)
+ check.assignment(x, m.key, "argument to delete")
+ if x.mode == invalid {
return
}
@@ -469,7 +469,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
m = 2
case *Map, *Chan:
m = 1
- case *Sum:
+ case *_Sum:
return t.is(valid)
default:
return false
@@ -732,8 +732,8 @@ func (check *Checker) applyTypeFunc(f func(Type) Type, x Type) Type {
// construct a suitable new type parameter
tpar := NewTypeName(token.NoPos, nil /* = Universe pkg */, "<type parameter>", nil)
- ptyp := check.NewTypeParam(tpar, 0, &emptyInterface) // assigns type to tpar as a side-effect
- tsum := NewSum(rtypes)
+ ptyp := check.newTypeParam(tpar, 0, &emptyInterface) // assigns type to tpar as a side-effect
+ tsum := _NewSum(rtypes)
ptyp.bound = &Interface{types: tsum, allMethods: markComplete, allTypes: tsum}
return ptyp
diff --git a/src/go/types/call.go b/src/go/types/call.go
index d9a7b440ec..ae0a245b2b 100644
--- a/src/go/types/call.go
+++ b/src/go/types/call.go
@@ -1,4 +1,3 @@
-// REVIEW INCOMPLETE
// Copyright 2013 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.
@@ -14,41 +13,109 @@ import (
"unicode"
)
-// TODO(rFindley) this has diverged a bit from types2. Bring it up to date.
-// If call == nil, the "call" was an index expression, and orig is of type *ast.IndexExpr.
-func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKind {
- assert(orig != nil)
- if call != nil {
- assert(call == orig)
- check.exprOrType(x, call.Fun)
- } else {
- // We must have an index expression.
- // x has already been set up (evaluation of orig.X).
- // Set up fake call so we can use its fields below.
- expr := orig.(*ast.IndexExpr)
- call = &ast.CallExpr{Fun: expr.X, Lparen: expr.Lbrack, Args: []ast.Expr{expr.Index}, Rparen: expr.Rbrack, Brackets: true}
+// funcInst type-checks a function instantiaton inst and returns the result in x.
+// The operand x must be the evaluation of inst.X and its type must be a signature.
+func (check *Checker) funcInst(x *operand, inst *ast.IndexExpr) {
+ args, ok := check.exprOrTypeList(unpackExpr(inst.Index))
+ if !ok {
+ x.mode = invalid
+ x.expr = inst
+ return
+ }
+ if len(args) > 0 && args[0].mode != typexpr {
+ check.errorf(args[0], _NotAType, "%s is not a type", args[0])
+ ok = false
+ }
+
+ // check number of type arguments
+ n := len(args)
+ sig := x.typ.(*Signature)
+ if n > len(sig.tparams) {
+ check.errorf(args[n-1], _Todo, "got %d type arguments but want %d", n, len(sig.tparams))
+ x.mode = invalid
+ x.expr = inst
+ return
+ }
+
+ // collect types
+ targs := make([]Type, n)
+ // TODO(rFindley) use a positioner here? instantiate would need to be
+ // updated accordingly.
+ poslist := make([]token.Pos, n)
+ for i, a := range args {
+ if a.mode != typexpr {
+ // error was reported earlier
+ x.mode = invalid
+ x.expr = inst
+ return
+ }
+ targs[i] = a.typ
+ poslist[i] = a.Pos()
+ }
+
+ // if we don't have enough type arguments, use constraint type inference
+ var inferred bool
+ if n < len(sig.tparams) {
+ var failed int
+ targs, failed = check.inferB(sig.tparams, targs)
+ if targs == nil {
+ // error was already reported
+ x.mode = invalid
+ x.expr = inst
+ return
+ }
+ if failed >= 0 {
+ // at least one type argument couldn't be inferred
+ assert(targs[failed] == nil)
+ tpar := sig.tparams[failed]
+ check.errorf(inNode(inst, inst.Rbrack), 0, "cannot infer %s (%v) (%s)", tpar.name, tpar.pos, targs)
+ x.mode = invalid
+ x.expr = inst
+ return
+ }
+ // all type arguments were inferred successfully
+ if debug {
+ for _, targ := range targs {
+ assert(targ != nil)
+ }
+ }
+ n = len(targs)
+ inferred = true
+ }
+ assert(n == len(sig.tparams))
+
+ // instantiate function signature
+ for i, typ := range targs {
+ // some positions may be missing if types are inferred
+ var pos token.Pos
+ if i < len(poslist) {
+ pos = poslist[i]
+ }
+ check.ordinaryType(atPos(pos), typ)
}
+ res := check.instantiate(x.Pos(), sig, targs, poslist).(*Signature)
+ assert(res.tparams == nil) // signature is not generic anymore
+ if inferred {
+ check.recordInferred(inst, targs, res)
+ }
+ x.typ = res
+ x.mode = value
+ x.expr = inst
+}
+
+func (check *Checker) call(x *operand, call *ast.CallExpr) exprKind {
+ check.exprOrType(x, call.Fun)
switch x.mode {
case invalid:
check.use(call.Args...)
- x.expr = orig
+ x.expr = call
return statement
case typexpr:
- // conversion or type instantiation
+ // conversion
T := x.typ
x.mode = invalid
- if isGeneric(T) {
- // type instantiation
- x.typ = check.typ(call)
- if x.typ != Typ[Invalid] {
- x.mode = typexpr
- }
- return expression
- }
-
- // conversion
switch n := len(call.Args); n {
case 0:
check.errorf(inNode(call, call.Rparen), _WrongArgCount, "missing argument in conversion to %s", T)
@@ -61,7 +128,7 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
}
if t := asInterface(T); t != nil {
check.completeInterface(token.NoPos, t)
- if t.IsConstraint() {
+ if t._IsConstraint() {
check.errorf(call, _Todo, "cannot use interface %s in conversion (contains type list or is comparable)", T)
break
}
@@ -72,7 +139,7 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
check.use(call.Args...)
check.errorf(call.Args[n-1], _WrongArgCount, "too many arguments in conversion to %s", T)
}
- x.expr = orig
+ x.expr = call
return conversion
case builtin:
@@ -80,7 +147,7 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
if !check.builtin(x, call, id) {
x.mode = invalid
}
- x.expr = orig
+ x.expr = call
// a non-constant result implies a function call
if x.mode != invalid && x.mode != constant_ {
check.hasCallOrRecv = true
@@ -95,109 +162,18 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
if sig == nil {
check.invalidOp(x, _InvalidCall, "cannot call non-function %s", x)
x.mode = invalid
- x.expr = orig
+ x.expr = call
return statement
}
// evaluate arguments
args, ok := check.exprOrTypeList(call.Args)
- if ok && call.Brackets && len(args) > 0 && args[0].mode != typexpr {
- check.errorf(args[0], _NotAType, "%s is not a type", args[0])
- ok = false
- }
if !ok {
x.mode = invalid
- x.expr = orig
- return expression
- }
-
- // instantiate function if needed
- if n := len(args); n > 0 && len(sig.tparams) > 0 && args[0].mode == typexpr {
- // If the first argument is a type, assume we have explicit type arguments.
-
- // check number of type arguments
- if n > len(sig.tparams) {
- check.errorf(args[n-1], _Todo, "got %d type arguments but want %d", n, len(sig.tparams))
- x.mode = invalid
- x.expr = orig
- return expression
- }
-
- // collect types
- targs := make([]Type, n)
- // TODO(rFindley) use a positioner here? instantiate would need to be
- // updated accordingly.
- poslist := make([]token.Pos, n)
- for i, a := range args {
- if a.mode != typexpr {
- // error was reported earlier
- x.mode = invalid
- x.expr = orig
- return expression
- }
- targs[i] = a.typ
- poslist[i] = a.Pos()
- }
-
- // if we don't have enough type arguments, use constraint type inference
- var inferred bool
- if n < len(sig.tparams) {
- var failed int
- targs, failed = check.inferB(sig.tparams, targs)
- if targs == nil {
- // error was already reported
- x.mode = invalid
- x.expr = orig
- return expression
- }
- if failed >= 0 {
- // at least one type argument couldn't be inferred
- assert(targs[failed] == nil)
- tpar := sig.tparams[failed]
- ppos := check.fset.Position(tpar.pos).String()
- check.errorf(inNode(call, call.Rparen), 0, "cannot infer %s (%s) (%s)", tpar.name, ppos, targs)
- x.mode = invalid
- x.expr = orig
- return expression
- }
- // all type arguments were inferred sucessfully
- if debug {
- for _, targ := range targs {
- assert(targ != nil)
- }
- }
- n = len(targs)
- inferred = true
- }
- assert(n == len(sig.tparams))
-
- // instantiate function signature
- for i, typ := range targs {
- // some positions may be missing if types are inferred
- var pos token.Pos
- if i < len(poslist) {
- pos = poslist[i]
- }
- check.ordinaryType(atPos(pos), typ)
- }
- res := check.instantiate(x.Pos(), sig, targs, poslist).(*Signature)
- assert(res.tparams == nil) // signature is not generic anymore
- if inferred {
- check.recordInferred(orig, targs, res)
- }
- x.typ = res
- x.mode = value
- x.expr = orig
+ x.expr = call
return expression
}
- // If we reach here, orig must have been a regular call, not an index
- // expression.
- // TODO(rFindley) with a manually constructed AST it is possible to reach
- // this assertion. We should return an invalidAST error here
- // rather than panicking.
- assert(!call.Brackets)
-
sig = check.arguments(call, sig, args)
// determine result
@@ -230,6 +206,7 @@ func (check *Checker) call(x *operand, call *ast.CallExpr, orig ast.Expr) exprKi
// exprOrTypeList returns a list of operands and reports an error if the
// list contains a mix of values and types (ignoring invalid operands).
+// TODO(rFindley) Now we can split this into exprList and typeList.
func (check *Checker) exprOrTypeList(elist []ast.Expr) (xlist []*operand, ok bool) {
ok = true
@@ -427,7 +404,7 @@ func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, args []*oper
return
}
}
- // all type arguments were inferred sucessfully
+ // all type arguments were inferred successfully
if debug {
for _, targ := range targs {
assert(targ != nil)
@@ -450,8 +427,6 @@ func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, args []*oper
}
// check arguments
- // TODO(gri) Possible optimization (may be tricky): We could avoid
- // checking arguments from which we inferred type arguments.
for i, a := range args {
check.assignment(a, sigParams.vars[i].typ, check.sprintf("argument to %s", call.Fun))
}
@@ -617,31 +592,42 @@ func (check *Checker) selector(x *operand, e *ast.SelectorExpr) {
// methods may not have a fully set up signature yet
if m, _ := obj.(*Func); m != nil {
check.objDecl(m, nil)
- // If m has a parameterized receiver type, infer the type parameter
- // values from the actual receiver provided and then substitute the
- // type parameters in the signature accordingly.
+ // If m has a parameterized receiver type, infer the type arguments from
+ // the actual receiver provided and then substitute the type parameters in
+ // the signature accordingly.
// TODO(gri) factor this code out
sig := m.typ.(*Signature)
if len(sig.rparams) > 0 {
+ // For inference to work, we must use the receiver type
+ // matching the receiver in the actual method declaration.
+ // If the method is embedded, the matching receiver is the
+ // embedded struct or interface that declared the method.
+ // Traverse the embedding to find that type (issue #44688).
+ recv := x.typ
+ for i := 0; i < len(index)-1; i++ {
+ // The embedded type is either a struct or a pointer to
+ // a struct except for the last one (which we don't need).
+ recv = asStruct(derefStructPtr(recv)).Field(index[i]).typ
+ }
+
// The method may have a pointer receiver, but the actually provided receiver
// may be a (hopefully addressable) non-pointer value, or vice versa. Here we
// only care about inferring receiver type parameters; to make the inference
// work, match up pointer-ness of receiver and argument.
- arg := x
- if ptrRecv := isPointer(sig.recv.typ); ptrRecv != isPointer(arg.typ) {
- copy := *arg
+ if ptrRecv := isPointer(sig.recv.typ); ptrRecv != isPointer(recv) {
if ptrRecv {
- copy.typ = NewPointer(arg.typ)
+ recv = NewPointer(recv)
} else {
- copy.typ = arg.typ.(*Pointer).base
+ recv = recv.(*Pointer).base
}
- arg = &copy
}
- targs, failed := check.infer(sig.rparams, NewTuple(sig.recv), []*operand{arg})
+ arg := operand{mode: variable, expr: x.expr, typ: recv}
+ targs, failed := check.infer(sig.rparams, NewTuple(sig.recv), []*operand{&arg})
if failed >= 0 {
// We may reach here if there were other errors (see issue #40056).
// check.infer will report a follow-up error.
- // TODO(gri) avoid the follow-up error or provide better explanation.
+ // TODO(gri) avoid the follow-up error as it is confusing
+ // (there's no inference in the source code)
goto Error
}
// Don't modify m. Instead - for now - make a copy of m and use that instead.
diff --git a/src/go/types/check.go b/src/go/types/check.go
index d1672837b8..69e9466a8b 100644
--- a/src/go/types/check.go
+++ b/src/go/types/check.go
@@ -8,6 +8,7 @@ package types
import (
"errors"
+ "fmt"
"go/ast"
"go/constant"
"go/token"
@@ -69,6 +70,12 @@ type importKey struct {
path, dir string
}
+// A dotImportKey describes a dot-imported object in the given scope.
+type dotImportKey struct {
+ scope *Scope
+ obj Object
+}
+
// A Checker maintains the state of the type checker.
// It must be created with NewChecker.
type Checker struct {
@@ -78,18 +85,20 @@ type Checker struct {
fset *token.FileSet
pkg *Package
*Info
- nextId uint64 // unique Id for type parameters (first valid Id is 1)
- objMap map[Object]*declInfo // maps package-level objects and (non-interface) methods to declaration info
- impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
- posMap map[*Interface][]token.Pos // maps interface types to lists of embedded interface positions
- typMap map[string]*Named // maps an instantiated named type hash to a *Named type
- pkgCnt map[string]int // counts number of imported packages with a given name (for better error messages)
+ version version // accepted language version
+ nextId uint64 // unique Id for type parameters (first valid Id is 1)
+ objMap map[Object]*declInfo // maps package-level objects and (non-interface) methods to declaration info
+ impMap map[importKey]*Package // maps (import path, source directory) to (complete or fake) package
+ posMap map[*Interface][]token.Pos // maps interface types to lists of embedded interface positions
+ typMap map[string]*Named // maps an instantiated named type hash to a *Named type
+ pkgCnt map[string]int // counts number of imported packages with a given name (for better error messages)
// information collected during type-checking of a set of package files
// (initialized by Files, valid only for the duration of check.Files;
// maps and lists are allocated on demand)
- files []*ast.File // package files
- unusedDotImports map[*Scope]map[*Package]*ast.ImportSpec // unused dot-imported packages
+ files []*ast.File // package files
+ imports []*PkgName // list of imported packages
+ dotImportMap map[dotImportKey]*PkgName // maps dot-imported objects to the package they were dot-imported through
firstErr error // first error encountered
methods map[*TypeName][]*Func // maps package scope type names to associated non-blank (non-interface) methods
@@ -106,22 +115,6 @@ type Checker struct {
indent int // indentation for tracing
}
-// addUnusedImport adds the position of a dot-imported package
-// pkg to the map of dot imports for the given file scope.
-func (check *Checker) addUnusedDotImport(scope *Scope, pkg *Package, spec *ast.ImportSpec) {
- mm := check.unusedDotImports
- if mm == nil {
- mm = make(map[*Scope]map[*Package]*ast.ImportSpec)
- check.unusedDotImports = mm
- }
- m := mm[scope]
- if m == nil {
- m = make(map[*Package]*ast.ImportSpec)
- mm[scope] = m
- }
- m[pkg] = spec
-}
-
// addDeclDep adds the dependency edge (check.decl -> to) if check.decl exists
func (check *Checker) addDeclDep(to Object) {
from := check.decl
@@ -187,17 +180,23 @@ func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Ch
info = new(Info)
}
+ version, err := parseGoVersion(conf.GoVersion)
+ if err != nil {
+ panic(fmt.Sprintf("invalid Go version %q (%v)", conf.GoVersion, err))
+ }
+
return &Checker{
- conf: conf,
- fset: fset,
- pkg: pkg,
- Info: info,
- nextId: 1,
- objMap: make(map[Object]*declInfo),
- impMap: make(map[importKey]*Package),
- posMap: make(map[*Interface][]token.Pos),
- typMap: make(map[string]*Named),
- pkgCnt: make(map[string]int),
+ conf: conf,
+ fset: fset,
+ pkg: pkg,
+ Info: info,
+ version: version,
+ nextId: 1,
+ objMap: make(map[Object]*declInfo),
+ impMap: make(map[importKey]*Package),
+ posMap: make(map[*Interface][]token.Pos),
+ typMap: make(map[string]*Named),
+ pkgCnt: make(map[string]int),
}
}
@@ -206,7 +205,8 @@ func NewChecker(conf *Config, fset *token.FileSet, pkg *Package, info *Info) *Ch
func (check *Checker) initFiles(files []*ast.File) {
// start with a clean slate (check.Files may be called multiple times)
check.files = nil
- check.unusedDotImports = nil
+ check.imports = nil
+ check.dotImportMap = nil
check.firstErr = nil
check.methods = nil
@@ -276,6 +276,9 @@ func (check *Checker) checkFiles(files []*ast.File) (err error) {
if !check.conf.DisableUnusedImportCheck {
check.unusedImports()
}
+ // no longer needed - release memory
+ check.imports = nil
+ check.dotImportMap = nil
check.recordUntyped()
@@ -284,6 +287,9 @@ func (check *Checker) checkFiles(files []*ast.File) (err error) {
}
check.pkg.complete = true
+
+ // TODO(rFindley) There's more memory we should release at this point.
+
return
}
@@ -334,7 +340,9 @@ func (check *Checker) recordTypeAndValue(x ast.Expr, mode operandMode, typ Type,
}
if mode == constant_ {
assert(val != nil)
- assert(typ == Typ[Invalid] || isConstType(typ))
+ // We check is(typ, IsConstType) here as constant expressions may be
+ // recorded as type parameters.
+ assert(typ == Typ[Invalid] || is(typ, IsConstType))
}
if m := check.Types; m != nil {
m[x] = TypeAndValue{mode, typ, val}
@@ -388,8 +396,8 @@ func (check *Checker) recordCommaOkTypes(x ast.Expr, a [2]Type) {
func (check *Checker) recordInferred(call ast.Expr, targs []Type, sig *Signature) {
assert(call != nil)
assert(sig != nil)
- if m := check.Inferred; m != nil {
- m[call] = Inferred{targs, sig}
+ if m := check._Inferred; m != nil {
+ m[call] = _Inferred{targs, sig}
}
}
diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go
index 51eae052f3..9812b3808b 100644
--- a/src/go/types/check_test.go
+++ b/src/go/types/check_test.go
@@ -44,10 +44,15 @@ import (
. "go/types"
)
+// parseTypeParams tells go/parser to parse type parameters. Must be kept in
+// sync with go/parser/interface.go.
+const parseTypeParams parser.Mode = 1 << 30
+
var (
haltOnError = flag.Bool("halt", false, "halt on error")
listErrors = flag.Bool("errlist", false, "list errors")
- testFiles = flag.String("files", "", "space-separated list of test files")
+ testFiles = flag.String("files", "", "comma-separated list of test files")
+ goVersion = flag.String("lang", "", "Go language version (e.g. \"go1.12\"")
)
var fset = token.NewFileSet()
@@ -68,11 +73,11 @@ func splitError(err error) (pos, msg string) {
return
}
-func parseFiles(t *testing.T, filenames []string, mode parser.Mode) ([]*ast.File, []error) {
+func parseFiles(t *testing.T, filenames []string, srcs [][]byte, mode parser.Mode) ([]*ast.File, []error) {
var files []*ast.File
var errlist []error
- for _, filename := range filenames {
- file, err := parser.ParseFile(fset, filename, nil, mode)
+ for i, filename := range filenames {
+ file, err := parser.ParseFile(fset, filename, srcs[i], mode)
if file == nil {
t.Fatalf("%s: %s", filename, err)
}
@@ -101,19 +106,17 @@ var errRx = regexp.MustCompile(`^ *ERROR *(HERE)? *"?([^"]*)"?`)
// errMap collects the regular expressions of ERROR comments found
// in files and returns them as a map of error positions to error messages.
//
-func errMap(t *testing.T, testname string, files []*ast.File) map[string][]string {
+// srcs must be a slice of the same length as files, containing the original
+// source for the parsed AST.
+func errMap(t *testing.T, files []*ast.File, srcs [][]byte) map[string][]string {
// map of position strings to lists of error message patterns
errmap := make(map[string][]string)
- for _, file := range files {
- filename := fset.Position(file.Package).Filename
- src, err := os.ReadFile(filename)
- if err != nil {
- t.Fatalf("%s: could not read %s", testname, filename)
- }
-
+ for i, file := range files {
+ tok := fset.File(file.Package)
+ src := srcs[i]
var s scanner.Scanner
- s.Init(fset.AddFile(filename, -1, len(src)), src, nil, scanner.ScanComments)
+ s.Init(tok, src, nil, scanner.ScanComments)
var prev token.Pos // position of last non-comment, non-semicolon token
var here token.Pos // position immediately after the token at position prev
@@ -190,24 +193,43 @@ func eliminate(t *testing.T, errmap map[string][]string, errlist []error) {
}
}
-func checkFiles(t *testing.T, sources []string) {
- if len(sources) == 0 {
+// goVersionRx matches a Go version string using '_', e.g. "go1_12".
+var goVersionRx = regexp.MustCompile(`^go[1-9][0-9]*_(0|[1-9][0-9]*)$`)
+
+// asGoVersion returns a regular Go language version string
+// if s is a Go version string using '_' rather than '.' to
+// separate the major and minor version numbers (e.g. "go1_12").
+// Otherwise it returns the empty string.
+func asGoVersion(s string) string {
+ if goVersionRx.MatchString(s) {
+ return strings.Replace(s, "_", ".", 1)
+ }
+ return ""
+}
+
+func checkFiles(t *testing.T, goVersion string, filenames []string, srcs [][]byte) {
+ if len(filenames) == 0 {
t.Fatal("no source files")
}
mode := parser.AllErrors
- if strings.HasSuffix(sources[0], ".go2") {
- mode |= parser.ParseTypeParams
+ if strings.HasSuffix(filenames[0], ".go2") {
+ mode |= parseTypeParams
}
// parse files and collect parser errors
- files, errlist := parseFiles(t, sources, mode)
+ files, errlist := parseFiles(t, filenames, srcs, mode)
pkgName := "<no package>"
if len(files) > 0 {
pkgName = files[0].Name.Name
}
+ // if no Go version is given, consider the package name
+ if goVersion == "" {
+ goVersion = asGoVersion(pkgName)
+ }
+
if *listErrors && len(errlist) > 0 {
t.Errorf("--- %s:", pkgName)
for _, err := range errlist {
@@ -217,13 +239,15 @@ func checkFiles(t *testing.T, sources []string) {
// typecheck and collect typechecker errors
var conf Config
+ conf.GoVersion = goVersion
// special case for importC.src
- if len(sources) == 1 && strings.HasSuffix(sources[0], "importC.src") {
- conf.FakeImportC = true
+ if len(filenames) == 1 {
+ if strings.HasSuffix(filenames[0], "importC.src") {
+ conf.FakeImportC = true
+ }
}
- // TODO(rFindley) we may need to use the source importer when adding generics
- // tests.
+
conf.Importer = importer.Default()
conf.Error = func(err error) {
if *haltOnError {
@@ -258,7 +282,7 @@ func checkFiles(t *testing.T, sources []string) {
// match and eliminate errors;
// we are expecting the following errors
- errmap := errMap(t, pkgName, files)
+ errmap := errMap(t, files, srcs)
eliminate(t, errmap, errlist)
// there should be no expected errors left
@@ -273,13 +297,20 @@ func checkFiles(t *testing.T, sources []string) {
}
// TestCheck is for manual testing of selected input files, provided with -files.
+// The accepted Go language version can be controlled with the -lang flag.
func TestCheck(t *testing.T) {
if *testFiles == "" {
return
}
testenv.MustHaveGoBuild(t)
DefPredeclaredTestFuncs()
- checkFiles(t, strings.Split(*testFiles, " "))
+ testPkg(t, strings.Split(*testFiles, ","), *goVersion)
+}
+
+func TestLongConstants(t *testing.T) {
+ format := "package longconst\n\nconst _ = %s\nconst _ = %s // ERROR excessively long constant"
+ src := fmt.Sprintf(format, strings.Repeat("1", 9999), strings.Repeat("1", 10001))
+ checkFiles(t, "", []string{"longconst.go"}, [][]byte{[]byte(src)})
}
func TestTestdata(t *testing.T) { DefPredeclaredTestFuncs(); testDir(t, "testdata") }
@@ -299,26 +330,33 @@ func testDir(t *testing.T, dir string) {
path := filepath.Join(dir, fi.Name())
// if fi is a directory, its files make up a single package
- var files []string
+ var filenames []string
if fi.IsDir() {
fis, err := ioutil.ReadDir(path)
if err != nil {
t.Error(err)
continue
}
- files = make([]string, len(fis))
- for i, fi := range fis {
- // if fi is a directory, checkFiles below will complain
- files[i] = filepath.Join(path, fi.Name())
- if testing.Verbose() {
- fmt.Printf("\t%s\n", files[i])
- }
+ for _, fi := range fis {
+ filenames = append(filenames, filepath.Join(path, fi.Name()))
}
} else {
- files = []string{path}
+ filenames = []string{path}
}
t.Run(filepath.Base(path), func(t *testing.T) {
- checkFiles(t, files)
+ testPkg(t, filenames, "")
})
}
}
+
+func testPkg(t *testing.T, filenames []string, goVersion string) {
+ srcs := make([][]byte, len(filenames))
+ for i, filename := range filenames {
+ src, err := os.ReadFile(filename)
+ if err != nil {
+ t.Fatalf("could not read %s: %v", filename, err)
+ }
+ srcs[i] = src
+ }
+ checkFiles(t, goVersion, filenames, srcs)
+}
diff --git a/src/go/types/conversions.go b/src/go/types/conversions.go
index 0756b575ae..d93ff465bb 100644
--- a/src/go/types/conversions.go
+++ b/src/go/types/conversions.go
@@ -55,8 +55,8 @@ func (check *Checker) conversion(x *operand, T Type) {
// - Keep untyped nil for untyped nil arguments.
// - For integer to string conversions, keep the argument type.
// (See also the TODO below.)
- if IsInterface(T) || constArg && !isConstType(T) {
- final = Default(x.typ)
+ if IsInterface(T) || constArg && !isConstType(T) || x.isNil() {
+ final = Default(x.typ) // default type of untyped nil is untyped nil
} else if isInteger(x.typ) && isString(T) {
final = x.typ
}
@@ -142,7 +142,7 @@ func isUintptr(typ Type) bool {
}
func isUnsafePointer(typ Type) bool {
- // TODO(gri): Is this asBasic() instead of typ.(*Basic) correct?
+ // TODO(gri): Is this asBasic(typ) instead of typ.(*Basic) correct?
// (The former calls under(), while the latter doesn't.)
// The spec does not say so, but gc claims it is. See also
// issue 6326.
diff --git a/src/go/types/decl.go b/src/go/types/decl.go
index bd2c546661..2eb2c39745 100644
--- a/src/go/types/decl.go
+++ b/src/go/types/decl.go
@@ -654,6 +654,9 @@ func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *Named) {
if alias {
// type alias declaration
+ if !check.allowVersion(obj.pkg, 1, 9) {
+ check.errorf(atPos(tdecl.Assign), _BadDecl, "type aliases requires go1.9 or later")
+ }
obj.typ = Typ[Invalid]
obj.typ = check.anyType(tdecl.Type)
@@ -710,7 +713,7 @@ func (check *Checker) collectTypeParams(list *ast.FieldList) (tparams []*TypeNam
setBoundAt := func(at int, bound Type) {
assert(IsInterface(bound))
- tparams[at].typ.(*TypeParam).bound = bound
+ tparams[at].typ.(*_TypeParam).bound = bound
}
index := 0
@@ -723,7 +726,7 @@ func (check *Checker) collectTypeParams(list *ast.FieldList) (tparams []*TypeNam
// The predeclared identifier "any" is visible only as a constraint
// in a type parameter list. Look for it before general constraint
// resolution.
- if tident, _ := f.Type.(*ast.Ident); tident != nil && tident.Name == "any" && check.lookup("any") == nil {
+ if tident, _ := unparen(f.Type).(*ast.Ident); tident != nil && tident.Name == "any" && check.lookup("any") == nil {
bound = universeAny
} else {
bound = check.typ(f.Type)
@@ -753,7 +756,7 @@ func (check *Checker) collectTypeParams(list *ast.FieldList) (tparams []*TypeNam
func (check *Checker) declareTypeParams(tparams []*TypeName, names []*ast.Ident) []*TypeName {
for _, name := range names {
tpar := NewTypeName(name.Pos(), check.pkg, name.Name, nil)
- check.NewTypeParam(tpar, len(tparams), &emptyInterface) // assigns type to tpar as a side-effect
+ check.newTypeParam(tpar, len(tparams), &emptyInterface) // assigns type to tpar as a side-effect
check.declare(check.scope, name, tpar, check.scope.pos) // TODO(gri) check scope position
tparams = append(tparams, tpar)
}
diff --git a/src/go/types/errorcodes.go b/src/go/types/errorcodes.go
index 7e62091558..1e39aed07d 100644
--- a/src/go/types/errorcodes.go
+++ b/src/go/types/errorcodes.go
@@ -6,6 +6,9 @@ package types
type errorCode int
+// TODO(rFindley): ensure that existing error codes do not change in the
+// dev.typeparams branch.
+
// This file defines the error codes that can be produced during type-checking.
// Collectively, these codes provide an identifier that may be used to
// implement special handling for certain types of errors.
@@ -386,8 +389,8 @@ const (
// _InvalidInitSig occurs when an init function declares parameters or
// results.
//
- // Example:
- // func init() int { return 1 }
+ // Deprecated: no longer emitted by the type checker. _InvalidInitDecl is
+ // used instead.
_InvalidInitSig
// _InvalidInitDecl occurs when init is declared as anything other than a
@@ -395,6 +398,9 @@ const (
//
// Example:
// var init = 1
+ //
+ // Example:
+ // func init() int { return 1 }
_InvalidInitDecl
// _InvalidMainDecl occurs when main is declared as anything other than a
@@ -1312,6 +1318,9 @@ const (
// }
_InvalidGo
+ // _BadDecl occurs when a declaration has invalid syntax.
+ _BadDecl
+
// _Todo is a placeholder for error codes that have not been decided.
// TODO(rFindley) remove this error code after deciding on errors for generics code.
_Todo
diff --git a/src/go/types/eval_test.go b/src/go/types/eval_test.go
index 33dfbefe19..41d3a61b89 100644
--- a/src/go/types/eval_test.go
+++ b/src/go/types/eval_test.go
@@ -76,7 +76,7 @@ func TestEvalArith(t *testing.T) {
`false == false`,
`12345678 + 87654321 == 99999999`,
`10 * 20 == 200`,
- `(1<<1000)*2 >> 100 == 2<<900`,
+ `(1<<500)*2 >> 100 == 2<<400`,
`"foo" + "bar" == "foobar"`,
`"abc" <= "bcd"`,
`len([10]struct{}{}) == 2*5`,
diff --git a/src/go/types/example_test.go b/src/go/types/example_test.go
index 3747f3b15a..32a25a4117 100644
--- a/src/go/types/example_test.go
+++ b/src/go/types/example_test.go
@@ -5,6 +5,7 @@
// Only run where builders (build.golang.org) have
// access to compiled packages for import.
//
+//go:build !arm && !arm64
// +build !arm,!arm64
package types_test
diff --git a/src/go/types/examples/functions.go2 b/src/go/types/examples/functions.go2
index c6ad511bd6..fb74ae7ae2 100644
--- a/src/go/types/examples/functions.go2
+++ b/src/go/types/examples/functions.go2
@@ -50,7 +50,7 @@ func new[T any]() *T {
// result type from the assignment to keep things simple and
// easy to understand.
var _ = new[int]()
-var _ *float64 = new(float64)() // the result type is indeed *float64
+var _ *float64 = new[float64]() // the result type is indeed *float64
// A function may have multiple type parameters, of course.
func foo[A, B, C any](a A, b []B, c *C) B {
@@ -59,7 +59,7 @@ func foo[A, B, C any](a A, b []B, c *C) B {
}
// As before, we can pass type parameters explicitly.
-var s = foo[int, string, float64](1, []string{"first"}, new(float64)())
+var s = foo[int, string, float64](1, []string{"first"}, new[float64]())
// Or we can use type inference.
var _ float64 = foo(42, []float64{1.0}, &s)
diff --git a/src/go/types/examples/types.go2 b/src/go/types/examples/types.go2
index 5aa624c131..59c8804ad2 100644
--- a/src/go/types/examples/types.go2
+++ b/src/go/types/examples/types.go2
@@ -112,6 +112,9 @@ type I1[T any] interface{
m1(T)
}
+// There is no such thing as a variadic generic type.
+type _[T ... /* ERROR invalid use of ... */ interface{}] struct{}
+
// Generic interfaces may be embedded as one would expect.
type I2 interface {
I1(int) // method!
@@ -143,7 +146,7 @@ func _() {
// We accept parenthesized embedded struct fields so we can distinguish between
// a named field with a parenthesized type foo (T) and an embedded parameterized
-// type (foo(T)), similarly to interace embedding.
+// type (foo(T)), similarly to interface embedding.
// They still need to be valid embedded types after the parentheses are stripped
// (i.e., in contrast to interfaces, we cannot embed a struct literal). The name
// of the embedded field is derived as before, after stripping parentheses.
@@ -264,3 +267,20 @@ func _() {
var _ comparable /* ERROR comparable */
var _ C /* ERROR comparable */
}
+
+// Type parameters are never const types, i.e., it's
+// not possible to declare a constant of type parameter type.
+// (If a type list contains just a single const type, we could
+// allow it, but such type lists don't make much sense in the
+// first place.)
+func _[T interface { type int, float64 }]() {
+ // not valid
+ const _ = T /* ERROR not constant */ (0)
+ const _ T /* ERROR invalid constant type T */ = 1
+
+ // valid
+ var _ = T(0)
+ var _ T = 1
+ _ = T(0)
+}
+
diff --git a/src/go/types/expr.go b/src/go/types/expr.go
index 1deda99aaf..e1b484c410 100644
--- a/src/go/types/expr.go
+++ b/src/go/types/expr.go
@@ -1,4 +1,3 @@
-// REVIEW INCOMPLETE
// Copyright 2012 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.
@@ -84,13 +83,77 @@ func (check *Checker) op(m opPredicates, x *operand, op token.Token) bool {
return true
}
+// overflow checks that the constant x is representable by its type.
+// For untyped constants, it checks that the value doesn't become
+// arbitrarily large.
+func (check *Checker) overflow(x *operand, op token.Token, opPos token.Pos) {
+ assert(x.mode == constant_)
+
+ if x.val.Kind() == constant.Unknown {
+ // TODO(gri) We should report exactly what went wrong. At the
+ // moment we don't have the (go/constant) API for that.
+ // See also TODO in go/constant/value.go.
+ check.errorf(atPos(opPos), _InvalidConstVal, "constant result is not representable")
+ return
+ }
+
+ // Typed constants must be representable in
+ // their type after each constant operation.
+ if isTyped(x.typ) {
+ check.representable(x, asBasic(x.typ))
+ return
+ }
+
+ // Untyped integer values must not grow arbitrarily.
+ const prec = 512 // 512 is the constant precision
+ if x.val.Kind() == constant.Int && constant.BitLen(x.val) > prec {
+ check.errorf(atPos(opPos), _InvalidConstVal, "constant %s overflow", opName(x.expr))
+ x.val = constant.MakeUnknown()
+ }
+}
+
+// opName returns the name of an operation, or the empty string.
+// For now, only operations that might overflow are handled.
+// TODO(gri) Expand this to a general mechanism giving names to
+// nodes?
+func opName(e ast.Expr) string {
+ switch e := e.(type) {
+ case *ast.BinaryExpr:
+ if int(e.Op) < len(op2str2) {
+ return op2str2[e.Op]
+ }
+ case *ast.UnaryExpr:
+ if int(e.Op) < len(op2str1) {
+ return op2str1[e.Op]
+ }
+ }
+ return ""
+}
+
+var op2str1 = [...]string{
+ token.XOR: "bitwise complement",
+}
+
+// This is only used for operations that may cause overflow.
+var op2str2 = [...]string{
+ token.ADD: "addition",
+ token.SUB: "subtraction",
+ token.XOR: "bitwise XOR",
+ token.MUL: "multiplication",
+ token.SHL: "shift",
+}
+
// The unary expression e may be nil. It's passed in for better error messages only.
-func (check *Checker) unary(x *operand, e *ast.UnaryExpr, op token.Token) {
- switch op {
+func (check *Checker) unary(x *operand, e *ast.UnaryExpr) {
+ check.expr(x, e.X)
+ if x.mode == invalid {
+ return
+ }
+ switch e.Op {
case token.AND:
// spec: "As an exception to the addressability
// requirement x may also be a composite literal."
- if _, ok := unparen(x.expr).(*ast.CompositeLit); !ok && x.mode != variable {
+ if _, ok := unparen(e.X).(*ast.CompositeLit); !ok && x.mode != variable {
check.invalidOp(x, _UnaddressableOperand, "cannot take address of %s", x)
x.mode = invalid
return
@@ -117,26 +180,23 @@ func (check *Checker) unary(x *operand, e *ast.UnaryExpr, op token.Token) {
return
}
- if !check.op(unaryOpPredicates, x, op) {
+ if !check.op(unaryOpPredicates, x, e.Op) {
x.mode = invalid
return
}
if x.mode == constant_ {
- typ := asBasic(x.typ)
- var prec uint
- if isUnsigned(typ) {
- prec = uint(check.conf.sizeof(typ) * 8)
+ if x.val.Kind() == constant.Unknown {
+ // nothing to do (and don't cause an error below in the overflow check)
+ return
}
- x.val = constant.UnaryOp(op, x.val, prec)
- // Typed constants must be representable in
- // their type after each constant operation.
- if isTyped(typ) {
- if e != nil {
- x.expr = e // for better error message
- }
- check.representable(x, typ)
+ var prec uint
+ if isUnsigned(x.typ) {
+ prec = uint(check.conf.sizeof(x.typ) * 8)
}
+ x.val = constant.UnaryOp(e.Op, x.val, prec)
+ x.expr = e
+ check.overflow(x, e.Op, x.Pos())
return
}
@@ -338,14 +398,20 @@ func representableConst(x constant.Value, check *Checker, typ *Basic, rounded *c
// representable checks that a constant operand is representable in the given
// basic type.
func (check *Checker) representable(x *operand, typ *Basic) {
- if v, code := check.representation(x, typ); code != 0 {
+ v, code := check.representation(x, typ)
+ if code != 0 {
check.invalidConversion(code, x, typ)
x.mode = invalid
- } else if v != nil {
- x.val = v
+ return
}
+ assert(v != nil)
+ x.val = v
}
+// representation returns the representation of the constant operand x as the
+// basic type typ.
+//
+// If no such representation is possible, it returns a non-zero error code.
func (check *Checker) representation(x *operand, typ *Basic) (constant.Value, errorCode) {
assert(x.mode == constant_)
v := x.val
@@ -531,7 +597,10 @@ func (check *Checker) convertUntyped(x *operand, target Type) {
// implicitTypeAndValue returns the implicit type of x when used in a context
// where the target type is expected. If no such implicit conversion is
-// possible, it returns a nil Type.
+// possible, it returns a nil Type and non-zero error code.
+//
+// If x is a constant operand, the returned constant.Value will be the
+// representation of x in this context.
func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, constant.Value, errorCode) {
target = expand(target)
if x.mode == invalid || isTyped(x.typ) || target == Typ[Invalid] {
@@ -586,11 +655,12 @@ func (check *Checker) implicitTypeAndValue(x *operand, target Type) (Type, const
if !hasNil(target) {
return nil, nil, _InvalidUntypedConversion
}
- // TODO(rFindley) return UntypedNil here (golang.org/issues/13061).
+ // Preserve the type of nil as UntypedNil: see #13061.
+ return Typ[UntypedNil], nil, 0
default:
return nil, nil, _InvalidUntypedConversion
}
- case *Sum:
+ case *_Sum:
ok := t.is(func(t Type) bool {
target, _, _ := check.implicitTypeAndValue(x, t)
return target != nil
@@ -685,15 +755,16 @@ func (check *Checker) comparison(x, y *operand, op token.Token) {
x.typ = Typ[UntypedBool]
}
-func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) {
- untypedx := isUntyped(x.typ)
+// If e != nil, it must be the shift expression; it may be nil for non-constant shifts.
+func (check *Checker) shift(x, y *operand, e ast.Expr, op token.Token) {
+ // TODO(gri) This function seems overly complex. Revisit.
var xval constant.Value
if x.mode == constant_ {
xval = constant.ToInt(x.val)
}
- if isInteger(x.typ) || untypedx && xval != nil && xval.Kind() == constant.Int {
+ if isInteger(x.typ) || isUntyped(x.typ) && xval != nil && xval.Kind() == constant.Int {
// The lhs is of integer type or an untyped constant representable
// as an integer. Nothing to do.
} else {
@@ -705,19 +776,33 @@ func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) {
// spec: "The right operand in a shift expression must have integer type
// or be an untyped constant representable by a value of type uint."
- switch {
- case isInteger(y.typ):
- // nothing to do
- case isUntyped(y.typ):
+
+ // Provide a good error message for negative shift counts.
+ if y.mode == constant_ {
+ yval := constant.ToInt(y.val) // consider -1, 1.0, but not -1.1
+ if yval.Kind() == constant.Int && constant.Sign(yval) < 0 {
+ check.invalidOp(y, _InvalidShiftCount, "negative shift count %s", y)
+ x.mode = invalid
+ return
+ }
+ }
+
+ // Caution: Check for isUntyped first because isInteger includes untyped
+ // integers (was bug #43697).
+ if isUntyped(y.typ) {
check.convertUntyped(y, Typ[Uint])
if y.mode == invalid {
x.mode = invalid
return
}
- default:
+ } else if !isInteger(y.typ) {
check.invalidOp(y, _InvalidShiftCount, "shift count %s must be integer", y)
x.mode = invalid
return
+ } else if !isUnsigned(y.typ) && !check.allowVersion(check.pkg, 1, 13) {
+ check.invalidOp(y, _InvalidShiftCount, "signed shift count %s requires go1.13 or later", y)
+ x.mode = invalid
+ return
}
var yval constant.Value
@@ -736,8 +821,17 @@ func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) {
if x.mode == constant_ {
if y.mode == constant_ {
+ // if either x or y has an unknown value, the result is unknown
+ if x.val.Kind() == constant.Unknown || y.val.Kind() == constant.Unknown {
+ x.val = constant.MakeUnknown()
+ // ensure the correct type - see comment below
+ if !isInteger(x.typ) {
+ x.typ = Typ[UntypedInt]
+ }
+ return
+ }
// rhs must be within reasonable bounds in constant shifts
- const shiftBound = 1023 - 1 + 52 // so we can express smallestFloat64
+ const shiftBound = 1023 - 1 + 52 // so we can express smallestFloat64 (see issue #44057)
s, ok := constant.Uint64Val(yval)
if !ok || s > shiftBound {
check.invalidOp(y, _InvalidShiftCount, "invalid shift count %s", y)
@@ -753,19 +847,17 @@ func (check *Checker) shift(x, y *operand, e *ast.BinaryExpr, op token.Token) {
}
// x is a constant so xval != nil and it must be of Int kind.
x.val = constant.Shift(xval, op, uint(s))
- // Typed constants must be representable in
- // their type after each constant operation.
- if isTyped(x.typ) {
- if e != nil {
- x.expr = e // for better error message
- }
- check.representable(x, asBasic(x.typ))
+ x.expr = e
+ opPos := x.Pos()
+ if b, _ := e.(*ast.BinaryExpr); b != nil {
+ opPos = b.OpPos
}
+ check.overflow(x, op, opPos)
return
}
// non-constant shift with constant lhs
- if untypedx {
+ if isUntyped(x.typ) {
// spec: "If the left operand of a non-constant shift
// expression is an untyped constant, the type of the
// constant is what it would be if the shift expression
@@ -826,8 +918,9 @@ func init() {
}
}
-// The binary expression e may be nil. It's passed in for better error messages only.
-func (check *Checker) binary(x *operand, e *ast.BinaryExpr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
+// If e != nil, it must be the binary expression; it may be nil for non-constant expressions
+// (when invoked for an assignment operation where the binary expression is implicit).
+func (check *Checker) binary(x *operand, e ast.Expr, lhs, rhs ast.Expr, op token.Token, opPos token.Pos) {
var y operand
check.expr(x, lhs)
@@ -902,30 +995,19 @@ func (check *Checker) binary(x *operand, e *ast.BinaryExpr, lhs, rhs ast.Expr, o
}
if x.mode == constant_ && y.mode == constant_ {
- xval := x.val
- yval := y.val
- typ := asBasic(x.typ)
+ // if either x or y has an unknown value, the result is unknown
+ if x.val.Kind() == constant.Unknown || y.val.Kind() == constant.Unknown {
+ x.val = constant.MakeUnknown()
+ // x.typ is unchanged
+ return
+ }
// force integer division of integer operands
- if op == token.QUO && isInteger(typ) {
+ if op == token.QUO && isInteger(x.typ) {
op = token.QUO_ASSIGN
}
- x.val = constant.BinaryOp(xval, op, yval)
- // report error if valid operands lead to an invalid result
- if xval.Kind() != constant.Unknown && yval.Kind() != constant.Unknown && x.val.Kind() == constant.Unknown {
- // TODO(gri) We should report exactly what went wrong. At the
- // moment we don't have the (go/constant) API for that.
- // See also TODO in go/constant/value.go.
- check.errorf(atPos(opPos), _InvalidConstVal, "constant result is not representable")
- // TODO(gri) Should we mark operands with unknown values as invalid?
- }
- // Typed constants must be representable in
- // their type after each constant operation.
- if isTyped(typ) {
- if e != nil {
- x.expr = e // for better error message
- }
- check.representable(x, typ)
- }
+ x.val = constant.BinaryOp(x.val, op, y.val)
+ x.expr = e
+ check.overflow(x, op, opPos)
return
}
@@ -1104,6 +1186,24 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
goto Error
case *ast.BasicLit:
+ switch e.Kind {
+ case token.INT, token.FLOAT, token.IMAG:
+ check.langCompat(e)
+ // The max. mantissa precision for untyped numeric values
+ // is 512 bits, or 4048 bits for each of the two integer
+ // parts of a fraction for floating-point numbers that are
+ // represented accurately in the go/constant package.
+ // Constant literals that are longer than this many bits
+ // are not meaningful; and excessively long constants may
+ // consume a lot of space and time for a useless conversion.
+ // Cap constant length with a generous upper limit that also
+ // allows for separators between all digits.
+ const limit = 10000
+ if len(e.Value) > limit {
+ check.errorf(e, _InvalidConstVal, "excessively long constant: %s... (%d chars)", e.Value[:10], len(e.Value))
+ goto Error
+ }
+ }
x.setConst(e.Kind, e.Value)
if x.mode == invalid {
// The parser already establishes syntactic correctness.
@@ -1365,7 +1465,8 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
if x.mode == value {
if sig := asSignature(x.typ); sig != nil && len(sig.tparams) > 0 {
- return check.call(x, nil, e)
+ check.funcInst(x, e)
+ return expression
}
}
@@ -1416,7 +1517,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
x.expr = e
return expression
- case *Sum:
+ case *_Sum:
// A sum type can be indexed if all of the sum's types
// support indexing and have the same index and element
// type. Special rules apply for maps in the sum type.
@@ -1448,7 +1549,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
tkey = t.key
e = t.elem
nmaps++
- case *TypeParam:
+ case *_TypeParam:
check.errorf(x, 0, "type of %s contains a type parameter - cannot index (implementation restriction)", x)
case *instance:
panic("unimplemented")
@@ -1560,7 +1661,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
valid = true
// x.typ doesn't change
- case *Sum, *TypeParam:
+ case *_Sum, *_TypeParam:
check.errorf(x, 0, "generic slice expressions not yet implemented")
goto Error
}
@@ -1645,7 +1746,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
x.typ = T
case *ast.CallExpr:
- return check.call(x, e, e)
+ return check.call(x, e)
case *ast.StarExpr:
check.exprOrType(x, e.X)
@@ -1665,11 +1766,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
}
case *ast.UnaryExpr:
- check.expr(x, e.X)
- if x.mode == invalid {
- goto Error
- }
- check.unary(x, e, e.Op)
+ check.unary(x, e)
if x.mode == invalid {
goto Error
}
diff --git a/src/go/types/exprstring.go b/src/go/types/exprstring.go
index 0d9ae58dfc..9e073b1de0 100644
--- a/src/go/types/exprstring.go
+++ b/src/go/types/exprstring.go
@@ -72,6 +72,14 @@ func WriteExpr(buf *bytes.Buffer, x ast.Expr) {
WriteExpr(buf, x.Index)
buf.WriteByte(']')
+ case *ast.ListExpr:
+ for i, e := range x.ElemList {
+ if i > 0 {
+ buf.WriteString(", ")
+ }
+ WriteExpr(buf, e)
+ }
+
case *ast.SliceExpr:
WriteExpr(buf, x.X)
buf.WriteByte('[')
@@ -98,16 +106,12 @@ func WriteExpr(buf *bytes.Buffer, x ast.Expr) {
case *ast.CallExpr:
WriteExpr(buf, x.Fun)
- var l, r byte = '(', ')'
- if x.Brackets {
- l, r = '[', ']'
- }
- buf.WriteByte(l)
+ buf.WriteByte('(')
writeExprList(buf, x.Args)
if x.Ellipsis.IsValid() {
buf.WriteString("...")
}
- buf.WriteByte(r)
+ buf.WriteByte(')')
case *ast.StarExpr:
buf.WriteByte('*')
diff --git a/src/go/types/fixedbugs/issue39634.go2 b/src/go/types/fixedbugs/issue39634.go2
index 249542d541..78dee00383 100644
--- a/src/go/types/fixedbugs/issue39634.go2
+++ b/src/go/types/fixedbugs/issue39634.go2
@@ -84,7 +84,7 @@ var x T25 /* ERROR without instantiation */ .m1
// crash 26
type T26 = interface{ F26[ /* ERROR methods cannot have type parameters */ Z any]() }
-func F26[Z any]() T26 { return F26 /* ERROR without instantiation */ /* ERROR missing method */ [] /* ERROR operand */ }
+func F26[Z any]() T26 { return F26[] /* ERROR operand */ }
// crash 27
func e27[T any]() interface{ x27 /* ERROR not a type */ }
diff --git a/src/go/types/fixedbugs/issue44688.go2 b/src/go/types/fixedbugs/issue44688.go2
new file mode 100644
index 0000000000..512bfcc922
--- /dev/null
+++ b/src/go/types/fixedbugs/issue44688.go2
@@ -0,0 +1,83 @@
+// Copyright 2021 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.
+
+package P
+
+type A1[T any] struct{}
+
+func (*A1[T]) m1(T) {}
+
+type A2[T any] interface {
+ m2(T)
+}
+
+type B1[T any] struct {
+ filler int
+ *A1[T]
+ A2[T]
+}
+
+type B2[T any] interface {
+ A2[T]
+}
+
+type C[T any] struct {
+ filler1 int
+ filler2 int
+ B1[T]
+}
+
+type D[T any] struct {
+ filler1 int
+ filler2 int
+ filler3 int
+ C[T]
+}
+
+func _() {
+ // calling embedded methods
+ var b1 B1[string]
+
+ b1.A1.m1("")
+ b1.m1("")
+
+ b1.A2.m2("")
+ b1.m2("")
+
+ var b2 B2[string]
+ b2.m2("")
+
+ // a deeper nesting
+ var d D[string]
+ d.m1("")
+ d.m2("")
+
+ // calling method expressions
+ m1x := B1[string].m1
+ m1x(b1, "")
+ m2x := B2[string].m2
+ m2x(b2, "")
+
+ // calling method values
+ m1v := b1.m1
+ m1v("")
+ m2v := b1.m2
+ m2v("")
+ b2v := b2.m2
+ b2v("")
+}
+
+// actual test case from issue
+
+type A[T any] struct{}
+
+func (*A[T]) f(T) {}
+
+type B[T any] struct{ A[T] }
+
+func _() {
+ var b B[string]
+ b.A.f("")
+ b.f("")
+}
diff --git a/src/go/types/gotype.go b/src/go/types/gotype.go
index 52709df17b..ca1d42c14d 100644
--- a/src/go/types/gotype.go
+++ b/src/go/types/gotype.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Build this command explicitly: go build gotype.go
diff --git a/src/go/types/infer.go b/src/go/types/infer.go
index 95bd3cb378..4b20836f88 100644
--- a/src/go/types/infer.go
+++ b/src/go/types/infer.go
@@ -98,7 +98,7 @@ func (check *Checker) infer(tparams []*TypeName, params *Tuple, args []*operand)
// only parameter type it can possibly match against is a *TypeParam.
// Thus, only keep the indices of generic parameters that are not of
// composite types and which don't have a type inferred yet.
- if tpar, _ := par.typ.(*TypeParam); tpar != nil && u.x.at(tpar.index) == nil {
+ if tpar, _ := par.typ.(*_TypeParam); tpar != nil && u.x.at(tpar.index) == nil {
indices[j] = i
j++
}
@@ -201,7 +201,7 @@ func (w *tpWalker) isParameterized(typ Type) (res bool) {
}
}
- case *Sum:
+ case *_Sum:
return w.isParameterizedList(t.types)
case *Signature:
@@ -243,7 +243,7 @@ func (w *tpWalker) isParameterized(typ Type) (res bool) {
case *Named:
return w.isParameterizedList(t.targs)
- case *TypeParam:
+ case *_TypeParam:
// t must be one of w.tparams
return t.index < len(w.tparams) && w.tparams[t.index].typ == t
@@ -291,7 +291,7 @@ func (check *Checker) inferB(tparams []*TypeName, targs []Type) (types []Type, i
// Unify type parameters with their structural constraints, if any.
for _, tpar := range tparams {
- typ := tpar.typ.(*TypeParam)
+ typ := tpar.typ.(*_TypeParam)
sbound := check.structuralType(typ.bound)
if sbound != nil {
if !u.unify(typ, sbound) {
diff --git a/src/go/types/issues_test.go b/src/go/types/issues_test.go
index 34850eb034..a773a362c7 100644
--- a/src/go/types/issues_test.go
+++ b/src/go/types/issues_test.go
@@ -385,9 +385,9 @@ func TestIssue28005(t *testing.T) {
}
}
if obj == nil {
- t.Fatal("interface not found")
+ t.Fatal("object X not found")
}
- iface := obj.Type().Underlying().(*Interface) // I must be an interface
+ iface := obj.Type().Underlying().(*Interface) // object X must be an interface
// Each iface method m is embedded; and m's receiver base type name
// must match the method's name per the choice in the source file.
@@ -549,3 +549,25 @@ func TestIssue43088(t *testing.T) {
Comparable(T1)
Comparable(T2)
}
+
+func TestIssue44515(t *testing.T) {
+ typ := Unsafe.Scope().Lookup("Pointer").Type()
+
+ got := TypeString(typ, nil)
+ want := "unsafe.Pointer"
+ if got != want {
+ t.Errorf("got %q; want %q", got, want)
+ }
+
+ qf := func(pkg *Package) string {
+ if pkg == Unsafe {
+ return "foo"
+ }
+ return ""
+ }
+ got = TypeString(typ, qf)
+ want = "foo.Pointer"
+ if got != want {
+ t.Errorf("got %q; want %q", got, want)
+ }
+}
diff --git a/src/go/types/lookup.go b/src/go/types/lookup.go
index a0e7f3cc0d..3691b1ecaa 100644
--- a/src/go/types/lookup.go
+++ b/src/go/types/lookup.go
@@ -107,7 +107,7 @@ func (check *Checker) rawLookupFieldOrMethod(T Type, addressable bool, pkg *Pack
var next []embeddedType // embedded types found at current depth
// look for (pkg, name) in all types at current depth
- var tpar *TypeParam // set if obj receiver is a type parameter
+ var tpar *_TypeParam // set if obj receiver is a type parameter
for _, e := range current {
typ := e.typ
@@ -195,7 +195,7 @@ func (check *Checker) rawLookupFieldOrMethod(T Type, addressable bool, pkg *Pack
indirect = e.indirect
}
- case *TypeParam:
+ case *_TypeParam:
// only consider explicit methods in the type parameter bound, not
// methods that may be common to all types in the type list.
if i, m := lookupMethod(t.Bound().allMethods, pkg, name); m != nil {
diff --git a/src/go/types/operand.go b/src/go/types/operand.go
index 8f9c9d09bf..8344c059c4 100644
--- a/src/go/types/operand.go
+++ b/src/go/types/operand.go
@@ -242,7 +242,7 @@ func (x *operand) assignableTo(check *Checker, T Type, reason *string) (bool, er
// x is an untyped value representable by a value of type T.
if isUntyped(Vu) {
- if t, ok := Tu.(*Sum); ok {
+ if t, ok := Tu.(*_Sum); ok {
return t.is(func(t Type) bool {
// TODO(gri) this could probably be more efficient
ok, _ := x.assignableTo(check, t, reason)
diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go
index 0233274967..7bb026414f 100644
--- a/src/go/types/predicates.go
+++ b/src/go/types/predicates.go
@@ -8,14 +8,13 @@ package types
import (
"go/token"
- "sort"
)
// isNamed reports whether typ has a name.
// isNamed may be called with types that are not fully set up.
func isNamed(typ Type) bool {
switch typ.(type) {
- case *Basic, *Named, *TypeParam, *instance:
+ case *Basic, *Named, *_TypeParam, *instance:
return true
}
return false
@@ -33,7 +32,7 @@ func is(typ Type, what BasicInfo) bool {
switch t := optype(typ).(type) {
case *Basic:
return t.info&what != 0
- case *Sum:
+ case *_Sum:
return t.is(func(typ Type) bool { return is(typ, what) })
}
return false
@@ -74,8 +73,13 @@ func isUntyped(typ Type) bool {
return !isTyped(typ)
}
-func isOrdered(typ Type) bool { return is(typ, IsOrdered) }
-func isConstType(typ Type) bool { return is(typ, IsConstType) }
+func isOrdered(typ Type) bool { return is(typ, IsOrdered) }
+
+func isConstType(typ Type) bool {
+ // Type parameters are never const types.
+ t, _ := under(typ).(*Basic)
+ return t != nil && t.info&IsConstType != 0
+}
// IsInterface reports whether typ is an interface type.
func IsInterface(typ Type) bool {
@@ -105,7 +109,7 @@ func comparable(T Type, seen map[Type]bool) bool {
//
// is not comparable because []byte is not comparable.
if t := asTypeParam(T); t != nil && optype(t) == theTop {
- return t.Bound().IsComparable()
+ return t.Bound()._IsComparable()
}
switch t := optype(T).(type) {
@@ -124,13 +128,13 @@ func comparable(T Type, seen map[Type]bool) bool {
return true
case *Array:
return comparable(t.elem, seen)
- case *Sum:
+ case *_Sum:
pred := func(t Type) bool {
return comparable(t, seen)
}
return t.is(pred)
- case *TypeParam:
- return t.Bound().IsComparable()
+ case *_TypeParam:
+ return t.Bound()._IsComparable()
}
return false
}
@@ -142,7 +146,7 @@ func hasNil(typ Type) bool {
return t.kind == UnsafePointer
case *Slice, *Pointer, *Signature, *Interface, *Map, *Chan:
return true
- case *Sum:
+ case *_Sum:
return t.is(hasNil)
}
return false
@@ -261,14 +265,14 @@ func (check *Checker) identical0(x, y Type, cmpTags bool, p *ifacePair) bool {
check.identical0(x.results, y.results, cmpTags, p)
}
- case *Sum:
+ case *_Sum:
// Two sum types are identical if they contain the same types.
// (Sum types always consist of at least two types. Also, the
// the set (list) of types in a sum type consists of unique
// types - each type appears exactly once. Thus, two sum types
// must contain the same number of types to have chance of
// being equal.
- if y, ok := y.(*Sum); ok && len(x.types) == len(y.types) {
+ if y, ok := y.(*_Sum); ok && len(x.types) == len(y.types) {
// Every type in x.types must be in y.types.
// Quadratic algorithm, but probably good enough for now.
// TODO(gri) we need a fast quick type ID/hash for all types.
@@ -330,8 +334,8 @@ func (check *Checker) identical0(x, y Type, cmpTags bool, p *ifacePair) bool {
p = p.prev
}
if debug {
- assert(sort.IsSorted(byUniqueMethodName(a)))
- assert(sort.IsSorted(byUniqueMethodName(b)))
+ assertSortedMethods(a)
+ assertSortedMethods(b)
}
for i, f := range a {
g := b[i]
@@ -366,7 +370,7 @@ func (check *Checker) identical0(x, y Type, cmpTags bool, p *ifacePair) bool {
return x.obj == y.obj
}
- case *TypeParam:
+ case *_TypeParam:
// nothing to do (x and y being equal is caught in the very beginning of this function)
// case *instance:
@@ -393,7 +397,7 @@ func (check *Checker) identicalTParams(x, y []*TypeName, cmpTags bool, p *ifaceP
}
for i, x := range x {
y := y[i]
- if !check.identical0(x.typ.(*TypeParam).bound, y.typ.(*TypeParam).bound, cmpTags, p) {
+ if !check.identical0(x.typ.(*_TypeParam).bound, y.typ.(*_TypeParam).bound, cmpTags, p) {
return false
}
}
diff --git a/src/go/types/resolver.go b/src/go/types/resolver.go
index 639ed12117..763ea48d38 100644
--- a/src/go/types/resolver.go
+++ b/src/go/types/resolver.go
@@ -259,14 +259,6 @@ func (check *Checker) collectObjects() {
return
}
- // add package to list of explicit imports
- // (this functionality is provided as a convenience
- // for clients; it is not needed for type-checking)
- if !pkgImports[imp] {
- pkgImports[imp] = true
- pkg.imports = append(pkg.imports, imp)
- }
-
// local name overrides imported package name
name := imp.name
if d.spec.Name != nil {
@@ -276,27 +268,41 @@ func (check *Checker) collectObjects() {
check.errorf(d.spec.Name, _ImportCRenamed, `cannot rename import "C"`)
return
}
- if name == "init" {
- check.errorf(d.spec.Name, _InvalidInitDecl, "cannot declare init - must be func")
- return
- }
}
- obj := NewPkgName(d.spec.Pos(), pkg, name, imp)
+ if name == "init" {
+ check.errorf(d.spec.Name, _InvalidInitDecl, "cannot import package as init - init must be a func")
+ return
+ }
+
+ // add package to list of explicit imports
+ // (this functionality is provided as a convenience
+ // for clients; it is not needed for type-checking)
+ if !pkgImports[imp] {
+ pkgImports[imp] = true
+ pkg.imports = append(pkg.imports, imp)
+ }
+
+ pkgName := NewPkgName(d.spec.Pos(), pkg, name, imp)
if d.spec.Name != nil {
// in a dot-import, the dot represents the package
- check.recordDef(d.spec.Name, obj)
+ check.recordDef(d.spec.Name, pkgName)
} else {
- check.recordImplicit(d.spec, obj)
+ check.recordImplicit(d.spec, pkgName)
}
if path == "C" {
// match cmd/compile (not prescribed by spec)
- obj.used = true
+ pkgName.used = true
}
// add import to file scope
+ check.imports = append(check.imports, pkgName)
if name == "." {
+ // dot-import
+ if check.dotImportMap == nil {
+ check.dotImportMap = make(map[dotImportKey]*PkgName)
+ }
// merge imported scope with file scope
for _, obj := range imp.scope.elems {
// A package scope may contain non-exported objects,
@@ -310,16 +316,15 @@ func (check *Checker) collectObjects() {
if alt := fileScope.Insert(obj); alt != nil {
check.errorf(d.spec.Name, _DuplicateDecl, "%s redeclared in this block", obj.Name())
check.reportAltDecl(alt)
+ } else {
+ check.dotImportMap[dotImportKey{fileScope, obj}] = pkgName
}
}
}
- // add position to set of dot-import positions for this file
- // (this is only needed for "imported but not used" errors)
- check.addUnusedDotImport(fileScope, imp, d.spec)
} else {
// declare imported package object in file scope
// (no need to provide s.Name since we called check.recordDef earlier)
- check.declare(fileScope, nil, obj, token.NoPos)
+ check.declare(fileScope, nil, pkgName, token.NoPos)
}
case constDecl:
// declare all constants
@@ -379,14 +384,20 @@ func (check *Checker) collectObjects() {
check.error(d.decl.Recv, _BadRecv, "method is missing receiver")
// treat as function
}
- if name == "init" {
+ if name == "init" || (name == "main" && check.pkg.name == "main") {
+ code := _InvalidInitDecl
+ if name == "main" {
+ code = _InvalidMainDecl
+ }
if d.decl.Type.TParams != nil {
- check.softErrorf(d.decl.Type.TParams, _InvalidInitSig, "func init must have no type parameters")
+ check.softErrorf(d.decl.Type.TParams, code, "func %s must have no type parameters", name)
}
if t := d.decl.Type; t.Params.NumFields() != 0 || t.Results != nil {
// TODO(rFindley) Should this be a hard error?
- check.softErrorf(d.decl, _InvalidInitSig, "func init must have no arguments and no return values")
+ check.softErrorf(d.decl, code, "func %s must have no arguments and no return values", name)
}
+ }
+ if name == "init" {
// don't declare init functions in the package scope - they are invisible
obj.parent = pkg.scope
check.recordDef(d.decl.Name, obj)
@@ -483,13 +494,10 @@ L: // unpack receiver type
}
// unpack type parameters, if any
- switch ptyp := rtyp.(type) {
- case *ast.IndexExpr:
- panic("unimplemented")
- case *ast.CallExpr:
- rtyp = ptyp.Fun
+ if ptyp, _ := rtyp.(*ast.IndexExpr); ptyp != nil {
+ rtyp = ptyp.X
if unpackParams {
- for _, arg := range ptyp.Args {
+ for _, arg := range unpackExpr(ptyp.Index) {
var par *ast.Ident
switch arg := arg.(type) {
case *ast.Ident:
@@ -648,39 +656,30 @@ func (check *Checker) unusedImports() {
// any of its exported identifiers. To import a package solely for its side-effects
// (initialization), use the blank identifier as explicit package name."
- // check use of regular imported packages
- for _, scope := range check.pkg.scope.children /* file scopes */ {
- for _, obj := range scope.elems {
- if obj, ok := obj.(*PkgName); ok {
- // Unused "blank imports" are automatically ignored
- // since _ identifiers are not entered into scopes.
- if !obj.used {
- path := obj.imported.path
- base := pkgName(path)
- if obj.name == base {
- check.softErrorf(obj, _UnusedImport, "%q imported but not used", path)
- } else {
- check.softErrorf(obj, _UnusedImport, "%q imported but not used as %s", path, obj.name)
- }
- }
- }
- }
- }
-
- // check use of dot-imported packages
- for _, unusedDotImports := range check.unusedDotImports {
- for pkg, pos := range unusedDotImports {
- check.softErrorf(pos, _UnusedImport, "%q imported but not used", pkg.path)
+ for _, obj := range check.imports {
+ if !obj.used && obj.name != "_" {
+ check.errorUnusedPkg(obj)
}
}
}
-// pkgName returns the package name (last element) of an import path.
-func pkgName(path string) string {
- if i := strings.LastIndex(path, "/"); i >= 0 {
- path = path[i+1:]
+func (check *Checker) errorUnusedPkg(obj *PkgName) {
+ // If the package was imported with a name other than the final
+ // import path element, show it explicitly in the error message.
+ // Note that this handles both renamed imports and imports of
+ // packages containing unconventional package declarations.
+ // Note that this uses / always, even on Windows, because Go import
+ // paths always use forward slashes.
+ path := obj.imported.path
+ elem := path
+ if i := strings.LastIndex(elem, "/"); i >= 0 {
+ elem = elem[i+1:]
+ }
+ if obj.name == "" || obj.name == "." || obj.name == elem {
+ check.softErrorf(obj, _UnusedImport, "%q imported but not used", path)
+ } else {
+ check.softErrorf(obj, _UnusedImport, "%q imported but not used as %s", path, obj.name)
}
- return path
}
// dir makes a good-faith attempt to return the directory
diff --git a/src/go/types/sanitize.go b/src/go/types/sanitize.go
index c4e729ec9b..3429867321 100644
--- a/src/go/types/sanitize.go
+++ b/src/go/types/sanitize.go
@@ -6,6 +6,11 @@ package types
// sanitizeInfo walks the types contained in info to ensure that all instances
// are expanded.
+//
+// This includes some objects that may be shared across concurrent
+// type-checking passes (such as those in the universe scope), so we are
+// careful here not to write types that are already sanitized. This avoids a
+// data race as any shared types should already be sanitized.
func sanitizeInfo(info *Info) {
var s sanitizer = make(map[Type]Type)
@@ -13,27 +18,42 @@ func sanitizeInfo(info *Info) {
// If modified, they must be assigned back.
for e, tv := range info.Types {
- tv.Type = s.typ(tv.Type)
- info.Types[e] = tv
+ if typ := s.typ(tv.Type); typ != tv.Type {
+ tv.Type = typ
+ info.Types[e] = tv
+ }
}
- for e, inf := range info.Inferred {
+ for e, inf := range info._Inferred {
+ changed := false
for i, targ := range inf.Targs {
- inf.Targs[i] = s.typ(targ)
+ if typ := s.typ(targ); typ != targ {
+ inf.Targs[i] = typ
+ changed = true
+ }
+ }
+ if typ := s.typ(inf.Sig); typ != inf.Sig {
+ inf.Sig = typ.(*Signature)
+ changed = true
+ }
+ if changed {
+ info._Inferred[e] = inf
}
- inf.Sig = s.typ(inf.Sig).(*Signature)
- info.Inferred[e] = inf
}
for _, obj := range info.Defs {
if obj != nil {
- obj.setType(s.typ(obj.Type()))
+ if typ := s.typ(obj.Type()); typ != obj.Type() {
+ obj.setType(typ)
+ }
}
}
for _, obj := range info.Uses {
if obj != nil {
- obj.setType(s.typ(obj.Type()))
+ if typ := s.typ(obj.Type()); typ != obj.Type() {
+ obj.setType(typ)
+ }
}
}
@@ -57,16 +77,22 @@ func (s sanitizer) typ(typ Type) Type {
// nothing to do
case *Array:
- t.elem = s.typ(t.elem)
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Slice:
- t.elem = s.typ(t.elem)
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Struct:
s.varList(t.fields)
case *Pointer:
- t.base = s.typ(t.base)
+ if base := s.typ(t.base); base != t.base {
+ t.base = base
+ }
case *Tuple:
s.tuple(t)
@@ -76,7 +102,7 @@ func (s sanitizer) typ(typ Type) Type {
s.tuple(t.params)
s.tuple(t.results)
- case *Sum:
+ case *_Sum:
s.typeList(t.types)
case *Interface:
@@ -87,20 +113,32 @@ func (s sanitizer) typ(typ Type) Type {
s.typ(t.allTypes)
case *Map:
- t.key = s.typ(t.key)
- t.elem = s.typ(t.elem)
+ if key := s.typ(t.key); key != t.key {
+ t.key = key
+ }
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Chan:
- t.elem = s.typ(t.elem)
+ if elem := s.typ(t.elem); elem != t.elem {
+ t.elem = elem
+ }
case *Named:
- t.orig = s.typ(t.orig)
- t.underlying = s.typ(t.underlying)
+ if orig := s.typ(t.orig); orig != t.orig {
+ t.orig = orig
+ }
+ if under := s.typ(t.underlying); under != t.underlying {
+ t.underlying = under
+ }
s.typeList(t.targs)
s.funcList(t.methods)
- case *TypeParam:
- t.bound = s.typ(t.bound)
+ case *_TypeParam:
+ if bound := s.typ(t.bound); bound != t.bound {
+ t.bound = bound
+ }
case *instance:
typ = t.expand()
@@ -115,7 +153,9 @@ func (s sanitizer) typ(typ Type) Type {
func (s sanitizer) var_(v *Var) {
if v != nil {
- v.typ = s.typ(v.typ)
+ if typ := s.typ(v.typ); typ != v.typ {
+ v.typ = typ
+ }
}
}
@@ -133,7 +173,9 @@ func (s sanitizer) tuple(t *Tuple) {
func (s sanitizer) func_(f *Func) {
if f != nil {
- f.typ = s.typ(f.typ)
+ if typ := s.typ(f.typ); typ != f.typ {
+ f.typ = typ
+ }
}
}
@@ -145,6 +187,8 @@ func (s sanitizer) funcList(list []*Func) {
func (s sanitizer) typeList(list []Type) {
for i, t := range list {
- list[i] = s.typ(t)
+ if typ := s.typ(t); typ != t {
+ list[i] = typ
+ }
}
}
diff --git a/src/go/types/scope.go b/src/go/types/scope.go
index 157b1b7066..26c28d1c4e 100644
--- a/src/go/types/scope.go
+++ b/src/go/types/scope.go
@@ -108,13 +108,13 @@ func (s *Scope) Insert(obj Object) Object {
return nil
}
-// Squash merges s with its parent scope p by adding all
+// squash merges s with its parent scope p by adding all
// objects of s to p, adding all children of s to the
// children of p, and removing s from p's children.
// The function f is called for each object obj in s which
// has an object alt in p. s should be discarded after
// having been squashed.
-func (s *Scope) Squash(err func(obj, alt Object)) {
+func (s *Scope) squash(err func(obj, alt Object)) {
p := s.parent
assert(p != nil)
for _, obj := range s.elems {
diff --git a/src/go/types/sizes.go b/src/go/types/sizes.go
index e8377a4f92..67052bb816 100644
--- a/src/go/types/sizes.go
+++ b/src/go/types/sizes.go
@@ -148,7 +148,7 @@ func (s *StdSizes) Sizeof(T Type) int64 {
}
offsets := s.Offsetsof(t.fields)
return offsets[n-1] + s.Sizeof(t.fields[n-1].typ)
- case *Sum:
+ case *_Sum:
panic("Sizeof unimplemented for type sum")
case *Interface:
return s.WordSize * 2
diff --git a/src/go/types/stdlib_test.go b/src/go/types/stdlib_test.go
index 63e31f3d74..29f71137df 100644
--- a/src/go/types/stdlib_test.go
+++ b/src/go/types/stdlib_test.go
@@ -106,6 +106,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
// get per-file instructions
expectErrors := false
filename := filepath.Join(path, f.Name())
+ goVersion := ""
if comment := firstComment(filename); comment != "" {
fields := strings.Fields(comment)
switch fields[0] {
@@ -115,13 +116,17 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
expectErrors = true
for _, arg := range fields[1:] {
if arg == "-0" || arg == "-+" || arg == "-std" {
- // Marked explicitly as not expected errors (-0),
+ // Marked explicitly as not expecting errors (-0),
// or marked as compiling runtime/stdlib, which is only done
// to trigger runtime/stdlib-only error output.
// In both cases, the code should typecheck.
expectErrors = false
break
}
+ const prefix = "-lang="
+ if strings.HasPrefix(arg, prefix) {
+ goVersion = arg[len(prefix):]
+ }
}
}
}
@@ -129,7 +134,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
// parse and type-check file
file, err := parser.ParseFile(fset, filename, nil, 0)
if err == nil {
- conf := Config{Importer: stdLibImporter}
+ conf := Config{GoVersion: goVersion, Importer: stdLibImporter}
_, err = conf.Check(filename, fset, []*ast.File{file}, nil)
}
@@ -171,19 +176,15 @@ func TestStdFixed(t *testing.T) {
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
"bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
"issue6889.go", // gc-specific test
- "issue7746.go", // large constants - consumes too much memory
"issue11362.go", // canonical import path check
"issue16369.go", // go/types handles this correctly - not an issue
"issue18459.go", // go/types doesn't check validity of //go:xxx directives
"issue18882.go", // go/types doesn't check validity of //go:xxx directives
- "issue20232.go", // go/types handles larger constants than gc
"issue20529.go", // go/types does not have constraints on stack size
"issue22200.go", // go/types does not have constraints on stack size
"issue22200b.go", // go/types does not have constraints on stack size
"issue25507.go", // go/types does not have constraints on stack size
"issue20780.go", // go/types does not have constraints on stack size
- "issue31747.go", // go/types does not have constraints on language level (-lang=go1.12) (see #31793)
- "issue34329.go", // go/types does not have constraints on language level (-lang=go1.13) (see #31793)
"bug251.go", // issue #34333 which was exposed with fix for #34151
"issue42058a.go", // go/types does not have constraints on channel element size
"issue42058b.go", // go/types does not have constraints on channel element size
diff --git a/src/go/types/stmt.go b/src/go/types/stmt.go
index 82c21c2a7a..27da198a85 100644
--- a/src/go/types/stmt.go
+++ b/src/go/types/stmt.go
@@ -907,7 +907,7 @@ func rangeKeyVal(typ Type, wantKey, wantVal bool) (Type, Type, string) {
msg = "send-only channel"
}
return typ.elem, Typ[Invalid], msg
- case *Sum:
+ case *_Sum:
first := true
var key, val Type
var msg string
diff --git a/src/go/types/subst.go b/src/go/types/subst.go
index ed27488503..931375f1f2 100644
--- a/src/go/types/subst.go
+++ b/src/go/types/subst.go
@@ -22,21 +22,21 @@ type substMap struct {
// TODO(gri) rewrite that code, get rid of this field, and make this
// struct just the map (proj)
targs []Type
- proj map[*TypeParam]Type
+ proj map[*_TypeParam]Type
}
// makeSubstMap creates a new substitution map mapping tpars[i] to targs[i].
// If targs[i] is nil, tpars[i] is not substituted.
func makeSubstMap(tpars []*TypeName, targs []Type) *substMap {
assert(len(tpars) == len(targs))
- proj := make(map[*TypeParam]Type, len(tpars))
+ proj := make(map[*_TypeParam]Type, len(tpars))
for i, tpar := range tpars {
// We must expand type arguments otherwise *instance
// types end up as components in composite types.
// TODO(gri) explain why this causes problems, if it does
targ := expand(targs[i]) // possibly nil
targs[i] = targ
- proj[tpar.typ.(*TypeParam)] = targ
+ proj[tpar.typ.(*_TypeParam)] = targ
}
return &substMap{targs, proj}
}
@@ -49,7 +49,7 @@ func (m *substMap) empty() bool {
return len(m.proj) == 0
}
-func (m *substMap) lookup(tpar *TypeParam) Type {
+func (m *substMap) lookup(tpar *_TypeParam) Type {
if t := m.proj[tpar]; t != nil {
return t
}
@@ -121,7 +121,7 @@ func (check *Checker) instantiate(pos token.Pos, typ Type, targs []Type, poslist
// check bounds
for i, tname := range tparams {
- tpar := tname.typ.(*TypeParam)
+ tpar := tname.typ.(*_TypeParam)
iface := tpar.Bound()
if iface.Empty() {
continue // no type bound
@@ -222,7 +222,7 @@ func (check *Checker) subst(pos token.Pos, typ Type, smap *substMap) Type {
switch t := typ.(type) {
case *Basic:
return typ // nothing to do
- case *TypeParam:
+ case *_TypeParam:
return smap.lookup(t)
}
@@ -293,13 +293,13 @@ func (subst *subster) typ(typ Type) Type {
}
}
- case *Sum:
+ case *_Sum:
types, copied := subst.typeList(t.types)
if copied {
// Don't do it manually, with a Sum literal: the new
// types list may not be unique and NewSum may remove
// duplicates.
- return NewSum(types)
+ return _NewSum(types)
}
case *Interface:
@@ -389,7 +389,7 @@ func (subst *subster) typ(typ Type) Type {
// create a new named type and populate caches to avoid endless recursion
tname := NewTypeName(subst.pos, t.obj.pkg, t.obj.name, nil)
- named := subst.check.NewNamed(tname, t.underlying, t.methods) // method signatures are updated lazily
+ named := subst.check.newNamed(tname, t.underlying, t.methods) // method signatures are updated lazily
named.tparams = t.tparams // new type is still parameterized
named.targs = newTargs
subst.check.typMap[h] = named
@@ -402,7 +402,7 @@ func (subst *subster) typ(typ Type) Type {
return named
- case *TypeParam:
+ case *_TypeParam:
return subst.smap.lookup(t)
case *instance:
diff --git a/src/go/types/testdata/builtins.src b/src/go/types/testdata/builtins.src
index 3c273b0766..3707528914 100644
--- a/src/go/types/testdata/builtins.src
+++ b/src/go/types/testdata/builtins.src
@@ -283,7 +283,7 @@ func delete1() {
delete() // ERROR not enough arguments
delete(1) // ERROR not enough arguments
delete(1, 2, 3) // ERROR too many arguments
- delete(m, 0 /* ERROR not assignable */)
+ delete(m, 0 /* ERROR cannot use */)
delete(m, s)
_ = delete /* ERROR used as value */ (m, s)
@@ -514,7 +514,7 @@ func panic1() {
panic("foo")
panic(false)
panic(1<<10)
- panic(1 /* ERROR overflows */ <<1000)
+ panic(1 << /* ERROR constant shift overflow */ 1000)
_ = panic /* ERROR used as value */ (0)
var s []byte
@@ -538,7 +538,7 @@ func print1() {
print(2.718281828)
print(false)
print(1<<10)
- print(1 /* ERROR overflows */ <<1000)
+ print(1 << /* ERROR constant shift overflow */ 1000)
println(nil /* ERROR untyped nil */ )
var s []int
@@ -564,7 +564,7 @@ func println1() {
println(2.718281828)
println(false)
println(1<<10)
- println(1 /* ERROR overflows */ <<1000)
+ println(1 << /* ERROR constant shift overflow */ 1000)
println(nil /* ERROR untyped nil */ )
var s []int
@@ -695,7 +695,7 @@ func Alignof1() {
_ = unsafe.Alignof(42)
_ = unsafe.Alignof(new(struct{}))
_ = unsafe.Alignof(1<<10)
- _ = unsafe.Alignof(1 /* ERROR overflows */ <<1000)
+ _ = unsafe.Alignof(1 << /* ERROR constant shift overflow */ 1000)
_ = unsafe.Alignof(nil /* ERROR "untyped nil */ )
unsafe /* ERROR not used */ .Alignof(x)
@@ -783,7 +783,7 @@ func Sizeof1() {
_ = unsafe.Sizeof(42)
_ = unsafe.Sizeof(new(complex128))
_ = unsafe.Sizeof(1<<10)
- _ = unsafe.Sizeof(1 /* ERROR overflows */ <<1000)
+ _ = unsafe.Sizeof(1 << /* ERROR constant shift overflow */ 1000)
_ = unsafe.Sizeof(nil /* ERROR untyped nil */ )
unsafe /* ERROR not used */ .Sizeof(x)
diff --git a/src/go/types/testdata/const0.src b/src/go/types/testdata/const0.src
index adbbf2863b..5608b1549b 100644
--- a/src/go/types/testdata/const0.src
+++ b/src/go/types/testdata/const0.src
@@ -348,3 +348,16 @@ const _ = unsafe.Sizeof(func() {
assert(one == 1)
assert(iota == 0)
})
+
+// untyped constants must not get arbitrarily large
+const prec = 512 // internal maximum precision for integers
+const maxInt = (1<<(prec/2) - 1) * (1<<(prec/2) + 1) // == 1<<prec - 1
+
+const _ = maxInt + /* ERROR constant addition overflow */ 1
+const _ = -maxInt - /* ERROR constant subtraction overflow */ 1
+const _ = maxInt ^ /* ERROR constant bitwise XOR overflow */ -1
+const _ = maxInt * /* ERROR constant multiplication overflow */ 2
+const _ = maxInt << /* ERROR constant shift overflow */ 2
+const _ = 1 << /* ERROR constant shift overflow */ prec
+
+const _ = ^ /* ERROR constant bitwise complement overflow */ maxInt
diff --git a/src/go/types/testdata/const1.src b/src/go/types/testdata/const1.src
index d82770464f..56b6bd4ca5 100644
--- a/src/go/types/testdata/const1.src
+++ b/src/go/types/testdata/const1.src
@@ -43,7 +43,12 @@ const (
const (
smallestFloat32 = 1.0 / (1<<(127 - 1 + 23))
- smallestFloat64 = 1.0 / (1<<(1023 - 1 + 52))
+ // TODO(gri) The compiler limits integers to 512 bit and thus
+ // we cannot compute the value (1<<(1023 - 1 + 52))
+ // without overflow. For now we match the compiler.
+ // See also issue #44057.
+ // smallestFloat64 = 1.0 / (1<<(1023 - 1 + 52))
+ smallestFloat64 = 4.940656458412465441765687928682213723651e-324
)
const (
@@ -53,7 +58,12 @@ const (
const (
maxFloat32 = 1<<127 * (1<<24 - 1) / (1.0<<23)
- maxFloat64 = 1<<1023 * (1<<53 - 1) / (1.0<<52)
+ // TODO(gri) The compiler limits integers to 512 bit and thus
+ // we cannot compute the value 1<<1023
+ // without overflow. For now we match the compiler.
+ // See also issue #44057.
+ // maxFloat64 = 1<<1023 * (1<<53 - 1) / (1.0<<52)
+ maxFloat64 = 1.797693134862315708145274237317043567981e+308
)
const (
@@ -271,7 +281,9 @@ const (
_ = assert(float64(smallestFloat32) == smallestFloat32)
_ = assert(float64(smallestFloat32/2) == smallestFloat32/2)
_ = assert(float64(smallestFloat64) == smallestFloat64)
- _ = assert(float64(smallestFloat64/2) == 0)
+ // TODO(gri) With the change to the declaration of smallestFloat64
+ // this now fails to be true. See issue #44058.
+ // _ = assert(float64(smallestFloat64/2) == 0)
)
const (
diff --git a/src/go/types/testdata/go1_12.src b/src/go/types/testdata/go1_12.src
new file mode 100644
index 0000000000..1e529f18be
--- /dev/null
+++ b/src/go/types/testdata/go1_12.src
@@ -0,0 +1,35 @@
+// Copyright 2021 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.
+
+// Check Go language version-specific errors.
+
+package go1_12 // go1.12
+
+// numeric literals
+const (
+ _ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later"
+ _ = 0b111 // ERROR "binary literals requires go1.13 or later"
+ _ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
+ _ = 0xabc // ok
+ _ = 0x0p1 // ERROR "hexadecimal floating-point literals requires go1.13 or later"
+
+ _ = 0B111 // ERROR "binary"
+ _ = 0O567 // ERROR "octal"
+ _ = 0Xabc // ok
+ _ = 0X0P1 // ERROR "hexadecimal floating-point"
+
+ _ = 1_000i // ERROR "underscores"
+ _ = 0b111i // ERROR "binary"
+ _ = 0o567i // ERROR "octal"
+ _ = 0xabci // ERROR "hexadecimal floating-point"
+ _ = 0x0p1i // ERROR "hexadecimal floating-point"
+)
+
+// signed shift counts
+var (
+ s int
+ _ = 1 << s // ERROR "invalid operation: signed shift count s \(variable of type int\) requires go1.13 or later"
+ _ = 1 >> s // ERROR "signed shift count"
+)
+
diff --git a/src/go/types/testdata/go1_13.src b/src/go/types/testdata/go1_13.src
new file mode 100644
index 0000000000..6aa1364e8a
--- /dev/null
+++ b/src/go/types/testdata/go1_13.src
@@ -0,0 +1,22 @@
+// Copyright 2021 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.
+
+// Check Go language version-specific errors.
+
+package go1_13 // go1.13
+
+// interface embedding
+
+type I interface { m() }
+
+type _ interface {
+ m()
+ I // ERROR "duplicate method m"
+}
+
+type _ interface {
+ I
+ I // ERROR "duplicate method m"
+}
+
diff --git a/src/go/types/testdata/go1_8.src b/src/go/types/testdata/go1_8.src
new file mode 100644
index 0000000000..3ead1e981b
--- /dev/null
+++ b/src/go/types/testdata/go1_8.src
@@ -0,0 +1,11 @@
+// Copyright 2021 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.
+
+// Check Go language version-specific errors.
+
+package go1_8 // go1.8
+
+// type alias declarations
+type any = /* ERROR type aliases requires go1.9 or later */ interface{}
+
diff --git a/src/go/types/testdata/importdecl0/importdecl0a.src b/src/go/types/testdata/importdecl0/importdecl0a.src
index e96fca3cdd..5ceb96e1fa 100644
--- a/src/go/types/testdata/importdecl0/importdecl0a.src
+++ b/src/go/types/testdata/importdecl0/importdecl0a.src
@@ -10,7 +10,7 @@ import (
// we can have multiple blank imports (was bug)
_ "math"
_ "net/rpc"
- init /* ERROR "cannot declare init" */ "fmt"
+ init /* ERROR "cannot import package as init" */ "fmt"
// reflect defines a type "flag" which shows up in the gc export data
"reflect"
. /* ERROR "imported but not used" */ "reflect"
diff --git a/src/go/types/testdata/importdecl0/importdecl0b.src b/src/go/types/testdata/importdecl0/importdecl0b.src
index 6844e70982..55690423b6 100644
--- a/src/go/types/testdata/importdecl0/importdecl0b.src
+++ b/src/go/types/testdata/importdecl0/importdecl0b.src
@@ -8,7 +8,7 @@ import "math"
import m "math"
import . "testing" // declares T in file scope
-import . /* ERROR "imported but not used" */ "unsafe"
+import . /* ERROR .unsafe. imported but not used */ "unsafe"
import . "fmt" // declares Println in file scope
import (
diff --git a/src/go/types/testdata/importdecl1/importdecl1b.src b/src/go/types/testdata/importdecl1/importdecl1b.src
index ee70bbd8e7..43a7bcd753 100644
--- a/src/go/types/testdata/importdecl1/importdecl1b.src
+++ b/src/go/types/testdata/importdecl1/importdecl1b.src
@@ -4,7 +4,7 @@
package importdecl1
-import . /* ERROR "imported but not used" */ "unsafe"
+import . /* ERROR .unsafe. imported but not used */ "unsafe"
type B interface {
A
diff --git a/src/go/types/testdata/issues.go2 b/src/go/types/testdata/issues.go2
index ac2dee36cb..2d4bb32c4b 100644
--- a/src/go/types/testdata/issues.go2
+++ b/src/go/types/testdata/issues.go2
@@ -21,7 +21,7 @@ func _() {
eql(x, x)
eql(y, y)
eql(y, nil)
- eql(io.Reader)(nil, nil)
+ eql[io.Reader](nil, nil)
}
// If we have a receiver of pointer type (below: *T) we must ignore
@@ -55,8 +55,8 @@ func (T) m1()
func (*T) m2()
func _() {
- f2(T /* ERROR wrong method signature */ )()
- f2(*T)()
+ f2[T /* ERROR wrong method signature */]()
+ f2[*T]()
}
// When a type parameter is used as an argument to instantiate a parameterized
@@ -244,7 +244,7 @@ func append[T interface{}, S sliceOf[T], T2 interface{ type T }](s S, t ...T2) S
var f func()
var cancelSlice []context.CancelFunc
-var _ = append(context.CancelFunc, []context.CancelFunc, context.CancelFunc)(cancelSlice, f)
+var _ = append[context.CancelFunc, []context.CancelFunc, context.CancelFunc](cancelSlice, f)
// A generic function must be instantiated with a type, not a value.
diff --git a/src/go/types/testdata/main.src b/src/go/types/testdata/main.src
new file mode 100644
index 0000000000..f892938d4a
--- /dev/null
+++ b/src/go/types/testdata/main.src
@@ -0,0 +1,9 @@
+// Copyright 2020 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.
+
+package main
+
+func main()
+func /* ERROR "no arguments and no return values" */ main /* ERROR redeclared */ (int)
+func /* ERROR "no arguments and no return values" */ main /* ERROR redeclared */ () int
diff --git a/src/go/types/testdata/shifts.src b/src/go/types/testdata/shifts.src
index c9a38ae169..4d3c59a50f 100644
--- a/src/go/types/testdata/shifts.src
+++ b/src/go/types/testdata/shifts.src
@@ -20,7 +20,7 @@ func shifts0() {
// This depends on the exact spec wording which is not
// done yet.
// TODO(gri) revisit and adjust when spec change is done
- _ = 1<<- /* ERROR "truncated to uint" */ 1.0
+ _ = 1<<- /* ERROR "negative shift count" */ 1.0
_ = 1<<1075 /* ERROR "invalid shift" */
_ = 2.0<<1
_ = 1<<1.0
@@ -60,11 +60,13 @@ func shifts1() {
_ uint = 1 << u
_ float32 = 1 /* ERROR "must be integer" */ << u
- // for issue 14822
+ // issue #14822
+ _ = 1<<( /* ERROR "overflows uint" */ 1<<64)
_ = 1<<( /* ERROR "invalid shift count" */ 1<<64-1)
- _ = 1<<( /* ERROR "invalid shift count" */ 1<<64)
- _ = u<<(1<<63) // valid
- _ = u<<(1<<64) // valid
+
+ // issue #43697
+ _ = u<<( /* ERROR "overflows uint" */ 1<<64)
+ _ = u<<(1<<64-1)
)
}
diff --git a/src/go/types/testdata/stmt0.src b/src/go/types/testdata/stmt0.src
index 297e34be42..2602d7dacf 100644
--- a/src/go/types/testdata/stmt0.src
+++ b/src/go/types/testdata/stmt0.src
@@ -90,7 +90,7 @@ func assignments1() {
// assignments to _
_ = nil /* ERROR "use of untyped nil" */
- _ = 1 /* ERROR overflow */ <<1000
+ _ = 1 << /* ERROR constant shift overflow */ 1000
(_) = 0
}
diff --git a/src/go/types/testdata/typeparams.go2 b/src/go/types/testdata/typeparams.go2
index bdf6d56082..bb7f016a83 100644
--- a/src/go/types/testdata/typeparams.go2
+++ b/src/go/types/testdata/typeparams.go2
@@ -19,6 +19,10 @@ func _[_ any](x int) int
func _[T any](T /* ERROR redeclared */ T)()
func _[T, T /* ERROR redeclared */ any]()
+// Constraints (incl. any) may be parenthesized.
+func _[_ (any)]() {}
+func _[_ (interface{})]() {}
+
func reverse[T any](list []T) []T {
rlist := make([]T, len(list))
i := len(list)
@@ -38,7 +42,7 @@ var _ = f(0 /* ERROR cannot use 0 .* as \[\]chan int */ )
func swap[A, B any](a A, b B) (B, A) { return b, a }
var _ = swap /* ERROR single value is expected */ [int, float32](1, 2)
-var f32, i = swap[int, float32](swap(float32, int)(1, 2))
+var f32, i = swap[int, float32](swap[float32, int](1, 2))
var _ float32 = f32
var _ int = i
@@ -76,11 +80,11 @@ var _ *int = new[int]()
func _[T any](map[T /* ERROR incomparable map key type T \(missing comparable constraint\) */]int) // w/o constraint we don't know if T is comparable
func f1[T1 any](struct{T1}) int
-var _ = f1(int)(struct{T1}{})
+var _ = f1[int](struct{T1}{})
type T1 = int
func f2[t1 any](struct{t1; x float32}) int
-var _ = f2(t1)(struct{t1; x float32}{})
+var _ = f2[t1](struct{t1; x float32}{})
type t1 = int
@@ -216,9 +220,9 @@ var _ = f8(1) /* ERROR not enough arguments */
var _ = f8(1, 2.3)
var _ = f8(1, 2.3, 3.4, 4.5)
var _ = f8(1, 2.3, 3.4, 4 /* ERROR does not match */ )
-var _ = f8(int, float64)(1, 2.3, 3.4, 4)
+var _ = f8[int, float64](1, 2.3, 3.4, 4)
-var _ = f8(int, float64)(0, 0, nil...) // test case for #18268
+var _ = f8[int, float64](0, 0, nil...) // test case for #18268
// init functions cannot have type parameters
@@ -271,7 +275,7 @@ type A[T any] T
func (a A[T]) m() A[T]
func _[T any]() {
- f12(A[T])()
+ f12[A[T]]()
}
// method expressions
diff --git a/src/go/types/type.go b/src/go/types/type.go
index 0fcefefb73..201da95a58 100644
--- a/src/go/types/type.go
+++ b/src/go/types/type.go
@@ -7,7 +7,6 @@ package types
import (
"fmt"
"go/token"
- "sort"
)
// A Type represents a type of Go.
@@ -241,11 +240,11 @@ func NewSignature(recv *Var, params, results *Tuple, variadic bool) *Signature {
// contain methods whose receiver type is a different interface.
func (s *Signature) Recv() *Var { return s.recv }
-// TParams returns the type parameters of signature s, or nil.
-func (s *Signature) TParams() []*TypeName { return s.tparams }
+// _TParams returns the type parameters of signature s, or nil.
+func (s *Signature) _TParams() []*TypeName { return s.tparams }
-// SetTParams sets the type parameters of signature s.
-func (s *Signature) SetTParams(tparams []*TypeName) { s.tparams = tparams }
+// _SetTParams sets the type parameters of signature s.
+func (s *Signature) _SetTParams(tparams []*TypeName) { s.tparams = tparams }
// Params returns the parameters of signature s, or nil.
func (s *Signature) Params() *Tuple { return s.params }
@@ -256,19 +255,19 @@ func (s *Signature) Results() *Tuple { return s.results }
// Variadic reports whether the signature s is variadic.
func (s *Signature) Variadic() bool { return s.variadic }
-// A Sum represents a set of possible types.
+// A _Sum represents a set of possible types.
// Sums are currently used to represent type lists of interfaces
// and thus the underlying types of type parameters; they are not
// first class types of Go.
-type Sum struct {
+type _Sum struct {
types []Type // types are unique
}
-// NewSum returns a new Sum type consisting of the provided
+// _NewSum returns a new Sum type consisting of the provided
// types if there are more than one. If there is exactly one
// type, it returns that type. If the list of types is empty
// the result is nil.
-func NewSum(types []Type) Type {
+func _NewSum(types []Type) Type {
if len(types) == 0 {
return nil
}
@@ -279,7 +278,7 @@ func NewSum(types []Type) Type {
// current use case of type lists.
// TODO(gri) Come up with the rules for sum types.
for _, t := range types {
- if _, ok := t.(*Sum); ok {
+ if _, ok := t.(*_Sum); ok {
panic("sum type contains sum type - unimplemented")
}
}
@@ -287,11 +286,11 @@ func NewSum(types []Type) Type {
if len(types) == 1 {
return types[0]
}
- return &Sum{types: types}
+ return &_Sum{types: types}
}
// is reports whether all types in t satisfy pred.
-func (s *Sum) is(pred func(Type) bool) bool {
+func (s *_Sum) is(pred func(Type) bool) bool {
if s == nil {
return false
}
@@ -393,8 +392,8 @@ func NewInterfaceType(methods []*Func, embeddeds []Type) *Interface {
}
// sort for API stability
- sort.Sort(byUniqueMethodName(methods))
- sort.Stable(byUniqueTypeName(embeddeds))
+ sortMethods(methods)
+ sortTypes(embeddeds)
typ.methods = methods
typ.embeddeds = embeddeds
@@ -447,8 +446,8 @@ func (t *Interface) Empty() bool {
}, nil)
}
-// HasTypeList reports whether interface t has a type list, possibly from an embedded type.
-func (t *Interface) HasTypeList() bool {
+// _HasTypeList reports whether interface t has a type list, possibly from an embedded type.
+func (t *Interface) _HasTypeList() bool {
if t.allMethods != nil {
// interface is complete - quick test
return t.allTypes != nil
@@ -459,8 +458,8 @@ func (t *Interface) HasTypeList() bool {
}, nil)
}
-// IsComparable reports whether interface t is or embeds the predeclared interface "comparable".
-func (t *Interface) IsComparable() bool {
+// _IsComparable reports whether interface t is or embeds the predeclared interface "comparable".
+func (t *Interface) _IsComparable() bool {
if t.allMethods != nil {
// interface is complete - quick test
_, m := lookupMethod(t.allMethods, nil, "==")
@@ -473,8 +472,8 @@ func (t *Interface) IsComparable() bool {
}, nil)
}
-// IsConstraint reports t.HasTypeList() || t.IsComparable().
-func (t *Interface) IsConstraint() bool {
+// _IsConstraint reports t.HasTypeList() || t.IsComparable().
+func (t *Interface) _IsConstraint() bool {
if t.allMethods != nil {
// interface is complete - quick test
if t.allTypes != nil {
@@ -591,7 +590,7 @@ func (t *Interface) Complete() *Interface {
}
if methods != nil {
- sort.Sort(byUniqueMethodName(methods))
+ sortMethods(methods)
t.allMethods = methods
}
t.allTypes = allTypes
@@ -668,7 +667,7 @@ func NewNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
return typ
}
-func (check *Checker) NewNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
+func (check *Checker) newNamed(obj *TypeName, underlying Type, methods []*Func) *Named {
typ := &Named{check: check, obj: obj, orig: underlying, underlying: underlying, methods: methods}
if obj.typ == nil {
obj.typ = typ
@@ -682,15 +681,15 @@ func (t *Named) Obj() *TypeName { return t.obj }
// TODO(gri) Come up with a better representation and API to distinguish
// between parameterized instantiated and non-instantiated types.
-// TParams returns the type parameters of the named type t, or nil.
+// _TParams returns the type parameters of the named type t, or nil.
// The result is non-nil for an (originally) parameterized type even if it is instantiated.
-func (t *Named) TParams() []*TypeName { return t.tparams }
+func (t *Named) _TParams() []*TypeName { return t.tparams }
-// TArgs returns the type arguments after instantiation of the named type t, or nil if not instantiated.
-func (t *Named) TArgs() []Type { return t.targs }
+// _TArgs returns the type arguments after instantiation of the named type t, or nil if not instantiated.
+func (t *Named) _TArgs() []Type { return t.targs }
-// SetTArgs sets the type arguments of Named.
-func (t *Named) SetTArgs(args []Type) { t.targs = args }
+// _SetTArgs sets the type arguments of Named.
+func (t *Named) _SetTArgs(args []Type) { t.targs = args }
// NumMethods returns the number of explicit methods whose receiver is named type t.
func (t *Named) NumMethods() int { return len(t.methods) }
@@ -716,8 +715,8 @@ func (t *Named) AddMethod(m *Func) {
}
}
-// A TypeParam represents a type parameter type.
-type TypeParam struct {
+// A _TypeParam represents a type parameter type.
+type _TypeParam struct {
check *Checker // for lazy type bound completion
id uint64 // unique id
obj *TypeName // corresponding type name
@@ -725,10 +724,10 @@ type TypeParam struct {
bound Type // *Named or *Interface; underlying type is always *Interface
}
-// NewTypeParam returns a new TypeParam.
-func (check *Checker) NewTypeParam(obj *TypeName, index int, bound Type) *TypeParam {
+// newTypeParam returns a new TypeParam.
+func (check *Checker) newTypeParam(obj *TypeName, index int, bound Type) *_TypeParam {
assert(bound != nil)
- typ := &TypeParam{check: check, id: check.nextId, obj: obj, index: index, bound: bound}
+ typ := &_TypeParam{check: check, id: check.nextId, obj: obj, index: index, bound: bound}
check.nextId++
if obj.typ == nil {
obj.typ = typ
@@ -736,7 +735,7 @@ func (check *Checker) NewTypeParam(obj *TypeName, index int, bound Type) *TypePa
return typ
}
-func (t *TypeParam) Bound() *Interface {
+func (t *_TypeParam) Bound() *Interface {
iface := asInterface(t.bound)
// use the type bound position if we have one
pos := token.NoPos
@@ -840,40 +839,40 @@ type top struct{}
var theTop = &top{}
// Type-specific implementations of Underlying.
-func (t *Basic) Underlying() Type { return t }
-func (t *Array) Underlying() Type { return t }
-func (t *Slice) Underlying() Type { return t }
-func (t *Struct) Underlying() Type { return t }
-func (t *Pointer) Underlying() Type { return t }
-func (t *Tuple) Underlying() Type { return t }
-func (t *Signature) Underlying() Type { return t }
-func (t *Sum) Underlying() Type { return t }
-func (t *Interface) Underlying() Type { return t }
-func (t *Map) Underlying() Type { return t }
-func (t *Chan) Underlying() Type { return t }
-func (t *Named) Underlying() Type { return t.underlying }
-func (t *TypeParam) Underlying() Type { return t }
-func (t *instance) Underlying() Type { return t }
-func (t *bottom) Underlying() Type { return t }
-func (t *top) Underlying() Type { return t }
+func (t *Basic) Underlying() Type { return t }
+func (t *Array) Underlying() Type { return t }
+func (t *Slice) Underlying() Type { return t }
+func (t *Struct) Underlying() Type { return t }
+func (t *Pointer) Underlying() Type { return t }
+func (t *Tuple) Underlying() Type { return t }
+func (t *Signature) Underlying() Type { return t }
+func (t *_Sum) Underlying() Type { return t }
+func (t *Interface) Underlying() Type { return t }
+func (t *Map) Underlying() Type { return t }
+func (t *Chan) Underlying() Type { return t }
+func (t *Named) Underlying() Type { return t.underlying }
+func (t *_TypeParam) Underlying() Type { return t }
+func (t *instance) Underlying() Type { return t }
+func (t *bottom) Underlying() Type { return t }
+func (t *top) Underlying() Type { return t }
// Type-specific implementations of String.
-func (t *Basic) String() string { return TypeString(t, nil) }
-func (t *Array) String() string { return TypeString(t, nil) }
-func (t *Slice) String() string { return TypeString(t, nil) }
-func (t *Struct) String() string { return TypeString(t, nil) }
-func (t *Pointer) String() string { return TypeString(t, nil) }
-func (t *Tuple) String() string { return TypeString(t, nil) }
-func (t *Signature) String() string { return TypeString(t, nil) }
-func (t *Sum) String() string { return TypeString(t, nil) }
-func (t *Interface) String() string { return TypeString(t, nil) }
-func (t *Map) String() string { return TypeString(t, nil) }
-func (t *Chan) String() string { return TypeString(t, nil) }
-func (t *Named) String() string { return TypeString(t, nil) }
-func (t *TypeParam) String() string { return TypeString(t, nil) }
-func (t *instance) String() string { return TypeString(t, nil) }
-func (t *bottom) String() string { return TypeString(t, nil) }
-func (t *top) String() string { return TypeString(t, nil) }
+func (t *Basic) String() string { return TypeString(t, nil) }
+func (t *Array) String() string { return TypeString(t, nil) }
+func (t *Slice) String() string { return TypeString(t, nil) }
+func (t *Struct) String() string { return TypeString(t, nil) }
+func (t *Pointer) String() string { return TypeString(t, nil) }
+func (t *Tuple) String() string { return TypeString(t, nil) }
+func (t *Signature) String() string { return TypeString(t, nil) }
+func (t *_Sum) String() string { return TypeString(t, nil) }
+func (t *Interface) String() string { return TypeString(t, nil) }
+func (t *Map) String() string { return TypeString(t, nil) }
+func (t *Chan) String() string { return TypeString(t, nil) }
+func (t *Named) String() string { return TypeString(t, nil) }
+func (t *_TypeParam) String() string { return TypeString(t, nil) }
+func (t *instance) String() string { return TypeString(t, nil) }
+func (t *bottom) String() string { return TypeString(t, nil) }
+func (t *top) String() string { return TypeString(t, nil) }
// under returns the true expanded underlying type.
// If it doesn't exist, the result is Typ[Invalid].
@@ -910,22 +909,11 @@ func asSlice(t Type) *Slice {
return op
}
-// TODO (rFindley) delete this on the dev.typeparams branch. This is only
-// exported in the prototype for legacy compatibility.
-func AsStruct(t Type) *Struct {
- return asStruct(t)
-}
-
func asStruct(t Type) *Struct {
op, _ := optype(t).(*Struct)
return op
}
-// TODO(rFindley) delete this on the dev.typeparams branch (see ToStruct).
-func AsPointer(t Type) *Pointer {
- return asPointer(t)
-}
-
func asPointer(t Type) *Pointer {
op, _ := optype(t).(*Pointer)
return op
@@ -941,8 +929,8 @@ func asSignature(t Type) *Signature {
return op
}
-func asSum(t Type) *Sum {
- op, _ := optype(t).(*Sum)
+func asSum(t Type) *_Sum {
+ op, _ := optype(t).(*_Sum)
return op
}
@@ -970,7 +958,7 @@ func asNamed(t Type) *Named {
return e
}
-func asTypeParam(t Type) *TypeParam {
- u, _ := under(t).(*TypeParam)
+func asTypeParam(t Type) *_TypeParam {
+ u, _ := under(t).(*_TypeParam)
return u
}
diff --git a/src/go/types/type_go2go.go b/src/go/types/type_go2go.go
new file mode 100644
index 0000000000..082ac3bd8b
--- /dev/null
+++ b/src/go/types/type_go2go.go
@@ -0,0 +1,27 @@
+// Copyright 2021 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.
+
+package types
+
+// This file exposes additional API methods related to type parameters, for use
+// in the go2go rewriter.
+
+type TypeParam = _TypeParam
+
+func (t *Named) TArgs() []Type { return t._TArgs() }
+func (t *Named) SetTArgs(args []Type) { t._SetTArgs(args) }
+func (t *Named) TParams() []*TypeName { return t._TParams() }
+
+func (t *Interface) HasTypeList() bool { return t._HasTypeList() }
+
+func (s *Signature) TParams() []*TypeName { return s._TParams() }
+func (s *Signature) SetTParams(tparams []*TypeName) { s._SetTParams(tparams) }
+
+func AsPointer(t Type) *Pointer {
+ return asPointer(t)
+}
+
+func AsStruct(t Type) *Struct {
+ return asStruct(t)
+}
diff --git a/src/go/types/typestring.go b/src/go/types/typestring.go
index 64bbb33505..fe27f0f276 100644
--- a/src/go/types/typestring.go
+++ b/src/go/types/typestring.go
@@ -9,6 +9,7 @@ package types
import (
"bytes"
"fmt"
+ "go/token"
"unicode/utf8"
)
@@ -98,9 +99,15 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
buf.WriteString("<nil>")
case *Basic:
- if t.kind == UnsafePointer {
- buf.WriteString("unsafe.")
+ // exported basic types go into package unsafe
+ // (currently this is just unsafe.Pointer)
+ if token.IsExported(t.name) {
+ if obj, _ := Unsafe.scope.Lookup(t.name).(*TypeName); obj != nil {
+ writeTypeName(buf, obj, qf)
+ break
+ }
}
+
if gcCompatibilityMode {
// forget the alias names
switch t.kind {
@@ -126,19 +133,14 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
if i > 0 {
buf.WriteString("; ")
}
- buf.WriteString(f.name)
- if f.embedded {
- // emphasize that the embedded field's name
- // doesn't match the field's type name
- if f.name != embeddedFieldName(f.typ) {
- buf.WriteString(" /* = ")
- writeType(buf, f.typ, qf, visited)
- buf.WriteString(" */")
- }
- } else {
+ // This doesn't do the right thing for embedded type
+ // aliases where we should print the alias name, not
+ // the aliased type (see issue #44410).
+ if !f.embedded {
+ buf.WriteString(f.name)
buf.WriteByte(' ')
- writeType(buf, f.typ, qf, visited)
}
+ writeType(buf, f.typ, qf, visited)
if tag := t.Tag(i); tag != "" {
fmt.Fprintf(buf, " %q", tag)
}
@@ -156,7 +158,7 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
buf.WriteString("func")
writeSignature(buf, t, qf, visited)
- case *Sum:
+ case *_Sum:
for i, t := range t.types {
if i > 0 {
buf.WriteString(", ")
@@ -277,7 +279,7 @@ func writeType(buf *bytes.Buffer, typ Type, qf Qualifier, visited []Type) {
writeTParamList(buf, t.tparams, qf, visited)
}
- case *TypeParam:
+ case *_TypeParam:
s := "?"
if t.obj != nil {
s = t.obj.name
@@ -319,7 +321,7 @@ func writeTParamList(buf *bytes.Buffer, list []*TypeName, qf Qualifier, visited
for i, p := range list {
// TODO(rFindley) support 'any' sugar here.
var b Type = &emptyInterface
- if t, _ := p.typ.(*TypeParam); t != nil && t.bound != nil {
+ if t, _ := p.typ.(*_TypeParam); t != nil && t.bound != nil {
b = t.bound
}
if i > 0 {
@@ -332,7 +334,7 @@ func writeTParamList(buf *bytes.Buffer, list []*TypeName, qf Qualifier, visited
}
prev = b
- if t, _ := p.typ.(*TypeParam); t != nil {
+ if t, _ := p.typ.(*_TypeParam); t != nil {
writeType(buf, t, qf, visited)
} else {
buf.WriteString(p.name)
@@ -424,25 +426,6 @@ func writeSignature(buf *bytes.Buffer, sig *Signature, qf Qualifier, visited []T
writeTuple(buf, sig.results, false, qf, visited)
}
-// embeddedFieldName returns an embedded field's name given its type.
-// The result is "" if the type doesn't have an embedded field name.
-func embeddedFieldName(typ Type) string {
- switch t := typ.(type) {
- case *Basic:
- return t.name
- case *Named:
- return t.obj.name
- case *Pointer:
- // *T is ok, but **T is not
- if _, ok := t.base.(*Pointer); !ok {
- return embeddedFieldName(t.base)
- }
- case *instance:
- return t.base.obj.name
- }
- return "" // not a (pointer to) a defined type
-}
-
// subscript returns the decimal (utf8) representation of x using subscript digits.
func subscript(x uint64) string {
const w = len("₀") // all digits 0...9 have the same utf8 width
diff --git a/src/go/types/typexpr.go b/src/go/types/typexpr.go
index a6b7314dd5..63e37de4b7 100644
--- a/src/go/types/typexpr.go
+++ b/src/go/types/typexpr.go
@@ -53,12 +53,12 @@ func (check *Checker) ident(x *operand, e *ast.Ident, def *Named, wantType bool)
}
assert(typ != nil)
- // The object may be dot-imported: If so, remove its package from
- // the map of unused dot imports for the respective file scope.
+ // The object may have been dot-imported.
+ // If so, mark the respective package as used.
// (This code is only needed for dot-imports. Without them,
// we only have to mark variables, see *Var case below).
- if pkg := obj.Pkg(); pkg != check.pkg && pkg != nil {
- delete(check.unusedDotImports[scope], pkg)
+ if pkgName := check.dotImportMap[dotImportKey{scope, obj}]; pkgName != nil {
+ pkgName.used = true
}
switch obj := obj.(type) {
@@ -146,7 +146,7 @@ func (check *Checker) ordinaryType(pos positioner, typ Type) {
check.softErrorf(pos, _Todo, "interface contains type constraints (%s)", t.allTypes)
return
}
- if t.IsComparable() {
+ if t._IsComparable() {
check.softErrorf(pos, _Todo, "interface is (or embeds) comparable")
}
}
@@ -208,21 +208,28 @@ func isubst(x ast.Expr, smap map[*ast.Ident]*ast.Ident) ast.Expr {
new.X = X
return &new
}
- case *ast.CallExpr:
- var args []ast.Expr
- for i, arg := range n.Args {
- new := isubst(arg, smap)
- if new != arg {
- if args == nil {
- args = make([]ast.Expr, len(n.Args))
- copy(args, n.Args)
+ case *ast.IndexExpr:
+ index := isubst(n.Index, smap)
+ if index != n.Index {
+ new := *n
+ new.Index = index
+ return &new
+ }
+ case *ast.ListExpr:
+ var elems []ast.Expr
+ for i, elem := range n.ElemList {
+ new := isubst(elem, smap)
+ if new != elem {
+ if elems == nil {
+ elems = make([]ast.Expr, len(n.ElemList))
+ copy(elems, n.ElemList)
}
- args[i] = new
+ elems[i] = new
}
}
- if args != nil {
+ if elems != nil {
new := *n
- new.Args = args
+ new.ElemList = elems
return &new
}
case *ast.ParenExpr:
@@ -294,7 +301,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast
}
smap := makeSubstMap(recvTParams, list)
for i, tname := range sig.rparams {
- bound := recvTParams[i].typ.(*TypeParam).bound
+ bound := recvTParams[i].typ.(*_TypeParam).bound
// bound is (possibly) parameterized in the context of the
// receiver type declaration. Substitute parameters for the
// current context.
@@ -302,7 +309,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast
// (no bound == empty interface)
if bound != nil {
bound = check.subst(tname.pos, bound, smap)
- tname.typ.(*TypeParam).bound = bound
+ tname.typ.(*_TypeParam).bound = bound
}
}
}
@@ -326,7 +333,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast
recvList, _ := check.collectParams(scope, recvPar, recvTyp, false) // use rewritten receiver type, if any
params, variadic := check.collectParams(scope, ftyp.Params, nil, true)
results, _ := check.collectParams(scope, ftyp.Results, nil, false)
- scope.Squash(func(obj, alt Object) {
+ scope.squash(func(obj, alt Object) {
check.errorf(obj, _DuplicateDecl, "%s redeclared in this block", obj.Name())
check.reportAltDecl(alt)
})
@@ -391,7 +398,7 @@ func (check *Checker) funcType(sig *Signature, recvPar *ast.FieldList, ftyp *ast
}
// goTypeName returns the Go type name for typ and
-// removes any occurences of "types." from that name.
+// removes any occurrences of "types." from that name.
func goTypeName(typ Type) string {
return strings.ReplaceAll(fmt.Sprintf("%T", typ), "types.", "")
}
@@ -460,14 +467,7 @@ func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
}
case *ast.IndexExpr:
- return check.instantiatedType(e.X, []ast.Expr{e.Index}, def)
-
- case *ast.CallExpr:
- if e.Brackets {
- return check.instantiatedType(e.Fun, e.Args, def)
- } else {
- check.errorf(e0, _NotAType, "%s is not a type", e0)
- }
+ return check.instantiatedType(e.X, unpackExpr(e.Index), def)
case *ast.ParenExpr:
// Generic types must be instantiated before they can be used in any form.
@@ -488,6 +488,12 @@ func (check *Checker) typInternal(e0 ast.Expr, def *Named) (T Type) {
typ.elem = check.varType(e.Elt)
return typ
+ case *ast.Ellipsis:
+ // dots are handled explicitly where they are legal
+ // (array composite literals and parameter lists)
+ check.error(e, _InvalidDotDotDot, "invalid use of '...'")
+ check.use(e.Elt)
+
case *ast.StructType:
typ := new(Struct)
def.setUnderlying(typ)
@@ -668,7 +674,7 @@ func (check *Checker) arrayLength(e ast.Expr) int64 {
}
// typeList provides the list of types corresponding to the incoming expression list.
-// If an error occured, the result is nil, but all list elements were type-checked.
+// If an error occurred, the result is nil, but all list elements were type-checked.
func (check *Checker) typeList(list []ast.Expr) []Type {
res := make([]Type, len(list)) // res != nil even if len(list) == 0
for i, x := range list {
@@ -817,7 +823,7 @@ func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, d
}
// type constraints
- ityp.types = NewSum(check.collectTypeConstraints(iface.Pos(), types))
+ ityp.types = _NewSum(check.collectTypeConstraints(iface.Pos(), types))
if len(ityp.methods) == 0 && ityp.types == nil && len(ityp.embeddeds) == 0 {
// empty interface
@@ -826,8 +832,8 @@ func (check *Checker) interfaceType(ityp *Interface, iface *ast.InterfaceType, d
}
// sort for API stability
- sort.Sort(byUniqueMethodName(ityp.methods))
- sort.Stable(byUniqueTypeName(ityp.embeddeds))
+ sortMethods(ityp.methods)
+ sortTypes(ityp.embeddeds)
check.later(func() { check.completeInterface(iface.Pos(), ityp) })
}
@@ -893,9 +899,13 @@ func (check *Checker) completeInterface(pos token.Pos, ityp *Interface) {
check.errorf(atPos(pos), _DuplicateDecl, "duplicate method %s", m.name)
check.errorf(atPos(mpos[other.(*Func)]), _DuplicateDecl, "\tother declaration of %s", m.name) // secondary error, \t indented
default:
- // check method signatures after all types are computed (issue #33656)
+ // We have a duplicate method name in an embedded (not explicitly declared) method.
+ // Check method signatures after all types are computed (issue #33656).
+ // If we're pre-go1.14 (overlapping embeddings are not permitted), report that
+ // error here as well (even though we could do it eagerly) because it's the same
+ // error message.
check.atEnd(func() {
- if !check.identical(m.typ, other.Type()) {
+ if !check.allowVersion(m.pkg, 1, 14) || !check.identical(m.typ, other.Type()) {
check.errorf(atPos(pos), _DuplicateDecl, "duplicate method %s", m.name)
check.errorf(atPos(mpos[other.(*Func)]), _DuplicateDecl, "\tother declaration of %s", m.name) // secondary error, \t indented
}
@@ -918,7 +928,7 @@ func (check *Checker) completeInterface(pos token.Pos, ityp *Interface) {
if etyp == nil {
if utyp != Typ[Invalid] {
var format string
- if _, ok := utyp.(*TypeParam); ok {
+ if _, ok := utyp.(*_TypeParam); ok {
format = "%s is a type parameter, not an interface"
} else {
format = "%s is not an interface"
@@ -977,7 +987,11 @@ func intersect(x, y Type) (r Type) {
if rtypes == nil {
return theBottom
}
- return NewSum(rtypes)
+ return _NewSum(rtypes)
+}
+
+func sortTypes(list []Type) {
+ sort.Stable(byUniqueTypeName(list))
}
// byUniqueTypeName named type lists can be sorted by their unique type names.
@@ -994,6 +1008,19 @@ func sortName(t Type) string {
return ""
}
+func sortMethods(list []*Func) {
+ sort.Sort(byUniqueMethodName(list))
+}
+
+func assertSortedMethods(list []*Func) {
+ if !debug {
+ panic("internal error: assertSortedMethods called outside debug mode")
+ }
+ if !sort.IsSorted(byUniqueMethodName(list)) {
+ panic("internal error: methods not sorted")
+ }
+}
+
// byUniqueMethodName method lists can be sorted by their unique method names.
type byUniqueMethodName []*Func
@@ -1131,10 +1158,6 @@ func embeddedFieldIdent(e ast.Expr) *ast.Ident {
return e.Sel
case *ast.IndexExpr:
return embeddedFieldIdent(e.X)
- case *ast.CallExpr:
- if e.Brackets {
- return embeddedFieldIdent(e.Fun)
- }
}
return nil // invalid embedded field
}
diff --git a/src/go/types/unify.go b/src/go/types/unify.go
index ab18febbdf..fbcd64c442 100644
--- a/src/go/types/unify.go
+++ b/src/go/types/unify.go
@@ -83,7 +83,7 @@ func (d *tparamsList) init(tparams []*TypeName) {
}
if debug {
for i, tpar := range tparams {
- assert(i == tpar.typ.(*TypeParam).index)
+ assert(i == tpar.typ.(*_TypeParam).index)
}
}
d.tparams = tparams
@@ -131,7 +131,7 @@ func (u *unifier) join(i, j int) bool {
// If typ is a type parameter of d, index returns the type parameter index.
// Otherwise, the result is < 0.
func (d *tparamsList) index(typ Type) int {
- if t, ok := typ.(*TypeParam); ok {
+ if t, ok := typ.(*_TypeParam); ok {
if i := t.index; i < len(d.tparams) && d.tparams[i].typ == t {
return i
}
@@ -335,7 +335,7 @@ func (u *unifier) nify(x, y Type, p *ifacePair) bool {
u.nify(x.results, y.results, p)
}
- case *Sum:
+ case *_Sum:
// This should not happen with the current internal use of sum types.
panic("type inference across sum types not implemented")
@@ -431,7 +431,7 @@ func (u *unifier) nify(x, y Type, p *ifacePair) bool {
}
}
- case *TypeParam:
+ case *_TypeParam:
// Two type parameters (which are not part of the type parameters of the
// enclosing type as those are handled in the beginning of this function)
// are identical if they originate in the same declaration.
diff --git a/src/go/types/universe.go b/src/go/types/universe.go
index f2f444fd9d..4ced018f8e 100644
--- a/src/go/types/universe.go
+++ b/src/go/types/universe.go
@@ -24,7 +24,7 @@ var (
universeIota *Const
universeByte *Basic // uint8 alias, but has name "byte"
universeRune *Basic // int32 alias, but has name "rune"
- universeAny *Named
+ universeAny *Interface
universeError *Named
)
@@ -82,10 +82,7 @@ func defPredeclaredTypes() {
// (Predeclared and entered into universe scope so we do all the
// usual checks; but removed again from scope later since it's
// only visible as constraint in a type parameter list.)
- {
- typ := &Named{underlying: &emptyInterface}
- def(NewTypeName(token.NoPos, nil, "any", typ))
- }
+ def(NewTypeName(token.NoPos, nil, "any", &emptyInterface))
// Error has a nil package in its qualified name since it is in no package
{
@@ -241,7 +238,7 @@ func init() {
universeIota = Universe.Lookup("iota").(*Const)
universeByte = Universe.Lookup("byte").(*TypeName).typ.(*Basic)
universeRune = Universe.Lookup("rune").(*TypeName).typ.(*Basic)
- universeAny = Universe.Lookup("any").(*TypeName).typ.(*Named)
+ universeAny = Universe.Lookup("any").(*TypeName).typ.(*Interface)
universeError = Universe.Lookup("error").(*TypeName).typ.(*Named)
// "any" is only visible as constraint in a type parameter list
diff --git a/src/go/types/version.go b/src/go/types/version.go
new file mode 100644
index 0000000000..154694169b
--- /dev/null
+++ b/src/go/types/version.go
@@ -0,0 +1,82 @@
+// Copyright 2021 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.
+
+package types
+
+import (
+ "fmt"
+ "go/ast"
+ "go/token"
+ "regexp"
+ "strconv"
+ "strings"
+)
+
+// langCompat reports an error if the representation of a numeric
+// literal is not compatible with the current language version.
+func (check *Checker) langCompat(lit *ast.BasicLit) {
+ s := lit.Value
+ if len(s) <= 2 || check.allowVersion(check.pkg, 1, 13) {
+ return
+ }
+ // len(s) > 2
+ if strings.Contains(s, "_") {
+ check.errorf(lit, _InvalidLit, "underscores in numeric literals requires go1.13 or later")
+ return
+ }
+ if s[0] != '0' {
+ return
+ }
+ radix := s[1]
+ if radix == 'b' || radix == 'B' {
+ check.errorf(lit, _InvalidLit, "binary literals requires go1.13 or later")
+ return
+ }
+ if radix == 'o' || radix == 'O' {
+ check.errorf(lit, _InvalidLit, "0o/0O-style octal literals requires go1.13 or later")
+ return
+ }
+ if lit.Kind != token.INT && (radix == 'x' || radix == 'X') {
+ check.errorf(lit, _InvalidLit, "hexadecimal floating-point literals requires go1.13 or later")
+ }
+}
+
+// allowVersion reports whether the given package
+// is allowed to use version major.minor.
+func (check *Checker) allowVersion(pkg *Package, major, minor int) bool {
+ // We assume that imported packages have all been checked,
+ // so we only have to check for the local package.
+ if pkg != check.pkg {
+ return true
+ }
+ ma, mi := check.version.major, check.version.minor
+ return ma == 0 && mi == 0 || ma > major || ma == major && mi >= minor
+}
+
+type version struct {
+ major, minor int
+}
+
+// parseGoVersion parses a Go version string (such as "go1.12")
+// and returns the version, or an error. If s is the empty
+// string, the version is 0.0.
+func parseGoVersion(s string) (v version, err error) {
+ if s == "" {
+ return
+ }
+ matches := goVersionRx.FindStringSubmatch(s)
+ if matches == nil {
+ err = fmt.Errorf(`should be something like "go1.12"`)
+ return
+ }
+ v.major, err = strconv.Atoi(matches[1])
+ if err != nil {
+ return
+ }
+ v.minor, err = strconv.Atoi(matches[2])
+ return
+}
+
+// goVersionRx matches a Go version string, e.g. "go1.12".
+var goVersionRx = regexp.MustCompile(`^go([1-9][0-9]*)\.(0|[1-9][0-9]*)$`)
diff --git a/src/hash/crc32/crc32_otherarch.go b/src/hash/crc32/crc32_otherarch.go
index 1a5e542ab6..936e5bf3e0 100644
--- a/src/hash/crc32/crc32_otherarch.go
+++ b/src/hash/crc32/crc32_otherarch.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !s390x && !ppc64le && !arm64
// +build !amd64,!s390x,!ppc64le,!arm64
package crc32
diff --git a/src/hash/crc32/gen_const_ppc64le.go b/src/hash/crc32/gen_const_ppc64le.go
index d7af018af4..c98454c685 100644
--- a/src/hash/crc32/gen_const_ppc64le.go
+++ b/src/hash/crc32/gen_const_ppc64le.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generate the constant table associated with the poly used by the
diff --git a/src/hash/maphash/maphash.go b/src/hash/maphash/maphash.go
index ecc147d599..f7ef1b41e8 100644
--- a/src/hash/maphash/maphash.go
+++ b/src/hash/maphash/maphash.go
@@ -34,7 +34,7 @@ type Seed struct {
//
// The zero Hash is a valid Hash ready to use.
// A zero Hash chooses a random seed for itself during
-// the first call to a Reset, Write, Seed, Sum64, or Seed method.
+// the first call to a Reset, Write, Seed, or Sum64 method.
// For control over the seed, use SetSeed.
//
// The computed hash values depend only on the initial seed and
diff --git a/src/html/fuzz.go b/src/html/fuzz.go
index ffa3e257f4..ecaf4f9069 100644
--- a/src/html/fuzz.go
+++ b/src/html/fuzz.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gofuzz
// +build gofuzz
package html
diff --git a/src/image/color/palette/gen.go b/src/image/color/palette/gen.go
index 3243e53981..7bb257d865 100644
--- a/src/image/color/palette/gen.go
+++ b/src/image/color/palette/gen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/image/internal/imageutil/gen.go b/src/image/internal/imageutil/gen.go
index 36de5dc9cc..38f41303fa 100644
--- a/src/image/internal/imageutil/gen.go
+++ b/src/image/internal/imageutil/gen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/image/jpeg/reader.go b/src/image/jpeg/reader.go
index 4a4706ffe7..b34072396c 100644
--- a/src/image/jpeg/reader.go
+++ b/src/image/jpeg/reader.go
@@ -14,9 +14,6 @@ import (
"io"
)
-// TODO(nigeltao): fix up the doc comment style so that sentences start with
-// the name of the type or function that they annotate.
-
// A FormatError reports that the input is not a valid JPEG.
type FormatError string
diff --git a/src/image/png/fuzz.go b/src/image/png/fuzz.go
index d9cb3921e5..6508533f44 100644
--- a/src/image/png/fuzz.go
+++ b/src/image/png/fuzz.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gofuzz
// +build gofuzz
package png
diff --git a/src/image/png/writer.go b/src/image/png/writer.go
index 53adc1633c..cbcdb9e798 100644
--- a/src/image/png/writer.go
+++ b/src/image/png/writer.go
@@ -51,6 +51,7 @@ type encoder struct {
bw *bufio.Writer
}
+// CompressionLevel indicates the compression level.
type CompressionLevel int
const (
diff --git a/src/index/suffixarray/gen.go b/src/index/suffixarray/gen.go
index 94184d71b6..3bc9b1e2ae 100644
--- a/src/index/suffixarray/gen.go
+++ b/src/index/suffixarray/gen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Gen generates sais2.go by duplicating functions in sais.go
diff --git a/src/internal/abi/abi.go b/src/internal/abi/abi.go
new file mode 100644
index 0000000000..6700facc04
--- /dev/null
+++ b/src/internal/abi/abi.go
@@ -0,0 +1,53 @@
+// Copyright 2020 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.
+
+package abi
+
+import "unsafe"
+
+// RegArgs is a struct that has space for each argument
+// and return value register on the current architecture.
+//
+// Assembly code knows the layout of the first two fields
+// of RegArgs.
+//
+// RegArgs also contains additional space to hold pointers
+// when it may not be safe to keep them only in the integer
+// register space otherwise.
+type RegArgs struct {
+ Ints [IntArgRegs]uintptr // untyped integer registers
+ Floats [FloatArgRegs]uint64 // untyped float registers
+
+ // Fields above this point are known to assembly.
+
+ // Ptrs is a space that duplicates Ints but with pointer type,
+ // used to make pointers passed or returned in registers
+ // visible to the GC by making the type unsafe.Pointer.
+ Ptrs [IntArgRegs]unsafe.Pointer
+
+ // ReturnIsPtr is a bitmap that indicates which registers
+ // contain or will contain pointers on the return path from
+ // a reflectcall. The i'th bit indicates whether the i'th
+ // register contains or will contain a valid Go pointer.
+ ReturnIsPtr IntArgRegBitmap
+}
+
+// IntArgRegBitmap is a bitmap large enough to hold one bit per
+// integer argument/return register.
+type IntArgRegBitmap [(IntArgRegs + 7) / 8]uint8
+
+// Set sets the i'th bit of the bitmap to 1.
+func (b *IntArgRegBitmap) Set(i int) {
+ b[i/8] |= uint8(1) << (i % 8)
+}
+
+// Get returns whether the i'th bit of the bitmap is set.
+//
+// nosplit because it's called in extremely sensitive contexts, like
+// on the reflectcall return path.
+//
+//go:nosplit
+func (b *IntArgRegBitmap) Get(i int) bool {
+ return b[i/8]&(uint8(1)<<(i%8)) != 0
+}
diff --git a/src/internal/abi/abi_amd64.go b/src/internal/abi/abi_amd64.go
new file mode 100644
index 0000000000..77589d4c34
--- /dev/null
+++ b/src/internal/abi/abi_amd64.go
@@ -0,0 +1,25 @@
+// Copyright 2020 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.
+
+//go:build goexperiment.regabi
+// +build goexperiment.regabi
+
+package abi
+
+const (
+ // See abi_generic.go.
+
+ // Currently these values are zero because whatever uses
+ // them will expect the register ABI, which isn't ready
+ // yet.
+
+ // RAX, RBX, RCX, RDI, RSI, R8, R9, R10, R11.
+ IntArgRegs = 0 // 9
+
+ // X0 -> X14.
+ FloatArgRegs = 0 // 15
+
+ // We use SSE2 registers which support 64-bit float operations.
+ EffectiveFloatRegSize = 0 // 8
+)
diff --git a/src/internal/abi/abi_generic.go b/src/internal/abi/abi_generic.go
new file mode 100644
index 0000000000..1e36f36e80
--- /dev/null
+++ b/src/internal/abi/abi_generic.go
@@ -0,0 +1,39 @@
+// Copyright 2020 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.
+
+//go:build !goexperiment.regabi
+// +build !goexperiment.regabi
+
+package abi
+
+const (
+ // ABI-related constants.
+ //
+ // In the generic case, these are all zero
+ // which lets them gracefully degrade to ABI0.
+
+ // IntArgRegs is the number of registers dedicated
+ // to passing integer argument values. Result registers are identical
+ // to argument registers, so this number is used for those too.
+ IntArgRegs = 0
+
+ // FloatArgRegs is the number of registers dedicated
+ // to passing floating-point argument values. Result registers are
+ // identical to argument registers, so this number is used for
+ // those too.
+ FloatArgRegs = 0
+
+ // EffectiveFloatRegSize describes the width of floating point
+ // registers on the current platform from the ABI's perspective.
+ //
+ // Since Go only supports 32-bit and 64-bit floating point primitives,
+ // this number should be either 0, 4, or 8. 0 indicates no floating
+ // point registers for the ABI or that floating point values will be
+ // passed via the softfloat ABI.
+ //
+ // For platforms that support larger floating point register widths,
+ // such as x87's 80-bit "registers" (not that we support x87 currently),
+ // use 8.
+ EffectiveFloatRegSize = 0
+)
diff --git a/src/internal/bytealg/compare_generic.go b/src/internal/bytealg/compare_generic.go
index bd4489a6b9..0690d0cf31 100644
--- a/src/internal/bytealg/compare_generic.go
+++ b/src/internal/bytealg/compare_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !386 && !amd64 && !s390x && !arm && !arm64 && !ppc64 && !ppc64le && !mips && !mipsle && !wasm && !mips64 && !mips64le
// +build !386,!amd64,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!wasm,!mips64,!mips64le
package bytealg
diff --git a/src/internal/bytealg/compare_native.go b/src/internal/bytealg/compare_native.go
index b53ba97463..baa188ff7a 100644
--- a/src/internal/bytealg/compare_native.go
+++ b/src/internal/bytealg/compare_native.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || amd64 || s390x || arm || arm64 || ppc64 || ppc64le || mips || mipsle || wasm || mips64 || mips64le
// +build 386 amd64 s390x arm arm64 ppc64 ppc64le mips mipsle wasm mips64 mips64le
package bytealg
diff --git a/src/internal/bytealg/count_generic.go b/src/internal/bytealg/count_generic.go
index 5575e81ab8..1891d29b24 100644
--- a/src/internal/bytealg/count_generic.go
+++ b/src/internal/bytealg/count_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !arm && !arm64 && !ppc64le && !ppc64 && !riscv64 && !s390x
// +build !amd64,!arm,!arm64,!ppc64le,!ppc64,!riscv64,!s390x
package bytealg
diff --git a/src/internal/bytealg/count_native.go b/src/internal/bytealg/count_native.go
index b1ff1d265a..a19a6f8223 100644
--- a/src/internal/bytealg/count_native.go
+++ b/src/internal/bytealg/count_native.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm || arm64 || ppc64le || ppc64 || riscv64 || s390x
// +build amd64 arm arm64 ppc64le ppc64 riscv64 s390x
package bytealg
diff --git a/src/internal/bytealg/index_generic.go b/src/internal/bytealg/index_generic.go
index 98e859f925..2b8b139aeb 100644
--- a/src/internal/bytealg/index_generic.go
+++ b/src/internal/bytealg/index_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !amd64 && !arm64 && !s390x
// +build !amd64,!arm64,!s390x
package bytealg
diff --git a/src/internal/bytealg/index_native.go b/src/internal/bytealg/index_native.go
index fde4214245..af56d8a294 100644
--- a/src/internal/bytealg/index_native.go
+++ b/src/internal/bytealg/index_native.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm64 || s390x
// +build amd64 arm64 s390x
package bytealg
diff --git a/src/internal/bytealg/indexbyte_generic.go b/src/internal/bytealg/indexbyte_generic.go
index 0b012a8850..6ef639fafd 100644
--- a/src/internal/bytealg/indexbyte_generic.go
+++ b/src/internal/bytealg/indexbyte_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !386 && !amd64 && !s390x && !arm && !arm64 && !ppc64 && !ppc64le && !mips && !mipsle && !mips64 && !mips64le && !riscv64 && !wasm
// +build !386,!amd64,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!mips64,!mips64le,!riscv64,!wasm
package bytealg
diff --git a/src/internal/bytealg/indexbyte_native.go b/src/internal/bytealg/indexbyte_native.go
index f96c5be491..965f38fe52 100644
--- a/src/internal/bytealg/indexbyte_native.go
+++ b/src/internal/bytealg/indexbyte_native.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || amd64 || s390x || arm || arm64 || ppc64 || ppc64le || mips || mipsle || mips64 || mips64le || riscv64 || wasm
// +build 386 amd64 s390x arm arm64 ppc64 ppc64le mips mipsle mips64 mips64le riscv64 wasm
package bytealg
diff --git a/src/internal/cpu/cpu_arm64_android.go b/src/internal/cpu/cpu_arm64_android.go
index 3c9e57c52a..ac6eee54b2 100644
--- a/src/internal/cpu/cpu_arm64_android.go
+++ b/src/internal/cpu/cpu_arm64_android.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm64
// +build arm64
package cpu
diff --git a/src/internal/cpu/cpu_arm64_darwin.go b/src/internal/cpu/cpu_arm64_darwin.go
index e094b97f97..ce1b250a18 100644
--- a/src/internal/cpu/cpu_arm64_darwin.go
+++ b/src/internal/cpu/cpu_arm64_darwin.go
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build arm64
-// +build darwin
-// +build !ios
+//go:build arm64 && darwin && !ios
+// +build arm64,darwin,!ios
package cpu
diff --git a/src/internal/cpu/cpu_arm64_freebsd.go b/src/internal/cpu/cpu_arm64_freebsd.go
index 9de2005c2e..8c481370da 100644
--- a/src/internal/cpu/cpu_arm64_freebsd.go
+++ b/src/internal/cpu/cpu_arm64_freebsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm64
// +build arm64
package cpu
diff --git a/src/internal/cpu/cpu_arm64_hwcap.go b/src/internal/cpu/cpu_arm64_hwcap.go
index fdaf43e1a2..8ac04fd8f9 100644
--- a/src/internal/cpu/cpu_arm64_hwcap.go
+++ b/src/internal/cpu/cpu_arm64_hwcap.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build arm64
-// +build linux
+//go:build arm64 && linux
+// +build arm64,linux
package cpu
diff --git a/src/internal/cpu/cpu_arm64_linux.go b/src/internal/cpu/cpu_arm64_linux.go
index 2f7411ff1e..c3a3f9a8e9 100644
--- a/src/internal/cpu/cpu_arm64_linux.go
+++ b/src/internal/cpu/cpu_arm64_linux.go
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build arm64
-// +build linux
-// +build !android
+//go:build arm64 && linux && !android
+// +build arm64,linux,!android
package cpu
diff --git a/src/internal/cpu/cpu_arm64_other.go b/src/internal/cpu/cpu_arm64_other.go
index f191db28d2..e8b5d529a4 100644
--- a/src/internal/cpu/cpu_arm64_other.go
+++ b/src/internal/cpu/cpu_arm64_other.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm64 && !linux && !freebsd && !android && (!darwin || ios)
// +build arm64
// +build !linux
// +build !freebsd
diff --git a/src/internal/cpu/cpu_mips64x.go b/src/internal/cpu/cpu_mips64x.go
index 0c4794a70a..d2f9d4499b 100644
--- a/src/internal/cpu/cpu_mips64x.go
+++ b/src/internal/cpu/cpu_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips64 || mips64le
// +build mips64 mips64le
package cpu
diff --git a/src/internal/cpu/cpu_no_name.go b/src/internal/cpu/cpu_no_name.go
index ce1c37a3c7..8d563b536c 100644
--- a/src/internal/cpu/cpu_no_name.go
+++ b/src/internal/cpu/cpu_no_name.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !386
-// +build !amd64
+//go:build !386 && !amd64
+// +build !386,!amd64
package cpu
diff --git a/src/internal/cpu/cpu_ppc64x.go b/src/internal/cpu/cpu_ppc64x.go
index beb1765427..2e7fd3ebb9 100644
--- a/src/internal/cpu/cpu_ppc64x.go
+++ b/src/internal/cpu/cpu_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package cpu
diff --git a/src/internal/cpu/cpu_ppc64x_aix.go b/src/internal/cpu/cpu_ppc64x_aix.go
index b840b823ba..3d17a9c730 100644
--- a/src/internal/cpu/cpu_ppc64x_aix.go
+++ b/src/internal/cpu/cpu_ppc64x_aix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package cpu
diff --git a/src/internal/cpu/cpu_ppc64x_linux.go b/src/internal/cpu/cpu_ppc64x_linux.go
index 73b191436d..b7c7345111 100644
--- a/src/internal/cpu/cpu_ppc64x_linux.go
+++ b/src/internal/cpu/cpu_ppc64x_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package cpu
diff --git a/src/internal/cpu/cpu_x86.go b/src/internal/cpu/cpu_x86.go
index ba6bf69034..fd1217a05d 100644
--- a/src/internal/cpu/cpu_x86.go
+++ b/src/internal/cpu/cpu_x86.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || amd64
// +build 386 amd64
package cpu
diff --git a/src/internal/cpu/cpu_x86_test.go b/src/internal/cpu/cpu_x86_test.go
index 61db93bd51..e3e16cc161 100644
--- a/src/internal/cpu/cpu_x86_test.go
+++ b/src/internal/cpu/cpu_x86_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || amd64
// +build 386 amd64
package cpu_test
diff --git a/src/internal/goroot/gc.go b/src/internal/goroot/gc.go
index ce72bc3896..2338b78f3a 100644
--- a/src/internal/goroot/gc.go
+++ b/src/internal/goroot/gc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gc
// +build gc
package goroot
diff --git a/src/internal/goroot/gccgo.go b/src/internal/goroot/gccgo.go
index 3530e59a15..b1041da11d 100644
--- a/src/internal/goroot/gccgo.go
+++ b/src/internal/goroot/gccgo.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gccgo
// +build gccgo
package goroot
diff --git a/src/internal/goversion/goversion.go b/src/internal/goversion/goversion.go
index 513be456bd..4cc15688c0 100644
--- a/src/internal/goversion/goversion.go
+++ b/src/internal/goversion/goversion.go
@@ -9,4 +9,4 @@ package goversion
//
// It should be updated at the start of each development cycle to be
// the version of the next Go 1.x release. See golang.org/issue/40705.
-const Version = 16
+const Version = 17
diff --git a/src/internal/poll/copy_file_range_linux.go b/src/internal/poll/copy_file_range_linux.go
index fc34aef4cb..5b9e5d4020 100644
--- a/src/internal/poll/copy_file_range_linux.go
+++ b/src/internal/poll/copy_file_range_linux.go
@@ -78,7 +78,7 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
// Go supports Linux >= 2.6.33, so the system call
// may not be present.
//
- // If we see ENOSYS, we have certainly not transfered
+ // If we see ENOSYS, we have certainly not transferred
// any data, so we can tell the caller that we
// couldn't handle the transfer and let them fall
// back to more generic code.
@@ -91,13 +91,13 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
// Prior to Linux 5.3, it was not possible to
// copy_file_range across file systems. Similarly to
// the ENOSYS case above, if we see EXDEV, we have
- // not transfered any data, and we can let the caller
+ // not transferred any data, and we can let the caller
// fall back to generic code.
//
// As for EINVAL, that is what we see if, for example,
// dst or src refer to a pipe rather than a regular
// file. This is another case where no data has been
- // transfered, so we consider it unhandled.
+ // transferred, so we consider it unhandled.
//
// If src and dst are on CIFS, we can see EIO.
// See issue #42334.
@@ -112,7 +112,15 @@ func CopyFileRange(dst, src *FD, remain int64) (written int64, handled bool, err
return 0, false, nil
case nil:
if n == 0 {
- // src is at EOF, which means we are done.
+ // If we did not read any bytes at all,
+ // then this file may be in a file system
+ // where copy_file_range silently fails.
+ // https://lore.kernel.org/linux-fsdevel/20210126233840.GG4626@dread.disaster.area/T/#m05753578c7f7882f6e9ffe01f981bc223edef2b0
+ if written == 0 {
+ return 0, false, nil
+ }
+ // Otherwise src is at EOF, which means
+ // we are done.
return written, true, nil
}
remain -= n
diff --git a/src/internal/poll/errno_unix.go b/src/internal/poll/errno_unix.go
index 0b23fc3210..55c548824f 100644
--- a/src/internal/poll/errno_unix.go
+++ b/src/internal/poll/errno_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package poll
diff --git a/src/internal/poll/errno_windows.go b/src/internal/poll/errno_windows.go
index e3bddb4bb2..c55f5f0df5 100644
--- a/src/internal/poll/errno_windows.go
+++ b/src/internal/poll/errno_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package poll
diff --git a/src/internal/poll/error_stub_test.go b/src/internal/poll/error_stub_test.go
index c40ffcd20f..bcc25dd666 100644
--- a/src/internal/poll/error_stub_test.go
+++ b/src/internal/poll/error_stub_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux
// +build !linux
package poll_test
diff --git a/src/internal/poll/export_posix_test.go b/src/internal/poll/export_posix_test.go
index abadf50930..f59c1f6dfa 100644
--- a/src/internal/poll/export_posix_test.go
+++ b/src/internal/poll/export_posix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
// Export guts for testing on posix.
diff --git a/src/internal/poll/fcntl_js.go b/src/internal/poll/fcntl_js.go
index 120fc1195f..7bf0ddc792 100644
--- a/src/internal/poll/fcntl_js.go
+++ b/src/internal/poll/fcntl_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package poll
diff --git a/src/internal/poll/fcntl_libc.go b/src/internal/poll/fcntl_libc.go
index 642472bc2b..cc609e48ad 100644
--- a/src/internal/poll/fcntl_libc.go
+++ b/src/internal/poll/fcntl_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || solaris
// +build aix darwin solaris
package poll
diff --git a/src/internal/poll/fcntl_syscall.go b/src/internal/poll/fcntl_syscall.go
index 5ac814359a..8db5b66504 100644
--- a/src/internal/poll/fcntl_syscall.go
+++ b/src/internal/poll/fcntl_syscall.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package poll
diff --git a/src/internal/poll/fd_fsync_posix.go b/src/internal/poll/fd_fsync_posix.go
index dd7956f14d..651a5ecd8b 100644
--- a/src/internal/poll/fd_fsync_posix.go
+++ b/src/internal/poll/fd_fsync_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris
package poll
diff --git a/src/internal/poll/fd_poll_js.go b/src/internal/poll/fd_poll_js.go
index d6b28e503c..760e24802e 100644
--- a/src/internal/poll/fd_poll_js.go
+++ b/src/internal/poll/fd_poll_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package poll
diff --git a/src/internal/poll/fd_poll_runtime.go b/src/internal/poll/fd_poll_runtime.go
index 222e5c6707..b072af00ea 100644
--- a/src/internal/poll/fd_poll_runtime.go
+++ b/src/internal/poll/fd_poll_runtime.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || windows || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd windows solaris
package poll
@@ -38,10 +39,6 @@ func (pd *pollDesc) init(fd *FD) error {
serverInit.Do(runtime_pollServerInit)
ctx, errno := runtime_pollOpen(uintptr(fd.Sysfd))
if errno != 0 {
- if ctx != 0 {
- runtime_pollUnblock(ctx)
- runtime_pollClose(ctx)
- }
return errnoErr(syscall.Errno(errno))
}
pd.runtimeCtx = ctx
diff --git a/src/internal/poll/fd_posix.go b/src/internal/poll/fd_posix.go
index 4edfa953a4..487f3285ee 100644
--- a/src/internal/poll/fd_posix.go
+++ b/src/internal/poll/fd_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package poll
diff --git a/src/internal/poll/fd_posix_test.go b/src/internal/poll/fd_posix_test.go
index 4449eb3a15..1dcf51d419 100644
--- a/src/internal/poll/fd_posix_test.go
+++ b/src/internal/poll/fd_posix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package poll_test
diff --git a/src/internal/poll/fd_unix.go b/src/internal/poll/fd_unix.go
index 2e77e76c87..fe8a5c8ec0 100644
--- a/src/internal/poll/fd_unix.go
+++ b/src/internal/poll/fd_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package poll
diff --git a/src/internal/poll/fd_writev_darwin.go b/src/internal/poll/fd_writev_darwin.go
index e2024471d4..805fa2ccd9 100644
--- a/src/internal/poll/fd_writev_darwin.go
+++ b/src/internal/poll/fd_writev_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin
// +build darwin
package poll
diff --git a/src/internal/poll/fd_writev_illumos.go b/src/internal/poll/fd_writev_illumos.go
index 1fa47ab1a3..a0b11ed5ae 100644
--- a/src/internal/poll/fd_writev_illumos.go
+++ b/src/internal/poll/fd_writev_illumos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
package poll
diff --git a/src/internal/poll/fd_writev_unix.go b/src/internal/poll/fd_writev_unix.go
index daeec96c38..87f284a56a 100644
--- a/src/internal/poll/fd_writev_unix.go
+++ b/src/internal/poll/fd_writev_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package poll
diff --git a/src/internal/poll/hook_cloexec.go b/src/internal/poll/hook_cloexec.go
index 5fd5449bb0..d519f602c1 100644
--- a/src/internal/poll/hook_cloexec.go
+++ b/src/internal/poll/hook_cloexec.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build dragonfly freebsd illumos linux netbsd openbsd
package poll
diff --git a/src/internal/poll/hook_unix.go b/src/internal/poll/hook_unix.go
index 11f90e9696..c88d65cdc8 100644
--- a/src/internal/poll/hook_unix.go
+++ b/src/internal/poll/hook_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package poll
diff --git a/src/internal/poll/iovec_illumos.go b/src/internal/poll/iovec_illumos.go
index 057067465b..f4058b298f 100644
--- a/src/internal/poll/iovec_illumos.go
+++ b/src/internal/poll/iovec_illumos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
package poll
diff --git a/src/internal/poll/iovec_unix.go b/src/internal/poll/iovec_unix.go
index 6f98947866..6fd5d86630 100644
--- a/src/internal/poll/iovec_unix.go
+++ b/src/internal/poll/iovec_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package poll
diff --git a/src/internal/poll/sendfile_bsd.go b/src/internal/poll/sendfile_bsd.go
index a24e41dcaa..9eda85882c 100644
--- a/src/internal/poll/sendfile_bsd.go
+++ b/src/internal/poll/sendfile_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd
// +build dragonfly freebsd
package poll
@@ -18,6 +19,10 @@ func SendFile(dstFD *FD, src int, pos, remain int64) (int64, error) {
return 0, err
}
defer dstFD.writeUnlock()
+ if err := dstFD.pd.prepareWrite(dstFD.isFile); err != nil {
+ return 0, err
+ }
+
dst := int(dstFD.Sysfd)
var written int64
var err error
diff --git a/src/internal/poll/sendfile_linux.go b/src/internal/poll/sendfile_linux.go
index d64283007d..d6442e8666 100644
--- a/src/internal/poll/sendfile_linux.go
+++ b/src/internal/poll/sendfile_linux.go
@@ -16,6 +16,9 @@ func SendFile(dstFD *FD, src int, remain int64) (int64, error) {
return 0, err
}
defer dstFD.writeUnlock()
+ if err := dstFD.pd.prepareWrite(dstFD.isFile); err != nil {
+ return 0, err
+ }
dst := int(dstFD.Sysfd)
var written int64
diff --git a/src/internal/poll/sendfile_solaris.go b/src/internal/poll/sendfile_solaris.go
index 762992e9eb..748c85131e 100644
--- a/src/internal/poll/sendfile_solaris.go
+++ b/src/internal/poll/sendfile_solaris.go
@@ -20,6 +20,9 @@ func SendFile(dstFD *FD, src int, pos, remain int64) (int64, error) {
return 0, err
}
defer dstFD.writeUnlock()
+ if err := dstFD.pd.prepareWrite(dstFD.isFile); err != nil {
+ return 0, err
+ }
dst := int(dstFD.Sysfd)
var written int64
diff --git a/src/internal/poll/sock_cloexec.go b/src/internal/poll/sock_cloexec.go
index ff7982ca9e..52191d85c6 100644
--- a/src/internal/poll/sock_cloexec.go
+++ b/src/internal/poll/sock_cloexec.go
@@ -5,6 +5,7 @@
// This file implements sysSocket and accept for platforms that
// provide a fast path for setting SetNonblock and CloseOnExec.
+//go:build dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build dragonfly freebsd illumos linux netbsd openbsd
package poll
diff --git a/src/internal/poll/sockopt.go b/src/internal/poll/sockopt.go
index bb5ea02c0a..4f2e2fb455 100644
--- a/src/internal/poll/sockopt.go
+++ b/src/internal/poll/sockopt.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package poll
diff --git a/src/internal/poll/sockopt_unix.go b/src/internal/poll/sockopt_unix.go
index bd942c2934..4fb9600dee 100644
--- a/src/internal/poll/sockopt_unix.go
+++ b/src/internal/poll/sockopt_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package poll
diff --git a/src/internal/poll/sockoptip.go b/src/internal/poll/sockoptip.go
index c55a1e3c5b..d86c4c1f81 100644
--- a/src/internal/poll/sockoptip.go
+++ b/src/internal/poll/sockoptip.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package poll
diff --git a/src/internal/poll/splice_linux.go b/src/internal/poll/splice_linux.go
index 01baf14ed7..968bc44a5f 100644
--- a/src/internal/poll/splice_linux.go
+++ b/src/internal/poll/splice_linux.go
@@ -52,7 +52,7 @@ func Splice(dst, src *FD, remain int64) (written int64, handled bool, sc string,
// If inPipe == 0 && err == nil, src is at EOF, and the
// transfer is complete.
handled = handled || (err != syscall.EINVAL)
- if err != nil || (inPipe == 0 && err == nil) {
+ if err != nil || inPipe == 0 {
break
}
n, err = splicePump(dst, prfd, inPipe)
diff --git a/src/internal/poll/strconv.go b/src/internal/poll/strconv.go
index 21cb40db70..fd5e20f1f4 100644
--- a/src/internal/poll/strconv.go
+++ b/src/internal/poll/strconv.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
// Simple conversions to avoid depending on strconv.
diff --git a/src/internal/poll/sys_cloexec.go b/src/internal/poll/sys_cloexec.go
index 4b3c642173..69207a4b89 100644
--- a/src/internal/poll/sys_cloexec.go
+++ b/src/internal/poll/sys_cloexec.go
@@ -5,6 +5,7 @@
// This file implements sysSocket and accept for platforms that do not
// provide a fast path for setting SetNonblock and CloseOnExec.
+//go:build aix || darwin || (js && wasm) || (solaris && !illumos)
// +build aix darwin js,wasm solaris,!illumos
package poll
diff --git a/src/internal/poll/writev.go b/src/internal/poll/writev.go
index 0123fc33de..824de7569e 100644
--- a/src/internal/poll/writev.go
+++ b/src/internal/poll/writev.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build darwin dragonfly freebsd illumos linux netbsd openbsd
package poll
diff --git a/src/internal/race/norace.go b/src/internal/race/norace.go
index d83c0165b2..67b1305713 100644
--- a/src/internal/race/norace.go
+++ b/src/internal/race/norace.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !race
// +build !race
package race
diff --git a/src/internal/race/race.go b/src/internal/race/race.go
index 2e7d97beaa..40f2c99383 100644
--- a/src/internal/race/race.go
+++ b/src/internal/race/race.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
package race
diff --git a/src/internal/syscall/execenv/execenv_default.go b/src/internal/syscall/execenv/execenv_default.go
index 4bdbb55edb..73289f1cd0 100644
--- a/src/internal/syscall/execenv/execenv_default.go
+++ b/src/internal/syscall/execenv/execenv_default.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package execenv
diff --git a/src/internal/syscall/execenv/execenv_windows.go b/src/internal/syscall/execenv/execenv_windows.go
index b50029c198..6c0654943e 100644
--- a/src/internal/syscall/execenv/execenv_windows.go
+++ b/src/internal/syscall/execenv/execenv_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package execenv
diff --git a/src/internal/syscall/unix/at.go b/src/internal/syscall/unix/at.go
index f857d68280..9b08864f7f 100644
--- a/src/internal/syscall/unix/at.go
+++ b/src/internal/syscall/unix/at.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux || openbsd || netbsd || dragonfly
// +build linux openbsd netbsd dragonfly
package unix
diff --git a/src/internal/syscall/unix/at_libc.go b/src/internal/syscall/unix/at_libc.go
index 6c3a8c9160..4cc351ea27 100644
--- a/src/internal/syscall/unix/at_libc.go
+++ b/src/internal/syscall/unix/at_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || solaris
// +build aix solaris
package unix
diff --git a/src/internal/syscall/unix/at_sysnum_fstatat64_linux.go b/src/internal/syscall/unix/at_sysnum_fstatat64_linux.go
index c6ea206c12..050d401bc0 100644
--- a/src/internal/syscall/unix/at_sysnum_fstatat64_linux.go
+++ b/src/internal/syscall/unix/at_sysnum_fstatat64_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm || mips || mipsle || 386
// +build arm mips mipsle 386
package unix
diff --git a/src/internal/syscall/unix/at_sysnum_fstatat_linux.go b/src/internal/syscall/unix/at_sysnum_fstatat_linux.go
index 31fe6a5a7b..e53a2d1b75 100644
--- a/src/internal/syscall/unix/at_sysnum_fstatat_linux.go
+++ b/src/internal/syscall/unix/at_sysnum_fstatat_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm64 || riscv64
// +build arm64 riscv64
package unix
diff --git a/src/internal/syscall/unix/at_sysnum_newfstatat_linux.go b/src/internal/syscall/unix/at_sysnum_newfstatat_linux.go
index e76c1cbdce..4cb4a5976b 100644
--- a/src/internal/syscall/unix/at_sysnum_newfstatat_linux.go
+++ b/src/internal/syscall/unix/at_sysnum_newfstatat_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || mips64 || mips64le || ppc64 || ppc64le || s390x
// +build amd64 mips64 mips64le ppc64 ppc64le s390x
package unix
diff --git a/src/internal/syscall/unix/fcntl_linux_32bit.go b/src/internal/syscall/unix/fcntl_linux_32bit.go
index 6c75afc2ab..46a4f6b030 100644
--- a/src/internal/syscall/unix/fcntl_linux_32bit.go
+++ b/src/internal/syscall/unix/fcntl_linux_32bit.go
@@ -5,6 +5,7 @@
// On 32-bit Linux systems, use SYS_FCNTL64.
// If you change the build tags here, see syscall/flock_linux_32bit.go.
+//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle)
// +build linux,386 linux,arm linux,mips linux,mipsle
package unix
diff --git a/src/internal/syscall/unix/nonblocking.go b/src/internal/syscall/unix/nonblocking.go
index db25fcca98..a22986cb8a 100644
--- a/src/internal/syscall/unix/nonblocking.go
+++ b/src/internal/syscall/unix/nonblocking.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package unix
diff --git a/src/internal/syscall/unix/nonblocking_js.go b/src/internal/syscall/unix/nonblocking_js.go
index a360b53c3d..a5a5080d46 100644
--- a/src/internal/syscall/unix/nonblocking_js.go
+++ b/src/internal/syscall/unix/nonblocking_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package unix
diff --git a/src/internal/syscall/unix/nonblocking_libc.go b/src/internal/syscall/unix/nonblocking_libc.go
index 37cc7943ee..d9565efcb6 100644
--- a/src/internal/syscall/unix/nonblocking_libc.go
+++ b/src/internal/syscall/unix/nonblocking_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || solaris
// +build aix darwin solaris
package unix
diff --git a/src/internal/syscall/unix/pipe2_illumos.go b/src/internal/syscall/unix/pipe2_illumos.go
index f3ac8d29df..b0aac89580 100644
--- a/src/internal/syscall/unix/pipe2_illumos.go
+++ b/src/internal/syscall/unix/pipe2_illumos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
package unix
diff --git a/src/internal/syscall/unix/sysnum_linux_generic.go b/src/internal/syscall/unix/sysnum_linux_generic.go
index f48da40188..a76025454c 100644
--- a/src/internal/syscall/unix/sysnum_linux_generic.go
+++ b/src/internal/syscall/unix/sysnum_linux_generic.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (arm64 || riscv64)
// +build linux
// +build arm64 riscv64
diff --git a/src/internal/syscall/unix/sysnum_linux_mips64x.go b/src/internal/syscall/unix/sysnum_linux_mips64x.go
index 6680942cb8..f353d4d73e 100644
--- a/src/internal/syscall/unix/sysnum_linux_mips64x.go
+++ b/src/internal/syscall/unix/sysnum_linux_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips64 || mips64le
// +build mips64 mips64le
package unix
diff --git a/src/internal/syscall/unix/sysnum_linux_mipsx.go b/src/internal/syscall/unix/sysnum_linux_mipsx.go
index 185d8320c9..4ed471532a 100644
--- a/src/internal/syscall/unix/sysnum_linux_mipsx.go
+++ b/src/internal/syscall/unix/sysnum_linux_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips || mipsle
// +build mips mipsle
package unix
diff --git a/src/internal/syscall/unix/sysnum_linux_ppc64x.go b/src/internal/syscall/unix/sysnum_linux_ppc64x.go
index 576937e3f5..b484ffef80 100644
--- a/src/internal/syscall/unix/sysnum_linux_ppc64x.go
+++ b/src/internal/syscall/unix/sysnum_linux_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package unix
diff --git a/src/internal/syscall/unix/writev_illumos.go b/src/internal/syscall/unix/writev_illumos.go
index eb7973d65b..f60949f662 100644
--- a/src/internal/syscall/unix/writev_illumos.go
+++ b/src/internal/syscall/unix/writev_illumos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
package unix
diff --git a/src/internal/testenv/testenv_cgo.go b/src/internal/testenv/testenv_cgo.go
index e3d4d16b33..02f08f57c7 100644
--- a/src/internal/testenv/testenv_cgo.go
+++ b/src/internal/testenv/testenv_cgo.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo
// +build cgo
package testenv
diff --git a/src/internal/testenv/testenv_notwin.go b/src/internal/testenv/testenv_notwin.go
index ccb5d5585f..846ec93856 100644
--- a/src/internal/testenv/testenv_notwin.go
+++ b/src/internal/testenv/testenv_notwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package testenv
diff --git a/src/io/fs/fs.go b/src/io/fs/fs.go
index b691a86049..3d2e2ee2ac 100644
--- a/src/io/fs/fs.go
+++ b/src/io/fs/fs.go
@@ -10,6 +10,7 @@ package fs
import (
"internal/oserror"
"time"
+ "unicode/utf8"
)
// An FS provides access to a hierarchical file system.
@@ -32,14 +33,22 @@ type FS interface {
// ValidPath reports whether the given path name
// is valid for use in a call to Open.
-// Path names passed to open are unrooted, slash-separated
-// sequences of path elements, like “x/y/z”.
-// Path names must not contain a “.” or “..” or empty element,
+//
+// Path names passed to open are UTF-8-encoded,
+// unrooted, slash-separated sequences of path elements, like “x/y/z”.
+// Path names must not contain an element that is “.” or “..” or the empty string,
// except for the special case that the root directory is named “.”.
+// Paths must not start or end with a slash: “/x” and “x/” are invalid.
//
-// Paths are slash-separated on all systems, even Windows.
-// Backslashes must not appear in path names.
+// Note that paths are slash-separated on all systems, even Windows.
+// Paths containing other characters such as backslash and colon
+// are accepted as valid, but those characters must never be
+// interpreted by an FS implementation as path element separators.
func ValidPath(name string) bool {
+ if !utf8.ValidString(name) {
+ return false
+ }
+
if name == "." {
// special case
return true
@@ -49,9 +58,6 @@ func ValidPath(name string) bool {
for {
i := 0
for i < len(name) && name[i] != '/' {
- if name[i] == '\\' {
- return false
- }
i++
}
elem := name[:i]
diff --git a/src/io/fs/fs_test.go b/src/io/fs/fs_test.go
index 8d395fc0db..aae1a7606f 100644
--- a/src/io/fs/fs_test.go
+++ b/src/io/fs/fs_test.go
@@ -33,9 +33,10 @@ var isValidPathTests = []struct {
{"x/..", false},
{"x/../y", false},
{"x//y", false},
- {`x\`, false},
- {`x\y`, false},
- {`\x`, false},
+ {`x\`, true},
+ {`x\y`, true},
+ {`x:y`, true},
+ {`\x`, true},
}
func TestValidPath(t *testing.T) {
diff --git a/src/io/fs/glob.go b/src/io/fs/glob.go
index 549f217542..45d9cb61b9 100644
--- a/src/io/fs/glob.go
+++ b/src/io/fs/glob.go
@@ -6,7 +6,6 @@ package fs
import (
"path"
- "runtime"
)
// A GlobFS is a file system with a Glob method.
@@ -111,8 +110,8 @@ func glob(fs FS, dir, pattern string, matches []string) (m []string, e error) {
// recognized by path.Match.
func hasMeta(path string) bool {
for i := 0; i < len(path); i++ {
- c := path[i]
- if c == '*' || c == '?' || c == '[' || runtime.GOOS == "windows" && c == '\\' {
+ switch path[i] {
+ case '*', '?', '[', '\\':
return true
}
}
diff --git a/src/io/fs/glob_test.go b/src/io/fs/glob_test.go
index f0d791fab5..f19bebed77 100644
--- a/src/io/fs/glob_test.go
+++ b/src/io/fs/glob_test.go
@@ -17,6 +17,7 @@ var globTests = []struct {
}{
{os.DirFS("."), "glob.go", "glob.go"},
{os.DirFS("."), "gl?b.go", "glob.go"},
+ {os.DirFS("."), `gl\ob.go`, "glob.go"},
{os.DirFS("."), "*", "glob.go"},
{os.DirFS(".."), "*/glob.go", "fs/glob.go"},
}
@@ -32,7 +33,7 @@ func TestGlob(t *testing.T) {
t.Errorf("Glob(%#q) = %#v want %v", tt.pattern, matches, tt.result)
}
}
- for _, pattern := range []string{"no_match", "../*/no_match"} {
+ for _, pattern := range []string{"no_match", "../*/no_match", `\*`} {
matches, err := Glob(os.DirFS("."), pattern)
if err != nil {
t.Errorf("Glob error for %q: %s", pattern, err)
diff --git a/src/io/fs/sub.go b/src/io/fs/sub.go
index 64cdffe6de..d689b9e2bc 100644
--- a/src/io/fs/sub.go
+++ b/src/io/fs/sub.go
@@ -68,7 +68,7 @@ func (f *subFS) shorten(name string) (rel string, ok bool) {
return "", false
}
-// fixErr shortens any reported names in PathErrors by stripping dir.
+// fixErr shortens any reported names in PathErrors by stripping f.dir.
func (f *subFS) fixErr(err error) error {
if e, ok := err.(*PathError); ok {
if short, ok := f.shorten(e.Path); ok {
diff --git a/src/io/ioutil/tempfile.go b/src/io/ioutil/tempfile.go
index af7c6fd7c1..4b272e5a5d 100644
--- a/src/io/ioutil/tempfile.go
+++ b/src/io/ioutil/tempfile.go
@@ -5,38 +5,9 @@
package ioutil
import (
- "errors"
"os"
- "path/filepath"
- "strconv"
- "strings"
- "sync"
- "time"
)
-// Random number state.
-// We generate random temporary file names so that there's a good
-// chance the file doesn't exist yet - keeps the number of tries in
-// TempFile to a minimum.
-var rand uint32
-var randmu sync.Mutex
-
-func reseed() uint32 {
- return uint32(time.Now().UnixNano() + int64(os.Getpid()))
-}
-
-func nextRandom() string {
- randmu.Lock()
- r := rand
- if r == 0 {
- r = reseed()
- }
- r = r*1664525 + 1013904223 // constants from Numerical Recipes
- rand = r
- randmu.Unlock()
- return strconv.Itoa(int(1e9 + r%1e9))[1:]
-}
-
// TempFile creates a new temporary file in the directory dir,
// opens the file for reading and writing, and returns the resulting *os.File.
// The filename is generated by taking pattern and adding a random
@@ -48,48 +19,10 @@ func nextRandom() string {
// will not choose the same file. The caller can use f.Name()
// to find the pathname of the file. It is the caller's responsibility
// to remove the file when no longer needed.
+//
+// As of Go 1.16, this function simply calls os.CreateTemp.
func TempFile(dir, pattern string) (f *os.File, err error) {
- if dir == "" {
- dir = os.TempDir()
- }
-
- prefix, suffix, err := prefixAndSuffix(pattern)
- if err != nil {
- return
- }
-
- nconflict := 0
- for i := 0; i < 10000; i++ {
- name := filepath.Join(dir, prefix+nextRandom()+suffix)
- f, err = os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
- if os.IsExist(err) {
- if nconflict++; nconflict > 10 {
- randmu.Lock()
- rand = reseed()
- randmu.Unlock()
- }
- continue
- }
- break
- }
- return
-}
-
-var errPatternHasSeparator = errors.New("pattern contains path separator")
-
-// prefixAndSuffix splits pattern by the last wildcard "*", if applicable,
-// returning prefix as the part before "*" and suffix as the part after "*".
-func prefixAndSuffix(pattern string) (prefix, suffix string, err error) {
- if strings.ContainsRune(pattern, os.PathSeparator) {
- err = errPatternHasSeparator
- return
- }
- if pos := strings.LastIndex(pattern, "*"); pos != -1 {
- prefix, suffix = pattern[:pos], pattern[pos+1:]
- } else {
- prefix = pattern
- }
- return
+ return os.CreateTemp(dir, pattern)
}
// TempDir creates a new temporary directory in the directory dir.
@@ -101,37 +34,8 @@ func prefixAndSuffix(pattern string) (prefix, suffix string, err error) {
// Multiple programs calling TempDir simultaneously
// will not choose the same directory. It is the caller's responsibility
// to remove the directory when no longer needed.
+//
+// As of Go 1.16, this function simply calls os.MkdirTemp.
func TempDir(dir, pattern string) (name string, err error) {
- if dir == "" {
- dir = os.TempDir()
- }
-
- prefix, suffix, err := prefixAndSuffix(pattern)
- if err != nil {
- return
- }
-
- nconflict := 0
- for i := 0; i < 10000; i++ {
- try := filepath.Join(dir, prefix+nextRandom()+suffix)
- err = os.Mkdir(try, 0700)
- if os.IsExist(err) {
- if nconflict++; nconflict > 10 {
- randmu.Lock()
- rand = reseed()
- randmu.Unlock()
- }
- continue
- }
- if os.IsNotExist(err) {
- if _, err := os.Stat(dir); os.IsNotExist(err) {
- return "", err
- }
- }
- if err == nil {
- name = try
- }
- break
- }
- return
+ return os.MkdirTemp(dir, pattern)
}
diff --git a/src/io/ioutil/tempfile_test.go b/src/io/ioutil/tempfile_test.go
index 440c7cffc6..5cef18c33b 100644
--- a/src/io/ioutil/tempfile_test.go
+++ b/src/io/ioutil/tempfile_test.go
@@ -50,6 +50,9 @@ func TestTempFile_pattern(t *testing.T) {
}
}
+// This string is from os.errPatternHasSeparator.
+const patternHasSeparator = "pattern contains path separator"
+
func TestTempFile_BadPattern(t *testing.T) {
tmpDir, err := TempDir("", t.Name())
if err != nil {
@@ -81,9 +84,8 @@ func TestTempFile_BadPattern(t *testing.T) {
if tt.wantErr {
if err == nil {
t.Errorf("Expected an error for pattern %q", tt.pattern)
- }
- if g, w := err, ErrPatternHasSeparator; g != w {
- t.Errorf("Error mismatch: got %#v, want %#v for pattern %q", g, w, tt.pattern)
+ } else if !strings.Contains(err.Error(), patternHasSeparator) {
+ t.Errorf("Error mismatch: got %#v, want %q for pattern %q", err, patternHasSeparator, tt.pattern)
}
} else if err != nil {
t.Errorf("Unexpected error %v for pattern %q", err, tt.pattern)
@@ -183,9 +185,8 @@ func TestTempDir_BadPattern(t *testing.T) {
if tt.wantErr {
if err == nil {
t.Errorf("Expected an error for pattern %q", tt.pattern)
- }
- if g, w := err, ErrPatternHasSeparator; g != w {
- t.Errorf("Error mismatch: got %#v, want %#v for pattern %q", g, w, tt.pattern)
+ } else if !strings.Contains(err.Error(), patternHasSeparator) {
+ t.Errorf("Error mismatch: got %#v, want %q for pattern %q", err, patternHasSeparator, tt.pattern)
}
} else if err != nil {
t.Errorf("Unexpected error %v for pattern %q", err, tt.pattern)
diff --git a/src/log/syslog/example_test.go b/src/log/syslog/example_test.go
index 4288d37dee..993976569e 100644
--- a/src/log/syslog/example_test.go
+++ b/src/log/syslog/example_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !plan9
// +build !windows,!plan9
package syslog_test
diff --git a/src/log/syslog/syslog.go b/src/log/syslog/syslog.go
index 97c10f31df..6abd4ad124 100644
--- a/src/log/syslog/syslog.go
+++ b/src/log/syslog/syslog.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !plan9
// +build !windows,!plan9
package syslog
diff --git a/src/log/syslog/syslog_test.go b/src/log/syslog/syslog_test.go
index 207bcf57c1..62c6250845 100644
--- a/src/log/syslog/syslog_test.go
+++ b/src/log/syslog/syslog_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !plan9 && !js
// +build !windows,!plan9,!js
package syslog
diff --git a/src/log/syslog/syslog_unix.go b/src/log/syslog/syslog_unix.go
index a64eed29f1..2e45f0764f 100644
--- a/src/log/syslog/syslog_unix.go
+++ b/src/log/syslog/syslog_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !plan9
// +build !windows,!plan9
package syslog
diff --git a/src/math/all_test.go b/src/math/all_test.go
index 3aae0373c7..d154457999 100644
--- a/src/math/all_test.go
+++ b/src/math/all_test.go
@@ -2067,6 +2067,21 @@ var fmaC = []struct{ x, y, z, want float64 }{
{-7.751454006381804e-05, 5.588653777189071e-308, -2.2207280111272877e-308, -2.2211612130544025e-308},
}
+var sqrt32 = []float32{
+ 0,
+ float32(Copysign(0, -1)),
+ float32(NaN()),
+ float32(Inf(1)),
+ float32(Inf(-1)),
+ 1,
+ 2,
+ -2,
+ 4.9790119248836735e+00,
+ 7.7388724745781045e+00,
+ -2.7688005719200159e-01,
+ -5.0106036182710749e+00,
+}
+
func tolerance(a, b, e float64) bool {
// Multiplying by e here can underflow denormal values to zero.
// Check a==b so that at least if a and b are small and identical
@@ -3181,6 +3196,25 @@ func TestFloatMinMax(t *testing.T) {
}
}
+var indirectSqrt = Sqrt
+
+// TestFloat32Sqrt checks the correctness of the float32 square root optimization result.
+func TestFloat32Sqrt(t *testing.T) {
+ for _, v := range sqrt32 {
+ want := float32(indirectSqrt(float64(v)))
+ got := float32(Sqrt(float64(v)))
+ if IsNaN(float64(want)) {
+ if !IsNaN(float64(got)) {
+ t.Errorf("got=%#v want=NaN, v=%#v", got, v)
+ }
+ continue
+ }
+ if got != want {
+ t.Errorf("got=%#v want=%#v, v=%#v", got, want, v)
+ }
+ }
+}
+
// Benchmarks
// Global exported variables are used to store the
diff --git a/src/math/asin_386.s b/src/math/asin_386.s
deleted file mode 100644
index 7dab390623..0000000000
--- a/src/math/asin_386.s
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2010 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"
-
-// func Asin(x float64) float64
-TEXT ·Asin(SB),NOSPLIT,$0
- FMOVD x+0(FP), F0 // F0=sin(x)
- FMOVD F0, F1 // F0=sin(x), F1=sin(x)
- FMULD F0, F0 // F0=sin(x)*sin(x), F1=sin(x)
- FLD1 // F0=1, F1=sin(x)*sin(x), F2=sin(x)
- FSUBRDP F0, F1 // F0=1-sin(x)*sin(x) (=cos(x)*cos(x)), F1=sin(x)
- FSQRT // F0=cos(x), F1=sin(x)
- FPATAN // F0=arcsin(sin(x))=x
- FMOVDP F0, ret+8(FP)
- RET
-
-// func Acos(x float64) float64
-TEXT ·Acos(SB),NOSPLIT,$0
- FMOVD x+0(FP), F0 // F0=cos(x)
- FMOVD F0, F1 // F0=cos(x), F1=cos(x)
- FMULD F0, F0 // F0=cos(x)*cos(x), F1=cos(x)
- FLD1 // F0=1, F1=cos(x)*cos(x), F2=cos(x)
- FSUBRDP F0, F1 // F0=1-cos(x)*cos(x) (=sin(x)*sin(x)), F1=cos(x)
- FSQRT // F0=sin(x), F1=cos(x)
- FXCHD F0, F1 // F0=cos(x), F1=sin(x)
- FPATAN // F0=arccos(cos(x))=x
- FMOVDP F0, ret+8(FP)
- RET
diff --git a/src/math/atan2_386.s b/src/math/atan2_386.s
deleted file mode 100644
index 90d211bf5b..0000000000
--- a/src/math/atan2_386.s
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2010 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"
-
-// func Atan2(y, x float64) float64 // =atan(y/x)
-TEXT ·Atan2(SB),NOSPLIT,$0
- FMOVD y+0(FP), F0 // F0=y
- FMOVD x+8(FP), F0 // F0=x, F1=y
- FPATAN // F0=atan(F1/F0)
- FMOVDP F0, ret+16(FP)
- RET
diff --git a/src/math/atan_386.s b/src/math/atan_386.s
deleted file mode 100644
index 43e79b92b6..0000000000
--- a/src/math/atan_386.s
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2010 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"
-
-// func Atan(x float64) float64
-TEXT ·Atan(SB),NOSPLIT,$0
- FMOVD x+0(FP), F0 // F0=x
- FLD1 // F0=1, F1=x
- FPATAN // F0=atan(F1/F0)
- FMOVDP F0, ret+8(FP)
- RET
diff --git a/src/math/big/arith_amd64.go b/src/math/big/arith_amd64.go
index 1d2d37cf93..89108fe149 100644
--- a/src/math/big/arith_amd64.go
+++ b/src/math/big/arith_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !math_big_pure_go
// +build !math_big_pure_go
package big
diff --git a/src/math/big/arith_decl.go b/src/math/big/arith_decl.go
index d519bdc87b..eea3d6b325 100644
--- a/src/math/big/arith_decl.go
+++ b/src/math/big/arith_decl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !math_big_pure_go
// +build !math_big_pure_go
package big
diff --git a/src/math/big/arith_decl_pure.go b/src/math/big/arith_decl_pure.go
index 5faa3bd281..059f6f1325 100644
--- a/src/math/big/arith_decl_pure.go
+++ b/src/math/big/arith_decl_pure.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build math_big_pure_go
// +build math_big_pure_go
package big
diff --git a/src/math/big/arith_decl_s390x.go b/src/math/big/arith_decl_s390x.go
index f1a69e1df0..4193f3231c 100644
--- a/src/math/big/arith_decl_s390x.go
+++ b/src/math/big/arith_decl_s390x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !math_big_pure_go
// +build !math_big_pure_go
package big
diff --git a/src/math/big/arith_s390x_test.go b/src/math/big/arith_s390x_test.go
index ce6bca8885..8375ddbdd4 100644
--- a/src/math/big/arith_s390x_test.go
+++ b/src/math/big/arith_s390x_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build s390x && !math_big_pure_go
// +build s390x,!math_big_pure_go
package big
diff --git a/src/math/big/nat.go b/src/math/big/nat.go
index 068176e1c1..bbd6c8850b 100644
--- a/src/math/big/nat.go
+++ b/src/math/big/nat.go
@@ -881,7 +881,7 @@ func (z nat) divRecursiveStep(u, v nat, depth int, tmp *nat, temps []*nat) {
// then floor(u1/v1) >= floor(u/v)
//
// Moreover, the difference is at most 2 if len(v1) >= len(u/v)
- // We choose s = B-1 since len(v)-B >= B+1 >= len(u/v)
+ // We choose s = B-1 since len(v)-s >= B+1 >= len(u/v)
s := (B - 1)
// Except for the first step, the top bits are always
// a division remainder, so the quotient length is <= n.
diff --git a/src/math/bits/bits_errors.go b/src/math/bits/bits_errors.go
index 192b4bee00..61cb5c9457 100644
--- a/src/math/bits/bits_errors.go
+++ b/src/math/bits/bits_errors.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !compiler_bootstrap
// +build !compiler_bootstrap
package bits
diff --git a/src/math/bits/bits_errors_bootstrap.go b/src/math/bits/bits_errors_bootstrap.go
index 5df5738848..4d610d33b8 100644
--- a/src/math/bits/bits_errors_bootstrap.go
+++ b/src/math/bits/bits_errors_bootstrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build compiler_bootstrap
// +build compiler_bootstrap
// This version used only for bootstrap (on this path we want
diff --git a/src/math/bits/make_examples.go b/src/math/bits/make_examples.go
index 1d3ad53fe6..ac4004df41 100644
--- a/src/math/bits/make_examples.go
+++ b/src/math/bits/make_examples.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This program generates example_test.go.
diff --git a/src/math/bits/make_tables.go b/src/math/bits/make_tables.go
index b068d5e0e3..5ab0b5fc57 100644
--- a/src/math/bits/make_tables.go
+++ b/src/math/bits/make_tables.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This program generates bits_tables.go.
diff --git a/src/math/cmplx/huge_test.go b/src/math/cmplx/huge_test.go
index f8e60c265f..78b42316de 100644
--- a/src/math/cmplx/huge_test.go
+++ b/src/math/cmplx/huge_test.go
@@ -5,6 +5,7 @@
// Disabled for s390x because it uses assembly routines that are not
// accurate for huge arguments.
+//go:build !s390x
// +build !s390x
package cmplx
diff --git a/src/math/exp2_386.s b/src/math/exp2_386.s
deleted file mode 100644
index d04cad6a55..0000000000
--- a/src/math/exp2_386.s
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2010 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"
-
-// func Exp2(x float64) float64
-TEXT ·Exp2(SB),NOSPLIT,$0
-// test bits for not-finite
- MOVL x_hi+4(FP), AX
- ANDL $0x7ff00000, AX
- CMPL AX, $0x7ff00000
- JEQ not_finite
- FMOVD x+0(FP), F0 // F0=x
- FMOVD F0, F1 // F0=x, F1=x
- FRNDINT // F0=int(x), F1=x
- FSUBD F0, F1 // F0=int(x), F1=x-int(x)
- FXCHD F0, F1 // F0=x-int(x), F1=int(x)
- F2XM1 // F0=2**(x-int(x))-1, F1=int(x)
- FLD1 // F0=1, F1=2**(x-int(x))-1, F2=int(x)
- FADDDP F0, F1 // F0=2**(x-int(x)), F1=int(x)
- FSCALE // F0=2**x, F1=int(x)
- FMOVDP F0, F1 // F0=2**x
- FMOVDP F0, ret+8(FP)
- RET
-not_finite:
-// test bits for -Inf
- MOVL x_hi+4(FP), BX
- MOVL x_lo+0(FP), CX
- CMPL BX, $0xfff00000
- JNE not_neginf
- CMPL CX, $0
- JNE not_neginf
- MOVL $0, ret_lo+8(FP)
- MOVL $0, ret_hi+12(FP)
- RET
-not_neginf:
- MOVL CX, ret_lo+8(FP)
- MOVL BX, ret_hi+12(FP)
- RET
diff --git a/src/math/exp_asm.go b/src/math/exp_asm.go
index 8dad3c810b..654ccce481 100644
--- a/src/math/exp_asm.go
+++ b/src/math/exp_asm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64
// +build amd64
package math
diff --git a/src/math/expm1_386.s b/src/math/expm1_386.s
deleted file mode 100644
index d020296ca7..0000000000
--- a/src/math/expm1_386.s
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2010 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"
-
-// func Expm1(x float64) float64
-TEXT ·Expm1(SB),NOSPLIT,$0
- FLDLN2 // F0=log(2) = 1/log2(e) ~ 0.693147
- FMOVD x+0(FP), F0 // F0=x, F1=1/log2(e)
- FABS // F0=|x|, F1=1/log2(e)
- FUCOMPP F0, F1 // compare F0 to F1
- FSTSW AX
- SAHF
- JCC use_exp // jump if F0 >= F1
- FLDL2E // F0=log2(e)
- FMULD x+0(FP), F0 // F0=x*log2(e) (-1<F0<1)
- F2XM1 // F0=e**x-1 = 2**(x*log2(e))-1
- FMOVDP F0, ret+8(FP)
- RET
-use_exp:
-// test bits for not-finite
- MOVL x_hi+4(FP), AX
- ANDL $0x7ff00000, AX
- CMPL AX, $0x7ff00000
- JEQ not_finite
- FLDL2E // F0=log2(e)
- FMULD x+0(FP), F0 // F0=x*log2(e)
- FMOVD F0, F1 // F0=x*log2(e), F1=x*log2(e)
- FRNDINT // F0=int(x*log2(e)), F1=x*log2(e)
- FSUBD F0, F1 // F0=int(x*log2(e)), F1=x*log2(e)-int(x*log2(e))
- FXCHD F0, F1 // F0=x*log2(e)-int(x*log2(e)), F1=int(x*log2(e))
- F2XM1 // F0=2**(x*log2(e)-int(x*log2(e)))-1, F1=int(x*log2(e))
- FLD1 // F0=1, F1=2**(x*log2(e)-int(x*log2(e)))-1, F2=int(x*log2(e))
- FADDDP F0, F1 // F0=2**(x*log2(e)-int(x*log2(e))), F1=int(x*log2(e))
- FSCALE // F0=e**x, F1=int(x*log2(e))
- FMOVDP F0, F1 // F0=e**x
- FLD1 // F0=1, F1=e**x
- FSUBDP F0, F1 // F0=e**x-1
- FMOVDP F0, ret+8(FP)
- RET
-not_finite:
-// test bits for -Inf
- MOVL x_hi+4(FP), BX
- MOVL x_lo+0(FP), CX
- CMPL BX, $0xfff00000
- JNE not_neginf
- CMPL CX, $0
- JNE not_neginf
- FLD1 // F0=1
- FCHS // F0=-1
- FMOVDP F0, ret+8(FP)
- RET
-not_neginf:
- MOVL CX, ret_lo+8(FP)
- MOVL BX, ret_hi+12(FP)
- RET
diff --git a/src/math/frexp_386.s b/src/math/frexp_386.s
deleted file mode 100644
index 832b435fe8..0000000000
--- a/src/math/frexp_386.s
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2010 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"
-
-// func Frexp(f float64) (frac float64, exp int)
-TEXT ·Frexp(SB),NOSPLIT,$0
- FMOVD f+0(FP), F0 // F0=f
- FXAM
- FSTSW AX
- SAHF
- JNP nan_zero_inf
- JCS nan_zero_inf
- FXTRACT // F0=f (0<=f<1), F1=e
- FMULD $(0.5), F0 // F0=f (0.5<=f<1), F1=e
- FMOVDP F0, frac+8(FP) // F0=e
- FLD1 // F0=1, F1=e
- FADDDP F0, F1 // F0=e+1
- FMOVLP F0, exp+16(FP) // (int=int32)
- RET
-nan_zero_inf:
- FMOVDP F0, frac+8(FP) // F0=e
- MOVL $0, exp+16(FP) // exp=0
- RET
diff --git a/src/math/huge_test.go b/src/math/huge_test.go
index 9448edc339..ec81a4a31d 100644
--- a/src/math/huge_test.go
+++ b/src/math/huge_test.go
@@ -5,6 +5,7 @@
// Disabled for s390x because it uses assembly routines that are not
// accurate for huge arguments.
+//go:build !s390x
// +build !s390x
package math_test
diff --git a/src/math/ldexp_386.s b/src/math/ldexp_386.s
deleted file mode 100644
index 6f67ae1d13..0000000000
--- a/src/math/ldexp_386.s
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2010 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"
-
-// func Ldexp(frac float64, exp int) float64
-TEXT ·Ldexp(SB),NOSPLIT,$0
- FMOVL exp+8(FP), F0 // F0=exp
- FMOVD frac+0(FP), F0 // F0=frac, F1=e
- FSCALE // F0=x*2**e, F1=e
- FMOVDP F0, F1 // F0=x*2**e
- FMOVDP F0, ret+12(FP)
- RET
diff --git a/src/math/log10_386.s b/src/math/log10_386.s
deleted file mode 100644
index 10eecd90e2..0000000000
--- a/src/math/log10_386.s
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2010 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"
-
-// func Log10(x float64) float64
-TEXT ·Log10(SB),NOSPLIT,$0
- FLDLG2 // F0=log10(2)
- FMOVD x+0(FP), F0 // F0=x, F1=log10(2)
- FYL2X // F0=log10(x)=log2(x)*log10(2)
- FMOVDP F0, ret+8(FP)
- RET
-
-// func Log2(x float64) float64
-TEXT ·Log2(SB),NOSPLIT,$0
- FLD1 // F0=1
- FMOVD x+0(FP), F0 // F0=x, F1=1
- FYL2X // F0=log2(x)
- FMOVDP F0, ret+8(FP)
- RET
diff --git a/src/math/log1p_386.s b/src/math/log1p_386.s
deleted file mode 100644
index 63b7e62283..0000000000
--- a/src/math/log1p_386.s
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2010 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"
-
-// func Log1p(x float64) float64
-TEXT ·Log1p(SB),NOSPLIT,$0
- FMOVD $(2.928932188134524e-01), F0
- FMOVD x+0(FP), F0 // F0=x, F1=1-sqrt(2)/2 = 0.29289321881345247559915564
- FABS // F0=|x|, F1=1-sqrt(2)/2
- FUCOMPP F0, F1 // compare F0 to F1
- FSTSW AX
- FLDLN2 // F0=log(2)
- ANDW $0x0100, AX
- JEQ use_fyl2x // jump if F0 >= F1
- FMOVD x+0(FP), F0 // F0=x, F1=log(2)
- FYL2XP1 // F0=log(1+x)=log2(1+x)*log(2)
- FMOVDP F0, ret+8(FP)
- RET
-use_fyl2x:
- FLD1 // F0=1, F2=log(2)
- FADDD x+0(FP), F0 // F0=1+x, F1=log(2)
- FYL2X // F0=log(1+x)=log2(1+x)*log(2)
- FMOVDP F0, ret+8(FP)
- RET
-
diff --git a/src/math/log_386.s b/src/math/log_386.s
deleted file mode 100644
index 0b64b507b2..0000000000
--- a/src/math/log_386.s
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2010 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"
-
-// func Log(x float64) float64
-TEXT ·Log(SB),NOSPLIT,$0
- FLDLN2 // F0=log(2)
- FMOVD x+0(FP), F0 // F0=x, F1=log(2)
- FYL2X // F0=log(x)=log2(x)*log(2)
- FMOVDP F0, ret+8(FP)
- RET
diff --git a/src/math/mod_386.s b/src/math/mod_386.s
deleted file mode 100644
index 10ad98be3e..0000000000
--- a/src/math/mod_386.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2010 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"
-
-// func Mod(x, y float64) float64
-TEXT ·Mod(SB),NOSPLIT,$0
- FMOVD y+8(FP), F0 // F0=y
- FMOVD x+0(FP), F0 // F0=x, F1=y
- FPREM // F0=reduced_x, F1=y
- FSTSW AX // AX=status word
- ANDW $0x0400, AX
- JNE -3(PC) // jump if reduction incomplete
- FMOVDP F0, F1 // F0=x-q*y
- FMOVDP F0, ret+16(FP)
- RET
diff --git a/src/math/modf_386.s b/src/math/modf_386.s
deleted file mode 100644
index e9160735d3..0000000000
--- a/src/math/modf_386.s
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2010 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"
-
-// func Modf(f float64) (int float64, frac float64)
-TEXT ·Modf(SB),NOSPLIT,$0
- // special case for f == -0.0
- MOVL f_hi+4(FP), DX // high word
- MOVL f_lo+0(FP), AX // low word
- CMPL DX, $(1<<31) // beginning of -0.0
- JNE notNegativeZero
- CMPL AX, $0 // could be denormalized
- JNE notNegativeZero
- MOVL AX, int_lo+8(FP)
- MOVL DX, int_hi+12(FP)
- MOVL AX, frac_lo+16(FP)
- MOVL DX, frac_hi+20(FP)
- RET
-notNegativeZero:
- FMOVD f+0(FP), F0 // F0=f
- FMOVD F0, F1 // F0=f, F1=f
- FSTCW -2(SP) // save old Control Word
- MOVW -2(SP), AX
- ORW $0x0c00, AX // Rounding Control set to truncate
- MOVW AX, -4(SP) // store new Control Word
- FLDCW -4(SP) // load new Control Word
- FRNDINT // F0=trunc(f), F1=f
- FLDCW -2(SP) // load old Control Word
- FSUBD F0, F1 // F0=trunc(f), F1=f-trunc(f)
- FMOVDP F0, int+8(FP) // F0=f-trunc(f)
- FMOVDP F0, frac+16(FP)
- RET
diff --git a/src/math/rand/gen_cooked.go b/src/math/rand/gen_cooked.go
index 0afc10d727..7950e09fd7 100644
--- a/src/math/rand/gen_cooked.go
+++ b/src/math/rand/gen_cooked.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This program computes the value of rngCooked in rng.go,
diff --git a/src/math/remainder_386.s b/src/math/remainder_386.s
deleted file mode 100644
index 318fa2c465..0000000000
--- a/src/math/remainder_386.s
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2010 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"
-
-// func Remainder(x, y float64) float64
-TEXT ·Remainder(SB),NOSPLIT,$0
- FMOVD y+8(FP), F0 // F0=y
- FMOVD x+0(FP), F0 // F0=x, F1=y
- FPREM1 // F0=reduced_x, F1=y
- FSTSW AX // AX=status word
- ANDW $0x0400, AX
- JNE -3(PC) // jump if reduction incomplete
- FMOVDP F0, F1 // F0=x-q*y
- FMOVDP F0, ret+16(FP)
- RET
diff --git a/src/math/stubs_386.s b/src/math/stubs_386.s
index 92c8621523..bccb3edd11 100644
--- a/src/math/stubs_386.s
+++ b/src/math/stubs_386.s
@@ -4,12 +4,24 @@
#include "textflag.h"
+TEXT ·Acos(SB), NOSPLIT, $0
+ JMP ·acos(SB)
+
TEXT ·Acosh(SB), NOSPLIT, $0
JMP ·acosh(SB)
+TEXT ·Asin(SB), NOSPLIT, $0
+ JMP ·asin(SB)
+
TEXT ·Asinh(SB), NOSPLIT, $0
JMP ·asinh(SB)
+TEXT ·Atan(SB), NOSPLIT, $0
+ JMP ·atan(SB)
+
+TEXT ·Atan2(SB), NOSPLIT, $0
+ JMP ·atan2(SB)
+
TEXT ·Atanh(SB), NOSPLIT, $0
JMP ·atanh(SB)
@@ -31,15 +43,48 @@ TEXT ·Erfc(SB), NOSPLIT, $0
TEXT ·Exp(SB), NOSPLIT, $0
JMP ·exp(SB)
+TEXT ·Exp2(SB), NOSPLIT, $0
+ JMP ·exp2(SB)
+
+TEXT ·Expm1(SB), NOSPLIT, $0
+ JMP ·expm1(SB)
+
+TEXT ·Frexp(SB), NOSPLIT, $0
+ JMP ·frexp(SB)
+
+TEXT ·Ldexp(SB), NOSPLIT, $0
+ JMP ·ldexp(SB)
+
+TEXT ·Log10(SB), NOSPLIT, $0
+ JMP ·log10(SB)
+
+TEXT ·Log2(SB), NOSPLIT, $0
+ JMP ·log2(SB)
+
+TEXT ·Log1p(SB), NOSPLIT, $0
+ JMP ·log1p(SB)
+
+TEXT ·Log(SB), NOSPLIT, $0
+ JMP ·log(SB)
+
TEXT ·Max(SB), NOSPLIT, $0
JMP ·max(SB)
TEXT ·Min(SB), NOSPLIT, $0
JMP ·min(SB)
+TEXT ·Mod(SB), NOSPLIT, $0
+ JMP ·mod(SB)
+
+TEXT ·Modf(SB), NOSPLIT, $0
+ JMP ·modf(SB)
+
TEXT ·Pow(SB), NOSPLIT, $0
JMP ·pow(SB)
+TEXT ·Remainder(SB), NOSPLIT, $0
+ JMP ·remainder(SB)
+
TEXT ·Sin(SB), NOSPLIT, $0
JMP ·sin(SB)
diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go
index 3a25002842..851d5a0fb0 100644
--- a/src/mime/type_unix.go
+++ b/src/mime/type_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package mime
diff --git a/src/net/addrselect.go b/src/net/addrselect.go
index 7c0dfe261c..ae93c595af 100644
--- a/src/net/addrselect.go
+++ b/src/net/addrselect.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// Minimal RFC 6724 address selection.
diff --git a/src/net/addrselect_test.go b/src/net/addrselect_test.go
index d6e0e63c3b..dc13917018 100644
--- a/src/net/addrselect_test.go
+++ b/src/net/addrselect_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/cgo_aix.go b/src/net/cgo_aix.go
index d0ad414a32..a94405ecc0 100644
--- a/src/net/cgo_aix.go
+++ b/src/net/cgo_aix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !netgo
// +build cgo,!netgo
package net
diff --git a/src/net/cgo_android.go b/src/net/cgo_android.go
index ab0368d14b..4b1a2e3e1d 100644
--- a/src/net/cgo_android.go
+++ b/src/net/cgo_android.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !netgo
// +build cgo,!netgo
package net
diff --git a/src/net/cgo_bsd.go b/src/net/cgo_bsd.go
index a923c556d3..23be72140b 100644
--- a/src/net/cgo_bsd.go
+++ b/src/net/cgo_bsd.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (darwin || dragonfly || freebsd)
+// +build cgo
+// +build !netgo
// +build darwin dragonfly freebsd
package net
diff --git a/src/net/cgo_linux.go b/src/net/cgo_linux.go
index 86d8f4dc1e..1bd6be93f7 100644
--- a/src/net/cgo_linux.go
+++ b/src/net/cgo_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !android && cgo && !netgo
// +build !android,cgo,!netgo
package net
diff --git a/src/net/cgo_netbsd.go b/src/net/cgo_netbsd.go
index 4610246561..3714793a52 100644
--- a/src/net/cgo_netbsd.go
+++ b/src/net/cgo_netbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !netgo
// +build cgo,!netgo
package net
diff --git a/src/net/cgo_openbsd.go b/src/net/cgo_openbsd.go
index 4610246561..3714793a52 100644
--- a/src/net/cgo_openbsd.go
+++ b/src/net/cgo_openbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !netgo
// +build cgo,!netgo
package net
diff --git a/src/net/cgo_resnew.go b/src/net/cgo_resnew.go
index 3e3e77e17d..154405270f 100644
--- a/src/net/cgo_resnew.go
+++ b/src/net/cgo_resnew.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (darwin || (linux && !android) || netbsd || solaris)
+// +build cgo
+// +build !netgo
// +build darwin linux,!android netbsd solaris
package net
diff --git a/src/net/cgo_resold.go b/src/net/cgo_resold.go
index abd04a814d..c4aab33eaa 100644
--- a/src/net/cgo_resold.go
+++ b/src/net/cgo_resold.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (android || freebsd || dragonfly || openbsd)
+// +build cgo
+// +build !netgo
// +build android freebsd dragonfly openbsd
package net
diff --git a/src/net/cgo_socknew.go b/src/net/cgo_socknew.go
index 3b13926107..f9cfad9909 100644
--- a/src/net/cgo_socknew.go
+++ b/src/net/cgo_socknew.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (android || linux || solaris)
+// +build cgo
+// +build !netgo
// +build android linux solaris
package net
diff --git a/src/net/cgo_sockold.go b/src/net/cgo_sockold.go
index e1e642bb41..22c67252f5 100644
--- a/src/net/cgo_sockold.go
+++ b/src/net/cgo_sockold.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (aix || darwin || dragonfly || freebsd || netbsd || openbsd)
+// +build cgo
+// +build !netgo
// +build aix darwin dragonfly freebsd netbsd openbsd
package net
diff --git a/src/net/cgo_solaris.go b/src/net/cgo_solaris.go
index 25c0721242..a84f5b0d34 100644
--- a/src/net/cgo_solaris.go
+++ b/src/net/cgo_solaris.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !netgo
// +build cgo,!netgo
package net
diff --git a/src/net/cgo_stub.go b/src/net/cgo_stub.go
index 041f8af129..039e4be88b 100644
--- a/src/net/cgo_stub.go
+++ b/src/net/cgo_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !cgo || netgo
// +build !cgo netgo
package net
diff --git a/src/net/cgo_unix.go b/src/net/cgo_unix.go
index 69c99fe7db..2ea86e074f 100644
--- a/src/net/cgo_unix.go
+++ b/src/net/cgo_unix.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris)
+// +build cgo
+// +build !netgo
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/cgo_unix_test.go b/src/net/cgo_unix_test.go
index 99d79a60c4..1f3d9ea207 100644
--- a/src/net/cgo_unix_test.go
+++ b/src/net/cgo_unix_test.go
@@ -2,7 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build cgo,!netgo
+//go:build cgo && !netgo && (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris)
+// +build cgo
+// +build !netgo
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/cgo_windows.go b/src/net/cgo_windows.go
index 8968b757a9..1fd1f29787 100644
--- a/src/net/cgo_windows.go
+++ b/src/net/cgo_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !netgo
// +build cgo,!netgo
package net
diff --git a/src/net/conf.go b/src/net/conf.go
index f1bbfedad0..6b9569cd92 100644
--- a/src/net/conf.go
+++ b/src/net/conf.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/conf_netcgo.go b/src/net/conf_netcgo.go
index db4c703b06..8f387ebc03 100644
--- a/src/net/conf_netcgo.go
+++ b/src/net/conf_netcgo.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build netcgo
// +build netcgo
package net
diff --git a/src/net/conf_test.go b/src/net/conf_test.go
index 1fe3cf41b1..b1f2c55ea5 100644
--- a/src/net/conf_test.go
+++ b/src/net/conf_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/conn_test.go b/src/net/conn_test.go
index 771cabcd3c..45e271c264 100644
--- a/src/net/conn_test.go
+++ b/src/net/conn_test.go
@@ -5,6 +5,7 @@
// This file implements API tests across platforms and will never have a build
// tag.
+//go:build !js
// +build !js
package net
diff --git a/src/net/dial_test.go b/src/net/dial_test.go
index 57cf5554ad..394bdb047e 100644
--- a/src/net/dial_test.go
+++ b/src/net/dial_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/dial_unix_test.go b/src/net/dial_unix_test.go
index 3cfc9d81b8..108b973099 100644
--- a/src/net/dial_unix_test.go
+++ b/src/net/dial_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/dnsclient_unix.go b/src/net/dnsclient_unix.go
index d7db0c8133..a3242ff3b2 100644
--- a/src/net/dnsclient_unix.go
+++ b/src/net/dnsclient_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// DNS client: see RFC 1035.
diff --git a/src/net/dnsclient_unix_test.go b/src/net/dnsclient_unix_test.go
index 0530c92c2e..b47b83af15 100644
--- a/src/net/dnsclient_unix_test.go
+++ b/src/net/dnsclient_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/dnsconfig_unix.go b/src/net/dnsconfig_unix.go
index 877e77c049..db9213a13f 100644
--- a/src/net/dnsconfig_unix.go
+++ b/src/net/dnsconfig_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// Read system DNS config from /etc/resolv.conf
diff --git a/src/net/dnsconfig_unix_test.go b/src/net/dnsconfig_unix_test.go
index 0d7897a813..0e2317c469 100644
--- a/src/net/dnsconfig_unix_test.go
+++ b/src/net/dnsconfig_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/dnsname_test.go b/src/net/dnsname_test.go
index 2964982311..d851bf7566 100644
--- a/src/net/dnsname_test.go
+++ b/src/net/dnsname_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/error_posix.go b/src/net/error_posix.go
index d709a273b7..50eb66fc61 100644
--- a/src/net/error_posix.go
+++ b/src/net/error_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/error_posix_test.go b/src/net/error_posix_test.go
index b411a378df..ea52a45ee8 100644
--- a/src/net/error_posix_test.go
+++ b/src/net/error_posix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package net
diff --git a/src/net/error_test.go b/src/net/error_test.go
index 556eb8c8d4..c304390819 100644
--- a/src/net/error_test.go
+++ b/src/net/error_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/error_unix.go b/src/net/error_unix.go
index e615330388..d0b5e2ce96 100644
--- a/src/net/error_unix.go
+++ b/src/net/error_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || js || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js linux netbsd openbsd solaris
package net
diff --git a/src/net/error_unix_test.go b/src/net/error_unix_test.go
index 9ce9e12c5e..533a45e648 100644
--- a/src/net/error_unix_test.go
+++ b/src/net/error_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9 && !windows
// +build !plan9,!windows
package net
diff --git a/src/net/external_test.go b/src/net/external_test.go
index f3c69c407f..b8753cc092 100644
--- a/src/net/external_test.go
+++ b/src/net/external_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/fd_posix.go b/src/net/fd_posix.go
index 53abd152c7..2945e46a48 100644
--- a/src/net/fd_posix.go
+++ b/src/net/fd_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package net
diff --git a/src/net/fd_unix.go b/src/net/fd_unix.go
index 1c9bba3b19..a7bbdd26b4 100644
--- a/src/net/fd_unix.go
+++ b/src/net/fd_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/file_stub.go b/src/net/file_stub.go
index bfb8100f53..9f988fe899 100644
--- a/src/net/file_stub.go
+++ b/src/net/file_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/file_test.go b/src/net/file_test.go
index 8c09c0da1b..a70ef1b312 100644
--- a/src/net/file_test.go
+++ b/src/net/file_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/file_unix.go b/src/net/file_unix.go
index dba69554ca..4520d4b839 100644
--- a/src/net/file_unix.go
+++ b/src/net/file_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/hook_unix.go b/src/net/hook_unix.go
index a28f1e066d..b9153d1947 100644
--- a/src/net/hook_unix.go
+++ b/src/net/hook_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package net
diff --git a/src/net/http/cgi/plan9_test.go b/src/net/http/cgi/plan9_test.go
index cc20fe03e4..f998bac6ea 100644
--- a/src/net/http/cgi/plan9_test.go
+++ b/src/net/http/cgi/plan9_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package cgi
diff --git a/src/net/http/cgi/posix_test.go b/src/net/http/cgi/posix_test.go
index 9396ce036a..bc58ea94cc 100644
--- a/src/net/http/cgi/posix_test.go
+++ b/src/net/http/cgi/posix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package cgi
diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go
index 6bef310feb..0379848e70 100644
--- a/src/net/http/h2_bundle.go
+++ b/src/net/http/h2_bundle.go
@@ -1,3 +1,4 @@
+//go:build !nethttpomithttp2
// +build !nethttpomithttp2
// Code generated by golang.org/x/tools/cmd/bundle. DO NOT EDIT.
diff --git a/src/net/http/omithttp2.go b/src/net/http/omithttp2.go
index 30c6e48cfc..79599d006a 100644
--- a/src/net/http/omithttp2.go
+++ b/src/net/http/omithttp2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build nethttpomithttp2
// +build nethttpomithttp2
package http
diff --git a/src/net/http/roundtrip.go b/src/net/http/roundtrip.go
index 2ec736bfb1..eef7c79293 100644
--- a/src/net/http/roundtrip.go
+++ b/src/net/http/roundtrip.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js || !wasm
// +build !js !wasm
package http
diff --git a/src/net/http/roundtrip_js.go b/src/net/http/roundtrip_js.go
index c6a221ac62..74c83a9172 100644
--- a/src/net/http/roundtrip_js.go
+++ b/src/net/http/roundtrip_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package http
diff --git a/src/net/http/triv.go b/src/net/http/triv.go
index 23e65d56e8..4dc62407c6 100644
--- a/src/net/http/triv.go
+++ b/src/net/http/triv.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/net/interface_bsd.go b/src/net/interface_bsd.go
index d791cb3016..7578b1a16a 100644
--- a/src/net/interface_bsd.go
+++ b/src/net/interface_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package net
diff --git a/src/net/interface_bsd_test.go b/src/net/interface_bsd_test.go
index 947dde71e6..8d0d9c3671 100644
--- a/src/net/interface_bsd_test.go
+++ b/src/net/interface_bsd_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package net
diff --git a/src/net/interface_bsdvar.go b/src/net/interface_bsdvar.go
index a809b5f5ce..6230e0bfee 100644
--- a/src/net/interface_bsdvar.go
+++ b/src/net/interface_bsdvar.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || netbsd || openbsd
// +build dragonfly netbsd openbsd
package net
diff --git a/src/net/interface_stub.go b/src/net/interface_stub.go
index ec58665e19..efe67c24d3 100644
--- a/src/net/interface_stub.go
+++ b/src/net/interface_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/interface_test.go b/src/net/interface_test.go
index b2ef21e8ac..754db36e3c 100644
--- a/src/net/interface_test.go
+++ b/src/net/interface_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/interface_unix_test.go b/src/net/interface_unix_test.go
index bf41a0fb82..0d69fa5da4 100644
--- a/src/net/interface_unix_test.go
+++ b/src/net/interface_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package net
diff --git a/src/net/internal/socktest/main_test.go b/src/net/internal/socktest/main_test.go
index 3b0a48aef4..8af85d382e 100644
--- a/src/net/internal/socktest/main_test.go
+++ b/src/net/internal/socktest/main_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9
// +build !js,!plan9
package socktest_test
diff --git a/src/net/internal/socktest/main_unix_test.go b/src/net/internal/socktest/main_unix_test.go
index 4d9d414356..6aa8875b66 100644
--- a/src/net/internal/socktest/main_unix_test.go
+++ b/src/net/internal/socktest/main_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9 && !windows
// +build !js,!plan9,!windows
package socktest_test
diff --git a/src/net/internal/socktest/switch_posix.go b/src/net/internal/socktest/switch_posix.go
index 863edef0d3..cda74e8639 100644
--- a/src/net/internal/socktest/switch_posix.go
+++ b/src/net/internal/socktest/switch_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package socktest
diff --git a/src/net/internal/socktest/switch_stub.go b/src/net/internal/socktest/switch_stub.go
index 28ce72cb85..5aa2ecec08 100644
--- a/src/net/internal/socktest/switch_stub.go
+++ b/src/net/internal/socktest/switch_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package socktest
diff --git a/src/net/internal/socktest/switch_unix.go b/src/net/internal/socktest/switch_unix.go
index 7dc3518410..bfe9d4dbd3 100644
--- a/src/net/internal/socktest/switch_unix.go
+++ b/src/net/internal/socktest/switch_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package socktest
diff --git a/src/net/internal/socktest/sys_cloexec.go b/src/net/internal/socktest/sys_cloexec.go
index 421352c7b4..c7f8331c2e 100644
--- a/src/net/internal/socktest/sys_cloexec.go
+++ b/src/net/internal/socktest/sys_cloexec.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build dragonfly freebsd illumos linux netbsd openbsd
package socktest
diff --git a/src/net/internal/socktest/sys_unix.go b/src/net/internal/socktest/sys_unix.go
index 0525512bff..e7cc45922e 100644
--- a/src/net/internal/socktest/sys_unix.go
+++ b/src/net/internal/socktest/sys_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package socktest
diff --git a/src/net/ip_test.go b/src/net/ip_test.go
index a5fc5e644a..1e09ae9db4 100644
--- a/src/net/ip_test.go
+++ b/src/net/ip_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/iprawsock_posix.go b/src/net/iprawsock_posix.go
index e653f6ae17..c1514f1698 100644
--- a/src/net/iprawsock_posix.go
+++ b/src/net/iprawsock_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/iprawsock_test.go b/src/net/iprawsock_test.go
index 8e3543dfc7..a96448ee6c 100644
--- a/src/net/iprawsock_test.go
+++ b/src/net/iprawsock_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/ipsock_posix.go b/src/net/ipsock_posix.go
index 8763d579fb..8d8a896501 100644
--- a/src/net/ipsock_posix.go
+++ b/src/net/ipsock_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/listen_test.go b/src/net/listen_test.go
index d8c72096ed..b1dce29ac2 100644
--- a/src/net/listen_test.go
+++ b/src/net/listen_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9
// +build !js,!plan9
package net
diff --git a/src/net/lookup_fake.go b/src/net/lookup_fake.go
index 3b3c39bc7d..f4fcaed5cf 100644
--- a/src/net/lookup_fake.go
+++ b/src/net/lookup_fake.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go
index 32a0d377da..3faaf00710 100644
--- a/src/net/lookup_test.go
+++ b/src/net/lookup_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/lookup_unix.go b/src/net/lookup_unix.go
index 9055826d40..c09afb300f 100644
--- a/src/net/lookup_unix.go
+++ b/src/net/lookup_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/main_cloexec_test.go b/src/net/main_cloexec_test.go
index 46b9ba5008..742be2fcd8 100644
--- a/src/net/main_cloexec_test.go
+++ b/src/net/main_cloexec_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build dragonfly freebsd illumos linux netbsd openbsd
package net
diff --git a/src/net/main_conf_test.go b/src/net/main_conf_test.go
index a92dff56c2..645b267b78 100644
--- a/src/net/main_conf_test.go
+++ b/src/net/main_conf_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9 && !windows
// +build !js,!plan9,!windows
package net
diff --git a/src/net/main_noconf_test.go b/src/net/main_noconf_test.go
index bac84aa300..bcea630cd3 100644
--- a/src/net/main_noconf_test.go
+++ b/src/net/main_noconf_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (js && wasm) || plan9 || windows
// +build js,wasm plan9 windows
package net
diff --git a/src/net/main_posix_test.go b/src/net/main_posix_test.go
index f2484f306d..c9ab25a4ad 100644
--- a/src/net/main_posix_test.go
+++ b/src/net/main_posix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9
// +build !js,!plan9
package net
diff --git a/src/net/main_test.go b/src/net/main_test.go
index 2d5be2ee5f..dc17d3fbb8 100644
--- a/src/net/main_test.go
+++ b/src/net/main_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/main_unix_test.go b/src/net/main_unix_test.go
index 8b9897699c..c8cff2d305 100644
--- a/src/net/main_unix_test.go
+++ b/src/net/main_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/mockserver_test.go b/src/net/mockserver_test.go
index 867e31e9ae..b50a1e59a1 100644
--- a/src/net/mockserver_test.go
+++ b/src/net/mockserver_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/net_fake.go b/src/net/net_fake.go
index 0c48dd5c03..49dc57c6ff 100644
--- a/src/net/net_fake.go
+++ b/src/net/net_fake.go
@@ -4,6 +4,7 @@
// Fake networking for js/wasm. It is intended to allow tests of other package to pass.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/net_test.go b/src/net/net_test.go
index 409e1400af..6d6299e74a 100644
--- a/src/net/net_test.go
+++ b/src/net/net_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/net_windows_test.go b/src/net/net_windows_test.go
index a0000950c6..2a563a078c 100644
--- a/src/net/net_windows_test.go
+++ b/src/net/net_windows_test.go
@@ -204,12 +204,17 @@ func runCmd(args ...string) ([]byte, error) {
return removeUTF8BOM(out), nil
}
-func netshSpeaksEnglish(t *testing.T) bool {
+func checkNetsh(t *testing.T) {
out, err := runCmd("netsh", "help")
if err != nil {
t.Fatal(err)
}
- return bytes.Contains(out, []byte("The following commands are available:"))
+ if bytes.Contains(out, []byte("The following helper DLL cannot be loaded")) {
+ t.Skipf("powershell failure:\n%s", err)
+ }
+ if !bytes.Contains(out, []byte("The following commands are available:")) {
+ t.Skipf("powershell does not speak English:\n%s", out)
+ }
}
func netshInterfaceIPShowInterface(ipver string, ifaces map[string]bool) error {
@@ -256,9 +261,7 @@ func netshInterfaceIPShowInterface(ipver string, ifaces map[string]bool) error {
}
func TestInterfacesWithNetsh(t *testing.T) {
- if !netshSpeaksEnglish(t) {
- t.Skip("English version of netsh required for this test")
- }
+ checkNetsh(t)
toString := func(name string, isup bool) string {
if isup {
@@ -427,9 +430,7 @@ func netshInterfaceIPv6ShowAddress(name string, netshOutput []byte) []string {
}
func TestInterfaceAddrsWithNetsh(t *testing.T) {
- if !netshSpeaksEnglish(t) {
- t.Skip("English version of netsh required for this test")
- }
+ checkNetsh(t)
outIPV4, err := runCmd("netsh", "interface", "ipv4", "show", "address")
if err != nil {
diff --git a/src/net/netgo_unix_test.go b/src/net/netgo_unix_test.go
index c672d3e8eb..0dfd6c2cd7 100644
--- a/src/net/netgo_unix_test.go
+++ b/src/net/netgo_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (!cgo || netgo) && (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris)
// +build !cgo netgo
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
diff --git a/src/net/nss.go b/src/net/nss.go
index 96b9cdd121..85177cab9b 100644
--- a/src/net/nss.go
+++ b/src/net/nss.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/nss_test.go b/src/net/nss_test.go
index 371deb502d..4b73886c51 100644
--- a/src/net/nss_test.go
+++ b/src/net/nss_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/packetconn_test.go b/src/net/packetconn_test.go
index a377d333d6..aeb9845fa7 100644
--- a/src/net/packetconn_test.go
+++ b/src/net/packetconn_test.go
@@ -5,6 +5,7 @@
// This file implements API tests across platforms and will never have a build
// tag.
+//go:build !js
// +build !js
package net
diff --git a/src/net/port_unix.go b/src/net/port_unix.go
index 4fdd9a37bc..a9a96a2323 100644
--- a/src/net/port_unix.go
+++ b/src/net/port_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
// Read system port mappings from /etc/services
diff --git a/src/net/protoconn_test.go b/src/net/protoconn_test.go
index 6f83f52681..fc9b386256 100644
--- a/src/net/protoconn_test.go
+++ b/src/net/protoconn_test.go
@@ -5,6 +5,7 @@
// This file implements API tests across platforms and will never have a build
// tag.
+//go:build !js
// +build !js
package net
diff --git a/src/net/rawconn_stub_test.go b/src/net/rawconn_stub_test.go
index cec977f75d..975aa8d956 100644
--- a/src/net/rawconn_stub_test.go
+++ b/src/net/rawconn_stub_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (js && wasm) || plan9
// +build js,wasm plan9
package net
diff --git a/src/net/rawconn_test.go b/src/net/rawconn_test.go
index a08ff89d1a..3ef7af33b7 100644
--- a/src/net/rawconn_test.go
+++ b/src/net/rawconn_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/rawconn_unix_test.go b/src/net/rawconn_unix_test.go
index 0194ba67c8..75bbab8b27 100644
--- a/src/net/rawconn_unix_test.go
+++ b/src/net/rawconn_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/rpc/server.go b/src/net/rpc/server.go
index 9cb928240f..074c5b9b0d 100644
--- a/src/net/rpc/server.go
+++ b/src/net/rpc/server.go
@@ -283,7 +283,7 @@ func suitableMethods(typ reflect.Type, reportErr bool) map[string]*methodType {
mtype := method.Type
mname := method.Name
// Method must be exported.
- if method.PkgPath != "" {
+ if !method.IsExported() {
continue
}
// Method needs three ins: receiver, *args, *reply.
diff --git a/src/net/sendfile_stub.go b/src/net/sendfile_stub.go
index 53bc53af43..5753bc0289 100644
--- a/src/net/sendfile_stub.go
+++ b/src/net/sendfile_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || (js && wasm) || netbsd || openbsd
// +build aix darwin js,wasm netbsd openbsd
package net
diff --git a/src/net/sendfile_test.go b/src/net/sendfile_test.go
index 657a36599f..db72daa328 100644
--- a/src/net/sendfile_test.go
+++ b/src/net/sendfile_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
@@ -10,8 +11,10 @@ import (
"bytes"
"crypto/sha256"
"encoding/hex"
+ "errors"
"fmt"
"io"
+ "io/ioutil"
"os"
"runtime"
"sync"
@@ -313,3 +316,66 @@ func TestSendfilePipe(t *testing.T) {
wg.Wait()
}
+
+// Issue 43822: tests that returns EOF when conn write timeout.
+func TestSendfileOnWriteTimeoutExceeded(t *testing.T) {
+ ln, err := newLocalListener("tcp")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer ln.Close()
+
+ errc := make(chan error, 1)
+ go func(ln Listener) (retErr error) {
+ defer func() {
+ errc <- retErr
+ close(errc)
+ }()
+
+ conn, err := ln.Accept()
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+
+ // Set the write deadline in the past(1h ago). It makes
+ // sure that it is always write timeout.
+ if err := conn.SetWriteDeadline(time.Now().Add(-1 * time.Hour)); err != nil {
+ return err
+ }
+
+ f, err := os.Open(newton)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ _, err = io.Copy(conn, f)
+ if errors.Is(err, os.ErrDeadlineExceeded) {
+ return nil
+ }
+
+ if err == nil {
+ err = fmt.Errorf("expected ErrDeadlineExceeded, but got nil")
+ }
+ return err
+ }(ln)
+
+ conn, err := Dial("tcp", ln.Addr().String())
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer conn.Close()
+
+ n, err := io.Copy(ioutil.Discard, conn)
+ if err != nil {
+ t.Fatalf("expected nil error, but got %v", err)
+ }
+ if n != 0 {
+ t.Fatalf("expected receive zero, but got %d byte(s)", n)
+ }
+
+ if err := <-errc; err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/src/net/sendfile_unix_alt.go b/src/net/sendfile_unix_alt.go
index 8cededce58..54667d672f 100644
--- a/src/net/sendfile_unix_alt.go
+++ b/src/net/sendfile_unix_alt.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || solaris
// +build dragonfly freebsd solaris
package net
diff --git a/src/net/server_test.go b/src/net/server_test.go
index 4ac5443e6a..8d4db7233d 100644
--- a/src/net/server_test.go
+++ b/src/net/server_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/sock_bsd.go b/src/net/sock_bsd.go
index 73fb6be814..4c883ada78 100644
--- a/src/net/sock_bsd.go
+++ b/src/net/sock_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package net
diff --git a/src/net/sock_cloexec.go b/src/net/sock_cloexec.go
index 5f345f0f4a..efc91fdb53 100644
--- a/src/net/sock_cloexec.go
+++ b/src/net/sock_cloexec.go
@@ -5,6 +5,7 @@
// This file implements sysSocket and accept for platforms that
// provide a fast path for setting SetNonblock and CloseOnExec.
+//go:build dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build dragonfly freebsd illumos linux netbsd openbsd
package net
diff --git a/src/net/sock_posix.go b/src/net/sock_posix.go
index 80b4169ec6..9b1e7880ae 100644
--- a/src/net/sock_posix.go
+++ b/src/net/sock_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package net
diff --git a/src/net/sock_stub.go b/src/net/sock_stub.go
index c9f86af4e7..d804bfaacc 100644
--- a/src/net/sock_stub.go
+++ b/src/net/sock_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || (js && wasm) || solaris
// +build aix js,wasm solaris
package net
diff --git a/src/net/sockaddr_posix.go b/src/net/sockaddr_posix.go
index a3710dd3f7..9d77cb569b 100644
--- a/src/net/sockaddr_posix.go
+++ b/src/net/sockaddr_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/sockopt_bsd.go b/src/net/sockopt_bsd.go
index 8fd1e882c6..216e5d52f1 100644
--- a/src/net/sockopt_bsd.go
+++ b/src/net/sockopt_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package net
diff --git a/src/net/sockopt_posix.go b/src/net/sockopt_posix.go
index de7255667f..50b9bfa0a7 100644
--- a/src/net/sockopt_posix.go
+++ b/src/net/sockopt_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package net
diff --git a/src/net/sockopt_stub.go b/src/net/sockopt_stub.go
index 52624a35d8..99b5277ed0 100644
--- a/src/net/sockopt_stub.go
+++ b/src/net/sockopt_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/sockoptip_bsdvar.go b/src/net/sockoptip_bsdvar.go
index 20a6dc9549..56022fd1a5 100644
--- a/src/net/sockoptip_bsdvar.go
+++ b/src/net/sockoptip_bsdvar.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd netbsd openbsd solaris
package net
diff --git a/src/net/sockoptip_posix.go b/src/net/sockoptip_posix.go
index b14963ff32..a2143aec2c 100644
--- a/src/net/sockoptip_posix.go
+++ b/src/net/sockoptip_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package net
diff --git a/src/net/sockoptip_stub.go b/src/net/sockoptip_stub.go
index 57cd289040..4175922cec 100644
--- a/src/net/sockoptip_stub.go
+++ b/src/net/sockoptip_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/splice_stub.go b/src/net/splice_stub.go
index 9106cb2c18..ce2e9046a9 100644
--- a/src/net/splice_stub.go
+++ b/src/net/splice_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux
// +build !linux
package net
diff --git a/src/net/splice_test.go b/src/net/splice_test.go
index 8a0cda6564..be13cc924d 100644
--- a/src/net/splice_test.go
+++ b/src/net/splice_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package net
diff --git a/src/net/sys_cloexec.go b/src/net/sys_cloexec.go
index 967b8bea9d..4d7112051f 100644
--- a/src/net/sys_cloexec.go
+++ b/src/net/sys_cloexec.go
@@ -5,6 +5,7 @@
// This file implements sysSocket and accept for platforms that do not
// provide a fast path for setting SetNonblock and CloseOnExec.
+//go:build aix || darwin || (solaris && !illumos)
// +build aix darwin solaris,!illumos
package net
diff --git a/src/net/tcpsock_posix.go b/src/net/tcpsock_posix.go
index 257c11976f..7c4523c5ee 100644
--- a/src/net/tcpsock_posix.go
+++ b/src/net/tcpsock_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/tcpsock_test.go b/src/net/tcpsock_test.go
index d6172bc503..9c9f1eae93 100644
--- a/src/net/tcpsock_test.go
+++ b/src/net/tcpsock_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/tcpsock_unix_test.go b/src/net/tcpsock_unix_test.go
index 2bd591b594..41bd229132 100644
--- a/src/net/tcpsock_unix_test.go
+++ b/src/net/tcpsock_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9 && !windows
// +build !js,!plan9,!windows
package net
diff --git a/src/net/tcpsockopt_posix.go b/src/net/tcpsockopt_posix.go
index 5e00ba1564..d08832adc0 100644
--- a/src/net/tcpsockopt_posix.go
+++ b/src/net/tcpsockopt_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
package net
diff --git a/src/net/tcpsockopt_stub.go b/src/net/tcpsockopt_stub.go
index d043da123d..028d5fd29c 100644
--- a/src/net/tcpsockopt_stub.go
+++ b/src/net/tcpsockopt_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package net
diff --git a/src/net/tcpsockopt_unix.go b/src/net/tcpsockopt_unix.go
index fb0ecb8dc7..a945889e00 100644
--- a/src/net/tcpsockopt_unix.go
+++ b/src/net/tcpsockopt_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || freebsd || linux || netbsd
// +build aix freebsd linux netbsd
package net
diff --git a/src/net/timeout_test.go b/src/net/timeout_test.go
index 205aaa430b..e1cf1467c3 100644
--- a/src/net/timeout_test.go
+++ b/src/net/timeout_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/udpsock_posix.go b/src/net/udpsock_posix.go
index bbfa4ed9c7..58c69f18ad 100644
--- a/src/net/udpsock_posix.go
+++ b/src/net/udpsock_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/udpsock_test.go b/src/net/udpsock_test.go
index 327eba6541..7a1ed4eb18 100644
--- a/src/net/udpsock_test.go
+++ b/src/net/udpsock_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/unixsock_posix.go b/src/net/unixsock_posix.go
index 275c7c936d..1d1f27449f 100644
--- a/src/net/unixsock_posix.go
+++ b/src/net/unixsock_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package net
diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go
index 0b13bf655f..71092e88fb 100644
--- a/src/net/unixsock_test.go
+++ b/src/net/unixsock_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js && !plan9 && !windows
// +build !js,!plan9,!windows
package net
diff --git a/src/net/unixsock_windows_test.go b/src/net/unixsock_windows_test.go
index 5dccc14653..29244f6471 100644
--- a/src/net/unixsock_windows_test.go
+++ b/src/net/unixsock_windows_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package net
diff --git a/src/net/write_unix_test.go b/src/net/write_unix_test.go
index 6d8cb6a6f8..f79f2d0865 100644
--- a/src/net/write_unix_test.go
+++ b/src/net/write_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
package net
diff --git a/src/net/writev_test.go b/src/net/writev_test.go
index d603b7f70a..bf40ca2023 100644
--- a/src/net/writev_test.go
+++ b/src/net/writev_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package net
diff --git a/src/net/writev_unix.go b/src/net/writev_unix.go
index 8b20f42b34..a0fedc2f99 100644
--- a/src/net/writev_unix.go
+++ b/src/net/writev_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || illumos || linux || netbsd || openbsd
// +build darwin dragonfly freebsd illumos linux netbsd openbsd
package net
diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go
index 0e1eab1c96..ef5c00aee0 100644
--- a/src/os/dir_unix.go
+++ b/src/os/dir_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/endian_big.go b/src/os/endian_big.go
index c98f124782..0529dccd6f 100644
--- a/src/os/endian_big.go
+++ b/src/os/endian_big.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
+//go:build ppc64 || s390x || mips || mips64
// +build ppc64 s390x mips mips64
package os
diff --git a/src/os/endian_little.go b/src/os/endian_little.go
index 3efc5e0d8d..6be6020f53 100644
--- a/src/os/endian_little.go
+++ b/src/os/endian_little.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
+//go:build 386 || amd64 || arm || arm64 || ppc64le || mips64le || mipsle || riscv64 || wasm
// +build 386 amd64 arm arm64 ppc64le mips64le mipsle riscv64 wasm
package os
diff --git a/src/os/env_unix_test.go b/src/os/env_unix_test.go
index 89430b3e20..d45e1deb83 100644
--- a/src/os/env_unix_test.go
+++ b/src/os/env_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os_test
diff --git a/src/os/error_errno.go b/src/os/error_errno.go
index 31ae05a21e..580e915b73 100644
--- a/src/os/error_errno.go
+++ b/src/os/error_errno.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package os
diff --git a/src/os/error_posix.go b/src/os/error_posix.go
index 2aeca82304..268b3a923a 100644
--- a/src/os/error_posix.go
+++ b/src/os/error_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package os
diff --git a/src/os/error_unix_test.go b/src/os/error_unix_test.go
index 18bcf3f4e4..e45282a0fd 100644
--- a/src/os/error_unix_test.go
+++ b/src/os/error_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os_test
diff --git a/src/os/error_windows_test.go b/src/os/error_windows_test.go
index b8191c5ebc..aa0c14b7d4 100644
--- a/src/os/error_windows_test.go
+++ b/src/os/error_windows_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows
// +build windows
package os_test
diff --git a/src/os/exec/exec_linux_test.go b/src/os/exec/exec_linux_test.go
index 6f850204d6..3cfa30ee72 100644
--- a/src/os/exec/exec_linux_test.go
+++ b/src/os/exec/exec_linux_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && cgo
// +build linux,cgo
// On systems that use glibc, calling malloc can create a new arena,
diff --git a/src/os/exec/exec_posix_test.go b/src/os/exec/exec_posix_test.go
index d4d67ac933..7b2c0c0c11 100644
--- a/src/os/exec/exec_posix_test.go
+++ b/src/os/exec/exec_posix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package exec_test
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go
index 8b0c93f382..57591a38ab 100644
--- a/src/os/exec/exec_test.go
+++ b/src/os/exec/exec_test.go
@@ -915,6 +915,16 @@ func TestHelperProcess(*testing.T) {
case "sleep":
time.Sleep(3 * time.Second)
os.Exit(0)
+ case "pipehandle":
+ handle, _ := strconv.ParseUint(args[0], 16, 64)
+ pipe := os.NewFile(uintptr(handle), "")
+ _, err := fmt.Fprint(pipe, args[1])
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "writing to pipe failed: %v\n", err)
+ os.Exit(1)
+ }
+ pipe.Close()
+ os.Exit(0)
default:
fmt.Fprintf(os.Stderr, "Unknown command %q\n", cmd)
os.Exit(2)
diff --git a/src/os/exec/exec_unix.go b/src/os/exec/exec_unix.go
index 51c52427c2..467c069e1c 100644
--- a/src/os/exec/exec_unix.go
+++ b/src/os/exec/exec_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9 && !windows
// +build !plan9,!windows
package exec
diff --git a/src/os/exec/exec_windows_test.go b/src/os/exec/exec_windows_test.go
new file mode 100644
index 0000000000..fbccffec0e
--- /dev/null
+++ b/src/os/exec/exec_windows_test.go
@@ -0,0 +1,43 @@
+// Copyright 2021 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.
+
+//go:build windows
+// +build windows
+
+package exec_test
+
+import (
+ "io"
+ "os"
+ "strconv"
+ "syscall"
+ "testing"
+)
+
+func TestPipePassing(t *testing.T) {
+ r, w, err := os.Pipe()
+ if err != nil {
+ t.Error(err)
+ }
+ const marker = "arrakis, dune, desert planet"
+ childProc := helperCommand(t, "pipehandle", strconv.FormatUint(uint64(w.Fd()), 16), marker)
+ childProc.SysProcAttr = &syscall.SysProcAttr{AdditionalInheritedHandles: []syscall.Handle{syscall.Handle(w.Fd())}}
+ err = childProc.Start()
+ if err != nil {
+ t.Error(err)
+ }
+ w.Close()
+ response, err := io.ReadAll(r)
+ if err != nil {
+ t.Error(err)
+ }
+ r.Close()
+ if string(response) != marker {
+ t.Errorf("got %q; want %q", string(response), marker)
+ }
+ err = childProc.Wait()
+ if err != nil {
+ t.Error(err)
+ }
+}
diff --git a/src/os/exec/lp_js.go b/src/os/exec/lp_js.go
index 6750fb99b0..4eac25fe6f 100644
--- a/src/os/exec/lp_js.go
+++ b/src/os/exec/lp_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package exec
diff --git a/src/os/exec/lp_unix.go b/src/os/exec/lp_unix.go
index 66c1df76fb..d1d246accf 100644
--- a/src/os/exec/lp_unix.go
+++ b/src/os/exec/lp_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package exec
diff --git a/src/os/exec/lp_unix_test.go b/src/os/exec/lp_unix_test.go
index 296480fd04..75bcdb1fdd 100644
--- a/src/os/exec/lp_unix_test.go
+++ b/src/os/exec/lp_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package exec
diff --git a/src/os/exec/lp_windows_test.go b/src/os/exec/lp_windows_test.go
index c6f3d5d406..56cb54f800 100644
--- a/src/os/exec/lp_windows_test.go
+++ b/src/os/exec/lp_windows_test.go
@@ -143,7 +143,7 @@ func (test lookPathTest) run(t *testing.T, tmpdir, printpathExe string) {
if errCmd == nil && errLP == nil {
// both succeeded
if should != have {
- t.Fatalf("test=%+v failed: expected to find %q, but found %q", test, should, have)
+ t.Fatalf("test=%+v:\ncmd /c ran: %s\nlookpath found: %s", test, should, have)
}
return
}
@@ -316,12 +316,17 @@ func TestLookPath(t *testing.T) {
// Run all tests.
for i, test := range lookPathTests {
- dir := filepath.Join(tmp, "d"+strconv.Itoa(i))
- err := os.Mkdir(dir, 0700)
- if err != nil {
- t.Fatal("Mkdir failed: ", err)
- }
- test.run(t, dir, printpathExe)
+ t.Run(fmt.Sprint(i), func(t *testing.T) {
+ if i == 16 {
+ t.Skip("golang.org/issue/44379")
+ }
+ dir := filepath.Join(tmp, "d"+strconv.Itoa(i))
+ err := os.Mkdir(dir, 0700)
+ if err != nil {
+ t.Fatal("Mkdir failed: ", err)
+ }
+ test.run(t, dir, printpathExe)
+ })
}
}
diff --git a/src/os/exec/read3.go b/src/os/exec/read3.go
index 8cc24da8cb..a8c71831d8 100644
--- a/src/os/exec/read3.go
+++ b/src/os/exec/read3.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This is a test program that verifies that it can read from
diff --git a/src/os/exec_posix.go b/src/os/exec_posix.go
index 7ecddaed37..443d4e0218 100644
--- a/src/os/exec_posix.go
+++ b/src/os/exec_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package os
@@ -102,7 +103,12 @@ func (p *ProcessState) String() string {
res := ""
switch {
case status.Exited():
- res = "exit status " + itoa(status.ExitStatus())
+ code := status.ExitStatus()
+ if runtime.GOOS == "windows" && uint(code) >= 1<<16 { // windows uses large hex numbers
+ res = "exit status " + uitox(uint(code))
+ } else { // unix systems use small decimal integers
+ res = "exit status " + itoa(code) // unix
+ }
case status.Signaled():
res = "signal: " + status.Signal().String()
case status.Stopped():
diff --git a/src/os/exec_unix.go b/src/os/exec_unix.go
index a1703a1259..d1bbeb7529 100644
--- a/src/os/exec_unix.go
+++ b/src/os/exec_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/exec_unix_test.go b/src/os/exec_unix_test.go
index d942cdb5e5..f14b3519fb 100644
--- a/src/os/exec_unix_test.go
+++ b/src/os/exec_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os_test
diff --git a/src/os/executable_path.go b/src/os/executable_path.go
index 7b8b83652c..625430ecfc 100644
--- a/src/os/executable_path.go
+++ b/src/os/executable_path.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || openbsd
// +build aix openbsd
package os
diff --git a/src/os/executable_plan9.go b/src/os/executable_plan9.go
index a5947eaae1..105c03f0c1 100644
--- a/src/os/executable_plan9.go
+++ b/src/os/executable_plan9.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package os
diff --git a/src/os/executable_procfs.go b/src/os/executable_procfs.go
index 5ee41a4b2e..9c64a0d474 100644
--- a/src/os/executable_procfs.go
+++ b/src/os/executable_procfs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux || netbsd || (js && wasm)
// +build linux netbsd js,wasm
package os
diff --git a/src/os/executable_sysctl.go b/src/os/executable_sysctl.go
index f9a4b18f60..039448b557 100644
--- a/src/os/executable_sysctl.go
+++ b/src/os/executable_sysctl.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd || dragonfly
// +build freebsd dragonfly
package os
diff --git a/src/os/export_unix_test.go b/src/os/export_unix_test.go
index 39866a68de..10f8312831 100644
--- a/src/os/export_unix_test.go
+++ b/src/os/export_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/fifo_test.go b/src/os/fifo_test.go
index 2439192a9d..c3607344ec 100644
--- a/src/os/fifo_test.go
+++ b/src/os/fifo_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package os_test
diff --git a/src/os/file.go b/src/os/file.go
index 416bc0efa6..ebeb0d0ac9 100644
--- a/src/os/file.go
+++ b/src/os/file.go
@@ -44,11 +44,13 @@ import (
"errors"
"internal/poll"
"internal/testlog"
+ "internal/unsafeheader"
"io"
"io/fs"
"runtime"
"syscall"
"time"
+ "unsafe"
)
// Name returns the name of the file as presented to Open.
@@ -246,7 +248,12 @@ func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
// WriteString is like Write, but writes the contents of string s rather than
// a slice of bytes.
func (f *File) WriteString(s string) (n int, err error) {
- return f.Write([]byte(s))
+ var b []byte
+ hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b))
+ hdr.Data = (*unsafeheader.String)(unsafe.Pointer(&s)).Data
+ hdr.Cap = len(s)
+ hdr.Len = len(s)
+ return f.Write(b)
}
// Mkdir creates a new directory with the specified name and permission
@@ -620,10 +627,21 @@ func DirFS(dir string) fs.FS {
return dirFS(dir)
}
+func containsAny(s, chars string) bool {
+ for i := 0; i < len(s); i++ {
+ for j := 0; j < len(chars); j++ {
+ if s[i] == chars[j] {
+ return true
+ }
+ }
+ }
+ return false
+}
+
type dirFS string
func (dir dirFS) Open(name string) (fs.File, error) {
- if !fs.ValidPath(name) {
+ if !fs.ValidPath(name) || runtime.GOOS == "windows" && containsAny(name, `\:`) {
return nil, &PathError{Op: "open", Path: name, Err: ErrInvalid}
}
f, err := Open(string(dir) + "/" + name)
diff --git a/src/os/file_posix.go b/src/os/file_posix.go
index 795c547856..211f2a1798 100644
--- a/src/os/file_posix.go
+++ b/src/os/file_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package os
diff --git a/src/os/file_unix.go b/src/os/file_unix.go
index f88450018e..e8b286c9ee 100644
--- a/src/os/file_unix.go
+++ b/src/os/file_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/file_windows.go b/src/os/file_windows.go
index dfc5fc6ce6..0d3c048a75 100644
--- a/src/os/file_windows.go
+++ b/src/os/file_windows.go
@@ -279,10 +279,11 @@ func rename(oldname, newname string) error {
}
// Pipe returns a connected pair of Files; reads from r return bytes written to w.
-// It returns the files and an error, if any.
+// It returns the files and an error, if any. The Windows handles underlying
+// the returned files are marked as inheritable by child processes.
func Pipe() (r *File, w *File, err error) {
var p [2]syscall.Handle
- e := syscall.CreatePipe(&p[0], &p[1], nil, 0)
+ e := syscall.Pipe(p[:])
if e != nil {
return nil, nil, NewSyscallError("pipe", e)
}
diff --git a/src/os/os_test.go b/src/os/os_test.go
index ee54b4aba1..f27c796c05 100644
--- a/src/os/os_test.go
+++ b/src/os/os_test.go
@@ -2719,6 +2719,40 @@ func TestDirFS(t *testing.T) {
if err := fstest.TestFS(DirFS("./testdata/dirfs"), "a", "b", "dir/x"); err != nil {
t.Fatal(err)
}
+
+ // Test that Open does not accept backslash as separator.
+ d := DirFS(".")
+ _, err := d.Open(`testdata\dirfs`)
+ if err == nil {
+ t.Fatalf(`Open testdata\dirfs succeeded`)
+ }
+}
+
+func TestDirFSPathsValid(t *testing.T) {
+ if runtime.GOOS == "windows" {
+ t.Skipf("skipping on Windows")
+ }
+
+ d := t.TempDir()
+ if err := os.WriteFile(filepath.Join(d, "control.txt"), []byte(string("Hello, world!")), 0644); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(filepath.Join(d, `e:xperi\ment.txt`), []byte(string("Hello, colon and backslash!")), 0644); err != nil {
+ t.Fatal(err)
+ }
+
+ fsys := os.DirFS(d)
+ err := fs.WalkDir(fsys, ".", func(path string, e fs.DirEntry, err error) error {
+ if fs.ValidPath(e.Name()) {
+ t.Logf("%q ok", e.Name())
+ } else {
+ t.Errorf("%q INVALID", e.Name())
+ }
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
}
func TestReadFileProc(t *testing.T) {
@@ -2739,3 +2773,21 @@ func TestReadFileProc(t *testing.T) {
t.Fatalf("read %s: not newline-terminated: %q", name, data)
}
}
+
+func TestWriteStringAlloc(t *testing.T) {
+ if runtime.GOOS == "js" {
+ t.Skip("js allocates a lot during File.WriteString")
+ }
+ d := t.TempDir()
+ f, err := Create(filepath.Join(d, "whiteboard.txt"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+ allocs := testing.AllocsPerRun(100, func() {
+ f.WriteString("I will not allocate when passed a string longer than 32 bytes.\n")
+ })
+ if allocs != 0 {
+ t.Errorf("expected 0 allocs for File.WriteString, got %v", allocs)
+ }
+}
diff --git a/src/os/os_unix_test.go b/src/os/os_unix_test.go
index 51693fd82a..9b4c0ab290 100644
--- a/src/os/os_unix_test.go
+++ b/src/os/os_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os_test
diff --git a/src/os/path_unix.go b/src/os/path_unix.go
index c99a8240c5..db38359492 100644
--- a/src/os/path_unix.go
+++ b/src/os/path_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/pipe2_bsd.go b/src/os/pipe2_bsd.go
index 0ef894b476..bf6d081db5 100644
--- a/src/os/pipe2_bsd.go
+++ b/src/os/pipe2_bsd.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build freebsd netbsd openbsd
+//go:build dragonfly || freebsd || netbsd || openbsd
+// +build dragonfly freebsd netbsd openbsd
package os
diff --git a/src/os/pipe2_illumos.go b/src/os/pipe2_illumos.go
index 026ce62b9a..71b8cb8e25 100644
--- a/src/os/pipe2_illumos.go
+++ b/src/os/pipe2_illumos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
package os
diff --git a/src/os/pipe_bsd.go b/src/os/pipe_bsd.go
index 115d6baa19..097b32e7eb 100644
--- a/src/os/pipe_bsd.go
+++ b/src/os/pipe_bsd.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build aix darwin dragonfly js,wasm solaris,!illumos
+//go:build aix || darwin || (js && wasm) || (solaris && !illumos)
+// +build aix darwin js,wasm solaris,!illumos
package os
diff --git a/src/os/pipe_test.go b/src/os/pipe_test.go
index b98e53845c..b663618502 100644
--- a/src/os/pipe_test.go
+++ b/src/os/pipe_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// Test broken pipes on Unix systems.
+//go:build !plan9 && !js
// +build !plan9,!js
package os_test
diff --git a/src/os/rawconn.go b/src/os/rawconn.go
index 9e11cda8c9..ffc598b061 100644
--- a/src/os/rawconn.go
+++ b/src/os/rawconn.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9
// +build !plan9
package os
diff --git a/src/os/rawconn_test.go b/src/os/rawconn_test.go
index 2554f5b087..8aebaf87a6 100644
--- a/src/os/rawconn_test.go
+++ b/src/os/rawconn_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// Test use of raw connections.
+//go:build !plan9 && !js
// +build !plan9,!js
package os_test
diff --git a/src/os/readfrom_linux_test.go b/src/os/readfrom_linux_test.go
index 37047175e6..cb6a59abdb 100644
--- a/src/os/readfrom_linux_test.go
+++ b/src/os/readfrom_linux_test.go
@@ -106,7 +106,7 @@ func TestCopyFileRange(t *testing.T) {
t.Fatal(err)
}
if n != int64(len(data)) {
- t.Fatalf("transfered %d, want %d", n, len(data))
+ t.Fatalf("transferred %d, want %d", n, len(data))
}
if !hook.called {
t.Fatalf("should have called poll.CopyFileRange")
@@ -130,7 +130,7 @@ func TestCopyFileRange(t *testing.T) {
t.Fatal(err)
}
if n != int64(len(data)) {
- t.Fatalf("transfered %d, want %d", n, len(data))
+ t.Fatalf("transferred %d, want %d", n, len(data))
}
if !hook.called {
t.Fatalf("should have called poll.CopyFileRange")
@@ -162,7 +162,7 @@ func TestCopyFileRange(t *testing.T) {
t.Fatal(err)
}
if n != int64(len(data)) {
- t.Fatalf("transfered %d, want %d", n, len(data))
+ t.Fatalf("transferred %d, want %d", n, len(data))
}
if !hook.called {
t.Fatalf("should have called poll.CopyFileRange")
@@ -361,3 +361,35 @@ func (h *copyFileRangeHook) install() {
func (h *copyFileRangeHook) uninstall() {
*PollCopyFileRangeP = h.original
}
+
+// On some kernels copy_file_range fails on files in /proc.
+func TestProcCopy(t *testing.T) {
+ const cmdlineFile = "/proc/self/cmdline"
+ cmdline, err := os.ReadFile(cmdlineFile)
+ if err != nil {
+ t.Skipf("can't read /proc file: %v", err)
+ }
+ in, err := os.Open(cmdlineFile)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer in.Close()
+ outFile := filepath.Join(t.TempDir(), "cmdline")
+ out, err := os.Create(outFile)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if _, err := io.Copy(out, in); err != nil {
+ t.Fatal(err)
+ }
+ if err := out.Close(); err != nil {
+ t.Fatal(err)
+ }
+ copy, err := os.ReadFile(outFile)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Equal(cmdline, copy) {
+ t.Errorf("copy of %q got %q want %q\n", cmdlineFile, copy, cmdline)
+ }
+}
diff --git a/src/os/readfrom_stub.go b/src/os/readfrom_stub.go
index 65429d0cab..826760f3df 100644
--- a/src/os/readfrom_stub.go
+++ b/src/os/readfrom_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux
// +build !linux
package os
diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go
index c1a1b726af..d04540bc63 100644
--- a/src/os/removeall_at.go
+++ b/src/os/removeall_at.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os
diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go
index 7c888baaa9..853e0eddfc 100644
--- a/src/os/removeall_noat.go
+++ b/src/os/removeall_noat.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !aix && !darwin && !dragonfly && !freebsd && !linux && !netbsd && !openbsd && !solaris
// +build !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd,!solaris
package os
diff --git a/src/os/signal/example_unix_test.go b/src/os/signal/example_unix_test.go
index a0af37a5bb..3f7795b8cf 100644
--- a/src/os/signal/example_unix_test.go
+++ b/src/os/signal/example_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package signal_test
diff --git a/src/os/signal/internal/pty/pty.go b/src/os/signal/internal/pty/pty.go
index f8813ce6be..8d2eac7103 100644
--- a/src/os/signal/internal/pty/pty.go
+++ b/src/os/signal/internal/pty/pty.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (aix || darwin || dragonfly || freebsd || (linux && !android) || netbsd || openbsd) && cgo
// +build aix darwin dragonfly freebsd linux,!android netbsd openbsd
// +build cgo
diff --git a/src/os/signal/signal_cgo_test.go b/src/os/signal/signal_cgo_test.go
index a8a485613f..e1e4509e2a 100644
--- a/src/os/signal/signal_cgo_test.go
+++ b/src/os/signal/signal_cgo_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (darwin || dragonfly || freebsd || (linux && !android) || netbsd || openbsd) && cgo
// +build darwin dragonfly freebsd linux,!android netbsd openbsd
// +build cgo
diff --git a/src/os/signal/signal_linux_test.go b/src/os/signal/signal_linux_test.go
index 2e553d0b0f..7abe1ec5a0 100644
--- a/src/os/signal/signal_linux_test.go
+++ b/src/os/signal/signal_linux_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package signal
diff --git a/src/os/signal/signal_test.go b/src/os/signal/signal_test.go
index bbc68af9fb..292d24c6f1 100644
--- a/src/os/signal/signal_test.go
+++ b/src/os/signal/signal_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package signal
diff --git a/src/os/signal/signal_unix.go b/src/os/signal/signal_unix.go
index 90a1eca156..9e241c43ac 100644
--- a/src/os/signal/signal_unix.go
+++ b/src/os/signal/signal_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package signal
diff --git a/src/os/stat_js.go b/src/os/stat_js.go
index 8d20ccddfc..3badf5ba57 100644
--- a/src/os/stat_js.go
+++ b/src/os/stat_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package os
diff --git a/src/os/stat_unix.go b/src/os/stat_unix.go
index 66c356fc62..8c17805f71 100644
--- a/src/os/stat_unix.go
+++ b/src/os/stat_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package os
diff --git a/src/os/sticky_bsd.go b/src/os/sticky_bsd.go
index c09b1ac202..ab23d8111d 100644
--- a/src/os/sticky_bsd.go
+++ b/src/os/sticky_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm netbsd openbsd solaris
package os
diff --git a/src/os/sticky_notbsd.go b/src/os/sticky_notbsd.go
index c15850692c..9979b43e8e 100644
--- a/src/os/sticky_notbsd.go
+++ b/src/os/sticky_notbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !aix && !darwin && !dragonfly && !freebsd && (!js || !wasm) && !netbsd && !openbsd && !solaris
// +build !aix
// +build !darwin
// +build !dragonfly
diff --git a/src/os/str.go b/src/os/str.go
index cba9fa3e8d..9bfcc15aa8 100644
--- a/src/os/str.go
+++ b/src/os/str.go
@@ -6,7 +6,7 @@
package os
-// Convert integer to decimal string
+// itoa converts val (an int) to a decimal string.
func itoa(val int) string {
if val < 0 {
return "-" + uitoa(uint(-val))
@@ -14,7 +14,7 @@ func itoa(val int) string {
return uitoa(uint(val))
}
-// Convert unsigned integer to decimal string
+// uitoa converts val (a uint) to a decimal string.
func uitoa(val uint) string {
if val == 0 { // avoid string allocation
return "0"
@@ -31,3 +31,35 @@ func uitoa(val uint) string {
buf[i] = byte('0' + val)
return string(buf[i:])
}
+
+// itox converts val (an int) to a hexdecimal string.
+func itox(val int) string {
+ if val < 0 {
+ return "-" + uitox(uint(-val))
+ }
+ return uitox(uint(val))
+}
+
+const hex = "0123456789abcdef"
+
+// uitox converts val (a uint) to a hexdecimal string.
+func uitox(val uint) string {
+ if val == 0 { // avoid string allocation
+ return "0x0"
+ }
+ var buf [20]byte // big enough for 64bit value base 16 + 0x
+ i := len(buf) - 1
+ for val >= 16 {
+ q := val / 16
+ buf[i] = hex[val%16]
+ i--
+ val = q
+ }
+ // val < 16
+ buf[i] = hex[val%16]
+ i--
+ buf[i] = 'x'
+ i--
+ buf[i] = '0'
+ return string(buf[i:])
+}
diff --git a/src/os/sys_bsd.go b/src/os/sys_bsd.go
index b1698f5d4c..1e245eb53a 100644
--- a/src/os/sys_bsd.go
+++ b/src/os/sys_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || (js && wasm) || netbsd || openbsd
// +build darwin dragonfly freebsd js,wasm netbsd openbsd
package os
diff --git a/src/os/sys_js.go b/src/os/sys_js.go
index e860654f81..4d6a64e8eb 100644
--- a/src/os/sys_js.go
+++ b/src/os/sys_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package os
diff --git a/src/os/sys_unix.go b/src/os/sys_unix.go
index 8491bad242..e316eaf06c 100644
--- a/src/os/sys_unix.go
+++ b/src/os/sys_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package os
diff --git a/src/os/timeout_test.go b/src/os/timeout_test.go
index 0a39f46333..6d65e420f0 100644
--- a/src/os/timeout_test.go
+++ b/src/os/timeout_test.go
@@ -2,9 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !js
-// +build !plan9
-// +build !windows
+//go:build !js && !plan9 && !windows
+// +build !js,!plan9,!windows
package os_test
diff --git a/src/os/types_unix.go b/src/os/types_unix.go
index c0259ae0e8..e9b8b8ba3a 100644
--- a/src/os/types_unix.go
+++ b/src/os/types_unix.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !windows
-// +build !plan9
+//go:build !windows && !plan9
+// +build !windows,!plan9
package os
diff --git a/src/os/user/cgo_lookup_unix.go b/src/os/user/cgo_lookup_unix.go
index 3307f790ea..abc9e9ce6d 100644
--- a/src/os/user/cgo_lookup_unix.go
+++ b/src/os/user/cgo_lookup_unix.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (aix || darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && cgo && !osusergo
// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/cgo_unix_test.go b/src/os/user/cgo_unix_test.go
index 1d341aa427..9ec32b3a78 100644
--- a/src/os/user/cgo_unix_test.go
+++ b/src/os/user/cgo_unix_test.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && cgo && !osusergo
// +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/getgrouplist_darwin.go b/src/os/user/getgrouplist_darwin.go
index e8fe26c47f..23d12e3247 100644
--- a/src/os/user/getgrouplist_darwin.go
+++ b/src/os/user/getgrouplist_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !osusergo
// +build cgo,!osusergo
package user
diff --git a/src/os/user/getgrouplist_unix.go b/src/os/user/getgrouplist_unix.go
index 9685414fc0..8393c5a474 100644
--- a/src/os/user/getgrouplist_unix.go
+++ b/src/os/user/getgrouplist_unix.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (dragonfly || freebsd || (!android && linux) || netbsd || openbsd) && cgo && !osusergo
// +build dragonfly freebsd !android,linux netbsd openbsd
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/listgroups_aix.go b/src/os/user/listgroups_aix.go
index 17de3e98d4..d2fdfdc6b1 100644
--- a/src/os/user/listgroups_aix.go
+++ b/src/os/user/listgroups_aix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !osusergo
// +build cgo,!osusergo
package user
diff --git a/src/os/user/listgroups_solaris.go b/src/os/user/listgroups_solaris.go
index f3cbf6ce4a..d993d30570 100644
--- a/src/os/user/listgroups_solaris.go
+++ b/src/os/user/listgroups_solaris.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo && !osusergo
// +build cgo,!osusergo
// Even though this file requires no C, it is used to provide a
diff --git a/src/os/user/listgroups_unix.go b/src/os/user/listgroups_unix.go
index 70f7af7f97..c7b72062d5 100644
--- a/src/os/user/listgroups_unix.go
+++ b/src/os/user/listgroups_unix.go
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (dragonfly || darwin || freebsd || (!android && linux) || netbsd || openbsd) && cgo && !osusergo
// +build dragonfly darwin freebsd !android,linux netbsd openbsd
-// +build cgo,!osusergo
+// +build cgo
+// +build !osusergo
package user
diff --git a/src/os/user/lookup_android.go b/src/os/user/lookup_android.go
index 8ca30b8c27..151aab49c2 100644
--- a/src/os/user/lookup_android.go
+++ b/src/os/user/lookup_android.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build android
// +build android
package user
diff --git a/src/os/user/lookup_stubs.go b/src/os/user/lookup_stubs.go
index 178d814dda..c975a11964 100644
--- a/src/os/user/lookup_stubs.go
+++ b/src/os/user/lookup_stubs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (!cgo && !windows && !plan9) || android || (osusergo && !windows && !plan9)
// +build !cgo,!windows,!plan9 android osusergo,!windows,!plan9
package user
diff --git a/src/os/user/lookup_unix.go b/src/os/user/lookup_unix.go
index 0890cd8f2b..ed8c2dee9d 100644
--- a/src/os/user/lookup_unix.go
+++ b/src/os/user/lookup_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (aix || darwin || dragonfly || freebsd || (js && wasm) || (!android && linux) || netbsd || openbsd || solaris) && (!cgo || osusergo)
// +build aix darwin dragonfly freebsd js,wasm !android,linux netbsd openbsd solaris
// +build !cgo osusergo
diff --git a/src/os/user/lookup_unix_test.go b/src/os/user/lookup_unix_test.go
index 72d3b47534..c697802171 100644
--- a/src/os/user/lookup_unix_test.go
+++ b/src/os/user/lookup_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (aix || darwin || dragonfly || freebsd || (!android && linux) || netbsd || openbsd || solaris) && !cgo
// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris
// +build !cgo
diff --git a/src/os/wait_unimp.go b/src/os/wait_unimp.go
index 0f4cdc4533..28dc2a5939 100644
--- a/src/os/wait_unimp.go
+++ b/src/os/wait_unimp.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || (js && wasm) || netbsd || openbsd || solaris
// +build aix darwin dragonfly js,wasm netbsd openbsd solaris
package os
diff --git a/src/os/wait_wait6.go b/src/os/wait_wait6.go
index 5420b2db73..895f21069a 100644
--- a/src/os/wait_wait6.go
+++ b/src/os/wait_wait6.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd
// +build freebsd
package os
diff --git a/src/os/wait_waitid.go b/src/os/wait_waitid.go
index 9c56eb2d41..1f3cb1cfe2 100644
--- a/src/os/wait_waitid.go
+++ b/src/os/wait_waitid.go
@@ -5,6 +5,7 @@
// We used to used this code for Darwin, but according to issue #19314
// waitid returns if the process is stopped, even when using WEXITED.
+//go:build linux
// +build linux
package os
diff --git a/src/path/filepath/example_unix_test.go b/src/path/filepath/example_unix_test.go
index c9d6944518..4ce10095e6 100644
--- a/src/path/filepath/example_unix_test.go
+++ b/src/path/filepath/example_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !plan9
// +build !windows,!plan9
package filepath_test
diff --git a/src/path/filepath/example_unix_walk_test.go b/src/path/filepath/example_unix_walk_test.go
index c8a818fd6e..d72efcebe6 100644
--- a/src/path/filepath/example_unix_walk_test.go
+++ b/src/path/filepath/example_unix_walk_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows && !plan9
// +build !windows,!plan9
package filepath_test
diff --git a/src/path/filepath/path_unix.go b/src/path/filepath/path_unix.go
index ec497d9e26..d4b6f967a3 100644
--- a/src/path/filepath/path_unix.go
+++ b/src/path/filepath/path_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package filepath
diff --git a/src/path/filepath/symlink_unix.go b/src/path/filepath/symlink_unix.go
index d20e63a987..657945a81a 100644
--- a/src/path/filepath/symlink_unix.go
+++ b/src/path/filepath/symlink_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package filepath
diff --git a/src/plugin/plugin_dlopen.go b/src/plugin/plugin_dlopen.go
index 9200fdc3cb..aa85d4831c 100644
--- a/src/plugin/plugin_dlopen.go
+++ b/src/plugin/plugin_dlopen.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (linux && cgo) || (darwin && cgo) || (freebsd && cgo)
// +build linux,cgo darwin,cgo freebsd,cgo
package plugin
diff --git a/src/plugin/plugin_stubs.go b/src/plugin/plugin_stubs.go
index 1893203017..67855bed4b 100644
--- a/src/plugin/plugin_stubs.go
+++ b/src/plugin/plugin_stubs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (!linux && !freebsd && !darwin) || !cgo
// +build !linux,!freebsd,!darwin !cgo
package plugin
diff --git a/src/plugin/plugin_test.go b/src/plugin/plugin_test.go
index 30b79edaad..4ce912132c 100644
--- a/src/plugin/plugin_test.go
+++ b/src/plugin/plugin_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux || (linux && !arm64)
// +build !linux linux,!arm64
package plugin_test
diff --git a/src/race.bash b/src/race.bash
index e2b96bcffe..81fb4be606 100755
--- a/src/race.bash
+++ b/src/race.bash
@@ -9,7 +9,7 @@
set -e
function usage {
- echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
+ echo 'race detector is only supported on linux/amd64, linux/ppc64le, linux/arm64, freebsd/amd64, netbsd/amd64, openbsd/amd64, darwin/amd64, and darwin/arm64' 1>&2
exit 1
}
@@ -34,6 +34,11 @@ case $(uname) in
usage
fi
;;
+"OpenBSD")
+ if [ $(uname -m) != "amd64" ]; then
+ usage
+ fi
+ ;;
*)
usage
;;
diff --git a/src/reflect/abi.go b/src/reflect/abi.go
new file mode 100644
index 0000000000..36d6b3095b
--- /dev/null
+++ b/src/reflect/abi.go
@@ -0,0 +1,400 @@
+// Copyright 2021 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.
+
+package reflect
+
+import (
+ "internal/abi"
+ "unsafe"
+)
+
+// abiStep represents an ABI "instruction." Each instruction
+// describes one part of how to translate between a Go value
+// in memory and a call frame.
+type abiStep struct {
+ kind abiStepKind
+
+ // offset and size together describe a part of a Go value
+ // in memory.
+ offset uintptr
+ size uintptr // size in bytes of the part
+
+ // These fields describe the ABI side of the translation.
+ stkOff uintptr // stack offset, used if kind == abiStepStack
+ ireg int // integer register index, used if kind == abiStepIntReg or kind == abiStepPointer
+ freg int // FP register index, used if kind == abiStepFloatReg
+}
+
+// abiStepKind is the "op-code" for an abiStep instruction.
+type abiStepKind int
+
+const (
+ abiStepBad abiStepKind = iota
+ abiStepStack // copy to/from stack
+ abiStepIntReg // copy to/from integer register
+ abiStepPointer // copy pointer to/from integer register
+ abiStepFloatReg // copy to/from FP register
+)
+
+// abiSeq represents a sequence of ABI instructions for copying
+// from a series of reflect.Values to a call frame (for call arguments)
+// or vice-versa (for call results).
+//
+// An abiSeq should be populated by calling its addArg method.
+type abiSeq struct {
+ // steps is the set of instructions.
+ //
+ // The instructions are grouped together by whole arguments,
+ // with the starting index for the instructions
+ // of the i'th Go value available in valueStart.
+ //
+ // For instance, if this abiSeq represents 3 arguments
+ // passed to a function, then the 2nd argument's steps
+ // begin at steps[valueStart[1]].
+ //
+ // Because reflect accepts Go arguments in distinct
+ // Values and each Value is stored separately, each abiStep
+ // that begins a new argument will have its offset
+ // field == 0.
+ steps []abiStep
+ valueStart []int
+
+ stackBytes uintptr // stack space used
+ iregs, fregs int // registers used
+}
+
+func (a *abiSeq) dump() {
+ for i, p := range a.steps {
+ println("part", i, p.kind, p.offset, p.size, p.stkOff, p.ireg, p.freg)
+ }
+ print("values ")
+ for _, i := range a.valueStart {
+ print(i, " ")
+ }
+ println()
+ println("stack", a.stackBytes)
+ println("iregs", a.iregs)
+ println("fregs", a.fregs)
+}
+
+// stepsForValue returns the ABI instructions for translating
+// the i'th Go argument or return value represented by this
+// abiSeq to the Go ABI.
+func (a *abiSeq) stepsForValue(i int) []abiStep {
+ s := a.valueStart[i]
+ var e int
+ if i == len(a.valueStart)-1 {
+ e = len(a.steps)
+ } else {
+ e = a.valueStart[i+1]
+ }
+ return a.steps[s:e]
+}
+
+// addArg extends the abiSeq with a new Go value of type t.
+//
+// If the value was stack-assigned, returns the single
+// abiStep describing that translation, and nil otherwise.
+func (a *abiSeq) addArg(t *rtype) *abiStep {
+ pStart := len(a.steps)
+ a.valueStart = append(a.valueStart, pStart)
+ if !a.regAssign(t, 0) {
+ a.steps = a.steps[:pStart]
+ a.stackAssign(t.size, uintptr(t.align))
+ return &a.steps[len(a.steps)-1]
+ }
+ return nil
+}
+
+// addRcvr extends the abiSeq with a new method call
+// receiver according to the interface calling convention.
+//
+// If the receiver was stack-assigned, returns the single
+// abiStep describing that translation, and nil otherwise.
+// Returns true if the receiver is a pointer.
+func (a *abiSeq) addRcvr(rcvr *rtype) (*abiStep, bool) {
+ // The receiver is always one word.
+ a.valueStart = append(a.valueStart, len(a.steps))
+ var ok, ptr bool
+ if ifaceIndir(rcvr) || rcvr.pointers() {
+ ok = a.assignIntN(0, ptrSize, 1, 0b1)
+ ptr = true
+ } else {
+ // TODO(mknyszek): Is this case even possible?
+ // The interface data work never contains a non-pointer
+ // value. This case was copied over from older code
+ // in the reflect package which only conditionally added
+ // a pointer bit to the reflect.(Value).Call stack frame's
+ // GC bitmap.
+ ok = a.assignIntN(0, ptrSize, 1, 0b0)
+ ptr = false
+ }
+ if !ok {
+ a.stackAssign(ptrSize, ptrSize)
+ return &a.steps[len(a.steps)-1], ptr
+ }
+ return nil, ptr
+}
+
+// regAssign attempts to reserve argument registers for a value of
+// type t, stored at some offset.
+//
+// It returns whether or not the assignment succeeded, but
+// leaves any changes it made to a.steps behind, so the caller
+// must undo that work by adjusting a.steps if it fails.
+//
+// This method along with the assign* methods represent the
+// complete register-assignment algorithm for the Go ABI.
+func (a *abiSeq) regAssign(t *rtype, offset uintptr) bool {
+ switch t.Kind() {
+ case UnsafePointer, Ptr, Chan, Map, Func:
+ return a.assignIntN(offset, t.size, 1, 0b1)
+ case Bool, Int, Uint, Int8, Uint8, Int16, Uint16, Int32, Uint32, Uintptr:
+ return a.assignIntN(offset, t.size, 1, 0b0)
+ case Int64, Uint64:
+ switch ptrSize {
+ case 4:
+ return a.assignIntN(offset, 4, 2, 0b0)
+ case 8:
+ return a.assignIntN(offset, 8, 1, 0b0)
+ }
+ case Float32, Float64:
+ return a.assignFloatN(offset, t.size, 1)
+ case Complex64:
+ return a.assignFloatN(offset, 4, 2)
+ case Complex128:
+ return a.assignFloatN(offset, 8, 2)
+ case String:
+ return a.assignIntN(offset, ptrSize, 2, 0b01)
+ case Interface:
+ return a.assignIntN(offset, ptrSize, 2, 0b10)
+ case Slice:
+ return a.assignIntN(offset, ptrSize, 3, 0b001)
+ case Array:
+ tt := (*arrayType)(unsafe.Pointer(t))
+ switch tt.len {
+ case 0:
+ // There's nothing to assign, so don't modify
+ // a.steps but succeed so the caller doesn't
+ // try to stack-assign this value.
+ return true
+ case 1:
+ return a.regAssign(tt.elem, offset)
+ default:
+ return false
+ }
+ case Struct:
+ if t.size == 0 {
+ // There's nothing to assign, so don't modify
+ // a.steps but succeed so the caller doesn't
+ // try to stack-assign this value.
+ return true
+ }
+ st := (*structType)(unsafe.Pointer(t))
+ for i := range st.fields {
+ f := &st.fields[i]
+ if f.typ.Size() == 0 {
+ // Ignore zero-sized fields.
+ continue
+ }
+ if !a.regAssign(f.typ, offset+f.offset()) {
+ return false
+ }
+ }
+ return true
+ default:
+ print("t.Kind == ", t.Kind(), "\n")
+ panic("unknown type kind")
+ }
+ panic("unhandled register assignment path")
+}
+
+// assignIntN assigns n values to registers, each "size" bytes large,
+// from the data at [offset, offset+n*size) in memory. Each value at
+// [offset+i*size, offset+(i+1)*size) for i < n is assigned to the
+// next n integer registers.
+//
+// Bit i in ptrMap indicates whether the i'th value is a pointer.
+// n must be <= 8.
+//
+// Returns whether assignment succeeded.
+func (a *abiSeq) assignIntN(offset, size uintptr, n int, ptrMap uint8) bool {
+ if n > 8 || n < 0 {
+ panic("invalid n")
+ }
+ if ptrMap != 0 && size != ptrSize {
+ panic("non-empty pointer map passed for non-pointer-size values")
+ }
+ if a.iregs+n > abi.IntArgRegs {
+ return false
+ }
+ for i := 0; i < n; i++ {
+ kind := abiStepIntReg
+ if ptrMap&(uint8(1)<<i) != 0 {
+ kind = abiStepPointer
+ }
+ a.steps = append(a.steps, abiStep{
+ kind: kind,
+ offset: offset + uintptr(i)*size,
+ size: size,
+ ireg: a.iregs,
+ })
+ a.iregs++
+ }
+ return true
+}
+
+// assignFloatN assigns n values to registers, each "size" bytes large,
+// from the data at [offset, offset+n*size) in memory. Each value at
+// [offset+i*size, offset+(i+1)*size) for i < n is assigned to the
+// next n floating-point registers.
+//
+// Returns whether assignment succeeded.
+func (a *abiSeq) assignFloatN(offset, size uintptr, n int) bool {
+ if n < 0 {
+ panic("invalid n")
+ }
+ if a.fregs+n > abi.FloatArgRegs || abi.EffectiveFloatRegSize < size {
+ return false
+ }
+ for i := 0; i < n; i++ {
+ a.steps = append(a.steps, abiStep{
+ kind: abiStepFloatReg,
+ offset: offset + uintptr(i)*size,
+ size: size,
+ freg: a.fregs,
+ })
+ a.fregs++
+ }
+ return true
+}
+
+// stackAssign reserves space for one value that is "size" bytes
+// large with alignment "alignment" to the stack.
+//
+// Should not be called directly; use addArg instead.
+func (a *abiSeq) stackAssign(size, alignment uintptr) {
+ a.stackBytes = align(a.stackBytes, alignment)
+ a.steps = append(a.steps, abiStep{
+ kind: abiStepStack,
+ offset: 0, // Only used for whole arguments, so the memory offset is 0.
+ size: size,
+ stkOff: a.stackBytes,
+ })
+ a.stackBytes += size
+}
+
+// abiDesc describes the ABI for a function or method.
+type abiDesc struct {
+ // call and ret represent the translation steps for
+ // the call and return paths of a Go function.
+ call, ret abiSeq
+
+ // These fields describe the stack space allocated
+ // for the call. stackCallArgsSize is the amount of space
+ // reserved for arguments but not return values. retOffset
+ // is the offset at which return values begin, and
+ // spill is the size in bytes of additional space reserved
+ // to spill argument registers into in case of preemption in
+ // reflectcall's stack frame.
+ stackCallArgsSize, retOffset, spill uintptr
+
+ // stackPtrs is a bitmap that indicates whether
+ // each word in the ABI stack space (stack-assigned
+ // args + return values) is a pointer. Used
+ // as the heap pointer bitmap for stack space
+ // passed to reflectcall.
+ stackPtrs *bitVector
+
+ // outRegPtrs is a bitmap whose i'th bit indicates
+ // whether the i'th integer result register contains
+ // a pointer. Used by reflectcall to make result
+ // pointers visible to the GC.
+ outRegPtrs abi.IntArgRegBitmap
+}
+
+func (a *abiDesc) dump() {
+ println("ABI")
+ println("call")
+ a.call.dump()
+ println("ret")
+ a.ret.dump()
+ println("stackCallArgsSize", a.stackCallArgsSize)
+ println("retOffset", a.retOffset)
+ println("spill", a.spill)
+}
+
+func newAbiDesc(t *funcType, rcvr *rtype) abiDesc {
+ // We need to add space for this argument to
+ // the frame so that it can spill args into it.
+ //
+ // The size of this space is just the sum of the sizes
+ // of each register-allocated type.
+ //
+ // TODO(mknyszek): Remove this when we no longer have
+ // caller reserved spill space.
+ spill := uintptr(0)
+
+ // Compute gc program & stack bitmap for stack arguments
+ stackPtrs := new(bitVector)
+
+ // Compute abiSeq for input parameters.
+ var in abiSeq
+ if rcvr != nil {
+ stkStep, isPtr := in.addRcvr(rcvr)
+ if stkStep != nil {
+ if isPtr {
+ stackPtrs.append(1)
+ } else {
+ stackPtrs.append(0)
+ }
+ } else {
+ spill += ptrSize
+ }
+ }
+ for _, arg := range t.in() {
+ stkStep := in.addArg(arg)
+ if stkStep != nil {
+ addTypeBits(stackPtrs, stkStep.stkOff, arg)
+ } else {
+ spill = align(spill, uintptr(arg.align))
+ spill += arg.size
+ }
+ }
+ spill = align(spill, ptrSize)
+
+ // From the input parameters alone, we now know
+ // the stackCallArgsSize and retOffset.
+ stackCallArgsSize := in.stackBytes
+ retOffset := align(in.stackBytes, ptrSize)
+
+ // Compute the stack frame pointer bitmap and register
+ // pointer bitmap for return values.
+ outRegPtrs := abi.IntArgRegBitmap{}
+
+ // Compute abiSeq for output parameters.
+ var out abiSeq
+ // Stack-assigned return values do not share
+ // space with arguments like they do with registers,
+ // so we need to inject a stack offset here.
+ // Fake it by artificially extending stackBytes by
+ // the return offset.
+ out.stackBytes = retOffset
+ for i, res := range t.out() {
+ stkStep := out.addArg(res)
+ if stkStep != nil {
+ addTypeBits(stackPtrs, stkStep.stkOff, res)
+ } else {
+ for _, st := range out.stepsForValue(i) {
+ if st.kind == abiStepPointer {
+ outRegPtrs.Set(st.ireg)
+ }
+ }
+ }
+ }
+ // Undo the faking from earlier so that stackBytes
+ // is accurate.
+ out.stackBytes -= retOffset
+ return abiDesc{in, out, stackCallArgsSize, retOffset, spill, stackPtrs, outRegPtrs}
+}
diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go
index 1225d6177d..35cc469d74 100644
--- a/src/reflect/all_test.go
+++ b/src/reflect/all_test.go
@@ -2900,6 +2900,7 @@ func TestFieldPkgPath(t *testing.T) {
index []int
pkgPath string
embedded bool
+ exported bool
}
checkPkgPath := func(name string, s []pkgpathTest) {
@@ -2911,27 +2912,63 @@ func TestFieldPkgPath(t *testing.T) {
if got, want := f.Anonymous, test.embedded; got != want {
t.Errorf("%s: Field(%d).Anonymous = %v, want %v", name, test.index, got, want)
}
+ if got, want := f.IsExported(), test.exported; got != want {
+ t.Errorf("%s: Field(%d).IsExported = %v, want %v", name, test.index, got, want)
+ }
}
}
checkPkgPath("testStruct", []pkgpathTest{
- {[]int{0}, "", false}, // Exported
- {[]int{1}, "reflect_test", false}, // unexported
- {[]int{2}, "", true}, // OtherPkgFields
- {[]int{2, 0}, "", false}, // OtherExported
- {[]int{2, 1}, "reflect", false}, // otherUnexported
- {[]int{3}, "reflect_test", true}, // int
- {[]int{4}, "reflect_test", true}, // *x
+ {[]int{0}, "", false, true}, // Exported
+ {[]int{1}, "reflect_test", false, false}, // unexported
+ {[]int{2}, "", true, true}, // OtherPkgFields
+ {[]int{2, 0}, "", false, true}, // OtherExported
+ {[]int{2, 1}, "reflect", false, false}, // otherUnexported
+ {[]int{3}, "reflect_test", true, false}, // int
+ {[]int{4}, "reflect_test", true, false}, // *x
})
type localOtherPkgFields OtherPkgFields
typ = TypeOf(localOtherPkgFields{})
checkPkgPath("localOtherPkgFields", []pkgpathTest{
- {[]int{0}, "", false}, // OtherExported
- {[]int{1}, "reflect", false}, // otherUnexported
+ {[]int{0}, "", false, true}, // OtherExported
+ {[]int{1}, "reflect", false, false}, // otherUnexported
})
}
+func TestMethodPkgPath(t *testing.T) {
+ type I interface {
+ x()
+ X()
+ }
+ typ := TypeOf((*interface {
+ I
+ y()
+ Y()
+ })(nil)).Elem()
+
+ tests := []struct {
+ name string
+ pkgPath string
+ exported bool
+ }{
+ {"X", "", true},
+ {"Y", "", true},
+ {"x", "reflect_test", false},
+ {"y", "reflect_test", false},
+ }
+
+ for _, test := range tests {
+ m, _ := typ.MethodByName(test.name)
+ if got, want := m.PkgPath, test.pkgPath; got != want {
+ t.Errorf("MethodByName(%q).PkgPath = %q, want %q", test.name, got, want)
+ }
+ if got, want := m.IsExported(), test.exported; got != want {
+ t.Errorf("MethodByName(%q).IsExported = %v, want %v", test.name, got, want)
+ }
+ }
+}
+
func TestVariadicType(t *testing.T) {
// Test example from Type documentation.
var f func(x int, y ...float64)
diff --git a/src/reflect/export_test.go b/src/reflect/export_test.go
index de426b58a8..ddcfca9dee 100644
--- a/src/reflect/export_test.go
+++ b/src/reflect/export_test.go
@@ -23,15 +23,17 @@ const PtrSize = ptrSize
func FuncLayout(t Type, rcvr Type) (frametype Type, argSize, retOffset uintptr, stack []byte, gc []byte, ptrs bool) {
var ft *rtype
- var s *bitVector
+ var abi abiDesc
if rcvr != nil {
- ft, argSize, retOffset, s, _ = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), rcvr.(*rtype))
+ ft, _, abi = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), rcvr.(*rtype))
} else {
- ft, argSize, retOffset, s, _ = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), nil)
+ ft, _, abi = funcLayout((*funcType)(unsafe.Pointer(t.(*rtype))), nil)
}
+ argSize = abi.stackCallArgsSize
+ retOffset = abi.retOffset
frametype = ft
- for i := uint32(0); i < s.n; i++ {
- stack = append(stack, s.data[i/8]>>(i%8)&1)
+ for i := uint32(0); i < abi.stackPtrs.n; i++ {
+ stack = append(stack, abi.stackPtrs.data[i/8]>>(i%8)&1)
}
if ft.kind&kindGCProg != 0 {
panic("can't handle gc programs")
diff --git a/src/reflect/makefunc.go b/src/reflect/makefunc.go
index 67dc4859b9..e17d4ea758 100644
--- a/src/reflect/makefunc.go
+++ b/src/reflect/makefunc.go
@@ -60,9 +60,9 @@ func MakeFunc(typ Type, fn func(args []Value) (results []Value)) Value {
code := **(**uintptr)(unsafe.Pointer(&dummy))
// makeFuncImpl contains a stack map for use by the runtime
- _, argLen, _, stack, _ := funcLayout(ftyp, nil)
+ _, _, abi := funcLayout(ftyp, nil)
- impl := &makeFuncImpl{code: code, stack: stack, argLen: argLen, ftyp: ftyp, fn: fn}
+ impl := &makeFuncImpl{code: code, stack: abi.stackPtrs, argLen: abi.stackCallArgsSize, ftyp: ftyp, fn: fn}
return Value{t, unsafe.Pointer(impl), flag(Func)}
}
@@ -112,12 +112,12 @@ func makeMethodValue(op string, v Value) Value {
code := **(**uintptr)(unsafe.Pointer(&dummy))
// methodValue contains a stack map for use by the runtime
- _, argLen, _, stack, _ := funcLayout(ftyp, nil)
+ _, _, abi := funcLayout(ftyp, nil)
fv := &methodValue{
fn: code,
- stack: stack,
- argLen: argLen,
+ stack: abi.stackPtrs,
+ argLen: abi.stackCallArgsSize,
method: int(v.flag) >> flagMethodShift,
rcvr: rcvr,
}
diff --git a/src/reflect/type.go b/src/reflect/type.go
index d323828c74..dc235ea8f7 100644
--- a/src/reflect/type.go
+++ b/src/reflect/type.go
@@ -568,12 +568,13 @@ func newName(n, tag string, exported bool) name {
// Method represents a single method.
type Method struct {
// Name is the method name.
+ Name string
+
// PkgPath is the package path that qualifies a lower case (unexported)
// method name. It is empty for upper case (exported) method names.
// The combination of PkgPath and Name uniquely identifies a method
// in a method set.
// See https://golang.org/ref/spec#Uniqueness_of_identifiers
- Name string
PkgPath string
Type Type // method type
@@ -581,6 +582,11 @@ type Method struct {
Index int // index for Type.Method
}
+// IsExported reports whether the method is exported.
+func (m Method) IsExported() bool {
+ return m.PkgPath == ""
+}
+
const (
kindDirectIface = 1 << 5
kindGCProg = 1 << 6 // Type.gc points to GC program
@@ -1090,6 +1096,7 @@ func (t *interfaceType) MethodByName(name string) (m Method, ok bool) {
type StructField struct {
// Name is the field name.
Name string
+
// PkgPath is the package path that qualifies a lower case (unexported)
// field name. It is empty for upper case (exported) field names.
// See https://golang.org/ref/spec#Uniqueness_of_identifiers
@@ -1102,6 +1109,11 @@ type StructField struct {
Anonymous bool // is an embedded field
}
+// IsExported reports whether the field is exported.
+func (f StructField) IsExported() bool {
+ return f.PkgPath == ""
+}
+
// A StructTag is the tag string in a struct field.
//
// By convention, tag strings are a concatenation of
@@ -1723,7 +1735,7 @@ func typesByString(s string) []*rtype {
// This is a copy of sort.Search, with f(h) replaced by (*typ[h].String() >= s).
i, j := 0, len(offs)
for i < j {
- h := i + (j-i)/2 // avoid overflow when computing h
+ h := i + (j-i)>>1 // avoid overflow when computing h
// i ≤ h < j
if !(rtypeOff(section, offs[h]).String() >= s) {
i = h + 1 // preserves f(i-1) == false
@@ -2771,8 +2783,7 @@ func runtimeStructField(field StructField) (structField, string) {
panic("reflect.StructOf: field \"" + field.Name + "\" is anonymous but has PkgPath set")
}
- exported := field.PkgPath == ""
- if exported {
+ if field.IsExported() {
// Best-effort check for misuse.
// Since this field will be treated as exported, not much harm done if Unicode lowercase slips through.
c := field.Name[0]
@@ -2788,7 +2799,7 @@ func runtimeStructField(field StructField) (structField, string) {
resolveReflectType(field.Type.common()) // install in runtime
f := structField{
- name: newName(field.Name, string(field.Tag), exported),
+ name: newName(field.Name, string(field.Tag), field.IsExported()),
typ: field.Type.common(),
offsetEmbed: offsetEmbed,
}
@@ -2984,21 +2995,20 @@ type layoutKey struct {
type layoutType struct {
t *rtype
- argSize uintptr // size of arguments
- retOffset uintptr // offset of return values.
- stack *bitVector
framePool *sync.Pool
+ abi abiDesc
}
var layoutCache sync.Map // map[layoutKey]layoutType
// funcLayout computes a struct type representing the layout of the
-// function arguments and return values for the function type t.
+// stack-assigned function arguments and return values for the function
+// type t.
// If rcvr != nil, rcvr specifies the type of the receiver.
// The returned type exists only for GC, so we only fill out GC relevant info.
// Currently, that's just size and the GC program. We also fill in
// the name for possible debugging use.
-func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset uintptr, stk *bitVector, framePool *sync.Pool) {
+func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, framePool *sync.Pool, abi abiDesc) {
if t.Kind() != Func {
panic("reflect: funcLayout of non-func type " + t.String())
}
@@ -3008,46 +3018,24 @@ func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset
k := layoutKey{t, rcvr}
if lti, ok := layoutCache.Load(k); ok {
lt := lti.(layoutType)
- return lt.t, lt.argSize, lt.retOffset, lt.stack, lt.framePool
+ return lt.t, lt.framePool, lt.abi
}
- // compute gc program & stack bitmap for arguments
- ptrmap := new(bitVector)
- var offset uintptr
- if rcvr != nil {
- // Reflect uses the "interface" calling convention for
- // methods, where receivers take one word of argument
- // space no matter how big they actually are.
- if ifaceIndir(rcvr) || rcvr.pointers() {
- ptrmap.append(1)
- } else {
- ptrmap.append(0)
- }
- offset += ptrSize
- }
- for _, arg := range t.in() {
- offset += -offset & uintptr(arg.align-1)
- addTypeBits(ptrmap, offset, arg)
- offset += arg.size
- }
- argSize = offset
- offset += -offset & (ptrSize - 1)
- retOffset = offset
- for _, res := range t.out() {
- offset += -offset & uintptr(res.align-1)
- addTypeBits(ptrmap, offset, res)
- offset += res.size
- }
- offset += -offset & (ptrSize - 1)
+ // Compute the ABI layout.
+ abi = newAbiDesc(t, rcvr)
// build dummy rtype holding gc program
x := &rtype{
- align: ptrSize,
- size: offset,
- ptrdata: uintptr(ptrmap.n) * ptrSize,
+ align: ptrSize,
+ // Don't add spill space here; it's only necessary in
+ // reflectcall's frame, not in the allocated frame.
+ // TODO(mknyszek): Remove this comment when register
+ // spill space in the frame is no longer required.
+ size: align(abi.retOffset+abi.ret.stackBytes, ptrSize),
+ ptrdata: uintptr(abi.stackPtrs.n) * ptrSize,
}
- if ptrmap.n > 0 {
- x.gcdata = &ptrmap.data[0]
+ if abi.stackPtrs.n > 0 {
+ x.gcdata = &abi.stackPtrs.data[0]
}
var s string
@@ -3064,13 +3052,11 @@ func funcLayout(t *funcType, rcvr *rtype) (frametype *rtype, argSize, retOffset
}}
lti, _ := layoutCache.LoadOrStore(k, layoutType{
t: x,
- argSize: argSize,
- retOffset: retOffset,
- stack: ptrmap,
framePool: framePool,
+ abi: abi,
})
lt := lti.(layoutType)
- return lt.t, lt.argSize, lt.retOffset, lt.stack, lt.framePool
+ return lt.t, lt.framePool, lt.abi
}
// ifaceIndir reports whether t is stored indirectly in an interface value.
diff --git a/src/reflect/value.go b/src/reflect/value.go
index 1f185b52e4..eae1b9bf29 100644
--- a/src/reflect/value.go
+++ b/src/reflect/value.go
@@ -5,6 +5,7 @@
package reflect
import (
+ "internal/abi"
"internal/unsafeheader"
"math"
"runtime"
@@ -352,6 +353,8 @@ func (v Value) CallSlice(in []Value) []Value {
var callGC bool // for testing; see TestCallMethodJump
+const debugReflectCall = false
+
func (v Value) call(op string, in []Value) []Value {
// Get function pointer, type.
t := (*funcType)(unsafe.Pointer(v.typ))
@@ -430,50 +433,112 @@ func (v Value) call(op string, in []Value) []Value {
}
nout := t.NumOut()
+ // Register argument space.
+ var regArgs abi.RegArgs
+
// Compute frame type.
- frametype, _, retOffset, _, framePool := funcLayout(t, rcvrtype)
+ frametype, framePool, abi := funcLayout(t, rcvrtype)
- // Allocate a chunk of memory for frame.
- var args unsafe.Pointer
- if nout == 0 {
- args = framePool.Get().(unsafe.Pointer)
- } else {
- // Can't use pool if the function has return values.
- // We will leak pointer to args in ret, so its lifetime is not scoped.
- args = unsafe_New(frametype)
+ // Allocate a chunk of memory for frame if needed.
+ var stackArgs unsafe.Pointer
+ if frametype.size != 0 {
+ if nout == 0 {
+ stackArgs = framePool.Get().(unsafe.Pointer)
+ } else {
+ // Can't use pool if the function has return values.
+ // We will leak pointer to args in ret, so its lifetime is not scoped.
+ stackArgs = unsafe_New(frametype)
+ }
+ }
+ frameSize := frametype.size
+
+ if debugReflectCall {
+ println("reflect.call", t.String())
+ abi.dump()
}
- off := uintptr(0)
// Copy inputs into args.
+
+ // Handle receiver.
+ inStart := 0
if rcvrtype != nil {
- storeRcvr(rcvr, args)
- off = ptrSize
+ // Guaranteed to only be one word in size,
+ // so it will only take up exactly 1 abiStep (either
+ // in a register or on the stack).
+ switch st := abi.call.steps[0]; st.kind {
+ case abiStepStack:
+ storeRcvr(rcvr, stackArgs)
+ case abiStepIntReg, abiStepPointer:
+ // Even pointers can go into the uintptr slot because
+ // they'll be kept alive by the Values referenced by
+ // this frame. Reflection forces these to be heap-allocated,
+ // so we don't need to worry about stack copying.
+ storeRcvr(rcvr, unsafe.Pointer(&regArgs.Ints[st.ireg]))
+ case abiStepFloatReg:
+ storeRcvr(rcvr, unsafe.Pointer(&regArgs.Floats[st.freg]))
+ default:
+ panic("unknown ABI parameter kind")
+ }
+ inStart = 1
}
+
+ // Handle arguments.
for i, v := range in {
v.mustBeExported()
targ := t.In(i).(*rtype)
- a := uintptr(targ.align)
- off = (off + a - 1) &^ (a - 1)
- n := targ.size
- if n == 0 {
- // Not safe to compute args+off pointing at 0 bytes,
- // because that might point beyond the end of the frame,
- // but we still need to call assignTo to check assignability.
- v.assignTo("reflect.Value.Call", targ, nil)
- continue
- }
- addr := add(args, off, "n > 0")
- v = v.assignTo("reflect.Value.Call", targ, addr)
- if v.flag&flagIndir != 0 {
- typedmemmove(targ, addr, v.ptr)
- } else {
- *(*unsafe.Pointer)(addr) = v.ptr
+ // TODO(mknyszek): Figure out if it's possible to get some
+ // scratch space for this assignment check. Previously, it
+ // was possible to use space in the argument frame.
+ v = v.assignTo("reflect.Value.Call", targ, nil)
+ stepsLoop:
+ for _, st := range abi.call.stepsForValue(i + inStart) {
+ switch st.kind {
+ case abiStepStack:
+ // Copy values to the "stack."
+ addr := add(stackArgs, st.stkOff, "precomputed stack arg offset")
+ if v.flag&flagIndir != 0 {
+ typedmemmove(targ, addr, v.ptr)
+ } else {
+ *(*unsafe.Pointer)(addr) = v.ptr
+ }
+ // There's only one step for a stack-allocated value.
+ break stepsLoop
+ case abiStepIntReg, abiStepPointer:
+ // Copy values to "integer registers."
+ if v.flag&flagIndir != 0 {
+ offset := add(v.ptr, st.offset, "precomputed value offset")
+ memmove(unsafe.Pointer(&regArgs.Ints[st.ireg]), offset, st.size)
+ } else {
+ if st.kind == abiStepPointer {
+ // Duplicate this pointer in the pointer area of the
+ // register space. Otherwise, there's the potential for
+ // this to be the last reference to v.ptr.
+ regArgs.Ptrs[st.ireg] = v.ptr
+ }
+ regArgs.Ints[st.ireg] = uintptr(v.ptr)
+ }
+ case abiStepFloatReg:
+ // Copy values to "float registers."
+ if v.flag&flagIndir == 0 {
+ panic("attempted to copy pointer to FP register")
+ }
+ offset := add(v.ptr, st.offset, "precomputed value offset")
+ memmove(unsafe.Pointer(&regArgs.Floats[st.freg]), offset, st.size)
+ default:
+ panic("unknown ABI part kind")
+ }
}
- off += n
}
+ // TODO(mknyszek): Remove this when we no longer have
+ // caller reserved spill space.
+ frameSize = align(frameSize, ptrSize)
+ frameSize += abi.spill
+
+ // Mark pointers in registers for the return path.
+ regArgs.ReturnIsPtr = abi.outRegPtrs
// Call.
- call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
+ call(frametype, fn, stackArgs, uint32(frametype.size), uint32(abi.retOffset), uint32(frameSize), &regArgs)
// For testing; see TestCallMethodJump.
if callGC {
@@ -482,34 +547,82 @@ func (v Value) call(op string, in []Value) []Value {
var ret []Value
if nout == 0 {
- typedmemclr(frametype, args)
- framePool.Put(args)
+ if stackArgs != nil {
+ typedmemclr(frametype, stackArgs)
+ framePool.Put(stackArgs)
+ }
} else {
- // Zero the now unused input area of args,
- // because the Values returned by this function contain pointers to the args object,
- // and will thus keep the args object alive indefinitely.
- typedmemclrpartial(frametype, args, 0, retOffset)
+ if stackArgs != nil {
+ // Zero the now unused input area of args,
+ // because the Values returned by this function contain pointers to the args object,
+ // and will thus keep the args object alive indefinitely.
+ typedmemclrpartial(frametype, stackArgs, 0, abi.retOffset)
+ }
// Wrap Values around return values in args.
ret = make([]Value, nout)
- off = retOffset
for i := 0; i < nout; i++ {
tv := t.Out(i)
- a := uintptr(tv.Align())
- off = (off + a - 1) &^ (a - 1)
- if tv.Size() != 0 {
+ if tv.Size() == 0 {
+ // For zero-sized return value, args+off may point to the next object.
+ // In this case, return the zero value instead.
+ ret[i] = Zero(tv)
+ continue
+ }
+ steps := abi.ret.stepsForValue(i)
+ if st := steps[0]; st.kind == abiStepStack {
+ // This value is on the stack. If part of a value is stack
+ // allocated, the entire value is according to the ABI. So
+ // just make an indirection into the allocated frame.
fl := flagIndir | flag(tv.Kind())
- ret[i] = Value{tv.common(), add(args, off, "tv.Size() != 0"), fl}
+ ret[i] = Value{tv.common(), add(stackArgs, st.stkOff, "tv.Size() != 0"), fl}
// Note: this does introduce false sharing between results -
// if any result is live, they are all live.
// (And the space for the args is live as well, but as we've
// cleared that space it isn't as big a deal.)
- } else {
- // For zero-sized return value, args+off may point to the next object.
- // In this case, return the zero value instead.
- ret[i] = Zero(tv)
+ continue
+ }
+
+ // Handle pointers passed in registers.
+ if !ifaceIndir(tv.common()) {
+ // Pointer-valued data gets put directly
+ // into v.ptr.
+ if steps[0].kind != abiStepPointer {
+ print("kind=", steps[0].kind, ", type=", tv.String(), "\n")
+ panic("mismatch between ABI description and types")
+ }
+ ret[i] = Value{tv.common(), regArgs.Ptrs[steps[0].ireg], flag(t.Kind())}
+ continue
+ }
+
+ // All that's left is values passed in registers that we need to
+ // create space for and copy values back into.
+ //
+ // TODO(mknyszek): We make a new allocation for each register-allocated
+ // value, but previously we could always point into the heap-allocated
+ // stack frame. This is a regression that could be fixed by adding
+ // additional space to the allocated stack frame and storing the
+ // register-allocated return values into the allocated stack frame and
+ // referring there in the resulting Value.
+ s := unsafe_New(tv.common())
+ for _, st := range steps {
+ switch st.kind {
+ case abiStepIntReg:
+ offset := add(s, st.offset, "precomputed value offset")
+ memmove(offset, unsafe.Pointer(&regArgs.Ints[st.ireg]), st.size)
+ case abiStepPointer:
+ s := add(s, st.offset, "precomputed value offset")
+ *((*unsafe.Pointer)(s)) = regArgs.Ptrs[st.ireg]
+ case abiStepFloatReg:
+ offset := add(s, st.offset, "precomputed value offset")
+ memmove(offset, unsafe.Pointer(&regArgs.Floats[st.freg]), st.size)
+ case abiStepStack:
+ panic("register-based return value has stack component")
+ default:
+ panic("unknown ABI part kind")
+ }
}
- off += tv.Size()
+ ret[i] = Value{tv.common(), s, flagIndir | flag(tv.Kind())}
}
}
@@ -709,7 +822,8 @@ func align(x, n uintptr) uintptr {
func callMethod(ctxt *methodValue, frame unsafe.Pointer, retValid *bool) {
rcvr := ctxt.rcvr
rcvrtype, t, fn := methodReceiver("call", rcvr, ctxt.method)
- frametype, argSize, retOffset, _, framePool := funcLayout(t, rcvrtype)
+ frametype, framePool, abid := funcLayout(t, rcvrtype)
+ argSize, retOffset := abid.stackCallArgsSize, abid.retOffset
// Make a new frame that is one word bigger so we can store the receiver.
// This space is used for both arguments and return values.
@@ -727,10 +841,19 @@ func callMethod(ctxt *methodValue, frame unsafe.Pointer, retValid *bool) {
typedmemmovepartial(frametype, add(scratch, argOffset, "argSize > argOffset"), frame, argOffset, argSize-argOffset)
}
+ frameSize := frametype.size
+ // TODO(mknyszek): Remove this when we no longer have
+ // caller reserved spill space.
+ frameSize = align(frameSize, ptrSize)
+ frameSize += abid.spill
+
// Call.
// Call copies the arguments from scratch to the stack, calls fn,
// and then copies the results back into scratch.
- call(frametype, fn, scratch, uint32(frametype.size), uint32(retOffset))
+ //
+ // TODO(mknyszek): Have this actually support the register-based ABI.
+ var regs abi.RegArgs
+ call(frametype, fn, scratch, uint32(frametype.size), uint32(retOffset), uint32(frameSize), &regs)
// Copy return values.
// Ignore any changes to args and just copy return values.
@@ -2802,14 +2925,32 @@ func mapiternext(it unsafe.Pointer)
//go:noescape
func maplen(m unsafe.Pointer) int
-// call calls fn with a copy of the n argument bytes pointed at by arg.
-// After fn returns, reflectcall copies n-retoffset result bytes
-// back into arg+retoffset before returning. If copying result bytes back,
-// the caller must pass the argument frame type as argtype, so that
-// call can execute appropriate write barriers during the copy.
+// call calls fn with "stackArgsSize" bytes of stack arguments laid out
+// at stackArgs and register arguments laid out in regArgs. frameSize is
+// the total amount of stack space that will be reserved by call, so this
+// should include enough space to spill register arguments to the stack in
+// case of preemption.
+//
+// After fn returns, call copies stackArgsSize-stackRetOffset result bytes
+// back into stackArgs+stackRetOffset before returning, for any return
+// values passed on the stack. Register-based return values will be found
+// in the same regArgs structure.
+//
+// regArgs must also be prepared with an appropriate ReturnIsPtr bitmap
+// indicating which registers will contain pointer-valued return values. The
+// purpose of this bitmap is to keep pointers visible to the GC between
+// returning from reflectcall and actually using them.
//
+// If copying result bytes back from the stack, the caller must pass the
+// argument frame type as stackArgsType, so that call can execute appropriate
+// write barriers during the copy.
+//
+// Arguments passed through to call do not escape. The type is used only in a
+// very limited callee of call, the stackArgs are copied, and regArgs is only
+// used in the call frame.
+//go:noescape
//go:linkname call runtime.reflectcall
-func call(argtype *rtype, fn, arg unsafe.Pointer, n uint32, retoffset uint32)
+func call(stackArgsType *rtype, f, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs)
func ifaceE2I(t *rtype, src interface{}, dst unsafe.Pointer)
diff --git a/src/regexp/exec2_test.go b/src/regexp/exec2_test.go
index 7b86b41156..6444bc12f9 100644
--- a/src/regexp/exec2_test.go
+++ b/src/regexp/exec2_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !race
// +build !race
package regexp
diff --git a/src/run.bash b/src/run.bash
index 706b4b60ee..2123c509f8 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -23,15 +23,7 @@ fi
eval $(../bin/go env)
export GOROOT # The api test requires GOROOT to be set, so set it to match ../bin/go.
-
-# We disallow local import for non-local packages, if $GOROOT happens
-# to be under $GOPATH, then some tests below will fail. $GOPATH needs
-# to be set to a non-empty string, else Go will set a default value
-# that may also conflict with $GOROOT. The $GOPATH value doesn't need
-# to point to an actual directory, it just needs to pass the semantic
-# checks performed by Go. Use $GOROOT to define $GOPATH so that we
-# don't blunder into a user-defined symbolic link.
-export GOPATH=/dev/null
+export GOPATH=/nonexist-gopath
unset CDPATH # in case user has it set
export GOBIN=$GOROOT/bin # Issue 14340
diff --git a/src/run.bat b/src/run.bat
index c299671c13..edcaf52659 100644
--- a/src/run.bat
+++ b/src/run.bat
@@ -18,9 +18,7 @@ setlocal
set GOBUILDFAIL=0
-:: we disallow local import for non-local packages, if %GOROOT% happens
-:: to be under %GOPATH%, then some tests below will fail
-set GOPATH=
+set GOPATH=c:\nonexist-gopath
:: Issue 14340: ignore GOBIN during all.bat.
set GOBIN=
set GOFLAGS=
diff --git a/src/run.rc b/src/run.rc
index ab7abfa991..a7b4801207 100755
--- a/src/run.rc
+++ b/src/run.rc
@@ -12,10 +12,9 @@ if(! test -f ../bin/go){
eval `{../bin/go env}
-GOPATH = () # we disallow local import for non-local packages, if $GOROOT happens
- # to be under $GOPATH, then some tests below will fail
-GOBIN = () # Issue 14340
-GOFLAGS = ()
-GO111MODULE = ()
+GOPATH=/nonexist-gopath
+GOBIN=() # Issue 14340
+GOFLAGS=()
+GO111MODULE=()
exec ../bin/go tool dist test -rebuild $*
diff --git a/src/runtime/asm.s b/src/runtime/asm.s
index 27d8df9e06..72c744925d 100644
--- a/src/runtime/asm.s
+++ b/src/runtime/asm.s
@@ -11,3 +11,8 @@
DATA runtime·no_pointers_stackmap+0x00(SB)/4, $2
DATA runtime·no_pointers_stackmap+0x04(SB)/4, $0
GLOBL runtime·no_pointers_stackmap(SB),RODATA, $8
+
+#ifndef GOARCH_amd64
+TEXT ·sigpanic0<ABIInternal>(SB),NOSPLIT,$0-0
+ JMP ·sigpanic<ABIInternal>(SB)
+#endif
diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s
index fa3b1be339..5cf6827c21 100644
--- a/src/runtime/asm_386.s
+++ b/src/runtime/asm_386.s
@@ -89,7 +89,7 @@ GLOBL _rt0_386_lib_argc<>(SB),NOPTR, $4
DATA _rt0_386_lib_argv<>(SB)/4, $0
GLOBL _rt0_386_lib_argv<>(SB),NOPTR, $4
-TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
// Copy arguments forward on an even stack.
// Users of this function jump to it, they don't call it.
MOVL 0(SP), AX
@@ -269,35 +269,23 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0
FLDCW runtime·controlWord64(SB)
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ CALL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT, $0-4
- MOVL buf+0(FP), AX // gobuf
- LEAL buf+0(FP), BX // caller's SP
- MOVL BX, gobuf_sp(AX)
- MOVL 0(SP), BX // caller's PC
- MOVL BX, gobuf_pc(AX)
- MOVL $0, gobuf_ret(AX)
- // Assert ctxt is zero. See func save.
- MOVL gobuf_ctxt(AX), BX
- TESTL BX, BX
- JZ 2(PC)
- CALL runtime·badctxt(SB)
- get_tls(CX)
- MOVL g(CX), BX
- MOVL BX, gobuf_g(AX)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB), NOSPLIT, $8-4
+TEXT runtime·gogo(SB), NOSPLIT, $0-4
MOVL buf+0(FP), BX // gobuf
MOVL gobuf_g(BX), DX
MOVL 0(DX), CX // make sure g != nil
+ JMP gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT, $0
get_tls(CX)
MOVL DX, g(CX)
MOVL gobuf_sp(BX), SP // restore SP
@@ -322,7 +310,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-4
MOVL BX, (g_sched+gobuf_pc)(AX)
LEAL fn+0(FP), BX // caller's SP
MOVL BX, (g_sched+gobuf_sp)(AX)
- MOVL AX, (g_sched+gobuf_g)(AX)
// switch to m->g0 & its stack, call fn
MOVL g(DX), BX
@@ -371,18 +358,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-4
// switch stacks
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVL $runtime·systemstack_switch(SB), (g_sched+gobuf_pc)(AX)
- MOVL SP, (g_sched+gobuf_sp)(AX)
- MOVL AX, (g_sched+gobuf_g)(AX)
+ CALL gosave_systemstack_switch<>(SB)
// switch to g0
get_tls(CX)
MOVL DX, g(CX)
MOVL (g_sched+gobuf_sp)(DX), BX
- // make it look like mstart called systemstack on g0, to stop traceback
- SUBL $4, BX
- MOVL $runtime·mstart(SB), DX
- MOVL DX, 0(BX)
MOVL BX, SP
// call target function
@@ -457,7 +438,6 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
// Set g->sched to context in f.
MOVL 0(SP), AX // f's PC
MOVL AX, (g_sched+gobuf_pc)(SI)
- MOVL SI, (g_sched+gobuf_g)(SI)
LEAL 4(SP), AX // f's SP
MOVL AX, (g_sched+gobuf_sp)(SI)
MOVL DX, (g_sched+gobuf_ctxt)(SI)
@@ -477,7 +457,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0
JMP runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -489,8 +469,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0
JMP AX
// Note: can't just "JMP NAME(SB)" - bad inlining results.
-TEXT ·reflectcall(SB), NOSPLIT, $0-20
- MOVL argsize+12(FP), CX
+TEXT ·reflectcall(SB), NOSPLIT, $0-28
+ MOVL frameSize+20(FP), CX
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -522,11 +502,11 @@ TEXT ·reflectcall(SB), NOSPLIT, $0-20
JMP AX
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-28; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVL argptr+8(FP), SI; \
- MOVL argsize+12(FP), CX; \
+ MOVL stackArgs+8(FP), SI; \
+ MOVL stackArgsSize+12(FP), CX; \
MOVL SP, DI; \
REP;MOVSB; \
/* call function */ \
@@ -535,10 +515,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
PCDATA $PCDATA_StackMapIndex, $0; \
CALL AX; \
/* copy return values back */ \
- MOVL argtype+0(FP), DX; \
- MOVL argptr+8(FP), DI; \
- MOVL argsize+12(FP), CX; \
- MOVL retoffset+16(FP), BX; \
+ MOVL stackArgsType+0(FP), DX; \
+ MOVL stackArgs+8(FP), DI; \
+ MOVL stackArgsSize+12(FP), CX; \
+ MOVL stackRetOffset+16(FP), BX; \
MOVL SP, SI; \
ADDL BX, DI; \
ADDL BX, SI; \
@@ -550,11 +530,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $16-0
+TEXT callRet<>(SB), NOSPLIT, $20-0
MOVL DX, 0(SP)
MOVL DI, 4(SP)
MOVL SI, 8(SP)
MOVL CX, 12(SP)
+ MOVL $0, 16(SP)
CALL runtime·reflectcallmove(SB)
RET
@@ -619,26 +600,45 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $0-8
MOVL 0(DX), BX
JMP BX // but first run the deferred function
-// Save state of caller into g->sched.
-TEXT gosave<>(SB),NOSPLIT,$0
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT,$0
PUSHL AX
PUSHL BX
get_tls(BX)
MOVL g(BX), BX
LEAL arg+0(FP), AX
MOVL AX, (g_sched+gobuf_sp)(BX)
- MOVL -4(AX), AX
+ MOVL $runtime·systemstack_switch(SB), AX
MOVL AX, (g_sched+gobuf_pc)(BX)
MOVL $0, (g_sched+gobuf_ret)(BX)
// Assert ctxt is zero. See func save.
MOVL (g_sched+gobuf_ctxt)(BX), AX
TESTL AX, AX
JZ 2(PC)
- CALL runtime·badctxt(SB)
+ CALL runtime·abort(SB)
POPL BX
POPL AX
RET
+// func asmcgocall_no_g(fn, arg unsafe.Pointer)
+// Call fn(arg) aligned appropriately for the gcc ABI.
+// Called on a system stack, and there may be no g yet (during needm).
+TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-8
+ MOVL fn+0(FP), AX
+ MOVL arg+4(FP), BX
+ MOVL SP, DX
+ SUBL $32, SP
+ ANDL $~15, SP // alignment, perhaps unnecessary
+ MOVL DX, 8(SP) // save old SP
+ MOVL BX, 0(SP) // first argument in x86-32 ABI
+ CALL AX
+ MOVL 8(SP), DX
+ MOVL DX, SP
+ RET
+
// func asmcgocall(fn, arg unsafe.Pointer) int32
// Call fn(arg) on the scheduler stack,
// aligned appropriately for the gcc ABI.
@@ -663,7 +663,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-12
JEQ noswitch
CMPL DI, m_gsignal(BP)
JEQ noswitch
- CALL gosave<>(SB)
+ CALL gosave_systemstack_switch<>(SB)
get_tls(CX)
MOVL SI, g(CX)
MOVL (g_sched+gobuf_sp)(SI), SP
@@ -1311,7 +1311,7 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0
// The top-most function running on a goroutine
// returns to goexit+PCQuantum.
-TEXT runtime·goexit(SB),NOSPLIT,$0-0
+TEXT runtime·goexit(SB),NOSPLIT|TOPFRAME,$0-0
BYTE $0x90 // NOP
CALL runtime·goexit1(SB) // does not return
// traceback from goexit1 must hit code range of goexit
diff --git a/src/runtime/asm_amd64.s b/src/runtime/asm_amd64.s
index b5d01ba73c..517c5a9d3e 100644
--- a/src/runtime/asm_amd64.s
+++ b/src/runtime/asm_amd64.s
@@ -84,9 +84,7 @@ GLOBL _rt0_amd64_lib_argc<>(SB),NOPTR, $8
DATA _rt0_amd64_lib_argv<>(SB)/8, $0
GLOBL _rt0_amd64_lib_argv<>(SB),NOPTR, $8
-// Defined as ABIInternal since it does not use the stack-based Go ABI (and
-// in addition there are no calls to this entry point from Go code).
-TEXT runtime·rt0_go<ABIInternal>(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// copy arguments forward on an even stack
MOVQ DI, AX // argc
MOVQ SI, BX // argv
@@ -252,38 +250,26 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0
// No per-thread init.
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ CALL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// func gosave(buf *gobuf)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT, $0-8
- MOVQ buf+0(FP), AX // gobuf
- LEAQ buf+0(FP), BX // caller's SP
- MOVQ BX, gobuf_sp(AX)
- MOVQ 0(SP), BX // caller's PC
- MOVQ BX, gobuf_pc(AX)
- MOVQ $0, gobuf_ret(AX)
- MOVQ BP, gobuf_bp(AX)
- // Assert ctxt is zero. See func save.
- MOVQ gobuf_ctxt(AX), BX
- TESTQ BX, BX
- JZ 2(PC)
- CALL runtime·badctxt(SB)
- get_tls(CX)
- MOVQ g(CX), BX
- MOVQ BX, gobuf_g(AX)
- RET
-
// func gogo(buf *gobuf)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB), NOSPLIT, $16-8
+TEXT runtime·gogo(SB), NOSPLIT, $0-8
MOVQ buf+0(FP), BX // gobuf
MOVQ gobuf_g(BX), DX
MOVQ 0(DX), CX // make sure g != nil
+ JMP gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT, $0
get_tls(CX)
MOVQ DX, g(CX)
+ MOVQ DX, R14 // set the g register
MOVQ gobuf_sp(BX), SP // restore SP
MOVQ gobuf_ret(BX), AX
MOVQ gobuf_ctxt(BX), DX
@@ -308,7 +294,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8
MOVQ BX, (g_sched+gobuf_pc)(AX)
LEAQ fn+0(FP), BX // caller's SP
MOVQ BX, (g_sched+gobuf_sp)(AX)
- MOVQ AX, (g_sched+gobuf_g)(AX)
MOVQ BP, (g_sched+gobuf_bp)(AX)
// switch to m->g0 & its stack, call fn
@@ -320,6 +305,7 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8
MOVQ $runtime·badmcall(SB), AX
JMP AX
MOVQ SI, g(CX) // g = m->g0
+ MOVQ SI, R14 // set the g register
MOVQ (g_sched+gobuf_sp)(SI), SP // sp = m->g0->sched.sp
PUSHQ AX
MOVQ DI, DX
@@ -358,19 +344,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
// switch stacks
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVQ $runtime·systemstack_switch(SB), SI
- MOVQ SI, (g_sched+gobuf_pc)(AX)
- MOVQ SP, (g_sched+gobuf_sp)(AX)
- MOVQ AX, (g_sched+gobuf_g)(AX)
- MOVQ BP, (g_sched+gobuf_bp)(AX)
+ CALL gosave_systemstack_switch<>(SB)
// switch to g0
MOVQ DX, g(CX)
+ MOVQ DX, R14 // set the g register
MOVQ (g_sched+gobuf_sp)(DX), BX
- // make it look like mstart called systemstack on g0, to stop traceback
- SUBQ $8, BX
- MOVQ $runtime·mstart(SB), DX
- MOVQ DX, 0(BX)
MOVQ BX, SP
// call target function
@@ -445,7 +424,6 @@ TEXT runtime·morestack(SB),NOSPLIT,$0-0
// Set g->sched to context in f.
MOVQ 0(SP), AX // f's PC
MOVQ AX, (g_sched+gobuf_pc)(SI)
- MOVQ SI, (g_sched+gobuf_g)(SI)
LEAQ 8(SP), AX // f's SP
MOVQ AX, (g_sched+gobuf_sp)(SI)
MOVQ BP, (g_sched+gobuf_bp)(SI)
@@ -464,8 +442,77 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0
MOVL $0, DX
JMP runtime·morestack(SB)
+// REFLECTCALL_USE_REGABI is not defined. It must be defined in conjunction with the
+// register constants in the internal/abi package.
+
+#ifdef REFLECTCALL_USE_REGABI
+// spillArgs stores return values from registers to a *internal/abi.RegArgs in R12.
+TEXT spillArgs<>(SB),NOSPLIT,$0-0
+ MOVQ AX, 0(R12)
+ MOVQ BX, 8(R12)
+ MOVQ CX, 16(R12)
+ MOVQ DI, 24(R12)
+ MOVQ SI, 32(R12)
+ MOVQ R8, 40(R12)
+ MOVQ R9, 48(R12)
+ MOVQ R10, 56(R12)
+ MOVQ R11, 64(R12)
+ MOVQ X0, 72(R12)
+ MOVQ X1, 80(R12)
+ MOVQ X2, 88(R12)
+ MOVQ X3, 96(R12)
+ MOVQ X4, 104(R12)
+ MOVQ X5, 112(R12)
+ MOVQ X6, 120(R12)
+ MOVQ X7, 128(R12)
+ MOVQ X8, 136(R12)
+ MOVQ X9, 144(R12)
+ MOVQ X10, 152(R12)
+ MOVQ X11, 160(R12)
+ MOVQ X12, 168(R12)
+ MOVQ X13, 176(R12)
+ MOVQ X14, 184(R12)
+ RET
+
+// unspillArgs loads args into registers from a *internal/abi.RegArgs in R12.
+TEXT unspillArgs<>(SB),NOSPLIT,$0-0
+ MOVQ 0(R12), AX
+ MOVQ 8(R12), BX
+ MOVQ 16(R12), CX
+ MOVQ 24(R12), DI
+ MOVQ 32(R12), SI
+ MOVQ 40(R12), R8
+ MOVQ 48(R12), R9
+ MOVQ 56(R12), R10
+ MOVQ 64(R12), R11
+ MOVQ 72(R12), X0
+ MOVQ 80(R12), X1
+ MOVQ 88(R12), X2
+ MOVQ 96(R12), X3
+ MOVQ 104(R12), X4
+ MOVQ 112(R12), X5
+ MOVQ 120(R12), X6
+ MOVQ 128(R12), X7
+ MOVQ 136(R12), X8
+ MOVQ 144(R12), X9
+ MOVQ 152(R12), X10
+ MOVQ 160(R12), X11
+ MOVQ 168(R12), X12
+ MOVQ 176(R12), X13
+ MOVQ 184(R12), X14
+ RET
+#else
+// spillArgs stores return values from registers to a pointer in R12.
+TEXT spillArgs<>(SB),NOSPLIT,$0-0
+ RET
+
+// unspillArgs loads args into registers from a pointer in R12.
+TEXT unspillArgs<>(SB),NOSPLIT,$0-0
+ RET
+#endif
+
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -477,8 +524,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0
JMP AX
// Note: can't just "JMP NAME(SB)" - bad inlining results.
-TEXT ·reflectcall<ABIInternal>(SB), NOSPLIT, $0-32
- MOVLQZX argsize+24(FP), CX
+TEXT ·reflectcall<ABIInternal>(SB), NOSPLIT, $0-48
+ MOVLQZX frameSize+32(FP), CX
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -510,23 +557,28 @@ TEXT ·reflectcall<ABIInternal>(SB), NOSPLIT, $0-32
JMP AX
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVQ argptr+16(FP), SI; \
- MOVLQZX argsize+24(FP), CX; \
+ MOVQ stackArgs+16(FP), SI; \
+ MOVLQZX stackArgsSize+24(FP), CX; \
MOVQ SP, DI; \
REP;MOVSB; \
+ /* set up argument registers */ \
+ MOVQ regArgs+40(FP), R12; \
+ CALL unspillArgs<>(SB); \
/* call function */ \
MOVQ f+8(FP), DX; \
PCDATA $PCDATA_StackMapIndex, $0; \
- MOVQ (DX), AX; \
- CALL AX; \
- /* copy return values back */ \
- MOVQ argtype+0(FP), DX; \
- MOVQ argptr+16(FP), DI; \
- MOVLQZX argsize+24(FP), CX; \
- MOVLQZX retoffset+28(FP), BX; \
+ MOVQ (DX), R12; \
+ CALL R12; \
+ /* copy register return values back */ \
+ MOVQ regArgs+40(FP), R12; \
+ CALL spillArgs<>(SB); \
+ MOVLQZX stackArgsSize+24(FP), CX; \
+ MOVLQZX stackRetOffset+28(FP), BX; \
+ MOVQ stackArgs+16(FP), DI; \
+ MOVQ stackArgsType+0(FP), DX; \
MOVQ SP, SI; \
ADDQ BX, DI; \
ADDQ BX, SI; \
@@ -538,12 +590,13 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $32-0
+TEXT callRet<>(SB), NOSPLIT, $40-0
NO_LOCAL_POINTERS
MOVQ DX, 0(SP)
MOVQ DI, 8(SP)
MOVQ SI, 16(SP)
MOVQ CX, 24(SP)
+ MOVQ R12, 32(SP)
CALL runtime·reflectcallmove(SB)
RET
@@ -604,21 +657,44 @@ TEXT runtime·jmpdefer(SB), NOSPLIT, $0-16
MOVQ 0(DX), BX
JMP BX // but first run the deferred function
-// Save state of caller into g->sched. Smashes R8, R9.
-TEXT gosave<>(SB),NOSPLIT,$0
- get_tls(R8)
- MOVQ g(R8), R8
- MOVQ 0(SP), R9
- MOVQ R9, (g_sched+gobuf_pc)(R8)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R9.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT,$0
+#ifndef GOEXPERIMENT_REGABI
+ get_tls(R14)
+ MOVQ g(R14), R14
+#endif
+ MOVQ $runtime·systemstack_switch(SB), R9
+ MOVQ R9, (g_sched+gobuf_pc)(R14)
LEAQ 8(SP), R9
- MOVQ R9, (g_sched+gobuf_sp)(R8)
- MOVQ $0, (g_sched+gobuf_ret)(R8)
- MOVQ BP, (g_sched+gobuf_bp)(R8)
+ MOVQ R9, (g_sched+gobuf_sp)(R14)
+ MOVQ $0, (g_sched+gobuf_ret)(R14)
+ MOVQ BP, (g_sched+gobuf_bp)(R14)
// Assert ctxt is zero. See func save.
- MOVQ (g_sched+gobuf_ctxt)(R8), R9
+ MOVQ (g_sched+gobuf_ctxt)(R14), R9
TESTQ R9, R9
JZ 2(PC)
- CALL runtime·badctxt(SB)
+ CALL runtime·abort(SB)
+ RET
+
+// func asmcgocall_no_g(fn, arg unsafe.Pointer)
+// Call fn(arg) aligned appropriately for the gcc ABI.
+// Called on a system stack, and there may be no g yet (during needm).
+TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16
+ MOVQ fn+0(FP), AX
+ MOVQ arg+8(FP), BX
+ MOVQ SP, DX
+ SUBQ $32, SP
+ ANDQ $~15, SP // alignment
+ MOVQ DX, 8(SP)
+ MOVQ BX, DI // DI = first argument in AMD64 ABI
+ MOVQ BX, CX // CX = first argument in Win64
+ CALL AX
+ MOVQ 8(SP), DX
+ MOVQ DX, SP
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -649,7 +725,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
// Switch to system stack.
MOVQ m_g0(R8), SI
- CALL gosave<>(SB)
+ CALL gosave_systemstack_switch<>(SB)
MOVQ SI, g(CX)
MOVQ (g_sched+gobuf_sp)(SI), SP
@@ -846,6 +922,7 @@ settls:
TEXT setg_gcc<>(SB),NOSPLIT,$0
get_tls(AX)
MOVQ DI, g(AX)
+ MOVQ DI, R14 // set the g register
RET
TEXT runtime·abort(SB),NOSPLIT,$0-0
@@ -1367,7 +1444,7 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0
// so as to make it identifiable to traceback (this
// function it used as a sentinel; traceback wants to
// see the func PC, not a wrapper PC).
-TEXT runtime·goexit<ABIInternal>(SB),NOSPLIT,$0-0
+TEXT runtime·goexit<ABIInternal>(SB),NOSPLIT|TOPFRAME,$0-0
BYTE $0x90 // NOP
CALL runtime·goexit1(SB) // does not return
// traceback from goexit1 must hit code range of goexit
@@ -1382,6 +1459,18 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
POPQ R15
RET
+// Initialize special registers then jump to sigpanic.
+// This function is injected from the signal handler for panicking
+// signals. It is quite painful to set X15 in the signal context,
+// so we do it here.
+TEXT ·sigpanic0<ABIInternal>(SB),NOSPLIT,$0-0
+#ifdef GOEXPERIMENT_REGABI
+ get_tls(R14)
+ MOVQ g(R14), R14
+ XORPS X15, X15
+#endif
+ JMP ·sigpanic<ABIInternal>(SB)
+
// gcWriteBarrier performs a heap pointer write and informs the GC.
//
// gcWriteBarrier does NOT follow the Go ABI. It takes two arguments:
@@ -1390,24 +1479,28 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0
// It clobbers FLAGS. It does not clobber any general-purpose registers,
// but may clobber others (e.g., SSE registers).
// Defined as ABIInternal since it does not use the stack-based Go ABI.
-TEXT runtime·gcWriteBarrier<ABIInternal>(SB),NOSPLIT,$120
+TEXT runtime·gcWriteBarrier<ABIInternal>(SB),NOSPLIT,$112
// Save the registers clobbered by the fast path. This is slightly
// faster than having the caller spill these.
- MOVQ R14, 104(SP)
- MOVQ R13, 112(SP)
+ MOVQ R12, 96(SP)
+ MOVQ R13, 104(SP)
// TODO: Consider passing g.m.p in as an argument so they can be shared
// across a sequence of write barriers.
+#ifdef GOEXPERIMENT_REGABI
+ MOVQ g_m(R14), R13
+#else
get_tls(R13)
MOVQ g(R13), R13
MOVQ g_m(R13), R13
+#endif
MOVQ m_p(R13), R13
- MOVQ (p_wbBuf+wbBuf_next)(R13), R14
+ MOVQ (p_wbBuf+wbBuf_next)(R13), R12
// Increment wbBuf.next position.
- LEAQ 16(R14), R14
- MOVQ R14, (p_wbBuf+wbBuf_next)(R13)
- CMPQ R14, (p_wbBuf+wbBuf_end)(R13)
+ LEAQ 16(R12), R12
+ MOVQ R12, (p_wbBuf+wbBuf_next)(R13)
+ CMPQ R12, (p_wbBuf+wbBuf_end)(R13)
// Record the write.
- MOVQ AX, -16(R14) // Record value
+ MOVQ AX, -16(R12) // Record value
// Note: This turns bad pointer writes into bad
// pointer reads, which could be confusing. We could avoid
// reading from obviously bad pointers, which would
@@ -1415,12 +1508,12 @@ TEXT runtime·gcWriteBarrier<ABIInternal>(SB),NOSPLIT,$120
// patch this up in the signal handler, or use XCHG to
// combine the read and the write.
MOVQ (DI), R13
- MOVQ R13, -8(R14) // Record *slot
+ MOVQ R13, -8(R12) // Record *slot
// Is the buffer full? (flags set in CMPQ above)
JEQ flush
ret:
- MOVQ 104(SP), R14
- MOVQ 112(SP), R13
+ MOVQ 96(SP), R12
+ MOVQ 104(SP), R13
// Do the write.
MOVQ AX, (DI)
RET
@@ -1450,10 +1543,10 @@ flush:
MOVQ R9, 64(SP)
MOVQ R10, 72(SP)
MOVQ R11, 80(SP)
- MOVQ R12, 88(SP)
+ // R12 already saved
// R13 already saved
- // R14 already saved
- MOVQ R15, 96(SP)
+ // R14 is g
+ MOVQ R15, 88(SP)
// This takes arguments DI and AX
CALL runtime·wbBufFlush(SB)
@@ -1469,8 +1562,7 @@ flush:
MOVQ 64(SP), R9
MOVQ 72(SP), R10
MOVQ 80(SP), R11
- MOVQ 88(SP), R12
- MOVQ 96(SP), R15
+ MOVQ 88(SP), R15
JMP ret
// gcWriteBarrierCX is gcWriteBarrier, but with args in DI and CX.
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index c54b4eb006..9896ab4383 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -112,7 +112,7 @@ GLOBL _rt0_arm_lib_argv<>(SB),NOPTR,$4
// using NOFRAME means do not save LR on stack.
// argc is in R0, argv is in R1.
-TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
MOVW $0xcafebabe, R12
// copy arguments forward on an even stack
@@ -202,44 +202,24 @@ TEXT runtime·asminit(SB),NOSPLIT,$0-0
WORD $0xeee1ba10 // vmsr fpscr, r11
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ BL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB),NOSPLIT|NOFRAME,$0-4
- MOVW buf+0(FP), R0
- MOVW R13, gobuf_sp(R0)
- MOVW LR, gobuf_pc(R0)
- MOVW g, gobuf_g(R0)
- MOVW $0, R11
- MOVW R11, gobuf_lr(R0)
- MOVW R11, gobuf_ret(R0)
- // Assert ctxt is zero. See func save.
- MOVW gobuf_ctxt(R0), R0
- CMP R0, R11
- B.EQ 2(PC)
- CALL runtime·badctxt(SB)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB),NOSPLIT,$8-4
+TEXT runtime·gogo(SB),NOSPLIT|NOFRAME,$0-4
MOVW buf+0(FP), R1
MOVW gobuf_g(R1), R0
- BL setg<>(SB)
+ MOVW 0(R0), R2 // make sure g != nil
+ B gogo<>(SB)
- // NOTE: We updated g above, and we are about to update SP.
- // Until LR and PC are also updated, the g/SP/LR/PC quadruple
- // are out of sync and must not be used as the basis of a traceback.
- // Sigprof skips the traceback when SP is not within g's bounds,
- // and when the PC is inside this function, runtime.gogo.
- // Since we are about to update SP, until we complete runtime.gogo
- // we must not leave this function. In particular, no calls
- // after this point: it must be straight-line code until the
- // final B instruction.
- // See large comment in sigprof for more details.
+TEXT gogo<>(SB),NOSPLIT|NOFRAME,$0
+ BL setg<>(SB)
MOVW gobuf_sp(R1), R13 // restore SP==R13
MOVW gobuf_lr(R1), LR
MOVW gobuf_ret(R1), R0
@@ -263,7 +243,6 @@ TEXT runtime·mcall(SB),NOSPLIT|NOFRAME,$0-4
MOVW LR, (g_sched+gobuf_pc)(g)
MOVW $0, R11
MOVW R11, (g_sched+gobuf_lr)(g)
- MOVW g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOVW g, R1
@@ -322,24 +301,14 @@ TEXT runtime·systemstack(SB),NOSPLIT,$0-4
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVW $runtime·systemstack_switch(SB), R3
- ADD $4, R3, R3 // get past push {lr}
- MOVW R3, (g_sched+gobuf_pc)(g)
- MOVW R13, (g_sched+gobuf_sp)(g)
- MOVW LR, (g_sched+gobuf_lr)(g)
- MOVW g, (g_sched+gobuf_g)(g)
+ BL gosave_systemstack_switch<>(SB)
// switch to g0
MOVW R0, R5
MOVW R2, R0
BL setg<>(SB)
MOVW R5, R0
- MOVW (g_sched+gobuf_sp)(R2), R3
- // make it look like mstart called systemstack on g0, to stop traceback
- SUB $4, R3, R3
- MOVW $runtime·mstart(SB), R4
- MOVW R4, 0(R3)
- MOVW R3, R13
+ MOVW (g_sched+gobuf_sp)(R2), R13
// call target function
MOVW R0, R7
@@ -421,7 +390,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
B runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -432,8 +401,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
MOVW $NAME(SB), R1; \
B (R1)
-TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20
- MOVW argsize+12(FP), R0
+TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-28
+ MOVW frameSize+20(FP), R0
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -465,11 +434,11 @@ TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20
B (R1)
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-28; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVW argptr+8(FP), R0; \
- MOVW argsize+12(FP), R2; \
+ MOVW stackArgs+8(FP), R0; \
+ MOVW stackArgsSize+12(FP), R2; \
ADD $4, R13, R1; \
CMP $0, R2; \
B.EQ 5(PC); \
@@ -483,10 +452,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
PCDATA $PCDATA_StackMapIndex, $0; \
BL (R0); \
/* copy return values back */ \
- MOVW argtype+0(FP), R4; \
- MOVW argptr+8(FP), R0; \
- MOVW argsize+12(FP), R2; \
- MOVW retoffset+16(FP), R3; \
+ MOVW stackArgsType+0(FP), R4; \
+ MOVW stackArgs+8(FP), R0; \
+ MOVW stackArgsSize+12(FP), R2; \
+ MOVW stackArgsRetOffset+16(FP), R3; \
ADD $4, R13, R1; \
ADD R3, R1; \
ADD R3, R0; \
@@ -498,11 +467,13 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-20; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $16-0
+TEXT callRet<>(SB), NOSPLIT, $20-0
MOVW R4, 4(R13)
MOVW R0, 8(R13)
MOVW R1, 12(R13)
MOVW R2, 16(R13)
+ MOVW $0, R7
+ MOVW R7, 20(R13)
BL runtime·reflectcallmove(SB)
RET
@@ -539,10 +510,6 @@ CALLFN(·call1073741824, 1073741824)
// 1. grab stored LR for caller
// 2. sub 4 bytes to get back to BL deferreturn
// 3. B to fn
-// TODO(rsc): Push things on stack and then use pop
-// to load all registers simultaneously, so that a profiling
-// interrupt can never see mismatched SP/LR/PC.
-// (And double-check that pop is atomic in that way.)
TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8
MOVW 0(R13), LR
MOVW $-4(LR), LR // BL deferreturn
@@ -552,19 +519,39 @@ TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8
MOVW 0(R7), R1
B (R1)
-// Save state of caller into g->sched. Smashes R11.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOVW LR, (g_sched+gobuf_pc)(g)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R11.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOVW $runtime·systemstack_switch(SB), R11
+ ADD $4, R11 // get past push {lr}
+ MOVW R11, (g_sched+gobuf_pc)(g)
MOVW R13, (g_sched+gobuf_sp)(g)
MOVW $0, R11
MOVW R11, (g_sched+gobuf_lr)(g)
MOVW R11, (g_sched+gobuf_ret)(g)
- MOVW R11, (g_sched+gobuf_ctxt)(g)
// Assert ctxt is zero. See func save.
MOVW (g_sched+gobuf_ctxt)(g), R11
- CMP $0, R11
+ TST R11, R11
B.EQ 2(PC)
- CALL runtime·badctxt(SB)
+ BL runtime·abort(SB)
+ RET
+
+// func asmcgocall_no_g(fn, arg unsafe.Pointer)
+// Call fn(arg) aligned appropriately for the gcc ABI.
+// Called on a system stack, and there may be no g yet (during needm).
+TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-8
+ MOVW fn+0(FP), R1
+ MOVW arg+4(FP), R0
+ MOVW R13, R2
+ SUB $32, R13
+ BIC $0x7, R13 // alignment for gcc ABI
+ MOVW R2, 8(R13)
+ BL (R1)
+ MOVW 8(R13), R2
+ MOVW R2, R13
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -590,7 +577,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-12
MOVW m_g0(R8), R3
CMP R3, g
BEQ nosave
- BL gosave<>(SB)
+ BL gosave_systemstack_switch<>(SB)
MOVW R0, R5
MOVW R3, R0
BL setg<>(SB)
diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s
index a09172f0c9..3709f1d95e 100644
--- a/src/runtime/asm_arm64.s
+++ b/src/runtime/asm_arm64.s
@@ -8,7 +8,7 @@
#include "funcdata.h"
#include "textflag.h"
-TEXT runtime·rt0_go(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// SP = stack; R0 = argc; R1 = argv
SUB $32, RSP
@@ -73,6 +73,10 @@ nocgo:
BL runtime·check(SB)
+#ifdef GOOS_windows
+ BL runtime·wintls(SB)
+#endif
+
MOVW 8(RSP), R0 // copy argc
MOVW R0, -8(RSP)
MOVD 16(RSP), R0 // copy argv
@@ -109,35 +113,26 @@ TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ BL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8
- MOVD buf+0(FP), R3
- MOVD RSP, R0
- MOVD R0, gobuf_sp(R3)
- MOVD R29, gobuf_bp(R3)
- MOVD LR, gobuf_pc(R3)
- MOVD g, gobuf_g(R3)
- MOVD ZR, gobuf_lr(R3)
- MOVD ZR, gobuf_ret(R3)
- // Assert ctxt is zero. See func save.
- MOVD gobuf_ctxt(R3), R0
- CBZ R0, 2(PC)
- CALL runtime·badctxt(SB)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB), NOSPLIT, $24-8
+TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8
MOVD buf+0(FP), R5
- MOVD gobuf_g(R5), g
+ MOVD gobuf_g(R5), R6
+ MOVD 0(R6), R4 // make sure g != nil
+ B gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0
+ MOVD R6, g
BL runtime·save_g(SB)
- MOVD 0(g), R4 // make sure g is not nil
MOVD gobuf_sp(R5), R0
MOVD R0, RSP
MOVD gobuf_bp(R5), R29
@@ -164,7 +159,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
MOVD R29, (g_sched+gobuf_bp)(g)
MOVD LR, (g_sched+gobuf_pc)(g)
MOVD $0, (g_sched+gobuf_lr)(g)
- MOVD g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOVD g, R3
@@ -222,24 +216,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVD $runtime·systemstack_switch(SB), R6
- ADD $8, R6 // get past prologue
- MOVD R6, (g_sched+gobuf_pc)(g)
- MOVD RSP, R0
- MOVD R0, (g_sched+gobuf_sp)(g)
- MOVD R29, (g_sched+gobuf_bp)(g)
- MOVD $0, (g_sched+gobuf_lr)(g)
- MOVD g, (g_sched+gobuf_g)(g)
+ BL gosave_systemstack_switch<>(SB)
// switch to g0
MOVD R5, g
BL runtime·save_g(SB)
MOVD (g_sched+gobuf_sp)(g), R3
- // make it look like mstart called systemstack on g0, to stop traceback
- SUB $16, R3
- AND $~15, R3
- MOVD $runtime·mstart(SB), R4
- MOVD R4, 0(R3)
MOVD R3, RSP
MOVD (g_sched+gobuf_bp)(g), R29
@@ -329,7 +311,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
B runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -342,8 +324,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
B (R27)
// Note: can't just "B NAME(SB)" - bad inlining results.
-TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
- MOVWU argsize+24(FP), R16
+TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48
+ MOVWU frameSize+32(FP), R16
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -375,11 +357,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
B (R0)
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVD arg+16(FP), R3; \
- MOVWU argsize+24(FP), R4; \
+ MOVD stackArgs+16(FP), R3; \
+ MOVWU stackArgsSize+24(FP), R4; \
ADD $8, RSP, R5; \
BIC $0xf, R4, R6; \
CBZ R6, 6(PC); \
@@ -405,10 +387,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
PCDATA $PCDATA_StackMapIndex, $0; \
BL (R0); \
/* copy return values back */ \
- MOVD argtype+0(FP), R7; \
- MOVD arg+16(FP), R3; \
- MOVWU n+24(FP), R4; \
- MOVWU retoffset+28(FP), R6; \
+ MOVD stackArgsType+0(FP), R7; \
+ MOVD stackArgs+16(FP), R3; \
+ MOVWU stackArgsSize+24(FP), R4; \
+ MOVWU stackRetOffset+28(FP), R6; \
ADD $8, RSP, R5; \
ADD R6, R5; \
ADD R6, R3; \
@@ -420,11 +402,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $40-0
+TEXT callRet<>(SB), NOSPLIT, $48-0
MOVD R7, 8(RSP)
MOVD R3, 16(RSP)
MOVD R5, 24(RSP)
MOVD R4, 32(RSP)
+ MOVD $0, 40(RSP)
BL runtime·reflectcallmove(SB)
RET
@@ -875,9 +858,15 @@ TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16
MOVD 0(R26), R3
B (R3)
-// Save state of caller into g->sched. Smashes R0.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOVD LR, (g_sched+gobuf_pc)(g)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R0.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·systemstack_switch(SB), R0
+ ADD $8, R0 // get past prologue
+ MOVD R0, (g_sched+gobuf_pc)(g)
MOVD RSP, R0
MOVD R0, (g_sched+gobuf_sp)(g)
MOVD R29, (g_sched+gobuf_bp)(g)
@@ -886,7 +875,18 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
// Assert ctxt is zero. See func save.
MOVD (g_sched+gobuf_ctxt)(g), R0
CBZ R0, 2(PC)
- CALL runtime·badctxt(SB)
+ CALL runtime·abort(SB)
+ RET
+
+// func asmcgocall_no_g(fn, arg unsafe.Pointer)
+// Call fn(arg) aligned appropriately for the gcc ABI.
+// Called on a system stack, and there may be no g yet (during needm).
+TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16
+ MOVD fn+0(FP), R1
+ MOVD arg+8(FP), R0
+ SUB $16, RSP // skip over saved frame pointer below RSP
+ BL (R1)
+ ADD $16, RSP // skip over saved frame pointer below RSP
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -913,8 +913,8 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
BEQ nosave
// Switch to system stack.
- MOVD R0, R9 // gosave<> and save_g might clobber R0
- BL gosave<>(SB)
+ MOVD R0, R9 // gosave_systemstack_switch<> and save_g might clobber R0
+ BL gosave_systemstack_switch<>(SB)
MOVD R3, g
BL runtime·save_g(SB)
MOVD (g_sched+gobuf_sp)(g), R0
@@ -967,7 +967,7 @@ nosave:
BL (R1)
// Restore stack pointer.
MOVD 8(RSP), R2
- MOVD R2, RSP
+ MOVD R2, RSP
MOVD R0, ret+16(FP)
RET
@@ -1115,6 +1115,9 @@ TEXT setg_gcc<>(SB),NOSPLIT,$8
MOVD savedR27-8(SP), R27
RET
+TEXT runtime·emptyfunc(SB),0,$0-0
+ RET
+
TEXT runtime·abort(SB),NOSPLIT|NOFRAME,$0-0
MOVD ZR, R0
MOVD (R0), R0
diff --git a/src/runtime/asm_mips64x.s b/src/runtime/asm_mips64x.s
index 19781f7885..cee4b528bb 100644
--- a/src/runtime/asm_mips64x.s
+++ b/src/runtime/asm_mips64x.s
@@ -11,7 +11,7 @@
#define REGCTXT R22
-TEXT runtime·rt0_go(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// R29 = stack; R4 = argc; R5 = argv
ADDV $-24, R29
@@ -85,30 +85,24 @@ TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ JAL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8
- MOVV buf+0(FP), R1
- MOVV R29, gobuf_sp(R1)
- MOVV R31, gobuf_pc(R1)
- MOVV g, gobuf_g(R1)
- MOVV R0, gobuf_lr(R1)
- MOVV R0, gobuf_ret(R1)
- // Assert ctxt is zero. See func save.
- MOVV gobuf_ctxt(R1), R1
- BEQ R1, 2(PC)
- JAL runtime·badctxt(SB)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB), NOSPLIT, $16-8
+TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8
MOVV buf+0(FP), R3
- MOVV gobuf_g(R3), g // make sure g is not nil
+ MOVV gobuf_g(R3), R4
+ MOVV 0(R4), R0 // make sure g != nil
+ JMP gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0
+ MOVV R4, g
JAL runtime·save_g(SB)
MOVV 0(g), R2
@@ -132,7 +126,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
MOVV R29, (g_sched+gobuf_sp)(g)
MOVV R31, (g_sched+gobuf_pc)(g)
MOVV R0, (g_sched+gobuf_lr)(g)
- MOVV g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOVV g, R1
@@ -184,21 +177,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVV $runtime·systemstack_switch(SB), R4
- ADDV $8, R4 // get past prologue
- MOVV R4, (g_sched+gobuf_pc)(g)
- MOVV R29, (g_sched+gobuf_sp)(g)
- MOVV R0, (g_sched+gobuf_lr)(g)
- MOVV g, (g_sched+gobuf_g)(g)
+ JAL gosave_systemstack_switch<>(SB)
// switch to g0
MOVV R3, g
JAL runtime·save_g(SB)
MOVV (g_sched+gobuf_sp)(g), R1
- // make it look like mstart called systemstack on g0, to stop traceback
- ADDV $-8, R1
- MOVV $runtime·mstart(SB), R2
- MOVV R2, 0(R1)
MOVV R1, R29
// call target function
@@ -279,7 +263,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
JMP runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -292,8 +276,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
JMP (R4)
// Note: can't just "BR NAME(SB)" - bad inlining results.
-TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
- MOVWU argsize+24(FP), R1
+TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48
+ MOVWU frameSize+32(FP), R1
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -325,11 +309,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
JMP (R4)
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVV arg+16(FP), R1; \
- MOVWU argsize+24(FP), R2; \
+ MOVV stackArgs+16(FP), R1; \
+ MOVWU stackArgsSize+24(FP), R2; \
MOVV R29, R3; \
ADDV $8, R3; \
ADDV R3, R2; \
@@ -345,10 +329,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
PCDATA $PCDATA_StackMapIndex, $0; \
JAL (R4); \
/* copy return values back */ \
- MOVV argtype+0(FP), R5; \
- MOVV arg+16(FP), R1; \
- MOVWU n+24(FP), R2; \
- MOVWU retoffset+28(FP), R4; \
+ MOVV stackArgsType+0(FP), R5; \
+ MOVV stackArgs+16(FP), R1; \
+ MOVWU stackArgsSize+24(FP), R2; \
+ MOVWU stackRetOffset+28(FP), R4; \
ADDV $8, R29, R3; \
ADDV R4, R3; \
ADDV R4, R1; \
@@ -360,11 +344,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $32-0
+TEXT callRet<>(SB), NOSPLIT, $40-0
MOVV R5, 8(R29)
MOVV R1, 16(R29)
MOVV R3, 24(R29)
MOVV R2, 32(R29)
+ MOVV $0, 40(R29)
JAL runtime·reflectcallmove(SB)
RET
@@ -415,16 +400,31 @@ TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16
MOVV 0(REGCTXT), R4
JMP (R4)
-// Save state of caller into g->sched. Smashes R1.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOVV R31, (g_sched+gobuf_pc)(g)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R1.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOVV $runtime·systemstack_switch(SB), R1
+ ADDV $8, R1 // get past prologue
+ MOVV R1, (g_sched+gobuf_pc)(g)
MOVV R29, (g_sched+gobuf_sp)(g)
MOVV R0, (g_sched+gobuf_lr)(g)
MOVV R0, (g_sched+gobuf_ret)(g)
// Assert ctxt is zero. See func save.
MOVV (g_sched+gobuf_ctxt)(g), R1
BEQ R1, 2(PC)
- JAL runtime·badctxt(SB)
+ JAL runtime·abort(SB)
+ RET
+
+// func asmcgocall_no_g(fn, arg unsafe.Pointer)
+// Call fn(arg) aligned appropriately for the gcc ABI.
+// Called on a system stack, and there may be no g yet (during needm).
+TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16
+ MOVV fn+0(FP), R25
+ MOVV arg+8(FP), R4
+ JAL (R25)
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -445,7 +445,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
MOVV m_g0(R5), R6
BEQ R6, g, g0
- JAL gosave<>(SB)
+ JAL gosave_systemstack_switch<>(SB)
MOVV R6, g
JAL runtime·save_g(SB)
MOVV (g_sched+gobuf_sp)(g), R29
diff --git a/src/runtime/asm_mipsx.s b/src/runtime/asm_mipsx.s
index ee87d81436..17fbc902c2 100644
--- a/src/runtime/asm_mipsx.s
+++ b/src/runtime/asm_mipsx.s
@@ -11,7 +11,7 @@
#define REGCTXT R22
-TEXT runtime·rt0_go(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// R29 = stack; R4 = argc; R5 = argv
ADDU $-12, R29
@@ -86,33 +86,25 @@ TEXT runtime·breakpoint(SB),NOSPLIT,$0-0
TEXT runtime·asminit(SB),NOSPLIT,$0-0
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ JAL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB),NOSPLIT|NOFRAME,$0-4
- MOVW buf+0(FP), R1
- MOVW R29, gobuf_sp(R1)
- MOVW R31, gobuf_pc(R1)
- MOVW g, gobuf_g(R1)
- MOVW R0, gobuf_lr(R1)
- MOVW R0, gobuf_ret(R1)
- // Assert ctxt is zero. See func save.
- MOVW gobuf_ctxt(R1), R1
- BEQ R1, 2(PC)
- JAL runtime·badctxt(SB)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB),NOSPLIT,$8-4
+TEXT runtime·gogo(SB),NOSPLIT|NOFRAME,$0-4
MOVW buf+0(FP), R3
- MOVW gobuf_g(R3), g // make sure g is not nil
- JAL runtime·save_g(SB)
+ MOVW gobuf_g(R3), R4
+ MOVW 0(R4), R5 // make sure g != nil
+ JMP gogo<>(SB)
- MOVW 0(g), R2
+TEXT gogo<>(SB),NOSPLIT|NOFRAME,$0
+ MOVW R4, g
+ JAL runtime·save_g(SB)
MOVW gobuf_sp(R3), R29
MOVW gobuf_lr(R3), R31
MOVW gobuf_ret(R3), R1
@@ -133,7 +125,6 @@ TEXT runtime·mcall(SB),NOSPLIT|NOFRAME,$0-4
MOVW R29, (g_sched+gobuf_sp)(g)
MOVW R31, (g_sched+gobuf_pc)(g)
MOVW R0, (g_sched+gobuf_lr)(g)
- MOVW g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOVW g, R1
@@ -185,21 +176,12 @@ TEXT runtime·systemstack(SB),NOSPLIT,$0-4
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVW $runtime·systemstack_switch(SB), R4
- ADDU $8, R4 // get past prologue
- MOVW R4, (g_sched+gobuf_pc)(g)
- MOVW R29, (g_sched+gobuf_sp)(g)
- MOVW R0, (g_sched+gobuf_lr)(g)
- MOVW g, (g_sched+gobuf_g)(g)
+ JAL gosave_systemstack_switch<>(SB)
// switch to g0
MOVW R3, g
JAL runtime·save_g(SB)
MOVW (g_sched+gobuf_sp)(g), R1
- // make it look like mstart called systemstack on g0, to stop traceback
- ADDU $-4, R1
- MOVW $runtime·mstart(SB), R2
- MOVW R2, 0(R1)
MOVW R1, R29
// call target function
@@ -280,7 +262,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0
JMP runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
@@ -291,8 +273,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT,$0-0
MOVW $NAME(SB), R4; \
JMP (R4)
-TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20
- MOVW argsize+12(FP), R1
+TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-28
+ MOVW frameSize+20(FP), R1
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
@@ -325,11 +307,11 @@ TEXT ·reflectcall(SB),NOSPLIT|NOFRAME,$0-20
JMP (R4)
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB),WRAPPER,$MAXSIZE-20; \
+TEXT NAME(SB),WRAPPER,$MAXSIZE-28; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVW arg+8(FP), R1; \
- MOVW argsize+12(FP), R2; \
+ MOVW stackArgs+8(FP), R1; \
+ MOVW stackArgsSize+12(FP), R2; \
MOVW R29, R3; \
ADDU $4, R3; \
ADDU R3, R2; \
@@ -345,10 +327,10 @@ TEXT NAME(SB),WRAPPER,$MAXSIZE-20; \
PCDATA $PCDATA_StackMapIndex, $0; \
JAL (R4); \
/* copy return values back */ \
- MOVW argtype+0(FP), R5; \
- MOVW arg+8(FP), R1; \
- MOVW n+12(FP), R2; \
- MOVW retoffset+16(FP), R4; \
+ MOVW stackArgsType+0(FP), R5; \
+ MOVW stackArgs+8(FP), R1; \
+ MOVW stackArgsSize+12(FP), R2; \
+ MOVW stackRetOffset+16(FP), R4; \
ADDU $4, R29, R3; \
ADDU R4, R3; \
ADDU R4, R1; \
@@ -360,11 +342,12 @@ TEXT NAME(SB),WRAPPER,$MAXSIZE-20; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $16-0
+TEXT callRet<>(SB), NOSPLIT, $20-0
MOVW R5, 4(R29)
MOVW R1, 8(R29)
MOVW R3, 12(R29)
MOVW R2, 16(R29)
+ MOVW $0, 20(R29)
JAL runtime·reflectcallmove(SB)
RET
@@ -415,16 +398,22 @@ TEXT runtime·jmpdefer(SB),NOSPLIT,$0-8
MOVW 0(REGCTXT), R4
JMP (R4)
-// Save state of caller into g->sched. Smashes R1.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOVW R31, (g_sched+gobuf_pc)(g)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R1.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOVW $runtime·systemstack_switch(SB), R1
+ ADDU $8, R1 // get past prologue
+ MOVW R1, (g_sched+gobuf_pc)(g)
MOVW R29, (g_sched+gobuf_sp)(g)
MOVW R0, (g_sched+gobuf_lr)(g)
MOVW R0, (g_sched+gobuf_ret)(g)
// Assert ctxt is zero. See func save.
MOVW (g_sched+gobuf_ctxt)(g), R1
BEQ R1, 2(PC)
- JAL runtime·badctxt(SB)
+ JAL runtime·abort(SB)
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -445,7 +434,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-12
MOVW m_g0(R5), R6
BEQ R6, g, g0
- JAL gosave<>(SB)
+ JAL gosave_systemstack_switch<>(SB)
MOVW R6, g
JAL runtime·save_g(SB)
MOVW (g_sched+gobuf_sp)(g), R29
diff --git a/src/runtime/asm_ppc64x.s b/src/runtime/asm_ppc64x.s
index dc34c0e4c8..6544048497 100644
--- a/src/runtime/asm_ppc64x.s
+++ b/src/runtime/asm_ppc64x.s
@@ -16,7 +16,7 @@
#define cgoCalleeStackSize 32
#endif
-TEXT runtime·rt0_go(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// R1 = stack; R3 = argc; R4 = argv; R13 = C TLS base pointer
// initialize essential registers
@@ -124,35 +124,26 @@ TEXT runtime·reginit(SB),NOSPLIT|NOFRAME,$0-0
XOR R0, R0
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ BL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8
- MOVD buf+0(FP), R3
- MOVD R1, gobuf_sp(R3)
- MOVD LR, R31
- MOVD R31, gobuf_pc(R3)
- MOVD g, gobuf_g(R3)
- MOVD R0, gobuf_lr(R3)
- MOVD R0, gobuf_ret(R3)
- // Assert ctxt is zero. See func save.
- MOVD gobuf_ctxt(R3), R3
- CMP R0, R3
- BEQ 2(PC)
- BL runtime·badctxt(SB)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB), NOSPLIT, $16-8
+TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8
MOVD buf+0(FP), R5
- MOVD gobuf_g(R5), g // make sure g is not nil
+ MOVD gobuf_g(R5), R6
+ MOVD 0(R6), R4 // make sure g != nil
+ BR gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0
+ MOVD R6, g
BL runtime·save_g(SB)
- MOVD 0(g), R4
MOVD gobuf_sp(R5), R1
MOVD gobuf_lr(R5), R31
#ifndef GOOS_aix
@@ -180,7 +171,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
MOVD LR, R31
MOVD R31, (g_sched+gobuf_pc)(g)
MOVD R0, (g_sched+gobuf_lr)(g)
- MOVD g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOVD g, R3
@@ -246,22 +236,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVD $runtime·systemstack_switch(SB), R6
- ADD $16, R6 // get past prologue (including r2-setting instructions when they're there)
- MOVD R6, (g_sched+gobuf_pc)(g)
- MOVD R1, (g_sched+gobuf_sp)(g)
- MOVD R0, (g_sched+gobuf_lr)(g)
- MOVD g, (g_sched+gobuf_g)(g)
+ BL gosave_systemstack_switch<>(SB)
// switch to g0
MOVD R5, g
BL runtime·save_g(SB)
- MOVD (g_sched+gobuf_sp)(g), R3
- // make it look like mstart called systemstack on g0, to stop traceback
- SUB $FIXED_FRAME, R3
- MOVD $runtime·mstart(SB), R4
- MOVD R4, 0(R3)
- MOVD R3, R1
+ MOVD (g_sched+gobuf_sp)(g), R1
// call target function
MOVD 0(R11), R12 // code pointer
@@ -356,7 +336,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
BR runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -370,8 +350,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
BR (CTR)
// Note: can't just "BR NAME(SB)" - bad inlining results.
-TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
- MOVWZ argsize+24(FP), R3
+TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48
+ MOVWZ frameSize+32(FP), R3
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -404,11 +384,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
BR (CTR)
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVD arg+16(FP), R3; \
- MOVWZ argsize+24(FP), R4; \
+ MOVD stackArgs+16(FP), R3; \
+ MOVWZ stackArgsSize+24(FP), R4; \
MOVD R1, R5; \
CMP R4, $8; \
BLT tailsetup; \
@@ -456,10 +436,10 @@ callfn: \
MOVD 24(R1), R2; \
#endif \
/* copy return values back */ \
- MOVD argtype+0(FP), R7; \
- MOVD arg+16(FP), R3; \
- MOVWZ n+24(FP), R4; \
- MOVWZ retoffset+28(FP), R6; \
+ MOVD stackArgsType+0(FP), R7; \
+ MOVD stackArgs+16(FP), R3; \
+ MOVWZ stackArgsSize+24(FP), R4; \
+ MOVWZ stackRetOffset+28(FP), R6; \
ADD $FIXED_FRAME, R1, R5; \
ADD R6, R5; \
ADD R6, R3; \
@@ -471,11 +451,12 @@ callfn: \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $32-0
+TEXT callRet<>(SB), NOSPLIT, $40-0
MOVD R7, FIXED_FRAME+0(R1)
MOVD R3, FIXED_FRAME+8(R1)
MOVD R5, FIXED_FRAME+16(R1)
MOVD R4, FIXED_FRAME+24(R1)
+ MOVD $0, FIXED_FRAME+32(R1)
BL runtime·reflectcallmove(SB)
RET
@@ -550,9 +531,14 @@ TEXT runtime·jmpdefer(SB), NOSPLIT|NOFRAME, $0-16
MOVD R12, CTR
BR (CTR)
-// Save state of caller into g->sched. Smashes R31.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOVD LR, R31
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R31.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·systemstack_switch(SB), R31
+ ADD $16, R31 // get past prologue (including r2-setting instructions when they're there)
MOVD R31, (g_sched+gobuf_pc)(g)
MOVD R1, (g_sched+gobuf_sp)(g)
MOVD R0, (g_sched+gobuf_lr)(g)
@@ -561,7 +547,7 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
MOVD (g_sched+gobuf_ctxt)(g), R31
CMP R0, R31
BEQ 2(PC)
- BL runtime·badctxt(SB)
+ BL runtime·abort(SB)
RET
#ifdef GOOS_aix
@@ -593,7 +579,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
MOVD m_g0(R8), R6
CMP R6, g
BEQ g0
- BL gosave<>(SB)
+ BL gosave_systemstack_switch<>(SB)
MOVD R6, g
BL runtime·save_g(SB)
MOVD (g_sched+gobuf_sp)(g), R1
diff --git a/src/runtime/asm_riscv64.s b/src/runtime/asm_riscv64.s
index 01b42dc3de..d8d5252ed5 100644
--- a/src/runtime/asm_riscv64.s
+++ b/src/runtime/asm_riscv64.s
@@ -7,7 +7,7 @@
#include "textflag.h"
// func rt0_go()
-TEXT runtime·rt0_go(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// X2 = stack; A0 = argc; A1 = argv
ADD $-24, X2
MOV A0, 8(X2) // argc
@@ -70,6 +70,10 @@ nocgo:
WORD $0 // crash if reached
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ CALL runtime·mstart0(SB)
+ RET // not reached
+
// void setg_gcc(G*); set g called from gcc with g in A0
TEXT setg_gcc<>(SB),NOSPLIT,$0-0
MOV A0, g
@@ -114,21 +118,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOV $runtime·systemstack_switch(SB), T2
- ADD $8, T2 // get past prologue
- MOV T2, (g_sched+gobuf_pc)(g)
- MOV X2, (g_sched+gobuf_sp)(g)
- MOV ZERO, (g_sched+gobuf_lr)(g)
- MOV g, (g_sched+gobuf_g)(g)
+ CALL gosave_systemstack_switch<>(SB)
// switch to g0
MOV T1, g
CALL runtime·save_g(SB)
MOV (g_sched+gobuf_sp)(g), T0
- // make it look like mstart called systemstack on g0, to stop traceback
- ADD $-8, T0
- MOV $runtime·mstart(SB), T1
- MOV T1, 0(T0)
MOV T0, X2
// call target function
@@ -233,12 +228,16 @@ TEXT runtime·return0(SB), NOSPLIT, $0
// restore state from Gobuf; longjmp
// func gogo(buf *gobuf)
-TEXT runtime·gogo(SB), NOSPLIT, $16-8
+TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8
MOV buf+0(FP), T0
- MOV gobuf_g(T0), g // make sure g is not nil
+ MOV gobuf_g(T0), T1
+ MOV 0(T1), ZERO // make sure g != nil
+ JMP gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0
+ MOV T1, g
CALL runtime·save_g(SB)
- MOV (g), ZERO // make sure g is not nil
MOV gobuf_sp(T0), X2
MOV gobuf_lr(T0), RA
MOV gobuf_ret(T0), A0
@@ -279,7 +278,6 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
MOV X2, (g_sched+gobuf_sp)(g)
MOV RA, (g_sched+gobuf_pc)(g)
MOV ZERO, (g_sched+gobuf_lr)(g)
- MOV g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOV g, T0
@@ -297,31 +295,22 @@ TEXT runtime·mcall(SB), NOSPLIT|NOFRAME, $0-8
JALR RA, T1
JMP runtime·badmcall2(SB)
-// func gosave(buf *gobuf)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT|NOFRAME, $0-8
- MOV buf+0(FP), T1
- MOV X2, gobuf_sp(T1)
- MOV RA, gobuf_pc(T1)
- MOV g, gobuf_g(T1)
- MOV ZERO, gobuf_lr(T1)
- MOV ZERO, gobuf_ret(T1)
- // Assert ctxt is zero. See func save.
- MOV gobuf_ctxt(T1), T1
- BEQ T1, ZERO, 2(PC)
- CALL runtime·badctxt(SB)
- RET
-
-// Save state of caller into g->sched. Smashes X31.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOV X1, (g_sched+gobuf_pc)(g)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes X31.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOV $runtime·systemstack_switch(SB), X31
+ ADD $8, X31 // get past prologue
+ MOV X31, (g_sched+gobuf_pc)(g)
MOV X2, (g_sched+gobuf_sp)(g)
MOV ZERO, (g_sched+gobuf_lr)(g)
MOV ZERO, (g_sched+gobuf_ret)(g)
// Assert ctxt is zero. See func save.
MOV (g_sched+gobuf_ctxt)(g), X31
BEQ ZERO, X31, 2(PC)
- CALL runtime·badctxt(SB)
+ CALL runtime·abort(SB)
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -342,7 +331,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
MOV m_g0(X6), X7
BEQ X7, g, g0
- CALL gosave<>(SB)
+ CALL gosave_systemstack_switch<>(SB)
MOV X7, g
CALL runtime·save_g(SB)
MOV (g_sched+gobuf_sp)(g), X2
@@ -374,7 +363,7 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
RET
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -386,13 +375,13 @@ TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
JALR ZERO, T2
// Note: can't just "BR NAME(SB)" - bad inlining results.
-// func call(argtype *rtype, fn, arg unsafe.Pointer, n uint32, retoffset uint32)
+// func call(stackArgsType *rtype, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
TEXT reflect·call(SB), NOSPLIT, $0-0
JMP ·reflectcall(SB)
-// func reflectcall(argtype *_type, fn, arg unsafe.Pointer, argsize uint32, retoffset uint32)
-TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
- MOVWU argsize+24(FP), T0
+// func call(stackArgsType *_type, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
+TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-48
+ MOVWU frameSize+32(FP), T0
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -424,11 +413,11 @@ TEXT ·reflectcall(SB), NOSPLIT|NOFRAME, $0-32
JALR ZERO, T2
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOV arg+16(FP), A1; \
- MOVWU argsize+24(FP), A2; \
+ MOV stackArgs+16(FP), A1; \
+ MOVWU stackArgsSize+24(FP), A2; \
MOV X2, A3; \
ADD $8, A3; \
ADD A3, A2; \
@@ -444,10 +433,10 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
PCDATA $PCDATA_StackMapIndex, $0; \
JALR RA, A4; \
/* copy return values back */ \
- MOV argtype+0(FP), A5; \
- MOV arg+16(FP), A1; \
- MOVWU n+24(FP), A2; \
- MOVWU retoffset+28(FP), A4; \
+ MOV stackArgsType+0(FP), A5; \
+ MOV stackArgs+16(FP), A1; \
+ MOVWU stackArgsSize+24(FP), A2; \
+ MOVWU stackRetOffset+28(FP), A4; \
ADD $8, X2, A3; \
ADD A4, A3; \
ADD A4, A1; \
@@ -459,11 +448,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $32-0
+TEXT callRet<>(SB), NOSPLIT, $40-0
MOV A5, 8(X2)
MOV A1, 16(X2)
MOV A3, 24(X2)
MOV A2, 32(X2)
+ MOV ZERO, 40(X2)
CALL runtime·reflectcallmove(SB)
RET
diff --git a/src/runtime/asm_s390x.s b/src/runtime/asm_s390x.s
index 7baef37324..4748e00aa8 100644
--- a/src/runtime/asm_s390x.s
+++ b/src/runtime/asm_s390x.s
@@ -84,7 +84,7 @@ GLOBL _rt0_s390x_lib_argc<>(SB), NOPTR, $8
DATA _rt0_s90x_lib_argv<>(SB)/8, $0
GLOBL _rt0_s390x_lib_argv<>(SB), NOPTR, $8
-TEXT runtime·rt0_go(SB),NOSPLIT,$0
+TEXT runtime·rt0_go(SB),NOSPLIT|TOPFRAME,$0
// R2 = argc; R3 = argv; R11 = temp; R13 = g; R15 = stack pointer
// C TLS base pointer in AR0:AR1
@@ -170,30 +170,24 @@ TEXT runtime·breakpoint(SB),NOSPLIT|NOFRAME,$0-0
TEXT runtime·asminit(SB),NOSPLIT|NOFRAME,$0-0
RET
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ CALL runtime·mstart0(SB)
+ RET // not reached
+
/*
* go-routine
*/
-// void gosave(Gobuf*)
-// save state in Gobuf; setjmp
-TEXT runtime·gosave(SB), NOSPLIT, $-8-8
- MOVD buf+0(FP), R3
- MOVD R15, gobuf_sp(R3)
- MOVD LR, gobuf_pc(R3)
- MOVD g, gobuf_g(R3)
- MOVD $0, gobuf_lr(R3)
- MOVD $0, gobuf_ret(R3)
- // Assert ctxt is zero. See func save.
- MOVD gobuf_ctxt(R3), R3
- CMPBEQ R3, $0, 2(PC)
- BL runtime·badctxt(SB)
- RET
-
// void gogo(Gobuf*)
// restore state from Gobuf; longjmp
-TEXT runtime·gogo(SB), NOSPLIT, $16-8
+TEXT runtime·gogo(SB), NOSPLIT|NOFRAME, $0-8
MOVD buf+0(FP), R5
- MOVD gobuf_g(R5), g // make sure g is not nil
+ MOVD gobuf_g(R5), R6
+ MOVD 0(R6), R7 // make sure g != nil
+ BR gogo<>(SB)
+
+TEXT gogo<>(SB), NOSPLIT|NOFRAME, $0
+ MOVD R6, g
BL runtime·save_g(SB)
MOVD 0(g), R4
@@ -218,7 +212,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $-8-8
MOVD R15, (g_sched+gobuf_sp)(g)
MOVD LR, (g_sched+gobuf_pc)(g)
MOVD $0, (g_sched+gobuf_lr)(g)
- MOVD g, (g_sched+gobuf_g)(g)
// Switch to m->g0 & its stack, call fn.
MOVD g, R3
@@ -271,22 +264,12 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
switch:
// save our state in g->sched. Pretend to
// be systemstack_switch if the G stack is scanned.
- MOVD $runtime·systemstack_switch(SB), R6
- ADD $16, R6 // get past prologue
- MOVD R6, (g_sched+gobuf_pc)(g)
- MOVD R15, (g_sched+gobuf_sp)(g)
- MOVD $0, (g_sched+gobuf_lr)(g)
- MOVD g, (g_sched+gobuf_g)(g)
+ BL gosave_systemstack_switch<>(SB)
// switch to g0
MOVD R5, g
BL runtime·save_g(SB)
- MOVD (g_sched+gobuf_sp)(g), R3
- // make it look like mstart called systemstack on g0, to stop traceback
- SUB $8, R3
- MOVD $runtime·mstart(SB), R4
- MOVD R4, 0(R3)
- MOVD R3, R15
+ MOVD (g_sched+gobuf_sp)(g), R15
// call target function
MOVD 0(R12), R3 // code pointer
@@ -368,7 +351,7 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
BR runtime·morestack(SB)
// reflectcall: call a function with the given argument list
-// func call(argtype *_type, f *FuncVal, arg *byte, argsize, retoffset uint32).
+// func call(stackArgsType *_type, f *FuncVal, stackArgs *byte, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs).
// we don't have variable-sized frames, so we use a small number
// of constant-sized-frame functions to encode a few bits of size in the pc.
// Caution: ugly multiline assembly macros in your future!
@@ -381,8 +364,8 @@ TEXT runtime·morestack_noctxt(SB),NOSPLIT|NOFRAME,$0-0
BR (R5)
// Note: can't just "BR NAME(SB)" - bad inlining results.
-TEXT ·reflectcall(SB), NOSPLIT, $-8-32
- MOVWZ argsize+24(FP), R3
+TEXT ·reflectcall(SB), NOSPLIT, $-8-48
+ MOVWZ frameSize+32(FP), R3
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
DISPATCH(runtime·call64, 64)
@@ -414,11 +397,11 @@ TEXT ·reflectcall(SB), NOSPLIT, $-8-32
BR (R5)
#define CALLFN(NAME,MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-24; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
/* copy arguments to stack */ \
- MOVD arg+16(FP), R4; \
- MOVWZ argsize+24(FP), R5; \
+ MOVD stackArgs+16(FP), R4; \
+ MOVWZ stackArgsSize+24(FP), R5; \
MOVD $stack-MAXSIZE(SP), R6; \
loopArgs: /* copy 256 bytes at a time */ \
CMP R5, $256; \
@@ -439,11 +422,11 @@ callFunction: \
PCDATA $PCDATA_StackMapIndex, $0; \
BL (R8); \
/* copy return values back */ \
- MOVD argtype+0(FP), R7; \
- MOVD arg+16(FP), R6; \
- MOVWZ n+24(FP), R5; \
+ MOVD stackArgsType+0(FP), R7; \
+ MOVD stackArgs+16(FP), R6; \
+ MOVWZ stackArgsSize+24(FP), R5; \
MOVD $stack-MAXSIZE(SP), R4; \
- MOVWZ retoffset+28(FP), R1; \
+ MOVWZ stackRetOffset+28(FP), R1; \
ADD R1, R4; \
ADD R1, R6; \
SUB R1, R5; \
@@ -454,11 +437,12 @@ callFunction: \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $32-0
+TEXT callRet<>(SB), NOSPLIT, $40-0
MOVD R7, 8(R15)
MOVD R6, 16(R15)
MOVD R4, 24(R15)
MOVD R5, 32(R15)
+ MOVD $0, 40(R15)
BL runtime·reflectcallmove(SB)
RET
@@ -512,16 +496,22 @@ TEXT runtime·jmpdefer(SB),NOSPLIT|NOFRAME,$0-16
MOVD 0(R12), R3
BR (R3)
-// Save state of caller into g->sched. Smashes R1.
-TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
- MOVD LR, (g_sched+gobuf_pc)(g)
+// Save state of caller into g->sched,
+// but using fake PC from systemstack_switch.
+// Must only be called from functions with no locals ($0)
+// or else unwinding from systemstack_switch is incorrect.
+// Smashes R1.
+TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·systemstack_switch(SB), R1
+ ADD $16, R1 // get past prologue
+ MOVD R1, (g_sched+gobuf_pc)(g)
MOVD R15, (g_sched+gobuf_sp)(g)
MOVD $0, (g_sched+gobuf_lr)(g)
MOVD $0, (g_sched+gobuf_ret)(g)
// Assert ctxt is zero. See func save.
MOVD (g_sched+gobuf_ctxt)(g), R1
CMPBEQ R1, $0, 2(PC)
- BL runtime·badctxt(SB)
+ BL runtime·abort(SB)
RET
// func asmcgocall(fn, arg unsafe.Pointer) int32
@@ -543,7 +533,7 @@ TEXT ·asmcgocall(SB),NOSPLIT,$0-20
MOVD g_m(g), R6
MOVD m_g0(R6), R6
CMPBEQ R6, g, g0
- BL gosave<>(SB)
+ BL gosave_systemstack_switch<>(SB)
MOVD R6, g
BL runtime·save_g(SB)
MOVD (g_sched+gobuf_sp)(g), R15
diff --git a/src/runtime/asm_wasm.s b/src/runtime/asm_wasm.s
index fcb780f1dc..33c335ba5a 100644
--- a/src/runtime/asm_wasm.s
+++ b/src/runtime/asm_wasm.s
@@ -7,7 +7,7 @@
#include "funcdata.h"
#include "textflag.h"
-TEXT runtime·rt0_go(SB), NOSPLIT|NOFRAME, $0
+TEXT runtime·rt0_go(SB), NOSPLIT|NOFRAME|TOPFRAME, $0
// save m->g0 = g0
MOVD $runtime·g0(SB), runtime·m0+m_g0(SB)
// save m0 to g0->m
@@ -24,6 +24,10 @@ TEXT runtime·rt0_go(SB), NOSPLIT|NOFRAME, $0
CALL runtime·mstart(SB) // WebAssembly stack will unwind when switching to another goroutine
UNDEF
+TEXT runtime·mstart(SB),NOSPLIT|TOPFRAME,$0
+ CALL runtime·mstart0(SB)
+ RET // not reached
+
DATA runtime·mainPC+0(SB)/8,$runtime·main(SB)
GLOBL runtime·mainPC(SB),RODATA,$8
@@ -34,7 +38,9 @@ TEXT ·checkASM(SB), NOSPLIT, $0-1
TEXT runtime·gogo(SB), NOSPLIT, $0-8
MOVD buf+0(FP), R0
- MOVD gobuf_g(R0), g
+ MOVD gobuf_g(R0), R1
+ MOVD 0(R1), R2 // make sure g != nil
+ MOVD R1, g
MOVD gobuf_sp(R0), SP
// Put target PC at -8(SP), wasm_pc_f_loop will pick it up
@@ -69,7 +75,6 @@ TEXT runtime·mcall(SB), NOSPLIT, $0-8
// save state in g->sched
MOVD 0(SP), g_sched+gobuf_pc(g) // caller's PC
MOVD $fn+0(FP), g_sched+gobuf_sp(g) // caller's SP
- MOVD g, g_sched+gobuf_g(g)
// if g == g0 call badmcall
Get g
@@ -143,7 +148,6 @@ TEXT runtime·systemstack(SB), NOSPLIT, $0-8
MOVD $runtime·systemstack_switch(SB), g_sched+gobuf_pc(g)
MOVD SP, g_sched+gobuf_sp(g)
- MOVD g, g_sched+gobuf_g(g)
// switch to g0
MOVD R2, g
@@ -270,7 +274,6 @@ TEXT runtime·morestack(SB), NOSPLIT, $0-0
// Set g->sched to context in f.
MOVD 0(SP), g_sched+gobuf_pc(g)
- MOVD g, g_sched+gobuf_g(g)
MOVD $8(SP), g_sched+gobuf_sp(g) // f's SP
MOVD CTXT, g_sched+gobuf_ctxt(g)
@@ -296,14 +299,14 @@ TEXT ·asmcgocall(SB), NOSPLIT, $0-0
JMP NAME(SB); \
End
-TEXT ·reflectcall(SB), NOSPLIT, $0-32
+TEXT ·reflectcall(SB), NOSPLIT, $0-48
I64Load fn+8(FP)
I64Eqz
If
CALLNORESUME runtime·sigpanic<ABIInternal>(SB)
End
- MOVW argsize+24(FP), R0
+ MOVW frameSize+32(FP), R0
DISPATCH(runtime·call16, 16)
DISPATCH(runtime·call32, 32)
@@ -335,18 +338,18 @@ TEXT ·reflectcall(SB), NOSPLIT, $0-32
JMP runtime·badreflectcall(SB)
#define CALLFN(NAME, MAXSIZE) \
-TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
+TEXT NAME(SB), WRAPPER, $MAXSIZE-48; \
NO_LOCAL_POINTERS; \
- MOVW argsize+24(FP), R0; \
+ MOVW stackArgsSize+24(FP), R0; \
\
Get R0; \
I64Eqz; \
Not; \
If; \
Get SP; \
- I64Load argptr+16(FP); \
+ I64Load stackArgs+16(FP); \
I32WrapI64; \
- I64Load argsize+24(FP); \
+ I64Load stackArgsSize+24(FP); \
I64Const $3; \
I64ShrU; \
I32WrapI64; \
@@ -359,12 +362,12 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
I64Load $0; \
CALL; \
\
- I64Load32U retoffset+28(FP); \
+ I64Load32U stackRetOffset+28(FP); \
Set R0; \
\
- MOVD argtype+0(FP), RET0; \
+ MOVD stackArgsType+0(FP), RET0; \
\
- I64Load argptr+16(FP); \
+ I64Load stackArgs+16(FP); \
Get R0; \
I64Add; \
Set RET1; \
@@ -375,7 +378,7 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
I64Add; \
Set RET2; \
\
- I64Load32U argsize+24(FP); \
+ I64Load32U stackArgsSize+24(FP); \
Get R0; \
I64Sub; \
Set RET3; \
@@ -387,12 +390,13 @@ TEXT NAME(SB), WRAPPER, $MAXSIZE-32; \
// separate function so it can allocate stack space for the arguments
// to reflectcallmove. It does not follow the Go ABI; it expects its
// arguments in registers.
-TEXT callRet<>(SB), NOSPLIT, $32-0
+TEXT callRet<>(SB), NOSPLIT, $40-0
NO_LOCAL_POINTERS
MOVD RET0, 0(SP)
MOVD RET1, 8(SP)
MOVD RET2, 16(SP)
MOVD RET3, 24(SP)
+ MOVD $0, 32(SP)
CALL runtime·reflectcallmove(SB)
RET
@@ -424,7 +428,7 @@ CALLFN(·call268435456, 268435456)
CALLFN(·call536870912, 536870912)
CALLFN(·call1073741824, 1073741824)
-TEXT runtime·goexit(SB), NOSPLIT, $0-0
+TEXT runtime·goexit(SB), NOSPLIT|TOPFRAME, $0-0
NOP // first PC of goexit is skipped
CALL runtime·goexit1(SB) // does not return
UNDEF
diff --git a/src/runtime/auxv_none.go b/src/runtime/auxv_none.go
index 3ca617b21e..3178f1a154 100644
--- a/src/runtime/auxv_none.go
+++ b/src/runtime/auxv_none.go
@@ -2,12 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !linux
-// +build !darwin
-// +build !dragonfly
-// +build !freebsd
-// +build !netbsd
-// +build !solaris
+//go:build !linux && !darwin && !dragonfly && !freebsd && !netbsd && !solaris
+// +build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!solaris
package runtime
diff --git a/src/runtime/cgo/callbacks_traceback.go b/src/runtime/cgo/callbacks_traceback.go
index cdadf9e66f..7302c1eedf 100644
--- a/src/runtime/cgo/callbacks_traceback.go
+++ b/src/runtime/cgo/callbacks_traceback.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || linux
// +build darwin linux
package cgo
diff --git a/src/runtime/cgo/dragonfly.go b/src/runtime/cgo/dragonfly.go
index d6d69187b8..cfa6fe86e2 100644
--- a/src/runtime/cgo/dragonfly.go
+++ b/src/runtime/cgo/dragonfly.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly
// +build dragonfly
package cgo
diff --git a/src/runtime/cgo/freebsd.go b/src/runtime/cgo/freebsd.go
index 5c9ddbdc71..d56702ec70 100644
--- a/src/runtime/cgo/freebsd.go
+++ b/src/runtime/cgo/freebsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd
// +build freebsd
package cgo
diff --git a/src/runtime/cgo/gcc_amd64.S b/src/runtime/cgo/gcc_amd64.S
index 17d9d47ef4..d75f864666 100644
--- a/src/runtime/cgo/gcc_amd64.S
+++ b/src/runtime/cgo/gcc_amd64.S
@@ -30,9 +30,14 @@ EXT(crosscall_amd64):
pushq %r15
#if defined(_WIN64)
+ movq %r8, %rdi /* arg of setg_gcc */
+ call *%rdx /* setg_gcc */
call *%rcx /* fn */
#else
- call *%rdi /* fn */
+ movq %rdi, %rbx
+ movq %rdx, %rdi /* arg of setg_gcc */
+ call *%rsi /* setg_gcc */
+ call *%rbx /* fn */
#endif
popq %r15
diff --git a/src/runtime/cgo/gcc_darwin_amd64.c b/src/runtime/cgo/gcc_darwin_amd64.c
index 51410d5026..d5b7fd8fd8 100644
--- a/src/runtime/cgo/gcc_darwin_amd64.c
+++ b/src/runtime/cgo/gcc_darwin_amd64.c
@@ -9,13 +9,16 @@
#include "libcgo_unix.h"
static void* threadentry(void*);
+static void (*setg_gcc)(void*);
void
-x_cgo_init(G *g)
+x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase)
{
pthread_attr_t attr;
size_t size;
+ setg_gcc = setg;
+
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &size);
g->stacklo = (uintptr)&attr - size + 4096;
@@ -57,10 +60,6 @@ threadentry(void *v)
ts = *(ThreadStart*)v;
free(v);
- // Move the g pointer into the slot reserved in thread local storage.
- // Constant must match the one in cmd/link/internal/ld/sym.go.
- asm volatile("movq %0, %%gs:0x30" :: "r"(ts.g));
-
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_dragonfly_amd64.c b/src/runtime/cgo/gcc_dragonfly_amd64.c
index d25db91900..0003414bf8 100644
--- a/src/runtime/cgo/gcc_dragonfly_amd64.c
+++ b/src/runtime/cgo/gcc_dragonfly_amd64.c
@@ -61,11 +61,6 @@ threadentry(void *v)
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_freebsd_amd64.c b/src/runtime/cgo/gcc_freebsd_amd64.c
index 514a2f8a23..6071ec3909 100644
--- a/src/runtime/cgo/gcc_freebsd_amd64.c
+++ b/src/runtime/cgo/gcc_freebsd_amd64.c
@@ -69,11 +69,6 @@ threadentry(void *v)
free(v);
_cgo_tsan_release();
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_libinit_windows.c b/src/runtime/cgo/gcc_libinit_windows.c
index 2732248bdc..ad5038667a 100644
--- a/src/runtime/cgo/gcc_libinit_windows.c
+++ b/src/runtime/cgo/gcc_libinit_windows.c
@@ -4,7 +4,7 @@
// +build cgo
-#define WIN64_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
diff --git a/src/runtime/cgo/gcc_linux_amd64.c b/src/runtime/cgo/gcc_linux_amd64.c
index f2bf6482cb..c25e7e769b 100644
--- a/src/runtime/cgo/gcc_linux_amd64.c
+++ b/src/runtime/cgo/gcc_linux_amd64.c
@@ -89,11 +89,6 @@ threadentry(void *v)
free(v);
_cgo_tsan_release();
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_netbsd_amd64.c b/src/runtime/cgo/gcc_netbsd_amd64.c
index dc966fc45b..9f4b031a08 100644
--- a/src/runtime/cgo/gcc_netbsd_amd64.c
+++ b/src/runtime/cgo/gcc_netbsd_amd64.c
@@ -62,11 +62,6 @@ threadentry(void *v)
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
// On NetBSD, a new thread inherits the signal stack of the
// creating thread. That confuses minit, so we remove that
// signal stack here before calling the regular mstart. It's
@@ -78,6 +73,6 @@ threadentry(void *v)
ss.ss_flags = SS_DISABLE;
sigaltstack(&ss, nil);
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_openbsd_amd64.c b/src/runtime/cgo/gcc_openbsd_amd64.c
index 34319fb0b8..09d2750f3a 100644
--- a/src/runtime/cgo/gcc_openbsd_amd64.c
+++ b/src/runtime/cgo/gcc_openbsd_amd64.c
@@ -60,11 +60,6 @@ threadentry(void *v)
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_solaris_amd64.c b/src/runtime/cgo/gcc_solaris_amd64.c
index 079bd12898..e89e844b1e 100644
--- a/src/runtime/cgo/gcc_solaris_amd64.c
+++ b/src/runtime/cgo/gcc_solaris_amd64.c
@@ -72,11 +72,6 @@ threadentry(void *v)
ts = *(ThreadStart*)v;
free(v);
- /*
- * Set specific keys.
- */
- setg_gcc((void*)ts.g);
-
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
return nil;
}
diff --git a/src/runtime/cgo/gcc_windows_amd64.c b/src/runtime/cgo/gcc_windows_amd64.c
index 0f8c817f0e..9df9b9b1e4 100644
--- a/src/runtime/cgo/gcc_windows_amd64.c
+++ b/src/runtime/cgo/gcc_windows_amd64.c
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-#define WIN64_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <process.h>
#include <stdlib.h>
@@ -12,10 +12,12 @@
#include "libcgo_windows.h"
static void threadentry(void*);
+static void (*setg_gcc)(void*);
void
-x_cgo_init(G *g)
+x_cgo_init(G *g, void (*setg)(void*), void **tlsg, void **tlsbase)
{
+ setg_gcc = setg;
}
@@ -46,10 +48,8 @@ threadentry(void *v)
*/
asm volatile (
"movq %0, %%gs:0x28\n" // MOVL tls0, 0x28(GS)
- "movq %%gs:0x28, %%rax\n" // MOVQ 0x28(GS), tmp
- "movq %1, 0(%%rax)\n" // MOVQ g, 0(GS)
- :: "r"(ts.tls), "r"(ts.g) : "%rax"
+ :: "r"(ts.tls)
);
- crosscall_amd64(ts.fn);
+ crosscall_amd64(ts.fn, setg_gcc, (void*)ts.g);
}
diff --git a/src/runtime/cgo/libcgo.h b/src/runtime/cgo/libcgo.h
index aba500a301..af4960e7e9 100644
--- a/src/runtime/cgo/libcgo.h
+++ b/src/runtime/cgo/libcgo.h
@@ -66,7 +66,7 @@ uintptr_t _cgo_wait_runtime_init_done(void);
/*
* Call fn in the 6c world.
*/
-void crosscall_amd64(void (*fn)(void));
+void crosscall_amd64(void (*fn)(void), void (*setg_gcc)(void*), void *g);
/*
* Call fn in the 8c world.
diff --git a/src/runtime/cgo/linux.go b/src/runtime/cgo/linux.go
index 76c0192c20..070d531bee 100644
--- a/src/runtime/cgo/linux.go
+++ b/src/runtime/cgo/linux.go
@@ -5,6 +5,7 @@
// Linux system call wrappers that provide POSIX semantics through the
// corresponding cgo->libc (nptl) wrappers for various system calls.
+//go:build linux
// +build linux
package cgo
diff --git a/src/runtime/cgo/linux_syscall.c b/src/runtime/cgo/linux_syscall.c
index 56f3d67d8b..59761c8b40 100644
--- a/src/runtime/cgo/linux_syscall.c
+++ b/src/runtime/cgo/linux_syscall.c
@@ -32,7 +32,7 @@ typedef struct {
#define SET_RETVAL(fn) \
uintptr_t ret = (uintptr_t) fn ; \
- if (ret == -1) { \
+ if (ret == (uintptr_t) -1) { \
x->retval = (uintptr_t) errno; \
} else \
x->retval = ret
diff --git a/src/runtime/cgo/mmap.go b/src/runtime/cgo/mmap.go
index 00fb7fced6..347ae6b363 100644
--- a/src/runtime/cgo/mmap.go
+++ b/src/runtime/cgo/mmap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (linux && amd64) || (linux && arm64)
// +build linux,amd64 linux,arm64
package cgo
diff --git a/src/runtime/cgo/netbsd.go b/src/runtime/cgo/netbsd.go
index 74d0aed014..7e17d1fcd2 100644
--- a/src/runtime/cgo/netbsd.go
+++ b/src/runtime/cgo/netbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build netbsd
// +build netbsd
package cgo
diff --git a/src/runtime/cgo/openbsd.go b/src/runtime/cgo/openbsd.go
index 81c73bf399..f6215613c3 100644
--- a/src/runtime/cgo/openbsd.go
+++ b/src/runtime/cgo/openbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build openbsd
// +build openbsd
package cgo
diff --git a/src/runtime/cgo/setenv.go b/src/runtime/cgo/setenv.go
index 6495fcb5f8..e6e8040ae0 100644
--- a/src/runtime/cgo/setenv.go
+++ b/src/runtime/cgo/setenv.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package cgo
diff --git a/src/runtime/cgo/sigaction.go b/src/runtime/cgo/sigaction.go
index 076fbc1a0a..ee63ea4c09 100644
--- a/src/runtime/cgo/sigaction.go
+++ b/src/runtime/cgo/sigaction.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (linux && amd64) || (freebsd && amd64) || (linux && arm64)
// +build linux,amd64 freebsd,amd64 linux,arm64
package cgo
diff --git a/src/runtime/cgo_mmap.go b/src/runtime/cgo_mmap.go
index d5e0cc1e3e..17d26b4cc8 100644
--- a/src/runtime/cgo_mmap.go
+++ b/src/runtime/cgo_mmap.go
@@ -4,6 +4,7 @@
// Support for memory sanitizer. See runtime/cgo/mmap.go.
+//go:build (linux && amd64) || (linux && arm64)
// +build linux,amd64 linux,arm64
package runtime
diff --git a/src/runtime/cgo_ppc64x.go b/src/runtime/cgo_ppc64x.go
index fb2da32c7e..4dc92ea321 100644
--- a/src/runtime/cgo_ppc64x.go
+++ b/src/runtime/cgo_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package runtime
diff --git a/src/runtime/cgo_sigaction.go b/src/runtime/cgo_sigaction.go
index de634dc957..15690ecb0b 100644
--- a/src/runtime/cgo_sigaction.go
+++ b/src/runtime/cgo_sigaction.go
@@ -4,6 +4,7 @@
// Support for memory sanitizer. See runtime/cgo/sigaction.go.
+//go:build (linux && amd64) || (freebsd && amd64) || (linux && arm64)
// +build linux,amd64 freebsd,amd64 linux,arm64
package runtime
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go
index 20cacd6043..534a2c4295 100644
--- a/src/runtime/cgocall.go
+++ b/src/runtime/cgocall.go
@@ -306,14 +306,7 @@ func unwindm(restore *bool) {
// unwind of g's stack (see comment at top of file).
mp := acquirem()
sched := &mp.g0.sched
- switch GOARCH {
- default:
- throw("unwindm not implemented")
- case "386", "amd64", "arm", "ppc64", "ppc64le", "mips64", "mips64le", "s390x", "mips", "mipsle", "riscv64":
- sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + sys.MinFrameSize))
- case "arm64":
- sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + 16))
- }
+ sched.sp = *(*uintptr)(unsafe.Pointer(sched.sp + alignUp(sys.MinFrameSize, sys.StackAlign)))
// Do the accounting that cgocall will not have a chance to do
// during an unwind.
diff --git a/src/runtime/chan.go b/src/runtime/chan.go
index ba56e2cc40..f2a75b30f4 100644
--- a/src/runtime/chan.go
+++ b/src/runtime/chan.go
@@ -690,28 +690,6 @@ func selectnbsend(c *hchan, elem unsafe.Pointer) (selected bool) {
// compiler implements
//
// select {
-// case v = <-c:
-// ... foo
-// default:
-// ... bar
-// }
-//
-// as
-//
-// if selectnbrecv(&v, c) {
-// ... foo
-// } else {
-// ... bar
-// }
-//
-func selectnbrecv(elem unsafe.Pointer, c *hchan) (selected bool) {
- selected, _ = chanrecv(c, elem, false)
- return
-}
-
-// compiler implements
-//
-// select {
// case v, ok = <-c:
// ... foo
// default:
@@ -720,16 +698,14 @@ func selectnbrecv(elem unsafe.Pointer, c *hchan) (selected bool) {
//
// as
//
-// if c != nil && selectnbrecv2(&v, &ok, c) {
+// if selected, ok = selectnbrecv(&v, c); selected {
// ... foo
// } else {
// ... bar
// }
//
-func selectnbrecv2(elem unsafe.Pointer, received *bool, c *hchan) (selected bool) {
- // TODO(khr): just return 2 values from this function, now that it is in Go.
- selected, *received = chanrecv(c, elem, false)
- return
+func selectnbrecv(elem unsafe.Pointer, c *hchan) (selected, received bool) {
+ return chanrecv(c, elem, false)
}
//go:linkname reflect_chansend reflect.chansend
diff --git a/src/runtime/chan_test.go b/src/runtime/chan_test.go
index 756bbbeccf..003d6a9fb3 100644
--- a/src/runtime/chan_test.go
+++ b/src/runtime/chan_test.go
@@ -631,7 +631,7 @@ func TestNoShrinkStackWhileParking(t *testing.T) {
// channel. See issue 40641 for more details on the problem.
//
// The way we try to induce this failure is to set up two
- // goroutines: a sender and a reciever that communicate across
+ // goroutines: a sender and a receiver that communicate across
// a channel. We try to set up a situation where the sender
// grows its stack temporarily then *fully* blocks on a channel
// often. Meanwhile a GC is triggered so that we try to get a
@@ -671,7 +671,7 @@ func TestNoShrinkStackWhileParking(t *testing.T) {
go send(c, done)
// Wait a little bit before triggering
// the GC to make sure the sender and
- // reciever have gotten into their groove.
+ // receiver have gotten into their groove.
time.Sleep(50 * time.Microsecond)
runtime.GC()
<-done
diff --git a/src/runtime/cpuprof.go b/src/runtime/cpuprof.go
index 9bfdfe7c74..e5d0193b9c 100644
--- a/src/runtime/cpuprof.go
+++ b/src/runtime/cpuprof.go
@@ -103,7 +103,16 @@ func (p *cpuProfile) add(gp *g, stk []uintptr) {
// because otherwise its write barrier behavior may not
// be correct. See the long comment there before
// changing the argument here.
- cpuprof.log.write(&gp.labels, nanotime(), hdr[:], stk)
+ //
+ // Note: it can happen on Windows, where we are calling
+ // p.add with a gp that is not the current g, that gp is nil,
+ // meaning we interrupted a system thread with no g.
+ // Avoid faulting in that case.
+ var tagPtr *unsafe.Pointer
+ if gp != nil {
+ tagPtr = &gp.labels
+ }
+ cpuprof.log.write(tagPtr, nanotime(), hdr[:], stk)
}
atomic.Store(&prof.signalLock, 0)
diff --git a/src/runtime/cputicks.go b/src/runtime/cputicks.go
index 7beb57ea12..7c926f4a2b 100644
--- a/src/runtime/cputicks.go
+++ b/src/runtime/cputicks.go
@@ -2,13 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !arm
-// +build !arm64
-// +build !mips64
-// +build !mips64le
-// +build !mips
-// +build !mipsle
-// +build !wasm
+//go:build !arm && !arm64 && !mips64 && !mips64le && !mips && !mipsle && !wasm
+// +build !arm,!arm64,!mips64,!mips64le,!mips,!mipsle,!wasm
package runtime
diff --git a/src/runtime/crash_cgo_test.go b/src/runtime/crash_cgo_test.go
index 140c170ddc..7d25c51aa2 100644
--- a/src/runtime/crash_cgo_test.go
+++ b/src/runtime/crash_cgo_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build cgo
// +build cgo
package runtime_test
diff --git a/src/runtime/crash_nonunix_test.go b/src/runtime/crash_nonunix_test.go
index 06c197ec2b..5f61476f21 100644
--- a/src/runtime/crash_nonunix_test.go
+++ b/src/runtime/crash_nonunix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows || plan9 || (js && wasm)
// +build windows plan9 js,wasm
package runtime_test
diff --git a/src/runtime/crash_unix_test.go b/src/runtime/crash_unix_test.go
index 803b031873..341c35ca56 100644
--- a/src/runtime/crash_unix_test.go
+++ b/src/runtime/crash_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package runtime_test
diff --git a/src/runtime/debug/panic_test.go b/src/runtime/debug/panic_test.go
index b67a3de4f9..b93631e1d8 100644
--- a/src/runtime/debug/panic_test.go
+++ b/src/runtime/debug/panic_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build aix darwin dragonfly freebsd linux netbsd openbsd
// TODO: test on Windows?
diff --git a/src/runtime/debug_test.go b/src/runtime/debug_test.go
index a0b3f84382..c4c41f95f2 100644
--- a/src/runtime/debug_test.go
+++ b/src/runtime/debug_test.go
@@ -9,9 +9,8 @@
// spends all of its time in the race runtime, which isn't a safe
// point.
-// +build amd64
-// +build linux
-// +build !race
+//go:build amd64 && linux && !race
+// +build amd64,linux,!race
package runtime_test
diff --git a/src/runtime/debugcall.go b/src/runtime/debugcall.go
index efc68a767d..2fe0b1d12f 100644
--- a/src/runtime/debugcall.go
+++ b/src/runtime/debugcall.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64
// +build amd64
package runtime
diff --git a/src/runtime/debuglog_off.go b/src/runtime/debuglog_off.go
index bb3e172498..dd38156999 100644
--- a/src/runtime/debuglog_off.go
+++ b/src/runtime/debuglog_off.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !debuglog
// +build !debuglog
package runtime
diff --git a/src/runtime/debuglog_on.go b/src/runtime/debuglog_on.go
index 3d477e8ef5..2fcdbe70d1 100644
--- a/src/runtime/debuglog_on.go
+++ b/src/runtime/debuglog_on.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build debuglog
// +build debuglog
package runtime
diff --git a/src/runtime/defs1_linux.go b/src/runtime/defs1_linux.go
index 4085d6f418..df9c05dd5e 100644
--- a/src/runtime/defs1_linux.go
+++ b/src/runtime/defs1_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs2_linux.go b/src/runtime/defs2_linux.go
index 87e19c1598..d016db7d02 100644
--- a/src/runtime/defs2_linux.go
+++ b/src/runtime/defs2_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs3_linux.go b/src/runtime/defs3_linux.go
index 31f2191c76..0a06aa2370 100644
--- a/src/runtime/defs3_linux.go
+++ b/src/runtime/defs3_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_aix.go b/src/runtime/defs_aix.go
index 23a6cac2bb..1605002ea2 100644
--- a/src/runtime/defs_aix.go
+++ b/src/runtime/defs_aix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_aix_ppc64.go b/src/runtime/defs_aix_ppc64.go
index a53fcc5933..f84ff1160d 100644
--- a/src/runtime/defs_aix_ppc64.go
+++ b/src/runtime/defs_aix_ppc64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix
// +build aix
package runtime
diff --git a/src/runtime/defs_arm_linux.go b/src/runtime/defs_arm_linux.go
index e51dd32b5b..f6b6dd2c09 100644
--- a/src/runtime/defs_arm_linux.go
+++ b/src/runtime/defs_arm_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_darwin.go b/src/runtime/defs_darwin.go
index cc8c475387..2d41a97b57 100644
--- a/src/runtime/defs_darwin.go
+++ b/src/runtime/defs_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_dragonfly.go b/src/runtime/defs_dragonfly.go
index 95014fe6e7..aca2bf9001 100644
--- a/src/runtime/defs_dragonfly.go
+++ b/src/runtime/defs_dragonfly.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
@@ -31,6 +32,10 @@ const (
EFAULT = C.EFAULT
EBUSY = C.EBUSY
EAGAIN = C.EAGAIN
+ ENOSYS = C.ENOSYS
+
+ O_NONBLOCK = C.O_NONBLOCK
+ O_CLOEXEC = C.O_CLOEXEC
PROT_NONE = C.PROT_NONE
PROT_READ = C.PROT_READ
diff --git a/src/runtime/defs_dragonfly_amd64.go b/src/runtime/defs_dragonfly_amd64.go
index 30f1b33845..f3c6ecd04b 100644
--- a/src/runtime/defs_dragonfly_amd64.go
+++ b/src/runtime/defs_dragonfly_amd64.go
@@ -10,6 +10,10 @@ const (
_EFAULT = 0xe
_EBUSY = 0x10
_EAGAIN = 0x23
+ _ENOSYS = 0x4e
+
+ _O_NONBLOCK = 0x4
+ _O_CLOEXEC = 0x20000
_PROT_NONE = 0x0
_PROT_READ = 0x1
diff --git a/src/runtime/defs_freebsd.go b/src/runtime/defs_freebsd.go
index e196dff076..c258759549 100644
--- a/src/runtime/defs_freebsd.go
+++ b/src/runtime/defs_freebsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_linux.go b/src/runtime/defs_linux.go
index 7b14063386..022ef19427 100644
--- a/src/runtime/defs_linux.go
+++ b/src/runtime/defs_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_linux_mips64x.go b/src/runtime/defs_linux_mips64x.go
index 1fb423b198..2cafad20cf 100644
--- a/src/runtime/defs_linux_mips64x.go
+++ b/src/runtime/defs_linux_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (mips64 || mips64le) && linux
// +build mips64 mips64le
// +build linux
diff --git a/src/runtime/defs_linux_mipsx.go b/src/runtime/defs_linux_mipsx.go
index 9315ba9346..3a8dfe2e99 100644
--- a/src/runtime/defs_linux_mipsx.go
+++ b/src/runtime/defs_linux_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (mips || mipsle) && linux
// +build mips mipsle
// +build linux
diff --git a/src/runtime/defs_netbsd.go b/src/runtime/defs_netbsd.go
index 3f5ce5adca..755992d18e 100644
--- a/src/runtime/defs_netbsd.go
+++ b/src/runtime/defs_netbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_netbsd_386.go b/src/runtime/defs_netbsd_386.go
index c26f246077..03c9c2de59 100644
--- a/src/runtime/defs_netbsd_386.go
+++ b/src/runtime/defs_netbsd_386.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_netbsd_amd64.go b/src/runtime/defs_netbsd_amd64.go
index f18a7b1fe3..9fda1d7d22 100644
--- a/src/runtime/defs_netbsd_amd64.go
+++ b/src/runtime/defs_netbsd_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_netbsd_arm.go b/src/runtime/defs_netbsd_arm.go
index cb0dce66b4..e7f4f6cece 100644
--- a/src/runtime/defs_netbsd_arm.go
+++ b/src/runtime/defs_netbsd_arm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_openbsd.go b/src/runtime/defs_openbsd.go
index ff7e21c71e..8d323449d1 100644
--- a/src/runtime/defs_openbsd.go
+++ b/src/runtime/defs_openbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_solaris.go b/src/runtime/defs_solaris.go
index 22df59094d..e644f9c6dd 100644
--- a/src/runtime/defs_solaris.go
+++ b/src/runtime/defs_solaris.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_solaris_amd64.go b/src/runtime/defs_solaris_amd64.go
index 0493178880..a0b38319a5 100644
--- a/src/runtime/defs_solaris_amd64.go
+++ b/src/runtime/defs_solaris_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/runtime/defs_windows.go b/src/runtime/defs_windows.go
index 43f358d56a..8d4e38120e 100644
--- a/src/runtime/defs_windows.go
+++ b/src/runtime/defs_windows.go
@@ -2,77 +2,83 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build ignore
-
-/*
-Input to cgo.
-
-GOARCH=amd64 go tool cgo -cdefs defs_windows.go > defs_windows_amd64.h
-GOARCH=386 go tool cgo -cdefs defs_windows.go > defs_windows_386.h
-*/
+// Windows architecture-independent definitions.
package runtime
-/*
-#include <signal.h>
-#include <stdarg.h>
-#include <windef.h>
-#include <winbase.h>
-#include <wincon.h>
+const (
+ _PROT_NONE = 0
+ _PROT_READ = 1
+ _PROT_WRITE = 2
+ _PROT_EXEC = 4
-#ifndef _X86_
-typedef struct {} FLOATING_SAVE_AREA;
-#endif
-#ifndef _AMD64_
-typedef struct {} M128A;
-#endif
-*/
-import "C"
+ _MAP_ANON = 1
+ _MAP_PRIVATE = 2
-const (
- PROT_NONE = 0
- PROT_READ = 1
- PROT_WRITE = 2
- PROT_EXEC = 4
+ _DUPLICATE_SAME_ACCESS = 0x2
+ _THREAD_PRIORITY_HIGHEST = 0x2
- MAP_ANON = 1
- MAP_PRIVATE = 2
+ _SIGINT = 0x2
+ _SIGTERM = 0xF
+ _CTRL_C_EVENT = 0x0
+ _CTRL_BREAK_EVENT = 0x1
+ _CTRL_CLOSE_EVENT = 0x2
+ _CTRL_LOGOFF_EVENT = 0x5
+ _CTRL_SHUTDOWN_EVENT = 0x6
- DUPLICATE_SAME_ACCESS = C.DUPLICATE_SAME_ACCESS
- THREAD_PRIORITY_HIGHEST = C.THREAD_PRIORITY_HIGHEST
+ _EXCEPTION_ACCESS_VIOLATION = 0xc0000005
+ _EXCEPTION_BREAKPOINT = 0x80000003
+ _EXCEPTION_ILLEGAL_INSTRUCTION = 0xc000001d
+ _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d
+ _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e
+ _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f
+ _EXCEPTION_FLT_OVERFLOW = 0xc0000091
+ _EXCEPTION_FLT_UNDERFLOW = 0xc0000093
+ _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094
+ _EXCEPTION_INT_OVERFLOW = 0xc0000095
- SIGINT = C.SIGINT
- SIGTERM = C.SIGTERM
- CTRL_C_EVENT = C.CTRL_C_EVENT
- CTRL_BREAK_EVENT = C.CTRL_BREAK_EVENT
- CTRL_CLOSE_EVENT = C.CTRL_CLOSE_EVENT
- CTRL_LOGOFF_EVENT = C.CTRL_LOGOFF_EVENT
- CTRL_SHUTDOWN_EVENT = C.CTRL_SHUTDOWN_EVENT
+ _INFINITE = 0xffffffff
+ _WAIT_TIMEOUT = 0x102
- CONTEXT_CONTROL = C.CONTEXT_CONTROL
- CONTEXT_FULL = C.CONTEXT_FULL
+ _EXCEPTION_CONTINUE_EXECUTION = -0x1
+ _EXCEPTION_CONTINUE_SEARCH = 0x0
+)
- EXCEPTION_ACCESS_VIOLATION = C.STATUS_ACCESS_VIOLATION
- EXCEPTION_BREAKPOINT = C.STATUS_BREAKPOINT
- EXCEPTION_FLT_DENORMAL_OPERAND = C.STATUS_FLOAT_DENORMAL_OPERAND
- EXCEPTION_FLT_DIVIDE_BY_ZERO = C.STATUS_FLOAT_DIVIDE_BY_ZERO
- EXCEPTION_FLT_INEXACT_RESULT = C.STATUS_FLOAT_INEXACT_RESULT
- EXCEPTION_FLT_OVERFLOW = C.STATUS_FLOAT_OVERFLOW
- EXCEPTION_FLT_UNDERFLOW = C.STATUS_FLOAT_UNDERFLOW
- EXCEPTION_INT_DIVIDE_BY_ZERO = C.STATUS_INTEGER_DIVIDE_BY_ZERO
- EXCEPTION_INT_OVERFLOW = C.STATUS_INTEGER_OVERFLOW
+type systeminfo struct {
+ anon0 [4]byte
+ dwpagesize uint32
+ lpminimumapplicationaddress *byte
+ lpmaximumapplicationaddress *byte
+ dwactiveprocessormask uintptr
+ dwnumberofprocessors uint32
+ dwprocessortype uint32
+ dwallocationgranularity uint32
+ wprocessorlevel uint16
+ wprocessorrevision uint16
+}
- INFINITE = C.INFINITE
- WAIT_TIMEOUT = C.WAIT_TIMEOUT
+type exceptionrecord struct {
+ exceptioncode uint32
+ exceptionflags uint32
+ exceptionrecord *exceptionrecord
+ exceptionaddress *byte
+ numberparameters uint32
+ exceptioninformation [15]uintptr
+}
- EXCEPTION_CONTINUE_EXECUTION = C.EXCEPTION_CONTINUE_EXECUTION
- EXCEPTION_CONTINUE_SEARCH = C.EXCEPTION_CONTINUE_SEARCH
-)
+type overlapped struct {
+ internal uintptr
+ internalhigh uintptr
+ anon0 [8]byte
+ hevent *byte
+}
-type SystemInfo C.SYSTEM_INFO
-type ExceptionRecord C.EXCEPTION_RECORD
-type FloatingSaveArea C.FLOATING_SAVE_AREA
-type M128a C.M128A
-type Context C.CONTEXT
-type Overlapped C.OVERLAPPED
-type MemoryBasicInformation C.MEMORY_BASIC_INFORMATION
+type memoryBasicInformation struct {
+ baseAddress uintptr
+ allocationBase uintptr
+ allocationProtect uint32
+ regionSize uintptr
+ state uint32
+ protect uint32
+ type_ uint32
+}
diff --git a/src/runtime/defs_windows_386.go b/src/runtime/defs_windows_386.go
index 3c5057b86f..37fe74c542 100644
--- a/src/runtime/defs_windows_386.go
+++ b/src/runtime/defs_windows_386.go
@@ -1,69 +1,10 @@
-// created by cgo -cdefs and then converted to Go
-// cgo -cdefs defs_windows.go
+// Copyright 2009 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.
package runtime
-const (
- _PROT_NONE = 0
- _PROT_READ = 1
- _PROT_WRITE = 2
- _PROT_EXEC = 4
-
- _MAP_ANON = 1
- _MAP_PRIVATE = 2
-
- _DUPLICATE_SAME_ACCESS = 0x2
- _THREAD_PRIORITY_HIGHEST = 0x2
-
- _SIGINT = 0x2
- _SIGTERM = 0xF
- _CTRL_C_EVENT = 0x0
- _CTRL_BREAK_EVENT = 0x1
- _CTRL_CLOSE_EVENT = 0x2
- _CTRL_LOGOFF_EVENT = 0x5
- _CTRL_SHUTDOWN_EVENT = 0x6
-
- _CONTEXT_CONTROL = 0x10001
- _CONTEXT_FULL = 0x10007
-
- _EXCEPTION_ACCESS_VIOLATION = 0xc0000005
- _EXCEPTION_BREAKPOINT = 0x80000003
- _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d
- _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e
- _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f
- _EXCEPTION_FLT_OVERFLOW = 0xc0000091
- _EXCEPTION_FLT_UNDERFLOW = 0xc0000093
- _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094
- _EXCEPTION_INT_OVERFLOW = 0xc0000095
-
- _INFINITE = 0xffffffff
- _WAIT_TIMEOUT = 0x102
-
- _EXCEPTION_CONTINUE_EXECUTION = -0x1
- _EXCEPTION_CONTINUE_SEARCH = 0x0
-)
-
-type systeminfo struct {
- anon0 [4]byte
- dwpagesize uint32
- lpminimumapplicationaddress *byte
- lpmaximumapplicationaddress *byte
- dwactiveprocessormask uint32
- dwnumberofprocessors uint32
- dwprocessortype uint32
- dwallocationgranularity uint32
- wprocessorlevel uint16
- wprocessorrevision uint16
-}
-
-type exceptionrecord struct {
- exceptioncode uint32
- exceptionflags uint32
- exceptionrecord *exceptionrecord
- exceptionaddress *byte
- numberparameters uint32
- exceptioninformation [15]uint32
-}
+const _CONTEXT_CONTROL = 0x10001
type floatingsavearea struct {
controlword uint32
@@ -130,20 +71,3 @@ func dumpregs(r *context) {
print("fs ", hex(r.segfs), "\n")
print("gs ", hex(r.seggs), "\n")
}
-
-type overlapped struct {
- internal uint32
- internalhigh uint32
- anon0 [8]byte
- hevent *byte
-}
-
-type memoryBasicInformation struct {
- baseAddress uintptr
- allocationBase uintptr
- allocationProtect uint32
- regionSize uintptr
- state uint32
- protect uint32
- type_ uint32
-}
diff --git a/src/runtime/defs_windows_amd64.go b/src/runtime/defs_windows_amd64.go
index ebb1506e2f..ac636a68ec 100644
--- a/src/runtime/defs_windows_amd64.go
+++ b/src/runtime/defs_windows_amd64.go
@@ -1,70 +1,10 @@
-// created by cgo -cdefs and then converted to Go
-// cgo -cdefs defs_windows.go
+// Copyright 2009 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.
package runtime
-const (
- _PROT_NONE = 0
- _PROT_READ = 1
- _PROT_WRITE = 2
- _PROT_EXEC = 4
-
- _MAP_ANON = 1
- _MAP_PRIVATE = 2
-
- _DUPLICATE_SAME_ACCESS = 0x2
- _THREAD_PRIORITY_HIGHEST = 0x2
-
- _SIGINT = 0x2
- _SIGTERM = 0xF
- _CTRL_C_EVENT = 0x0
- _CTRL_BREAK_EVENT = 0x1
- _CTRL_CLOSE_EVENT = 0x2
- _CTRL_LOGOFF_EVENT = 0x5
- _CTRL_SHUTDOWN_EVENT = 0x6
-
- _CONTEXT_CONTROL = 0x100001
- _CONTEXT_FULL = 0x10000b
-
- _EXCEPTION_ACCESS_VIOLATION = 0xc0000005
- _EXCEPTION_BREAKPOINT = 0x80000003
- _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d
- _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e
- _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f
- _EXCEPTION_FLT_OVERFLOW = 0xc0000091
- _EXCEPTION_FLT_UNDERFLOW = 0xc0000093
- _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094
- _EXCEPTION_INT_OVERFLOW = 0xc0000095
-
- _INFINITE = 0xffffffff
- _WAIT_TIMEOUT = 0x102
-
- _EXCEPTION_CONTINUE_EXECUTION = -0x1
- _EXCEPTION_CONTINUE_SEARCH = 0x0
-)
-
-type systeminfo struct {
- anon0 [4]byte
- dwpagesize uint32
- lpminimumapplicationaddress *byte
- lpmaximumapplicationaddress *byte
- dwactiveprocessormask uint64
- dwnumberofprocessors uint32
- dwprocessortype uint32
- dwallocationgranularity uint32
- wprocessorlevel uint16
- wprocessorrevision uint16
-}
-
-type exceptionrecord struct {
- exceptioncode uint32
- exceptionflags uint32
- exceptionrecord *exceptionrecord
- exceptionaddress *byte
- numberparameters uint32
- pad_cgo_0 [4]byte
- exceptioninformation [15]uint64
-}
+const _CONTEXT_CONTROL = 0x100001
type m128a struct {
low uint64
@@ -123,7 +63,7 @@ type context struct {
func (c *context) ip() uintptr { return uintptr(c.rip) }
func (c *context) sp() uintptr { return uintptr(c.rsp) }
-// Amd64 does not have link register, so this returns 0.
+// AMD64 does not have link register, so this returns 0.
func (c *context) lr() uintptr { return 0 }
func (c *context) set_lr(x uintptr) {}
@@ -152,20 +92,3 @@ func dumpregs(r *context) {
print("fs ", hex(r.segfs), "\n")
print("gs ", hex(r.seggs), "\n")
}
-
-type overlapped struct {
- internal uint64
- internalhigh uint64
- anon0 [8]byte
- hevent *byte
-}
-
-type memoryBasicInformation struct {
- baseAddress uintptr
- allocationBase uintptr
- allocationProtect uint32
- regionSize uintptr
- state uint32
- protect uint32
- type_ uint32
-}
diff --git a/src/runtime/defs_windows_arm.go b/src/runtime/defs_windows_arm.go
index b275b0572a..370470e35d 100644
--- a/src/runtime/defs_windows_arm.go
+++ b/src/runtime/defs_windows_arm.go
@@ -4,67 +4,13 @@
package runtime
-const (
- _PROT_NONE = 0
- _PROT_READ = 1
- _PROT_WRITE = 2
- _PROT_EXEC = 4
-
- _MAP_ANON = 1
- _MAP_PRIVATE = 2
-
- _DUPLICATE_SAME_ACCESS = 0x2
- _THREAD_PRIORITY_HIGHEST = 0x2
-
- _SIGINT = 0x2
- _SIGTERM = 0xF
- _CTRL_C_EVENT = 0x0
- _CTRL_BREAK_EVENT = 0x1
- _CTRL_CLOSE_EVENT = 0x2
- _CTRL_LOGOFF_EVENT = 0x5
- _CTRL_SHUTDOWN_EVENT = 0x6
-
- _CONTEXT_CONTROL = 0x10001
- _CONTEXT_FULL = 0x10007
-
- _EXCEPTION_ACCESS_VIOLATION = 0xc0000005
- _EXCEPTION_BREAKPOINT = 0x80000003
- _EXCEPTION_FLT_DENORMAL_OPERAND = 0xc000008d
- _EXCEPTION_FLT_DIVIDE_BY_ZERO = 0xc000008e
- _EXCEPTION_FLT_INEXACT_RESULT = 0xc000008f
- _EXCEPTION_FLT_OVERFLOW = 0xc0000091
- _EXCEPTION_FLT_UNDERFLOW = 0xc0000093
- _EXCEPTION_INT_DIVIDE_BY_ZERO = 0xc0000094
- _EXCEPTION_INT_OVERFLOW = 0xc0000095
-
- _INFINITE = 0xffffffff
- _WAIT_TIMEOUT = 0x102
-
- _EXCEPTION_CONTINUE_EXECUTION = -0x1
- _EXCEPTION_CONTINUE_SEARCH = 0x0
-)
-
-type systeminfo struct {
- anon0 [4]byte
- dwpagesize uint32
- lpminimumapplicationaddress *byte
- lpmaximumapplicationaddress *byte
- dwactiveprocessormask uint32
- dwnumberofprocessors uint32
- dwprocessortype uint32
- dwallocationgranularity uint32
- wprocessorlevel uint16
- wprocessorrevision uint16
-}
-
-type exceptionrecord struct {
- exceptioncode uint32
- exceptionflags uint32
- exceptionrecord *exceptionrecord
- exceptionaddress *byte
- numberparameters uint32
- exceptioninformation [15]uint32
-}
+// NOTE(rsc): _CONTEXT_CONTROL is actually 0x200001 and should include PC, SP, and LR.
+// However, empirically, LR doesn't come along on Windows 10
+// unless you also set _CONTEXT_INTEGER (0x200002).
+// Without LR, we skip over the next-to-bottom function in profiles
+// when the bottom function is frameless.
+// So we set both here, to make a working _CONTEXT_CONTROL.
+const _CONTEXT_CONTROL = 0x200003
type neon128 struct {
low uint64
@@ -132,23 +78,6 @@ func dumpregs(r *context) {
print("cpsr ", hex(r.cpsr), "\n")
}
-type overlapped struct {
- internal uint32
- internalhigh uint32
- anon0 [8]byte
- hevent *byte
-}
-
-type memoryBasicInformation struct {
- baseAddress uintptr
- allocationBase uintptr
- allocationProtect uint32
- regionSize uintptr
- state uint32
- protect uint32
- type_ uint32
-}
-
func stackcheck() {
// TODO: not implemented on ARM
}
diff --git a/src/runtime/defs_windows_arm64.go b/src/runtime/defs_windows_arm64.go
new file mode 100644
index 0000000000..9ccce46f09
--- /dev/null
+++ b/src/runtime/defs_windows_arm64.go
@@ -0,0 +1,83 @@
+// 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.
+
+package runtime
+
+// NOTE(rsc): _CONTEXT_CONTROL is actually 0x400001 and should include PC, SP, and LR.
+// However, empirically, LR doesn't come along on Windows 10
+// unless you also set _CONTEXT_INTEGER (0x400002).
+// Without LR, we skip over the next-to-bottom function in profiles
+// when the bottom function is frameless.
+// So we set both here, to make a working _CONTEXT_CONTROL.
+const _CONTEXT_CONTROL = 0x400003
+
+type neon128 struct {
+ low uint64
+ high int64
+}
+
+// See https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-arm64_nt_context
+type context struct {
+ contextflags uint32
+ cpsr uint32
+ x [31]uint64 // fp is x[29], lr is x[30]
+ xsp uint64
+ pc uint64
+ v [32]neon128
+ fpcr uint32
+ fpsr uint32
+ bcr [8]uint32
+ bvr [8]uint64
+ wcr [2]uint32
+ wvr [2]uint64
+}
+
+func (c *context) ip() uintptr { return uintptr(c.pc) }
+func (c *context) sp() uintptr { return uintptr(c.xsp) }
+func (c *context) lr() uintptr { return uintptr(c.x[30]) }
+
+func (c *context) set_ip(x uintptr) { c.pc = uint64(x) }
+func (c *context) set_sp(x uintptr) { c.xsp = uint64(x) }
+func (c *context) set_lr(x uintptr) { c.x[30] = uint64(x) }
+
+func dumpregs(r *context) {
+ print("r0 ", hex(r.x[0]), "\n")
+ print("r1 ", hex(r.x[1]), "\n")
+ print("r2 ", hex(r.x[2]), "\n")
+ print("r3 ", hex(r.x[3]), "\n")
+ print("r4 ", hex(r.x[4]), "\n")
+ print("r5 ", hex(r.x[5]), "\n")
+ print("r6 ", hex(r.x[6]), "\n")
+ print("r7 ", hex(r.x[7]), "\n")
+ print("r8 ", hex(r.x[8]), "\n")
+ print("r9 ", hex(r.x[9]), "\n")
+ print("r10 ", hex(r.x[10]), "\n")
+ print("r11 ", hex(r.x[11]), "\n")
+ print("r12 ", hex(r.x[12]), "\n")
+ print("r13 ", hex(r.x[13]), "\n")
+ print("r14 ", hex(r.x[14]), "\n")
+ print("r15 ", hex(r.x[15]), "\n")
+ print("r16 ", hex(r.x[16]), "\n")
+ print("r17 ", hex(r.x[17]), "\n")
+ print("r18 ", hex(r.x[18]), "\n")
+ print("r19 ", hex(r.x[19]), "\n")
+ print("r20 ", hex(r.x[20]), "\n")
+ print("r21 ", hex(r.x[21]), "\n")
+ print("r22 ", hex(r.x[22]), "\n")
+ print("r23 ", hex(r.x[23]), "\n")
+ print("r24 ", hex(r.x[24]), "\n")
+ print("r25 ", hex(r.x[25]), "\n")
+ print("r26 ", hex(r.x[26]), "\n")
+ print("r27 ", hex(r.x[27]), "\n")
+ print("r28 ", hex(r.x[28]), "\n")
+ print("r29 ", hex(r.x[29]), "\n")
+ print("lr ", hex(r.x[30]), "\n")
+ print("sp ", hex(r.xsp), "\n")
+ print("pc ", hex(r.pc), "\n")
+ print("cpsr ", hex(r.cpsr), "\n")
+}
+
+func stackcheck() {
+ // TODO: not implemented on ARM
+}
diff --git a/src/runtime/duff_amd64.s b/src/runtime/duff_amd64.s
index 2ff5bf6dbc..df010f5853 100644
--- a/src/runtime/duff_amd64.s
+++ b/src/runtime/duff_amd64.s
@@ -5,100 +5,100 @@
#include "textflag.h"
TEXT runtime·duffzero<ABIInternal>(SB), NOSPLIT, $0-0
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
- MOVUPS X0,(DI)
- MOVUPS X0,16(DI)
- MOVUPS X0,32(DI)
- MOVUPS X0,48(DI)
+ MOVUPS X15,(DI)
+ MOVUPS X15,16(DI)
+ MOVUPS X15,32(DI)
+ MOVUPS X15,48(DI)
LEAQ 64(DI),DI
RET
diff --git a/src/runtime/env_posix.go b/src/runtime/env_posix.go
index af353bbcd9..95517b2a95 100644
--- a/src/runtime/env_posix.go
+++ b/src/runtime/env_posix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows || plan9
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows plan9
package runtime
diff --git a/src/runtime/export_debug_test.go b/src/runtime/export_debug_test.go
index ed4242ef24..18ccecd5cd 100644
--- a/src/runtime/export_debug_test.go
+++ b/src/runtime/export_debug_test.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build amd64
-// +build linux
+//go:build amd64 && linux
+// +build amd64,linux
package runtime
diff --git a/src/runtime/export_futex_test.go b/src/runtime/export_futex_test.go
index a727a93114..34c970d6d2 100644
--- a/src/runtime/export_futex_test.go
+++ b/src/runtime/export_futex_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux
// +build dragonfly freebsd linux
package runtime
diff --git a/src/runtime/export_mmap_test.go b/src/runtime/export_mmap_test.go
index aeaf37f64b..bf4a815899 100644
--- a/src/runtime/export_mmap_test.go
+++ b/src/runtime/export_mmap_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// Export guts for testing.
diff --git a/src/runtime/export_pipe2_test.go b/src/runtime/export_pipe2_test.go
index 9d580d3313..26d8b7d185 100644
--- a/src/runtime/export_pipe2_test.go
+++ b/src/runtime/export_pipe2_test.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build freebsd linux netbsd openbsd solaris
+//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris
+// +build dragonfly freebsd linux netbsd openbsd solaris
package runtime
diff --git a/src/runtime/export_pipe_test.go b/src/runtime/export_pipe_test.go
index 8f66770fb9..a0c6c0440d 100644
--- a/src/runtime/export_pipe_test.go
+++ b/src/runtime/export_pipe_test.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build aix darwin dragonfly
+//go:build aix || darwin
+// +build aix darwin
package runtime
diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go
index 22fef3134f..a48bb2636f 100644
--- a/src/runtime/export_test.go
+++ b/src/runtime/export_test.go
@@ -200,8 +200,6 @@ func GostringW(w []uint16) (s string) {
return
}
-type Uintreg sys.Uintreg
-
var Open = open
var Close = closefd
var Read = read
diff --git a/src/runtime/export_unix_test.go b/src/runtime/export_unix_test.go
index 307c63fd68..215e234286 100644
--- a/src/runtime/export_unix_test.go
+++ b/src/runtime/export_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package runtime
diff --git a/src/runtime/extern.go b/src/runtime/extern.go
index dacdf4f383..bbe41dd0d4 100644
--- a/src/runtime/extern.go
+++ b/src/runtime/extern.go
@@ -229,6 +229,8 @@ func Callers(skip int, pc []uintptr) int {
return callers(skip, pc)
}
+var defaultGOROOT string // set by cmd/link
+
// GOROOT returns the root of the Go tree. It uses the
// GOROOT environment variable, if set at process start,
// or else the root used during the Go build.
@@ -237,7 +239,7 @@ func GOROOT() string {
if s != "" {
return s
}
- return sys.DefaultGoroot
+ return defaultGOROOT
}
// Version returns the Go tree's version string.
diff --git a/src/runtime/futex_test.go b/src/runtime/futex_test.go
index 3051bd5880..10a735327a 100644
--- a/src/runtime/futex_test.go
+++ b/src/runtime/futex_test.go
@@ -6,6 +6,7 @@
// The race detector emits calls to split stack functions so it breaks
// the test.
+//go:build (dragonfly || freebsd || linux) && !race
// +build dragonfly freebsd linux
// +build !race
diff --git a/src/runtime/hash32.go b/src/runtime/hash32.go
index 966f70e1aa..7fa8eb7cab 100644
--- a/src/runtime/hash32.go
+++ b/src/runtime/hash32.go
@@ -6,6 +6,7 @@
// xxhash: https://code.google.com/p/xxhash/
// cityhash: https://code.google.com/p/cityhash/
+//go:build 386 || arm || mips || mipsle
// +build 386 arm mips mipsle
package runtime
diff --git a/src/runtime/hash64.go b/src/runtime/hash64.go
index d1283824ad..1bee666bd7 100644
--- a/src/runtime/hash64.go
+++ b/src/runtime/hash64.go
@@ -6,6 +6,7 @@
// xxhash: https://code.google.com/p/xxhash/
// cityhash: https://code.google.com/p/cityhash/
+//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm
// +build amd64 arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x wasm
package runtime
diff --git a/src/runtime/histogram.go b/src/runtime/histogram.go
index 42baa6c5e2..da4910d341 100644
--- a/src/runtime/histogram.go
+++ b/src/runtime/histogram.go
@@ -26,7 +26,7 @@ const (
// The number of super-buckets (timeHistNumSuperBuckets), on the
// other hand, defines the range. To reserve room for sub-buckets,
// bit timeHistSubBucketBits is the first bit considered for
- // super-buckets, so super-bucket indicies are adjusted accordingly.
+ // super-buckets, so super-bucket indices are adjusted accordingly.
//
// As an example, consider 45 super-buckets with 16 sub-buckets.
//
diff --git a/src/runtime/iface.go b/src/runtime/iface.go
index 0504b89363..02b18dabff 100644
--- a/src/runtime/iface.go
+++ b/src/runtime/iface.go
@@ -447,23 +447,18 @@ func convI2I(inter *interfacetype, i iface) (r iface) {
return
}
-func assertI2I(inter *interfacetype, i iface) (r iface) {
- tab := i.tab
+func assertI2I(inter *interfacetype, tab *itab) *itab {
if tab == nil {
// explicit conversions require non-nil interface value.
panic(&TypeAssertionError{nil, nil, &inter.typ, ""})
}
if tab.inter == inter {
- r.tab = tab
- r.data = i.data
- return
+ return tab
}
- r.tab = getitab(inter, tab._type, false)
- r.data = i.data
- return
+ return getitab(inter, tab._type, false)
}
-func assertI2I2(inter *interfacetype, i iface) (r iface, b bool) {
+func assertI2I2(inter *interfacetype, i iface) (r iface) {
tab := i.tab
if tab == nil {
return
@@ -476,22 +471,18 @@ func assertI2I2(inter *interfacetype, i iface) (r iface, b bool) {
}
r.tab = tab
r.data = i.data
- b = true
return
}
-func assertE2I(inter *interfacetype, e eface) (r iface) {
- t := e._type
+func assertE2I(inter *interfacetype, t *_type) *itab {
if t == nil {
// explicit conversions require non-nil interface value.
panic(&TypeAssertionError{nil, nil, &inter.typ, ""})
}
- r.tab = getitab(inter, t, false)
- r.data = e.data
- return
+ return getitab(inter, t, false)
}
-func assertE2I2(inter *interfacetype, e eface) (r iface, b bool) {
+func assertE2I2(inter *interfacetype, e eface) (r iface) {
t := e._type
if t == nil {
return
@@ -502,18 +493,17 @@ func assertE2I2(inter *interfacetype, e eface) (r iface, b bool) {
}
r.tab = tab
r.data = e.data
- b = true
return
}
//go:linkname reflect_ifaceE2I reflect.ifaceE2I
func reflect_ifaceE2I(inter *interfacetype, e eface, dst *iface) {
- *dst = assertE2I(inter, e)
+ *dst = iface{assertE2I(inter, e._type), e.data}
}
//go:linkname reflectlite_ifaceE2I internal/reflectlite.ifaceE2I
func reflectlite_ifaceE2I(inter *interfacetype, e eface, dst *iface) {
- *dst = assertE2I(inter, e)
+ *dst = iface{assertE2I(inter, e._type), e.data}
}
func iterate_itabs(fn func(*itab)) {
diff --git a/src/runtime/internal/atomic/atomic_386.go b/src/runtime/internal/atomic/atomic_386.go
index 1bfcb1143d..d4aed6b671 100644
--- a/src/runtime/internal/atomic/atomic_386.go
+++ b/src/runtime/internal/atomic/atomic_386.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386
// +build 386
package atomic
diff --git a/src/runtime/internal/atomic/atomic_arm.go b/src/runtime/internal/atomic/atomic_arm.go
index 546b3d6120..2e9374ca26 100644
--- a/src/runtime/internal/atomic/atomic_arm.go
+++ b/src/runtime/internal/atomic/atomic_arm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm
// +build arm
package atomic
diff --git a/src/runtime/internal/atomic/atomic_arm64.go b/src/runtime/internal/atomic/atomic_arm64.go
index d49bee8936..131c687e1b 100644
--- a/src/runtime/internal/atomic/atomic_arm64.go
+++ b/src/runtime/internal/atomic/atomic_arm64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm64
// +build arm64
package atomic
diff --git a/src/runtime/internal/atomic/atomic_mips64x.go b/src/runtime/internal/atomic/atomic_mips64x.go
index b0109d72b0..5b407ebc7a 100644
--- a/src/runtime/internal/atomic/atomic_mips64x.go
+++ b/src/runtime/internal/atomic/atomic_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips64 || mips64le
// +build mips64 mips64le
package atomic
diff --git a/src/runtime/internal/atomic/atomic_mipsx.go b/src/runtime/internal/atomic/atomic_mipsx.go
index 1336b50121..80cd65b333 100644
--- a/src/runtime/internal/atomic/atomic_mipsx.go
+++ b/src/runtime/internal/atomic/atomic_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips || mipsle
// +build mips mipsle
// Export some functions via linkname to assembly in sync/atomic.
diff --git a/src/runtime/internal/atomic/atomic_ppc64x.go b/src/runtime/internal/atomic/atomic_ppc64x.go
index e4b109f0ec..98101e3287 100644
--- a/src/runtime/internal/atomic/atomic_ppc64x.go
+++ b/src/runtime/internal/atomic/atomic_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package atomic
diff --git a/src/runtime/internal/atomic/stubs.go b/src/runtime/internal/atomic/stubs.go
index 62e30d1788..1275884b2f 100644
--- a/src/runtime/internal/atomic/stubs.go
+++ b/src/runtime/internal/atomic/stubs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !wasm
// +build !wasm
package atomic
diff --git a/src/runtime/internal/sys/arch.go b/src/runtime/internal/sys/arch.go
index 13c00cf639..3c99a2f7da 100644
--- a/src/runtime/internal/sys/arch.go
+++ b/src/runtime/internal/sys/arch.go
@@ -18,3 +18,37 @@ const (
S390X
WASM
)
+
+// PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant.
+// It is also the size of the machine's native word size (that is, 4 on 32-bit systems, 8 on 64-bit).
+const PtrSize = 4 << (^uintptr(0) >> 63)
+
+// AIX requires a larger stack for syscalls.
+const StackGuardMultiplier = StackGuardMultiplierDefault*(1-GoosAix) + 2*GoosAix
+
+// ArchFamily is the architecture family (AMD64, ARM, ...)
+const ArchFamily ArchFamilyType = _ArchFamily
+
+// BigEndian reports whether the architecture is big-endian.
+const BigEndian = GoarchArmbe|GoarchArm64be|GoarchMips|GoarchMips64|GoarchPpc|GoarchPpc64|GoarchS390|GoarchS390x|GoarchSparc|GoarchSparc64 == 1
+
+// DefaultPhysPageSize is the default physical page size.
+const DefaultPhysPageSize = _DefaultPhysPageSize
+
+// PCQuantum is the minimal unit for a program counter (1 on x86, 4 on most other systems).
+// The various PC tables record PC deltas pre-divided by PCQuantum.
+const PCQuantum = _PCQuantum
+
+// Int64Align is the required alignment for a 64-bit integer (4 on 32-bit systems, 8 on 64-bit).
+const Int64Align = PtrSize
+
+// MinFrameSize is the size of the system-reserved words at the bottom
+// of a frame (just above the architectural stack pointer).
+// It is zero on x86 and PtrSize on most non-x86 (LR-based) systems.
+// On PowerPC it is larger, to cover three more reserved words:
+// the compiler word, the link editor word, and the TOC save word.
+const MinFrameSize = _MinFrameSize
+
+// StackAlign is the required alignment of the SP register.
+// The stack must be at least word aligned, but some architectures require more.
+const StackAlign = _StackAlign
diff --git a/src/runtime/internal/sys/arch_386.go b/src/runtime/internal/sys/arch_386.go
index b51f70a512..1ebce3435e 100644
--- a/src/runtime/internal/sys/arch_386.go
+++ b/src/runtime/internal/sys/arch_386.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = I386
- BigEndian = false
- DefaultPhysPageSize = 4096
- PCQuantum = 1
- Int64Align = 4
- MinFrameSize = 0
+ _ArchFamily = I386
+ _DefaultPhysPageSize = 4096
+ _PCQuantum = 1
+ _MinFrameSize = 0
+ _StackAlign = PtrSize
)
-
-type Uintreg uint32
diff --git a/src/runtime/internal/sys/arch_amd64.go b/src/runtime/internal/sys/arch_amd64.go
index 3d6776e71e..7f003d0f1d 100644
--- a/src/runtime/internal/sys/arch_amd64.go
+++ b/src/runtime/internal/sys/arch_amd64.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = AMD64
- BigEndian = false
- DefaultPhysPageSize = 4096
- PCQuantum = 1
- Int64Align = 8
- MinFrameSize = 0
+ _ArchFamily = AMD64
+ _DefaultPhysPageSize = 4096
+ _PCQuantum = 1
+ _MinFrameSize = 0
+ _StackAlign = PtrSize
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_arm.go b/src/runtime/internal/sys/arch_arm.go
index 97960d6f83..ef2048bb71 100644
--- a/src/runtime/internal/sys/arch_arm.go
+++ b/src/runtime/internal/sys/arch_arm.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = ARM
- BigEndian = false
- DefaultPhysPageSize = 65536
- PCQuantum = 4
- Int64Align = 4
- MinFrameSize = 4
+ _ArchFamily = ARM
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 4
+ _MinFrameSize = 4
+ _StackAlign = PtrSize
)
-
-type Uintreg uint32
diff --git a/src/runtime/internal/sys/arch_arm64.go b/src/runtime/internal/sys/arch_arm64.go
index 911a9485e1..b9f2f7b1fe 100644
--- a/src/runtime/internal/sys/arch_arm64.go
+++ b/src/runtime/internal/sys/arch_arm64.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = ARM64
- BigEndian = false
- DefaultPhysPageSize = 65536
- PCQuantum = 4
- Int64Align = 8
- MinFrameSize = 8
+ _ArchFamily = ARM64
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 4
+ _MinFrameSize = 8
+ _StackAlign = 16
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_mips.go b/src/runtime/internal/sys/arch_mips.go
index 75cdb2e07f..4cb0eebea7 100644
--- a/src/runtime/internal/sys/arch_mips.go
+++ b/src/runtime/internal/sys/arch_mips.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = MIPS
- BigEndian = true
- DefaultPhysPageSize = 65536
- PCQuantum = 4
- Int64Align = 4
- MinFrameSize = 4
+ _ArchFamily = MIPS
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 4
+ _MinFrameSize = 4
+ _StackAlign = PtrSize
)
-
-type Uintreg uint32
diff --git a/src/runtime/internal/sys/arch_mips64.go b/src/runtime/internal/sys/arch_mips64.go
index 494291a802..57636ac4a4 100644
--- a/src/runtime/internal/sys/arch_mips64.go
+++ b/src/runtime/internal/sys/arch_mips64.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = MIPS64
- BigEndian = true
- DefaultPhysPageSize = 16384
- PCQuantum = 4
- Int64Align = 8
- MinFrameSize = 8
+ _ArchFamily = MIPS64
+ _DefaultPhysPageSize = 16384
+ _PCQuantum = 4
+ _MinFrameSize = 8
+ _StackAlign = PtrSize
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_mips64le.go b/src/runtime/internal/sys/arch_mips64le.go
index d36d1202f6..57636ac4a4 100644
--- a/src/runtime/internal/sys/arch_mips64le.go
+++ b/src/runtime/internal/sys/arch_mips64le.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = MIPS64
- BigEndian = false
- DefaultPhysPageSize = 16384
- PCQuantum = 4
- Int64Align = 8
- MinFrameSize = 8
+ _ArchFamily = MIPS64
+ _DefaultPhysPageSize = 16384
+ _PCQuantum = 4
+ _MinFrameSize = 8
+ _StackAlign = PtrSize
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_mipsle.go b/src/runtime/internal/sys/arch_mipsle.go
index 323bf82059..4240f5ce47 100644
--- a/src/runtime/internal/sys/arch_mipsle.go
+++ b/src/runtime/internal/sys/arch_mipsle.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = MIPS
- BigEndian = false
- DefaultPhysPageSize = 65536
- PCQuantum = 4
- Int64Align = 4
- MinFrameSize = 4
+ _ArchFamily = MIPS
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 4
+ _MinFrameSize = 4
+ _StackAlign = PtrSize
)
-
-type Uintreg uint32
diff --git a/src/runtime/internal/sys/arch_ppc64.go b/src/runtime/internal/sys/arch_ppc64.go
index da1fe3d596..1869213ce2 100644
--- a/src/runtime/internal/sys/arch_ppc64.go
+++ b/src/runtime/internal/sys/arch_ppc64.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = PPC64
- BigEndian = true
- DefaultPhysPageSize = 65536
- PCQuantum = 4
- Int64Align = 8
- MinFrameSize = 32
+ _ArchFamily = PPC64
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 4
+ _MinFrameSize = 32
+ _StackAlign = 16
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_ppc64le.go b/src/runtime/internal/sys/arch_ppc64le.go
index 605979903a..1869213ce2 100644
--- a/src/runtime/internal/sys/arch_ppc64le.go
+++ b/src/runtime/internal/sys/arch_ppc64le.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = PPC64
- BigEndian = false
- DefaultPhysPageSize = 65536
- PCQuantum = 4
- Int64Align = 8
- MinFrameSize = 32
+ _ArchFamily = PPC64
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 4
+ _MinFrameSize = 32
+ _StackAlign = 16
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_riscv64.go b/src/runtime/internal/sys/arch_riscv64.go
index 7cdcc8fcbd..360d236e32 100644
--- a/src/runtime/internal/sys/arch_riscv64.go
+++ b/src/runtime/internal/sys/arch_riscv64.go
@@ -5,14 +5,9 @@
package sys
const (
- ArchFamily = RISCV64
- BigEndian = false
- CacheLineSize = 64
- DefaultPhysPageSize = 4096
- PCQuantum = 4
- Int64Align = 8
- HugePageSize = 1 << 21
- MinFrameSize = 8
+ _ArchFamily = RISCV64
+ _DefaultPhysPageSize = 4096
+ _PCQuantum = 4
+ _MinFrameSize = 8
+ _StackAlign = PtrSize
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_s390x.go b/src/runtime/internal/sys/arch_s390x.go
index 12cb8a0fcb..e33e0b7f2b 100644
--- a/src/runtime/internal/sys/arch_s390x.go
+++ b/src/runtime/internal/sys/arch_s390x.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = S390X
- BigEndian = true
- DefaultPhysPageSize = 4096
- PCQuantum = 2
- Int64Align = 8
- MinFrameSize = 8
+ _ArchFamily = S390X
+ _DefaultPhysPageSize = 4096
+ _PCQuantum = 2
+ _MinFrameSize = 8
+ _StackAlign = PtrSize
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/arch_wasm.go b/src/runtime/internal/sys/arch_wasm.go
index eb825df626..ee919ff9e6 100644
--- a/src/runtime/internal/sys/arch_wasm.go
+++ b/src/runtime/internal/sys/arch_wasm.go
@@ -5,12 +5,9 @@
package sys
const (
- ArchFamily = WASM
- BigEndian = false
- DefaultPhysPageSize = 65536
- PCQuantum = 1
- Int64Align = 8
- MinFrameSize = 0
+ _ArchFamily = WASM
+ _DefaultPhysPageSize = 65536
+ _PCQuantum = 1
+ _MinFrameSize = 0
+ _StackAlign = PtrSize
)
-
-type Uintreg uint64
diff --git a/src/runtime/internal/sys/gengoos.go b/src/runtime/internal/sys/gengoos.go
index 9bbc48d94f..51f64a6e5c 100644
--- a/src/runtime/internal/sys/gengoos.go
+++ b/src/runtime/internal/sys/gengoos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
package main
diff --git a/src/runtime/internal/sys/intrinsics.go b/src/runtime/internal/sys/intrinsics.go
index 3c8898236c..e76d8dd064 100644
--- a/src/runtime/internal/sys/intrinsics.go
+++ b/src/runtime/internal/sys/intrinsics.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !386
// +build !386
// TODO finish intrinsifying 386, deadcode the assembly, remove build tags, merge w/ intrinsics_common
diff --git a/src/runtime/internal/sys/intrinsics_stubs.go b/src/runtime/internal/sys/intrinsics_stubs.go
index 9cbf48216c..bf1494d48a 100644
--- a/src/runtime/internal/sys/intrinsics_stubs.go
+++ b/src/runtime/internal/sys/intrinsics_stubs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386
// +build 386
package sys
diff --git a/src/runtime/internal/sys/stubs.go b/src/runtime/internal/sys/stubs.go
deleted file mode 100644
index 10b0173f60..0000000000
--- a/src/runtime/internal/sys/stubs.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2014 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.
-
-package sys
-
-// Declarations for runtime services implemented in C or assembly.
-
-const PtrSize = 4 << (^uintptr(0) >> 63) // unsafe.Sizeof(uintptr(0)) but an ideal const
-const RegSize = 4 << (^Uintreg(0) >> 63) // unsafe.Sizeof(uintreg(0)) but an ideal const
-const SpAlign = 1*(1-GoarchArm64) + 16*GoarchArm64 // SP alignment: 1 normally, 16 for ARM64
-
-var DefaultGoroot string // set at link time
-
-// AIX requires a larger stack for syscalls.
-const StackGuardMultiplier = StackGuardMultiplierDefault*(1-GoosAix) + 2*GoosAix
diff --git a/src/runtime/internal/sys/zgoarch_386.go b/src/runtime/internal/sys/zgoarch_386.go
index c286d0df2b..98a2401bfe 100644
--- a/src/runtime/internal/sys/zgoarch_386.go
+++ b/src/runtime/internal/sys/zgoarch_386.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build 386
// +build 386
package sys
diff --git a/src/runtime/internal/sys/zgoarch_amd64.go b/src/runtime/internal/sys/zgoarch_amd64.go
index d21c1d7d2a..d8faa5c786 100644
--- a/src/runtime/internal/sys/zgoarch_amd64.go
+++ b/src/runtime/internal/sys/zgoarch_amd64.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build amd64
// +build amd64
package sys
diff --git a/src/runtime/internal/sys/zgoarch_arm.go b/src/runtime/internal/sys/zgoarch_arm.go
index 9085fb0ea8..b64a69c9b4 100644
--- a/src/runtime/internal/sys/zgoarch_arm.go
+++ b/src/runtime/internal/sys/zgoarch_arm.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build arm
// +build arm
package sys
diff --git a/src/runtime/internal/sys/zgoarch_arm64.go b/src/runtime/internal/sys/zgoarch_arm64.go
index ed7ef2ebcb..de6f85347b 100644
--- a/src/runtime/internal/sys/zgoarch_arm64.go
+++ b/src/runtime/internal/sys/zgoarch_arm64.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build arm64
// +build arm64
package sys
diff --git a/src/runtime/internal/sys/zgoarch_arm64be.go b/src/runtime/internal/sys/zgoarch_arm64be.go
index faf3111053..b762bb069f 100644
--- a/src/runtime/internal/sys/zgoarch_arm64be.go
+++ b/src/runtime/internal/sys/zgoarch_arm64be.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build arm64be
// +build arm64be
package sys
diff --git a/src/runtime/internal/sys/zgoarch_armbe.go b/src/runtime/internal/sys/zgoarch_armbe.go
index cb28301e0b..e5297e4b16 100644
--- a/src/runtime/internal/sys/zgoarch_armbe.go
+++ b/src/runtime/internal/sys/zgoarch_armbe.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build armbe
// +build armbe
package sys
diff --git a/src/runtime/internal/sys/zgoarch_mips.go b/src/runtime/internal/sys/zgoarch_mips.go
index 315dea1c84..b5f4ed390c 100644
--- a/src/runtime/internal/sys/zgoarch_mips.go
+++ b/src/runtime/internal/sys/zgoarch_mips.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build mips
// +build mips
package sys
diff --git a/src/runtime/internal/sys/zgoarch_mips64.go b/src/runtime/internal/sys/zgoarch_mips64.go
index 5258cbfbe7..73777cceb2 100644
--- a/src/runtime/internal/sys/zgoarch_mips64.go
+++ b/src/runtime/internal/sys/zgoarch_mips64.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build mips64
// +build mips64
package sys
diff --git a/src/runtime/internal/sys/zgoarch_mips64le.go b/src/runtime/internal/sys/zgoarch_mips64le.go
index 1721698518..0c81c36c09 100644
--- a/src/runtime/internal/sys/zgoarch_mips64le.go
+++ b/src/runtime/internal/sys/zgoarch_mips64le.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build mips64le
// +build mips64le
package sys
diff --git a/src/runtime/internal/sys/zgoarch_mips64p32.go b/src/runtime/internal/sys/zgoarch_mips64p32.go
index 44c4624da9..d63ce27d24 100644
--- a/src/runtime/internal/sys/zgoarch_mips64p32.go
+++ b/src/runtime/internal/sys/zgoarch_mips64p32.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build mips64p32
// +build mips64p32
package sys
diff --git a/src/runtime/internal/sys/zgoarch_mips64p32le.go b/src/runtime/internal/sys/zgoarch_mips64p32le.go
index eb63225430..2d577890b2 100644
--- a/src/runtime/internal/sys/zgoarch_mips64p32le.go
+++ b/src/runtime/internal/sys/zgoarch_mips64p32le.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build mips64p32le
// +build mips64p32le
package sys
diff --git a/src/runtime/internal/sys/zgoarch_mipsle.go b/src/runtime/internal/sys/zgoarch_mipsle.go
index e0ebfbf038..8af919d03a 100644
--- a/src/runtime/internal/sys/zgoarch_mipsle.go
+++ b/src/runtime/internal/sys/zgoarch_mipsle.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build mipsle
// +build mipsle
package sys
diff --git a/src/runtime/internal/sys/zgoarch_ppc.go b/src/runtime/internal/sys/zgoarch_ppc.go
index ef26aa3201..f6f12a5ddc 100644
--- a/src/runtime/internal/sys/zgoarch_ppc.go
+++ b/src/runtime/internal/sys/zgoarch_ppc.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build ppc
// +build ppc
package sys
diff --git a/src/runtime/internal/sys/zgoarch_ppc64.go b/src/runtime/internal/sys/zgoarch_ppc64.go
index 32c2d46d4c..a8379601f4 100644
--- a/src/runtime/internal/sys/zgoarch_ppc64.go
+++ b/src/runtime/internal/sys/zgoarch_ppc64.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build ppc64
// +build ppc64
package sys
diff --git a/src/runtime/internal/sys/zgoarch_ppc64le.go b/src/runtime/internal/sys/zgoarch_ppc64le.go
index 3a6e56763c..f2ec5dcba7 100644
--- a/src/runtime/internal/sys/zgoarch_ppc64le.go
+++ b/src/runtime/internal/sys/zgoarch_ppc64le.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build ppc64le
// +build ppc64le
package sys
diff --git a/src/runtime/internal/sys/zgoarch_riscv.go b/src/runtime/internal/sys/zgoarch_riscv.go
index d8f6b49093..83a3312f5f 100644
--- a/src/runtime/internal/sys/zgoarch_riscv.go
+++ b/src/runtime/internal/sys/zgoarch_riscv.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build riscv
// +build riscv
package sys
diff --git a/src/runtime/internal/sys/zgoarch_riscv64.go b/src/runtime/internal/sys/zgoarch_riscv64.go
index 0ba843b5ac..1dfcc84997 100644
--- a/src/runtime/internal/sys/zgoarch_riscv64.go
+++ b/src/runtime/internal/sys/zgoarch_riscv64.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build riscv64
// +build riscv64
package sys
diff --git a/src/runtime/internal/sys/zgoarch_s390.go b/src/runtime/internal/sys/zgoarch_s390.go
index 20a1b234a6..91aba5a0f6 100644
--- a/src/runtime/internal/sys/zgoarch_s390.go
+++ b/src/runtime/internal/sys/zgoarch_s390.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build s390
// +build s390
package sys
diff --git a/src/runtime/internal/sys/zgoarch_s390x.go b/src/runtime/internal/sys/zgoarch_s390x.go
index ffdda0c827..edce50234e 100644
--- a/src/runtime/internal/sys/zgoarch_s390x.go
+++ b/src/runtime/internal/sys/zgoarch_s390x.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build s390x
// +build s390x
package sys
diff --git a/src/runtime/internal/sys/zgoarch_sparc.go b/src/runtime/internal/sys/zgoarch_sparc.go
index b4949510d5..5ae9560ab0 100644
--- a/src/runtime/internal/sys/zgoarch_sparc.go
+++ b/src/runtime/internal/sys/zgoarch_sparc.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build sparc
// +build sparc
package sys
diff --git a/src/runtime/internal/sys/zgoarch_sparc64.go b/src/runtime/internal/sys/zgoarch_sparc64.go
index 0f6df411ce..e2a0134aff 100644
--- a/src/runtime/internal/sys/zgoarch_sparc64.go
+++ b/src/runtime/internal/sys/zgoarch_sparc64.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build sparc64
// +build sparc64
package sys
diff --git a/src/runtime/internal/sys/zgoarch_wasm.go b/src/runtime/internal/sys/zgoarch_wasm.go
index e69afb0cb3..52e85dea37 100644
--- a/src/runtime/internal/sys/zgoarch_wasm.go
+++ b/src/runtime/internal/sys/zgoarch_wasm.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build wasm
// +build wasm
package sys
diff --git a/src/runtime/internal/sys/zgoos_aix.go b/src/runtime/internal/sys/zgoos_aix.go
index 0631d02aa5..f3b907471f 100644
--- a/src/runtime/internal/sys/zgoos_aix.go
+++ b/src/runtime/internal/sys/zgoos_aix.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build aix
// +build aix
package sys
diff --git a/src/runtime/internal/sys/zgoos_android.go b/src/runtime/internal/sys/zgoos_android.go
index d356a40bec..e28baf7c48 100644
--- a/src/runtime/internal/sys/zgoos_android.go
+++ b/src/runtime/internal/sys/zgoos_android.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build android
// +build android
package sys
diff --git a/src/runtime/internal/sys/zgoos_darwin.go b/src/runtime/internal/sys/zgoos_darwin.go
index 6aa2db7e3a..3c7f7b543e 100644
--- a/src/runtime/internal/sys/zgoos_darwin.go
+++ b/src/runtime/internal/sys/zgoos_darwin.go
@@ -1,7 +1,7 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
-// +build !ios
-// +build darwin
+//go:build !ios && darwin
+// +build !ios,darwin
package sys
diff --git a/src/runtime/internal/sys/zgoos_dragonfly.go b/src/runtime/internal/sys/zgoos_dragonfly.go
index 88ee1174f1..f844d29e2a 100644
--- a/src/runtime/internal/sys/zgoos_dragonfly.go
+++ b/src/runtime/internal/sys/zgoos_dragonfly.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build dragonfly
// +build dragonfly
package sys
diff --git a/src/runtime/internal/sys/zgoos_freebsd.go b/src/runtime/internal/sys/zgoos_freebsd.go
index 8de2ec0559..8999a2797a 100644
--- a/src/runtime/internal/sys/zgoos_freebsd.go
+++ b/src/runtime/internal/sys/zgoos_freebsd.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build freebsd
// +build freebsd
package sys
diff --git a/src/runtime/internal/sys/zgoos_hurd.go b/src/runtime/internal/sys/zgoos_hurd.go
index 183ccb02a1..a546488bf8 100644
--- a/src/runtime/internal/sys/zgoos_hurd.go
+++ b/src/runtime/internal/sys/zgoos_hurd.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build hurd
// +build hurd
package sys
diff --git a/src/runtime/internal/sys/zgoos_illumos.go b/src/runtime/internal/sys/zgoos_illumos.go
index d04134e1df..02a4ca06e8 100644
--- a/src/runtime/internal/sys/zgoos_illumos.go
+++ b/src/runtime/internal/sys/zgoos_illumos.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build illumos
// +build illumos
package sys
diff --git a/src/runtime/internal/sys/zgoos_ios.go b/src/runtime/internal/sys/zgoos_ios.go
index cf6e9d61f0..033eec623d 100644
--- a/src/runtime/internal/sys/zgoos_ios.go
+++ b/src/runtime/internal/sys/zgoos_ios.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build ios
// +build ios
package sys
diff --git a/src/runtime/internal/sys/zgoos_js.go b/src/runtime/internal/sys/zgoos_js.go
index 1d9279ab38..28226ad60a 100644
--- a/src/runtime/internal/sys/zgoos_js.go
+++ b/src/runtime/internal/sys/zgoos_js.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build js
// +build js
package sys
diff --git a/src/runtime/internal/sys/zgoos_linux.go b/src/runtime/internal/sys/zgoos_linux.go
index 0f718d704f..01546e4b9f 100644
--- a/src/runtime/internal/sys/zgoos_linux.go
+++ b/src/runtime/internal/sys/zgoos_linux.go
@@ -1,7 +1,7 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
-// +build !android
-// +build linux
+//go:build !android && linux
+// +build !android,linux
package sys
diff --git a/src/runtime/internal/sys/zgoos_netbsd.go b/src/runtime/internal/sys/zgoos_netbsd.go
index 2ae149ff13..9d658b20ee 100644
--- a/src/runtime/internal/sys/zgoos_netbsd.go
+++ b/src/runtime/internal/sys/zgoos_netbsd.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build netbsd
// +build netbsd
package sys
diff --git a/src/runtime/internal/sys/zgoos_openbsd.go b/src/runtime/internal/sys/zgoos_openbsd.go
index 7d4d61e4ca..0f55454a95 100644
--- a/src/runtime/internal/sys/zgoos_openbsd.go
+++ b/src/runtime/internal/sys/zgoos_openbsd.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build openbsd
// +build openbsd
package sys
diff --git a/src/runtime/internal/sys/zgoos_plan9.go b/src/runtime/internal/sys/zgoos_plan9.go
index 30aec46df3..d0347464d6 100644
--- a/src/runtime/internal/sys/zgoos_plan9.go
+++ b/src/runtime/internal/sys/zgoos_plan9.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build plan9
// +build plan9
package sys
diff --git a/src/runtime/internal/sys/zgoos_solaris.go b/src/runtime/internal/sys/zgoos_solaris.go
index 4bb8c99bce..05c3007e2c 100644
--- a/src/runtime/internal/sys/zgoos_solaris.go
+++ b/src/runtime/internal/sys/zgoos_solaris.go
@@ -1,7 +1,7 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
-// +build !illumos
-// +build solaris
+//go:build !illumos && solaris
+// +build !illumos,solaris
package sys
diff --git a/src/runtime/internal/sys/zgoos_windows.go b/src/runtime/internal/sys/zgoos_windows.go
index d1f4290204..7d07fa3a45 100644
--- a/src/runtime/internal/sys/zgoos_windows.go
+++ b/src/runtime/internal/sys/zgoos_windows.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build windows
// +build windows
package sys
diff --git a/src/runtime/internal/sys/zgoos_zos.go b/src/runtime/internal/sys/zgoos_zos.go
index d22be46fc0..d6e5b9b0cb 100644
--- a/src/runtime/internal/sys/zgoos_zos.go
+++ b/src/runtime/internal/sys/zgoos_zos.go
@@ -1,5 +1,6 @@
// Code generated by gengoos.go using 'go generate'. DO NOT EDIT.
+//go:build zos
// +build zos
package sys
diff --git a/src/runtime/lfstack_32bit.go b/src/runtime/lfstack_32bit.go
index f07ff1c06b..c00f0965bd 100644
--- a/src/runtime/lfstack_32bit.go
+++ b/src/runtime/lfstack_32bit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || arm || mips || mipsle
// +build 386 arm mips mipsle
package runtime
diff --git a/src/runtime/lfstack_64bit.go b/src/runtime/lfstack_64bit.go
index 9d821b989e..4812dd1156 100644
--- a/src/runtime/lfstack_64bit.go
+++ b/src/runtime/lfstack_64bit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm
// +build amd64 arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x wasm
package runtime
diff --git a/src/runtime/libfuzzer.go b/src/runtime/libfuzzer.go
index 0161955f09..578bce0414 100644
--- a/src/runtime/libfuzzer.go
+++ b/src/runtime/libfuzzer.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build libfuzzer
// +build libfuzzer
package runtime
diff --git a/src/runtime/lock_futex.go b/src/runtime/lock_futex.go
index 91467fdfae..017b481c64 100644
--- a/src/runtime/lock_futex.go
+++ b/src/runtime/lock_futex.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux
// +build dragonfly freebsd linux
package runtime
diff --git a/src/runtime/lock_js.go b/src/runtime/lock_js.go
index 14bdc76842..04e7e85c12 100644
--- a/src/runtime/lock_js.go
+++ b/src/runtime/lock_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package runtime
diff --git a/src/runtime/lock_sema.go b/src/runtime/lock_sema.go
index 671e524e45..3c0a7ca67e 100644
--- a/src/runtime/lock_sema.go
+++ b/src/runtime/lock_sema.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || netbsd || openbsd || plan9 || solaris || windows
// +build aix darwin netbsd openbsd plan9 solaris windows
package runtime
diff --git a/src/runtime/lockrank_off.go b/src/runtime/lockrank_off.go
index 7dcd8f5fe9..f3d2c00914 100644
--- a/src/runtime/lockrank_off.go
+++ b/src/runtime/lockrank_off.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !goexperiment.staticlockranking
// +build !goexperiment.staticlockranking
package runtime
diff --git a/src/runtime/lockrank_on.go b/src/runtime/lockrank_on.go
index 88ac95a004..7d45debaca 100644
--- a/src/runtime/lockrank_on.go
+++ b/src/runtime/lockrank_on.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build goexperiment.staticlockranking
// +build goexperiment.staticlockranking
package runtime
@@ -219,7 +220,7 @@ func releaseLockRank(rank lockRank) {
func lockWithRankMayAcquire(l *mutex, rank lockRank) {
gp := getg()
if gp.m.locksHeldLen == 0 {
- // No possibilty of lock ordering problem if no other locks held
+ // No possibility of lock ordering problem if no other locks held
return
}
diff --git a/src/runtime/mbarrier.go b/src/runtime/mbarrier.go
index 2b5affce52..4994347bde 100644
--- a/src/runtime/mbarrier.go
+++ b/src/runtime/mbarrier.go
@@ -14,6 +14,7 @@
package runtime
import (
+ "internal/abi"
"runtime/internal/sys"
"unsafe"
)
@@ -223,11 +224,18 @@ func reflect_typedmemmovepartial(typ *_type, dst, src unsafe.Pointer, off, size
// stack map of reflectcall is wrong.
//
//go:nosplit
-func reflectcallmove(typ *_type, dst, src unsafe.Pointer, size uintptr) {
+func reflectcallmove(typ *_type, dst, src unsafe.Pointer, size uintptr, regs *abi.RegArgs) {
if writeBarrier.needed && typ != nil && typ.ptrdata != 0 && size >= sys.PtrSize {
bulkBarrierPreWrite(uintptr(dst), uintptr(src), size)
}
memmove(dst, src, size)
+
+ // Move pointers returned in registers to a place where the GC can see them.
+ for i := range regs.Ints {
+ if regs.ReturnIsPtr.Get(i) {
+ regs.Ptrs[i] = unsafe.Pointer(regs.Ints[i])
+ }
+ }
}
//go:nosplit
diff --git a/src/runtime/mem_bsd.go b/src/runtime/mem_bsd.go
index bc672019fb..dcbb9a1d51 100644
--- a/src/runtime/mem_bsd.go
+++ b/src/runtime/mem_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || netbsd || openbsd || solaris
// +build dragonfly freebsd netbsd openbsd solaris
package runtime
diff --git a/src/runtime/mem_js.go b/src/runtime/mem_js.go
index 957ed36ffa..fe940360c0 100644
--- a/src/runtime/mem_js.go
+++ b/src/runtime/mem_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package runtime
diff --git a/src/runtime/memclr_arm.s b/src/runtime/memclr_arm.s
index f113a1aa2d..f02d058ead 100644
--- a/src/runtime/memclr_arm.s
+++ b/src/runtime/memclr_arm.s
@@ -33,6 +33,7 @@
// See memclrNoHeapPointers Go doc for important implementation constraints.
// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
+// Also called from assembly in sys_windows_arm.s without g (but using Go stack convention).
TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-8
MOVW ptr+0(FP), TO
MOVW n+4(FP), N
diff --git a/src/runtime/memclr_arm64.s b/src/runtime/memclr_arm64.s
index bef77651e4..c1a0dcef58 100644
--- a/src/runtime/memclr_arm64.s
+++ b/src/runtime/memclr_arm64.s
@@ -7,6 +7,7 @@
// See memclrNoHeapPointers Go doc for important implementation constraints.
// func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
+// Also called from assembly in sys_windows_arm64.s without g (but using Go stack convention).
TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16
MOVD ptr+0(FP), R0
MOVD n+8(FP), R1
diff --git a/src/runtime/metrics.go b/src/runtime/metrics.go
index 3e8dbda0ca..ce3bac9d8f 100644
--- a/src/runtime/metrics.go
+++ b/src/runtime/metrics.go
@@ -481,7 +481,7 @@ func readMetrics(samplesp unsafe.Pointer, len int, cap int) {
// Acquire the metricsSema but with handoff. This operation
// is expensive enough that queueing up goroutines and handing
- // off between them will be noticably better-behaved.
+ // off between them will be noticeably better-behaved.
semacquire1(&metricsSema, true, 0, 0)
// Ensure the map is initialized.
diff --git a/src/runtime/metrics/doc.go b/src/runtime/metrics/doc.go
index 021a0bddca..7f790afc12 100644
--- a/src/runtime/metrics/doc.go
+++ b/src/runtime/metrics/doc.go
@@ -16,13 +16,12 @@ Interface
Metrics are designated by a string key, rather than, for example, a field name in
a struct. The full list of supported metrics is always available in the slice of
Descriptions returned by All. Each Description also includes useful information
-about the metric, such as how to display it (e.g. gauge vs. counter) and how difficult
-or disruptive it is to obtain it (e.g. do you need to stop the world?).
+about the metric.
Thus, users of this API are encouraged to sample supported metrics defined by the
slice returned by All to remain compatible across Go versions. Of course, situations
arise where reading specific metrics is critical. For these cases, users are
-encouranged to use build tags, and although metrics may be deprecated and removed,
+encouraged to use build tags, and although metrics may be deprecated and removed,
users should consider this to be an exceptional and rare event, coinciding with a
very large change in a particular Go implementation.
diff --git a/src/runtime/metrics/example_test.go b/src/runtime/metrics/example_test.go
index cade0c38bf..624d9d8a6b 100644
--- a/src/runtime/metrics/example_test.go
+++ b/src/runtime/metrics/example_test.go
@@ -88,7 +88,7 @@ func medianBucket(h *metrics.Float64Histogram) float64 {
total = 0
for i, count := range h.Counts {
total += count
- if total > thresh {
+ if total >= thresh {
return h.Buckets[i]
}
}
diff --git a/src/runtime/metrics/sample.go b/src/runtime/metrics/sample.go
index 35534dd70d..4cf8cdf799 100644
--- a/src/runtime/metrics/sample.go
+++ b/src/runtime/metrics/sample.go
@@ -14,7 +14,7 @@ type Sample struct {
// Name is the name of the metric sampled.
//
// It must correspond to a name in one of the metric descriptions
- // returned by Descriptions.
+ // returned by All.
Name string
// Value is the value of the metric sample.
@@ -32,9 +32,9 @@ func runtime_readMetrics(unsafe.Pointer, int, int)
//
// Note that re-use has some caveats. Notably, Values should not be read or
// manipulated while a Read with that value is outstanding; that is a data race.
-// This property includes pointer-typed Values (e.g. Float64Histogram) whose
-// underlying storage will be reused by Read when possible. To safely use such
-// values in a concurrent setting, all data must be deep-copied.
+// This property includes pointer-typed Values (for example, Float64Histogram)
+// whose underlying storage will be reused by Read when possible. To safely use
+// such values in a concurrent setting, all data must be deep-copied.
//
// It is safe to execute multiple Read calls concurrently, but their arguments
// must share no underlying memory. When in doubt, create a new []Sample from
diff --git a/src/runtime/metrics/value.go b/src/runtime/metrics/value.go
index 61e8a192a3..ed9a33d87c 100644
--- a/src/runtime/metrics/value.go
+++ b/src/runtime/metrics/value.go
@@ -33,7 +33,7 @@ type Value struct {
pointer unsafe.Pointer // contains non-scalar values.
}
-// Kind returns the a tag representing the kind of value this is.
+// Kind returns the tag representing the kind of value this is.
func (v Value) Kind() ValueKind {
return v.kind
}
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go
index f4dbd77252..e92ec80e3c 100644
--- a/src/runtime/mfinal.go
+++ b/src/runtime/mfinal.go
@@ -7,6 +7,7 @@
package runtime
import (
+ "internal/abi"
"runtime/internal/atomic"
"runtime/internal/sys"
"unsafe"
@@ -213,13 +214,17 @@ func runfinq() {
if len(ityp.mhdr) != 0 {
// convert to interface with methods
// this conversion is guaranteed to succeed - we checked in SetFinalizer
- *(*iface)(frame) = assertE2I(ityp, *(*eface)(frame))
+ (*iface)(frame).tab = assertE2I(ityp, (*eface)(frame)._type)
}
default:
throw("bad kind in runfinq")
}
fingRunning = true
- reflectcall(nil, unsafe.Pointer(f.fn), frame, uint32(framesz), uint32(framesz))
+ // Pass a dummy RegArgs for now.
+ //
+ // TODO(mknyszek): Pass arguments in registers.
+ var regs abi.RegArgs
+ reflectcall(nil, unsafe.Pointer(f.fn), frame, uint32(framesz), uint32(framesz), uint32(framesz), &regs)
fingRunning = false
// Drop finalizer queue heap references
@@ -398,7 +403,7 @@ func SetFinalizer(obj interface{}, finalizer interface{}) {
// ok - satisfies empty interface
goto okarg
}
- if _, ok := assertE2I2(ityp, *efaceOf(&obj)); ok {
+ if iface := assertE2I2(ityp, *efaceOf(&obj)); iface.tab != nil {
goto okarg
}
}
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go
index 185d3201ca..7c7239beb8 100644
--- a/src/runtime/mgc.go
+++ b/src/runtime/mgc.go
@@ -302,9 +302,11 @@ const (
// gcMarkWorkerFractionalMode indicates that a P is currently
// running the "fractional" mark worker. The fractional worker
// is necessary when GOMAXPROCS*gcBackgroundUtilization is not
- // an integer. The fractional worker should run until it is
- // preempted and will be scheduled to pick up the fractional
- // part of GOMAXPROCS*gcBackgroundUtilization.
+ // an integer and using only dedicated workers would result in
+ // utilization too far from the target of gcBackgroundUtilization.
+ // The fractional worker should run until it is preempted and
+ // will be scheduled to pick up the fractional part of
+ // GOMAXPROCS*gcBackgroundUtilization.
gcMarkWorkerFractionalMode
// gcMarkWorkerIdleMode indicates that a P is running the mark
diff --git a/src/runtime/mgcscavenge.go b/src/runtime/mgcscavenge.go
index a7c5bc49b8..46a40632bf 100644
--- a/src/runtime/mgcscavenge.go
+++ b/src/runtime/mgcscavenge.go
@@ -207,7 +207,7 @@ func wakeScavenger() {
// Ready the goroutine by injecting it. We use injectglist instead
// of ready or goready in order to allow us to run this function
// without a P. injectglist also avoids placing the goroutine in
- // the current P's runnext slot, which is desireable to prevent
+ // the current P's runnext slot, which is desirable to prevent
// the scavenger from interfering with user goroutine scheduling
// too much.
var list gList
diff --git a/src/runtime/mkduff.go b/src/runtime/mkduff.go
index 94ae75fbfe..8632fe08a3 100644
--- a/src/runtime/mkduff.go
+++ b/src/runtime/mkduff.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// runtime·duffzero is a Duff's device for zeroing memory.
@@ -62,15 +63,15 @@ func gen(arch string, tags, zero, copy func(io.Writer)) {
func notags(w io.Writer) { fmt.Fprintln(w) }
func zeroAMD64(w io.Writer) {
- // X0: zero
+ // X15: zero
// DI: ptr to memory to be zeroed
// DI is updated as a side effect.
- fmt.Fprintln(w, "TEXT runtime·duffzero(SB), NOSPLIT, $0-0")
+ fmt.Fprintln(w, "TEXT runtime·duffzero<ABIInternal>(SB), NOSPLIT, $0-0")
for i := 0; i < 16; i++ {
- fmt.Fprintln(w, "\tMOVUPS\tX0,(DI)")
- fmt.Fprintln(w, "\tMOVUPS\tX0,16(DI)")
- fmt.Fprintln(w, "\tMOVUPS\tX0,32(DI)")
- fmt.Fprintln(w, "\tMOVUPS\tX0,48(DI)")
+ fmt.Fprintln(w, "\tMOVUPS\tX15,(DI)")
+ fmt.Fprintln(w, "\tMOVUPS\tX15,16(DI)")
+ fmt.Fprintln(w, "\tMOVUPS\tX15,32(DI)")
+ fmt.Fprintln(w, "\tMOVUPS\tX15,48(DI)")
fmt.Fprintln(w, "\tLEAQ\t64(DI),DI") // We use lea instead of add, to avoid clobbering flags
fmt.Fprintln(w)
}
@@ -84,7 +85,7 @@ func copyAMD64(w io.Writer) {
//
// This is equivalent to a sequence of MOVSQ but
// for some reason that is 3.5x slower than this code.
- fmt.Fprintln(w, "TEXT runtime·duffcopy(SB), NOSPLIT, $0-0")
+ fmt.Fprintln(w, "TEXT runtime·duffcopy<ABIInternal>(SB), NOSPLIT, $0-0")
for i := 0; i < 64; i++ {
fmt.Fprintln(w, "\tMOVUPS\t(SI), X0")
fmt.Fprintln(w, "\tADDQ\t$16, SI")
diff --git a/src/runtime/mkfastlog2table.go b/src/runtime/mkfastlog2table.go
index d650292394..8d78a3923a 100644
--- a/src/runtime/mkfastlog2table.go
+++ b/src/runtime/mkfastlog2table.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// fastlog2Table contains log2 approximations for 5 binary digits.
diff --git a/src/runtime/mkpreempt.go b/src/runtime/mkpreempt.go
index 1d614dd003..3a9e6cc478 100644
--- a/src/runtime/mkpreempt.go
+++ b/src/runtime/mkpreempt.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// mkpreempt generates the asyncPreempt functions for each
@@ -229,12 +230,16 @@ func genAMD64() {
if reg == "SP" || reg == "BP" {
continue
}
- if strings.HasPrefix(reg, "X") {
- l.add("MOVUPS", reg, 16)
- } else {
+ if !strings.HasPrefix(reg, "X") {
l.add("MOVQ", reg, 8)
}
}
+ lSSE := layout{stack: l.stack, sp: "SP"}
+ for _, reg := range regNamesAMD64 {
+ if strings.HasPrefix(reg, "X") {
+ lSSE.add("MOVUPS", reg, 16)
+ }
+ }
// TODO: MXCSR register?
@@ -243,10 +248,12 @@ func genAMD64() {
p("// Save flags before clobbering them")
p("PUSHFQ")
p("// obj doesn't understand ADD/SUB on SP, but does understand ADJSP")
- p("ADJSP $%d", l.stack)
+ p("ADJSP $%d", lSSE.stack)
p("// But vet doesn't know ADJSP, so suppress vet stack checking")
p("NOP SP")
+ l.save()
+
// Apparently, the signal handling code path in darwin kernel leaves
// the upper bits of Y registers in a dirty state, which causes
// many SSE operations (128-bit and narrower) become much slower.
@@ -258,10 +265,11 @@ func genAMD64() {
p("VZEROUPPER")
p("#endif")
- l.save()
+ lSSE.save()
p("CALL ·asyncPreempt2(SB)")
+ lSSE.restore()
l.restore()
- p("ADJSP $%d", -l.stack)
+ p("ADJSP $%d", -lSSE.stack)
p("POPFQ")
p("POPQ BP")
p("RET")
diff --git a/src/runtime/mksizeclasses.go b/src/runtime/mksizeclasses.go
index b92d1fed5f..b4a117d343 100644
--- a/src/runtime/mksizeclasses.go
+++ b/src/runtime/mksizeclasses.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generate tables for small malloc size classes.
diff --git a/src/runtime/mmap.go b/src/runtime/mmap.go
index 1b1848b79e..7460eb3104 100644
--- a/src/runtime/mmap.go
+++ b/src/runtime/mmap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !aix && !darwin && !js && (!linux || !amd64) && (!linux || !arm64) && !openbsd && !plan9 && !solaris && !windows
// +build !aix
// +build !darwin
// +build !js
diff --git a/src/runtime/mpagealloc_32bit.go b/src/runtime/mpagealloc_32bit.go
index 331dadade9..fceb4e7a18 100644
--- a/src/runtime/mpagealloc_32bit.go
+++ b/src/runtime/mpagealloc_32bit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || arm || mips || mipsle || wasm || (ios && arm64)
// +build 386 arm mips mipsle wasm ios,arm64
// wasm is a treated as a 32-bit architecture for the purposes of the page
diff --git a/src/runtime/mpagealloc_64bit.go b/src/runtime/mpagealloc_64bit.go
index ffacb46c18..16577346a7 100644
--- a/src/runtime/mpagealloc_64bit.go
+++ b/src/runtime/mpagealloc_64bit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || (!ios && arm64) || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x
// +build amd64 !ios,arm64 mips64 mips64le ppc64 ppc64le riscv64 s390x
// See mpagealloc_32bit.go for why ios/arm64 is excluded here.
diff --git a/src/runtime/msan.go b/src/runtime/msan.go
index 6a5960b0a8..25aaf94e26 100644
--- a/src/runtime/msan.go
+++ b/src/runtime/msan.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build msan
// +build msan
package runtime
diff --git a/src/runtime/msan0.go b/src/runtime/msan0.go
index 374d13f30b..b1096a6750 100644
--- a/src/runtime/msan0.go
+++ b/src/runtime/msan0.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !msan
// +build !msan
// Dummy MSan support API, used when not built with -msan.
diff --git a/src/runtime/nbpipe_fcntl_libc_test.go b/src/runtime/nbpipe_fcntl_libc_test.go
index b38c58399b..076a722eb7 100644
--- a/src/runtime/nbpipe_fcntl_libc_test.go
+++ b/src/runtime/nbpipe_fcntl_libc_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || solaris
// +build aix darwin solaris
package runtime_test
diff --git a/src/runtime/nbpipe_fcntl_unix_test.go b/src/runtime/nbpipe_fcntl_unix_test.go
index 75acdb62dd..6d5e4ff021 100644
--- a/src/runtime/nbpipe_fcntl_unix_test.go
+++ b/src/runtime/nbpipe_fcntl_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package runtime_test
diff --git a/src/runtime/nbpipe_pipe.go b/src/runtime/nbpipe_pipe.go
index 822b2944db..b17257e9ec 100644
--- a/src/runtime/nbpipe_pipe.go
+++ b/src/runtime/nbpipe_pipe.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build aix darwin dragonfly
+//go:build aix || darwin
+// +build aix darwin
package runtime
diff --git a/src/runtime/nbpipe_pipe2.go b/src/runtime/nbpipe_pipe2.go
index e3639d99b1..f22b2b591f 100644
--- a/src/runtime/nbpipe_pipe2.go
+++ b/src/runtime/nbpipe_pipe2.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build freebsd linux netbsd openbsd solaris
+//go:build dragonfly || freebsd || linux || netbsd || openbsd || solaris
+// +build dragonfly freebsd linux netbsd openbsd solaris
package runtime
diff --git a/src/runtime/nbpipe_test.go b/src/runtime/nbpipe_test.go
index d739f57864..1d6a9b525c 100644
--- a/src/runtime/nbpipe_test.go
+++ b/src/runtime/nbpipe_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package runtime_test
diff --git a/src/runtime/netpoll.go b/src/runtime/netpoll.go
index 77eb3aa4c6..202aef593f 100644
--- a/src/runtime/netpoll.go
+++ b/src/runtime/netpoll.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || windows
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows
package runtime
@@ -161,9 +162,12 @@ func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
pd.self = pd
unlock(&pd.lock)
- var errno int32
- errno = netpollopen(fd, pd)
- return pd, int(errno)
+ errno := netpollopen(fd, pd)
+ if errno != 0 {
+ pollcache.free(pd)
+ return nil, int(errno)
+ }
+ return pd, 0
}
//go:linkname poll_runtime_pollClose internal/poll.runtime_pollClose
diff --git a/src/runtime/netpoll_epoll.go b/src/runtime/netpoll_epoll.go
index 58f4fa8754..371ac59f8e 100644
--- a/src/runtime/netpoll_epoll.go
+++ b/src/runtime/netpoll_epoll.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package runtime
diff --git a/src/runtime/netpoll_fake.go b/src/runtime/netpoll_fake.go
index b2af3b89b2..8366f28914 100644
--- a/src/runtime/netpoll_fake.go
+++ b/src/runtime/netpoll_fake.go
@@ -5,6 +5,7 @@
// Fake network poller for wasm/js.
// Should never be used, because wasm/js network connections do not honor "SetNonblock".
+//go:build js && wasm
// +build js,wasm
package runtime
diff --git a/src/runtime/netpoll_kqueue.go b/src/runtime/netpoll_kqueue.go
index 3bd93c1f20..80d1b0cf18 100644
--- a/src/runtime/netpoll_kqueue.go
+++ b/src/runtime/netpoll_kqueue.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package runtime
diff --git a/src/runtime/netpoll_stub.go b/src/runtime/netpoll_stub.go
index 3599f2d01b..33ab8eba58 100644
--- a/src/runtime/netpoll_stub.go
+++ b/src/runtime/netpoll_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package runtime
diff --git a/src/runtime/norace_linux_test.go b/src/runtime/norace_linux_test.go
index 3517a5ddbe..94b7c7a467 100644
--- a/src/runtime/norace_linux_test.go
+++ b/src/runtime/norace_linux_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// The file contains tests that cannot run under race detector for some reason.
+//go:build !race
// +build !race
package runtime_test
diff --git a/src/runtime/norace_test.go b/src/runtime/norace_test.go
index e90128bb6d..9ad5dde382 100644
--- a/src/runtime/norace_test.go
+++ b/src/runtime/norace_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// The file contains tests that cannot run under race detector for some reason.
+//go:build !race
// +build !race
package runtime_test
diff --git a/src/runtime/os2_aix.go b/src/runtime/os2_aix.go
index abd1010be9..4d77f0de6d 100644
--- a/src/runtime/os2_aix.go
+++ b/src/runtime/os2_aix.go
@@ -527,20 +527,17 @@ func internal_cpu_getsystemcfg(label uint) uint {
func usleep1(us uint32)
//go:nosplit
-func usleep(us uint32) {
- _g_ := getg()
+func usleep_no_g(us uint32) {
+ usleep1(us)
+}
- // Check the validity of m because we might be called in cgo callback
- // path early enough where there isn't a g or a m available yet.
- if _g_ != nil && _g_.m != nil {
- r, err := syscall1(&libc_usleep, uintptr(us))
- if int32(r) == -1 {
- println("syscall usleep failed: ", hex(err))
- throw("syscall usleep")
- }
- return
+//go:nosplit
+func usleep(us uint32) {
+ r, err := syscall1(&libc_usleep, uintptr(us))
+ if int32(r) == -1 {
+ println("syscall usleep failed: ", hex(err))
+ throw("syscall usleep")
}
- usleep1(us)
}
//go:nosplit
@@ -611,20 +608,17 @@ func raiseproc(sig uint32) {
func osyield1()
//go:nosplit
-func osyield() {
- _g_ := getg()
+func osyield_no_g() {
+ osyield1()
+}
- // Check the validity of m because it might be called during a cgo
- // callback early enough where m isn't available yet.
- if _g_ != nil && _g_.m != nil {
- r, err := syscall0(&libc_sched_yield)
- if int32(r) == -1 {
- println("syscall osyield failed: ", hex(err))
- throw("syscall osyield")
- }
- return
+//go:nosplit
+func osyield() {
+ r, err := syscall0(&libc_sched_yield)
+ if int32(r) == -1 {
+ println("syscall osyield failed: ", hex(err))
+ throw("syscall osyield")
}
- osyield1()
}
//go:nosplit
diff --git a/src/runtime/os3_plan9.go b/src/runtime/os3_plan9.go
index 15ca3359d2..b6ee98cab6 100644
--- a/src/runtime/os3_plan9.go
+++ b/src/runtime/os3_plan9.go
@@ -92,10 +92,6 @@ func sighandler(_ureg *ureg, note *byte, gp *g) int {
if usesLR {
c.setlr(pc)
} else {
- if sys.RegSize > sys.PtrSize {
- sp -= sys.PtrSize
- *(*uintptr)(unsafe.Pointer(sp)) = 0
- }
sp -= sys.PtrSize
*(*uintptr)(unsafe.Pointer(sp)) = pc
c.setsp(sp)
diff --git a/src/runtime/os3_solaris.go b/src/runtime/os3_solaris.go
index 6ba11afd93..4b65139eb8 100644
--- a/src/runtime/os3_solaris.go
+++ b/src/runtime/os3_solaris.go
@@ -522,6 +522,11 @@ func sysconf(name int32) int64 {
func usleep1(usec uint32)
//go:nosplit
+func usleep_no_g(µs uint32) {
+ usleep1(µs)
+}
+
+//go:nosplit
func usleep(µs uint32) {
usleep1(µs)
}
@@ -569,18 +574,15 @@ func setNonblock(fd int32) {
func osyield1()
//go:nosplit
-func osyield() {
- _g_ := getg()
-
- // Check the validity of m because we might be called in cgo callback
- // path early enough where there isn't a m available yet.
- if _g_ != nil && _g_.m != nil {
- sysvicall0(&libc_sched_yield)
- return
- }
+func osyield_no_g() {
osyield1()
}
+//go:nosplit
+func osyield() {
+ sysvicall0(&libc_sched_yield)
+}
+
//go:linkname executablePath os.executablePath
var executablePath string
diff --git a/src/runtime/os_aix.go b/src/runtime/os_aix.go
index 303f0876de..557b17cc75 100644
--- a/src/runtime/os_aix.go
+++ b/src/runtime/os_aix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix
// +build aix
package runtime
diff --git a/src/runtime/os_darwin.go b/src/runtime/os_darwin.go
index 9ca17c20df..470698d0a3 100644
--- a/src/runtime/os_darwin.go
+++ b/src/runtime/os_darwin.go
@@ -331,6 +331,11 @@ func mdestroy(mp *m) {
}
//go:nosplit
+func osyield_no_g() {
+ usleep_no_g(1)
+}
+
+//go:nosplit
func osyield() {
usleep(1)
}
diff --git a/src/runtime/os_dragonfly.go b/src/runtime/os_dragonfly.go
index 383df54bd4..5c688a3109 100644
--- a/src/runtime/os_dragonfly.go
+++ b/src/runtime/os_dragonfly.go
@@ -51,16 +51,20 @@ func sys_umtx_wakeup(addr *uint32, val int32) int32
func osyield()
+//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
+
func kqueue() int32
//go:noescape
func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32
-func closeonexec(fd int32)
-func setNonblock(fd int32)
func pipe() (r, w int32, errno int32)
-
-const stackSystem = 0
+func pipe2(flags int32) (r, w int32, errno int32)
+func closeonexec(fd int32)
+func setNonblock(fd int32)
// From DragonFly's <sys/sysctl.h>
const (
diff --git a/src/runtime/os_freebsd.go b/src/runtime/os_freebsd.go
index 09065ccb68..09dd50ce59 100644
--- a/src/runtime/os_freebsd.go
+++ b/src/runtime/os_freebsd.go
@@ -36,6 +36,11 @@ func sys_umtx_op(addr *uint32, mode int32, val uint32, uaddr1 uintptr, ut *umtx_
func osyield()
+//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
+
func kqueue() int32
//go:noescape
diff --git a/src/runtime/os_freebsd2.go b/src/runtime/os_freebsd2.go
index 6947a05d04..fde6fbf1b1 100644
--- a/src/runtime/os_freebsd2.go
+++ b/src/runtime/os_freebsd2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd && !amd64
// +build freebsd,!amd64
package runtime
diff --git a/src/runtime/os_freebsd_noauxv.go b/src/runtime/os_freebsd_noauxv.go
index 01efb9b7c9..8fe0cb6718 100644
--- a/src/runtime/os_freebsd_noauxv.go
+++ b/src/runtime/os_freebsd_noauxv.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build freebsd
-// +build !arm
+//go:build freebsd && !arm
+// +build freebsd,!arm
package runtime
diff --git a/src/runtime/os_js.go b/src/runtime/os_js.go
index 24261e88a2..52b64e7602 100644
--- a/src/runtime/os_js.go
+++ b/src/runtime/os_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package runtime
@@ -30,12 +31,22 @@ func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)
func usleep(usec uint32)
+//go:nosplit
+func usleep_no_g(usec uint32) {
+ usleep(usec)
+}
+
func exitThread(wait *uint32)
type mOS struct{}
func osyield()
+//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
+
const _SIGSEGV = 0xb
func sigpanic() {
diff --git a/src/runtime/os_linux.go b/src/runtime/os_linux.go
index 058c7daf9c..21d3ae653e 100644
--- a/src/runtime/os_linux.go
+++ b/src/runtime/os_linux.go
@@ -410,6 +410,11 @@ func raiseproc(sig uint32)
func sched_getaffinity(pid, len uintptr, buf *byte) int32
func osyield()
+//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
+
func pipe() (r, w int32, errno int32)
func pipe2(flags int32) (r, w int32, errno int32)
func setNonblock(fd int32)
diff --git a/src/runtime/os_linux_arm64.go b/src/runtime/os_linux_arm64.go
index c5fd742048..5260f22f57 100644
--- a/src/runtime/os_linux_arm64.go
+++ b/src/runtime/os_linux_arm64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build arm64
// +build arm64
package runtime
diff --git a/src/runtime/os_linux_be64.go b/src/runtime/os_linux_be64.go
index 9860002ee4..806d02fee8 100644
--- a/src/runtime/os_linux_be64.go
+++ b/src/runtime/os_linux_be64.go
@@ -4,6 +4,7 @@
// The standard GNU/Linux sigset type on big-endian 64-bit machines.
+//go:build linux && (ppc64 || s390x)
// +build linux
// +build ppc64 s390x
diff --git a/src/runtime/os_linux_generic.go b/src/runtime/os_linux_generic.go
index e1d0952ddf..fe1973dbde 100644
--- a/src/runtime/os_linux_generic.go
+++ b/src/runtime/os_linux_generic.go
@@ -2,13 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !mips
-// +build !mipsle
-// +build !mips64
-// +build !mips64le
-// +build !s390x
-// +build !ppc64
-// +build linux
+//go:build !mips && !mipsle && !mips64 && !mips64le && !s390x && !ppc64 && linux
+// +build !mips,!mipsle,!mips64,!mips64le,!s390x,!ppc64,linux
package runtime
diff --git a/src/runtime/os_linux_mips64x.go b/src/runtime/os_linux_mips64x.go
index 815a83a04b..bd76442dbd 100644
--- a/src/runtime/os_linux_mips64x.go
+++ b/src/runtime/os_linux_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips64 || mips64le)
// +build linux
// +build mips64 mips64le
diff --git a/src/runtime/os_linux_mipsx.go b/src/runtime/os_linux_mipsx.go
index 00fb02e4bf..ef8b3f7d43 100644
--- a/src/runtime/os_linux_mipsx.go
+++ b/src/runtime/os_linux_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips || mipsle)
// +build linux
// +build mips mipsle
diff --git a/src/runtime/os_linux_noauxv.go b/src/runtime/os_linux_noauxv.go
index 895b4cd5f4..59b5aacaeb 100644
--- a/src/runtime/os_linux_noauxv.go
+++ b/src/runtime/os_linux_noauxv.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux
-// +build !arm,!arm64,!mips,!mipsle,!mips64,!mips64le,!s390x,!ppc64,!ppc64le
+//go:build linux && !arm && !arm64 && !mips && !mipsle && !mips64 && !mips64le && !s390x && !ppc64 && !ppc64le
+// +build linux,!arm,!arm64,!mips,!mipsle,!mips64,!mips64le,!s390x,!ppc64,!ppc64le
package runtime
diff --git a/src/runtime/os_linux_novdso.go b/src/runtime/os_linux_novdso.go
index 155f415e71..8104f63627 100644
--- a/src/runtime/os_linux_novdso.go
+++ b/src/runtime/os_linux_novdso.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux
-// +build !386,!amd64,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le
+//go:build linux && !386 && !amd64 && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le
+// +build linux,!386,!amd64,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le
package runtime
diff --git a/src/runtime/os_linux_ppc64x.go b/src/runtime/os_linux_ppc64x.go
index 3aedc23ef9..c093d2ec0f 100644
--- a/src/runtime/os_linux_ppc64x.go
+++ b/src/runtime/os_linux_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le
diff --git a/src/runtime/os_linux_x86.go b/src/runtime/os_linux_x86.go
index d91fa1a0d1..5667774d82 100644
--- a/src/runtime/os_linux_x86.go
+++ b/src/runtime/os_linux_x86.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (386 || amd64)
// +build linux
// +build 386 amd64
diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go
index 2b742a3711..0328fa57ae 100644
--- a/src/runtime/os_netbsd.go
+++ b/src/runtime/os_netbsd.go
@@ -67,6 +67,11 @@ func lwp_self() int32
func osyield()
+//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
+
func kqueue() int32
//go:noescape
diff --git a/src/runtime/os_nonopenbsd.go b/src/runtime/os_nonopenbsd.go
index e65697bdb3..6134b6c02f 100644
--- a/src/runtime/os_nonopenbsd.go
+++ b/src/runtime/os_nonopenbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !openbsd
// +build !openbsd
package runtime
diff --git a/src/runtime/os_only_solaris.go b/src/runtime/os_only_solaris.go
index e2f5409354..3829683c80 100644
--- a/src/runtime/os_only_solaris.go
+++ b/src/runtime/os_only_solaris.go
@@ -4,6 +4,7 @@
// Solaris code that doesn't also apply to illumos.
+//go:build !illumos
// +build !illumos
package runtime
diff --git a/src/runtime/os_openbsd_libc.go b/src/runtime/os_openbsd_libc.go
index 2edb0358b0..3f43ade558 100644
--- a/src/runtime/os_openbsd_libc.go
+++ b/src/runtime/os_openbsd_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,amd64 openbsd,arm64
package runtime
diff --git a/src/runtime/os_openbsd_syscall.go b/src/runtime/os_openbsd_syscall.go
index 16ff2b8e25..6facf31593 100644
--- a/src/runtime/os_openbsd_syscall.go
+++ b/src/runtime/os_openbsd_syscall.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build openbsd,!amd64
-// +build openbsd,!arm64
+//go:build openbsd && !amd64 && openbsd && !arm64
+// +build openbsd,!amd64,openbsd,!arm64
package runtime
diff --git a/src/runtime/os_openbsd_syscall1.go b/src/runtime/os_openbsd_syscall1.go
index b0bef4c504..0f3d5f0b73 100644
--- a/src/runtime/os_openbsd_syscall1.go
+++ b/src/runtime/os_openbsd_syscall1.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build openbsd && !amd64 && !arm64
// +build openbsd,!amd64,!arm64
package runtime
@@ -13,3 +14,8 @@ func thrsleep(ident uintptr, clock_id int32, tsp *timespec, lock uintptr, abort
func thrwakeup(ident uintptr, n int32) int32
func osyield()
+
+//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
diff --git a/src/runtime/os_openbsd_syscall2.go b/src/runtime/os_openbsd_syscall2.go
index ab940510af..3b1707126b 100644
--- a/src/runtime/os_openbsd_syscall2.go
+++ b/src/runtime/os_openbsd_syscall2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build openbsd && !amd64 && !arm64
// +build openbsd,!amd64,!arm64
package runtime
@@ -32,6 +33,11 @@ func closefd(fd int32) int32
func exit(code int32)
func usleep(usec uint32)
+//go:nosplit
+func usleep_no_g(usec uint32) {
+ usleep(usec)
+}
+
// write calls the write system call.
// It returns a non-negative number of bytes written or a negative errno value.
//go:noescape
diff --git a/src/runtime/os_plan9.go b/src/runtime/os_plan9.go
index 2a84a73716..77665f461a 100644
--- a/src/runtime/os_plan9.go
+++ b/src/runtime/os_plan9.go
@@ -340,6 +340,11 @@ func osyield() {
}
//go:nosplit
+func osyield_no_g() {
+ osyield()
+}
+
+//go:nosplit
func usleep(µs uint32) {
ms := int32(µs / 1000)
if ms == 0 {
@@ -349,6 +354,11 @@ func usleep(µs uint32) {
}
//go:nosplit
+func usleep_no_g(usec uint32) {
+ usleep(usec)
+}
+
+//go:nosplit
func nanotime1() int64 {
var scratch int64
ns := nsec(&scratch)
diff --git a/src/runtime/os_windows.go b/src/runtime/os_windows.go
index e6b22e3167..f4e21a93ed 100644
--- a/src/runtime/os_windows.go
+++ b/src/runtime/os_windows.go
@@ -148,6 +148,9 @@ func tstart_stdcall(newm *m)
// Called by OS using stdcall ABI.
func ctrlhandler()
+// Init-time helper
+func wintls()
+
type mOS struct {
threadLock mutex // protects "thread" and prevents closing
thread uintptr // thread handle
@@ -236,6 +239,8 @@ func windowsLoadSystemLib(name []byte) uintptr {
}
}
+const haveCputicksAsm = GOARCH == "386" || GOARCH == "amd64"
+
func loadOptionalSyscalls() {
var kernel32dll = []byte("kernel32.dll\000")
k32 := stdcall1(_LoadLibraryA, uintptr(unsafe.Pointer(&kernel32dll[0])))
@@ -262,7 +267,7 @@ func loadOptionalSyscalls() {
}
_NtWaitForSingleObject = windowsFindfunc(n32, []byte("NtWaitForSingleObject\000"))
- if GOARCH == "arm" {
+ if !haveCputicksAsm {
_QueryPerformanceCounter = windowsFindfunc(k32, []byte("QueryPerformanceCounter\000"))
if _QueryPerformanceCounter == nil {
throw("could not find QPC syscalls")
@@ -379,7 +384,6 @@ const (
// in sys_windows_386.s and sys_windows_amd64.s:
func externalthreadhandler()
func getlasterror() uint32
-func setlasterror(err uint32)
// When loading DLLs, we prefer to use LoadLibraryEx with
// LOAD_LIBRARY_SEARCH_* flags, if available. LoadLibraryEx is not
@@ -453,23 +457,22 @@ func createHighResTimer() uintptr {
_SYNCHRONIZE|_TIMER_QUERY_STATE|_TIMER_MODIFY_STATE)
}
+const highResTimerSupported = GOARCH == "386" || GOARCH == "amd64"
+
func initHighResTimer() {
- if GOARCH == "arm" {
+ if !highResTimerSupported {
// TODO: Not yet implemented.
return
}
h := createHighResTimer()
if h != 0 {
haveHighResTimer = true
- usleep2Addr = unsafe.Pointer(funcPC(usleep2HighRes))
stdcall1(_CloseHandle, h)
}
}
func osinit() {
asmstdcallAddr = unsafe.Pointer(funcPC(asmstdcall))
- usleep2Addr = unsafe.Pointer(funcPC(usleep2))
- switchtothreadAddr = unsafe.Pointer(funcPC(switchtothread))
setBadSignalMsg()
@@ -1061,26 +1064,39 @@ func stdcall7(fn stdFunction, a0, a1, a2, a3, a4, a5, a6 uintptr) uintptr {
return stdcall(fn)
}
-// In sys_windows_386.s and sys_windows_amd64.s.
-func onosstack(fn unsafe.Pointer, arg uint32)
-
-// These are not callable functions. They should only be called via onosstack.
-func usleep2(usec uint32)
-func usleep2HighRes(usec uint32)
+// These must run on the system stack only.
+func usleep2(dt int32)
+func usleep2HighRes(dt int32)
func switchtothread()
-var usleep2Addr unsafe.Pointer
-var switchtothreadAddr unsafe.Pointer
+//go:nosplit
+func osyield_no_g() {
+ switchtothread()
+}
//go:nosplit
func osyield() {
- onosstack(switchtothreadAddr, 0)
+ systemstack(switchtothread)
+}
+
+//go:nosplit
+func usleep_no_g(us uint32) {
+ dt := -10 * int32(us) // relative sleep (negative), 100ns units
+ usleep2(dt)
}
//go:nosplit
func usleep(us uint32) {
- // Have 1us units; want 100ns units.
- onosstack(usleep2Addr, 10*us)
+ systemstack(func() {
+ dt := -10 * int32(us) // relative sleep (negative), 100ns units
+ // If the high-res timer is available and its handle has been allocated for this m, use it.
+ // Otherwise fall back to the low-res one, which doesn't need a handle.
+ if haveHighResTimer && getg().m.highResTimer != 0 {
+ usleep2HighRes(dt)
+ } else {
+ usleep2(dt)
+ }
+ })
}
func ctrlhandler1(_type uint32) uint32 {
@@ -1123,21 +1139,21 @@ func profilem(mp *m, thread uintptr) {
c.contextflags = _CONTEXT_CONTROL
stdcall2(_GetThreadContext, thread, uintptr(unsafe.Pointer(c)))
- gp := gFromTLS(mp)
+ gp := gFromSP(mp, c.sp())
sigprof(c.ip(), c.sp(), c.lr(), gp, mp)
}
-func gFromTLS(mp *m) *g {
- switch GOARCH {
- case "arm":
- tls := &mp.tls[0]
- return **((***g)(unsafe.Pointer(tls)))
- case "386", "amd64":
- tls := &mp.tls[0]
- return *((**g)(unsafe.Pointer(tls)))
+func gFromSP(mp *m, sp uintptr) *g {
+ if gp := mp.g0; gp != nil && gp.stack.lo < sp && sp < gp.stack.hi {
+ return gp
+ }
+ if gp := mp.gsignal; gp != nil && gp.stack.lo < sp && sp < gp.stack.hi {
+ return gp
+ }
+ if gp := mp.curg; gp != nil && gp.stack.lo < sp && sp < gp.stack.hi {
+ return gp
}
- throw("unsupported architecture")
return nil
}
@@ -1208,14 +1224,14 @@ func setThreadCPUProfiler(hz int32) {
atomic.Store((*uint32)(unsafe.Pointer(&getg().m.profilehz)), uint32(hz))
}
-const preemptMSupported = GOARCH != "arm"
+const preemptMSupported = GOARCH == "386" || GOARCH == "amd64"
// suspendLock protects simultaneous SuspendThread operations from
// suspending each other.
var suspendLock mutex
func preemptM(mp *m) {
- if GOARCH == "arm" {
+ if !preemptMSupported {
// TODO: Implement call injection
return
}
@@ -1286,7 +1302,7 @@ func preemptM(mp *m) {
unlock(&suspendLock)
// Does it want a preemption and is it safe to preempt?
- gp := gFromTLS(mp)
+ gp := gFromSP(mp, c.sp())
if wantAsyncPreempt(gp) {
if ok, newpc := isAsyncSafePoint(gp, c.ip(), c.sp(), c.lr()); ok {
// Inject call to asyncPreempt
diff --git a/src/runtime/os_windows_arm64.go b/src/runtime/os_windows_arm64.go
new file mode 100644
index 0000000000..7e413445ba
--- /dev/null
+++ b/src/runtime/os_windows_arm64.go
@@ -0,0 +1,14 @@
+// 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.
+
+package runtime
+
+import "unsafe"
+
+//go:nosplit
+func cputicks() int64 {
+ var counter int64
+ stdcall1(_QueryPerformanceCounter, uintptr(unsafe.Pointer(&counter)))
+ return counter
+}
diff --git a/src/runtime/panic.go b/src/runtime/panic.go
index 5b2ccdd874..e320eaa596 100644
--- a/src/runtime/panic.go
+++ b/src/runtime/panic.go
@@ -5,6 +5,7 @@
package runtime
import (
+ "internal/abi"
"runtime/internal/atomic"
"runtime/internal/sys"
"unsafe"
@@ -874,7 +875,13 @@ func reflectcallSave(p *_panic, fn, arg unsafe.Pointer, argsize uint32) {
p.pc = getcallerpc()
p.sp = unsafe.Pointer(getcallersp())
}
- reflectcall(nil, fn, arg, argsize, argsize)
+ // Pass a dummy RegArgs for now since no function actually implements
+ // the register-based ABI.
+ //
+ // TODO(mknyszek): Implement this properly, setting up arguments in
+ // registers as necessary in the caller.
+ var regs abi.RegArgs
+ reflectcall(nil, fn, arg, argsize, argsize, argsize, &regs)
if p != nil {
p.pc = 0
p.sp = unsafe.Pointer(nil)
@@ -968,7 +975,9 @@ func gopanic(e interface{}) {
}
} else {
p.argp = unsafe.Pointer(getargp(0))
- reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
+
+ var regs abi.RegArgs
+ reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz), uint32(d.siz), &regs)
}
p.argp = nil
diff --git a/src/runtime/panic32.go b/src/runtime/panic32.go
index aea8401a37..acbdd1ff45 100644
--- a/src/runtime/panic32.go
+++ b/src/runtime/panic32.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build 386 || arm || mips || mipsle
// +build 386 arm mips mipsle
package runtime
diff --git a/src/runtime/pprof/mprof_test.go b/src/runtime/pprof/mprof_test.go
index c11a45fd69..3ef40d3de7 100644
--- a/src/runtime/pprof/mprof_test.go
+++ b/src/runtime/pprof/mprof_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package pprof
@@ -93,31 +94,31 @@ func TestMemoryProfiler(t *testing.T) {
}{{
stk: []string{"runtime/pprof.allocatePersistent1K", "runtime/pprof.TestMemoryProfiler"},
legacy: fmt.Sprintf(`%v: %v \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-# 0x[0-9,a-f]+ runtime/pprof\.allocatePersistent1K\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test\.go:47
-# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test\.go:82
+# 0x[0-9,a-f]+ runtime/pprof\.allocatePersistent1K\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test\.go:48
+# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test\.go:83
`, 32*memoryProfilerRun, 1024*memoryProfilerRun, 32*memoryProfilerRun, 1024*memoryProfilerRun),
}, {
stk: []string{"runtime/pprof.allocateTransient1M", "runtime/pprof.TestMemoryProfiler"},
legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-# 0x[0-9,a-f]+ runtime/pprof\.allocateTransient1M\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:24
-# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:79
+# 0x[0-9,a-f]+ runtime/pprof\.allocateTransient1M\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:25
+# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:80
`, (1<<10)*memoryProfilerRun, (1<<20)*memoryProfilerRun),
}, {
stk: []string{"runtime/pprof.allocateTransient2M", "runtime/pprof.TestMemoryProfiler"},
legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-# 0x[0-9,a-f]+ runtime/pprof\.allocateTransient2M\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:30
-# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:80
+# 0x[0-9,a-f]+ runtime/pprof\.allocateTransient2M\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:31
+# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:81
`, memoryProfilerRun, (2<<20)*memoryProfilerRun),
}, {
stk: []string{"runtime/pprof.allocateTransient2MInline", "runtime/pprof.TestMemoryProfiler"},
legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+ 0x[0-9,a-f]+
-# 0x[0-9,a-f]+ runtime/pprof\.allocateTransient2MInline\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:34
-# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:81
+# 0x[0-9,a-f]+ runtime/pprof\.allocateTransient2MInline\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:35
+# 0x[0-9,a-f]+ runtime/pprof\.TestMemoryProfiler\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:82
`, memoryProfilerRun, (2<<20)*memoryProfilerRun),
}, {
stk: []string{"runtime/pprof.allocateReflectTransient"},
legacy: fmt.Sprintf(`0: 0 \[%v: %v\] @( 0x[0-9,a-f]+)+
-# 0x[0-9,a-f]+ runtime/pprof\.allocateReflectTransient\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:55
+# 0x[0-9,a-f]+ runtime/pprof\.allocateReflectTransient\+0x[0-9,a-f]+ .*/runtime/pprof/mprof_test.go:56
`, memoryProfilerRun, (2<<20)*memoryProfilerRun),
}}
diff --git a/src/runtime/pprof/pprof_norusage.go b/src/runtime/pprof/pprof_norusage.go
index 6fdcc6cc38..e175dd380c 100644
--- a/src/runtime/pprof/pprof_norusage.go
+++ b/src/runtime/pprof/pprof_norusage.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !darwin && !linux
// +build !darwin,!linux
package pprof
diff --git a/src/runtime/pprof/pprof_rusage.go b/src/runtime/pprof/pprof_rusage.go
index 7954673811..269f21bc2f 100644
--- a/src/runtime/pprof/pprof_rusage.go
+++ b/src/runtime/pprof/pprof_rusage.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || linux
// +build darwin linux
package pprof
diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go
index b6ee160e84..1b86dbff5b 100644
--- a/src/runtime/pprof/pprof_test.go
+++ b/src/runtime/pprof/pprof_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
package pprof
@@ -11,6 +12,7 @@ import (
"context"
"fmt"
"internal/profile"
+ "internal/race"
"internal/testenv"
"io"
"math/big"
@@ -261,34 +263,25 @@ func parseProfile(t *testing.T, valBytes []byte, f func(uintptr, []*profile.Loca
// as interpreted by matches, and returns the parsed profile.
func testCPUProfile(t *testing.T, matches matchFunc, need []string, avoid []string, f func(dur time.Duration)) *profile.Profile {
switch runtime.GOOS {
- case "darwin", "ios":
- switch runtime.GOARCH {
- case "arm64":
- // nothing
- default:
- out, err := exec.Command("uname", "-a").CombinedOutput()
- if err != nil {
- t.Fatal(err)
- }
- vers := string(out)
- t.Logf("uname -a: %v", vers)
+ case "darwin":
+ out, err := exec.Command("uname", "-a").CombinedOutput()
+ if err != nil {
+ t.Fatal(err)
}
+ vers := string(out)
+ t.Logf("uname -a: %v", vers)
case "plan9":
t.Skip("skipping on plan9")
}
broken := false
switch runtime.GOOS {
- case "darwin", "ios", "dragonfly", "netbsd", "illumos", "solaris":
+ case "ios", "dragonfly", "netbsd", "illumos", "solaris":
broken = true
case "openbsd":
if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" {
broken = true
}
- case "windows":
- if runtime.GOARCH == "arm" {
- broken = true // See https://golang.org/issues/42862
- }
}
maxDuration := 5 * time.Second
@@ -514,8 +507,10 @@ func TestGoroutineSwitch(t *testing.T) {
}
StopCPUProfile()
- // Read profile to look for entries for runtime.gogo with an attempt at a traceback.
- // The special entry
+ // Read profile to look for entries for gogo with an attempt at a traceback.
+ // "runtime.gogo" is OK, because that's the part of the context switch
+ // before the actual switch begins. But we should not see "gogo",
+ // aka "gogo<>(SB)", which does the actual switch and is marked SPWRITE.
parseProfile(t, prof.Bytes(), func(count uintptr, stk []*profile.Location, _ map[string][]string) {
// An entry with two frames with 'System' in its top frame
// exists to record a PC without a traceback. Those are okay.
@@ -526,13 +521,19 @@ func TestGoroutineSwitch(t *testing.T) {
}
}
- // Otherwise, should not see runtime.gogo.
+ // An entry with just one frame is OK too:
+ // it knew to stop at gogo.
+ if len(stk) == 1 {
+ return
+ }
+
+ // Otherwise, should not see gogo.
// The place we'd see it would be the inner most frame.
name := stk[0].Line[0].Function.Name
- if name == "runtime.gogo" {
+ if name == "gogo" {
var buf bytes.Buffer
fprintStack(&buf, stk)
- t.Fatalf("found profile entry for runtime.gogo:\n%s", buf.String())
+ t.Fatalf("found profile entry for gogo:\n%s", buf.String())
}
})
}
@@ -584,6 +585,18 @@ func stackContainsAll(spec string, count uintptr, stk []*profile.Location, label
}
func TestMorestack(t *testing.T) {
+ if runtime.GOOS == "darwin" && race.Enabled {
+ // For whatever reason, using the race detector on macOS keeps us
+ // from finding the newstack/growstack calls in the profile.
+ // Not worth worrying about.
+ // https://build.golang.org/log/280d387327806e17c8aabeb38b9503dbbd942ed1
+ t.Skip("skipping on darwin race detector")
+ }
+ if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
+ // For whatever reason, darwin/arm64 also doesn't work.
+ // https://build.golang.org/log/c45e82cc25f152642e6fb90d882ef5a8cd130ce5
+ t.Skip("skipping on darwin/arm64")
+ }
testCPUProfile(t, stackContainsAll, []string{"runtime.newstack,runtime/pprof.growstack"}, avoidFunctions(), func(duration time.Duration) {
t := time.After(duration)
c := make(chan bool)
diff --git a/src/runtime/preempt_amd64.s b/src/runtime/preempt_amd64.s
index 92c664d79a..dc7af806d3 100644
--- a/src/runtime/preempt_amd64.s
+++ b/src/runtime/preempt_amd64.s
@@ -13,11 +13,6 @@ TEXT ·asyncPreempt<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-0
ADJSP $368
// But vet doesn't know ADJSP, so suppress vet stack checking
NOP SP
- #ifdef GOOS_darwin
- CMPB internal∕cpu·X86+const_offsetX86HasAVX(SB), $0
- JE 2(PC)
- VZEROUPPER
- #endif
MOVQ AX, 0(SP)
MOVQ CX, 8(SP)
MOVQ DX, 16(SP)
@@ -32,6 +27,11 @@ TEXT ·asyncPreempt<ABIInternal>(SB),NOSPLIT|NOFRAME,$0-0
MOVQ R13, 88(SP)
MOVQ R14, 96(SP)
MOVQ R15, 104(SP)
+ #ifdef GOOS_darwin
+ CMPB internal∕cpu·X86+const_offsetX86HasAVX(SB), $0
+ JE 2(PC)
+ VZEROUPPER
+ #endif
MOVUPS X0, 112(SP)
MOVUPS X1, 128(SP)
MOVUPS X2, 144(SP)
diff --git a/src/runtime/preempt_nonwindows.go b/src/runtime/preempt_nonwindows.go
index 3066a1521e..365e86a611 100644
--- a/src/runtime/preempt_nonwindows.go
+++ b/src/runtime/preempt_nonwindows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package runtime
diff --git a/src/runtime/print.go b/src/runtime/print.go
index 64055a34cc..f15296cf02 100644
--- a/src/runtime/print.go
+++ b/src/runtime/print.go
@@ -216,13 +216,15 @@ func printint(v int64) {
printuint(uint64(v))
}
+var minhexdigits = 0 // protected by printlock
+
func printhex(v uint64) {
const dig = "0123456789abcdef"
var buf [100]byte
i := len(buf)
for i--; i > 0; i-- {
buf[i] = dig[v%16]
- if v < 16 {
+ if v < 16 && len(buf)-i >= minhexdigits {
break
}
v /= 16
@@ -265,29 +267,16 @@ func printiface(i iface) {
// and should return a character mark to appear just before that
// word's value. It can return 0 to indicate no mark.
func hexdumpWords(p, end uintptr, mark func(uintptr) byte) {
- p1 := func(x uintptr) {
- var buf [2 * sys.PtrSize]byte
- for i := len(buf) - 1; i >= 0; i-- {
- if x&0xF < 10 {
- buf[i] = byte(x&0xF) + '0'
- } else {
- buf[i] = byte(x&0xF) - 10 + 'a'
- }
- x >>= 4
- }
- gwrite(buf[:])
- }
-
printlock()
var markbuf [1]byte
markbuf[0] = ' '
+ minhexdigits = int(unsafe.Sizeof(uintptr(0)) * 2)
for i := uintptr(0); p+i < end; i += sys.PtrSize {
if i%16 == 0 {
if i != 0 {
println()
}
- p1(p + i)
- print(": ")
+ print(hex(p+i), ": ")
}
if mark != nil {
@@ -298,15 +287,16 @@ func hexdumpWords(p, end uintptr, mark func(uintptr) byte) {
}
gwrite(markbuf[:])
val := *(*uintptr)(unsafe.Pointer(p + i))
- p1(val)
+ print(hex(val))
print(" ")
// Can we symbolize val?
fn := findfunc(val)
if fn.valid() {
- print("<", funcname(fn), "+", val-fn.entry, "> ")
+ print("<", funcname(fn), "+", hex(val-fn.entry), "> ")
}
}
+ minhexdigits = 0
println()
printunlock()
}
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 73a789c189..19049d21f3 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1234,7 +1234,10 @@ func mStackIsSystemAllocated() bool {
}
// mstart is the entry-point for new Ms.
-//
+// It is written in assembly, marked TOPFRAME, and calls mstart0.
+func mstart()
+
+// mstart0 is the Go entry-point for new Ms.
// This must not split the stack because we may not even have stack
// bounds set up yet.
//
@@ -1243,7 +1246,7 @@ func mStackIsSystemAllocated() bool {
//
//go:nosplit
//go:nowritebarrierrec
-func mstart() {
+func mstart0() {
_g_ := getg()
osStack := _g_.stack.lo == 0
@@ -1281,6 +1284,9 @@ func mstart() {
mexit(osStack)
}
+// The go:noinline is to guarantee the getcallerpc/getcallersp below are safe,
+// so that we can set up g0.sched to return to the call of mstart1 above.
+//go:noinline
func mstart1() {
_g_ := getg()
@@ -1288,11 +1294,16 @@ func mstart1() {
throw("bad runtime·mstart")
}
- // Record the caller for use as the top of stack in mcall and
- // for terminating the thread.
+ // Set up m.g0.sched as a label returning returning to just
+ // after the mstart1 call in mstart0 above, for use by goexit0 and mcall.
// We're never coming back to mstart1 after we call schedule,
// so other calls can reuse the current frame.
- save(getcallerpc(), getcallersp())
+ // And goexit0 does a gogo that needs to return from mstart1
+ // and let mstart0 exit the thread.
+ _g_.sched.g = guintptr(unsafe.Pointer(_g_))
+ _g_.sched.pc = getcallerpc()
+ _g_.sched.sp = getcallersp()
+
asminit()
minit()
@@ -1900,7 +1911,7 @@ func oneNewExtraM() {
gp := malg(4096)
gp.sched.pc = funcPC(goexit) + sys.PCQuantum
gp.sched.sp = gp.stack.hi
- gp.sched.sp -= 4 * sys.RegSize // extra space in case of reads slightly beyond frame
+ gp.sched.sp -= 4 * sys.PtrSize // extra space in case of reads slightly beyond frame
gp.sched.lr = 0
gp.sched.g = guintptr(unsafe.Pointer(gp))
gp.syscallpc = gp.sched.pc
@@ -2012,7 +2023,7 @@ func lockextra(nilokay bool) *m {
for {
old := atomic.Loaduintptr(&extram)
if old == locked {
- osyield()
+ osyield_no_g()
continue
}
if old == 0 && !nilokay {
@@ -2023,13 +2034,13 @@ func lockextra(nilokay bool) *m {
atomic.Xadd(&extraMWaiters, 1)
incr = true
}
- usleep(1)
+ usleep_no_g(1)
continue
}
if atomic.Casuintptr(&extram, old, locked) {
return (*m)(unsafe.Pointer(old))
}
- osyield()
+ osyield_no_g()
continue
}
}
@@ -3445,11 +3456,19 @@ func goexit0(gp *g) {
func save(pc, sp uintptr) {
_g_ := getg()
+ if _g_ == _g_.m.g0 || _g_ == _g_.m.gsignal {
+ // m.g0.sched is special and must describe the context
+ // for exiting the thread. mstart1 writes to it directly.
+ // m.gsignal.sched should not be used at all.
+ // This check makes sure save calls do not accidentally
+ // run in contexts where they'd write to system g's.
+ throw("save on system g not allowed")
+ }
+
_g_.sched.pc = pc
_g_.sched.sp = sp
_g_.sched.lr = 0
_g_.sched.ret = 0
- _g_.sched.g = guintptr(unsafe.Pointer(_g_))
// We need to ensure ctxt is zero, but can't have a write
// barrier here. However, it should always already be zero.
// Assert that.
@@ -3463,7 +3482,7 @@ func save(pc, sp uintptr) {
// This is called only from the go syscall library and cgocall,
// not from the low-level system calls used by the runtime.
//
-// Entersyscall cannot split the stack: the gosave must
+// Entersyscall cannot split the stack: the save must
// make g->sched refer to the caller's stack segment, because
// entersyscall is going to return immediately after.
//
@@ -4009,9 +4028,9 @@ func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerp
// We could allocate a larger initial stack if necessary.
// Not worth it: this is almost always an error.
- // 4*sizeof(uintreg): extra space added below
- // sizeof(uintreg): caller's LR (arm) or return address (x86, in gostartcall).
- if siz >= _StackMin-4*sys.RegSize-sys.RegSize {
+ // 4*PtrSize: extra space added below
+ // PtrSize: caller's LR (arm) or return address (x86, in gostartcall).
+ if siz >= _StackMin-4*sys.PtrSize-sys.PtrSize {
throw("newproc: function arguments too large for new goroutine")
}
@@ -4030,8 +4049,8 @@ func newproc1(fn *funcval, argp unsafe.Pointer, narg int32, callergp *g, callerp
throw("newproc1: new g is not Gdead")
}
- totalSize := 4*sys.RegSize + uintptr(siz) + sys.MinFrameSize // extra space in case of reads slightly beyond frame
- totalSize += -totalSize & (sys.SpAlign - 1) // align to spAlign
+ totalSize := 4*sys.PtrSize + uintptr(siz) + sys.MinFrameSize // extra space in case of reads slightly beyond frame
+ totalSize += -totalSize & (sys.StackAlign - 1) // align to StackAlign
sp := newg.stack.hi - totalSize
spArg := sp
if usesLR {
@@ -4151,17 +4170,25 @@ func gfput(_p_ *p, gp *g) {
_p_.gFree.push(gp)
_p_.gFree.n++
if _p_.gFree.n >= 64 {
- lock(&sched.gFree.lock)
+ var (
+ inc int32
+ stackQ gQueue
+ noStackQ gQueue
+ )
for _p_.gFree.n >= 32 {
- _p_.gFree.n--
gp = _p_.gFree.pop()
+ _p_.gFree.n--
if gp.stack.lo == 0 {
- sched.gFree.noStack.push(gp)
+ noStackQ.push(gp)
} else {
- sched.gFree.stack.push(gp)
+ stackQ.push(gp)
}
- sched.gFree.n++
+ inc++
}
+ lock(&sched.gFree.lock)
+ sched.gFree.noStack.pushAll(noStackQ)
+ sched.gFree.stack.pushAll(stackQ)
+ sched.gFree.n += inc
unlock(&sched.gFree.lock)
}
}
@@ -4213,17 +4240,25 @@ retry:
// Purge all cached G's from gfree list to the global list.
func gfpurge(_p_ *p) {
- lock(&sched.gFree.lock)
+ var (
+ inc int32
+ stackQ gQueue
+ noStackQ gQueue
+ )
for !_p_.gFree.empty() {
gp := _p_.gFree.pop()
_p_.gFree.n--
if gp.stack.lo == 0 {
- sched.gFree.noStack.push(gp)
+ noStackQ.push(gp)
} else {
- sched.gFree.stack.push(gp)
+ stackQ.push(gp)
}
- sched.gFree.n++
+ inc++
}
+ lock(&sched.gFree.lock)
+ sched.gFree.noStack.pushAll(noStackQ)
+ sched.gFree.stack.pushAll(stackQ)
+ sched.gFree.n += inc
unlock(&sched.gFree.lock)
}
@@ -4404,75 +4439,6 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
// See golang.org/issue/17165.
getg().m.mallocing++
- // Define that a "user g" is a user-created goroutine, and a "system g"
- // is one that is m->g0 or m->gsignal.
- //
- // We might be interrupted for profiling halfway through a
- // goroutine switch. The switch involves updating three (or four) values:
- // g, PC, SP, and (on arm) LR. The PC must be the last to be updated,
- // because once it gets updated the new g is running.
- //
- // When switching from a user g to a system g, LR is not considered live,
- // so the update only affects g, SP, and PC. Since PC must be last, there
- // the possible partial transitions in ordinary execution are (1) g alone is updated,
- // (2) both g and SP are updated, and (3) SP alone is updated.
- // If SP or g alone is updated, we can detect the partial transition by checking
- // whether the SP is within g's stack bounds. (We could also require that SP
- // be changed only after g, but the stack bounds check is needed by other
- // cases, so there is no need to impose an additional requirement.)
- //
- // There is one exceptional transition to a system g, not in ordinary execution.
- // When a signal arrives, the operating system starts the signal handler running
- // with an updated PC and SP. The g is updated last, at the beginning of the
- // handler. There are two reasons this is okay. First, until g is updated the
- // g and SP do not match, so the stack bounds check detects the partial transition.
- // Second, signal handlers currently run with signals disabled, so a profiling
- // signal cannot arrive during the handler.
- //
- // When switching from a system g to a user g, there are three possibilities.
- //
- // First, it may be that the g switch has no PC update, because the SP
- // either corresponds to a user g throughout (as in asmcgocall)
- // or because it has been arranged to look like a user g frame
- // (as in cgocallback). In this case, since the entire
- // transition is a g+SP update, a partial transition updating just one of
- // those will be detected by the stack bounds check.
- //
- // Second, when returning from a signal handler, the PC and SP updates
- // are performed by the operating system in an atomic update, so the g
- // update must be done before them. The stack bounds check detects
- // the partial transition here, and (again) signal handlers run with signals
- // disabled, so a profiling signal cannot arrive then anyway.
- //
- // Third, the common case: it may be that the switch updates g, SP, and PC
- // separately. If the PC is within any of the functions that does this,
- // we don't ask for a traceback. C.F. the function setsSP for more about this.
- //
- // There is another apparently viable approach, recorded here in case
- // the "PC within setsSP function" check turns out not to be usable.
- // It would be possible to delay the update of either g or SP until immediately
- // before the PC update instruction. Then, because of the stack bounds check,
- // the only problematic interrupt point is just before that PC update instruction,
- // and the sigprof handler can detect that instruction and simulate stepping past
- // it in order to reach a consistent state. On ARM, the update of g must be made
- // in two places (in R10 and also in a TLS slot), so the delayed update would
- // need to be the SP update. The sigprof handler must read the instruction at
- // the current PC and if it was the known instruction (for example, JMP BX or
- // MOV R2, PC), use that other register in place of the PC value.
- // The biggest drawback to this solution is that it requires that we can tell
- // whether it's safe to read from the memory pointed at by PC.
- // In a correct program, we can test PC == nil and otherwise read,
- // but if a profiling signal happens at the instant that a program executes
- // a bad jump (before the program manages to handle the resulting fault)
- // the profiling handler could fault trying to read nonexistent memory.
- //
- // To recap, there are no constraints on the assembly being used for the
- // transition. We simply require that g and SP match and that the PC is not
- // in gogo.
- traceback := true
- if gp == nil || sp < gp.stack.lo || gp.stack.hi < sp || setsSP(pc) || (mp != nil && mp.vdsoSP != 0) {
- traceback = false
- }
var stk [maxCPUProfStack]uintptr
n := 0
if mp.ncgo > 0 && mp.curg != nil && mp.curg.syscallpc != 0 && mp.curg.syscallsp != 0 {
@@ -4495,7 +4461,7 @@ func sigprof(pc, sp, lr uintptr, gp *g, mp *m) {
if n > 0 {
n += cgoOff
}
- } else if traceback {
+ } else {
n = gentraceback(pc, sp, lr, gp, 0, &stk[0], len(stk), nil, nil, _TraceTrap|_TraceJumpStack)
}
@@ -4574,30 +4540,6 @@ func sigprofNonGoPC(pc uintptr) {
}
}
-// Reports whether a function will set the SP
-// to an absolute value. Important that
-// we don't traceback when these are at the bottom
-// of the stack since we can't be sure that we will
-// find the caller.
-//
-// If the function is not on the bottom of the stack
-// we assume that it will have set it up so that traceback will be consistent,
-// either by being a traceback terminating function
-// or putting one on the stack at the right offset.
-func setsSP(pc uintptr) bool {
- f := findfunc(pc)
- if !f.valid() {
- // couldn't find the function for this PC,
- // so assume the worst and stop traceback
- return true
- }
- switch f.funcID {
- case funcID_gogo, funcID_systemstack, funcID_mcall, funcID_morestack:
- return true
- }
- return false
-}
-
// setcpuprofilerate sets the CPU profiling rate to hz times per second.
// If hz <= 0, setcpuprofilerate turns off CPU profiling.
func setcpuprofilerate(hz int32) {
diff --git a/src/runtime/race.go b/src/runtime/race.go
index 79fd21765d..cc8c5db1bd 100644
--- a/src/runtime/race.go
+++ b/src/runtime/race.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
package runtime
diff --git a/src/runtime/race/README b/src/runtime/race/README
index 178ab94ab5..dbff42dc8a 100644
--- a/src/runtime/race/README
+++ b/src/runtime/race/README
@@ -12,3 +12,4 @@ race_netbsd_amd64.syso built with LLVM 89f7ccea6f6488c443655880229c54db1f180153
race_windows_amd64.syso built with LLVM 89f7ccea6f6488c443655880229c54db1f180153 and Go f62d3202bf9dbb3a00ad2a2c63ff4fa4188c5d3b.
race_linux_arm64.syso built with LLVM 89f7ccea6f6488c443655880229c54db1f180153 and Go f62d3202bf9dbb3a00ad2a2c63ff4fa4188c5d3b.
race_darwin_arm64.syso built with LLVM 00da38ce2d36c07f12c287dc515d37bb7bc410e9 and Go fe70a3a0fd31441bcbb9932ecab11a6083cf2119.
+race_openbsd_amd64.syso built with LLVM fcf6ae2f070eba73074b6ec8d8281e54d29dbeeb and Go 8f2db14cd35bbd674cb2988a508306de6655e425.
diff --git a/src/runtime/race/output_test.go b/src/runtime/race/output_test.go
index 17dc32013f..4a959d9aba 100644
--- a/src/runtime/race/output_test.go
+++ b/src/runtime/race/output_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
package race_test
diff --git a/src/runtime/race/race.go b/src/runtime/race/race.go
index d6a14b79e7..84050e8771 100644
--- a/src/runtime/race/race.go
+++ b/src/runtime/race/race.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build race,linux,amd64 race,freebsd,amd64 race,netbsd,amd64 race,darwin,amd64 race,windows,amd64 race,linux,ppc64le race,linux,arm64 race,darwin,arm64
+//go:build (race && linux && amd64) || (race && freebsd && amd64) || (race && netbsd && amd64) || (race && darwin && amd64) || (race && windows && amd64) || (race && linux && ppc64le) || (race && linux && arm64) || (race && darwin && arm64) || (race && openbsd && amd64)
+// +build race,linux,amd64 race,freebsd,amd64 race,netbsd,amd64 race,darwin,amd64 race,windows,amd64 race,linux,ppc64le race,linux,arm64 race,darwin,arm64 race,openbsd,amd64
package race
diff --git a/src/runtime/race/race_linux_test.go b/src/runtime/race/race_linux_test.go
index c00ce4d3df..9c0d48d6bd 100644
--- a/src/runtime/race/race_linux_test.go
+++ b/src/runtime/race/race_linux_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && race
// +build linux,race
package race_test
diff --git a/src/runtime/race/race_openbsd_amd64.syso b/src/runtime/race/race_openbsd_amd64.syso
new file mode 100644
index 0000000000..9fefd87ec6
--- /dev/null
+++ b/src/runtime/race/race_openbsd_amd64.syso
Binary files differ
diff --git a/src/runtime/race/race_test.go b/src/runtime/race/race_test.go
index d433af6bd0..8c880b8570 100644
--- a/src/runtime/race/race_test.go
+++ b/src/runtime/race/race_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
// This program is used to verify the race detector
diff --git a/src/runtime/race/race_unix_test.go b/src/runtime/race/race_unix_test.go
index 84f0acece6..acd6e47f98 100644
--- a/src/runtime/race/race_unix_test.go
+++ b/src/runtime/race/race_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race && (darwin || freebsd || linux)
// +build race
// +build darwin freebsd linux
diff --git a/src/runtime/race/race_windows_test.go b/src/runtime/race/race_windows_test.go
index 307a1ea6c0..e490d766dd 100644
--- a/src/runtime/race/race_windows_test.go
+++ b/src/runtime/race/race_windows_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build windows && race
// +build windows,race
package race_test
diff --git a/src/runtime/race/sched_test.go b/src/runtime/race/sched_test.go
index d6bb323cde..e904ebd20d 100644
--- a/src/runtime/race/sched_test.go
+++ b/src/runtime/race/sched_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
package race_test
diff --git a/src/runtime/race/syso_test.go b/src/runtime/race/syso_test.go
index db846c5d2a..cbce5a8f18 100644
--- a/src/runtime/race/syso_test.go
+++ b/src/runtime/race/syso_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !android && !js && !ppc64le
// +build !android,!js,!ppc64le
// Note: we don't run on Android or ppc64 because if there is any non-race test
diff --git a/src/runtime/race/testdata/mutex_test.go b/src/runtime/race/testdata/mutex_test.go
index cbed2d370c..9dbed9a2c9 100644
--- a/src/runtime/race/testdata/mutex_test.go
+++ b/src/runtime/race/testdata/mutex_test.go
@@ -78,16 +78,23 @@ func TestNoRaceMutexPureHappensBefore(t *testing.T) {
var mu sync.Mutex
var x int16 = 0
_ = x
+ written := false
ch := make(chan bool, 2)
go func() {
x = 1
mu.Lock()
+ written = true
mu.Unlock()
ch <- true
}()
go func() {
- <-time.After(1e5)
+ time.Sleep(100 * time.Microsecond)
mu.Lock()
+ for !written {
+ mu.Unlock()
+ time.Sleep(100 * time.Microsecond)
+ mu.Lock()
+ }
mu.Unlock()
x = 1
ch <- true
diff --git a/src/runtime/race/timer_test.go b/src/runtime/race/timer_test.go
index a6c34a8352..f11f8456a0 100644
--- a/src/runtime/race/timer_test.go
+++ b/src/runtime/race/timer_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build race
// +build race
package race_test
diff --git a/src/runtime/race0.go b/src/runtime/race0.go
index 180f707b1a..0e431b8103 100644
--- a/src/runtime/race0.go
+++ b/src/runtime/race0.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !race
// +build !race
// Dummy race detection API, used when not built with -race.
diff --git a/src/runtime/race_amd64.s b/src/runtime/race_amd64.s
index 9818bc6ddf..e10c21c7f3 100644
--- a/src/runtime/race_amd64.s
+++ b/src/runtime/race_amd64.s
@@ -146,8 +146,10 @@ TEXT runtime·racewriterangepc1(SB), NOSPLIT, $0-24
// If addr (RARG1) is out of range, do nothing.
// Otherwise, setup goroutine context and invoke racecall. Other arguments already set.
TEXT racecalladdr<>(SB), NOSPLIT, $0-0
+#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
+#endif
MOVQ g_racectx(R14), RARG0 // goroutine context
// Check that addr is within [arenastart, arenaend) or within [racedatastart, racedataend).
CMPQ RARG1, runtime·racearenastart(SB)
@@ -182,23 +184,27 @@ TEXT runtime·racefuncenter(SB), NOSPLIT, $0-8
// Common code for racefuncenter/racefuncenterfp
// R11 = caller's return address
TEXT racefuncenter<>(SB), NOSPLIT, $0-0
- MOVQ DX, R15 // save function entry context (for closures)
+ MOVQ DX, BX // save function entry context (for closures)
+#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
+#endif
MOVQ g_racectx(R14), RARG0 // goroutine context
MOVQ R11, RARG1
// void __tsan_func_enter(ThreadState *thr, void *pc);
MOVQ $__tsan_func_enter(SB), AX
- // racecall<> preserves R15
+ // racecall<> preserves BX
CALL racecall<>(SB)
- MOVQ R15, DX // restore function entry context
+ MOVQ BX, DX // restore function entry context
RET
// func runtime·racefuncexit()
// Called from instrumented code.
TEXT runtime·racefuncexit(SB), NOSPLIT, $0-0
+#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
+#endif
MOVQ g_racectx(R14), RARG0 // goroutine context
// void __tsan_func_exit(ThreadState *thr);
MOVQ $__tsan_func_exit(SB), AX
@@ -357,8 +363,10 @@ racecallatomic_data:
JAE racecallatomic_ignore
racecallatomic_ok:
// Addr is within the good range, call the atomic function.
+#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
+#endif
MOVQ g_racectx(R14), RARG0 // goroutine context
MOVQ 8(SP), RARG1 // caller pc
MOVQ (SP), RARG2 // pc
@@ -368,13 +376,15 @@ racecallatomic_ignore:
// Addr is outside the good range.
// Call __tsan_go_ignore_sync_begin to ignore synchronization during the atomic op.
// An attempt to synchronize on the address would cause crash.
- MOVQ AX, R15 // remember the original function
+ MOVQ AX, BX // remember the original function
MOVQ $__tsan_go_ignore_sync_begin(SB), AX
+#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
+#endif
MOVQ g_racectx(R14), RARG0 // goroutine context
CALL racecall<>(SB)
- MOVQ R15, AX // restore the original function
+ MOVQ BX, AX // restore the original function
// Call the atomic function.
MOVQ g_racectx(R14), RARG0 // goroutine context
MOVQ 8(SP), RARG1 // caller pc
@@ -399,8 +409,10 @@ TEXT runtime·racecall(SB), NOSPLIT, $0-0
// Switches SP to g0 stack and calls (AX). Arguments already set.
TEXT racecall<>(SB), NOSPLIT, $0-0
+#ifndef GOEXPERIMENT_REGABI
get_tls(R12)
MOVQ g(R12), R14
+#endif
MOVQ g_m(R14), R13
// Switch to g0 stack.
MOVQ SP, R12 // callee-saved, preserved across the CALL
@@ -412,6 +424,9 @@ call:
ANDQ $~15, SP // alignment for gcc ABI
CALL AX
MOVQ R12, SP
+ // Back to Go world, set special registers.
+ // The g register (R14) is preserved in C.
+ XORPS X15, X15
RET
// C->Go callback thunk that allows to call runtime·racesymbolize from C code.
@@ -419,7 +434,9 @@ call:
// The overall effect of Go->C->Go call chain is similar to that of mcall.
// RARG0 contains command code. RARG1 contains command-specific context.
// See racecallback for command codes.
-TEXT runtime·racecallbackthunk(SB), NOSPLIT, $56-8
+// Defined as ABIInternal so as to avoid introducing a wrapper,
+// because its address is passed to C via funcPC.
+TEXT runtime·racecallbackthunk<ABIInternal>(SB), NOSPLIT, $56-8
// Handle command raceGetProcCmd (0) here.
// First, code below assumes that we are on curg, while raceGetProcCmd
// can be executed on g0. Second, it is called frequently, so will
@@ -447,12 +464,13 @@ rest:
PUSHQ R15
// Set g = g0.
get_tls(R12)
- MOVQ g(R12), R13
- MOVQ g_m(R13), R14
- MOVQ m_g0(R14), R15
+ MOVQ g(R12), R14
+ MOVQ g_m(R14), R13
+ MOVQ m_g0(R13), R15
CMPQ R13, R15
JEQ noswitch // branch if already on g0
MOVQ R15, g(R12) // g = m->g0
+ MOVQ R15, R14 // set g register
PUSHQ RARG1 // func arg
PUSHQ RARG0 // func arg
CALL runtime·racecallback(SB)
diff --git a/src/runtime/relax_stub.go b/src/runtime/relax_stub.go
index 81ed1291b8..5b92879c20 100644
--- a/src/runtime/relax_stub.go
+++ b/src/runtime/relax_stub.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !windows
// +build !windows
package runtime
diff --git a/src/runtime/rt0_windows_arm64.s b/src/runtime/rt0_windows_arm64.s
new file mode 100644
index 0000000000..1e71a068d3
--- /dev/null
+++ b/src/runtime/rt0_windows_arm64.s
@@ -0,0 +1,12 @@
+// 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 "go_asm.h"
+#include "go_tls.h"
+#include "textflag.h"
+
+// This is the entry point for the program from the
+// kernel for an ordinary -buildmode=exe program.
+TEXT _rt0_arm64_windows(SB),NOSPLIT|NOFRAME,$0
+ B ·rt0_go(SB)
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index b7c7b4cff2..f5318e6f11 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -5,7 +5,6 @@
package runtime
import (
- "internal/cpu"
"runtime/internal/atomic"
"runtime/internal/sys"
"unsafe"
@@ -327,7 +326,7 @@ type gobuf struct {
pc uintptr
g guintptr
ctxt unsafe.Pointer
- ret sys.Uintreg
+ ret uintptr
lr uintptr
bp uintptr // for framepointer-enabled architectures
}
@@ -713,7 +712,8 @@ type p struct {
// scheduler ASAP (regardless of what G is running on it).
preempt bool
- pad cpu.CacheLinePad
+ // Padding is no longer needed. False sharing is now not a worry because p is large enough
+ // that its size class is an integer multiple of the cache line size (for any of our architectures).
}
type schedt struct {
@@ -833,10 +833,11 @@ type _func struct {
pcfile uint32
pcln uint32
npcdata uint32
- cuOffset uint32 // runtime.cutab offset of this function's CU
- funcID funcID // set for certain special runtime functions
- _ [2]byte // pad
- nfuncdata uint8 // must be last
+ cuOffset uint32 // runtime.cutab offset of this function's CU
+ funcID funcID // set for certain special runtime functions
+ flag funcFlag
+ _ [1]byte // pad
+ nfuncdata uint8 // must be last, must end on a uint32-aligned boundary
}
// Pseudo-Func that is returned for PCs that occur in inlined code.
@@ -1105,4 +1106,4 @@ var (
)
// Must agree with cmd/internal/objabi.Framepointer_enabled.
-const framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64" && (GOOS == "linux" || GOOS == "darwin" || GOOS == "ios")
+const framepointer_enabled = GOARCH == "amd64" || GOARCH == "arm64"
diff --git a/src/runtime/runtime_mmap_test.go b/src/runtime/runtime_mmap_test.go
index bb0b747606..f71f8afa57 100644
--- a/src/runtime/runtime_mmap_test.go
+++ b/src/runtime/runtime_mmap_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package runtime_test
diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go
index e5d2d97d05..4572a25195 100644
--- a/src/runtime/runtime_test.go
+++ b/src/runtime/runtime_test.go
@@ -266,8 +266,8 @@ func TestTrailingZero(t *testing.T) {
n int64
z struct{}
}
- if unsafe.Sizeof(T2{}) != 8+unsafe.Sizeof(Uintreg(0)) {
- t.Errorf("sizeof(%#v)==%d, want %d", T2{}, unsafe.Sizeof(T2{}), 8+unsafe.Sizeof(Uintreg(0)))
+ if unsafe.Sizeof(T2{}) != 8+unsafe.Sizeof(uintptr(0)) {
+ t.Errorf("sizeof(%#v)==%d, want %d", T2{}, unsafe.Sizeof(T2{}), 8+unsafe.Sizeof(uintptr(0)))
}
type T3 struct {
n byte
diff --git a/src/runtime/runtime_unix_test.go b/src/runtime/runtime_unix_test.go
index b0cbbbe3e6..0251c676e6 100644
--- a/src/runtime/runtime_unix_test.go
+++ b/src/runtime/runtime_unix_test.go
@@ -6,6 +6,7 @@
// We need a fast system call to provoke the race,
// and Close(-1) is nearly universally fast.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || plan9
// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9
package runtime_test
diff --git a/src/runtime/semasleep_test.go b/src/runtime/semasleep_test.go
index 9b371b0732..905e932b7d 100644
--- a/src/runtime/semasleep_test.go
+++ b/src/runtime/semasleep_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !plan9 && !windows && !js
// +build !plan9,!windows,!js
package runtime_test
diff --git a/src/runtime/sigaction.go b/src/runtime/sigaction.go
index 3c888579d0..76f37b1b53 100644
--- a/src/runtime/sigaction.go
+++ b/src/runtime/sigaction.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (linux && !amd64 && !arm64) || (freebsd && !amd64)
// +build linux,!amd64,!arm64 freebsd,!amd64
package runtime
diff --git a/src/runtime/signal_386.go b/src/runtime/signal_386.go
index 065aff48d3..5824eaddb5 100644
--- a/src/runtime/signal_386.go
+++ b/src/runtime/signal_386.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package runtime
diff --git a/src/runtime/signal_aix_ppc64.go b/src/runtime/signal_aix_ppc64.go
index c17563e2a5..a0becd431e 100644
--- a/src/runtime/signal_aix_ppc64.go
+++ b/src/runtime/signal_aix_ppc64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix
// +build aix
package runtime
diff --git a/src/runtime/signal_amd64.go b/src/runtime/signal_amd64.go
index 6ab1f758c2..e45fbb4a87 100644
--- a/src/runtime/signal_amd64.go
+++ b/src/runtime/signal_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 && (darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris)
// +build amd64
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
@@ -65,11 +66,14 @@ func (c *sigctxt) preparePanic(sig uint32, gp *g) {
pc := uintptr(c.rip())
sp := uintptr(c.rsp())
+ // In case we are panicking from external code, we need to initialize
+ // Go special registers. We inject sigpanic0 (instead of sigpanic),
+ // which takes care of that.
if shouldPushSigpanic(gp, pc, *(*uintptr)(unsafe.Pointer(sp))) {
- c.pushCall(funcPC(sigpanic), pc)
+ c.pushCall(funcPC(sigpanic0), pc)
} else {
// Not safe to push the call. Just clobber the frame.
- c.set_rip(uint64(funcPC(sigpanic)))
+ c.set_rip(uint64(funcPC(sigpanic0)))
}
}
diff --git a/src/runtime/signal_arm.go b/src/runtime/signal_arm.go
index 156d9d384c..4d9c6224a2 100644
--- a/src/runtime/signal_arm.go
+++ b/src/runtime/signal_arm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package runtime
diff --git a/src/runtime/signal_arm64.go b/src/runtime/signal_arm64.go
index 3c20139c99..f04750084f 100644
--- a/src/runtime/signal_arm64.go
+++ b/src/runtime/signal_arm64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || freebsd || linux || netbsd || openbsd
// +build darwin freebsd linux netbsd openbsd
package runtime
@@ -63,7 +64,7 @@ func (c *sigctxt) preparePanic(sig uint32, gp *g) {
// functions are correctly handled. This smashes
// the stack frame but we're not going back there
// anyway.
- sp := c.sp() - sys.SpAlign // needs only sizeof uint64, but must align the stack
+ sp := c.sp() - sys.StackAlign // needs only sizeof uint64, but must align the stack
c.set_sp(sp)
*(*uint64)(unsafe.Pointer(uintptr(sp))) = c.lr()
diff --git a/src/runtime/signal_linux_mips64x.go b/src/runtime/signal_linux_mips64x.go
index b608197d60..f0a75ac3ea 100644
--- a/src/runtime/signal_linux_mips64x.go
+++ b/src/runtime/signal_linux_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips64 || mips64le)
// +build linux
// +build mips64 mips64le
diff --git a/src/runtime/signal_linux_mipsx.go b/src/runtime/signal_linux_mipsx.go
index c88ac4d521..f3969c5aac 100644
--- a/src/runtime/signal_linux_mipsx.go
+++ b/src/runtime/signal_linux_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips || mipsle)
// +build linux
// +build mips mipsle
diff --git a/src/runtime/signal_linux_ppc64x.go b/src/runtime/signal_linux_ppc64x.go
index 97cb26d587..d9d3e55ec2 100644
--- a/src/runtime/signal_linux_ppc64x.go
+++ b/src/runtime/signal_linux_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le
diff --git a/src/runtime/signal_mips64x.go b/src/runtime/signal_mips64x.go
index 2a347ff4cb..1616b57027 100644
--- a/src/runtime/signal_mips64x.go
+++ b/src/runtime/signal_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (linux || openbsd) && (mips64 || mips64le)
// +build linux openbsd
// +build mips64 mips64le
diff --git a/src/runtime/signal_mipsx.go b/src/runtime/signal_mipsx.go
index 8c29f59bd1..dcc7f1e9dd 100644
--- a/src/runtime/signal_mipsx.go
+++ b/src/runtime/signal_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips || mipsle)
// +build linux
// +build mips mipsle
diff --git a/src/runtime/signal_ppc64x.go b/src/runtime/signal_ppc64x.go
index 5de93a330a..f2225da9a1 100644
--- a/src/runtime/signal_ppc64x.go
+++ b/src/runtime/signal_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (aix || linux) && (ppc64 || ppc64le)
// +build aix linux
// +build ppc64 ppc64le
diff --git a/src/runtime/signal_riscv64.go b/src/runtime/signal_riscv64.go
index 93363a4746..e6b1b14130 100644
--- a/src/runtime/signal_riscv64.go
+++ b/src/runtime/signal_riscv64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && riscv64
// +build linux,riscv64
package runtime
diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go
index 3f70707ab4..f2e526973d 100644
--- a/src/runtime/signal_unix.go
+++ b/src/runtime/signal_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package runtime
diff --git a/src/runtime/signal_windows.go b/src/runtime/signal_windows.go
index 3af2e39b08..63158f0bc4 100644
--- a/src/runtime/signal_windows.go
+++ b/src/runtime/signal_windows.go
@@ -5,6 +5,7 @@
package runtime
import (
+ "runtime/internal/sys"
"unsafe"
)
@@ -43,13 +44,18 @@ func initExceptionHandler() {
//
//go:nosplit
func isAbort(r *context) bool {
- // In the case of an abort, the exception IP is one byte after
- // the INT3 (this differs from UNIX OSes).
- return isAbortPC(r.ip() - 1)
+ pc := r.ip()
+ if GOARCH == "386" || GOARCH == "amd64" || GOARCH == "arm" {
+ // In the case of an abort, the exception IP is one byte after
+ // the INT3 (this differs from UNIX OSes). Note that on ARM,
+ // this means that the exception IP is no longer aligned.
+ pc--
+ }
+ return isAbortPC(pc)
}
// isgoexception reports whether this exception should be translated
-// into a Go panic.
+// into a Go panic or throw.
//
// It is nosplit to avoid growing the stack in case we're aborting
// because of a stack overflow.
@@ -63,11 +69,6 @@ func isgoexception(info *exceptionrecord, r *context) bool {
return false
}
- if isAbort(r) {
- // Never turn abort into a panic.
- return false
- }
-
// Go will only handle some exceptions.
switch info.exceptioncode {
default:
@@ -81,6 +82,7 @@ func isgoexception(info *exceptionrecord, r *context) bool {
case _EXCEPTION_FLT_OVERFLOW:
case _EXCEPTION_FLT_UNDERFLOW:
case _EXCEPTION_BREAKPOINT:
+ case _EXCEPTION_ILLEGAL_INSTRUCTION: // breakpoint arrives this way on arm64
}
return true
}
@@ -99,21 +101,23 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 {
return _EXCEPTION_CONTINUE_SEARCH
}
- // After this point, it is safe to grow the stack.
-
- if gp.throwsplit {
- // We can't safely sigpanic because it may grow the
- // stack. Let it fall through.
- return _EXCEPTION_CONTINUE_SEARCH
+ if gp.throwsplit || isAbort(r) {
+ // We can't safely sigpanic because it may grow the stack.
+ // Or this is a call to abort.
+ // Don't go through any more of the Windows handler chain.
+ // Crash now.
+ winthrow(info, r, gp)
}
+ // After this point, it is safe to grow the stack.
+
// Make it look like a call to the signal func.
// Have to pass arguments out of band since
// augmenting the stack frame would break
// the unwinding code.
gp.sig = info.exceptioncode
- gp.sigcode0 = uintptr(info.exceptioninformation[0])
- gp.sigcode1 = uintptr(info.exceptioninformation[1])
+ gp.sigcode0 = info.exceptioninformation[0]
+ gp.sigcode1 = info.exceptioninformation[1]
gp.sigpc = r.ip()
// Only push runtime·sigpanic if r.ip() != 0.
@@ -131,16 +135,14 @@ func exceptionhandler(info *exceptionrecord, r *context, gp *g) int32 {
// overwrite the PC. (See issue #35773)
if r.ip() != 0 && r.ip() != funcPC(asyncPreempt) {
sp := unsafe.Pointer(r.sp())
- sp = add(sp, ^(unsafe.Sizeof(uintptr(0)) - 1)) // sp--
+ delta := uintptr(sys.StackAlign)
+ sp = add(sp, -delta)
r.set_sp(uintptr(sp))
- switch GOARCH {
- default:
- panic("unsupported architecture")
- case "386", "amd64":
- *((*uintptr)(sp)) = r.ip()
- case "arm":
+ if usesLR {
*((*uintptr)(sp)) = r.lr()
r.set_lr(r.ip())
+ } else {
+ *((*uintptr)(sp)) = r.ip()
}
}
r.set_ip(funcPC(sigpanic))
@@ -181,6 +183,12 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 {
return _EXCEPTION_CONTINUE_SEARCH
}
+ winthrow(info, r, gp)
+ return 0 // not reached
+}
+
+//go:nosplit
+func winthrow(info *exceptionrecord, r *context, gp *g) {
_g_ := getg()
if panicking != 0 { // traceback already printed
@@ -206,11 +214,8 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 {
}
print("\n")
- // TODO(jordanrh1): This may be needed for 386/AMD64 as well.
- if GOARCH == "arm" {
- _g_.m.throwing = 1
- _g_.m.caughtsig.set(gp)
- }
+ _g_.m.throwing = 1
+ _g_.m.caughtsig.set(gp)
level, _, docrash := gotraceback()
if level > 0 {
@@ -224,7 +229,6 @@ func lastcontinuehandler(info *exceptionrecord, r *context, gp *g) int32 {
}
exit(2)
- return 0 // not reached
}
func sigpanic() {
diff --git a/src/runtime/signal_windows_test.go b/src/runtime/signal_windows_test.go
index 33a9b92ee7..05bc6f8e71 100644
--- a/src/runtime/signal_windows_test.go
+++ b/src/runtime/signal_windows_test.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package runtime_test
diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go
index 28b9e26d0f..a282c7aca7 100644
--- a/src/runtime/sigqueue.go
+++ b/src/runtime/sigqueue.go
@@ -28,6 +28,7 @@
// unnecessary rechecks of sig.mask, but it cannot lead to missed signals
// nor deadlocks.
+//go:build !plan9
// +build !plan9
package runtime
diff --git a/src/runtime/sigqueue_note.go b/src/runtime/sigqueue_note.go
index 16aeeb2ef0..e23446bea4 100644
--- a/src/runtime/sigqueue_note.go
+++ b/src/runtime/sigqueue_note.go
@@ -7,8 +7,8 @@
// signal_recv thread. This file holds the non-Darwin implementations of
// those functions. These functions will never be called.
-// +build !darwin
-// +build !plan9
+//go:build !darwin && !plan9
+// +build !darwin,!plan9
package runtime
diff --git a/src/runtime/sigtab_linux_generic.go b/src/runtime/sigtab_linux_generic.go
index 38d686544f..dc1debddab 100644
--- a/src/runtime/sigtab_linux_generic.go
+++ b/src/runtime/sigtab_linux_generic.go
@@ -2,11 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !mips
-// +build !mipsle
-// +build !mips64
-// +build !mips64le
-// +build linux
+//go:build !mips && !mipsle && !mips64 && !mips64le && linux
+// +build !mips,!mipsle,!mips64,!mips64le,linux
package runtime
diff --git a/src/runtime/sigtab_linux_mipsx.go b/src/runtime/sigtab_linux_mipsx.go
index 51ef470ce7..af9c7e56eb 100644
--- a/src/runtime/sigtab_linux_mipsx.go
+++ b/src/runtime/sigtab_linux_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (mips || mipsle || mips64 || mips64le) && linux
// +build mips mipsle mips64 mips64le
// +build linux
diff --git a/src/runtime/stack.go b/src/runtime/stack.go
index 7b9dce5393..d971e5e26f 100644
--- a/src/runtime/stack.go
+++ b/src/runtime/stack.go
@@ -651,7 +651,7 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool {
// Adjust saved base pointer if there is one.
// TODO what about arm64 frame pointer adjustment?
- if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*sys.RegSize {
+ if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*sys.PtrSize {
if stackDebug >= 3 {
print(" saved bp\n")
}
@@ -1089,7 +1089,7 @@ func nilfunc() {
}
// adjust Gobuf as if it executed a call to fn
-// and then did an immediate gosave.
+// and then stopped before the first instruction in fn.
func gostartcallfn(gobuf *gobuf, fv *funcval) {
var fn unsafe.Pointer
if fv != nil {
@@ -1245,7 +1245,7 @@ func getStackMap(frame *stkframe, cache *pcvalueCache, debug bool) (locals, args
var minsize uintptr
switch sys.ArchFamily {
case sys.ARM64:
- minsize = sys.SpAlign
+ minsize = sys.StackAlign
default:
minsize = sys.MinFrameSize
}
diff --git a/src/runtime/stubs.go b/src/runtime/stubs.go
index 2ee2c74dfe..b9b313a711 100644
--- a/src/runtime/stubs.go
+++ b/src/runtime/stubs.go
@@ -4,7 +4,10 @@
package runtime
-import "unsafe"
+import (
+ "internal/abi"
+ "unsafe"
+)
// Should be a built-in for unsafe.Pointer?
//go:nosplit
@@ -166,8 +169,8 @@ func noescape(p unsafe.Pointer) unsafe.Pointer {
// This in turn calls cgocallbackg, which is where we'll find
// pointer-declared arguments.
func cgocallback(fn, frame, ctxt uintptr)
+
func gogo(buf *gobuf)
-func gosave(buf *gobuf)
//go:noescape
func jmpdefer(fv *funcval, argp uintptr)
@@ -175,19 +178,50 @@ func asminit()
func setg(gg *g)
func breakpoint()
-// reflectcall calls fn with a copy of the n argument bytes pointed at by arg.
-// After fn returns, reflectcall copies n-retoffset result bytes
-// back into arg+retoffset before returning. If copying result bytes back,
-// the caller should pass the argument frame type as argtype, so that
-// call can execute appropriate write barriers during the copy.
+// reflectcall calls fn with arguments described by stackArgs, stackArgsSize,
+// frameSize, and regArgs.
+//
+// Arguments passed on the stack and space for return values passed on the stack
+// must be laid out at the space pointed to by stackArgs (with total length
+// stackArgsSize) according to the ABI.
+//
+// stackRetOffset must be some value <= stackArgsSize that indicates the
+// offset within stackArgs where the return value space begins.
+//
+// frameSize is the total size of the argument frame at stackArgs and must
+// therefore be >= stackArgsSize. It must include additional space for spilling
+// register arguments for stack growth and preemption.
+//
+// TODO(mknyszek): Once we don't need the additional spill space, remove frameSize,
+// since frameSize will be redundant with stackArgsSize.
+//
+// Arguments passed in registers must be laid out in regArgs according to the ABI.
+// regArgs will hold any return values passed in registers after the call.
//
-// Package reflect always passes a frame type. In package runtime,
-// Windows callbacks are the only use of this that copies results
-// back, and those cannot have pointers in their results, so runtime
-// passes nil for the frame type.
+// reflectcall copies stack arguments from stackArgs to the goroutine stack, and
+// then copies back stackArgsSize-stackRetOffset bytes back to the return space
+// in stackArgs once fn has completed. It also "unspills" argument registers from
+// regArgs before calling fn, and spills them back into regArgs immediately
+// following the call to fn. If there are results being returned on the stack,
+// the caller should pass the argument frame type as stackArgsType so that
+// reflectcall can execute appropriate write barriers during the copy.
+//
+// reflectcall expects regArgs.ReturnIsPtr to be populated indicating which
+// registers on the return path will contain Go pointers. It will then store
+// these pointers in regArgs.Ptrs such that they are visible to the GC.
+//
+// Package reflect passes a frame type. In package runtime, there is only
+// one call that copies results back, in callbackWrap in syscall_windows.go, and it
+// does NOT pass a frame type, meaning there are no write barriers invoked. See that
+// call site for justification.
//
// Package reflect accesses this symbol through a linkname.
-func reflectcall(argtype *_type, fn, arg unsafe.Pointer, argsize uint32, retoffset uint32)
+//
+// Arguments passed through to reflectcall do not escape. The type is used
+// only in a very limited callee of reflectcall, the stackArgs are copied, and
+// regArgs is only used in the reflectcall frame.
+//go:noescape
+func reflectcall(stackArgsType *_type, fn, stackArgs unsafe.Pointer, stackArgsSize, stackRetOffset, frameSize uint32, regArgs *abi.RegArgs)
func procyield(cycles uint32)
@@ -357,3 +391,7 @@ func duffcopy()
// Called from linker-generated .initarray; declared for go vet; do NOT call from Go.
func addmoduledata()
+
+// Injected by the signal handler for panicking signals. On many platforms it just
+// jumps to sigpanic.
+func sigpanic0()
diff --git a/src/runtime/stubs2.go b/src/runtime/stubs2.go
index 85088b3ab9..525b324c81 100644
--- a/src/runtime/stubs2.go
+++ b/src/runtime/stubs2.go
@@ -2,13 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !aix
-// +build !darwin
-// +build !js
-// +build !openbsd
-// +build !plan9
-// +build !solaris
-// +build !windows
+//go:build !aix && !darwin && !js && !openbsd && !plan9 && !solaris && !windows
+// +build !aix,!darwin,!js,!openbsd,!plan9,!solaris,!windows
package runtime
@@ -23,6 +18,11 @@ func closefd(fd int32) int32
func exit(code int32)
func usleep(usec uint32)
+//go:nosplit
+func usleep_no_g(usec uint32) {
+ usleep(usec)
+}
+
// write calls the write system call.
// It returns a non-negative number of bytes written or a negative errno value.
//go:noescape
diff --git a/src/runtime/stubs3.go b/src/runtime/stubs3.go
index 1885d32051..b895be4c70 100644
--- a/src/runtime/stubs3.go
+++ b/src/runtime/stubs3.go
@@ -2,12 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !aix
-// +build !darwin
-// +build !freebsd
-// +build !openbsd
-// +build !plan9
-// +build !solaris
+//go:build !aix && !darwin && !freebsd && !openbsd && !plan9 && !solaris
+// +build !aix,!darwin,!freebsd,!openbsd,!plan9,!solaris
package runtime
diff --git a/src/runtime/stubs_386.go b/src/runtime/stubs_386.go
index 5108294d83..300f167fff 100644
--- a/src/runtime/stubs_386.go
+++ b/src/runtime/stubs_386.go
@@ -15,3 +15,6 @@ func stackcheck()
// Called from assembly only; declared for go vet.
func setldt(slot uintptr, base unsafe.Pointer, size uintptr)
func emptyfunc()
+
+//go:noescape
+func asmcgocall_no_g(fn, arg unsafe.Pointer)
diff --git a/src/runtime/stubs_amd64.go b/src/runtime/stubs_amd64.go
index 8c14bc2271..bf98493e9d 100644
--- a/src/runtime/stubs_amd64.go
+++ b/src/runtime/stubs_amd64.go
@@ -4,6 +4,8 @@
package runtime
+import "unsafe"
+
// Called from compiled code; declared for vet; do NOT call from Go.
func gcWriteBarrierCX()
func gcWriteBarrierDX()
@@ -35,3 +37,6 @@ func retpolineR12()
func retpolineR13()
func retpolineR14()
func retpolineR15()
+
+//go:noescape
+func asmcgocall_no_g(fn, arg unsafe.Pointer)
diff --git a/src/runtime/stubs_arm.go b/src/runtime/stubs_arm.go
index c13bf16de2..52c32937ae 100644
--- a/src/runtime/stubs_arm.go
+++ b/src/runtime/stubs_arm.go
@@ -4,6 +4,8 @@
package runtime
+import "unsafe"
+
// Called from compiler-generated code; declared for go vet.
func udiv()
func _div()
@@ -18,3 +20,6 @@ func save_g()
func emptyfunc()
func _initcgo()
func read_tls_fallback()
+
+//go:noescape
+func asmcgocall_no_g(fn, arg unsafe.Pointer)
diff --git a/src/runtime/stubs_arm64.go b/src/runtime/stubs_arm64.go
index 44c566e602..f5e3bb4854 100644
--- a/src/runtime/stubs_arm64.go
+++ b/src/runtime/stubs_arm64.go
@@ -4,6 +4,13 @@
package runtime
+import "unsafe"
+
// Called from assembly only; declared for go vet.
func load_g()
func save_g()
+
+//go:noescape
+func asmcgocall_no_g(fn, arg unsafe.Pointer)
+
+func emptyfunc()
diff --git a/src/runtime/stubs_linux.go b/src/runtime/stubs_linux.go
index e75fcf6c95..ba267009ca 100644
--- a/src/runtime/stubs_linux.go
+++ b/src/runtime/stubs_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package runtime
diff --git a/src/runtime/stubs_mips64x.go b/src/runtime/stubs_mips64x.go
index 4e62c1ce90..05a4d0d38d 100644
--- a/src/runtime/stubs_mips64x.go
+++ b/src/runtime/stubs_mips64x.go
@@ -2,10 +2,16 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips64 || mips64le
// +build mips64 mips64le
package runtime
+import "unsafe"
+
// Called from assembly only; declared for go vet.
func load_g()
func save_g()
+
+//go:noescape
+func asmcgocall_no_g(fn, arg unsafe.Pointer)
diff --git a/src/runtime/stubs_mipsx.go b/src/runtime/stubs_mipsx.go
index 707b295f7a..9bffb35b67 100644
--- a/src/runtime/stubs_mipsx.go
+++ b/src/runtime/stubs_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips || mipsle
// +build mips mipsle
package runtime
diff --git a/src/runtime/stubs_nonlinux.go b/src/runtime/stubs_nonlinux.go
index e1ea05cf0b..f9b98595fc 100644
--- a/src/runtime/stubs_nonlinux.go
+++ b/src/runtime/stubs_nonlinux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !linux
// +build !linux
package runtime
diff --git a/src/runtime/stubs_ppc64x.go b/src/runtime/stubs_ppc64x.go
index 26f5bb20ca..0841b413fd 100644
--- a/src/runtime/stubs_ppc64x.go
+++ b/src/runtime/stubs_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package runtime
diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go
index 7667f23f1d..00f802aaa7 100644
--- a/src/runtime/symtab.go
+++ b/src/runtime/symtab.go
@@ -308,30 +308,53 @@ type funcID uint8
const (
funcID_normal funcID = iota // not a special function
- funcID_runtime_main
+ funcID_asmcgocall
+ funcID_asyncPreempt
+ funcID_cgocallback
+ funcID_debugCallV1
+ funcID_externalthreadhandler
+ funcID_gcBgMarkWorker
funcID_goexit
+ funcID_gogo
+ funcID_gopanic
+ funcID_handleAsyncEvent
funcID_jmpdefer
funcID_mcall
funcID_morestack
funcID_mstart
+ funcID_panicwrap
funcID_rt0_go
- funcID_asmcgocall
- funcID_sigpanic
funcID_runfinq
- funcID_gcBgMarkWorker
- funcID_systemstack_switch
+ funcID_runtime_main
+ funcID_sigpanic
funcID_systemstack
- funcID_cgocallback
- funcID_gogo
- funcID_externalthreadhandler
- funcID_debugCallV1
- funcID_gopanic
- funcID_panicwrap
- funcID_handleAsyncEvent
- funcID_asyncPreempt
+ funcID_systemstack_switch
funcID_wrapper // any autogenerated code (hash/eq algorithms, method wrappers, etc.)
)
+// A FuncFlag holds bits about a function.
+// This list must match the list in cmd/internal/objabi/funcid.go.
+type funcFlag uint8
+
+const (
+ // TOPFRAME indicates a function that appears at the top of its stack.
+ // The traceback routine stop at such a function and consider that a
+ // successful, complete traversal of the stack.
+ // Examples of TOPFRAME functions include goexit, which appears
+ // at the top of a user goroutine stack, and mstart, which appears
+ // at the top of a system goroutine stack.
+ funcFlag_TOPFRAME funcFlag = 1 << iota
+
+ // SPWRITE indicates a function that writes an arbitrary value to SP
+ // (any write other than adding or subtracting a constant amount).
+ // The traceback routines cannot encode such changes into the
+ // pcsp tables, so the function traceback cannot safely unwind past
+ // SPWRITE functions. Stopping at an SPWRITE function is considered
+ // to be an incomplete unwinding of the stack. In certain contexts
+ // (in particular garbage collector stack scans) that is a fatal error.
+ funcFlag_SPWRITE
+)
+
// pcHeader holds data used by the pclntab lookups.
type pcHeader struct {
magic uint32 // 0xFFFFFFFA
diff --git a/src/runtime/sys_darwin.go b/src/runtime/sys_darwin.go
index 4a3f2fc453..4ae259ac63 100644
--- a/src/runtime/sys_darwin.go
+++ b/src/runtime/sys_darwin.go
@@ -27,7 +27,7 @@ func syscall()
//go:nosplit
//go:cgo_unsafe_args
func syscall_syscallX(fn, a1, a2, a3 uintptr) (r1, r2, err uintptr) {
- entersyscallblock()
+ entersyscall()
libcCall(unsafe.Pointer(funcPC(syscallX)), unsafe.Pointer(&fn))
exitsyscall()
return
@@ -229,6 +229,12 @@ func usleep_trampoline()
//go:nosplit
//go:cgo_unsafe_args
+func usleep_no_g(usec uint32) {
+ asmcgocall_no_g(unsafe.Pointer(funcPC(usleep_trampoline)), unsafe.Pointer(&usec))
+}
+
+//go:nosplit
+//go:cgo_unsafe_args
func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
return libcCall(unsafe.Pointer(funcPC(write_trampoline)), unsafe.Pointer(&fd))
}
diff --git a/src/runtime/sys_darwin_amd64.s b/src/runtime/sys_darwin_amd64.s
index 630fb5df64..0fe8c7e172 100644
--- a/src/runtime/sys_darwin_amd64.s
+++ b/src/runtime/sys_darwin_amd64.s
@@ -5,6 +5,8 @@
// System calls and other sys.stuff for AMD64, Darwin
// System calls are implemented in libSystem, this file contains
// trampolines that convert from Go to C calling convention.
+// The trampolines are ABIInternal as they are referenced from
+// Go code with funcPC.
#include "go_asm.h"
#include "go_tls.h"
@@ -13,7 +15,7 @@
#define CLOCK_REALTIME 0
// Exit the entire program (like C exit)
-TEXT runtime·exit_trampoline(SB),NOSPLIT,$0
+TEXT runtime·exit_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 exit status
@@ -22,7 +24,7 @@ TEXT runtime·exit_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·open_trampoline(SB),NOSPLIT,$0
+TEXT runtime·open_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 8(DI), SI // arg 2 flags
@@ -33,7 +35,7 @@ TEXT runtime·open_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·close_trampoline(SB),NOSPLIT,$0
+TEXT runtime·close_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 fd
@@ -41,7 +43,7 @@ TEXT runtime·close_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·read_trampoline(SB),NOSPLIT,$0
+TEXT runtime·read_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 buf
@@ -57,7 +59,7 @@ noerr:
POPQ BP
RET
-TEXT runtime·write_trampoline(SB),NOSPLIT,$0
+TEXT runtime·write_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 buf
@@ -73,7 +75,7 @@ noerr:
POPQ BP
RET
-TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pipe_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
CALL libc_pipe(SB) // pointer already in DI
@@ -84,7 +86,7 @@ TEXT runtime·pipe_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0
+TEXT runtime·setitimer_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 new
@@ -94,7 +96,7 @@ TEXT runtime·setitimer_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0
+TEXT runtime·madvise_trampoline<ABIInternal>(SB), NOSPLIT, $0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 len
@@ -105,12 +107,12 @@ TEXT runtime·madvise_trampoline(SB), NOSPLIT, $0
POPQ BP
RET
-TEXT runtime·mlock_trampoline(SB), NOSPLIT, $0
+TEXT runtime·mlock_trampoline<ABIInternal>(SB), NOSPLIT, $0
UNDEF // unimplemented
GLOBL timebase<>(SB),NOPTR,$(machTimebaseInfo__size)
-TEXT runtime·nanotime_trampoline(SB),NOSPLIT,$0
+TEXT runtime·nanotime_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ DI, BX
@@ -139,7 +141,7 @@ initialized:
POPQ BP
RET
-TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0
+TEXT runtime·walltime_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP // make a frame; keep stack aligned
MOVQ SP, BP
MOVQ DI, SI // arg 2 timespec
@@ -148,7 +150,7 @@ TEXT runtime·walltime_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0
+TEXT runtime·sigaction_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 new
@@ -161,7 +163,7 @@ TEXT runtime·sigaction_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0
+TEXT runtime·sigprocmask_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 new
@@ -174,7 +176,7 @@ TEXT runtime·sigprocmask_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0
+TEXT runtime·sigaltstack_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 old
@@ -186,7 +188,7 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·raiseproc_trampoline(SB),NOSPLIT,$0
+TEXT runtime·raiseproc_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), BX // signal
@@ -212,7 +214,7 @@ TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
// This is the function registered during sigaction and is invoked when
// a signal is received. It just redirects to the Go function sigtrampgo.
-TEXT runtime·sigtramp(SB),NOSPLIT,$0
+TEXT runtime·sigtramp<ABIInternal>(SB),NOSPLIT,$0
// This runs on the signal stack, so we have lots of stack available.
// We allocate our own stack space, because if we tell the linker
// how much we're using, the NOSPLIT check fails.
@@ -246,7 +248,7 @@ TEXT runtime·sigtramp(SB),NOSPLIT,$0
// Used instead of sigtramp in programs that use cgo.
// Arguments from kernel are in DI, SI, DX.
-TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
+TEXT runtime·cgoSigtramp<ABIInternal>(SB),NOSPLIT,$0
// If no traceback function, do usual sigtramp.
MOVQ runtime·cgoTraceback(SB), AX
TESTQ AX, AX
@@ -289,12 +291,12 @@ TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
// The first three arguments, and the fifth, are already in registers.
// Set the two remaining arguments now.
MOVQ runtime·cgoTraceback(SB), CX
- MOVQ $runtime·sigtramp(SB), R9
+ MOVQ $runtime·sigtramp<ABIInternal>(SB), R9
MOVQ _cgo_callers(SB), AX
JMP AX
sigtramp:
- JMP runtime·sigtramp(SB)
+ JMP runtime·sigtramp<ABIInternal>(SB)
sigtrampnog:
// Signal arrived on a non-Go thread. If this is SIGPROF, get a
@@ -320,7 +322,7 @@ sigtrampnog:
MOVQ _cgo_callers(SB), AX
JMP AX
-TEXT runtime·mmap_trampoline(SB),NOSPLIT,$0
+TEXT runtime·mmap_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP // make a frame; keep stack aligned
MOVQ SP, BP
MOVQ DI, BX
@@ -343,7 +345,7 @@ ok:
POPQ BP
RET
-TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0
+TEXT runtime·munmap_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 len
@@ -355,7 +357,7 @@ TEXT runtime·munmap_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·usleep_trampoline(SB),NOSPLIT,$0
+TEXT runtime·usleep_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 usec
@@ -367,7 +369,7 @@ TEXT runtime·settls(SB),NOSPLIT,$32
// Nothing to do on Darwin, pthread already set thread-local storage up.
RET
-TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0
+TEXT runtime·sysctl_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 8(DI), SI // arg 2 miblen
@@ -380,7 +382,7 @@ TEXT runtime·sysctl_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0
+TEXT runtime·sysctlbyname_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 oldp
@@ -392,14 +394,14 @@ TEXT runtime·sysctlbyname_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·kqueue_trampoline(SB),NOSPLIT,$0
+TEXT runtime·kqueue_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
CALL libc_kqueue(SB)
POPQ BP
RET
-TEXT runtime·kevent_trampoline(SB),NOSPLIT,$0
+TEXT runtime·kevent_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 keventt
@@ -418,7 +420,7 @@ ok:
POPQ BP
RET
-TEXT runtime·fcntl_trampoline(SB),NOSPLIT,$0
+TEXT runtime·fcntl_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 4(DI), SI // arg 2 cmd
@@ -475,7 +477,7 @@ TEXT runtime·mstart_stub(SB),NOSPLIT,$0
// A pointer to the arguments is passed in DI.
// A single int32 result is returned in AX.
// (For more results, make an args/results structure.)
-TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_init_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP // make frame, keep stack 16-byte aligned.
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 attr
@@ -483,7 +485,7 @@ TEXT runtime·pthread_attr_init_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_getstacksize_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 size
@@ -492,7 +494,7 @@ TEXT runtime·pthread_attr_getstacksize_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_attr_setdetachstate_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 state
@@ -501,7 +503,7 @@ TEXT runtime·pthread_attr_setdetachstate_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_create_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
@@ -514,7 +516,7 @@ TEXT runtime·pthread_create_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
+TEXT runtime·raise_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVL 0(DI), DI // arg 1 signal
@@ -522,7 +524,7 @@ TEXT runtime·raise_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_mutex_init_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 attr
@@ -531,7 +533,7 @@ TEXT runtime·pthread_mutex_init_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_mutex_lock_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 mutex
@@ -539,7 +541,7 @@ TEXT runtime·pthread_mutex_lock_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_mutex_unlock_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 mutex
@@ -547,7 +549,7 @@ TEXT runtime·pthread_mutex_unlock_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_cond_init_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 attr
@@ -556,7 +558,7 @@ TEXT runtime·pthread_cond_init_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_cond_wait_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 mutex
@@ -565,7 +567,7 @@ TEXT runtime·pthread_cond_wait_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_cond_timedwait_relative_np_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 mutex
@@ -575,7 +577,7 @@ TEXT runtime·pthread_cond_timedwait_relative_np_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_cond_signal_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 0(DI), DI // arg 1 cond
@@ -583,7 +585,7 @@ TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_self_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ DI, BX // BX is caller-save
@@ -592,7 +594,7 @@ TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0
POPQ BP
RET
-TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0
+TEXT runtime·pthread_kill_trampoline<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
MOVQ 8(DI), SI // arg 2 sig
@@ -617,7 +619,7 @@ TEXT runtime·pthread_kill_trampoline(SB),NOSPLIT,$0
//
// syscall expects a 32-bit result and tests for 32-bit -1
// to decide there was an error.
-TEXT runtime·syscall(SB),NOSPLIT,$0
+TEXT runtime·syscall<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
@@ -667,7 +669,7 @@ ok:
//
// syscallX is like syscall but expects a 64-bit result
// and tests for 64-bit -1 to decide there was an error.
-TEXT runtime·syscallX(SB),NOSPLIT,$0
+TEXT runtime·syscallX<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
@@ -703,7 +705,7 @@ ok:
// syscallPtr is like syscallX except that the libc function reports an
// error by returning NULL and setting errno.
-TEXT runtime·syscallPtr(SB),NOSPLIT,$0
+TEXT runtime·syscallPtr<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
@@ -756,7 +758,7 @@ ok:
//
// syscall6 expects a 32-bit result and tests for 32-bit -1
// to decide there was an error.
-TEXT runtime·syscall6(SB),NOSPLIT,$0
+TEXT runtime·syscall6<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
@@ -809,7 +811,7 @@ ok:
//
// syscall6X is like syscall6 but expects a 64-bit result
// and tests for 64-bit -1 to decide there was an error.
-TEXT runtime·syscall6X(SB),NOSPLIT,$0
+TEXT runtime·syscall6X<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
@@ -845,7 +847,7 @@ ok:
// syscallNoErr is like syscall6 but does not check for errors, and
// only returns one value, for use with standard C ABI library functions.
-TEXT runtime·syscallNoErr(SB),NOSPLIT,$0
+TEXT runtime·syscallNoErr<ABIInternal>(SB),NOSPLIT,$0
PUSHQ BP
MOVQ SP, BP
SUBQ $16, SP
diff --git a/src/runtime/sys_dragonfly_amd64.s b/src/runtime/sys_dragonfly_amd64.s
index 580633af55..9cb268d740 100644
--- a/src/runtime/sys_dragonfly_amd64.s
+++ b/src/runtime/sys_dragonfly_amd64.s
@@ -123,6 +123,24 @@ pipeok:
MOVL $0, errno+8(FP)
RET
+// func pipe2(flags int32) (r, w int32, errno int32)
+TEXT runtime·pipe2(SB),NOSPLIT,$0-20
+ MOVL $0, DI
+ // dragonfly expects flags as the 2nd argument
+ MOVL flags+0(FP), SI
+ MOVL $538, AX
+ SYSCALL
+ JCC pipe2ok
+ MOVL $-1,r+8(FP)
+ MOVL $-1,w+12(FP)
+ MOVL AX, errno+16(FP)
+ RET
+pipe2ok:
+ MOVL AX, r+8(FP)
+ MOVL DX, w+12(FP)
+ MOVL $0, errno+16(FP)
+ RET
+
TEXT runtime·write1(SB),NOSPLIT,$-8
MOVQ fd+0(FP), DI // arg 1 fd
MOVQ p+8(FP), SI // arg 2 buf
diff --git a/src/runtime/sys_libc.go b/src/runtime/sys_libc.go
index 996c032105..99d073517b 100644
--- a/src/runtime/sys_libc.go
+++ b/src/runtime/sys_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || (openbsd && amd64) || (openbsd && arm64)
// +build darwin openbsd,amd64 openbsd,arm64
package runtime
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s
index 37cb8dad03..d48573c2c5 100644
--- a/src/runtime/sys_linux_amd64.s
+++ b/src/runtime/sys_linux_amd64.s
@@ -215,9 +215,13 @@ TEXT runtime·walltime1(SB),NOSPLIT,$16-12
MOVQ SP, R12 // Save old SP; R12 unchanged by C code.
+#ifdef GOEXPERIMENT_REGABI
+ MOVQ g_m(R14), BX // BX unchanged by C code.
+#else
get_tls(CX)
MOVQ g(CX), AX
MOVQ g_m(AX), BX // BX unchanged by C code.
+#endif
// Set vdsoPC and vdsoSP for SIGPROF traceback.
// Save the old values on stack and restore them on exit,
@@ -232,7 +236,11 @@ TEXT runtime·walltime1(SB),NOSPLIT,$16-12
MOVQ CX, m_vdsoPC(BX)
MOVQ DX, m_vdsoSP(BX)
+#ifdef GOEXPERIMENT_REGABI
+ CMPQ R14, m_curg(BX) // Only switch if on curg.
+#else
CMPQ AX, m_curg(BX) // Only switch if on curg.
+#endif
JNE noswitch
MOVQ m_g0(BX), DX
@@ -275,9 +283,13 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$16-8
MOVQ SP, R12 // Save old SP; R12 unchanged by C code.
+#ifdef GOEXPERIMENT_REGABI
+ MOVQ g_m(R14), BX // BX unchanged by C code.
+#else
get_tls(CX)
MOVQ g(CX), AX
MOVQ g_m(AX), BX // BX unchanged by C code.
+#endif
// Set vdsoPC and vdsoSP for SIGPROF traceback.
// Save the old values on stack and restore them on exit,
@@ -292,7 +304,11 @@ TEXT runtime·nanotime1(SB),NOSPLIT,$16-8
MOVQ CX, m_vdsoPC(BX)
MOVQ DX, m_vdsoSP(BX)
+#ifdef GOEXPERIMENT_REGABI
+ CMPQ R14, m_curg(BX) // Only switch if on curg.
+#else
CMPQ AX, m_curg(BX) // Only switch if on curg.
+#endif
JNE noswitch
MOVQ m_g0(BX), DX
@@ -632,6 +648,7 @@ nog1:
get_tls(CX)
MOVQ R13, g_m(R9)
MOVQ R9, g(CX)
+ MOVQ R9, R14 // set g register
CALL runtime·stackcheck(SB)
nog2:
diff --git a/src/runtime/sys_mips64x.go b/src/runtime/sys_mips64x.go
index cb429c3147..842a4a7084 100644
--- a/src/runtime/sys_mips64x.go
+++ b/src/runtime/sys_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips64 || mips64le
// +build mips64 mips64le
package runtime
diff --git a/src/runtime/sys_mipsx.go b/src/runtime/sys_mipsx.go
index 2819218d5f..2038eb7d79 100644
--- a/src/runtime/sys_mipsx.go
+++ b/src/runtime/sys_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build mips || mipsle
// +build mips mipsle
package runtime
diff --git a/src/runtime/sys_nonppc64x.go b/src/runtime/sys_nonppc64x.go
index 440937498f..66821b1f76 100644
--- a/src/runtime/sys_nonppc64x.go
+++ b/src/runtime/sys_nonppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !ppc64 && !ppc64le
// +build !ppc64,!ppc64le
package runtime
diff --git a/src/runtime/sys_openbsd.go b/src/runtime/sys_openbsd.go
index fcddf4d6a5..362fa777ef 100644
--- a/src/runtime/sys_openbsd.go
+++ b/src/runtime/sys_openbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,amd64 openbsd,arm64
package runtime
diff --git a/src/runtime/sys_openbsd1.go b/src/runtime/sys_openbsd1.go
index e2886218db..43e0058985 100644
--- a/src/runtime/sys_openbsd1.go
+++ b/src/runtime/sys_openbsd1.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,amd64 openbsd,arm64
package runtime
@@ -27,6 +28,11 @@ func osyield() {
}
func sched_yield_trampoline()
+//go:nosplit
+func osyield_no_g() {
+ asmcgocall_no_g(unsafe.Pointer(funcPC(sched_yield_trampoline)), unsafe.Pointer(nil))
+}
+
//go:cgo_import_dynamic libc_thrsleep __thrsleep "libc.so"
//go:cgo_import_dynamic libc_thrwakeup __thrwakeup "libc.so"
//go:cgo_import_dynamic libc_sched_yield sched_yield "libc.so"
diff --git a/src/runtime/sys_openbsd2.go b/src/runtime/sys_openbsd2.go
index 474e7145e7..73157043be 100644
--- a/src/runtime/sys_openbsd2.go
+++ b/src/runtime/sys_openbsd2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,amd64 openbsd,arm64
package runtime
@@ -130,6 +131,12 @@ func usleep_trampoline()
//go:nosplit
//go:cgo_unsafe_args
+func usleep_no_g(usec uint32) {
+ asmcgocall_no_g(unsafe.Pointer(funcPC(usleep_trampoline)), unsafe.Pointer(&usec))
+}
+
+//go:nosplit
+//go:cgo_unsafe_args
func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32 {
return libcCall(unsafe.Pointer(funcPC(sysctl_trampoline)), unsafe.Pointer(&mib))
}
diff --git a/src/runtime/sys_openbsd3.go b/src/runtime/sys_openbsd3.go
index 4d4c88e3ac..751c00c2b3 100644
--- a/src/runtime/sys_openbsd3.go
+++ b/src/runtime/sys_openbsd3.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,amd64 openbsd,arm64
package runtime
diff --git a/src/runtime/sys_ppc64x.go b/src/runtime/sys_ppc64x.go
index 796f27c4e3..69bd99fa09 100644
--- a/src/runtime/sys_ppc64x.go
+++ b/src/runtime/sys_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ppc64 || ppc64le
// +build ppc64 ppc64le
package runtime
diff --git a/src/runtime/sys_wasm.go b/src/runtime/sys_wasm.go
index 9bf710ba0e..057ed4ccd9 100644
--- a/src/runtime/sys_wasm.go
+++ b/src/runtime/sys_wasm.go
@@ -27,13 +27,9 @@ func wasmTruncU()
func wasmExit(code int32)
// adjust Gobuf as it if executed a call to fn with context ctxt
-// and then did an immediate gosave.
+// and then stopped before the first instruction in fn.
func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
sp := buf.sp
- if sys.RegSize > sys.PtrSize {
- sp -= sys.PtrSize
- *(*uintptr)(unsafe.Pointer(sp)) = 0
- }
sp -= sys.PtrSize
*(*uintptr)(unsafe.Pointer(sp)) = buf.pc
buf.sp = sp
diff --git a/src/runtime/sys_windows_386.s b/src/runtime/sys_windows_386.s
index ef8a3dd3c2..4f00c58c16 100644
--- a/src/runtime/sys_windows_386.s
+++ b/src/runtime/sys_windows_386.s
@@ -66,11 +66,6 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0
MOVL AX, ret+0(FP)
RET
-TEXT runtime·setlasterror(SB),NOSPLIT,$0
- MOVL err+0(FP), AX
- MOVL AX, 0x34(FS)
- RET
-
// Called by Windows as a Vectored Exception Handler (VEH).
// First argument is pointer to struct containing
// exception record and context pointers.
@@ -99,7 +94,7 @@ TEXT sigtramp<>(SB),NOSPLIT,$0-0
JNE 2(PC)
CALL runtime·badsignal2(SB)
- // save g and SP in case of stack switch
+ // save g in case of stack switch
MOVL DX, 32(SP) // g
MOVL SP, 36(SP)
@@ -113,13 +108,9 @@ TEXT sigtramp<>(SB),NOSPLIT,$0-0
get_tls(BP)
MOVL BX, g(BP)
MOVL (g_sched+gobuf_sp)(BX), DI
- // make it look like mstart called us on g0, to stop traceback
- SUBL $4, DI
- MOVL $runtime·mstart(SB), 0(DI)
- // traceback will think that we've done SUBL
- // on this stack, so subtract them here to match.
- // (we need room for sighandler arguments anyway).
+ // make room for sighandler arguments
// and re-save old SP for restoring later.
+ // (note that the 36(DI) here must match the 36(SP) above.)
SUBL $40, DI
MOVL SP, 36(DI)
MOVL DI, SP
@@ -137,7 +128,7 @@ g0:
// switch back to original stack and g
// no-op if we never left.
MOVL 36(SP), SP
- MOVL 32(SP), DX
+ MOVL 32(SP), DX // note: different SP
get_tls(BP)
MOVL DX, g(BP)
@@ -183,7 +174,7 @@ TEXT runtime·profileloop(SB),NOSPLIT,$0
ADDL $12, SP
JMP CX
-TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
+TEXT runtime·externalthreadhandler(SB),NOSPLIT|TOPFRAME,$0
PUSHL BP
MOVL SP, BP
PUSHL BX
@@ -347,60 +338,11 @@ TEXT runtime·setldt(SB),NOSPLIT,$0
MOVL CX, 0x14(FS)
RET
-// onosstack calls fn on OS stack.
-// func onosstack(fn unsafe.Pointer, arg uint32)
-TEXT runtime·onosstack(SB),NOSPLIT,$0
- MOVL fn+0(FP), AX // to hide from 8l
- MOVL arg+4(FP), BX
-
- // Execute call on m->g0 stack, in case we are not actually
- // calling a system call wrapper, like when running under WINE.
- get_tls(CX)
- CMPL CX, $0
- JNE 3(PC)
- // Not a Go-managed thread. Do not switch stack.
- CALL AX
- RET
-
- MOVL g(CX), BP
- MOVL g_m(BP), BP
-
- // leave pc/sp for cpu profiler
- MOVL (SP), SI
- MOVL SI, m_libcallpc(BP)
- MOVL g(CX), SI
- MOVL SI, m_libcallg(BP)
- // sp must be the last, because once async cpu profiler finds
- // all three values to be non-zero, it will use them
- LEAL fn+0(FP), SI
- MOVL SI, m_libcallsp(BP)
-
- MOVL m_g0(BP), SI
- CMPL g(CX), SI
- JNE switch
- // executing on m->g0 already
- CALL AX
- JMP ret
-
-switch:
- // Switch to m->g0 stack and back.
- MOVL (g_sched+gobuf_sp)(SI), SI
- MOVL SP, -4(SI)
- LEAL -4(SI), SP
- CALL AX
- MOVL 0(SP), SP
-
-ret:
- get_tls(CX)
- MOVL g(CX), BP
- MOVL g_m(BP), BP
- MOVL $0, m_libcallsp(BP)
- RET
-
-// Runs on OS stack. duration (in 100ns units) is in BX.
-TEXT runtime·usleep2(SB),NOSPLIT,$20
- // Want negative 100ns units.
- NEGL BX
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g may be nil.
+TEXT runtime·usleep2(SB),NOSPLIT,$20-4
+ MOVL dt+0(FP), BX
MOVL $-1, hi-4(SP)
MOVL BX, lo-8(SP)
LEAL lo-8(SP), BX
@@ -413,17 +355,15 @@ TEXT runtime·usleep2(SB),NOSPLIT,$20
MOVL BP, SP
RET
-// Runs on OS stack. duration (in 100ns units) is in BX.
-TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36
- get_tls(CX)
- CMPL CX, $0
- JE gisnotset
-
- // Want negative 100ns units.
- NEGL BX
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g is valid.
+TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36-4
+ MOVL dt+0(FP), BX
MOVL $-1, hi-4(SP)
MOVL BX, lo-8(SP)
+ get_tls(CX)
MOVL g(CX), CX
MOVL g_m(CX), CX
MOVL (m_mOS+mOS_highResTimer)(CX), CX
@@ -452,12 +392,6 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT,$36
RET
-gisnotset:
- // TLS is not configured. Call usleep2 instead.
- MOVL $runtime·usleep2(SB), AX
- CALL AX
- RET
-
// Runs on OS stack.
TEXT runtime·switchtothread(SB),NOSPLIT,$0
MOVL SP, BP
diff --git a/src/runtime/sys_windows_amd64.s b/src/runtime/sys_windows_amd64.s
index d1690cad58..aba2811e59 100644
--- a/src/runtime/sys_windows_amd64.s
+++ b/src/runtime/sys_windows_amd64.s
@@ -103,12 +103,6 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0
MOVL AX, ret+0(FP)
RET
-TEXT runtime·setlasterror(SB),NOSPLIT,$0
- MOVL err+0(FP), AX
- MOVQ 0x30(GS), CX
- MOVL AX, 0x68(CX)
- RET
-
// Called by Windows as a Vectored Exception Handler (VEH).
// First argument is pointer to struct containing
// exception record and context pointers.
@@ -157,16 +151,10 @@ TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0-0
get_tls(BP)
MOVQ BX, g(BP)
MOVQ (g_sched+gobuf_sp)(BX), DI
- // make it look like mstart called us on g0, to stop traceback
- SUBQ $8, DI
- MOVQ $runtime·mstart(SB), SI
- MOVQ SI, 0(DI)
- // traceback will think that we've done PUSHFQ and SUBQ
- // on this stack, so subtract them here to match.
- // (we need room for sighandler arguments anyway).
+ // make room for sighandler arguments
// and re-save old SP for restoring later.
- SUBQ $(112+8), DI
- // save g, save old stack pointer.
+ // (note that the 104(DI) here must match the 104(SP) above.)
+ SUBQ $120, DI
MOVQ SP, 104(DI)
MOVQ DI, SP
@@ -227,7 +215,7 @@ TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$8
CALL runtime·externalthreadhandler(SB)
RET
-TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME,$0
+TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
PUSHQ BP
MOVQ SP, BP
PUSHQ BX
@@ -388,61 +376,16 @@ TEXT runtime·settls(SB),NOSPLIT,$0
MOVQ DI, 0x28(GS)
RET
-// func onosstack(fn unsafe.Pointer, arg uint32)
-TEXT runtime·onosstack(SB),NOSPLIT,$0
- MOVQ fn+0(FP), AX // to hide from 6l
- MOVL arg+8(FP), BX
-
- // Execute call on m->g0 stack, in case we are not actually
- // calling a system call wrapper, like when running under WINE.
- get_tls(R15)
- CMPQ R15, $0
- JNE 3(PC)
- // Not a Go-managed thread. Do not switch stack.
- CALL AX
- RET
-
- MOVQ g(R15), R13
- MOVQ g_m(R13), R13
-
- // leave pc/sp for cpu profiler
- MOVQ (SP), R12
- MOVQ R12, m_libcallpc(R13)
- MOVQ g(R15), R12
- MOVQ R12, m_libcallg(R13)
- // sp must be the last, because once async cpu profiler finds
- // all three values to be non-zero, it will use them
- LEAQ fn+0(FP), R12
- MOVQ R12, m_libcallsp(R13)
-
- MOVQ m_g0(R13), R14
- CMPQ g(R15), R14
- JNE switch
- // executing on m->g0 already
- CALL AX
- JMP ret
-
-switch:
- // Switch to m->g0 stack and back.
- MOVQ (g_sched+gobuf_sp)(R14), R14
- MOVQ SP, -8(R14)
- LEAQ -8(R14), SP
- CALL AX
- MOVQ 0(SP), SP
-
-ret:
- MOVQ $0, m_libcallsp(R13)
- RET
-
-// Runs on OS stack. duration (in 100ns units) is in BX.
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g may be nil.
// The function leaves room for 4 syscall parameters
// (as per windows amd64 calling convention).
-TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48
+TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48-4
+ MOVLQSX dt+0(FP), BX
MOVQ SP, AX
ANDQ $~15, SP // alignment as per Windows requirement
MOVQ AX, 40(SP)
- // Want negative 100ns units.
- NEGQ BX
LEAQ 32(SP), R8 // ptime
MOVQ BX, (R8)
MOVQ $-1, CX // handle
@@ -452,11 +395,11 @@ TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$48
MOVQ 40(SP), SP
RET
-// Runs on OS stack. duration (in 100ns units) is in BX.
-TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72
+// Runs on OS stack. duration (in -100ns units) is in dt+0(FP).
+// g is valid.
+TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72-4
+ MOVLQSX dt+0(FP), BX
get_tls(CX)
- CMPQ CX, $0
- JE gisnotset
MOVQ SP, AX
ANDQ $~15, SP // alignment as per Windows requirement
@@ -466,8 +409,6 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72
MOVQ g_m(CX), CX
MOVQ (m_mOS+mOS_highResTimer)(CX), CX // hTimer
MOVQ CX, 48(SP) // save hTimer for later
- // Want negative 100ns units.
- NEGQ BX
LEAQ 56(SP), DX // lpDueTime
MOVQ BX, (DX)
MOVQ $0, R8 // lPeriod
@@ -487,12 +428,6 @@ TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$72
MOVQ 64(SP), SP
RET
-gisnotset:
- // TLS is not configured. Call usleep2 instead.
- MOVQ $runtime·usleep2(SB), AX
- CALL AX
- RET
-
// Runs on OS stack.
TEXT runtime·switchtothread(SB),NOSPLIT|NOFRAME,$0
MOVQ SP, AX
diff --git a/src/runtime/sys_windows_arm.s b/src/runtime/sys_windows_arm.s
index fe267080cc..9a5d9b1dd4 100644
--- a/src/runtime/sys_windows_arm.s
+++ b/src/runtime/sys_windows_arm.s
@@ -6,6 +6,8 @@
#include "go_tls.h"
#include "textflag.h"
+// Note: For system ABI, R0-R3 are args, R4-R11 are callee-save.
+
// void runtime·asmstdcall(void *c);
TEXT runtime·asmstdcall(SB),NOSPLIT|NOFRAME,$0
MOVM.DB.W [R4, R5, R14], (R13) // push {r4, r5, lr}
@@ -103,11 +105,6 @@ TEXT runtime·getlasterror(SB),NOSPLIT,$0
MOVW R0, ret+0(FP)
RET
-TEXT runtime·setlasterror(SB),NOSPLIT|NOFRAME,$0
- MRC 15, 0, R1, C13, C0, 2
- MOVW R0, 0x34(R1)
- RET
-
// Called by Windows as a Vectored Exception Handler (VEH).
// First argument is pointer to struct containing
// exception record and context pointers.
@@ -144,11 +141,10 @@ TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
MOVW (g_sched+gobuf_sp)(g), R3 // R3 = g->gobuf.sp
BL runtime·save_g(SB)
- // traceback will think that we've done PUSH and SUB
- // on this stack, so subtract them here to match.
- // (we need room for sighandler arguments anyway).
+ // make room for sighandler arguments
// and re-save old SP for restoring later.
- SUB $(40+8+20), R3
+ // (note that the 24(R3) here must match the 24(R13) above.)
+ SUB $40, R3
MOVW R13, 24(R3) // save old stack pointer
MOVW R3, R13 // switch stack
@@ -156,21 +152,18 @@ g0:
MOVW 0(R6), R2 // R2 = ExceptionPointers->ExceptionRecord
MOVW 4(R6), R3 // R3 = ExceptionPointers->ContextRecord
- // make it look like mstart called us on g0, to stop traceback
- MOVW $runtime·mstart(SB), R4
-
- MOVW R4, 0(R13) // Save link register for traceback
+ MOVW $0, R4
+ MOVW R4, 0(R13) // No saved link register.
MOVW R2, 4(R13) // Move arg0 (ExceptionRecord) into position
MOVW R3, 8(R13) // Move arg1 (ContextRecord) into position
MOVW R5, 12(R13) // Move arg2 (original g) into position
BL (R7) // Call the go routine
MOVW 16(R13), R4 // Fetch return value from stack
- // Compute the value of the g0 stack pointer after deallocating
- // this frame, then allocating 8 bytes. We may need to store
- // the resume SP and PC on the g0 stack to work around
- // control flow guard when we resume from the exception.
- ADD $(40+20), R13, R12
+ // Save system stack pointer for sigresume setup below.
+ // The exact value does not matter - nothing is read or written
+ // from this address. It just needs to be on the system stack.
+ MOVW R13, R12
// switch back to original stack and g
MOVW 24(R13), R13
@@ -188,42 +181,45 @@ done:
BEQ return
// Check if we need to set up the control flow guard workaround.
- // On Windows/ARM, the stack pointer must lie within system
- // stack limits when we resume from exception.
+ // On Windows, the stack pointer in the context must lie within
+ // system stack limits when we resume from exception.
// Store the resume SP and PC on the g0 stack,
- // and return to returntramp on the g0 stack. returntramp
+ // and return to sigresume on the g0 stack. sigresume
// pops the saved PC and SP from the g0 stack, resuming execution
// at the desired location.
- // If returntramp has already been set up by a previous exception
+ // If sigresume has already been set up by a previous exception
// handler, don't clobber the stored SP and PC on the stack.
MOVW 4(R3), R3 // PEXCEPTION_POINTERS->Context
- MOVW 0x40(R3), R2 // load PC from context record
- MOVW $returntramp<>(SB), R1
+ MOVW context_pc(R3), R2 // load PC from context record
+ MOVW $sigresume<>(SB), R1
CMP R1, R2
B.EQ return // do not clobber saved SP/PC
- // Save resume SP and PC on g0 stack
- MOVW 0x38(R3), R2 // load SP from context record
- MOVW R2, 0(R12) // Store resume SP on g0 stack
- MOVW 0x40(R3), R2 // load PC from context record
- MOVW R2, 4(R12) // Store resume PC on g0 stack
+ // Save resume SP and PC into R0, R1.
+ MOVW context_spr(R3), R2
+ MOVW R2, context_r0(R3)
+ MOVW context_pc(R3), R2
+ MOVW R2, context_r1(R3)
- // Set up context record to return to returntramp on g0 stack
- MOVW R12, 0x38(R3) // save g0 stack pointer
- // in context record
- MOVW $returntramp<>(SB), R2 // save resume address
- MOVW R2, 0x40(R3) // in context record
+ // Set up context record to return to sigresume on g0 stack
+ MOVW R12, context_spr(R3)
+ MOVW $sigresume<>(SB), R2
+ MOVW R2, context_pc(R3)
return:
B (R14) // return
-//
// Trampoline to resume execution from exception handler.
// This is part of the control flow guard workaround.
// It switches stacks and jumps to the continuation address.
-//
-TEXT returntramp<>(SB),NOSPLIT|NOFRAME,$0
- MOVM.IA (R13), [R13, R15] // ldm sp, [sp, pc]
+// R0 and R1 are set above at the end of sigtramp<>
+// in the context that starts executing at sigresume<>.
+TEXT sigresume<>(SB),NOSPLIT|NOFRAME,$0
+ // Important: do not smash LR,
+ // which is set to a live value when handling
+ // a signal by pushing a call to sigpanic onto the stack.
+ MOVW R0, R13
+ B (R1)
TEXT runtime·exceptiontramp(SB),NOSPLIT|NOFRAME,$0
MOVW $runtime·exceptionhandler(SB), R1
@@ -259,16 +255,17 @@ TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$0
// +----------------+
// 12| argument (r0) |
//---+----------------+
-// 8 | param1 |
+// 8 | param1 | (also return value for called Go function)
// +----------------+
// 4 | param0 |
// +----------------+
-// 0 | retval |
+// 0 | slot for LR |
// +----------------+
//
-TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME,$0
+TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME|TOPFRAME,$0
MOVM.DB.W [R4-R11, R14], (R13) // push {r4-r11, lr}
SUB $(m__size + g__size + 20), R13 // space for locals
+ MOVW R14, 0(R13) // push LR again for anything unwinding the stack
MOVW R0, 12(R13)
MOVW R1, 16(R13)
@@ -307,7 +304,7 @@ TEXT runtime·externalthreadhandler(SB),NOSPLIT|NOFRAME,$0
MOVW $0, g
BL runtime·save_g(SB)
- MOVW 0(R13), R0 // load return value
+ MOVW 8(R13), R0 // load return value
ADD $(m__size + g__size + 20), R13 // free locals
MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc}
@@ -359,9 +356,6 @@ TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0
MOVW R0, g_m(g)
BL runtime·save_g(SB)
- // do per-thread TLS initialization
- BL init_thread_tls<>(SB)
-
// Layout new m scheduler stack on os stack.
MOVW R13, R0
MOVW R0, g_stack+stack_hi(g)
@@ -377,84 +371,15 @@ TEXT runtime·tstart_stdcall(SB),NOSPLIT|NOFRAME,$0
MOVW $0, R0
MOVM.IA.W (R13), [R4-R11, R15] // pop {r4-r11, pc}
-// onosstack calls fn on OS stack.
-// adapted from asm_arm.s : systemstack
-// func onosstack(fn unsafe.Pointer, arg uint32)
-TEXT runtime·onosstack(SB),NOSPLIT,$0
- MOVW fn+0(FP), R5 // R5 = fn
- MOVW arg+4(FP), R6 // R6 = arg
-
- // This function can be called when there is no g,
- // for example, when we are handling a callback on a non-go thread.
- // In this case we're already on the system stack.
- CMP $0, g
- BEQ noswitch
-
- MOVW g_m(g), R1 // R1 = m
-
- MOVW m_gsignal(R1), R2 // R2 = gsignal
- CMP g, R2
- B.EQ noswitch
-
- MOVW m_g0(R1), R2 // R2 = g0
- CMP g, R2
- B.EQ noswitch
-
- MOVW m_curg(R1), R3
- CMP g, R3
- B.EQ switch
-
- // Bad: g is not gsignal, not g0, not curg. What is it?
- // Hide call from linker nosplit analysis.
- MOVW $runtime·badsystemstack(SB), R0
- BL (R0)
- B runtime·abort(SB)
-
-switch:
- // save our state in g->sched. Pretend to
- // be systemstack_switch if the G stack is scanned.
- MOVW $runtime·systemstack_switch(SB), R3
- ADD $4, R3, R3 // get past push {lr}
- MOVW R3, (g_sched+gobuf_pc)(g)
- MOVW R13, (g_sched+gobuf_sp)(g)
- MOVW LR, (g_sched+gobuf_lr)(g)
- MOVW g, (g_sched+gobuf_g)(g)
-
- // switch to g0
- MOVW R2, g
- MOVW (g_sched+gobuf_sp)(R2), R3
- // make it look like mstart called systemstack on g0, to stop traceback
- SUB $4, R3, R3
- MOVW $runtime·mstart(SB), R4
- MOVW R4, 0(R3)
- MOVW R3, R13
-
- // call target function
- MOVW R6, R0 // arg
- BL (R5)
-
- // switch back to g
- MOVW g_m(g), R1
- MOVW m_curg(R1), g
- MOVW (g_sched+gobuf_sp)(g), R13
- MOVW $0, R3
- MOVW R3, (g_sched+gobuf_sp)(g)
- RET
-
-noswitch:
- // Using a tail call here cleans up tracebacks since we won't stop
- // at an intermediate systemstack.
- MOVW.P 4(R13), R14 // restore LR
- MOVW R6, R0 // arg
- B (R5)
-
-// Runs on OS stack. Duration (in 100ns units) is in R0.
-TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g may be nil.
+TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0-4
+ MOVW dt+0(FP), R3
MOVM.DB.W [R4, R14], (R13) // push {r4, lr}
MOVW R13, R4 // Save SP
SUB $8, R13 // R13 = R13 - 8
BIC $0x7, R13 // Align SP for ABI
- RSB $0, R0, R3 // R3 = -R0
MOVW $0, R1 // R1 = FALSE (alertable)
MOVW $-1, R0 // R0 = handle
MOVW R13, R2 // R2 = pTime
@@ -465,9 +390,11 @@ TEXT runtime·usleep2(SB),NOSPLIT|NOFRAME,$0
MOVW R4, R13 // Restore SP
MOVM.IA.W (R13), [R4, R15] // pop {R4, pc}
-// Runs on OS stack. Duration (in 100ns units) is in R0.
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g is valid.
// TODO: neeeds to be implemented properly.
-TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$0
+TEXT runtime·usleep2HighRes(SB),NOSPLIT|NOFRAME,$0-4
B runtime·abort(SB)
// Runs on OS stack.
@@ -497,7 +424,7 @@ TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0
#define time_hi1 4
#define time_hi2 8
-TEXT runtime·nanotime1(SB),NOSPLIT,$0-8
+TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8
MOVW $0, R0
MOVB runtime·useQPCTime(SB), R0
CMP $0, R0
@@ -521,9 +448,8 @@ loop:
RET
useQPC:
B runtime·nanotimeQPC(SB) // tail call
- RET
-TEXT time·now(SB),NOSPLIT,$0-20
+TEXT time·now(SB),NOSPLIT|NOFRAME,$0-20
MOVW $0, R0
MOVB runtime·useQPCTime(SB), R0
CMP $0, R0
@@ -597,8 +523,7 @@ wall:
MOVW R1,nsec+8(FP)
RET
useQPC:
- B runtime·nanotimeQPC(SB) // tail call
- RET
+ B runtime·nowQPC(SB) // tail call
// save_g saves the g register (R10) into thread local memory
// so that we can call externally compiled
@@ -656,39 +581,8 @@ TEXT runtime·_initcgo(SB),NOSPLIT|NOFRAME,$0
MOVW $runtime·tls_g(SB), R1
MOVW R0, (R1)
- BL init_thread_tls<>(SB)
-
MOVW R4, R13
MOVM.IA.W (R13), [R4, R15] // pop {r4, pc}
-// void init_thread_tls()
-//
-// Does per-thread TLS initialization. Saves a pointer to the TLS slot
-// holding G, in the current m.
-//
-// g->m->tls[0] = &_TEB->TlsSlots[tls_g]
-//
-// The purpose of this is to enable the profiling handler to get the
-// current g associated with the thread. We cannot use m->curg because curg
-// only holds the current user g. If the thread is executing system code or
-// external code, m->curg will be NULL. The thread's TLS slot always holds
-// the current g, so save a reference to this location so the profiling
-// handler can get the real g from the thread's m.
-//
-// Clobbers R0-R3
-TEXT init_thread_tls<>(SB),NOSPLIT|NOFRAME,$0
- // compute &_TEB->TlsSlots[tls_g]
- MRC 15, 0, R0, C13, C0, 2
- ADD $0xe10, R0
- MOVW $runtime·tls_g(SB), R1
- MOVW (R1), R1
- MOVW R1<<2, R1
- ADD R1, R0
-
- // save in g->m->tls[0]
- MOVW g_m(g), R1
- MOVW R0, m_tls(R1)
- RET
-
// Holds the TLS Slot, which was allocated by TlsAlloc()
GLOBL runtime·tls_g+0(SB), NOPTR, $4
diff --git a/src/runtime/sys_windows_arm64.s b/src/runtime/sys_windows_arm64.s
new file mode 100644
index 0000000000..53960488f9
--- /dev/null
+++ b/src/runtime/sys_windows_arm64.s
@@ -0,0 +1,579 @@
+// 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 "go_asm.h"
+#include "go_tls.h"
+#include "textflag.h"
+#include "funcdata.h"
+
+// Offsets into Thread Environment Block (pointer in R18)
+#define TEB_error 0x68
+#define TEB_TlsSlots 0x1480
+
+// Note: R0-R7 are args, R8 is indirect return value address,
+// R9-R15 are caller-save, R19-R29 are callee-save.
+//
+// load_g and save_g (in tls_arm64.s) clobber R27 (REGTMP) and R0.
+
+// void runtime·asmstdcall(void *c);
+TEXT runtime·asmstdcall(SB),NOSPLIT|NOFRAME,$0
+ STP.W (R29, R30), -32(RSP) // allocate C ABI stack frame
+ STP (R19, R20), 16(RSP) // save old R19, R20
+ MOVD R0, R19 // save libcall pointer
+ MOVD RSP, R20 // save stack pointer
+
+ // SetLastError(0)
+ MOVD $0, TEB_error(R18_PLATFORM)
+ MOVD libcall_args(R19), R12 // libcall->args
+
+ // Do we have more than 8 arguments?
+ MOVD libcall_n(R19), R0
+ CMP $0, R0; BEQ _0args
+ CMP $1, R0; BEQ _1args
+ CMP $2, R0; BEQ _2args
+ CMP $3, R0; BEQ _3args
+ CMP $4, R0; BEQ _4args
+ CMP $5, R0; BEQ _5args
+ CMP $6, R0; BEQ _6args
+ CMP $7, R0; BEQ _7args
+ CMP $8, R0; BEQ _8args
+
+ // Reserve stack space for remaining args
+ SUB $8, R0, R2
+ ADD $1, R2, R3 // make even number of words for stack alignment
+ AND $~1, R3
+ LSL $3, R3
+ SUB R3, RSP
+
+ // R4: size of stack arguments (n-8)*8
+ // R5: &args[8]
+ // R6: loop counter, from 0 to (n-8)*8
+ // R7: scratch
+ // R8: copy of RSP - (R2)(RSP) assembles as (R2)(ZR)
+ SUB $8, R0, R4
+ LSL $3, R4
+ ADD $(8*8), R12, R5
+ MOVD $0, R6
+ MOVD RSP, R8
+stackargs:
+ MOVD (R6)(R5), R7
+ MOVD R7, (R6)(R8)
+ ADD $8, R6
+ CMP R6, R4
+ BNE stackargs
+
+_8args:
+ MOVD (7*8)(R12), R7
+_7args:
+ MOVD (6*8)(R12), R6
+_6args:
+ MOVD (5*8)(R12), R5
+_5args:
+ MOVD (4*8)(R12), R4
+_4args:
+ MOVD (3*8)(R12), R3
+_3args:
+ MOVD (2*8)(R12), R2
+_2args:
+ MOVD (1*8)(R12), R1
+_1args:
+ MOVD (0*8)(R12), R0
+_0args:
+
+ MOVD libcall_fn(R19), R12 // branch to libcall->fn
+ BL (R12)
+
+ MOVD R20, RSP // free stack space
+ MOVD R0, libcall_r1(R19) // save return value to libcall->r1
+ // TODO(rsc) floating point like amd64 in libcall->r2?
+
+ // GetLastError
+ MOVD TEB_error(R18_PLATFORM), R0
+ MOVD R0, libcall_err(R19)
+
+ // Restore callee-saved registers.
+ LDP 16(RSP), (R19, R20)
+ LDP.P 32(RSP), (R29, R30)
+ RET
+
+TEXT runtime·badsignal2(SB),NOSPLIT,$16-0
+ NO_LOCAL_POINTERS
+
+ // stderr
+ MOVD runtime·_GetStdHandle(SB), R1
+ MOVD $-12, R0
+ SUB $16, RSP // skip over saved frame pointer below RSP
+ BL (R1)
+ ADD $16, RSP
+
+ // handle in R0 already
+ MOVD $runtime·badsignalmsg(SB), R1 // lpBuffer
+ MOVD $runtime·badsignallen(SB), R2 // lpNumberOfBytesToWrite
+ MOVD (R2), R2
+ MOVD R13, R3 // lpNumberOfBytesWritten
+ MOVD $0, R4 // lpOverlapped
+ MOVD runtime·_WriteFile(SB), R12
+ SUB $16, RSP // skip over saved frame pointer below RSP
+ BL (R12)
+ ADD $16, RSP
+
+ RET
+
+TEXT runtime·getlasterror(SB),NOSPLIT|NOFRAME,$0
+ MOVD TEB_error(R18_PLATFORM), R0
+ MOVD R0, ret+0(FP)
+ RET
+
+#define SAVE_R19_TO_R28(offset) \
+ MOVD R19, savedR19+((offset)+0*8)(SP); \
+ MOVD R20, savedR20+((offset)+1*8)(SP); \
+ MOVD R21, savedR21+((offset)+2*8)(SP); \
+ MOVD R22, savedR22+((offset)+3*8)(SP); \
+ MOVD R23, savedR23+((offset)+4*8)(SP); \
+ MOVD R24, savedR24+((offset)+5*8)(SP); \
+ MOVD R25, savedR25+((offset)+6*8)(SP); \
+ MOVD R26, savedR26+((offset)+7*8)(SP); \
+ MOVD R27, savedR27+((offset)+8*8)(SP); \
+ MOVD g, savedR28+((offset)+9*8)(SP);
+
+#define RESTORE_R19_TO_R28(offset) \
+ MOVD savedR19+((offset)+0*8)(SP), R19; \
+ MOVD savedR20+((offset)+1*8)(SP), R20; \
+ MOVD savedR21+((offset)+2*8)(SP), R21; \
+ MOVD savedR22+((offset)+3*8)(SP), R22; \
+ MOVD savedR23+((offset)+4*8)(SP), R23; \
+ MOVD savedR24+((offset)+5*8)(SP), R24; \
+ MOVD savedR25+((offset)+6*8)(SP), R25; \
+ MOVD savedR26+((offset)+7*8)(SP), R26; \
+ MOVD savedR27+((offset)+8*8)(SP), R27; \
+ MOVD savedR28+((offset)+9*8)(SP), g; /* R28 */
+
+// Called by Windows as a Vectored Exception Handler (VEH).
+// First argument is pointer to struct containing
+// exception record and context pointers.
+// Handler function is stored in R1
+// Return 0 for 'not handled', -1 for handled.
+// int32_t sigtramp(
+// PEXCEPTION_POINTERS ExceptionInfo,
+// func *GoExceptionHandler);
+TEXT sigtramp<>(SB),NOSPLIT|NOFRAME,$0
+ // Save R0, R1 (args) as well as LR, R27, R28 (callee-save).
+ MOVD R0, R5
+ MOVD R1, R6
+ MOVD LR, R7
+ MOVD R27, R16 // saved R27 (callee-save)
+ MOVD g, R17 // saved R28 (callee-save from Windows, not really g)
+
+ BL runtime·load_g(SB) // smashes R0, R27, R28 (g)
+ CMP $0, g // is there a current g?
+ BNE 2(PC)
+ BL runtime·badsignal2(SB)
+
+ // Do we need to switch to the g0 stack?
+ MOVD g, R3 // R3 = oldg (for sigtramp_g0)
+ MOVD g_m(g), R2 // R2 = m
+ MOVD m_g0(R2), R2 // R2 = g0
+ CMP g, R2 // if curg == g0
+ BNE switch
+
+ // No: on g0 stack already, tail call to sigtramp_g0.
+ // Restore all the callee-saves so sigtramp_g0 can return to our caller.
+ // We also pass R2 = g0, R3 = oldg, both set above.
+ MOVD R5, R0
+ MOVD R6, R1
+ MOVD R7, LR
+ MOVD R16, R27 // restore R27
+ MOVD R17, g // restore R28
+ B sigtramp_g0<>(SB)
+
+switch:
+ // switch to g0 stack (but do not update g - that's sigtramp_g0's job)
+ MOVD RSP, R8
+ MOVD (g_sched+gobuf_sp)(R2), R4 // R4 = g->gobuf.sp
+ SUB $(6*8), R4 // alloc space for saves - 2 words below SP for frame pointer, 3 for us to use, 1 for alignment
+ MOVD R4, RSP // switch to g0 stack
+
+ MOVD $0, (0*8)(RSP) // fake saved LR
+ MOVD R7, (1*8)(RSP) // saved LR
+ MOVD R8, (2*8)(RSP) // saved SP
+
+ MOVD R5, R0 // original args
+ MOVD R6, R1 // original args
+ MOVD R16, R27
+ MOVD R17, g // R28
+ BL sigtramp_g0<>(SB)
+
+ // switch back to original stack; g already updated
+ MOVD (1*8)(RSP), R7 // saved LR
+ MOVD (2*8)(RSP), R8 // saved SP
+ MOVD R7, LR
+ MOVD R8, RSP
+ RET
+
+// sigtramp_g0 is running on the g0 stack, with R2 = g0, R3 = oldg.
+// But g itself is not set - that's R28, a callee-save register,
+// and it still holds the value from the Windows DLL caller.
+TEXT sigtramp_g0<>(SB),NOSPLIT,$128
+ NO_LOCAL_POINTERS
+
+ // Push C callee-save registers R19-R28. LR, FP already saved.
+ SAVE_R19_TO_R28(-10*8)
+
+ MOVD 0(R0), R5 // R5 = ExceptionPointers->ExceptionRecord
+ MOVD 8(R0), R6 // R6 = ExceptionPointers->ContextRecord
+ MOVD R6, context-(11*8)(SP)
+
+ MOVD R2, g // g0
+ BL runtime·save_g(SB) // smashes R0
+
+ MOVD R5, (1*8)(RSP) // arg0 (ExceptionRecord)
+ MOVD R6, (2*8)(RSP) // arg1 (ContextRecord)
+ MOVD R3, (3*8)(RSP) // arg2 (original g)
+ MOVD R3, oldg-(12*8)(SP)
+ BL (R1)
+ MOVD oldg-(12*8)(SP), g
+ BL runtime·save_g(SB) // smashes R0
+ MOVW (4*8)(RSP), R0 // return value (0 or -1)
+
+ // if return value is CONTINUE_SEARCH, do not set up control
+ // flow guard workaround
+ CMP $0, R0
+ BEQ return
+
+ // Check if we need to set up the control flow guard workaround.
+ // On Windows, the stack pointer in the context must lie within
+ // system stack limits when we resume from exception.
+ // Store the resume SP and PC in alternate registers
+ // and return to sigresume on the g0 stack.
+ // sigresume makes no use of the stack at all,
+ // loading SP from R0 and jumping to R1.
+ // Note that smashing R0 and R1 is only safe because we know sigpanic
+ // will not actually return to the original frame, so the registers
+ // are effectively dead. But this does mean we can't use the
+ // same mechanism for async preemption.
+ MOVD context-(11*8)(SP), R6
+ MOVD context_pc(R6), R2 // load PC from context record
+ MOVD $sigresume<>(SB), R1
+
+ CMP R1, R2
+ BEQ return // do not clobber saved SP/PC
+
+ // Save resume SP and PC into R0, R1.
+ MOVD context_xsp(R6), R2
+ MOVD R2, (context_x+0*8)(R6)
+ MOVD context_pc(R6), R2
+ MOVD R2, (context_x+1*8)(R6)
+
+ // Set up context record to return to sigresume on g0 stack
+ MOVD RSP, R2
+ MOVD R2, context_xsp(R6)
+ MOVD $sigresume<>(SB), R2
+ MOVD R2, context_pc(R6)
+
+return:
+ RESTORE_R19_TO_R28(-10*8) // smashes g
+ RET
+
+// Trampoline to resume execution from exception handler.
+// This is part of the control flow guard workaround.
+// It switches stacks and jumps to the continuation address.
+// R0 and R1 are set above at the end of sigtramp<>
+// in the context that starts executing at sigresume<>.
+TEXT sigresume<>(SB),NOSPLIT|NOFRAME,$0
+ // Important: do not smash LR,
+ // which is set to a live value when handling
+ // a signal by pushing a call to sigpanic onto the stack.
+ MOVD R0, RSP
+ B (R1)
+
+TEXT runtime·exceptiontramp(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·exceptionhandler(SB), R1
+ B sigtramp<>(SB)
+
+TEXT runtime·firstcontinuetramp(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·firstcontinuehandler(SB), R1
+ B sigtramp<>(SB)
+
+TEXT runtime·lastcontinuetramp(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·lastcontinuehandler(SB), R1
+ B sigtramp<>(SB)
+
+TEXT runtime·ctrlhandler(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·ctrlhandler1(SB), R1
+ B runtime·externalthreadhandler(SB)
+
+TEXT runtime·profileloop(SB),NOSPLIT|NOFRAME,$0
+ MOVD $runtime·profileloop1(SB), R1
+ B runtime·externalthreadhandler(SB)
+
+// externalthreadhander called with R0 = uint32 arg, R1 = Go function f.
+// Need to call f(arg), which returns a uint32, and return it in R0.
+TEXT runtime·externalthreadhandler(SB),NOSPLIT|TOPFRAME,$96-0
+ NO_LOCAL_POINTERS
+
+ // Push C callee-save registers R19-R28. LR, FP already saved.
+ SAVE_R19_TO_R28(-10*8)
+
+ // Allocate space for args, saved R0+R1, g, and m structures.
+ // Hide from nosplit check.
+ #define extra ((64+g__size+m__size+15)&~15)
+ SUB $extra, RSP, R2 // hide from nosplit overflow check
+ MOVD R2, RSP
+
+ // Save R0 and R1 (our args).
+ MOVD R0, 32(RSP)
+ MOVD R1, 40(RSP)
+
+ // Zero out m and g structures.
+ MOVD $64(RSP), R0
+ MOVD R0, 8(RSP)
+ MOVD $(m__size + g__size), R0
+ MOVD R0, 16(RSP)
+ MOVD $0, 0(RSP) // not-saved LR
+ BL runtime·memclrNoHeapPointers(SB)
+
+ // Initialize m and g structures.
+ MOVD $64(RSP), g
+ MOVD $g__size(g), R3 // m
+ MOVD R3, g_m(g) // g->m = m
+ MOVD g, m_g0(R3) // m->g0 = g
+ MOVD g, m_curg(R3) // m->curg = g
+ MOVD RSP, R0
+ MOVD R0, g_stack+stack_hi(g)
+ SUB $(32*1024), R0
+ MOVD R0, (g_stack+stack_lo)(g)
+ MOVD R0, g_stackguard0(g)
+ MOVD R0, g_stackguard1(g)
+ BL runtime·save_g(SB)
+
+ // Call function.
+ MOVD 32(RSP), R0
+ MOVD 40(RSP), R1
+ MOVW R0, 8(RSP)
+ BL (R1)
+
+ // Clear g.
+ MOVD $0, g
+ BL runtime·save_g(SB)
+
+ // Load return value (save_g would have smashed)
+ MOVW (2*8)(RSP), R0
+
+ ADD $extra, RSP, R2
+ MOVD R2, RSP
+ #undef extra
+
+ RESTORE_R19_TO_R28(-10*8)
+ RET
+
+GLOBL runtime·cbctxts(SB), NOPTR, $4
+
+TEXT runtime·callbackasm1(SB),NOSPLIT,$208-0
+ NO_LOCAL_POINTERS
+
+ // On entry, the trampoline in zcallback_windows_arm64.s left
+ // the callback index in R12 (which is volatile in the C ABI).
+
+ // Save callback register arguments R0-R7.
+ // We do this at the top of the frame so they're contiguous with stack arguments.
+ MOVD R0, arg0-(8*8)(SP)
+ MOVD R1, arg1-(7*8)(SP)
+ MOVD R2, arg2-(6*8)(SP)
+ MOVD R3, arg3-(5*8)(SP)
+ MOVD R4, arg4-(4*8)(SP)
+ MOVD R5, arg5-(3*8)(SP)
+ MOVD R6, arg6-(2*8)(SP)
+ MOVD R7, arg7-(1*8)(SP)
+
+ // Push C callee-save registers R19-R28.
+ // LR, FP already saved.
+ SAVE_R19_TO_R28(-18*8)
+
+ // Create a struct callbackArgs on our stack.
+ MOVD $cbargs-(18*8+callbackArgs__size)(SP), R13
+ MOVD R12, callbackArgs_index(R13) // callback index
+ MOVD $arg0-(8*8)(SP), R0
+ MOVD R0, callbackArgs_args(R13) // address of args vector
+ MOVD $0, R0
+ MOVD R0, callbackArgs_result(R13) // result
+
+ // Call cgocallback, which will call callbackWrap(frame).
+ MOVD $·callbackWrap(SB), R0 // PC of function to call
+ MOVD R13, R1 // frame (&callbackArgs{...})
+ MOVD $0, R2 // context
+ MOVD R0, (1*8)(RSP)
+ MOVD R1, (2*8)(RSP)
+ MOVD R2, (3*8)(RSP)
+ BL runtime·cgocallback(SB)
+
+ // Get callback result.
+ MOVD $cbargs-(18*8+callbackArgs__size)(SP), R13
+ MOVD callbackArgs_result(R13), R0
+
+ RESTORE_R19_TO_R28(-18*8)
+
+ RET
+
+// uint32 tstart_stdcall(M *newm);
+TEXT runtime·tstart_stdcall(SB),NOSPLIT,$96-0
+ SAVE_R19_TO_R28(-10*8)
+
+ MOVD m_g0(R0), g
+ MOVD R0, g_m(g)
+ BL runtime·save_g(SB)
+
+ // Set up stack guards for OS stack.
+ MOVD RSP, R0
+ MOVD R0, g_stack+stack_hi(g)
+ SUB $(64*1024), R0
+ MOVD R0, (g_stack+stack_lo)(g)
+ MOVD R0, g_stackguard0(g)
+ MOVD R0, g_stackguard1(g)
+
+ BL runtime·emptyfunc(SB) // fault if stack check is wrong
+ BL runtime·mstart(SB)
+
+ RESTORE_R19_TO_R28(-10*8)
+
+ // Exit the thread.
+ MOVD $0, R0
+ RET
+
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g may be nil.
+TEXT runtime·usleep2(SB),NOSPLIT,$32-4
+ MOVW dt+0(FP), R0
+ MOVD $16(RSP), R2 // R2 = pTime
+ MOVD R0, 0(R2) // *pTime = -dt
+ MOVD $-1, R0 // R0 = handle
+ MOVD $0, R1 // R1 = FALSE (alertable)
+ MOVD runtime·_NtWaitForSingleObject(SB), R3
+ SUB $16, RSP // skip over saved frame pointer below RSP
+ BL (R3)
+ ADD $16, RSP
+ RET
+
+// Runs on OS stack.
+// duration (in -100ns units) is in dt+0(FP).
+// g is valid.
+// TODO: neeeds to be implemented properly.
+TEXT runtime·usleep2HighRes(SB),NOSPLIT,$0-4
+ B runtime·abort(SB)
+
+// Runs on OS stack.
+TEXT runtime·switchtothread(SB),NOSPLIT,$16-0
+ MOVD runtime·_SwitchToThread(SB), R0
+ SUB $16, RSP // skip over saved frame pointer below RSP
+ BL (R0)
+ ADD $16, RSP
+ RET
+
+// See http://www.dcl.hpi.uni-potsdam.de/research/WRK/2007/08/getting-os-information-the-kuser_shared_data-structure/
+// Must read hi1, then lo, then hi2. The snapshot is valid if hi1 == hi2.
+#define _INTERRUPT_TIME 0x7ffe0008
+#define _SYSTEM_TIME 0x7ffe0014
+#define time_lo 0
+#define time_hi1 4
+#define time_hi2 8
+
+TEXT runtime·nanotime1(SB),NOSPLIT|NOFRAME,$0-8
+ MOVB runtime·useQPCTime(SB), R0
+ CMP $0, R0
+ BNE useQPC
+ MOVD $_INTERRUPT_TIME, R3
+loop:
+ MOVWU time_hi1(R3), R1
+ MOVWU time_lo(R3), R0
+ MOVWU time_hi2(R3), R2
+ CMP R1, R2
+ BNE loop
+
+ // wintime = R1:R0, multiply by 100
+ ORR R1<<32, R0
+ MOVD $100, R1
+ MUL R1, R0
+ MOVD R0, ret+0(FP)
+ RET
+useQPC:
+ B runtime·nanotimeQPC(SB) // tail call
+
+TEXT time·now(SB),NOSPLIT|NOFRAME,$0-24
+ MOVB runtime·useQPCTime(SB), R0
+ CMP $0, R0
+ BNE useQPC
+ MOVD $_INTERRUPT_TIME, R3
+loop:
+ MOVWU time_hi1(R3), R1
+ MOVWU time_lo(R3), R0
+ MOVWU time_hi2(R3), R2
+ CMP R1, R2
+ BNE loop
+
+ // wintime = R1:R0, multiply by 100
+ ORR R1<<32, R0
+ MOVD $100, R1
+ MUL R1, R0
+ MOVD R0, mono+16(FP)
+
+ MOVD $_SYSTEM_TIME, R3
+wall:
+ MOVWU time_hi1(R3), R1
+ MOVWU time_lo(R3), R0
+ MOVWU time_hi2(R3), R2
+ CMP R1, R2
+ BNE wall
+
+ // w = R1:R0 in 100ns units
+ // convert to Unix epoch (but still 100ns units)
+ #define delta 116444736000000000
+ ORR R1<<32, R0
+ SUB $delta, R0
+
+ // Convert to nSec
+ MOVD $100, R1
+ MUL R1, R0
+
+ // Code stolen from compiler output for:
+ //
+ // var x uint64
+ // func f() (sec uint64, nsec uint32) { return x / 1000000000, uint32(x % 100000000) }
+ //
+ LSR $1, R0, R1
+ MOVD $-8543223759426509416, R2
+ UMULH R2, R1, R1
+ LSR $28, R1, R1
+ MOVD R1, sec+0(FP)
+ MOVD $-6067343680855748867, R1
+ UMULH R0, R1, R1
+ LSR $26, R1, R1
+ MOVD $100000000, R2
+ MSUB R1, R0, R2, R0
+ MOVW R0, nsec+8(FP)
+ RET
+useQPC:
+ B runtime·nowQPC(SB) // tail call
+
+// This is called from rt0_go, which runs on the system stack
+// using the initial stack allocated by the OS.
+// It calls back into standard C using the BL below.
+TEXT runtime·wintls(SB),NOSPLIT,$0
+ // Allocate a TLS slot to hold g across calls to external code
+ MOVD runtime·_TlsAlloc(SB), R0
+ SUB $16, RSP // skip over saved frame pointer below RSP
+ BL (R0)
+ ADD $16, RSP
+
+ // Assert that slot is less than 64 so we can use _TEB->TlsSlots
+ CMP $64, R0
+ BLT ok
+ MOVD $runtime·abort(SB), R1
+ BL (R1)
+ok:
+
+ // Save offset from R18 into tls_g.
+ LSL $3, R1
+ ADD $TEB_TlsSlots, R1
+ MOVD R1, runtime·tls_g(SB)
+ RET
diff --git a/src/runtime/sys_x86.go b/src/runtime/sys_x86.go
index f917cb8bd7..0866e3140e 100644
--- a/src/runtime/sys_x86.go
+++ b/src/runtime/sys_x86.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 || 386
// +build amd64 386
package runtime
@@ -12,13 +13,9 @@ import (
)
// adjust Gobuf as if it executed a call to fn with context ctxt
-// and then did an immediate gosave.
+// and then stopped before the first instruction in fn.
func gostartcall(buf *gobuf, fn, ctxt unsafe.Pointer) {
sp := buf.sp
- if sys.RegSize > sys.PtrSize {
- sp -= sys.PtrSize
- *(*uintptr)(unsafe.Pointer(sp)) = 0
- }
sp -= sys.PtrSize
*(*uintptr)(unsafe.Pointer(sp)) = buf.pc
buf.sp = sp
diff --git a/src/runtime/syscall_windows.go b/src/runtime/syscall_windows.go
index 7835b492f7..7cf9318bdb 100644
--- a/src/runtime/syscall_windows.go
+++ b/src/runtime/syscall_windows.go
@@ -5,6 +5,7 @@
package runtime
import (
+ "internal/abi"
"runtime/internal/sys"
"unsafe"
)
@@ -70,8 +71,8 @@ func callbackasmAddr(i int) uintptr {
panic("unsupported architecture")
case "386", "amd64":
entrySize = 5
- case "arm":
- // On ARM, each entry is a MOV instruction
+ case "arm", "arm64":
+ // On ARM and ARM64, each entry is a MOV instruction
// followed by a branch instruction
entrySize = 8
}
@@ -115,13 +116,14 @@ func compileCallback(fn eface, cdecl bool) (code uintptr) {
// registers and the stack.
panic("compileCallback: argument size is larger than uintptr")
}
- if k := t.kind & kindMask; (GOARCH == "amd64" || GOARCH == "arm") && (k == kindFloat32 || k == kindFloat64) {
+ if k := t.kind & kindMask; GOARCH != "386" && (k == kindFloat32 || k == kindFloat64) {
// In fastcall, floating-point arguments in
// the first four positions are passed in
// floating-point registers, which we don't
// currently spill. arm passes floating-point
// arguments in VFP registers, which we also
// don't support.
+ // So basically we only support 386.
panic("compileCallback: float arguments not supported")
}
@@ -146,6 +148,7 @@ func compileCallback(fn eface, cdecl bool) (code uintptr) {
}
// cdecl, stdcall, fastcall, and arm pad arguments to word size.
+ // TODO(rsc): On arm and arm64 do we need to skip the caller's saved LR?
src += sys.PtrSize
// The Go ABI packs arguments.
dst += t.size
@@ -242,7 +245,11 @@ func callbackWrap(a *callbackArgs) {
// Even though this is copying back results, we can pass a nil
// type because those results must not require write barriers.
- reflectcall(nil, unsafe.Pointer(c.fn), noescape(goArgs), uint32(c.retOffset)+sys.PtrSize, uint32(c.retOffset))
+ //
+ // Pass a dummy RegArgs for now.
+ // TODO(mknyszek): Pass arguments in registers.
+ var regs abi.RegArgs
+ reflectcall(nil, unsafe.Pointer(c.fn), noescape(goArgs), uint32(c.retOffset)+sys.PtrSize, uint32(c.retOffset), uint32(c.retOffset)+sys.PtrSize, &regs)
// Extract the result.
a.result = *(*uintptr)(unsafe.Pointer(&frame[c.retOffset]))
diff --git a/src/runtime/time_fake.go b/src/runtime/time_fake.go
index c64d2994a9..1238744ebf 100644
--- a/src/runtime/time_fake.go
+++ b/src/runtime/time_fake.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build faketime
-// +build !windows
+//go:build faketime && !windows
+// +build faketime,!windows
// Faketime isn't currently supported on Windows. This would require:
//
diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go
index 1912a94e87..13bf1c2d4f 100644
--- a/src/runtime/time_nofake.go
+++ b/src/runtime/time_nofake.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !faketime
// +build !faketime
package runtime
diff --git a/src/runtime/timeasm.go b/src/runtime/timeasm.go
index 82cf63edff..fe38a086fc 100644
--- a/src/runtime/timeasm.go
+++ b/src/runtime/timeasm.go
@@ -4,6 +4,7 @@
// Declarations for operating systems implementing time.now directly in assembly.
+//go:build windows
// +build windows
package runtime
diff --git a/src/runtime/timestub.go b/src/runtime/timestub.go
index 459bf8e543..2ef8d4665f 100644
--- a/src/runtime/timestub.go
+++ b/src/runtime/timestub.go
@@ -5,6 +5,7 @@
// Declarations for operating systems implementing time.now
// indirectly, in terms of walltime and nanotime assembly.
+//go:build !windows
// +build !windows
package runtime
diff --git a/src/runtime/timestub2.go b/src/runtime/timestub2.go
index 68777ee4a9..53b10885af 100644
--- a/src/runtime/timestub2.go
+++ b/src/runtime/timestub2.go
@@ -2,12 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build !aix
-// +build !darwin
-// +build !freebsd
-// +build !openbsd
-// +build !solaris
-// +build !windows
+//go:build !aix && !darwin && !freebsd && !openbsd && !solaris && !windows
+// +build !aix,!darwin,!freebsd,!openbsd,!solaris,!windows
package runtime
diff --git a/src/runtime/tls_arm64.h b/src/runtime/tls_arm64.h
index 0804fa3502..fe5e4cee12 100644
--- a/src/runtime/tls_arm64.h
+++ b/src/runtime/tls_arm64.h
@@ -41,8 +41,16 @@
#define MRS_TPIDR_R0 WORD $0xd53bd040 // MRS TPIDR_EL0, R0
#endif
+#ifdef GOOS_windows
+#define TLS_windows
+#endif
+#ifdef TLS_windows
+#define TLSG_IS_VARIABLE
+#define MRS_TPIDR_R0 MOVD R18_PLATFORM, R0
+#endif
+
// Define something that will break the build if
// the GOOS is unknown.
-#ifndef TPIDR
-#define MRS_TPIDR_R0 TPIDR_UNKNOWN
+#ifndef MRS_TPIDR_R0
+#define MRS_TPIDR_R0 unknown_TLS_implementation_in_tls_arm64_h
#endif
diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s
index 085012f791..52b3e8f222 100644
--- a/src/runtime/tls_arm64.s
+++ b/src/runtime/tls_arm64.s
@@ -9,12 +9,14 @@
#include "tls_arm64.h"
TEXT runtime·load_g(SB),NOSPLIT,$0
-#ifndef TLS_darwin
+#ifndef GOOS_darwin
#ifndef GOOS_openbsd
+#ifndef GOOS_windows
MOVB runtime·iscgo(SB), R0
CBZ R0, nocgo
#endif
#endif
+#endif
MRS_TPIDR_R0
#ifdef TLS_darwin
@@ -28,12 +30,14 @@ nocgo:
RET
TEXT runtime·save_g(SB),NOSPLIT,$0
-#ifndef TLS_darwin
+#ifndef GOOS_darwin
#ifndef GOOS_openbsd
+#ifndef GOOS_windows
MOVB runtime·iscgo(SB), R0
CBZ R0, nocgo
#endif
#endif
+#endif
MRS_TPIDR_R0
#ifdef TLS_darwin
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index 2601cd697f..53eb689848 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -15,24 +15,9 @@ import (
// The most important fact about a given architecture is whether it uses a link register.
// On systems with link registers, the prologue for a non-leaf function stores the
// incoming value of LR at the bottom of the newly allocated stack frame.
-// On systems without link registers, the architecture pushes a return PC during
+// On systems without link registers (x86), the architecture pushes a return PC during
// the call instruction, so the return PC ends up above the stack frame.
// In this file, the return PC is always called LR, no matter how it was found.
-//
-// To date, the opposite of a link register architecture is an x86 architecture.
-// This code may need to change if some other kind of non-link-register
-// architecture comes along.
-//
-// The other important fact is the size of a pointer: on 32-bit systems the LR
-// takes up only 4 bytes on the stack, while on 64-bit systems it takes up 8 bytes.
-// Typically this is ptrSize.
-//
-// As an exception, amd64p32 had ptrSize == 4 but the CALL instruction still
-// stored an 8-byte return PC onto the stack. To accommodate this, we used regSize
-// as the size of the architecture-pushed return PC.
-//
-// usesLR is defined below in terms of minFrameSize, which is defined in
-// arch_$GOARCH.go. ptrSize and regSize are defined in stubs.go.
const usesLR = sys.MinFrameSize > 0
@@ -144,8 +129,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
frame.pc = *(*uintptr)(unsafe.Pointer(frame.sp))
frame.lr = 0
} else {
- frame.pc = uintptr(*(*sys.Uintreg)(unsafe.Pointer(frame.sp)))
- frame.sp += sys.RegSize
+ frame.pc = uintptr(*(*uintptr)(unsafe.Pointer(frame.sp)))
+ frame.sp += sys.PtrSize
}
}
@@ -180,6 +165,22 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
break
}
+ // Compute function info flags.
+ flag := f.flag
+ if f.funcID == funcID_cgocallback {
+ // cgocallback does write SP to switch from the g0 to the curg stack,
+ // but it carefully arranges that during the transition BOTH stacks
+ // have cgocallback frame valid for unwinding through.
+ // So we don't need to exclude it with the other SP-writing functions.
+ flag &^= funcFlag_SPWRITE
+ }
+ if frame.pc == pc0 && frame.sp == sp0 && pc0 == gp.syscallpc && sp0 == gp.syscallsp {
+ // Some Syscall functions write to SP, but they do so only after
+ // saving the entry PC/SP using entersyscall.
+ // Since we are using the entry PC/SP, the later SP write doesn't matter.
+ flag &^= funcFlag_SPWRITE
+ }
+
// Found an actual function.
// Derive frame pointer and link register.
if frame.fp == 0 {
@@ -196,6 +197,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
frame.pc = gp.m.curg.sched.pc
frame.fn = findfunc(frame.pc)
f = frame.fn
+ flag = f.flag
frame.sp = gp.m.curg.sched.sp
cgoCtxt = gp.m.curg.cgoCtxt
case funcID_systemstack:
@@ -203,29 +205,37 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
// stack transition.
frame.sp = gp.m.curg.sched.sp
cgoCtxt = gp.m.curg.cgoCtxt
+ flag &^= funcFlag_SPWRITE
}
}
frame.fp = frame.sp + uintptr(funcspdelta(f, frame.pc, &cache))
if !usesLR {
// On x86, call instruction pushes return PC before entering new function.
- frame.fp += sys.RegSize
+ frame.fp += sys.PtrSize
}
}
var flr funcInfo
- if topofstack(f, gp.m != nil && gp == gp.m.g0) {
+ if flag&funcFlag_TOPFRAME != 0 {
+ // This function marks the top of the stack. Stop the traceback.
frame.lr = 0
flr = funcInfo{}
- } else if usesLR && f.funcID == funcID_jmpdefer {
- // jmpdefer modifies SP/LR/PC non-atomically.
- // If a profiling interrupt arrives during jmpdefer,
- // the stack unwind may see a mismatched register set
- // and get confused. Stop if we see PC within jmpdefer
- // to avoid that confusion.
- // See golang.org/issue/8153.
+ } else if flag&funcFlag_SPWRITE != 0 {
+ // The function we are in does a write to SP that we don't know
+ // how to encode in the spdelta table. Examples include context
+ // switch routines like runtime.gogo but also any code that switches
+ // to the g0 stack to run host C code. Since we can't reliably unwind
+ // the SP (we might not even be on the stack we think we are),
+ // we stop the traceback here.
if callback != nil {
- throw("traceback_arm: found jmpdefer when tracing with callback")
+ // Finding an SPWRITE should only happen for a profiling signal, which can
+ // arrive at any time. For a GC stack traversal (callback != nil),
+ // we shouldn't see this case, and we must be sure to walk the
+ // entire stack or the GC is invalid. So crash.
+ println("traceback: unexpected SPWRITE function", funcname(f))
+ throw("traceback")
}
frame.lr = 0
+ flr = funcInfo{}
} else {
var lrPtr uintptr
if usesLR {
@@ -235,8 +245,8 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
}
} else {
if frame.lr == 0 {
- lrPtr = frame.fp - sys.RegSize
- frame.lr = uintptr(*(*sys.Uintreg)(unsafe.Pointer(lrPtr)))
+ lrPtr = frame.fp - sys.PtrSize
+ frame.lr = uintptr(*(*uintptr)(unsafe.Pointer(lrPtr)))
}
}
flr = findfunc(frame.lr)
@@ -266,13 +276,28 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
frame.varp = frame.fp
if !usesLR {
// On x86, call instruction pushes return PC before entering new function.
- frame.varp -= sys.RegSize
+ frame.varp -= sys.PtrSize
}
// For architectures with frame pointers, if there's
// a frame, then there's a saved frame pointer here.
- if frame.varp > frame.sp && (GOARCH == "amd64" || GOARCH == "arm64") {
- frame.varp -= sys.RegSize
+ //
+ // NOTE: This code is not as general as it looks.
+ // On x86, the ABI is to save the frame pointer word at the
+ // top of the stack frame, so we have to back down over it.
+ // On arm64, the frame pointer should be at the bottom of
+ // the stack (with R29 (aka FP) = RSP), in which case we would
+ // not want to do the subtraction here. But we started out without
+ // any frame pointer, and when we wanted to add it, we didn't
+ // want to break all the assembly doing direct writes to 8(RSP)
+ // to set the first parameter to a called function.
+ // So we decided to write the FP link *below* the stack pointer
+ // (with R29 = RSP - 8 in Go functions).
+ // This is technically ABI-compatible but not standard.
+ // And it happens to end up mimicking the x86 layout.
+ // Other architectures may make different decisions.
+ if frame.varp > frame.sp && framepointer_enabled {
+ frame.varp -= sys.PtrSize
}
// Derive size of arguments.
@@ -490,11 +515,7 @@ func gentraceback(pc0, sp0, lr0 uintptr, gp *g, skip int, pcbuf *uintptr, max in
// before faking a call.
if usesLR && injectedCall {
x := *(*uintptr)(unsafe.Pointer(frame.sp))
- frame.sp += sys.MinFrameSize
- if GOARCH == "arm64" {
- // arm64 needs 16-byte aligned SP, always
- frame.sp += sys.PtrSize
- }
+ frame.sp += alignUp(sys.MinFrameSize, sys.StackAlign)
f = findfunc(frame.pc)
frame.fn = f
if !f.valid() {
@@ -1000,22 +1021,6 @@ func tracebackHexdump(stk stack, frame *stkframe, bad uintptr) {
})
}
-// Does f mark the top of a goroutine stack?
-func topofstack(f funcInfo, g0 bool) bool {
- return f.funcID == funcID_goexit ||
- f.funcID == funcID_mstart ||
- f.funcID == funcID_mcall ||
- f.funcID == funcID_morestack ||
- f.funcID == funcID_rt0_go ||
- f.funcID == funcID_externalthreadhandler ||
- // asmcgocall is TOS on the system stack because it
- // switches to the system stack, but in this case we
- // can come back to the regular stack and still want
- // to be able to unwind through the call that appeared
- // on the regular stack.
- (g0 && f.funcID == funcID_asmcgocall)
-}
-
// isSystemGoroutine reports whether the goroutine g must be omitted
// in stack dumps and deadlock detector. This is any goroutine that
// starts at a runtime.* entry point, except for runtime.main,
diff --git a/src/runtime/vdso_elf32.go b/src/runtime/vdso_elf32.go
index 2720f33eed..456173b0f5 100644
--- a/src/runtime/vdso_elf32.go
+++ b/src/runtime/vdso_elf32.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (386 || arm)
// +build linux
// +build 386 arm
diff --git a/src/runtime/vdso_elf64.go b/src/runtime/vdso_elf64.go
index 6ded9d621a..9923bd4697 100644
--- a/src/runtime/vdso_elf64.go
+++ b/src/runtime/vdso_elf64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le)
// +build linux
// +build amd64 arm64 mips64 mips64le ppc64 ppc64le
diff --git a/src/runtime/vdso_freebsd.go b/src/runtime/vdso_freebsd.go
index 122cc8b128..74b2f1435a 100644
--- a/src/runtime/vdso_freebsd.go
+++ b/src/runtime/vdso_freebsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd
// +build freebsd
package runtime
diff --git a/src/runtime/vdso_freebsd_x86.go b/src/runtime/vdso_freebsd_x86.go
index 1fa5d80dcc..23a5a8c322 100644
--- a/src/runtime/vdso_freebsd_x86.go
+++ b/src/runtime/vdso_freebsd_x86.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd && (386 || amd64)
// +build freebsd
// +build 386 amd64
diff --git a/src/runtime/vdso_in_none.go b/src/runtime/vdso_in_none.go
index 7f4019c0d6..c66fbf8216 100644
--- a/src/runtime/vdso_in_none.go
+++ b/src/runtime/vdso_in_none.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (linux && !386 && !amd64 && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le) || !linux
// +build linux,!386,!amd64,!arm,!arm64,!mips64,!mips64le,!ppc64,!ppc64le !linux
package runtime
diff --git a/src/runtime/vdso_linux.go b/src/runtime/vdso_linux.go
index 6e2942498d..ae211f96b1 100644
--- a/src/runtime/vdso_linux.go
+++ b/src/runtime/vdso_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (386 || amd64 || arm || arm64 || mips64 || mips64le || ppc64 || ppc64le)
// +build linux
// +build 386 amd64 arm arm64 mips64 mips64le ppc64 ppc64le
diff --git a/src/runtime/vdso_linux_mips64x.go b/src/runtime/vdso_linux_mips64x.go
index 3a0f947612..395ddbba69 100644
--- a/src/runtime/vdso_linux_mips64x.go
+++ b/src/runtime/vdso_linux_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips64 || mips64le)
// +build linux
// +build mips64 mips64le
diff --git a/src/runtime/vdso_linux_ppc64x.go b/src/runtime/vdso_linux_ppc64x.go
index f30946e4c5..b741dbfcdc 100644
--- a/src/runtime/vdso_linux_ppc64x.go
+++ b/src/runtime/vdso_linux_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le
diff --git a/src/runtime/vlrt.go b/src/runtime/vlrt.go
index 996c0611fd..cf631bdcca 100644
--- a/src/runtime/vlrt.go
+++ b/src/runtime/vlrt.go
@@ -23,6 +23,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+//go:build arm || 386 || mips || mipsle
// +build arm 386 mips mipsle
package runtime
diff --git a/src/runtime/wincallback.go b/src/runtime/wincallback.go
index fb452222da..56f0674f4e 100644
--- a/src/runtime/wincallback.go
+++ b/src/runtime/wincallback.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// Generate Windows callback assembly file.
@@ -72,6 +73,34 @@ TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0
}
}
+func genasmArm64() {
+ var buf bytes.Buffer
+
+ buf.WriteString(`// Code generated by wincallback.go using 'go generate'. DO NOT EDIT.
+
+// External code calls into callbackasm at an offset corresponding
+// to the callback index. Callbackasm is a table of MOV and B instructions.
+// The MOV instruction loads R12 with the callback index, and the
+// B instruction branches to callbackasm1.
+// callbackasm1 takes the callback index from R12 and
+// indexes into an array that stores information about each callback.
+// It then calls the Go implementation for that callback.
+#include "textflag.h"
+
+TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0
+`)
+ for i := 0; i < maxCallback; i++ {
+ buf.WriteString(fmt.Sprintf("\tMOVD\t$%d, R12\n", i))
+ buf.WriteString("\tB\truntime·callbackasm1(SB)\n")
+ }
+
+ err := os.WriteFile("zcallback_windows_arm64.s", buf.Bytes(), 0666)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "wincallback: %s\n", err)
+ os.Exit(2)
+ }
+}
+
func gengo() {
var buf bytes.Buffer
@@ -91,5 +120,6 @@ const cb_max = %d // maximum number of windows callbacks allowed
func main() {
genasm386Amd64()
genasmArm()
+ genasmArm64()
gengo()
}
diff --git a/src/runtime/write_err.go b/src/runtime/write_err.go
index 6b1467b1c4..a4656fd728 100644
--- a/src/runtime/write_err.go
+++ b/src/runtime/write_err.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !android
// +build !android
package runtime
diff --git a/src/runtime/zcallback_windows_arm64.s b/src/runtime/zcallback_windows_arm64.s
new file mode 100644
index 0000000000..69fb05788c
--- /dev/null
+++ b/src/runtime/zcallback_windows_arm64.s
@@ -0,0 +1,4012 @@
+// Code generated by wincallback.go using 'go generate'. DO NOT EDIT.
+
+// External code calls into callbackasm at an offset corresponding
+// to the callback index. Callbackasm is a table of MOV and B instructions.
+// The MOV instruction loads R12 with the callback index, and the
+// B instruction branches to callbackasm1.
+// callbackasm1 takes the callback index from R12 and
+// indexes into an array that stores information about each callback.
+// It then calls the Go implementation for that callback.
+#include "textflag.h"
+
+TEXT runtime·callbackasm(SB),NOSPLIT|NOFRAME,$0
+ MOVD $0, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1, R12
+ B runtime·callbackasm1(SB)
+ MOVD $2, R12
+ B runtime·callbackasm1(SB)
+ MOVD $3, R12
+ B runtime·callbackasm1(SB)
+ MOVD $4, R12
+ B runtime·callbackasm1(SB)
+ MOVD $5, R12
+ B runtime·callbackasm1(SB)
+ MOVD $6, R12
+ B runtime·callbackasm1(SB)
+ MOVD $7, R12
+ B runtime·callbackasm1(SB)
+ MOVD $8, R12
+ B runtime·callbackasm1(SB)
+ MOVD $9, R12
+ B runtime·callbackasm1(SB)
+ MOVD $10, R12
+ B runtime·callbackasm1(SB)
+ MOVD $11, R12
+ B runtime·callbackasm1(SB)
+ MOVD $12, R12
+ B runtime·callbackasm1(SB)
+ MOVD $13, R12
+ B runtime·callbackasm1(SB)
+ MOVD $14, R12
+ B runtime·callbackasm1(SB)
+ MOVD $15, R12
+ B runtime·callbackasm1(SB)
+ MOVD $16, R12
+ B runtime·callbackasm1(SB)
+ MOVD $17, R12
+ B runtime·callbackasm1(SB)
+ MOVD $18, R12
+ B runtime·callbackasm1(SB)
+ MOVD $19, R12
+ B runtime·callbackasm1(SB)
+ MOVD $20, R12
+ B runtime·callbackasm1(SB)
+ MOVD $21, R12
+ B runtime·callbackasm1(SB)
+ MOVD $22, R12
+ B runtime·callbackasm1(SB)
+ MOVD $23, R12
+ B runtime·callbackasm1(SB)
+ MOVD $24, R12
+ B runtime·callbackasm1(SB)
+ MOVD $25, R12
+ B runtime·callbackasm1(SB)
+ MOVD $26, R12
+ B runtime·callbackasm1(SB)
+ MOVD $27, R12
+ B runtime·callbackasm1(SB)
+ MOVD $28, R12
+ B runtime·callbackasm1(SB)
+ MOVD $29, R12
+ B runtime·callbackasm1(SB)
+ MOVD $30, R12
+ B runtime·callbackasm1(SB)
+ MOVD $31, R12
+ B runtime·callbackasm1(SB)
+ MOVD $32, R12
+ B runtime·callbackasm1(SB)
+ MOVD $33, R12
+ B runtime·callbackasm1(SB)
+ MOVD $34, R12
+ B runtime·callbackasm1(SB)
+ MOVD $35, R12
+ B runtime·callbackasm1(SB)
+ MOVD $36, R12
+ B runtime·callbackasm1(SB)
+ MOVD $37, R12
+ B runtime·callbackasm1(SB)
+ MOVD $38, R12
+ B runtime·callbackasm1(SB)
+ MOVD $39, R12
+ B runtime·callbackasm1(SB)
+ MOVD $40, R12
+ B runtime·callbackasm1(SB)
+ MOVD $41, R12
+ B runtime·callbackasm1(SB)
+ MOVD $42, R12
+ B runtime·callbackasm1(SB)
+ MOVD $43, R12
+ B runtime·callbackasm1(SB)
+ MOVD $44, R12
+ B runtime·callbackasm1(SB)
+ MOVD $45, R12
+ B runtime·callbackasm1(SB)
+ MOVD $46, R12
+ B runtime·callbackasm1(SB)
+ MOVD $47, R12
+ B runtime·callbackasm1(SB)
+ MOVD $48, R12
+ B runtime·callbackasm1(SB)
+ MOVD $49, R12
+ B runtime·callbackasm1(SB)
+ MOVD $50, R12
+ B runtime·callbackasm1(SB)
+ MOVD $51, R12
+ B runtime·callbackasm1(SB)
+ MOVD $52, R12
+ B runtime·callbackasm1(SB)
+ MOVD $53, R12
+ B runtime·callbackasm1(SB)
+ MOVD $54, R12
+ B runtime·callbackasm1(SB)
+ MOVD $55, R12
+ B runtime·callbackasm1(SB)
+ MOVD $56, R12
+ B runtime·callbackasm1(SB)
+ MOVD $57, R12
+ B runtime·callbackasm1(SB)
+ MOVD $58, R12
+ B runtime·callbackasm1(SB)
+ MOVD $59, R12
+ B runtime·callbackasm1(SB)
+ MOVD $60, R12
+ B runtime·callbackasm1(SB)
+ MOVD $61, R12
+ B runtime·callbackasm1(SB)
+ MOVD $62, R12
+ B runtime·callbackasm1(SB)
+ MOVD $63, R12
+ B runtime·callbackasm1(SB)
+ MOVD $64, R12
+ B runtime·callbackasm1(SB)
+ MOVD $65, R12
+ B runtime·callbackasm1(SB)
+ MOVD $66, R12
+ B runtime·callbackasm1(SB)
+ MOVD $67, R12
+ B runtime·callbackasm1(SB)
+ MOVD $68, R12
+ B runtime·callbackasm1(SB)
+ MOVD $69, R12
+ B runtime·callbackasm1(SB)
+ MOVD $70, R12
+ B runtime·callbackasm1(SB)
+ MOVD $71, R12
+ B runtime·callbackasm1(SB)
+ MOVD $72, R12
+ B runtime·callbackasm1(SB)
+ MOVD $73, R12
+ B runtime·callbackasm1(SB)
+ MOVD $74, R12
+ B runtime·callbackasm1(SB)
+ MOVD $75, R12
+ B runtime·callbackasm1(SB)
+ MOVD $76, R12
+ B runtime·callbackasm1(SB)
+ MOVD $77, R12
+ B runtime·callbackasm1(SB)
+ MOVD $78, R12
+ B runtime·callbackasm1(SB)
+ MOVD $79, R12
+ B runtime·callbackasm1(SB)
+ MOVD $80, R12
+ B runtime·callbackasm1(SB)
+ MOVD $81, R12
+ B runtime·callbackasm1(SB)
+ MOVD $82, R12
+ B runtime·callbackasm1(SB)
+ MOVD $83, R12
+ B runtime·callbackasm1(SB)
+ MOVD $84, R12
+ B runtime·callbackasm1(SB)
+ MOVD $85, R12
+ B runtime·callbackasm1(SB)
+ MOVD $86, R12
+ B runtime·callbackasm1(SB)
+ MOVD $87, R12
+ B runtime·callbackasm1(SB)
+ MOVD $88, R12
+ B runtime·callbackasm1(SB)
+ MOVD $89, R12
+ B runtime·callbackasm1(SB)
+ MOVD $90, R12
+ B runtime·callbackasm1(SB)
+ MOVD $91, R12
+ B runtime·callbackasm1(SB)
+ MOVD $92, R12
+ B runtime·callbackasm1(SB)
+ MOVD $93, R12
+ B runtime·callbackasm1(SB)
+ MOVD $94, R12
+ B runtime·callbackasm1(SB)
+ MOVD $95, R12
+ B runtime·callbackasm1(SB)
+ MOVD $96, R12
+ B runtime·callbackasm1(SB)
+ MOVD $97, R12
+ B runtime·callbackasm1(SB)
+ MOVD $98, R12
+ B runtime·callbackasm1(SB)
+ MOVD $99, R12
+ B runtime·callbackasm1(SB)
+ MOVD $100, R12
+ B runtime·callbackasm1(SB)
+ MOVD $101, R12
+ B runtime·callbackasm1(SB)
+ MOVD $102, R12
+ B runtime·callbackasm1(SB)
+ MOVD $103, R12
+ B runtime·callbackasm1(SB)
+ MOVD $104, R12
+ B runtime·callbackasm1(SB)
+ MOVD $105, R12
+ B runtime·callbackasm1(SB)
+ MOVD $106, R12
+ B runtime·callbackasm1(SB)
+ MOVD $107, R12
+ B runtime·callbackasm1(SB)
+ MOVD $108, R12
+ B runtime·callbackasm1(SB)
+ MOVD $109, R12
+ B runtime·callbackasm1(SB)
+ MOVD $110, R12
+ B runtime·callbackasm1(SB)
+ MOVD $111, R12
+ B runtime·callbackasm1(SB)
+ MOVD $112, R12
+ B runtime·callbackasm1(SB)
+ MOVD $113, R12
+ B runtime·callbackasm1(SB)
+ MOVD $114, R12
+ B runtime·callbackasm1(SB)
+ MOVD $115, R12
+ B runtime·callbackasm1(SB)
+ MOVD $116, R12
+ B runtime·callbackasm1(SB)
+ MOVD $117, R12
+ B runtime·callbackasm1(SB)
+ MOVD $118, R12
+ B runtime·callbackasm1(SB)
+ MOVD $119, R12
+ B runtime·callbackasm1(SB)
+ MOVD $120, R12
+ B runtime·callbackasm1(SB)
+ MOVD $121, R12
+ B runtime·callbackasm1(SB)
+ MOVD $122, R12
+ B runtime·callbackasm1(SB)
+ MOVD $123, R12
+ B runtime·callbackasm1(SB)
+ MOVD $124, R12
+ B runtime·callbackasm1(SB)
+ MOVD $125, R12
+ B runtime·callbackasm1(SB)
+ MOVD $126, R12
+ B runtime·callbackasm1(SB)
+ MOVD $127, R12
+ B runtime·callbackasm1(SB)
+ MOVD $128, R12
+ B runtime·callbackasm1(SB)
+ MOVD $129, R12
+ B runtime·callbackasm1(SB)
+ MOVD $130, R12
+ B runtime·callbackasm1(SB)
+ MOVD $131, R12
+ B runtime·callbackasm1(SB)
+ MOVD $132, R12
+ B runtime·callbackasm1(SB)
+ MOVD $133, R12
+ B runtime·callbackasm1(SB)
+ MOVD $134, R12
+ B runtime·callbackasm1(SB)
+ MOVD $135, R12
+ B runtime·callbackasm1(SB)
+ MOVD $136, R12
+ B runtime·callbackasm1(SB)
+ MOVD $137, R12
+ B runtime·callbackasm1(SB)
+ MOVD $138, R12
+ B runtime·callbackasm1(SB)
+ MOVD $139, R12
+ B runtime·callbackasm1(SB)
+ MOVD $140, R12
+ B runtime·callbackasm1(SB)
+ MOVD $141, R12
+ B runtime·callbackasm1(SB)
+ MOVD $142, R12
+ B runtime·callbackasm1(SB)
+ MOVD $143, R12
+ B runtime·callbackasm1(SB)
+ MOVD $144, R12
+ B runtime·callbackasm1(SB)
+ MOVD $145, R12
+ B runtime·callbackasm1(SB)
+ MOVD $146, R12
+ B runtime·callbackasm1(SB)
+ MOVD $147, R12
+ B runtime·callbackasm1(SB)
+ MOVD $148, R12
+ B runtime·callbackasm1(SB)
+ MOVD $149, R12
+ B runtime·callbackasm1(SB)
+ MOVD $150, R12
+ B runtime·callbackasm1(SB)
+ MOVD $151, R12
+ B runtime·callbackasm1(SB)
+ MOVD $152, R12
+ B runtime·callbackasm1(SB)
+ MOVD $153, R12
+ B runtime·callbackasm1(SB)
+ MOVD $154, R12
+ B runtime·callbackasm1(SB)
+ MOVD $155, R12
+ B runtime·callbackasm1(SB)
+ MOVD $156, R12
+ B runtime·callbackasm1(SB)
+ MOVD $157, R12
+ B runtime·callbackasm1(SB)
+ MOVD $158, R12
+ B runtime·callbackasm1(SB)
+ MOVD $159, R12
+ B runtime·callbackasm1(SB)
+ MOVD $160, R12
+ B runtime·callbackasm1(SB)
+ MOVD $161, R12
+ B runtime·callbackasm1(SB)
+ MOVD $162, R12
+ B runtime·callbackasm1(SB)
+ MOVD $163, R12
+ B runtime·callbackasm1(SB)
+ MOVD $164, R12
+ B runtime·callbackasm1(SB)
+ MOVD $165, R12
+ B runtime·callbackasm1(SB)
+ MOVD $166, R12
+ B runtime·callbackasm1(SB)
+ MOVD $167, R12
+ B runtime·callbackasm1(SB)
+ MOVD $168, R12
+ B runtime·callbackasm1(SB)
+ MOVD $169, R12
+ B runtime·callbackasm1(SB)
+ MOVD $170, R12
+ B runtime·callbackasm1(SB)
+ MOVD $171, R12
+ B runtime·callbackasm1(SB)
+ MOVD $172, R12
+ B runtime·callbackasm1(SB)
+ MOVD $173, R12
+ B runtime·callbackasm1(SB)
+ MOVD $174, R12
+ B runtime·callbackasm1(SB)
+ MOVD $175, R12
+ B runtime·callbackasm1(SB)
+ MOVD $176, R12
+ B runtime·callbackasm1(SB)
+ MOVD $177, R12
+ B runtime·callbackasm1(SB)
+ MOVD $178, R12
+ B runtime·callbackasm1(SB)
+ MOVD $179, R12
+ B runtime·callbackasm1(SB)
+ MOVD $180, R12
+ B runtime·callbackasm1(SB)
+ MOVD $181, R12
+ B runtime·callbackasm1(SB)
+ MOVD $182, R12
+ B runtime·callbackasm1(SB)
+ MOVD $183, R12
+ B runtime·callbackasm1(SB)
+ MOVD $184, R12
+ B runtime·callbackasm1(SB)
+ MOVD $185, R12
+ B runtime·callbackasm1(SB)
+ MOVD $186, R12
+ B runtime·callbackasm1(SB)
+ MOVD $187, R12
+ B runtime·callbackasm1(SB)
+ MOVD $188, R12
+ B runtime·callbackasm1(SB)
+ MOVD $189, R12
+ B runtime·callbackasm1(SB)
+ MOVD $190, R12
+ B runtime·callbackasm1(SB)
+ MOVD $191, R12
+ B runtime·callbackasm1(SB)
+ MOVD $192, R12
+ B runtime·callbackasm1(SB)
+ MOVD $193, R12
+ B runtime·callbackasm1(SB)
+ MOVD $194, R12
+ B runtime·callbackasm1(SB)
+ MOVD $195, R12
+ B runtime·callbackasm1(SB)
+ MOVD $196, R12
+ B runtime·callbackasm1(SB)
+ MOVD $197, R12
+ B runtime·callbackasm1(SB)
+ MOVD $198, R12
+ B runtime·callbackasm1(SB)
+ MOVD $199, R12
+ B runtime·callbackasm1(SB)
+ MOVD $200, R12
+ B runtime·callbackasm1(SB)
+ MOVD $201, R12
+ B runtime·callbackasm1(SB)
+ MOVD $202, R12
+ B runtime·callbackasm1(SB)
+ MOVD $203, R12
+ B runtime·callbackasm1(SB)
+ MOVD $204, R12
+ B runtime·callbackasm1(SB)
+ MOVD $205, R12
+ B runtime·callbackasm1(SB)
+ MOVD $206, R12
+ B runtime·callbackasm1(SB)
+ MOVD $207, R12
+ B runtime·callbackasm1(SB)
+ MOVD $208, R12
+ B runtime·callbackasm1(SB)
+ MOVD $209, R12
+ B runtime·callbackasm1(SB)
+ MOVD $210, R12
+ B runtime·callbackasm1(SB)
+ MOVD $211, R12
+ B runtime·callbackasm1(SB)
+ MOVD $212, R12
+ B runtime·callbackasm1(SB)
+ MOVD $213, R12
+ B runtime·callbackasm1(SB)
+ MOVD $214, R12
+ B runtime·callbackasm1(SB)
+ MOVD $215, R12
+ B runtime·callbackasm1(SB)
+ MOVD $216, R12
+ B runtime·callbackasm1(SB)
+ MOVD $217, R12
+ B runtime·callbackasm1(SB)
+ MOVD $218, R12
+ B runtime·callbackasm1(SB)
+ MOVD $219, R12
+ B runtime·callbackasm1(SB)
+ MOVD $220, R12
+ B runtime·callbackasm1(SB)
+ MOVD $221, R12
+ B runtime·callbackasm1(SB)
+ MOVD $222, R12
+ B runtime·callbackasm1(SB)
+ MOVD $223, R12
+ B runtime·callbackasm1(SB)
+ MOVD $224, R12
+ B runtime·callbackasm1(SB)
+ MOVD $225, R12
+ B runtime·callbackasm1(SB)
+ MOVD $226, R12
+ B runtime·callbackasm1(SB)
+ MOVD $227, R12
+ B runtime·callbackasm1(SB)
+ MOVD $228, R12
+ B runtime·callbackasm1(SB)
+ MOVD $229, R12
+ B runtime·callbackasm1(SB)
+ MOVD $230, R12
+ B runtime·callbackasm1(SB)
+ MOVD $231, R12
+ B runtime·callbackasm1(SB)
+ MOVD $232, R12
+ B runtime·callbackasm1(SB)
+ MOVD $233, R12
+ B runtime·callbackasm1(SB)
+ MOVD $234, R12
+ B runtime·callbackasm1(SB)
+ MOVD $235, R12
+ B runtime·callbackasm1(SB)
+ MOVD $236, R12
+ B runtime·callbackasm1(SB)
+ MOVD $237, R12
+ B runtime·callbackasm1(SB)
+ MOVD $238, R12
+ B runtime·callbackasm1(SB)
+ MOVD $239, R12
+ B runtime·callbackasm1(SB)
+ MOVD $240, R12
+ B runtime·callbackasm1(SB)
+ MOVD $241, R12
+ B runtime·callbackasm1(SB)
+ MOVD $242, R12
+ B runtime·callbackasm1(SB)
+ MOVD $243, R12
+ B runtime·callbackasm1(SB)
+ MOVD $244, R12
+ B runtime·callbackasm1(SB)
+ MOVD $245, R12
+ B runtime·callbackasm1(SB)
+ MOVD $246, R12
+ B runtime·callbackasm1(SB)
+ MOVD $247, R12
+ B runtime·callbackasm1(SB)
+ MOVD $248, R12
+ B runtime·callbackasm1(SB)
+ MOVD $249, R12
+ B runtime·callbackasm1(SB)
+ MOVD $250, R12
+ B runtime·callbackasm1(SB)
+ MOVD $251, R12
+ B runtime·callbackasm1(SB)
+ MOVD $252, R12
+ B runtime·callbackasm1(SB)
+ MOVD $253, R12
+ B runtime·callbackasm1(SB)
+ MOVD $254, R12
+ B runtime·callbackasm1(SB)
+ MOVD $255, R12
+ B runtime·callbackasm1(SB)
+ MOVD $256, R12
+ B runtime·callbackasm1(SB)
+ MOVD $257, R12
+ B runtime·callbackasm1(SB)
+ MOVD $258, R12
+ B runtime·callbackasm1(SB)
+ MOVD $259, R12
+ B runtime·callbackasm1(SB)
+ MOVD $260, R12
+ B runtime·callbackasm1(SB)
+ MOVD $261, R12
+ B runtime·callbackasm1(SB)
+ MOVD $262, R12
+ B runtime·callbackasm1(SB)
+ MOVD $263, R12
+ B runtime·callbackasm1(SB)
+ MOVD $264, R12
+ B runtime·callbackasm1(SB)
+ MOVD $265, R12
+ B runtime·callbackasm1(SB)
+ MOVD $266, R12
+ B runtime·callbackasm1(SB)
+ MOVD $267, R12
+ B runtime·callbackasm1(SB)
+ MOVD $268, R12
+ B runtime·callbackasm1(SB)
+ MOVD $269, R12
+ B runtime·callbackasm1(SB)
+ MOVD $270, R12
+ B runtime·callbackasm1(SB)
+ MOVD $271, R12
+ B runtime·callbackasm1(SB)
+ MOVD $272, R12
+ B runtime·callbackasm1(SB)
+ MOVD $273, R12
+ B runtime·callbackasm1(SB)
+ MOVD $274, R12
+ B runtime·callbackasm1(SB)
+ MOVD $275, R12
+ B runtime·callbackasm1(SB)
+ MOVD $276, R12
+ B runtime·callbackasm1(SB)
+ MOVD $277, R12
+ B runtime·callbackasm1(SB)
+ MOVD $278, R12
+ B runtime·callbackasm1(SB)
+ MOVD $279, R12
+ B runtime·callbackasm1(SB)
+ MOVD $280, R12
+ B runtime·callbackasm1(SB)
+ MOVD $281, R12
+ B runtime·callbackasm1(SB)
+ MOVD $282, R12
+ B runtime·callbackasm1(SB)
+ MOVD $283, R12
+ B runtime·callbackasm1(SB)
+ MOVD $284, R12
+ B runtime·callbackasm1(SB)
+ MOVD $285, R12
+ B runtime·callbackasm1(SB)
+ MOVD $286, R12
+ B runtime·callbackasm1(SB)
+ MOVD $287, R12
+ B runtime·callbackasm1(SB)
+ MOVD $288, R12
+ B runtime·callbackasm1(SB)
+ MOVD $289, R12
+ B runtime·callbackasm1(SB)
+ MOVD $290, R12
+ B runtime·callbackasm1(SB)
+ MOVD $291, R12
+ B runtime·callbackasm1(SB)
+ MOVD $292, R12
+ B runtime·callbackasm1(SB)
+ MOVD $293, R12
+ B runtime·callbackasm1(SB)
+ MOVD $294, R12
+ B runtime·callbackasm1(SB)
+ MOVD $295, R12
+ B runtime·callbackasm1(SB)
+ MOVD $296, R12
+ B runtime·callbackasm1(SB)
+ MOVD $297, R12
+ B runtime·callbackasm1(SB)
+ MOVD $298, R12
+ B runtime·callbackasm1(SB)
+ MOVD $299, R12
+ B runtime·callbackasm1(SB)
+ MOVD $300, R12
+ B runtime·callbackasm1(SB)
+ MOVD $301, R12
+ B runtime·callbackasm1(SB)
+ MOVD $302, R12
+ B runtime·callbackasm1(SB)
+ MOVD $303, R12
+ B runtime·callbackasm1(SB)
+ MOVD $304, R12
+ B runtime·callbackasm1(SB)
+ MOVD $305, R12
+ B runtime·callbackasm1(SB)
+ MOVD $306, R12
+ B runtime·callbackasm1(SB)
+ MOVD $307, R12
+ B runtime·callbackasm1(SB)
+ MOVD $308, R12
+ B runtime·callbackasm1(SB)
+ MOVD $309, R12
+ B runtime·callbackasm1(SB)
+ MOVD $310, R12
+ B runtime·callbackasm1(SB)
+ MOVD $311, R12
+ B runtime·callbackasm1(SB)
+ MOVD $312, R12
+ B runtime·callbackasm1(SB)
+ MOVD $313, R12
+ B runtime·callbackasm1(SB)
+ MOVD $314, R12
+ B runtime·callbackasm1(SB)
+ MOVD $315, R12
+ B runtime·callbackasm1(SB)
+ MOVD $316, R12
+ B runtime·callbackasm1(SB)
+ MOVD $317, R12
+ B runtime·callbackasm1(SB)
+ MOVD $318, R12
+ B runtime·callbackasm1(SB)
+ MOVD $319, R12
+ B runtime·callbackasm1(SB)
+ MOVD $320, R12
+ B runtime·callbackasm1(SB)
+ MOVD $321, R12
+ B runtime·callbackasm1(SB)
+ MOVD $322, R12
+ B runtime·callbackasm1(SB)
+ MOVD $323, R12
+ B runtime·callbackasm1(SB)
+ MOVD $324, R12
+ B runtime·callbackasm1(SB)
+ MOVD $325, R12
+ B runtime·callbackasm1(SB)
+ MOVD $326, R12
+ B runtime·callbackasm1(SB)
+ MOVD $327, R12
+ B runtime·callbackasm1(SB)
+ MOVD $328, R12
+ B runtime·callbackasm1(SB)
+ MOVD $329, R12
+ B runtime·callbackasm1(SB)
+ MOVD $330, R12
+ B runtime·callbackasm1(SB)
+ MOVD $331, R12
+ B runtime·callbackasm1(SB)
+ MOVD $332, R12
+ B runtime·callbackasm1(SB)
+ MOVD $333, R12
+ B runtime·callbackasm1(SB)
+ MOVD $334, R12
+ B runtime·callbackasm1(SB)
+ MOVD $335, R12
+ B runtime·callbackasm1(SB)
+ MOVD $336, R12
+ B runtime·callbackasm1(SB)
+ MOVD $337, R12
+ B runtime·callbackasm1(SB)
+ MOVD $338, R12
+ B runtime·callbackasm1(SB)
+ MOVD $339, R12
+ B runtime·callbackasm1(SB)
+ MOVD $340, R12
+ B runtime·callbackasm1(SB)
+ MOVD $341, R12
+ B runtime·callbackasm1(SB)
+ MOVD $342, R12
+ B runtime·callbackasm1(SB)
+ MOVD $343, R12
+ B runtime·callbackasm1(SB)
+ MOVD $344, R12
+ B runtime·callbackasm1(SB)
+ MOVD $345, R12
+ B runtime·callbackasm1(SB)
+ MOVD $346, R12
+ B runtime·callbackasm1(SB)
+ MOVD $347, R12
+ B runtime·callbackasm1(SB)
+ MOVD $348, R12
+ B runtime·callbackasm1(SB)
+ MOVD $349, R12
+ B runtime·callbackasm1(SB)
+ MOVD $350, R12
+ B runtime·callbackasm1(SB)
+ MOVD $351, R12
+ B runtime·callbackasm1(SB)
+ MOVD $352, R12
+ B runtime·callbackasm1(SB)
+ MOVD $353, R12
+ B runtime·callbackasm1(SB)
+ MOVD $354, R12
+ B runtime·callbackasm1(SB)
+ MOVD $355, R12
+ B runtime·callbackasm1(SB)
+ MOVD $356, R12
+ B runtime·callbackasm1(SB)
+ MOVD $357, R12
+ B runtime·callbackasm1(SB)
+ MOVD $358, R12
+ B runtime·callbackasm1(SB)
+ MOVD $359, R12
+ B runtime·callbackasm1(SB)
+ MOVD $360, R12
+ B runtime·callbackasm1(SB)
+ MOVD $361, R12
+ B runtime·callbackasm1(SB)
+ MOVD $362, R12
+ B runtime·callbackasm1(SB)
+ MOVD $363, R12
+ B runtime·callbackasm1(SB)
+ MOVD $364, R12
+ B runtime·callbackasm1(SB)
+ MOVD $365, R12
+ B runtime·callbackasm1(SB)
+ MOVD $366, R12
+ B runtime·callbackasm1(SB)
+ MOVD $367, R12
+ B runtime·callbackasm1(SB)
+ MOVD $368, R12
+ B runtime·callbackasm1(SB)
+ MOVD $369, R12
+ B runtime·callbackasm1(SB)
+ MOVD $370, R12
+ B runtime·callbackasm1(SB)
+ MOVD $371, R12
+ B runtime·callbackasm1(SB)
+ MOVD $372, R12
+ B runtime·callbackasm1(SB)
+ MOVD $373, R12
+ B runtime·callbackasm1(SB)
+ MOVD $374, R12
+ B runtime·callbackasm1(SB)
+ MOVD $375, R12
+ B runtime·callbackasm1(SB)
+ MOVD $376, R12
+ B runtime·callbackasm1(SB)
+ MOVD $377, R12
+ B runtime·callbackasm1(SB)
+ MOVD $378, R12
+ B runtime·callbackasm1(SB)
+ MOVD $379, R12
+ B runtime·callbackasm1(SB)
+ MOVD $380, R12
+ B runtime·callbackasm1(SB)
+ MOVD $381, R12
+ B runtime·callbackasm1(SB)
+ MOVD $382, R12
+ B runtime·callbackasm1(SB)
+ MOVD $383, R12
+ B runtime·callbackasm1(SB)
+ MOVD $384, R12
+ B runtime·callbackasm1(SB)
+ MOVD $385, R12
+ B runtime·callbackasm1(SB)
+ MOVD $386, R12
+ B runtime·callbackasm1(SB)
+ MOVD $387, R12
+ B runtime·callbackasm1(SB)
+ MOVD $388, R12
+ B runtime·callbackasm1(SB)
+ MOVD $389, R12
+ B runtime·callbackasm1(SB)
+ MOVD $390, R12
+ B runtime·callbackasm1(SB)
+ MOVD $391, R12
+ B runtime·callbackasm1(SB)
+ MOVD $392, R12
+ B runtime·callbackasm1(SB)
+ MOVD $393, R12
+ B runtime·callbackasm1(SB)
+ MOVD $394, R12
+ B runtime·callbackasm1(SB)
+ MOVD $395, R12
+ B runtime·callbackasm1(SB)
+ MOVD $396, R12
+ B runtime·callbackasm1(SB)
+ MOVD $397, R12
+ B runtime·callbackasm1(SB)
+ MOVD $398, R12
+ B runtime·callbackasm1(SB)
+ MOVD $399, R12
+ B runtime·callbackasm1(SB)
+ MOVD $400, R12
+ B runtime·callbackasm1(SB)
+ MOVD $401, R12
+ B runtime·callbackasm1(SB)
+ MOVD $402, R12
+ B runtime·callbackasm1(SB)
+ MOVD $403, R12
+ B runtime·callbackasm1(SB)
+ MOVD $404, R12
+ B runtime·callbackasm1(SB)
+ MOVD $405, R12
+ B runtime·callbackasm1(SB)
+ MOVD $406, R12
+ B runtime·callbackasm1(SB)
+ MOVD $407, R12
+ B runtime·callbackasm1(SB)
+ MOVD $408, R12
+ B runtime·callbackasm1(SB)
+ MOVD $409, R12
+ B runtime·callbackasm1(SB)
+ MOVD $410, R12
+ B runtime·callbackasm1(SB)
+ MOVD $411, R12
+ B runtime·callbackasm1(SB)
+ MOVD $412, R12
+ B runtime·callbackasm1(SB)
+ MOVD $413, R12
+ B runtime·callbackasm1(SB)
+ MOVD $414, R12
+ B runtime·callbackasm1(SB)
+ MOVD $415, R12
+ B runtime·callbackasm1(SB)
+ MOVD $416, R12
+ B runtime·callbackasm1(SB)
+ MOVD $417, R12
+ B runtime·callbackasm1(SB)
+ MOVD $418, R12
+ B runtime·callbackasm1(SB)
+ MOVD $419, R12
+ B runtime·callbackasm1(SB)
+ MOVD $420, R12
+ B runtime·callbackasm1(SB)
+ MOVD $421, R12
+ B runtime·callbackasm1(SB)
+ MOVD $422, R12
+ B runtime·callbackasm1(SB)
+ MOVD $423, R12
+ B runtime·callbackasm1(SB)
+ MOVD $424, R12
+ B runtime·callbackasm1(SB)
+ MOVD $425, R12
+ B runtime·callbackasm1(SB)
+ MOVD $426, R12
+ B runtime·callbackasm1(SB)
+ MOVD $427, R12
+ B runtime·callbackasm1(SB)
+ MOVD $428, R12
+ B runtime·callbackasm1(SB)
+ MOVD $429, R12
+ B runtime·callbackasm1(SB)
+ MOVD $430, R12
+ B runtime·callbackasm1(SB)
+ MOVD $431, R12
+ B runtime·callbackasm1(SB)
+ MOVD $432, R12
+ B runtime·callbackasm1(SB)
+ MOVD $433, R12
+ B runtime·callbackasm1(SB)
+ MOVD $434, R12
+ B runtime·callbackasm1(SB)
+ MOVD $435, R12
+ B runtime·callbackasm1(SB)
+ MOVD $436, R12
+ B runtime·callbackasm1(SB)
+ MOVD $437, R12
+ B runtime·callbackasm1(SB)
+ MOVD $438, R12
+ B runtime·callbackasm1(SB)
+ MOVD $439, R12
+ B runtime·callbackasm1(SB)
+ MOVD $440, R12
+ B runtime·callbackasm1(SB)
+ MOVD $441, R12
+ B runtime·callbackasm1(SB)
+ MOVD $442, R12
+ B runtime·callbackasm1(SB)
+ MOVD $443, R12
+ B runtime·callbackasm1(SB)
+ MOVD $444, R12
+ B runtime·callbackasm1(SB)
+ MOVD $445, R12
+ B runtime·callbackasm1(SB)
+ MOVD $446, R12
+ B runtime·callbackasm1(SB)
+ MOVD $447, R12
+ B runtime·callbackasm1(SB)
+ MOVD $448, R12
+ B runtime·callbackasm1(SB)
+ MOVD $449, R12
+ B runtime·callbackasm1(SB)
+ MOVD $450, R12
+ B runtime·callbackasm1(SB)
+ MOVD $451, R12
+ B runtime·callbackasm1(SB)
+ MOVD $452, R12
+ B runtime·callbackasm1(SB)
+ MOVD $453, R12
+ B runtime·callbackasm1(SB)
+ MOVD $454, R12
+ B runtime·callbackasm1(SB)
+ MOVD $455, R12
+ B runtime·callbackasm1(SB)
+ MOVD $456, R12
+ B runtime·callbackasm1(SB)
+ MOVD $457, R12
+ B runtime·callbackasm1(SB)
+ MOVD $458, R12
+ B runtime·callbackasm1(SB)
+ MOVD $459, R12
+ B runtime·callbackasm1(SB)
+ MOVD $460, R12
+ B runtime·callbackasm1(SB)
+ MOVD $461, R12
+ B runtime·callbackasm1(SB)
+ MOVD $462, R12
+ B runtime·callbackasm1(SB)
+ MOVD $463, R12
+ B runtime·callbackasm1(SB)
+ MOVD $464, R12
+ B runtime·callbackasm1(SB)
+ MOVD $465, R12
+ B runtime·callbackasm1(SB)
+ MOVD $466, R12
+ B runtime·callbackasm1(SB)
+ MOVD $467, R12
+ B runtime·callbackasm1(SB)
+ MOVD $468, R12
+ B runtime·callbackasm1(SB)
+ MOVD $469, R12
+ B runtime·callbackasm1(SB)
+ MOVD $470, R12
+ B runtime·callbackasm1(SB)
+ MOVD $471, R12
+ B runtime·callbackasm1(SB)
+ MOVD $472, R12
+ B runtime·callbackasm1(SB)
+ MOVD $473, R12
+ B runtime·callbackasm1(SB)
+ MOVD $474, R12
+ B runtime·callbackasm1(SB)
+ MOVD $475, R12
+ B runtime·callbackasm1(SB)
+ MOVD $476, R12
+ B runtime·callbackasm1(SB)
+ MOVD $477, R12
+ B runtime·callbackasm1(SB)
+ MOVD $478, R12
+ B runtime·callbackasm1(SB)
+ MOVD $479, R12
+ B runtime·callbackasm1(SB)
+ MOVD $480, R12
+ B runtime·callbackasm1(SB)
+ MOVD $481, R12
+ B runtime·callbackasm1(SB)
+ MOVD $482, R12
+ B runtime·callbackasm1(SB)
+ MOVD $483, R12
+ B runtime·callbackasm1(SB)
+ MOVD $484, R12
+ B runtime·callbackasm1(SB)
+ MOVD $485, R12
+ B runtime·callbackasm1(SB)
+ MOVD $486, R12
+ B runtime·callbackasm1(SB)
+ MOVD $487, R12
+ B runtime·callbackasm1(SB)
+ MOVD $488, R12
+ B runtime·callbackasm1(SB)
+ MOVD $489, R12
+ B runtime·callbackasm1(SB)
+ MOVD $490, R12
+ B runtime·callbackasm1(SB)
+ MOVD $491, R12
+ B runtime·callbackasm1(SB)
+ MOVD $492, R12
+ B runtime·callbackasm1(SB)
+ MOVD $493, R12
+ B runtime·callbackasm1(SB)
+ MOVD $494, R12
+ B runtime·callbackasm1(SB)
+ MOVD $495, R12
+ B runtime·callbackasm1(SB)
+ MOVD $496, R12
+ B runtime·callbackasm1(SB)
+ MOVD $497, R12
+ B runtime·callbackasm1(SB)
+ MOVD $498, R12
+ B runtime·callbackasm1(SB)
+ MOVD $499, R12
+ B runtime·callbackasm1(SB)
+ MOVD $500, R12
+ B runtime·callbackasm1(SB)
+ MOVD $501, R12
+ B runtime·callbackasm1(SB)
+ MOVD $502, R12
+ B runtime·callbackasm1(SB)
+ MOVD $503, R12
+ B runtime·callbackasm1(SB)
+ MOVD $504, R12
+ B runtime·callbackasm1(SB)
+ MOVD $505, R12
+ B runtime·callbackasm1(SB)
+ MOVD $506, R12
+ B runtime·callbackasm1(SB)
+ MOVD $507, R12
+ B runtime·callbackasm1(SB)
+ MOVD $508, R12
+ B runtime·callbackasm1(SB)
+ MOVD $509, R12
+ B runtime·callbackasm1(SB)
+ MOVD $510, R12
+ B runtime·callbackasm1(SB)
+ MOVD $511, R12
+ B runtime·callbackasm1(SB)
+ MOVD $512, R12
+ B runtime·callbackasm1(SB)
+ MOVD $513, R12
+ B runtime·callbackasm1(SB)
+ MOVD $514, R12
+ B runtime·callbackasm1(SB)
+ MOVD $515, R12
+ B runtime·callbackasm1(SB)
+ MOVD $516, R12
+ B runtime·callbackasm1(SB)
+ MOVD $517, R12
+ B runtime·callbackasm1(SB)
+ MOVD $518, R12
+ B runtime·callbackasm1(SB)
+ MOVD $519, R12
+ B runtime·callbackasm1(SB)
+ MOVD $520, R12
+ B runtime·callbackasm1(SB)
+ MOVD $521, R12
+ B runtime·callbackasm1(SB)
+ MOVD $522, R12
+ B runtime·callbackasm1(SB)
+ MOVD $523, R12
+ B runtime·callbackasm1(SB)
+ MOVD $524, R12
+ B runtime·callbackasm1(SB)
+ MOVD $525, R12
+ B runtime·callbackasm1(SB)
+ MOVD $526, R12
+ B runtime·callbackasm1(SB)
+ MOVD $527, R12
+ B runtime·callbackasm1(SB)
+ MOVD $528, R12
+ B runtime·callbackasm1(SB)
+ MOVD $529, R12
+ B runtime·callbackasm1(SB)
+ MOVD $530, R12
+ B runtime·callbackasm1(SB)
+ MOVD $531, R12
+ B runtime·callbackasm1(SB)
+ MOVD $532, R12
+ B runtime·callbackasm1(SB)
+ MOVD $533, R12
+ B runtime·callbackasm1(SB)
+ MOVD $534, R12
+ B runtime·callbackasm1(SB)
+ MOVD $535, R12
+ B runtime·callbackasm1(SB)
+ MOVD $536, R12
+ B runtime·callbackasm1(SB)
+ MOVD $537, R12
+ B runtime·callbackasm1(SB)
+ MOVD $538, R12
+ B runtime·callbackasm1(SB)
+ MOVD $539, R12
+ B runtime·callbackasm1(SB)
+ MOVD $540, R12
+ B runtime·callbackasm1(SB)
+ MOVD $541, R12
+ B runtime·callbackasm1(SB)
+ MOVD $542, R12
+ B runtime·callbackasm1(SB)
+ MOVD $543, R12
+ B runtime·callbackasm1(SB)
+ MOVD $544, R12
+ B runtime·callbackasm1(SB)
+ MOVD $545, R12
+ B runtime·callbackasm1(SB)
+ MOVD $546, R12
+ B runtime·callbackasm1(SB)
+ MOVD $547, R12
+ B runtime·callbackasm1(SB)
+ MOVD $548, R12
+ B runtime·callbackasm1(SB)
+ MOVD $549, R12
+ B runtime·callbackasm1(SB)
+ MOVD $550, R12
+ B runtime·callbackasm1(SB)
+ MOVD $551, R12
+ B runtime·callbackasm1(SB)
+ MOVD $552, R12
+ B runtime·callbackasm1(SB)
+ MOVD $553, R12
+ B runtime·callbackasm1(SB)
+ MOVD $554, R12
+ B runtime·callbackasm1(SB)
+ MOVD $555, R12
+ B runtime·callbackasm1(SB)
+ MOVD $556, R12
+ B runtime·callbackasm1(SB)
+ MOVD $557, R12
+ B runtime·callbackasm1(SB)
+ MOVD $558, R12
+ B runtime·callbackasm1(SB)
+ MOVD $559, R12
+ B runtime·callbackasm1(SB)
+ MOVD $560, R12
+ B runtime·callbackasm1(SB)
+ MOVD $561, R12
+ B runtime·callbackasm1(SB)
+ MOVD $562, R12
+ B runtime·callbackasm1(SB)
+ MOVD $563, R12
+ B runtime·callbackasm1(SB)
+ MOVD $564, R12
+ B runtime·callbackasm1(SB)
+ MOVD $565, R12
+ B runtime·callbackasm1(SB)
+ MOVD $566, R12
+ B runtime·callbackasm1(SB)
+ MOVD $567, R12
+ B runtime·callbackasm1(SB)
+ MOVD $568, R12
+ B runtime·callbackasm1(SB)
+ MOVD $569, R12
+ B runtime·callbackasm1(SB)
+ MOVD $570, R12
+ B runtime·callbackasm1(SB)
+ MOVD $571, R12
+ B runtime·callbackasm1(SB)
+ MOVD $572, R12
+ B runtime·callbackasm1(SB)
+ MOVD $573, R12
+ B runtime·callbackasm1(SB)
+ MOVD $574, R12
+ B runtime·callbackasm1(SB)
+ MOVD $575, R12
+ B runtime·callbackasm1(SB)
+ MOVD $576, R12
+ B runtime·callbackasm1(SB)
+ MOVD $577, R12
+ B runtime·callbackasm1(SB)
+ MOVD $578, R12
+ B runtime·callbackasm1(SB)
+ MOVD $579, R12
+ B runtime·callbackasm1(SB)
+ MOVD $580, R12
+ B runtime·callbackasm1(SB)
+ MOVD $581, R12
+ B runtime·callbackasm1(SB)
+ MOVD $582, R12
+ B runtime·callbackasm1(SB)
+ MOVD $583, R12
+ B runtime·callbackasm1(SB)
+ MOVD $584, R12
+ B runtime·callbackasm1(SB)
+ MOVD $585, R12
+ B runtime·callbackasm1(SB)
+ MOVD $586, R12
+ B runtime·callbackasm1(SB)
+ MOVD $587, R12
+ B runtime·callbackasm1(SB)
+ MOVD $588, R12
+ B runtime·callbackasm1(SB)
+ MOVD $589, R12
+ B runtime·callbackasm1(SB)
+ MOVD $590, R12
+ B runtime·callbackasm1(SB)
+ MOVD $591, R12
+ B runtime·callbackasm1(SB)
+ MOVD $592, R12
+ B runtime·callbackasm1(SB)
+ MOVD $593, R12
+ B runtime·callbackasm1(SB)
+ MOVD $594, R12
+ B runtime·callbackasm1(SB)
+ MOVD $595, R12
+ B runtime·callbackasm1(SB)
+ MOVD $596, R12
+ B runtime·callbackasm1(SB)
+ MOVD $597, R12
+ B runtime·callbackasm1(SB)
+ MOVD $598, R12
+ B runtime·callbackasm1(SB)
+ MOVD $599, R12
+ B runtime·callbackasm1(SB)
+ MOVD $600, R12
+ B runtime·callbackasm1(SB)
+ MOVD $601, R12
+ B runtime·callbackasm1(SB)
+ MOVD $602, R12
+ B runtime·callbackasm1(SB)
+ MOVD $603, R12
+ B runtime·callbackasm1(SB)
+ MOVD $604, R12
+ B runtime·callbackasm1(SB)
+ MOVD $605, R12
+ B runtime·callbackasm1(SB)
+ MOVD $606, R12
+ B runtime·callbackasm1(SB)
+ MOVD $607, R12
+ B runtime·callbackasm1(SB)
+ MOVD $608, R12
+ B runtime·callbackasm1(SB)
+ MOVD $609, R12
+ B runtime·callbackasm1(SB)
+ MOVD $610, R12
+ B runtime·callbackasm1(SB)
+ MOVD $611, R12
+ B runtime·callbackasm1(SB)
+ MOVD $612, R12
+ B runtime·callbackasm1(SB)
+ MOVD $613, R12
+ B runtime·callbackasm1(SB)
+ MOVD $614, R12
+ B runtime·callbackasm1(SB)
+ MOVD $615, R12
+ B runtime·callbackasm1(SB)
+ MOVD $616, R12
+ B runtime·callbackasm1(SB)
+ MOVD $617, R12
+ B runtime·callbackasm1(SB)
+ MOVD $618, R12
+ B runtime·callbackasm1(SB)
+ MOVD $619, R12
+ B runtime·callbackasm1(SB)
+ MOVD $620, R12
+ B runtime·callbackasm1(SB)
+ MOVD $621, R12
+ B runtime·callbackasm1(SB)
+ MOVD $622, R12
+ B runtime·callbackasm1(SB)
+ MOVD $623, R12
+ B runtime·callbackasm1(SB)
+ MOVD $624, R12
+ B runtime·callbackasm1(SB)
+ MOVD $625, R12
+ B runtime·callbackasm1(SB)
+ MOVD $626, R12
+ B runtime·callbackasm1(SB)
+ MOVD $627, R12
+ B runtime·callbackasm1(SB)
+ MOVD $628, R12
+ B runtime·callbackasm1(SB)
+ MOVD $629, R12
+ B runtime·callbackasm1(SB)
+ MOVD $630, R12
+ B runtime·callbackasm1(SB)
+ MOVD $631, R12
+ B runtime·callbackasm1(SB)
+ MOVD $632, R12
+ B runtime·callbackasm1(SB)
+ MOVD $633, R12
+ B runtime·callbackasm1(SB)
+ MOVD $634, R12
+ B runtime·callbackasm1(SB)
+ MOVD $635, R12
+ B runtime·callbackasm1(SB)
+ MOVD $636, R12
+ B runtime·callbackasm1(SB)
+ MOVD $637, R12
+ B runtime·callbackasm1(SB)
+ MOVD $638, R12
+ B runtime·callbackasm1(SB)
+ MOVD $639, R12
+ B runtime·callbackasm1(SB)
+ MOVD $640, R12
+ B runtime·callbackasm1(SB)
+ MOVD $641, R12
+ B runtime·callbackasm1(SB)
+ MOVD $642, R12
+ B runtime·callbackasm1(SB)
+ MOVD $643, R12
+ B runtime·callbackasm1(SB)
+ MOVD $644, R12
+ B runtime·callbackasm1(SB)
+ MOVD $645, R12
+ B runtime·callbackasm1(SB)
+ MOVD $646, R12
+ B runtime·callbackasm1(SB)
+ MOVD $647, R12
+ B runtime·callbackasm1(SB)
+ MOVD $648, R12
+ B runtime·callbackasm1(SB)
+ MOVD $649, R12
+ B runtime·callbackasm1(SB)
+ MOVD $650, R12
+ B runtime·callbackasm1(SB)
+ MOVD $651, R12
+ B runtime·callbackasm1(SB)
+ MOVD $652, R12
+ B runtime·callbackasm1(SB)
+ MOVD $653, R12
+ B runtime·callbackasm1(SB)
+ MOVD $654, R12
+ B runtime·callbackasm1(SB)
+ MOVD $655, R12
+ B runtime·callbackasm1(SB)
+ MOVD $656, R12
+ B runtime·callbackasm1(SB)
+ MOVD $657, R12
+ B runtime·callbackasm1(SB)
+ MOVD $658, R12
+ B runtime·callbackasm1(SB)
+ MOVD $659, R12
+ B runtime·callbackasm1(SB)
+ MOVD $660, R12
+ B runtime·callbackasm1(SB)
+ MOVD $661, R12
+ B runtime·callbackasm1(SB)
+ MOVD $662, R12
+ B runtime·callbackasm1(SB)
+ MOVD $663, R12
+ B runtime·callbackasm1(SB)
+ MOVD $664, R12
+ B runtime·callbackasm1(SB)
+ MOVD $665, R12
+ B runtime·callbackasm1(SB)
+ MOVD $666, R12
+ B runtime·callbackasm1(SB)
+ MOVD $667, R12
+ B runtime·callbackasm1(SB)
+ MOVD $668, R12
+ B runtime·callbackasm1(SB)
+ MOVD $669, R12
+ B runtime·callbackasm1(SB)
+ MOVD $670, R12
+ B runtime·callbackasm1(SB)
+ MOVD $671, R12
+ B runtime·callbackasm1(SB)
+ MOVD $672, R12
+ B runtime·callbackasm1(SB)
+ MOVD $673, R12
+ B runtime·callbackasm1(SB)
+ MOVD $674, R12
+ B runtime·callbackasm1(SB)
+ MOVD $675, R12
+ B runtime·callbackasm1(SB)
+ MOVD $676, R12
+ B runtime·callbackasm1(SB)
+ MOVD $677, R12
+ B runtime·callbackasm1(SB)
+ MOVD $678, R12
+ B runtime·callbackasm1(SB)
+ MOVD $679, R12
+ B runtime·callbackasm1(SB)
+ MOVD $680, R12
+ B runtime·callbackasm1(SB)
+ MOVD $681, R12
+ B runtime·callbackasm1(SB)
+ MOVD $682, R12
+ B runtime·callbackasm1(SB)
+ MOVD $683, R12
+ B runtime·callbackasm1(SB)
+ MOVD $684, R12
+ B runtime·callbackasm1(SB)
+ MOVD $685, R12
+ B runtime·callbackasm1(SB)
+ MOVD $686, R12
+ B runtime·callbackasm1(SB)
+ MOVD $687, R12
+ B runtime·callbackasm1(SB)
+ MOVD $688, R12
+ B runtime·callbackasm1(SB)
+ MOVD $689, R12
+ B runtime·callbackasm1(SB)
+ MOVD $690, R12
+ B runtime·callbackasm1(SB)
+ MOVD $691, R12
+ B runtime·callbackasm1(SB)
+ MOVD $692, R12
+ B runtime·callbackasm1(SB)
+ MOVD $693, R12
+ B runtime·callbackasm1(SB)
+ MOVD $694, R12
+ B runtime·callbackasm1(SB)
+ MOVD $695, R12
+ B runtime·callbackasm1(SB)
+ MOVD $696, R12
+ B runtime·callbackasm1(SB)
+ MOVD $697, R12
+ B runtime·callbackasm1(SB)
+ MOVD $698, R12
+ B runtime·callbackasm1(SB)
+ MOVD $699, R12
+ B runtime·callbackasm1(SB)
+ MOVD $700, R12
+ B runtime·callbackasm1(SB)
+ MOVD $701, R12
+ B runtime·callbackasm1(SB)
+ MOVD $702, R12
+ B runtime·callbackasm1(SB)
+ MOVD $703, R12
+ B runtime·callbackasm1(SB)
+ MOVD $704, R12
+ B runtime·callbackasm1(SB)
+ MOVD $705, R12
+ B runtime·callbackasm1(SB)
+ MOVD $706, R12
+ B runtime·callbackasm1(SB)
+ MOVD $707, R12
+ B runtime·callbackasm1(SB)
+ MOVD $708, R12
+ B runtime·callbackasm1(SB)
+ MOVD $709, R12
+ B runtime·callbackasm1(SB)
+ MOVD $710, R12
+ B runtime·callbackasm1(SB)
+ MOVD $711, R12
+ B runtime·callbackasm1(SB)
+ MOVD $712, R12
+ B runtime·callbackasm1(SB)
+ MOVD $713, R12
+ B runtime·callbackasm1(SB)
+ MOVD $714, R12
+ B runtime·callbackasm1(SB)
+ MOVD $715, R12
+ B runtime·callbackasm1(SB)
+ MOVD $716, R12
+ B runtime·callbackasm1(SB)
+ MOVD $717, R12
+ B runtime·callbackasm1(SB)
+ MOVD $718, R12
+ B runtime·callbackasm1(SB)
+ MOVD $719, R12
+ B runtime·callbackasm1(SB)
+ MOVD $720, R12
+ B runtime·callbackasm1(SB)
+ MOVD $721, R12
+ B runtime·callbackasm1(SB)
+ MOVD $722, R12
+ B runtime·callbackasm1(SB)
+ MOVD $723, R12
+ B runtime·callbackasm1(SB)
+ MOVD $724, R12
+ B runtime·callbackasm1(SB)
+ MOVD $725, R12
+ B runtime·callbackasm1(SB)
+ MOVD $726, R12
+ B runtime·callbackasm1(SB)
+ MOVD $727, R12
+ B runtime·callbackasm1(SB)
+ MOVD $728, R12
+ B runtime·callbackasm1(SB)
+ MOVD $729, R12
+ B runtime·callbackasm1(SB)
+ MOVD $730, R12
+ B runtime·callbackasm1(SB)
+ MOVD $731, R12
+ B runtime·callbackasm1(SB)
+ MOVD $732, R12
+ B runtime·callbackasm1(SB)
+ MOVD $733, R12
+ B runtime·callbackasm1(SB)
+ MOVD $734, R12
+ B runtime·callbackasm1(SB)
+ MOVD $735, R12
+ B runtime·callbackasm1(SB)
+ MOVD $736, R12
+ B runtime·callbackasm1(SB)
+ MOVD $737, R12
+ B runtime·callbackasm1(SB)
+ MOVD $738, R12
+ B runtime·callbackasm1(SB)
+ MOVD $739, R12
+ B runtime·callbackasm1(SB)
+ MOVD $740, R12
+ B runtime·callbackasm1(SB)
+ MOVD $741, R12
+ B runtime·callbackasm1(SB)
+ MOVD $742, R12
+ B runtime·callbackasm1(SB)
+ MOVD $743, R12
+ B runtime·callbackasm1(SB)
+ MOVD $744, R12
+ B runtime·callbackasm1(SB)
+ MOVD $745, R12
+ B runtime·callbackasm1(SB)
+ MOVD $746, R12
+ B runtime·callbackasm1(SB)
+ MOVD $747, R12
+ B runtime·callbackasm1(SB)
+ MOVD $748, R12
+ B runtime·callbackasm1(SB)
+ MOVD $749, R12
+ B runtime·callbackasm1(SB)
+ MOVD $750, R12
+ B runtime·callbackasm1(SB)
+ MOVD $751, R12
+ B runtime·callbackasm1(SB)
+ MOVD $752, R12
+ B runtime·callbackasm1(SB)
+ MOVD $753, R12
+ B runtime·callbackasm1(SB)
+ MOVD $754, R12
+ B runtime·callbackasm1(SB)
+ MOVD $755, R12
+ B runtime·callbackasm1(SB)
+ MOVD $756, R12
+ B runtime·callbackasm1(SB)
+ MOVD $757, R12
+ B runtime·callbackasm1(SB)
+ MOVD $758, R12
+ B runtime·callbackasm1(SB)
+ MOVD $759, R12
+ B runtime·callbackasm1(SB)
+ MOVD $760, R12
+ B runtime·callbackasm1(SB)
+ MOVD $761, R12
+ B runtime·callbackasm1(SB)
+ MOVD $762, R12
+ B runtime·callbackasm1(SB)
+ MOVD $763, R12
+ B runtime·callbackasm1(SB)
+ MOVD $764, R12
+ B runtime·callbackasm1(SB)
+ MOVD $765, R12
+ B runtime·callbackasm1(SB)
+ MOVD $766, R12
+ B runtime·callbackasm1(SB)
+ MOVD $767, R12
+ B runtime·callbackasm1(SB)
+ MOVD $768, R12
+ B runtime·callbackasm1(SB)
+ MOVD $769, R12
+ B runtime·callbackasm1(SB)
+ MOVD $770, R12
+ B runtime·callbackasm1(SB)
+ MOVD $771, R12
+ B runtime·callbackasm1(SB)
+ MOVD $772, R12
+ B runtime·callbackasm1(SB)
+ MOVD $773, R12
+ B runtime·callbackasm1(SB)
+ MOVD $774, R12
+ B runtime·callbackasm1(SB)
+ MOVD $775, R12
+ B runtime·callbackasm1(SB)
+ MOVD $776, R12
+ B runtime·callbackasm1(SB)
+ MOVD $777, R12
+ B runtime·callbackasm1(SB)
+ MOVD $778, R12
+ B runtime·callbackasm1(SB)
+ MOVD $779, R12
+ B runtime·callbackasm1(SB)
+ MOVD $780, R12
+ B runtime·callbackasm1(SB)
+ MOVD $781, R12
+ B runtime·callbackasm1(SB)
+ MOVD $782, R12
+ B runtime·callbackasm1(SB)
+ MOVD $783, R12
+ B runtime·callbackasm1(SB)
+ MOVD $784, R12
+ B runtime·callbackasm1(SB)
+ MOVD $785, R12
+ B runtime·callbackasm1(SB)
+ MOVD $786, R12
+ B runtime·callbackasm1(SB)
+ MOVD $787, R12
+ B runtime·callbackasm1(SB)
+ MOVD $788, R12
+ B runtime·callbackasm1(SB)
+ MOVD $789, R12
+ B runtime·callbackasm1(SB)
+ MOVD $790, R12
+ B runtime·callbackasm1(SB)
+ MOVD $791, R12
+ B runtime·callbackasm1(SB)
+ MOVD $792, R12
+ B runtime·callbackasm1(SB)
+ MOVD $793, R12
+ B runtime·callbackasm1(SB)
+ MOVD $794, R12
+ B runtime·callbackasm1(SB)
+ MOVD $795, R12
+ B runtime·callbackasm1(SB)
+ MOVD $796, R12
+ B runtime·callbackasm1(SB)
+ MOVD $797, R12
+ B runtime·callbackasm1(SB)
+ MOVD $798, R12
+ B runtime·callbackasm1(SB)
+ MOVD $799, R12
+ B runtime·callbackasm1(SB)
+ MOVD $800, R12
+ B runtime·callbackasm1(SB)
+ MOVD $801, R12
+ B runtime·callbackasm1(SB)
+ MOVD $802, R12
+ B runtime·callbackasm1(SB)
+ MOVD $803, R12
+ B runtime·callbackasm1(SB)
+ MOVD $804, R12
+ B runtime·callbackasm1(SB)
+ MOVD $805, R12
+ B runtime·callbackasm1(SB)
+ MOVD $806, R12
+ B runtime·callbackasm1(SB)
+ MOVD $807, R12
+ B runtime·callbackasm1(SB)
+ MOVD $808, R12
+ B runtime·callbackasm1(SB)
+ MOVD $809, R12
+ B runtime·callbackasm1(SB)
+ MOVD $810, R12
+ B runtime·callbackasm1(SB)
+ MOVD $811, R12
+ B runtime·callbackasm1(SB)
+ MOVD $812, R12
+ B runtime·callbackasm1(SB)
+ MOVD $813, R12
+ B runtime·callbackasm1(SB)
+ MOVD $814, R12
+ B runtime·callbackasm1(SB)
+ MOVD $815, R12
+ B runtime·callbackasm1(SB)
+ MOVD $816, R12
+ B runtime·callbackasm1(SB)
+ MOVD $817, R12
+ B runtime·callbackasm1(SB)
+ MOVD $818, R12
+ B runtime·callbackasm1(SB)
+ MOVD $819, R12
+ B runtime·callbackasm1(SB)
+ MOVD $820, R12
+ B runtime·callbackasm1(SB)
+ MOVD $821, R12
+ B runtime·callbackasm1(SB)
+ MOVD $822, R12
+ B runtime·callbackasm1(SB)
+ MOVD $823, R12
+ B runtime·callbackasm1(SB)
+ MOVD $824, R12
+ B runtime·callbackasm1(SB)
+ MOVD $825, R12
+ B runtime·callbackasm1(SB)
+ MOVD $826, R12
+ B runtime·callbackasm1(SB)
+ MOVD $827, R12
+ B runtime·callbackasm1(SB)
+ MOVD $828, R12
+ B runtime·callbackasm1(SB)
+ MOVD $829, R12
+ B runtime·callbackasm1(SB)
+ MOVD $830, R12
+ B runtime·callbackasm1(SB)
+ MOVD $831, R12
+ B runtime·callbackasm1(SB)
+ MOVD $832, R12
+ B runtime·callbackasm1(SB)
+ MOVD $833, R12
+ B runtime·callbackasm1(SB)
+ MOVD $834, R12
+ B runtime·callbackasm1(SB)
+ MOVD $835, R12
+ B runtime·callbackasm1(SB)
+ MOVD $836, R12
+ B runtime·callbackasm1(SB)
+ MOVD $837, R12
+ B runtime·callbackasm1(SB)
+ MOVD $838, R12
+ B runtime·callbackasm1(SB)
+ MOVD $839, R12
+ B runtime·callbackasm1(SB)
+ MOVD $840, R12
+ B runtime·callbackasm1(SB)
+ MOVD $841, R12
+ B runtime·callbackasm1(SB)
+ MOVD $842, R12
+ B runtime·callbackasm1(SB)
+ MOVD $843, R12
+ B runtime·callbackasm1(SB)
+ MOVD $844, R12
+ B runtime·callbackasm1(SB)
+ MOVD $845, R12
+ B runtime·callbackasm1(SB)
+ MOVD $846, R12
+ B runtime·callbackasm1(SB)
+ MOVD $847, R12
+ B runtime·callbackasm1(SB)
+ MOVD $848, R12
+ B runtime·callbackasm1(SB)
+ MOVD $849, R12
+ B runtime·callbackasm1(SB)
+ MOVD $850, R12
+ B runtime·callbackasm1(SB)
+ MOVD $851, R12
+ B runtime·callbackasm1(SB)
+ MOVD $852, R12
+ B runtime·callbackasm1(SB)
+ MOVD $853, R12
+ B runtime·callbackasm1(SB)
+ MOVD $854, R12
+ B runtime·callbackasm1(SB)
+ MOVD $855, R12
+ B runtime·callbackasm1(SB)
+ MOVD $856, R12
+ B runtime·callbackasm1(SB)
+ MOVD $857, R12
+ B runtime·callbackasm1(SB)
+ MOVD $858, R12
+ B runtime·callbackasm1(SB)
+ MOVD $859, R12
+ B runtime·callbackasm1(SB)
+ MOVD $860, R12
+ B runtime·callbackasm1(SB)
+ MOVD $861, R12
+ B runtime·callbackasm1(SB)
+ MOVD $862, R12
+ B runtime·callbackasm1(SB)
+ MOVD $863, R12
+ B runtime·callbackasm1(SB)
+ MOVD $864, R12
+ B runtime·callbackasm1(SB)
+ MOVD $865, R12
+ B runtime·callbackasm1(SB)
+ MOVD $866, R12
+ B runtime·callbackasm1(SB)
+ MOVD $867, R12
+ B runtime·callbackasm1(SB)
+ MOVD $868, R12
+ B runtime·callbackasm1(SB)
+ MOVD $869, R12
+ B runtime·callbackasm1(SB)
+ MOVD $870, R12
+ B runtime·callbackasm1(SB)
+ MOVD $871, R12
+ B runtime·callbackasm1(SB)
+ MOVD $872, R12
+ B runtime·callbackasm1(SB)
+ MOVD $873, R12
+ B runtime·callbackasm1(SB)
+ MOVD $874, R12
+ B runtime·callbackasm1(SB)
+ MOVD $875, R12
+ B runtime·callbackasm1(SB)
+ MOVD $876, R12
+ B runtime·callbackasm1(SB)
+ MOVD $877, R12
+ B runtime·callbackasm1(SB)
+ MOVD $878, R12
+ B runtime·callbackasm1(SB)
+ MOVD $879, R12
+ B runtime·callbackasm1(SB)
+ MOVD $880, R12
+ B runtime·callbackasm1(SB)
+ MOVD $881, R12
+ B runtime·callbackasm1(SB)
+ MOVD $882, R12
+ B runtime·callbackasm1(SB)
+ MOVD $883, R12
+ B runtime·callbackasm1(SB)
+ MOVD $884, R12
+ B runtime·callbackasm1(SB)
+ MOVD $885, R12
+ B runtime·callbackasm1(SB)
+ MOVD $886, R12
+ B runtime·callbackasm1(SB)
+ MOVD $887, R12
+ B runtime·callbackasm1(SB)
+ MOVD $888, R12
+ B runtime·callbackasm1(SB)
+ MOVD $889, R12
+ B runtime·callbackasm1(SB)
+ MOVD $890, R12
+ B runtime·callbackasm1(SB)
+ MOVD $891, R12
+ B runtime·callbackasm1(SB)
+ MOVD $892, R12
+ B runtime·callbackasm1(SB)
+ MOVD $893, R12
+ B runtime·callbackasm1(SB)
+ MOVD $894, R12
+ B runtime·callbackasm1(SB)
+ MOVD $895, R12
+ B runtime·callbackasm1(SB)
+ MOVD $896, R12
+ B runtime·callbackasm1(SB)
+ MOVD $897, R12
+ B runtime·callbackasm1(SB)
+ MOVD $898, R12
+ B runtime·callbackasm1(SB)
+ MOVD $899, R12
+ B runtime·callbackasm1(SB)
+ MOVD $900, R12
+ B runtime·callbackasm1(SB)
+ MOVD $901, R12
+ B runtime·callbackasm1(SB)
+ MOVD $902, R12
+ B runtime·callbackasm1(SB)
+ MOVD $903, R12
+ B runtime·callbackasm1(SB)
+ MOVD $904, R12
+ B runtime·callbackasm1(SB)
+ MOVD $905, R12
+ B runtime·callbackasm1(SB)
+ MOVD $906, R12
+ B runtime·callbackasm1(SB)
+ MOVD $907, R12
+ B runtime·callbackasm1(SB)
+ MOVD $908, R12
+ B runtime·callbackasm1(SB)
+ MOVD $909, R12
+ B runtime·callbackasm1(SB)
+ MOVD $910, R12
+ B runtime·callbackasm1(SB)
+ MOVD $911, R12
+ B runtime·callbackasm1(SB)
+ MOVD $912, R12
+ B runtime·callbackasm1(SB)
+ MOVD $913, R12
+ B runtime·callbackasm1(SB)
+ MOVD $914, R12
+ B runtime·callbackasm1(SB)
+ MOVD $915, R12
+ B runtime·callbackasm1(SB)
+ MOVD $916, R12
+ B runtime·callbackasm1(SB)
+ MOVD $917, R12
+ B runtime·callbackasm1(SB)
+ MOVD $918, R12
+ B runtime·callbackasm1(SB)
+ MOVD $919, R12
+ B runtime·callbackasm1(SB)
+ MOVD $920, R12
+ B runtime·callbackasm1(SB)
+ MOVD $921, R12
+ B runtime·callbackasm1(SB)
+ MOVD $922, R12
+ B runtime·callbackasm1(SB)
+ MOVD $923, R12
+ B runtime·callbackasm1(SB)
+ MOVD $924, R12
+ B runtime·callbackasm1(SB)
+ MOVD $925, R12
+ B runtime·callbackasm1(SB)
+ MOVD $926, R12
+ B runtime·callbackasm1(SB)
+ MOVD $927, R12
+ B runtime·callbackasm1(SB)
+ MOVD $928, R12
+ B runtime·callbackasm1(SB)
+ MOVD $929, R12
+ B runtime·callbackasm1(SB)
+ MOVD $930, R12
+ B runtime·callbackasm1(SB)
+ MOVD $931, R12
+ B runtime·callbackasm1(SB)
+ MOVD $932, R12
+ B runtime·callbackasm1(SB)
+ MOVD $933, R12
+ B runtime·callbackasm1(SB)
+ MOVD $934, R12
+ B runtime·callbackasm1(SB)
+ MOVD $935, R12
+ B runtime·callbackasm1(SB)
+ MOVD $936, R12
+ B runtime·callbackasm1(SB)
+ MOVD $937, R12
+ B runtime·callbackasm1(SB)
+ MOVD $938, R12
+ B runtime·callbackasm1(SB)
+ MOVD $939, R12
+ B runtime·callbackasm1(SB)
+ MOVD $940, R12
+ B runtime·callbackasm1(SB)
+ MOVD $941, R12
+ B runtime·callbackasm1(SB)
+ MOVD $942, R12
+ B runtime·callbackasm1(SB)
+ MOVD $943, R12
+ B runtime·callbackasm1(SB)
+ MOVD $944, R12
+ B runtime·callbackasm1(SB)
+ MOVD $945, R12
+ B runtime·callbackasm1(SB)
+ MOVD $946, R12
+ B runtime·callbackasm1(SB)
+ MOVD $947, R12
+ B runtime·callbackasm1(SB)
+ MOVD $948, R12
+ B runtime·callbackasm1(SB)
+ MOVD $949, R12
+ B runtime·callbackasm1(SB)
+ MOVD $950, R12
+ B runtime·callbackasm1(SB)
+ MOVD $951, R12
+ B runtime·callbackasm1(SB)
+ MOVD $952, R12
+ B runtime·callbackasm1(SB)
+ MOVD $953, R12
+ B runtime·callbackasm1(SB)
+ MOVD $954, R12
+ B runtime·callbackasm1(SB)
+ MOVD $955, R12
+ B runtime·callbackasm1(SB)
+ MOVD $956, R12
+ B runtime·callbackasm1(SB)
+ MOVD $957, R12
+ B runtime·callbackasm1(SB)
+ MOVD $958, R12
+ B runtime·callbackasm1(SB)
+ MOVD $959, R12
+ B runtime·callbackasm1(SB)
+ MOVD $960, R12
+ B runtime·callbackasm1(SB)
+ MOVD $961, R12
+ B runtime·callbackasm1(SB)
+ MOVD $962, R12
+ B runtime·callbackasm1(SB)
+ MOVD $963, R12
+ B runtime·callbackasm1(SB)
+ MOVD $964, R12
+ B runtime·callbackasm1(SB)
+ MOVD $965, R12
+ B runtime·callbackasm1(SB)
+ MOVD $966, R12
+ B runtime·callbackasm1(SB)
+ MOVD $967, R12
+ B runtime·callbackasm1(SB)
+ MOVD $968, R12
+ B runtime·callbackasm1(SB)
+ MOVD $969, R12
+ B runtime·callbackasm1(SB)
+ MOVD $970, R12
+ B runtime·callbackasm1(SB)
+ MOVD $971, R12
+ B runtime·callbackasm1(SB)
+ MOVD $972, R12
+ B runtime·callbackasm1(SB)
+ MOVD $973, R12
+ B runtime·callbackasm1(SB)
+ MOVD $974, R12
+ B runtime·callbackasm1(SB)
+ MOVD $975, R12
+ B runtime·callbackasm1(SB)
+ MOVD $976, R12
+ B runtime·callbackasm1(SB)
+ MOVD $977, R12
+ B runtime·callbackasm1(SB)
+ MOVD $978, R12
+ B runtime·callbackasm1(SB)
+ MOVD $979, R12
+ B runtime·callbackasm1(SB)
+ MOVD $980, R12
+ B runtime·callbackasm1(SB)
+ MOVD $981, R12
+ B runtime·callbackasm1(SB)
+ MOVD $982, R12
+ B runtime·callbackasm1(SB)
+ MOVD $983, R12
+ B runtime·callbackasm1(SB)
+ MOVD $984, R12
+ B runtime·callbackasm1(SB)
+ MOVD $985, R12
+ B runtime·callbackasm1(SB)
+ MOVD $986, R12
+ B runtime·callbackasm1(SB)
+ MOVD $987, R12
+ B runtime·callbackasm1(SB)
+ MOVD $988, R12
+ B runtime·callbackasm1(SB)
+ MOVD $989, R12
+ B runtime·callbackasm1(SB)
+ MOVD $990, R12
+ B runtime·callbackasm1(SB)
+ MOVD $991, R12
+ B runtime·callbackasm1(SB)
+ MOVD $992, R12
+ B runtime·callbackasm1(SB)
+ MOVD $993, R12
+ B runtime·callbackasm1(SB)
+ MOVD $994, R12
+ B runtime·callbackasm1(SB)
+ MOVD $995, R12
+ B runtime·callbackasm1(SB)
+ MOVD $996, R12
+ B runtime·callbackasm1(SB)
+ MOVD $997, R12
+ B runtime·callbackasm1(SB)
+ MOVD $998, R12
+ B runtime·callbackasm1(SB)
+ MOVD $999, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1000, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1001, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1002, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1003, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1004, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1005, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1006, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1007, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1008, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1009, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1010, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1011, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1012, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1013, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1014, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1015, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1016, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1017, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1018, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1019, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1020, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1021, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1022, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1023, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1024, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1025, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1026, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1027, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1028, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1029, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1030, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1031, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1032, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1033, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1034, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1035, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1036, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1037, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1038, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1039, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1040, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1041, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1042, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1043, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1044, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1045, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1046, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1047, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1048, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1049, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1050, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1051, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1052, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1053, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1054, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1055, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1056, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1057, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1058, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1059, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1060, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1061, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1062, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1063, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1064, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1065, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1066, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1067, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1068, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1069, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1070, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1071, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1072, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1073, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1074, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1075, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1076, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1077, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1078, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1079, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1080, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1081, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1082, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1083, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1084, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1085, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1086, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1087, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1088, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1089, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1090, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1091, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1092, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1093, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1094, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1095, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1096, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1097, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1098, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1099, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1100, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1101, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1102, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1103, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1104, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1105, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1106, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1107, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1108, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1109, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1110, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1111, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1112, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1113, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1114, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1115, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1116, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1117, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1118, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1119, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1120, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1121, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1122, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1123, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1124, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1125, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1126, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1127, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1128, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1129, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1130, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1131, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1132, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1133, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1134, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1135, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1136, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1137, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1138, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1139, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1140, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1141, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1142, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1143, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1144, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1145, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1146, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1147, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1148, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1149, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1150, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1151, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1152, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1153, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1154, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1155, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1156, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1157, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1158, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1159, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1160, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1161, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1162, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1163, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1164, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1165, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1166, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1167, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1168, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1169, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1170, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1171, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1172, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1173, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1174, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1175, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1176, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1177, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1178, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1179, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1180, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1181, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1182, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1183, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1184, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1185, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1186, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1187, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1188, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1189, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1190, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1191, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1192, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1193, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1194, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1195, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1196, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1197, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1198, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1199, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1200, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1201, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1202, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1203, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1204, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1205, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1206, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1207, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1208, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1209, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1210, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1211, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1212, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1213, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1214, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1215, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1216, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1217, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1218, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1219, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1220, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1221, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1222, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1223, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1224, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1225, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1226, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1227, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1228, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1229, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1230, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1231, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1232, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1233, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1234, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1235, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1236, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1237, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1238, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1239, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1240, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1241, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1242, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1243, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1244, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1245, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1246, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1247, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1248, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1249, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1250, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1251, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1252, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1253, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1254, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1255, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1256, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1257, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1258, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1259, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1260, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1261, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1262, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1263, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1264, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1265, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1266, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1267, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1268, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1269, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1270, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1271, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1272, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1273, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1274, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1275, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1276, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1277, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1278, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1279, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1280, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1281, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1282, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1283, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1284, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1285, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1286, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1287, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1288, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1289, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1290, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1291, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1292, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1293, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1294, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1295, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1296, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1297, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1298, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1299, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1300, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1301, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1302, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1303, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1304, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1305, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1306, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1307, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1308, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1309, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1310, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1311, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1312, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1313, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1314, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1315, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1316, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1317, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1318, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1319, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1320, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1321, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1322, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1323, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1324, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1325, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1326, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1327, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1328, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1329, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1330, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1331, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1332, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1333, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1334, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1335, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1336, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1337, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1338, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1339, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1340, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1341, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1342, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1343, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1344, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1345, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1346, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1347, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1348, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1349, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1350, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1351, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1352, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1353, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1354, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1355, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1356, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1357, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1358, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1359, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1360, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1361, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1362, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1363, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1364, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1365, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1366, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1367, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1368, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1369, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1370, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1371, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1372, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1373, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1374, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1375, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1376, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1377, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1378, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1379, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1380, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1381, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1382, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1383, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1384, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1385, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1386, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1387, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1388, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1389, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1390, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1391, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1392, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1393, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1394, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1395, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1396, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1397, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1398, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1399, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1400, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1401, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1402, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1403, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1404, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1405, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1406, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1407, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1408, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1409, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1410, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1411, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1412, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1413, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1414, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1415, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1416, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1417, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1418, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1419, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1420, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1421, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1422, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1423, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1424, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1425, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1426, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1427, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1428, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1429, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1430, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1431, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1432, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1433, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1434, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1435, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1436, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1437, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1438, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1439, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1440, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1441, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1442, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1443, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1444, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1445, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1446, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1447, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1448, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1449, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1450, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1451, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1452, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1453, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1454, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1455, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1456, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1457, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1458, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1459, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1460, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1461, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1462, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1463, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1464, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1465, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1466, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1467, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1468, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1469, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1470, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1471, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1472, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1473, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1474, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1475, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1476, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1477, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1478, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1479, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1480, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1481, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1482, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1483, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1484, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1485, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1486, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1487, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1488, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1489, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1490, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1491, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1492, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1493, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1494, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1495, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1496, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1497, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1498, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1499, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1500, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1501, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1502, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1503, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1504, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1505, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1506, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1507, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1508, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1509, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1510, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1511, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1512, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1513, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1514, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1515, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1516, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1517, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1518, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1519, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1520, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1521, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1522, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1523, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1524, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1525, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1526, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1527, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1528, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1529, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1530, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1531, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1532, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1533, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1534, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1535, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1536, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1537, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1538, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1539, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1540, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1541, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1542, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1543, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1544, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1545, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1546, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1547, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1548, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1549, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1550, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1551, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1552, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1553, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1554, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1555, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1556, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1557, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1558, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1559, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1560, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1561, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1562, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1563, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1564, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1565, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1566, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1567, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1568, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1569, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1570, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1571, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1572, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1573, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1574, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1575, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1576, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1577, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1578, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1579, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1580, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1581, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1582, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1583, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1584, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1585, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1586, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1587, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1588, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1589, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1590, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1591, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1592, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1593, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1594, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1595, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1596, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1597, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1598, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1599, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1600, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1601, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1602, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1603, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1604, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1605, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1606, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1607, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1608, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1609, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1610, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1611, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1612, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1613, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1614, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1615, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1616, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1617, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1618, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1619, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1620, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1621, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1622, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1623, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1624, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1625, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1626, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1627, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1628, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1629, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1630, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1631, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1632, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1633, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1634, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1635, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1636, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1637, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1638, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1639, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1640, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1641, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1642, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1643, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1644, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1645, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1646, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1647, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1648, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1649, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1650, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1651, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1652, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1653, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1654, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1655, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1656, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1657, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1658, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1659, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1660, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1661, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1662, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1663, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1664, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1665, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1666, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1667, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1668, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1669, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1670, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1671, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1672, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1673, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1674, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1675, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1676, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1677, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1678, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1679, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1680, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1681, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1682, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1683, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1684, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1685, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1686, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1687, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1688, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1689, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1690, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1691, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1692, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1693, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1694, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1695, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1696, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1697, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1698, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1699, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1700, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1701, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1702, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1703, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1704, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1705, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1706, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1707, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1708, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1709, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1710, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1711, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1712, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1713, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1714, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1715, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1716, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1717, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1718, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1719, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1720, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1721, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1722, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1723, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1724, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1725, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1726, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1727, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1728, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1729, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1730, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1731, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1732, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1733, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1734, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1735, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1736, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1737, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1738, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1739, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1740, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1741, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1742, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1743, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1744, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1745, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1746, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1747, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1748, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1749, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1750, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1751, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1752, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1753, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1754, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1755, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1756, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1757, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1758, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1759, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1760, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1761, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1762, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1763, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1764, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1765, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1766, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1767, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1768, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1769, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1770, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1771, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1772, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1773, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1774, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1775, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1776, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1777, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1778, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1779, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1780, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1781, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1782, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1783, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1784, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1785, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1786, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1787, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1788, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1789, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1790, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1791, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1792, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1793, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1794, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1795, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1796, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1797, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1798, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1799, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1800, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1801, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1802, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1803, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1804, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1805, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1806, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1807, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1808, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1809, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1810, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1811, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1812, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1813, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1814, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1815, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1816, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1817, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1818, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1819, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1820, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1821, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1822, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1823, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1824, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1825, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1826, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1827, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1828, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1829, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1830, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1831, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1832, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1833, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1834, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1835, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1836, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1837, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1838, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1839, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1840, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1841, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1842, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1843, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1844, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1845, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1846, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1847, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1848, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1849, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1850, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1851, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1852, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1853, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1854, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1855, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1856, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1857, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1858, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1859, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1860, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1861, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1862, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1863, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1864, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1865, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1866, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1867, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1868, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1869, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1870, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1871, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1872, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1873, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1874, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1875, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1876, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1877, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1878, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1879, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1880, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1881, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1882, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1883, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1884, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1885, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1886, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1887, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1888, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1889, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1890, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1891, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1892, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1893, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1894, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1895, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1896, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1897, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1898, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1899, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1900, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1901, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1902, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1903, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1904, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1905, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1906, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1907, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1908, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1909, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1910, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1911, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1912, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1913, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1914, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1915, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1916, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1917, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1918, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1919, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1920, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1921, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1922, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1923, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1924, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1925, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1926, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1927, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1928, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1929, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1930, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1931, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1932, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1933, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1934, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1935, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1936, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1937, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1938, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1939, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1940, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1941, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1942, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1943, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1944, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1945, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1946, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1947, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1948, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1949, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1950, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1951, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1952, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1953, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1954, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1955, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1956, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1957, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1958, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1959, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1960, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1961, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1962, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1963, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1964, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1965, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1966, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1967, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1968, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1969, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1970, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1971, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1972, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1973, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1974, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1975, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1976, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1977, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1978, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1979, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1980, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1981, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1982, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1983, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1984, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1985, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1986, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1987, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1988, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1989, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1990, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1991, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1992, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1993, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1994, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1995, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1996, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1997, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1998, R12
+ B runtime·callbackasm1(SB)
+ MOVD $1999, R12
+ B runtime·callbackasm1(SB)
diff --git a/src/sort/genzfunc.go b/src/sort/genzfunc.go
index e7eb573737..ed04e33568 100644
--- a/src/sort/genzfunc.go
+++ b/src/sort/genzfunc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This program is run via "go generate" (via a directive in sort.go)
diff --git a/src/sort/slice_go113.go b/src/sort/slice_go113.go
index bf24db714a..53542dbd1a 100644
--- a/src/sort/slice_go113.go
+++ b/src/sort/slice_go113.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.13
// +build go1.13
package sort
diff --git a/src/sort/slice_go14.go b/src/sort/slice_go14.go
index 3bf5cbc00b..5d5949f3ca 100644
--- a/src/sort/slice_go14.go
+++ b/src/sort/slice_go14.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !go1.8
// +build !go1.8
package sort
diff --git a/src/sort/slice_go18.go b/src/sort/slice_go18.go
index e1766040a7..1538477bc5 100644
--- a/src/sort/slice_go18.go
+++ b/src/sort/slice_go18.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.8 && !go1.13
// +build go1.8,!go1.13
package sort
diff --git a/src/strconv/bytealg.go b/src/strconv/bytealg.go
index 7f66f2a8bb..9780c28ef3 100644
--- a/src/strconv/bytealg.go
+++ b/src/strconv/bytealg.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !compiler_bootstrap
// +build !compiler_bootstrap
package strconv
diff --git a/src/strconv/bytealg_bootstrap.go b/src/strconv/bytealg_bootstrap.go
index a3a547d1b6..875a0eb147 100644
--- a/src/strconv/bytealg_bootstrap.go
+++ b/src/strconv/bytealg_bootstrap.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build compiler_bootstrap
// +build compiler_bootstrap
package strconv
diff --git a/src/strconv/makeisprint.go b/src/strconv/makeisprint.go
index 0e6e90a6c6..909f9e4787 100644
--- a/src/strconv/makeisprint.go
+++ b/src/strconv/makeisprint.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
//
@@ -36,7 +37,7 @@ var (
func bsearch16(a []uint16, x uint16) int {
i, j := 0, len(a)
for i < j {
- h := i + (j-i)/2
+ h := i + (j-i)>>1
if a[h] < x {
i = h + 1
} else {
@@ -51,7 +52,7 @@ func bsearch16(a []uint16, x uint16) int {
func bsearch32(a []uint32, x uint32) int {
i, j := 0, len(a)
for i < j {
- h := i + (j-i)/2
+ h := i + (j-i)>>1
if a[h] < x {
i = h + 1
} else {
diff --git a/src/strconv/quote.go b/src/strconv/quote.go
index 4ffa10b72e..db0dbb288b 100644
--- a/src/strconv/quote.go
+++ b/src/strconv/quote.go
@@ -440,7 +440,7 @@ func Unquote(s string) (string, error) {
func bsearch16(a []uint16, x uint16) int {
i, j := 0, len(a)
for i < j {
- h := i + (j-i)/2
+ h := i + (j-i)>>1
if a[h] < x {
i = h + 1
} else {
@@ -455,7 +455,7 @@ func bsearch16(a []uint16, x uint16) int {
func bsearch32(a []uint32, x uint32) int {
i, j := 0, len(a)
for i < j {
- h := i + (j-i)/2
+ h := i + (j-i)>>1
if a[h] < x {
i = h + 1
} else {
diff --git a/src/strings/builder.go b/src/strings/builder.go
index 6ff151d74b..547e52e84d 100644
--- a/src/strings/builder.go
+++ b/src/strings/builder.go
@@ -103,7 +103,8 @@ func (b *Builder) WriteByte(c byte) error {
// It returns the length of r and a nil error.
func (b *Builder) WriteRune(r rune) (int, error) {
b.copyCheck()
- if r < utf8.RuneSelf {
+ // Compare as uint32 to correctly handle negative runes.
+ if uint32(r) < utf8.RuneSelf {
b.buf = append(b.buf, byte(r))
return 1, nil
}
diff --git a/src/strings/builder_test.go b/src/strings/builder_test.go
index b662efe7a5..e3d239266f 100644
--- a/src/strings/builder_test.go
+++ b/src/strings/builder_test.go
@@ -8,6 +8,7 @@ import (
"bytes"
. "strings"
"testing"
+ "unicode/utf8"
)
func check(t *testing.T, b *Builder, want string) {
@@ -301,6 +302,16 @@ func TestBuilderCopyPanic(t *testing.T) {
}
}
+func TestBuilderWriteInvalidRune(t *testing.T) {
+ // Invalid runes, including negative ones, should be written as
+ // utf8.RuneError.
+ for _, r := range []rune{-1, utf8.MaxRune + 1} {
+ var b Builder
+ b.WriteRune(r)
+ check(t, &b, "\uFFFD")
+ }
+}
+
var someBytes = []byte("some bytes sdljlk jsklj3lkjlk djlkjw")
var sinkS string
diff --git a/src/sync/pool_test.go b/src/sync/pool_test.go
index ad98350b2b..65666daab4 100644
--- a/src/sync/pool_test.go
+++ b/src/sync/pool_test.go
@@ -3,6 +3,7 @@
// license that can be found in the LICENSE file.
// Pool is no-op under race detector, so all these tests do not work.
+//go:build !race
// +build !race
package sync_test
diff --git a/src/sync/runtime2.go b/src/sync/runtime2.go
index f10c4e8e0e..c4b44893f0 100644
--- a/src/sync/runtime2.go
+++ b/src/sync/runtime2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !goexperiment.staticlockranking
// +build !goexperiment.staticlockranking
package sync
diff --git a/src/sync/runtime2_lockrank.go b/src/sync/runtime2_lockrank.go
index aaa1c27626..e91fdb6c1f 100644
--- a/src/sync/runtime2_lockrank.go
+++ b/src/sync/runtime2_lockrank.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build goexperiment.staticlockranking
// +build goexperiment.staticlockranking
package sync
diff --git a/src/syscall/asm_linux_386.s b/src/syscall/asm_linux_386.s
index 4201f367ba..1c69083118 100644
--- a/src/syscall/asm_linux_386.s
+++ b/src/syscall/asm_linux_386.s
@@ -110,6 +110,26 @@ ok2:
MOVL $0, err+36(FP)
RET
+// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
+TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-16
+ MOVL trap+0(FP), AX // syscall entry
+ MOVL a1+4(FP), BX
+ MOVL $0, CX
+ MOVL $0, DX
+ POPL SI // preserve return address
+ INVOKE_SYSCALL
+ PUSHL SI
+ CMPL AX, $0xfffff001
+ JLS ok
+ MOVL $-1, r1+8(FP)
+ NEGL AX
+ MOVL AX, err+12(FP)
+ RET
+ok:
+ MOVL AX, r1+8(FP)
+ MOVL $0, err+12(FP)
+ RET
+
// func rawSyscallNoError(trap uintptr, a1, a2, a3 uintptr) (r1, r2 uintptr);
TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-24
MOVL trap+0(FP), AX // syscall entry
diff --git a/src/syscall/asm_linux_amd64.s b/src/syscall/asm_linux_amd64.s
index ba22179dc2..a9af68d51d 100644
--- a/src/syscall/asm_linux_amd64.s
+++ b/src/syscall/asm_linux_amd64.s
@@ -108,7 +108,7 @@ ok2:
RET
// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
-TEXT ·rawVforkSyscall(SB),NOSPLIT,$0-32
+TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
MOVQ a1+8(FP), DI
MOVQ $0, SI
MOVQ $0, DX
diff --git a/src/syscall/asm_linux_arm.s b/src/syscall/asm_linux_arm.s
index 458e9cce79..6bb4df81a0 100644
--- a/src/syscall/asm_linux_arm.s
+++ b/src/syscall/asm_linux_arm.s
@@ -154,6 +154,27 @@ ok1:
MOVW R0, err+24(FP)
RET
+// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
+TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-16
+ MOVW trap+0(FP), R7 // syscall entry
+ MOVW a1+4(FP), R0
+ MOVW $0, R1
+ MOVW $0, R2
+ SWI $0
+ MOVW $0xfffff001, R1
+ CMP R1, R0
+ BLS ok
+ MOVW $-1, R1
+ MOVW R1, r1+8(FP)
+ RSB $0, R0, R0
+ MOVW R0, err+12(FP)
+ RET
+ok:
+ MOVW R0, r1+8(FP)
+ MOVW $0, R0
+ MOVW R0, err+12(FP)
+ RET
+
// func rawSyscallNoError(trap uintptr, a1, a2, a3 uintptr) (r1, r2 uintptr);
TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-24
MOVW trap+0(FP), R7 // syscall entry
diff --git a/src/syscall/asm_linux_arm64.s b/src/syscall/asm_linux_arm64.s
index fb22f8d547..a30e4d87d4 100644
--- a/src/syscall/asm_linux_arm64.s
+++ b/src/syscall/asm_linux_arm64.s
@@ -125,7 +125,6 @@ ok:
MOVD ZR, err+24(FP) // errno
RET
-
// func rawSyscallNoError(trap uintptr, a1, a2, a3 uintptr) (r1, r2 uintptr);
TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
MOVD a1+8(FP), R0
diff --git a/src/syscall/asm_linux_mips64x.s b/src/syscall/asm_linux_mips64x.s
index d0b0e5a0a8..b3ae59023d 100644
--- a/src/syscall/asm_linux_mips64x.s
+++ b/src/syscall/asm_linux_mips64x.s
@@ -102,6 +102,26 @@ ok2:
MOVV R0, err+72(FP) // errno
RET
+// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
+TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-32
+ MOVV a1+8(FP), R4
+ MOVV R0, R5
+ MOVV R0, R6
+ MOVV R0, R7
+ MOVV R0, R8
+ MOVV R0, R9
+ MOVV trap+0(FP), R2 // syscall entry
+ SYSCALL
+ BEQ R7, ok
+ MOVV $-1, R1
+ MOVV R1, r1+16(FP) // r1
+ MOVV R2, err+24(FP) // errno
+ RET
+ok:
+ MOVV R2, r1+16(FP) // r1
+ MOVV R0, err+24(FP) // errno
+ RET
+
TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-48
MOVV a1+8(FP), R4
MOVV a2+16(FP), R5
diff --git a/src/syscall/asm_linux_mipsx.s b/src/syscall/asm_linux_mipsx.s
index 5727e4d41d..ee436490b2 100644
--- a/src/syscall/asm_linux_mipsx.s
+++ b/src/syscall/asm_linux_mipsx.s
@@ -139,6 +139,23 @@ ok2:
MOVW R0, err+36(FP) // errno
RET
+// func rawVforkSyscall(trap, a1 uintptr) (r1, err uintptr)
+TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-16
+ MOVW a1+4(FP), R4
+ MOVW R0, R5
+ MOVW R0, R6
+ MOVW trap+0(FP), R2 // syscall entry
+ SYSCALL
+ BEQ R7, ok
+ MOVW $-1, R1
+ MOVW R1, r1+8(FP) // r1
+ MOVW R2, err+12(FP) // errno
+ RET
+ok:
+ MOVW R2, r1+8(FP) // r1
+ MOVW R0, err+12(FP) // errno
+ RET
+
TEXT ·rawSyscallNoError(SB),NOSPLIT,$20-24
MOVW a1+4(FP), R4
MOVW a2+8(FP), R5
diff --git a/src/syscall/bpf_bsd.go b/src/syscall/bpf_bsd.go
index f67ee6064b..452d4cf14b 100644
--- a/src/syscall/bpf_bsd.go
+++ b/src/syscall/bpf_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || netbsd || openbsd
// +build dragonfly freebsd netbsd openbsd
// Berkeley packet filter for BSD variants
diff --git a/src/syscall/creds_test.go b/src/syscall/creds_test.go
index 524689ae2d..463033d558 100644
--- a/src/syscall/creds_test.go
+++ b/src/syscall/creds_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package syscall_test
diff --git a/src/syscall/dirent.go b/src/syscall/dirent.go
index fab123d4a7..9e1222e81c 100644
--- a/src/syscall/dirent.go
+++ b/src/syscall/dirent.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package syscall
diff --git a/src/syscall/dirent_test.go b/src/syscall/dirent_test.go
index 7dac98ff4b..8ed3caa9d4 100644
--- a/src/syscall/dirent_test.go
+++ b/src/syscall/dirent_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package syscall_test
diff --git a/src/syscall/endian_big.go b/src/syscall/endian_big.go
index 3c26005ab5..dc0947fa6e 100644
--- a/src/syscall/endian_big.go
+++ b/src/syscall/endian_big.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
+//go:build ppc64 || s390x || mips || mips64
// +build ppc64 s390x mips mips64
package syscall
diff --git a/src/syscall/endian_little.go b/src/syscall/endian_little.go
index 43b081d640..a894445f73 100644
--- a/src/syscall/endian_little.go
+++ b/src/syscall/endian_little.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
+//go:build 386 || amd64 || arm || arm64 || ppc64le || mips64le || mipsle || riscv64 || wasm
// +build 386 amd64 arm arm64 ppc64le mips64le mipsle riscv64 wasm
package syscall
diff --git a/src/syscall/env_unix.go b/src/syscall/env_unix.go
index a4bb28cc45..022ef6ed73 100644
--- a/src/syscall/env_unix.go
+++ b/src/syscall/env_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris || plan9
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris plan9
// Unix environment variables.
diff --git a/src/syscall/exec_aix_test.go b/src/syscall/exec_aix_test.go
index 22b752cf27..17c7ac0664 100644
--- a/src/syscall/exec_aix_test.go
+++ b/src/syscall/exec_aix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix
// +build aix
package syscall
diff --git a/src/syscall/exec_bsd.go b/src/syscall/exec_bsd.go
index 940a81b58e..9c1fbbaeab 100644
--- a/src/syscall/exec_bsd.go
+++ b/src/syscall/exec_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || netbsd || (openbsd && !amd64 && !arm64)
// +build dragonfly freebsd netbsd openbsd,!amd64,!arm64
package syscall
diff --git a/src/syscall/exec_libc.go b/src/syscall/exec_libc.go
index 3722858325..3c8e87d32f 100644
--- a/src/syscall/exec_libc.go
+++ b/src/syscall/exec_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || solaris
// +build aix solaris
// This file handles forkAndExecInChild function for OS using libc syscall like AIX or Solaris.
diff --git a/src/syscall/exec_libc2.go b/src/syscall/exec_libc2.go
index 45d3f85baf..507eff8ab3 100644
--- a/src/syscall/exec_libc2.go
+++ b/src/syscall/exec_libc2.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || (openbsd && amd64) || (openbsd && arm64)
// +build darwin openbsd,amd64 openbsd,arm64
package syscall
diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go
index b6acad96ea..6353da4048 100644
--- a/src/syscall/exec_linux.go
+++ b/src/syscall/exec_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package syscall
@@ -207,18 +208,12 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att
}
}
- var hasRawVforkSyscall bool
- switch runtime.GOARCH {
- case "amd64", "arm64", "ppc64", "riscv64", "s390x":
- hasRawVforkSyscall = true
- }
-
// About to call fork.
// No more allocation or calls of non-assembly functions.
runtime_BeforeFork()
locked = true
switch {
- case hasRawVforkSyscall && (sys.Cloneflags&CLONE_NEWUSER == 0 && sys.Unshareflags&CLONE_NEWUSER == 0):
+ case sys.Cloneflags&CLONE_NEWUSER == 0 && sys.Unshareflags&CLONE_NEWUSER == 0:
r1, err1 = rawVforkSyscall(SYS_CLONE, uintptr(SIGCHLD|CLONE_VFORK|CLONE_VM)|sys.Cloneflags)
case runtime.GOARCH == "s390x":
r1, _, err1 = RawSyscall6(SYS_CLONE, 0, uintptr(SIGCHLD)|sys.Cloneflags, 0, 0, 0, 0)
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go
index ac3a5754ae..7d89eaae63 100644
--- a/src/syscall/exec_linux_test.go
+++ b/src/syscall/exec_linux_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux
// +build linux
package syscall_test
diff --git a/src/syscall/exec_plan9.go b/src/syscall/exec_plan9.go
index 47ccbdc384..12c4237f69 100644
--- a/src/syscall/exec_plan9.go
+++ b/src/syscall/exec_plan9.go
@@ -320,14 +320,15 @@ func cexecPipe(p []int) error {
return e
}
- fd, e := Open("#d/"+itoa(p[1]), O_CLOEXEC)
+ fd, e := Open("#d/"+itoa(p[1]), O_RDWR|O_CLOEXEC)
if e != nil {
Close(p[0])
Close(p[1])
return e
}
- Close(fd)
+ Close(p[1])
+ p[1] = fd
return nil
}
diff --git a/src/syscall/exec_solaris_test.go b/src/syscall/exec_solaris_test.go
index 6b8f1ad383..f54fc8385d 100644
--- a/src/syscall/exec_solaris_test.go
+++ b/src/syscall/exec_solaris_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build solaris
// +build solaris
package syscall
diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go
index 1f49c78ef9..1f38de22b2 100644
--- a/src/syscall/exec_unix.go
+++ b/src/syscall/exec_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// Fork, exec, wait, etc.
diff --git a/src/syscall/exec_unix_test.go b/src/syscall/exec_unix_test.go
index d6b6f51fa6..10bad5ac46 100644
--- a/src/syscall/exec_unix_test.go
+++ b/src/syscall/exec_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package syscall_test
diff --git a/src/syscall/exec_windows.go b/src/syscall/exec_windows.go
index 46cbd7567d..7b73cf1f6f 100644
--- a/src/syscall/exec_windows.go
+++ b/src/syscall/exec_windows.go
@@ -235,13 +235,15 @@ type ProcAttr struct {
}
type SysProcAttr struct {
- HideWindow bool
- CmdLine string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess
- CreationFlags uint32
- Token Token // if set, runs new process in the security context represented by the token
- ProcessAttributes *SecurityAttributes // if set, applies these security attributes as the descriptor for the new process
- ThreadAttributes *SecurityAttributes // if set, applies these security attributes as the descriptor for the main thread of the new process
- NoInheritHandles bool // if set, each inheritable handle in the calling process is not inherited by the new process
+ HideWindow bool
+ CmdLine string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess
+ CreationFlags uint32
+ Token Token // if set, runs new process in the security context represented by the token
+ ProcessAttributes *SecurityAttributes // if set, applies these security attributes as the descriptor for the new process
+ ThreadAttributes *SecurityAttributes // if set, applies these security attributes as the descriptor for the main thread of the new process
+ NoInheritHandles bool // if set, each inheritable handle in the calling process is not inherited by the new process
+ AdditionalInheritedHandles []Handle // a list of additional handles, already marked as inheritable, that will be inherited by the new process
+ ParentProcess Handle // if non-zero, the new process regards the process given by this handle as its parent process, and AdditionalInheritedHandles, if set, should exist in this parent process
}
var zeroProcAttr ProcAttr
@@ -310,41 +312,57 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle
}
}
- // Acquire the fork lock so that no other threads
- // create new fds that are not yet close-on-exec
- // before we fork.
- ForkLock.Lock()
- defer ForkLock.Unlock()
-
p, _ := GetCurrentProcess()
+ parentProcess := p
+ if sys.ParentProcess != 0 {
+ parentProcess = sys.ParentProcess
+ }
fd := make([]Handle, len(attr.Files))
for i := range attr.Files {
if attr.Files[i] > 0 {
- err := DuplicateHandle(p, Handle(attr.Files[i]), p, &fd[i], 0, true, DUPLICATE_SAME_ACCESS)
+ err := DuplicateHandle(p, Handle(attr.Files[i]), parentProcess, &fd[i], 0, true, DUPLICATE_SAME_ACCESS)
if err != nil {
return 0, 0, err
}
- defer CloseHandle(Handle(fd[i]))
+ defer DuplicateHandle(parentProcess, fd[i], 0, nil, 0, false, DUPLICATE_CLOSE_SOURCE)
}
}
- si := new(StartupInfo)
+ si := new(_STARTUPINFOEXW)
+ si.ProcThreadAttributeList, err = newProcThreadAttributeList(2)
+ if err != nil {
+ return 0, 0, err
+ }
+ defer deleteProcThreadAttributeList(si.ProcThreadAttributeList)
si.Cb = uint32(unsafe.Sizeof(*si))
si.Flags = STARTF_USESTDHANDLES
if sys.HideWindow {
si.Flags |= STARTF_USESHOWWINDOW
si.ShowWindow = SW_HIDE
}
+ if sys.ParentProcess != 0 {
+ err = updateProcThreadAttribute(si.ProcThreadAttributeList, 0, _PROC_THREAD_ATTRIBUTE_PARENT_PROCESS, uintptr(unsafe.Pointer(&sys.ParentProcess)), unsafe.Sizeof(sys.ParentProcess), 0, nil)
+ if err != nil {
+ return 0, 0, err
+ }
+ }
si.StdInput = fd[0]
si.StdOutput = fd[1]
si.StdErr = fd[2]
+ fd = append(fd, sys.AdditionalInheritedHandles...)
+ // Do not accidentally inherit more than these handles.
+ err = updateProcThreadAttribute(si.ProcThreadAttributeList, 0, _PROC_THREAD_ATTRIBUTE_HANDLE_LIST, uintptr(unsafe.Pointer(&fd[0])), uintptr(len(fd))*unsafe.Sizeof(fd[0]), 0, nil)
+ if err != nil {
+ return 0, 0, err
+ }
+
pi := new(ProcessInformation)
- flags := sys.CreationFlags | CREATE_UNICODE_ENVIRONMENT
+ flags := sys.CreationFlags | CREATE_UNICODE_ENVIRONMENT | _EXTENDED_STARTUPINFO_PRESENT
if sys.Token != 0 {
- err = CreateProcessAsUser(sys.Token, argv0p, argvp, sys.ProcessAttributes, sys.ThreadAttributes, !sys.NoInheritHandles, flags, createEnvBlock(attr.Env), dirp, si, pi)
+ err = CreateProcessAsUser(sys.Token, argv0p, argvp, sys.ProcessAttributes, sys.ThreadAttributes, !sys.NoInheritHandles, flags, createEnvBlock(attr.Env), dirp, &si.StartupInfo, pi)
} else {
- err = CreateProcess(argv0p, argvp, sys.ProcessAttributes, sys.ThreadAttributes, !sys.NoInheritHandles, flags, createEnvBlock(attr.Env), dirp, si, pi)
+ err = CreateProcess(argv0p, argvp, sys.ProcessAttributes, sys.ThreadAttributes, !sys.NoInheritHandles, flags, createEnvBlock(attr.Env), dirp, &si.StartupInfo, pi)
}
if err != nil {
return 0, 0, err
diff --git a/src/syscall/exec_windows_test.go b/src/syscall/exec_windows_test.go
index eda1d36877..fb2c767c35 100644
--- a/src/syscall/exec_windows_test.go
+++ b/src/syscall/exec_windows_test.go
@@ -5,8 +5,14 @@
package syscall_test
import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path/filepath"
"syscall"
"testing"
+ "time"
)
func TestEscapeArg(t *testing.T) {
@@ -41,3 +47,70 @@ func TestEscapeArg(t *testing.T) {
}
}
}
+
+func TestChangingProcessParent(t *testing.T) {
+ if os.Getenv("GO_WANT_HELPER_PROCESS") == "parent" {
+ // in parent process
+
+ // Parent does nothign. It is just used as a parent of a child process.
+ time.Sleep(time.Minute)
+ os.Exit(0)
+ }
+
+ if os.Getenv("GO_WANT_HELPER_PROCESS") == "child" {
+ // in child process
+ dumpPath := os.Getenv("GO_WANT_HELPER_PROCESS_FILE")
+ if dumpPath == "" {
+ fmt.Fprintf(os.Stderr, "Dump file path cannot be blank.")
+ os.Exit(1)
+ }
+ err := os.WriteFile(dumpPath, []byte(fmt.Sprintf("%d", os.Getppid())), 0644)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error writing dump file: %v", err)
+ os.Exit(2)
+ }
+ os.Exit(0)
+ }
+
+ // run parent process
+
+ parent := exec.Command(os.Args[0], "-test.run=TestChangingProcessParent")
+ parent.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=parent")
+ err := parent.Start()
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer func() {
+ parent.Process.Kill()
+ parent.Wait()
+ }()
+
+ // run child process
+
+ const _PROCESS_CREATE_PROCESS = 0x0080
+ const _PROCESS_DUP_HANDLE = 0x0040
+ childDumpPath := filepath.Join(t.TempDir(), "ppid.txt")
+ ph, err := syscall.OpenProcess(_PROCESS_CREATE_PROCESS|_PROCESS_DUP_HANDLE|syscall.PROCESS_QUERY_INFORMATION,
+ false, uint32(parent.Process.Pid))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer syscall.CloseHandle(ph)
+
+ child := exec.Command(os.Args[0], "-test.run=TestChangingProcessParent")
+ child.Env = append(os.Environ(),
+ "GO_WANT_HELPER_PROCESS=child",
+ "GO_WANT_HELPER_PROCESS_FILE="+childDumpPath)
+ child.SysProcAttr = &syscall.SysProcAttr{ParentProcess: ph}
+ childOutput, err := child.CombinedOutput()
+ if err != nil {
+ t.Errorf("child failed: %v: %v", err, string(childOutput))
+ }
+ childOutput, err = ioutil.ReadFile(childDumpPath)
+ if err != nil {
+ t.Fatalf("reading child output failed: %v", err)
+ }
+ if got, want := string(childOutput), fmt.Sprintf("%d", parent.Process.Pid); got != want {
+ t.Fatalf("child output: want %q, got %q", want, got)
+ }
+}
diff --git a/src/syscall/export_unix_test.go b/src/syscall/export_unix_test.go
index 4c3d0f6d2a..2d2c67673d 100644
--- a/src/syscall/export_unix_test.go
+++ b/src/syscall/export_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build dragonfly || freebsd || linux || netbsd || openbsd
// +build dragonfly freebsd linux netbsd openbsd
package syscall
diff --git a/src/syscall/flock.go b/src/syscall/flock.go
index 568efca7d4..3b43b6aede 100644
--- a/src/syscall/flock.go
+++ b/src/syscall/flock.go
@@ -1,3 +1,4 @@
+//go:build linux || freebsd || openbsd || netbsd || dragonfly
// +build linux freebsd openbsd netbsd dragonfly
// Copyright 2014 The Go Authors. All rights reserved.
diff --git a/src/syscall/flock_linux_32bit.go b/src/syscall/flock_linux_32bit.go
index e11aed6ed1..2f3277497c 100644
--- a/src/syscall/flock_linux_32bit.go
+++ b/src/syscall/flock_linux_32bit.go
@@ -5,6 +5,7 @@
// If you change the build tags here, see
// internal/syscall/unix/fcntl_linux_32bit.go.
+//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle)
// +build linux,386 linux,arm linux,mips linux,mipsle
package syscall
diff --git a/src/syscall/forkpipe.go b/src/syscall/forkpipe.go
index d9999cb8b8..79cbdf4150 100644
--- a/src/syscall/forkpipe.go
+++ b/src/syscall/forkpipe.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build aix darwin dragonfly solaris
+//go:build aix || darwin || solaris
+// +build aix darwin solaris
package syscall
diff --git a/src/syscall/forkpipe2.go b/src/syscall/forkpipe2.go
index c9a0c4996e..e57240c156 100644
--- a/src/syscall/forkpipe2.go
+++ b/src/syscall/forkpipe2.go
@@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build freebsd netbsd openbsd
+//go:build dragonfly || freebsd || netbsd || openbsd
+// +build dragonfly freebsd netbsd openbsd
package syscall
diff --git a/src/syscall/fs_js.go b/src/syscall/fs_js.go
index 673feea77f..0170516201 100644
--- a/src/syscall/fs_js.go
+++ b/src/syscall/fs_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package syscall
diff --git a/src/syscall/getdirentries_test.go b/src/syscall/getdirentries_test.go
index 66bb8acba2..936c8a163a 100644
--- a/src/syscall/getdirentries_test.go
+++ b/src/syscall/getdirentries_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || freebsd || netbsd || openbsd
// +build darwin freebsd netbsd openbsd
package syscall_test
diff --git a/src/syscall/mkasm.go b/src/syscall/mkasm.go
index 2ebaf8d351..39461145e9 100644
--- a/src/syscall/mkasm.go
+++ b/src/syscall/mkasm.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// mkasm.go generates assembly trampolines to call library routines from Go.
@@ -53,7 +54,8 @@ func main() {
fn := line[5 : len(line)-13]
if !trampolines[fn] {
trampolines[fn] = true
- fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
+ // The trampolines are ABIInternal as they are address-taken in Go code.
+ fmt.Fprintf(&out, "TEXT ·%s_trampoline<ABIInternal>(SB),NOSPLIT,$0-0\n", fn)
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
}
}
diff --git a/src/syscall/mkpost.go b/src/syscall/mkpost.go
index ef89128310..94e8d92eff 100644
--- a/src/syscall/mkpost.go
+++ b/src/syscall/mkpost.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// mkpost processes the output of cgo -godefs to
diff --git a/src/syscall/mksyscall_windows.go b/src/syscall/mksyscall_windows.go
index 240254b2c7..d8e8a713c5 100644
--- a/src/syscall/mksyscall_windows.go
+++ b/src/syscall/mksyscall_windows.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// mksyscall_windows wraps golang.org/x/sys/windows/mkwinsyscall.
diff --git a/src/syscall/mmap_unix_test.go b/src/syscall/mmap_unix_test.go
index d0b3644b59..e3909f1afb 100644
--- a/src/syscall/mmap_unix_test.go
+++ b/src/syscall/mmap_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build aix darwin dragonfly freebsd linux netbsd openbsd
package syscall_test
diff --git a/src/syscall/msan.go b/src/syscall/msan.go
index baaad6df98..89fb75f03c 100644
--- a/src/syscall/msan.go
+++ b/src/syscall/msan.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build msan
// +build msan
package syscall
diff --git a/src/syscall/msan0.go b/src/syscall/msan0.go
index ff10be9d25..85097025a0 100644
--- a/src/syscall/msan0.go
+++ b/src/syscall/msan0.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !msan
// +build !msan
package syscall
diff --git a/src/syscall/net_js.go b/src/syscall/net_js.go
index 25f171bda8..ed462025bb 100644
--- a/src/syscall/net_js.go
+++ b/src/syscall/net_js.go
@@ -5,6 +5,7 @@
// js/wasm uses fake networking directly implemented in the net package.
// This file only exists to make the compiler happy.
+//go:build js && wasm
// +build js,wasm
package syscall
diff --git a/src/syscall/ptrace_darwin.go b/src/syscall/ptrace_darwin.go
index a873d826b8..b968c7c7f3 100644
--- a/src/syscall/ptrace_darwin.go
+++ b/src/syscall/ptrace_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !ios
// +build !ios
package syscall
diff --git a/src/syscall/ptrace_ios.go b/src/syscall/ptrace_ios.go
index 2f61a88a08..5209d1e0dd 100644
--- a/src/syscall/ptrace_ios.go
+++ b/src/syscall/ptrace_ios.go
@@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ios
+// +build ios
+
package syscall
// Nosplit because it is called from forkAndExecInChild.
diff --git a/src/syscall/route_bsd.go b/src/syscall/route_bsd.go
index b364eeaba5..e9321a4e64 100644
--- a/src/syscall/route_bsd.go
+++ b/src/syscall/route_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
package syscall
diff --git a/src/syscall/route_freebsd_32bit.go b/src/syscall/route_freebsd_32bit.go
index aed8682237..412833a37c 100644
--- a/src/syscall/route_freebsd_32bit.go
+++ b/src/syscall/route_freebsd_32bit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (freebsd && 386) || (freebsd && arm)
// +build freebsd,386 freebsd,arm
package syscall
diff --git a/src/syscall/route_freebsd_64bit.go b/src/syscall/route_freebsd_64bit.go
index e70ba3df89..5300bed471 100644
--- a/src/syscall/route_freebsd_64bit.go
+++ b/src/syscall/route_freebsd_64bit.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (freebsd && amd64) || (freebsd && arm64)
// +build freebsd,amd64 freebsd,arm64
package syscall
diff --git a/src/syscall/setuidgid_32_linux.go b/src/syscall/setuidgid_32_linux.go
index b0b7f61d22..64897fe43c 100644
--- a/src/syscall/setuidgid_32_linux.go
+++ b/src/syscall/setuidgid_32_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (386 || arm)
// +build linux
// +build 386 arm
diff --git a/src/syscall/setuidgid_linux.go b/src/syscall/setuidgid_linux.go
index 38c83c92f9..3b36f66fa2 100644
--- a/src/syscall/setuidgid_linux.go
+++ b/src/syscall/setuidgid_linux.go
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux
-// +build !386,!arm
+//go:build linux && !386 && !arm
+// +build linux,!386,!arm
package syscall
diff --git a/src/syscall/sockcmsg_unix.go b/src/syscall/sockcmsg_unix.go
index 1ff97a5ae1..99913b9a88 100644
--- a/src/syscall/sockcmsg_unix.go
+++ b/src/syscall/sockcmsg_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
// Socket control messages
diff --git a/src/syscall/sockcmsg_unix_other.go b/src/syscall/sockcmsg_unix_other.go
index 40f03142a6..bd8dcfa34c 100644
--- a/src/syscall/sockcmsg_unix_other.go
+++ b/src/syscall/sockcmsg_unix_other.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin freebsd linux netbsd openbsd solaris
package syscall
diff --git a/src/syscall/syscall_bsd.go b/src/syscall/syscall_bsd.go
index 1c7ec588bc..595e705856 100644
--- a/src/syscall/syscall_bsd.go
+++ b/src/syscall/syscall_bsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || netbsd || openbsd
// +build darwin dragonfly freebsd netbsd openbsd
// BSD system call wrappers shared by *BSD based systems
diff --git a/src/syscall/syscall_bsd_test.go b/src/syscall/syscall_bsd_test.go
index f2bc3f5147..2d8a8cbfe6 100644
--- a/src/syscall/syscall_bsd_test.go
+++ b/src/syscall/syscall_bsd_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || openbsd
// +build darwin dragonfly freebsd openbsd
package syscall_test
diff --git a/src/syscall/syscall_dragonfly.go b/src/syscall/syscall_dragonfly.go
index 0988fe4608..b01a4ada67 100644
--- a/src/syscall/syscall_dragonfly.go
+++ b/src/syscall/syscall_dragonfly.go
@@ -100,6 +100,19 @@ func Pipe(p []int) (err error) {
return
}
+//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error)
+
+func Pipe2(p []int, flags int) (err error) {
+ if len(p) != 2 {
+ return EINVAL
+ }
+ var pp [2]_C_int
+ // pipe2 on dragonfly takes an fds array as an argument, but still
+ // returns the file descriptors.
+ p[0], p[1], err = pipe2(&pp, flags)
+ return err
+}
+
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
func Pread(fd int, p []byte, offset int64) (n int, err error) {
return extpread(fd, p, 0, offset)
diff --git a/src/syscall/syscall_dup2_linux.go b/src/syscall/syscall_dup2_linux.go
index f03a923112..351a96edc1 100644
--- a/src/syscall/syscall_dup2_linux.go
+++ b/src/syscall/syscall_dup2_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !android && (386 || amd64 || arm || mips || mipsle || mips64 || mips64le || ppc64 || ppc64le || s390x)
// +build !android
// +build 386 amd64 arm mips mipsle mips64 mips64le ppc64 ppc64le s390x
diff --git a/src/syscall/syscall_dup3_linux.go b/src/syscall/syscall_dup3_linux.go
index 1ebdcb20a2..66ec67b0ab 100644
--- a/src/syscall/syscall_dup3_linux.go
+++ b/src/syscall/syscall_dup3_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build android || arm64 || riscv64
// +build android arm64 riscv64
package syscall
diff --git a/src/syscall/syscall_freebsd_test.go b/src/syscall/syscall_freebsd_test.go
index 3ccfe5d463..89c7959d0c 100644
--- a/src/syscall/syscall_freebsd_test.go
+++ b/src/syscall/syscall_freebsd_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build freebsd
// +build freebsd
package syscall_test
diff --git a/src/syscall/syscall_illumos.go b/src/syscall/syscall_illumos.go
index d70a436d13..ef95fe58f7 100644
--- a/src/syscall/syscall_illumos.go
+++ b/src/syscall/syscall_illumos.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
// Illumos system calls not present on Solaris.
diff --git a/src/syscall/syscall_js.go b/src/syscall/syscall_js.go
index 0ab8c3fba4..c17c6fcdcf 100644
--- a/src/syscall/syscall_js.go
+++ b/src/syscall/syscall_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package syscall
diff --git a/src/syscall/syscall_linux_386.go b/src/syscall/syscall_linux_386.go
index ed52647403..0db037470d 100644
--- a/src/syscall/syscall_linux_386.go
+++ b/src/syscall/syscall_linux_386.go
@@ -387,6 +387,4 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
-func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) {
- panic("not implemented")
-}
+func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)
diff --git a/src/syscall/syscall_linux_arm.go b/src/syscall/syscall_linux_arm.go
index 4a3729f898..e887cf788f 100644
--- a/src/syscall/syscall_linux_arm.go
+++ b/src/syscall/syscall_linux_arm.go
@@ -236,6 +236,4 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
-func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) {
- panic("not implemented")
-}
+func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)
diff --git a/src/syscall/syscall_linux_mips64x.go b/src/syscall/syscall_linux_mips64x.go
index ab25b7be6f..5feb03e915 100644
--- a/src/syscall/syscall_linux_mips64x.go
+++ b/src/syscall/syscall_linux_mips64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips64 || mips64le)
// +build linux
// +build mips64 mips64le
@@ -213,6 +214,4 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint64(length)
}
-func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) {
- panic("not implemented")
-}
+func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)
diff --git a/src/syscall/syscall_linux_mipsx.go b/src/syscall/syscall_linux_mipsx.go
index 377946fc92..39104d71d8 100644
--- a/src/syscall/syscall_linux_mipsx.go
+++ b/src/syscall/syscall_linux_mipsx.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (mips || mipsle)
// +build linux
// +build mips mipsle
@@ -223,6 +224,4 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
-func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno) {
- panic("not implemented")
-}
+func rawVforkSyscall(trap, a1 uintptr) (r1 uintptr, err Errno)
diff --git a/src/syscall/syscall_linux_ppc64x.go b/src/syscall/syscall_linux_ppc64x.go
index 45bf667407..495ae29757 100644
--- a/src/syscall/syscall_linux_ppc64x.go
+++ b/src/syscall/syscall_linux_ppc64x.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build linux && (ppc64 || ppc64le)
// +build linux
// +build ppc64 ppc64le
diff --git a/src/syscall/syscall_openbsd1.go b/src/syscall/syscall_openbsd1.go
index 2c7d0f8c90..0d6761d49e 100644
--- a/src/syscall/syscall_openbsd1.go
+++ b/src/syscall/syscall_openbsd1.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build openbsd && !amd64 && !arm64
// +build openbsd,!amd64,!arm64
package syscall
diff --git a/src/syscall/syscall_openbsd_libc.go b/src/syscall/syscall_openbsd_libc.go
index 042615bf2a..610c66fd34 100644
--- a/src/syscall/syscall_openbsd_libc.go
+++ b/src/syscall/syscall_openbsd_libc.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,amd64 openbsd,arm64
package syscall
diff --git a/src/syscall/syscall_ptrace_test.go b/src/syscall/syscall_ptrace_test.go
index 6b7f54dcfd..45729d9e8e 100644
--- a/src/syscall/syscall_ptrace_test.go
+++ b/src/syscall/syscall_ptrace_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd
// +build darwin dragonfly freebsd linux netbsd openbsd
package syscall_test
diff --git a/src/syscall/syscall_unix.go b/src/syscall/syscall_unix.go
index 786ad34170..40fc8b8a30 100644
--- a/src/syscall/syscall_unix.go
+++ b/src/syscall/syscall_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package syscall
diff --git a/src/syscall/syscall_unix_test.go b/src/syscall/syscall_unix_test.go
index 7e6a8c9043..a05fff5136 100644
--- a/src/syscall/syscall_unix_test.go
+++ b/src/syscall/syscall_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
package syscall_test
diff --git a/src/syscall/syscall_windows.go b/src/syscall/syscall_windows.go
index ba69133d81..cc8dc487d3 100644
--- a/src/syscall/syscall_windows.go
+++ b/src/syscall/syscall_windows.go
@@ -213,9 +213,9 @@ func NewCallbackCDecl(fn interface{}) uintptr {
//sys SetEndOfFile(handle Handle) (err error)
//sys GetSystemTimeAsFileTime(time *Filetime)
//sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff]
-//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error)
-//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error)
-//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error)
+//sys createIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) = CreateIoCompletionPort
+//sys getQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) = GetQueuedCompletionStatus
+//sys postQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) = PostQueuedCompletionStatus
//sys CancelIo(s Handle) (err error)
//sys CancelIoEx(s Handle, o *Overlapped) (err error)
//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW
@@ -284,6 +284,9 @@ func NewCallbackCDecl(fn interface{}) uintptr {
// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL.
//sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW
//sys CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW
+//sys initializeProcThreadAttributeList(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, attrcount uint32, flags uint32, size *uintptr) (err error) = InitializeProcThreadAttributeList
+//sys deleteProcThreadAttributeList(attrlist *_PROC_THREAD_ATTRIBUTE_LIST) = DeleteProcThreadAttributeList
+//sys updateProcThreadAttribute(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, flags uint32, attr uintptr, value uintptr, size uintptr, prevvalue uintptr, returnedsize *uintptr) (err error) = UpdateProcThreadAttribute
// syscall interface implementation for other packages
@@ -414,19 +417,22 @@ const ptrSize = unsafe.Sizeof(uintptr(0))
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa365542(v=vs.85).aspx
func setFilePointerEx(handle Handle, distToMove int64, newFilePointer *int64, whence uint32) error {
var e1 Errno
- switch runtime.GOARCH {
- default:
- panic("unsupported architecture")
- case "amd64":
+ if unsafe.Sizeof(uintptr(0)) == 8 {
_, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 4, uintptr(handle), uintptr(distToMove), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0, 0)
- case "386":
- // distToMove is a LARGE_INTEGER:
- // https://msdn.microsoft.com/en-us/library/windows/desktop/aa383713(v=vs.85).aspx
- _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 5, uintptr(handle), uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0)
- case "arm":
- // distToMove must be 8-byte aligned per ARM calling convention
- // https://msdn.microsoft.com/en-us/library/dn736986.aspx#Anchor_7
- _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 6, uintptr(handle), 0, uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence))
+ } else {
+ // Different 32-bit systems disgaree about whether distToMove starts 8-byte aligned.
+ switch runtime.GOARCH {
+ default:
+ panic("unsupported 32-bit architecture")
+ case "386":
+ // distToMove is a LARGE_INTEGER:
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/aa383713(v=vs.85).aspx
+ _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 5, uintptr(handle), uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence), 0)
+ case "arm":
+ // distToMove must be 8-byte aligned per ARM calling convention
+ // https://msdn.microsoft.com/en-us/library/dn736986.aspx#Anchor_7
+ _, _, e1 = Syscall6(procSetFilePointerEx.Addr(), 6, uintptr(handle), 0, uintptr(distToMove), uintptr(distToMove>>32), uintptr(unsafe.Pointer(newFilePointer)), uintptr(whence))
+ }
}
if e1 != 0 {
return errnoErr(e1)
@@ -1209,3 +1215,51 @@ func Readlink(path string, buf []byte) (n int, err error) {
return n, nil
}
+
+// Deprecated: CreateIoCompletionPort has the wrong function signature. Use x/sys/windows.CreateIoCompletionPort.
+func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (Handle, error) {
+ return createIoCompletionPort(filehandle, cphandle, uintptr(key), threadcnt)
+}
+
+// Deprecated: GetQueuedCompletionStatus has the wrong function signature. Use x/sys/windows.GetQueuedCompletionStatus.
+func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) error {
+ var ukey uintptr
+ var pukey *uintptr
+ if key != nil {
+ ukey = uintptr(*key)
+ pukey = &ukey
+ }
+ err := getQueuedCompletionStatus(cphandle, qty, pukey, overlapped, timeout)
+ if key != nil {
+ *key = uint32(ukey)
+ if uintptr(*key) != ukey && err == nil {
+ err = errorspkg.New("GetQueuedCompletionStatus returned key overflow")
+ }
+ }
+ return err
+}
+
+// Deprecated: PostQueuedCompletionStatus has the wrong function signature. Use x/sys/windows.PostQueuedCompletionStatus.
+func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) error {
+ return postQueuedCompletionStatus(cphandle, qty, uintptr(key), overlapped)
+}
+
+// newProcThreadAttributeList allocates new PROC_THREAD_ATTRIBUTE_LIST, with
+// the requested maximum number of attributes, which must be cleaned up by
+// deleteProcThreadAttributeList.
+func newProcThreadAttributeList(maxAttrCount uint32) (*_PROC_THREAD_ATTRIBUTE_LIST, error) {
+ var size uintptr
+ err := initializeProcThreadAttributeList(nil, maxAttrCount, 0, &size)
+ if err != ERROR_INSUFFICIENT_BUFFER {
+ if err == nil {
+ return nil, errorspkg.New("unable to query buffer size from InitializeProcThreadAttributeList")
+ }
+ return nil, err
+ }
+ al := (*_PROC_THREAD_ATTRIBUTE_LIST)(unsafe.Pointer(&make([]byte, size)[0]))
+ err = initializeProcThreadAttributeList(al, maxAttrCount, 0, &size)
+ if err != nil {
+ return nil, err
+ }
+ return al, nil
+}
diff --git a/src/syscall/syscall_windows_386.go b/src/syscall/syscall_windows_386.go
deleted file mode 100644
index e82b540b4b..0000000000
--- a/src/syscall/syscall_windows_386.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2009 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.
-
-package syscall
diff --git a/src/syscall/syscall_windows_amd64.go b/src/syscall/syscall_windows_amd64.go
deleted file mode 100644
index e82b540b4b..0000000000
--- a/src/syscall/syscall_windows_amd64.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2009 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.
-
-package syscall
diff --git a/src/syscall/tables_js.go b/src/syscall/tables_js.go
index a7c4f8c890..64d958415d 100644
--- a/src/syscall/tables_js.go
+++ b/src/syscall/tables_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package syscall
diff --git a/src/syscall/time_fake.go b/src/syscall/time_fake.go
index 5dec57a25a..cf88aeb921 100644
--- a/src/syscall/time_fake.go
+++ b/src/syscall/time_fake.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build faketime
// +build faketime
package syscall
diff --git a/src/syscall/time_nofake.go b/src/syscall/time_nofake.go
index c94cef8686..5eaa2daabd 100644
--- a/src/syscall/time_nofake.go
+++ b/src/syscall/time_nofake.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !faketime
// +build !faketime
package syscall
diff --git a/src/syscall/timestruct.go b/src/syscall/timestruct.go
index bca51df08d..e4f3d50f56 100644
--- a/src/syscall/timestruct.go
+++ b/src/syscall/timestruct.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package syscall
diff --git a/src/syscall/types_aix.go b/src/syscall/types_aix.go
index cbc47cc6c1..6588d690ea 100644
--- a/src/syscall/types_aix.go
+++ b/src/syscall/types_aix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_darwin.go b/src/syscall/types_darwin.go
index 7b3a9d2335..c2a32c0782 100644
--- a/src/syscall/types_darwin.go
+++ b/src/syscall/types_darwin.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_dragonfly.go b/src/syscall/types_dragonfly.go
index 53bc12403b..9f8d5bc3dd 100644
--- a/src/syscall/types_dragonfly.go
+++ b/src/syscall/types_dragonfly.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_freebsd.go b/src/syscall/types_freebsd.go
index f686021121..d741411703 100644
--- a/src/syscall/types_freebsd.go
+++ b/src/syscall/types_freebsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_illumos_amd64.go b/src/syscall/types_illumos_amd64.go
index abb282f3e4..254e3e7cfe 100644
--- a/src/syscall/types_illumos_amd64.go
+++ b/src/syscall/types_illumos_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build illumos
// +build illumos
// Illumos consts not present on Solaris. These are added manually rather than
diff --git a/src/syscall/types_linux.go b/src/syscall/types_linux.go
index 9de32d9c01..bf76be978b 100644
--- a/src/syscall/types_linux.go
+++ b/src/syscall/types_linux.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_netbsd.go b/src/syscall/types_netbsd.go
index 30ab2dc845..0bd25ea3c9 100644
--- a/src/syscall/types_netbsd.go
+++ b/src/syscall/types_netbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_openbsd.go b/src/syscall/types_openbsd.go
index 922864815b..8b41cdca23 100644
--- a/src/syscall/types_openbsd.go
+++ b/src/syscall/types_openbsd.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_solaris.go b/src/syscall/types_solaris.go
index 76a74508d2..179f791481 100644
--- a/src/syscall/types_solaris.go
+++ b/src/syscall/types_solaris.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
/*
diff --git a/src/syscall/types_windows.go b/src/syscall/types_windows.go
index 0349f3b180..384b5b4f2c 100644
--- a/src/syscall/types_windows.go
+++ b/src/syscall/types_windows.go
@@ -398,6 +398,14 @@ type win32finddata1 struct {
Reserved1 uint32
FileName [MAX_PATH]uint16
AlternateFileName [14]uint16
+
+ // The Microsoft documentation for this struct¹ describes three additional
+ // fields: dwFileType, dwCreatorType, and wFinderFlags. However, those fields
+ // are empirically only present in the macOS port of the Win32 API,² and thus
+ // not needed for binaries built for Windows.
+ //
+ // ¹ https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-win32_find_dataw
+ // ² https://golang.org/issue/42637#issuecomment-760715755
}
func copyFindData(dst *Win32finddata, src *win32finddata1) {
@@ -482,6 +490,22 @@ type StartupInfo struct {
StdErr Handle
}
+type _PROC_THREAD_ATTRIBUTE_LIST struct {
+ _ [1]byte
+}
+
+const (
+ _PROC_THREAD_ATTRIBUTE_PARENT_PROCESS = 0x00020000
+ _PROC_THREAD_ATTRIBUTE_HANDLE_LIST = 0x00020002
+)
+
+type _STARTUPINFOEXW struct {
+ StartupInfo
+ ProcThreadAttributeList *_PROC_THREAD_ATTRIBUTE_LIST
+}
+
+const _EXTENDED_STARTUPINFO_PRESENT = 0x00080000
+
type ProcessInformation struct {
Process Handle
Thread Handle
diff --git a/src/syscall/types_windows_arm64.go b/src/syscall/types_windows_arm64.go
new file mode 100644
index 0000000000..7d45ddbc0b
--- /dev/null
+++ b/src/syscall/types_windows_arm64.go
@@ -0,0 +1,22 @@
+// Copyright 2011 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.
+
+package syscall
+
+type WSAData struct {
+ Version uint16
+ HighVersion uint16
+ MaxSockets uint16
+ MaxUdpDg uint16
+ VendorInfo *byte
+ Description [WSADESCRIPTION_LEN + 1]byte
+ SystemStatus [WSASYS_STATUS_LEN + 1]byte
+}
+
+type Servent struct {
+ Name *byte
+ Aliases **byte
+ Proto *byte
+ Port uint16
+}
diff --git a/src/syscall/zerrors_darwin_amd64.go b/src/syscall/zerrors_darwin_amd64.go
index 58799fbde7..0b9897284c 100644
--- a/src/syscall/zerrors_darwin_amd64.go
+++ b/src/syscall/zerrors_darwin_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && darwin
// +build amd64,darwin
package syscall
diff --git a/src/syscall/zerrors_darwin_arm64.go b/src/syscall/zerrors_darwin_arm64.go
index 8b433616ee..5f210fd1c4 100644
--- a/src/syscall/zerrors_darwin_arm64.go
+++ b/src/syscall/zerrors_darwin_arm64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build arm64 && darwin
// +build arm64,darwin
package syscall
diff --git a/src/syscall/zerrors_dragonfly_amd64.go b/src/syscall/zerrors_dragonfly_amd64.go
index 3434a85d34..b572f44a6b 100644
--- a/src/syscall/zerrors_dragonfly_amd64.go
+++ b/src/syscall/zerrors_dragonfly_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && dragonfly
// +build amd64,dragonfly
package syscall
diff --git a/src/syscall/zerrors_freebsd_386.go b/src/syscall/zerrors_freebsd_386.go
index 85786a5b4e..aec26ad778 100644
--- a/src/syscall/zerrors_freebsd_386.go
+++ b/src/syscall/zerrors_freebsd_386.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
+//go:build 386 && freebsd
// +build 386,freebsd
package syscall
diff --git a/src/syscall/zerrors_freebsd_amd64.go b/src/syscall/zerrors_freebsd_amd64.go
index b3ebf3d474..d6d13e4155 100644
--- a/src/syscall/zerrors_freebsd_amd64.go
+++ b/src/syscall/zerrors_freebsd_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && freebsd
// +build amd64,freebsd
package syscall
diff --git a/src/syscall/zerrors_freebsd_arm.go b/src/syscall/zerrors_freebsd_arm.go
index 29eabb1d2d..15c714fad8 100644
--- a/src/syscall/zerrors_freebsd_arm.go
+++ b/src/syscall/zerrors_freebsd_arm.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- _const.go
+//go:build arm && freebsd
// +build arm,freebsd
package syscall
diff --git a/src/syscall/zerrors_freebsd_arm64.go b/src/syscall/zerrors_freebsd_arm64.go
index 82ee158478..b20ce7d823 100644
--- a/src/syscall/zerrors_freebsd_arm64.go
+++ b/src/syscall/zerrors_freebsd_arm64.go
@@ -1,6 +1,7 @@
// mkerrors.sh -m64
// Code generated by the command above; DO NOT EDIT.
+//go:build freebsd && arm64
// +build freebsd,arm64
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
diff --git a/src/syscall/zerrors_linux_386.go b/src/syscall/zerrors_linux_386.go
index 53a442d108..fb64932ad6 100644
--- a/src/syscall/zerrors_linux_386.go
+++ b/src/syscall/zerrors_linux_386.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
+//go:build 386 && linux
// +build 386,linux
package syscall
diff --git a/src/syscall/zerrors_linux_amd64.go b/src/syscall/zerrors_linux_amd64.go
index 0b4c60dd4c..3a92bcdbb4 100644
--- a/src/syscall/zerrors_linux_amd64.go
+++ b/src/syscall/zerrors_linux_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && linux
// +build amd64,linux
package syscall
diff --git a/src/syscall/zerrors_linux_arm.go b/src/syscall/zerrors_linux_arm.go
index 9a8d9e8579..e013d8e7fd 100644
--- a/src/syscall/zerrors_linux_arm.go
+++ b/src/syscall/zerrors_linux_arm.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- _const.go
+//go:build arm && linux
// +build arm,linux
package syscall
diff --git a/src/syscall/zerrors_linux_arm64.go b/src/syscall/zerrors_linux_arm64.go
index f0caf552b2..1a4d33e3fd 100644
--- a/src/syscall/zerrors_linux_arm64.go
+++ b/src/syscall/zerrors_linux_arm64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- _const.go
+//go:build arm64 && linux
// +build arm64,linux
package syscall
diff --git a/src/syscall/zerrors_linux_ppc64.go b/src/syscall/zerrors_linux_ppc64.go
index f064731ae5..1dda43be70 100644
--- a/src/syscall/zerrors_linux_ppc64.go
+++ b/src/syscall/zerrors_linux_ppc64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build ppc64 && linux
// +build ppc64,linux
package syscall
diff --git a/src/syscall/zerrors_linux_ppc64le.go b/src/syscall/zerrors_linux_ppc64le.go
index 41e21a510e..6d56f1c998 100644
--- a/src/syscall/zerrors_linux_ppc64le.go
+++ b/src/syscall/zerrors_linux_ppc64le.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build ppc64le && linux
// +build ppc64le,linux
package syscall
diff --git a/src/syscall/zerrors_netbsd_386.go b/src/syscall/zerrors_netbsd_386.go
index bf1e4a74c3..6a58946a4a 100644
--- a/src/syscall/zerrors_netbsd_386.go
+++ b/src/syscall/zerrors_netbsd_386.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
+//go:build 386 && netbsd
// +build 386,netbsd
package syscall
diff --git a/src/syscall/zerrors_netbsd_amd64.go b/src/syscall/zerrors_netbsd_amd64.go
index 247e78e6c6..f5c5c2f49c 100644
--- a/src/syscall/zerrors_netbsd_amd64.go
+++ b/src/syscall/zerrors_netbsd_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && netbsd
// +build amd64,netbsd
package syscall
diff --git a/src/syscall/zerrors_netbsd_arm.go b/src/syscall/zerrors_netbsd_arm.go
index f23cd8693f..c9d4579b41 100644
--- a/src/syscall/zerrors_netbsd_arm.go
+++ b/src/syscall/zerrors_netbsd_arm.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -marm _const.go
+//go:build arm && netbsd
// +build arm,netbsd
package syscall
diff --git a/src/syscall/zerrors_netbsd_arm64.go b/src/syscall/zerrors_netbsd_arm64.go
index 6f6453f6ee..e35bff7f3e 100644
--- a/src/syscall/zerrors_netbsd_arm64.go
+++ b/src/syscall/zerrors_netbsd_arm64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build arm64 && netbsd
// +build arm64,netbsd
package syscall
diff --git a/src/syscall/zerrors_openbsd_386.go b/src/syscall/zerrors_openbsd_386.go
index 7985abe3f0..04d1b3f177 100644
--- a/src/syscall/zerrors_openbsd_386.go
+++ b/src/syscall/zerrors_openbsd_386.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m32 _const.go
+//go:build 386 && openbsd
// +build 386,openbsd
package syscall
diff --git a/src/syscall/zerrors_openbsd_amd64.go b/src/syscall/zerrors_openbsd_amd64.go
index 9c4ff2955f..923a3a47c5 100644
--- a/src/syscall/zerrors_openbsd_amd64.go
+++ b/src/syscall/zerrors_openbsd_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && openbsd
// +build amd64,openbsd
package syscall
diff --git a/src/syscall/zerrors_openbsd_arm.go b/src/syscall/zerrors_openbsd_arm.go
index 493a8389f2..89a4e6d89a 100644
--- a/src/syscall/zerrors_openbsd_arm.go
+++ b/src/syscall/zerrors_openbsd_arm.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- _const.go
+//go:build arm && openbsd
// +build arm,openbsd
package syscall
diff --git a/src/syscall/zerrors_solaris_amd64.go b/src/syscall/zerrors_solaris_amd64.go
index eba401544a..b7dee69602 100644
--- a/src/syscall/zerrors_solaris_amd64.go
+++ b/src/syscall/zerrors_solaris_amd64.go
@@ -4,6 +4,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -m64 _const.go
+//go:build amd64 && solaris
// +build amd64,solaris
package syscall
diff --git a/src/syscall/zerrors_windows_amd64.go b/src/syscall/zerrors_windows_amd64.go
deleted file mode 100644
index 8bc5b6b194..0000000000
--- a/src/syscall/zerrors_windows_amd64.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// Copyright 2011 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.
-
-package syscall
diff --git a/src/syscall/zsyscall_aix_ppc64.go b/src/syscall/zsyscall_aix_ppc64.go
index 20625c1a3e..134ae41165 100644
--- a/src/syscall/zsyscall_aix_ppc64.go
+++ b/src/syscall/zsyscall_aix_ppc64.go
@@ -1,6 +1,7 @@
// mksyscall_libc.pl -aix -tags aix,ppc64 syscall_aix.go syscall_aix_ppc64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build aix && ppc64
// +build aix,ppc64
package syscall
diff --git a/src/syscall/zsyscall_darwin_amd64.go b/src/syscall/zsyscall_darwin_amd64.go
index 4f2cdf861e..13dfacdba2 100644
--- a/src/syscall/zsyscall_darwin_amd64.go
+++ b/src/syscall/zsyscall_darwin_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -darwin -tags darwin,amd64 syscall_bsd.go syscall_darwin.go syscall_darwin_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build darwin && amd64
// +build darwin,amd64
package syscall
diff --git a/src/syscall/zsyscall_darwin_amd64.s b/src/syscall/zsyscall_darwin_amd64.s
index 492f947855..5eb48cee44 100644
--- a/src/syscall/zsyscall_darwin_amd64.s
+++ b/src/syscall/zsyscall_darwin_amd64.s
@@ -1,253 +1,253 @@
// go run mkasm.go darwin amd64
// Code generated by the command above; DO NOT EDIT.
#include "textflag.h"
-TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getfsstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getfsstat(SB)
-TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setattrlist_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setattrlist(SB)
-TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fdopendir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fdopendir(SB)
-TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendfile_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendfile(SB)
-TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgroups(SB)
-TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgroups(SB)
-TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_wait4_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_wait4(SB)
-TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_accept_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_accept(SB)
-TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_bind_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_bind(SB)
-TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_connect_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_connect(SB)
-TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socket_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socket(SB)
-TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockopt(SB)
-TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsockopt(SB)
-TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpeername_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpeername(SB)
-TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockname_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockname(SB)
-TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_shutdown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_shutdown(SB)
-TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socketpair_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socketpair(SB)
-TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvfrom_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvfrom(SB)
-TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendto_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendto(SB)
-TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvmsg(SB)
-TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendmsg(SB)
-TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kevent_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kevent(SB)
-TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_utimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_utimes(SB)
-TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_futimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
-TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fcntl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pipe_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
-TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kill_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kill(SB)
-TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_access_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_access(SB)
-TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_adjtime_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_adjtime(SB)
-TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chdir(SB)
-TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chflags(SB)
-TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chmod(SB)
-TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chown(SB)
-TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chroot_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chroot(SB)
-TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_close_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_close(SB)
-TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_closedir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_closedir(SB)
-TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup(SB)
-TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup2_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup2(SB)
-TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_exchangedata_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_exchangedata(SB)
-TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchdir(SB)
-TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchflags(SB)
-TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchmod(SB)
-TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchown(SB)
-TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_flock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_flock(SB)
-TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fpathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fpathconf(SB)
-TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fsync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fsync(SB)
-TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ftruncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ftruncate(SB)
-TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getdtablesize_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getdtablesize(SB)
-TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getegid(SB)
-TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_geteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_geteuid(SB)
-TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgid(SB)
-TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgid(SB)
-TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgrp_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgrp(SB)
-TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpid(SB)
-TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getppid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getppid(SB)
-TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpriority(SB)
-TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrlimit(SB)
-TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrusage_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB)
-TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsid(SB)
-TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getuid(SB)
-TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_issetugid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_issetugid(SB)
-TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kqueue_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kqueue(SB)
-TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lchown(SB)
-TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_link_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_link(SB)
-TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_listen_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_listen(SB)
-TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkdir(SB)
-TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkfifo_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkfifo(SB)
-TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mknod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mknod(SB)
-TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mlock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mlock(SB)
-TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mlockall_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mlockall(SB)
-TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mprotect_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mprotect(SB)
-TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munlock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munlock(SB)
-TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munlockall_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munlockall(SB)
-TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_open_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_open(SB)
-TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pathconf(SB)
-TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pread_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pread(SB)
-TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pwrite_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pwrite(SB)
-TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_read_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_read(SB)
-TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_readdir_r_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_readdir_r(SB)
-TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_readlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_readlink(SB)
-TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rename_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rename(SB)
-TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_revoke_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_revoke(SB)
-TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rmdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rmdir(SB)
-TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lseek_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lseek(SB)
-TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_select_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_select(SB)
-TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setegid(SB)
-TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_seteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_seteuid(SB)
-TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgid(SB)
-TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setlogin_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setlogin(SB)
-TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpgid(SB)
-TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpriority(SB)
-TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setprivexec_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setprivexec(SB)
-TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setregid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setregid(SB)
-TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setreuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setreuid(SB)
-TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setrlimit(SB)
-TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsid(SB)
-TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_settimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_settimeofday(SB)
-TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setuid(SB)
-TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_symlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_symlink(SB)
-TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sync(SB)
-TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_truncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_truncate(SB)
-TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_umask_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_umask(SB)
-TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_undelete_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_undelete(SB)
-TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlink(SB)
-TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unmount_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unmount(SB)
-TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_write_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_write(SB)
-TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_writev_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_writev(SB)
-TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mmap(SB)
-TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munmap(SB)
-TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fork_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fork(SB)
-TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ioctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
-TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_execve_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_execve(SB)
-TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_exit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_exit(SB)
-TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sysctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sysctl(SB)
-TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlinkat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlinkat(SB)
-TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_openat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_openat(SB)
-TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getcwd_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getcwd(SB)
-TEXT ·libc_fstat64_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstat64_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstat64(SB)
-TEXT ·libc_fstatfs64_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatfs64_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatfs64(SB)
-TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_gettimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
-TEXT ·libc_lstat64_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lstat64_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lstat64(SB)
-TEXT ·libc_stat64_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_stat64_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_stat64(SB)
-TEXT ·libc_statfs64_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_statfs64_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_statfs64(SB)
-TEXT ·libc_fstatat64_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatat64_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatat64(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ptrace_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB)
diff --git a/src/syscall/zsyscall_darwin_arm64.go b/src/syscall/zsyscall_darwin_arm64.go
index 0d8598d816..79576eedf7 100644
--- a/src/syscall/zsyscall_darwin_arm64.go
+++ b/src/syscall/zsyscall_darwin_arm64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -darwin -tags darwin,arm64 syscall_bsd.go syscall_darwin.go syscall_darwin_arm64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build darwin && arm64
// +build darwin,arm64
package syscall
diff --git a/src/syscall/zsyscall_darwin_arm64.s b/src/syscall/zsyscall_darwin_arm64.s
index b606c6e49e..73e4a3fd8d 100644
--- a/src/syscall/zsyscall_darwin_arm64.s
+++ b/src/syscall/zsyscall_darwin_arm64.s
@@ -1,253 +1,253 @@
// go run mkasm.go darwin arm64
// Code generated by the command above; DO NOT EDIT.
#include "textflag.h"
-TEXT ·libc_getfsstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getfsstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getfsstat(SB)
-TEXT ·libc_setattrlist_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setattrlist_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setattrlist(SB)
-TEXT ·libc_fdopendir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fdopendir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fdopendir(SB)
-TEXT ·libc_sendfile_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendfile_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendfile(SB)
-TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgroups(SB)
-TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgroups(SB)
-TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_wait4_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_wait4(SB)
-TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_accept_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_accept(SB)
-TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_bind_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_bind(SB)
-TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_connect_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_connect(SB)
-TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socket_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socket(SB)
-TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockopt(SB)
-TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsockopt(SB)
-TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpeername_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpeername(SB)
-TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockname_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockname(SB)
-TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_shutdown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_shutdown(SB)
-TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socketpair_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socketpair(SB)
-TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvfrom_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvfrom(SB)
-TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendto_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendto(SB)
-TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvmsg(SB)
-TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendmsg(SB)
-TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kevent_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kevent(SB)
-TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_utimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_utimes(SB)
-TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_futimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
-TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fcntl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_pipe_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pipe_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pipe(SB)
-TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kill_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kill(SB)
-TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_access_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_access(SB)
-TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_adjtime_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_adjtime(SB)
-TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chdir(SB)
-TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chflags(SB)
-TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chmod(SB)
-TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chown(SB)
-TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chroot_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chroot(SB)
-TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_close_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_close(SB)
-TEXT ·libc_closedir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_closedir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_closedir(SB)
-TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup(SB)
-TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup2_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup2(SB)
-TEXT ·libc_exchangedata_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_exchangedata_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_exchangedata(SB)
-TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchdir(SB)
-TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchflags(SB)
-TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchmod(SB)
-TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchown(SB)
-TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_flock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_flock(SB)
-TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fpathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fpathconf(SB)
-TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fsync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fsync(SB)
-TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ftruncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ftruncate(SB)
-TEXT ·libc_getdtablesize_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getdtablesize_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getdtablesize(SB)
-TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getegid(SB)
-TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_geteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_geteuid(SB)
-TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgid(SB)
-TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgid(SB)
-TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgrp_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgrp(SB)
-TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpid(SB)
-TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getppid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getppid(SB)
-TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpriority(SB)
-TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrlimit(SB)
-TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrusage_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB)
-TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsid(SB)
-TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getuid(SB)
-TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_issetugid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_issetugid(SB)
-TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kqueue_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kqueue(SB)
-TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lchown(SB)
-TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_link_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_link(SB)
-TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_listen_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_listen(SB)
-TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkdir(SB)
-TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkfifo_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkfifo(SB)
-TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mknod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mknod(SB)
-TEXT ·libc_mlock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mlock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mlock(SB)
-TEXT ·libc_mlockall_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mlockall_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mlockall(SB)
-TEXT ·libc_mprotect_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mprotect_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mprotect(SB)
-TEXT ·libc_munlock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munlock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munlock(SB)
-TEXT ·libc_munlockall_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munlockall_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munlockall(SB)
-TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_open_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_open(SB)
-TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pathconf(SB)
-TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pread_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pread(SB)
-TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pwrite_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pwrite(SB)
-TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_read_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_read(SB)
-TEXT ·libc_readdir_r_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_readdir_r_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_readdir_r(SB)
-TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_readlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_readlink(SB)
-TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rename_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rename(SB)
-TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_revoke_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_revoke(SB)
-TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rmdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rmdir(SB)
-TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lseek_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lseek(SB)
-TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_select_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_select(SB)
-TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setegid(SB)
-TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_seteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_seteuid(SB)
-TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgid(SB)
-TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setlogin_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setlogin(SB)
-TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpgid(SB)
-TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpriority(SB)
-TEXT ·libc_setprivexec_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setprivexec_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setprivexec(SB)
-TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setregid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setregid(SB)
-TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setreuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setreuid(SB)
-TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setrlimit(SB)
-TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsid(SB)
-TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_settimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_settimeofday(SB)
-TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setuid(SB)
-TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_symlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_symlink(SB)
-TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sync(SB)
-TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_truncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_truncate(SB)
-TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_umask_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_umask(SB)
-TEXT ·libc_undelete_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_undelete_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_undelete(SB)
-TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlink(SB)
-TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unmount_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unmount(SB)
-TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_write_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_write(SB)
-TEXT ·libc_writev_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_writev_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_writev(SB)
-TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mmap(SB)
-TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munmap(SB)
-TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fork_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fork(SB)
-TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ioctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
-TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_execve_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_execve(SB)
-TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_exit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_exit(SB)
-TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sysctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sysctl(SB)
-TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlinkat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlinkat(SB)
-TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_openat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_openat(SB)
-TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getcwd_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getcwd(SB)
-TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstat(SB)
-TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatfs_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatfs(SB)
-TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_gettimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
-TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lstat(SB)
-TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_stat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_stat(SB)
-TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_statfs_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_statfs(SB)
-TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatat(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ptrace_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB)
diff --git a/src/syscall/zsyscall_dragonfly_amd64.go b/src/syscall/zsyscall_dragonfly_amd64.go
index 578b5a3e9e..aa327c0010 100644
--- a/src/syscall/zsyscall_dragonfly_amd64.go
+++ b/src/syscall/zsyscall_dragonfly_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build dragonfly && amd64
// +build dragonfly,amd64
package syscall
@@ -273,6 +274,18 @@ func pipe() (r int, w int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+func pipe2(p *[2]_C_int, flags int) (r int, w int, err error) {
+ r0, r1, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
+ r = int(r0)
+ w = int(r1)
+ if e1 != 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
+// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
+
func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) {
var _p0 unsafe.Pointer
if len(p) > 0 {
diff --git a/src/syscall/zsyscall_freebsd_386.go b/src/syscall/zsyscall_freebsd_386.go
index ddc265f190..7137d66f0b 100644
--- a/src/syscall/zsyscall_freebsd_386.go
+++ b/src/syscall/zsyscall_freebsd_386.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -tags freebsd,386 syscall_bsd.go syscall_freebsd.go syscall_freebsd_386.go
// Code generated by the command above; DO NOT EDIT.
+//go:build freebsd && 386
// +build freebsd,386
package syscall
diff --git a/src/syscall/zsyscall_freebsd_amd64.go b/src/syscall/zsyscall_freebsd_amd64.go
index a0f79522b9..d721dafde2 100644
--- a/src/syscall/zsyscall_freebsd_amd64.go
+++ b/src/syscall/zsyscall_freebsd_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags freebsd,amd64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build freebsd && amd64
// +build freebsd,amd64
package syscall
diff --git a/src/syscall/zsyscall_freebsd_arm.go b/src/syscall/zsyscall_freebsd_arm.go
index 2cd23d3db6..d9dbea921a 100644
--- a/src/syscall/zsyscall_freebsd_arm.go
+++ b/src/syscall/zsyscall_freebsd_arm.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -arm -tags freebsd,arm syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm.go
// Code generated by the command above; DO NOT EDIT.
+//go:build freebsd && arm
// +build freebsd,arm
package syscall
diff --git a/src/syscall/zsyscall_freebsd_arm64.go b/src/syscall/zsyscall_freebsd_arm64.go
index 1b177383c2..a24f0115e2 100644
--- a/src/syscall/zsyscall_freebsd_arm64.go
+++ b/src/syscall/zsyscall_freebsd_arm64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags freebsd,arm64 syscall_bsd.go syscall_freebsd.go syscall_freebsd_arm64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build freebsd && arm64
// +build freebsd,arm64
package syscall
diff --git a/src/syscall/zsyscall_linux_386.go b/src/syscall/zsyscall_linux_386.go
index 5a749ff3f3..ac822d6f7a 100644
--- a/src/syscall/zsyscall_linux_386.go
+++ b/src/syscall/zsyscall_linux_386.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && 386
// +build linux,386
package syscall
diff --git a/src/syscall/zsyscall_linux_amd64.go b/src/syscall/zsyscall_linux_amd64.go
index 34b624c1d4..ed37fa8dec 100644
--- a/src/syscall/zsyscall_linux_amd64.go
+++ b/src/syscall/zsyscall_linux_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && amd64
// +build linux,amd64
package syscall
diff --git a/src/syscall/zsyscall_linux_arm.go b/src/syscall/zsyscall_linux_arm.go
index 4d133766f7..213aaf3bac 100644
--- a/src/syscall/zsyscall_linux_arm.go
+++ b/src/syscall/zsyscall_linux_arm.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && arm
// +build linux,arm
package syscall
diff --git a/src/syscall/zsyscall_linux_arm64.go b/src/syscall/zsyscall_linux_arm64.go
index e7f7b7e3f8..e2f9c0fd9b 100644
--- a/src/syscall/zsyscall_linux_arm64.go
+++ b/src/syscall/zsyscall_linux_arm64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && arm64
// +build linux,arm64
package syscall
diff --git a/src/syscall/zsyscall_linux_mips.go b/src/syscall/zsyscall_linux_mips.go
index a8522dc571..617c2f5466 100644
--- a/src/syscall/zsyscall_linux_mips.go
+++ b/src/syscall/zsyscall_linux_mips.go
@@ -1,6 +1,7 @@
// mksyscall.pl -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && mips
// +build linux,mips
package syscall
diff --git a/src/syscall/zsyscall_linux_mips64.go b/src/syscall/zsyscall_linux_mips64.go
index 1219fcc6cb..793d4b9884 100644
--- a/src/syscall/zsyscall_linux_mips64.go
+++ b/src/syscall/zsyscall_linux_mips64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && mips64
// +build linux,mips64
package syscall
diff --git a/src/syscall/zsyscall_linux_mips64le.go b/src/syscall/zsyscall_linux_mips64le.go
index c3737bf3cf..54e1760bda 100644
--- a/src/syscall/zsyscall_linux_mips64le.go
+++ b/src/syscall/zsyscall_linux_mips64le.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && mips64le
// +build linux,mips64le
package syscall
diff --git a/src/syscall/zsyscall_linux_mipsle.go b/src/syscall/zsyscall_linux_mipsle.go
index 5006f4a409..ba7e2118c0 100644
--- a/src/syscall/zsyscall_linux_mipsle.go
+++ b/src/syscall/zsyscall_linux_mipsle.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && mipsle
// +build linux,mipsle
package syscall
diff --git a/src/syscall/zsyscall_linux_ppc64.go b/src/syscall/zsyscall_linux_ppc64.go
index 323be988be..c3437722e0 100644
--- a/src/syscall/zsyscall_linux_ppc64.go
+++ b/src/syscall/zsyscall_linux_ppc64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && ppc64
// +build linux,ppc64
package syscall
diff --git a/src/syscall/zsyscall_linux_ppc64le.go b/src/syscall/zsyscall_linux_ppc64le.go
index 99aea6b559..acc34a76d2 100644
--- a/src/syscall/zsyscall_linux_ppc64le.go
+++ b/src/syscall/zsyscall_linux_ppc64le.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && ppc64le
// +build linux,ppc64le
package syscall
diff --git a/src/syscall/zsyscall_linux_riscv64.go b/src/syscall/zsyscall_linux_riscv64.go
index afa8945944..d662d780db 100644
--- a/src/syscall/zsyscall_linux_riscv64.go
+++ b/src/syscall/zsyscall_linux_riscv64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,riscv64 syscall_linux.go syscall_linux_riscv64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && riscv64
// +build linux,riscv64
package syscall
diff --git a/src/syscall/zsyscall_linux_s390x.go b/src/syscall/zsyscall_linux_s390x.go
index 5717206f28..20f8c61366 100644
--- a/src/syscall/zsyscall_linux_s390x.go
+++ b/src/syscall/zsyscall_linux_s390x.go
@@ -1,6 +1,7 @@
// mksyscall.pl -tags linux,s390x syscall_linux.go syscall_linux_s390x.go
// Code generated by the command above; DO NOT EDIT.
+//go:build linux && s390x
// +build linux,s390x
package syscall
diff --git a/src/syscall/zsyscall_netbsd_386.go b/src/syscall/zsyscall_netbsd_386.go
index 7e0210081e..07ff5fba5f 100644
--- a/src/syscall/zsyscall_netbsd_386.go
+++ b/src/syscall/zsyscall_netbsd_386.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -netbsd -tags netbsd,386 syscall_bsd.go syscall_netbsd.go syscall_netbsd_386.go
// Code generated by the command above; DO NOT EDIT.
+//go:build netbsd && 386
// +build netbsd,386
package syscall
diff --git a/src/syscall/zsyscall_netbsd_amd64.go b/src/syscall/zsyscall_netbsd_amd64.go
index e9ee790501..ffb4e059a4 100644
--- a/src/syscall/zsyscall_netbsd_amd64.go
+++ b/src/syscall/zsyscall_netbsd_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -netbsd -tags netbsd,amd64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build netbsd && amd64
// +build netbsd,amd64
package syscall
diff --git a/src/syscall/zsyscall_netbsd_arm.go b/src/syscall/zsyscall_netbsd_arm.go
index 37438b020b..37df77e5e8 100644
--- a/src/syscall/zsyscall_netbsd_arm.go
+++ b/src/syscall/zsyscall_netbsd_arm.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -netbsd -arm -tags netbsd,arm syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm.go
// Code generated by the command above; DO NOT EDIT.
+//go:build netbsd && arm
// +build netbsd,arm
package syscall
diff --git a/src/syscall/zsyscall_netbsd_arm64.go b/src/syscall/zsyscall_netbsd_arm64.go
index 758f398228..c5eb57a226 100644
--- a/src/syscall/zsyscall_netbsd_arm64.go
+++ b/src/syscall/zsyscall_netbsd_arm64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -netbsd -tags netbsd,arm64 syscall_bsd.go syscall_netbsd.go syscall_netbsd_arm64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build netbsd && arm64
// +build netbsd,arm64
package syscall
diff --git a/src/syscall/zsyscall_openbsd_386.go b/src/syscall/zsyscall_openbsd_386.go
index decd169f0d..7d4c4d342a 100644
--- a/src/syscall/zsyscall_openbsd_386.go
+++ b/src/syscall/zsyscall_openbsd_386.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -openbsd -tags openbsd,386 syscall_bsd.go syscall_openbsd.go syscall_openbsd_386.go
// Code generated by the command above; DO NOT EDIT.
+//go:build openbsd && 386
// +build openbsd,386
package syscall
diff --git a/src/syscall/zsyscall_openbsd_amd64.go b/src/syscall/zsyscall_openbsd_amd64.go
index 733050ad1d..b4698b79e2 100644
--- a/src/syscall/zsyscall_openbsd_amd64.go
+++ b/src/syscall/zsyscall_openbsd_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -openbsd -libc -tags openbsd,amd64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_libc.go syscall_openbsd_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build openbsd && amd64
// +build openbsd,amd64
package syscall
diff --git a/src/syscall/zsyscall_openbsd_amd64.s b/src/syscall/zsyscall_openbsd_amd64.s
index e5c5dde930..8256a451f5 100644
--- a/src/syscall/zsyscall_openbsd_amd64.s
+++ b/src/syscall/zsyscall_openbsd_amd64.s
@@ -1,233 +1,233 @@
// go run mkasm.go openbsd amd64
// Code generated by the command above; DO NOT EDIT.
#include "textflag.h"
-TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgroups(SB)
-TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgroups(SB)
-TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_wait4_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_wait4(SB)
-TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_accept_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_accept(SB)
-TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_bind_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_bind(SB)
-TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_connect_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_connect(SB)
-TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socket_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socket(SB)
-TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockopt(SB)
-TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsockopt(SB)
-TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpeername_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpeername(SB)
-TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockname_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockname(SB)
-TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_shutdown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_shutdown(SB)
-TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socketpair_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socketpair(SB)
-TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvfrom_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvfrom(SB)
-TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendto_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendto(SB)
-TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvmsg(SB)
-TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendmsg(SB)
-TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kevent_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kevent(SB)
-TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_utimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_utimes(SB)
-TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_futimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
-TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fcntl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pipe2_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pipe2(SB)
-TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_accept4_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_accept4(SB)
-TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getdents_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getdents(SB)
-TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_access_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_access(SB)
-TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_adjtime_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_adjtime(SB)
-TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chdir(SB)
-TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chflags(SB)
-TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chmod(SB)
-TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chown(SB)
-TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chroot_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chroot(SB)
-TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_close_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_close(SB)
-TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup(SB)
-TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup2_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup2(SB)
-TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchdir(SB)
-TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchflags(SB)
-TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchmod(SB)
-TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchown(SB)
-TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_flock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_flock(SB)
-TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fpathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fpathconf(SB)
-TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstat(SB)
-TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatfs_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatfs(SB)
-TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fsync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fsync(SB)
-TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ftruncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ftruncate(SB)
-TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getegid(SB)
-TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_geteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_geteuid(SB)
-TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgid(SB)
-TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgid(SB)
-TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgrp_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgrp(SB)
-TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpid(SB)
-TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getppid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getppid(SB)
-TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpriority(SB)
-TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrlimit(SB)
-TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrusage_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB)
-TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsid(SB)
-TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_gettimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
-TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getuid(SB)
-TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_issetugid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_issetugid(SB)
-TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kill_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kill(SB)
-TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kqueue_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kqueue(SB)
-TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lchown(SB)
-TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_link_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_link(SB)
-TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_listen_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_listen(SB)
-TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lstat(SB)
-TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkdir(SB)
-TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkfifo_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkfifo(SB)
-TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mknod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mknod(SB)
-TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_nanosleep_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_nanosleep(SB)
-TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_open_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_open(SB)
-TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pathconf(SB)
-TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pread_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pread(SB)
-TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pwrite_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pwrite(SB)
-TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_read_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_read(SB)
-TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_readlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_readlink(SB)
-TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rename_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rename(SB)
-TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_revoke_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_revoke(SB)
-TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rmdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rmdir(SB)
-TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_select_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_select(SB)
-TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setegid(SB)
-TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_seteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_seteuid(SB)
-TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgid(SB)
-TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setlogin_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setlogin(SB)
-TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpgid(SB)
-TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpriority(SB)
-TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setregid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setregid(SB)
-TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setreuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setreuid(SB)
-TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setrlimit(SB)
-TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsid(SB)
-TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_settimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_settimeofday(SB)
-TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setuid(SB)
-TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_stat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_stat(SB)
-TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_statfs_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_statfs(SB)
-TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_symlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_symlink(SB)
-TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sync(SB)
-TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_truncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_truncate(SB)
-TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_umask_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_umask(SB)
-TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlink(SB)
-TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unmount_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unmount(SB)
-TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_write_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_write(SB)
-TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mmap(SB)
-TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munmap(SB)
-TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_utimensat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
-TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_syscall_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_syscall(SB)
-TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lseek_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lseek(SB)
-TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getcwd_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getcwd(SB)
-TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sysctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sysctl(SB)
-TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fork_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fork(SB)
-TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ioctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
-TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_execve_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_execve(SB)
-TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_exit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_exit(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ptrace_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB)
-TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getentropy_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getentropy(SB)
-TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatat(SB)
-TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlinkat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlinkat(SB)
-TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_openat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_openat(SB)
diff --git a/src/syscall/zsyscall_openbsd_arm.go b/src/syscall/zsyscall_openbsd_arm.go
index dce0a540e6..31425b3558 100644
--- a/src/syscall/zsyscall_openbsd_arm.go
+++ b/src/syscall/zsyscall_openbsd_arm.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -openbsd -arm -tags openbsd,arm syscall_bsd.go syscall_openbsd.go syscall_openbsd_arm.go
// Code generated by the command above; DO NOT EDIT.
+//go:build openbsd && arm
// +build openbsd,arm
package syscall
diff --git a/src/syscall/zsyscall_openbsd_arm64.go b/src/syscall/zsyscall_openbsd_arm64.go
index 2093eb74e5..de6db1e3fa 100644
--- a/src/syscall/zsyscall_openbsd_arm64.go
+++ b/src/syscall/zsyscall_openbsd_arm64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -openbsd -libc -tags openbsd,arm64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_libc.go syscall_openbsd_arm64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build openbsd && arm64
// +build openbsd,arm64
package syscall
diff --git a/src/syscall/zsyscall_openbsd_arm64.s b/src/syscall/zsyscall_openbsd_arm64.s
index 37778b1db5..f6e0a8da94 100644
--- a/src/syscall/zsyscall_openbsd_arm64.s
+++ b/src/syscall/zsyscall_openbsd_arm64.s
@@ -1,233 +1,233 @@
// go run mkasm.go openbsd arm64
// Code generated by the command above; DO NOT EDIT.
#include "textflag.h"
-TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgroups(SB)
-TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgroups_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgroups(SB)
-TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_wait4_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_wait4(SB)
-TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_accept_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_accept(SB)
-TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_bind_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_bind(SB)
-TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_connect_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_connect(SB)
-TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socket_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socket(SB)
-TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockopt(SB)
-TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsockopt_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsockopt(SB)
-TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpeername_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpeername(SB)
-TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsockname_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsockname(SB)
-TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_shutdown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_shutdown(SB)
-TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_socketpair_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_socketpair(SB)
-TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvfrom_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvfrom(SB)
-TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendto_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendto(SB)
-TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_recvmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_recvmsg(SB)
-TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sendmsg_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sendmsg(SB)
-TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kevent_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kevent(SB)
-TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_utimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_utimes(SB)
-TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_futimes_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_futimes(SB)
-TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fcntl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fcntl(SB)
-TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pipe2_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pipe2(SB)
-TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_accept4_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_accept4(SB)
-TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getdents_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getdents(SB)
-TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_access_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_access(SB)
-TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_adjtime_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_adjtime(SB)
-TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chdir(SB)
-TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chflags(SB)
-TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chmod(SB)
-TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chown(SB)
-TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_chroot_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_chroot(SB)
-TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_close_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_close(SB)
-TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup(SB)
-TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_dup2_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_dup2(SB)
-TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchdir(SB)
-TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchflags_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchflags(SB)
-TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchmod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchmod(SB)
-TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fchown(SB)
-TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_flock_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_flock(SB)
-TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fpathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fpathconf(SB)
-TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstat(SB)
-TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatfs_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatfs(SB)
-TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fsync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fsync(SB)
-TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ftruncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ftruncate(SB)
-TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getegid(SB)
-TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_geteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_geteuid(SB)
-TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getgid(SB)
-TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgid(SB)
-TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpgrp_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpgrp(SB)
-TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpid(SB)
-TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getppid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getppid(SB)
-TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getpriority(SB)
-TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrlimit(SB)
-TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getrusage_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getrusage(SB)
-TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getsid(SB)
-TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_gettimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_gettimeofday(SB)
-TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getuid(SB)
-TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_issetugid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_issetugid(SB)
-TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kill_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kill(SB)
-TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_kqueue_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_kqueue(SB)
-TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lchown_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lchown(SB)
-TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_link_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_link(SB)
-TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_listen_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_listen(SB)
-TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lstat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lstat(SB)
-TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkdir(SB)
-TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mkfifo_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mkfifo(SB)
-TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mknod_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mknod(SB)
-TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_nanosleep_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_nanosleep(SB)
-TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_open_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_open(SB)
-TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pathconf_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pathconf(SB)
-TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pread_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pread(SB)
-TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_pwrite_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_pwrite(SB)
-TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_read_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_read(SB)
-TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_readlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_readlink(SB)
-TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rename_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rename(SB)
-TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_revoke_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_revoke(SB)
-TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_rmdir_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_rmdir(SB)
-TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_select_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_select(SB)
-TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setegid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setegid(SB)
-TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_seteuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_seteuid(SB)
-TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setgid(SB)
-TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setlogin_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setlogin(SB)
-TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpgid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpgid(SB)
-TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setpriority_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setpriority(SB)
-TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setregid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setregid(SB)
-TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setreuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setreuid(SB)
-TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setrlimit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setrlimit(SB)
-TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setsid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setsid(SB)
-TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_settimeofday_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_settimeofday(SB)
-TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_setuid_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_setuid(SB)
-TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_stat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_stat(SB)
-TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_statfs_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_statfs(SB)
-TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_symlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_symlink(SB)
-TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sync_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sync(SB)
-TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_truncate_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_truncate(SB)
-TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_umask_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_umask(SB)
-TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlink_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlink(SB)
-TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unmount_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unmount(SB)
-TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_write_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_write(SB)
-TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_mmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_mmap(SB)
-TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_munmap_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_munmap(SB)
-TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_utimensat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_utimensat(SB)
-TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_syscall_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_syscall(SB)
-TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_lseek_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_lseek(SB)
-TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getcwd_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getcwd(SB)
-TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_sysctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_sysctl(SB)
-TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fork_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fork(SB)
-TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ioctl_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ioctl(SB)
-TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_execve_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_execve(SB)
-TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_exit_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_exit(SB)
-TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_ptrace_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_ptrace(SB)
-TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_getentropy_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_getentropy(SB)
-TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_fstatat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_fstatat(SB)
-TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_unlinkat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_unlinkat(SB)
-TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0
+TEXT ·libc_openat_trampoline<ABIInternal>(SB),NOSPLIT,$0-0
JMP libc_openat(SB)
diff --git a/src/syscall/zsyscall_openbsd_mips64.go b/src/syscall/zsyscall_openbsd_mips64.go
index ded05686c4..70fd1474fd 100644
--- a/src/syscall/zsyscall_openbsd_mips64.go
+++ b/src/syscall/zsyscall_openbsd_mips64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -openbsd -tags openbsd,mips64 syscall_bsd.go syscall_openbsd.go syscall_openbsd_mips64x.go
// Code generated by the command above; DO NOT EDIT.
+//go:build openbsd && mips64
// +build openbsd,mips64
package syscall
diff --git a/src/syscall/zsyscall_plan9_386.go b/src/syscall/zsyscall_plan9_386.go
index 998c6c555e..8b7727b343 100644
--- a/src/syscall/zsyscall_plan9_386.go
+++ b/src/syscall/zsyscall_plan9_386.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -plan9 -tags plan9,386 syscall_plan9.go
// Code generated by the command above; DO NOT EDIT.
+//go:build plan9 && 386
// +build plan9,386
package syscall
diff --git a/src/syscall/zsyscall_plan9_amd64.go b/src/syscall/zsyscall_plan9_amd64.go
index 02a28294ea..bed9108ea6 100644
--- a/src/syscall/zsyscall_plan9_amd64.go
+++ b/src/syscall/zsyscall_plan9_amd64.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -plan9 -tags plan9,amd64 syscall_plan9.go
// Code generated by the command above; DO NOT EDIT.
+//go:build plan9 && amd64
// +build plan9,amd64
package syscall
diff --git a/src/syscall/zsyscall_plan9_arm.go b/src/syscall/zsyscall_plan9_arm.go
index 449823976d..7bbcf9b4b7 100644
--- a/src/syscall/zsyscall_plan9_arm.go
+++ b/src/syscall/zsyscall_plan9_arm.go
@@ -1,6 +1,7 @@
// mksyscall.pl -l32 -plan9 -tags plan9,arm syscall_plan9.go
// Code generated by the command above; DO NOT EDIT.
+//go:build plan9 && arm
// +build plan9,arm
package syscall
diff --git a/src/syscall/zsyscall_solaris_amd64.go b/src/syscall/zsyscall_solaris_amd64.go
index 446ebfc503..9b37dc0950 100644
--- a/src/syscall/zsyscall_solaris_amd64.go
+++ b/src/syscall/zsyscall_solaris_amd64.go
@@ -1,6 +1,7 @@
// mksyscall_libc.pl -solaris -tags solaris,amd64 syscall_solaris.go syscall_solaris_amd64.go
// Code generated by the command above; DO NOT EDIT.
+//go:build solaris && amd64
// +build solaris,amd64
package syscall
diff --git a/src/syscall/zsyscall_windows.go b/src/syscall/zsyscall_windows.go
index 2166be595b..b08e6ac5c2 100644
--- a/src/syscall/zsyscall_windows.go
+++ b/src/syscall/zsyscall_windows.go
@@ -93,6 +93,7 @@ var (
procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW")
procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot")
procDeleteFileW = modkernel32.NewProc("DeleteFileW")
+ procDeleteProcThreadAttributeList = modkernel32.NewProc("DeleteProcThreadAttributeList")
procDeviceIoControl = modkernel32.NewProc("DeviceIoControl")
procDuplicateHandle = modkernel32.NewProc("DuplicateHandle")
procExitProcess = modkernel32.NewProc("ExitProcess")
@@ -131,6 +132,7 @@ var (
procGetTempPathW = modkernel32.NewProc("GetTempPathW")
procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation")
procGetVersion = modkernel32.NewProc("GetVersion")
+ procInitializeProcThreadAttributeList = modkernel32.NewProc("InitializeProcThreadAttributeList")
procLoadLibraryW = modkernel32.NewProc("LoadLibraryW")
procLocalFree = modkernel32.NewProc("LocalFree")
procMapViewOfFile = modkernel32.NewProc("MapViewOfFile")
@@ -153,6 +155,7 @@ var (
procSetHandleInformation = modkernel32.NewProc("SetHandleInformation")
procTerminateProcess = modkernel32.NewProc("TerminateProcess")
procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile")
+ procUpdateProcThreadAttribute = modkernel32.NewProc("UpdateProcThreadAttribute")
procVirtualLock = modkernel32.NewProc("VirtualLock")
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
@@ -515,7 +518,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr
return
}
-func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) {
+func createIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) {
r0, _, e1 := Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0)
handle = Handle(r0)
if handle == 0 {
@@ -569,6 +572,11 @@ func DeleteFile(path *uint16) (err error) {
return
}
+func deleteProcThreadAttributeList(attrlist *_PROC_THREAD_ATTRIBUTE_LIST) {
+ Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0)
+ return
+}
+
func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) {
r1, _, e1 := Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0)
if r1 == 0 {
@@ -822,7 +830,7 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime,
return
}
-func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) {
+func getQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) {
r1, _, e1 := Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0)
if r1 == 0 {
err = errnoErr(e1)
@@ -897,6 +905,14 @@ func GetVersion() (ver uint32, err error) {
return
}
+func initializeProcThreadAttributeList(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, attrcount uint32, flags uint32, size *uintptr) (err error) {
+ r1, _, e1 := Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func LoadLibrary(libname string) (handle Handle, err error) {
var _p0 *uint16
_p0, err = UTF16PtrFromString(libname)
@@ -954,7 +970,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err
return
}
-func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) {
+func postQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) {
r1, _, e1 := Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0)
if r1 == 0 {
err = errnoErr(e1)
@@ -1099,6 +1115,14 @@ func UnmapViewOfFile(addr uintptr) (err error) {
return
}
+func updateProcThreadAttribute(attrlist *_PROC_THREAD_ATTRIBUTE_LIST, flags uint32, attr uintptr, value uintptr, size uintptr, prevvalue uintptr, returnedsize *uintptr) (err error) {
+ r1, _, e1 := Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0)
+ if r1 == 0 {
+ err = errnoErr(e1)
+ }
+ return
+}
+
func VirtualLock(addr uintptr, length uintptr) (err error) {
r1, _, e1 := Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0)
if r1 == 0 {
diff --git a/src/syscall/zsysnum_darwin_amd64.go b/src/syscall/zsysnum_darwin_amd64.go
index a2331bee8a..f66f7d2715 100644
--- a/src/syscall/zsysnum_darwin_amd64.go
+++ b/src/syscall/zsysnum_darwin_amd64.go
@@ -1,6 +1,7 @@
// mksysnum_darwin.pl /usr/include/sys/syscall.h
// Code generated by the command above; DO NOT EDIT.
+//go:build amd64 && darwin
// +build amd64,darwin
package syscall
diff --git a/src/syscall/zsysnum_darwin_arm64.go b/src/syscall/zsysnum_darwin_arm64.go
index 9548717945..6fa146368a 100644
--- a/src/syscall/zsysnum_darwin_arm64.go
+++ b/src/syscall/zsysnum_darwin_arm64.go
@@ -1,6 +1,7 @@
// mksysnum_darwin.pl /usr/include/sys/syscall.h
// Code generated by the command above; DO NOT EDIT.
+//go:build arm64 && darwin
// +build arm64,darwin
package syscall
diff --git a/src/syscall/zsysnum_dragonfly_amd64.go b/src/syscall/zsysnum_dragonfly_amd64.go
index 9ce11f5899..ae504a5f0c 100644
--- a/src/syscall/zsysnum_dragonfly_amd64.go
+++ b/src/syscall/zsysnum_dragonfly_amd64.go
@@ -1,6 +1,7 @@
// mksysnum_dragonfly.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build amd64 && dragonfly
// +build amd64,dragonfly
package syscall
@@ -301,6 +302,7 @@ const (
SYS_LPATHCONF = 533 // { int lpathconf(char *path, int name); }
SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); }
SYS_VMM_GUEST_SYNC_ADDR = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); }
+ SYS_PIPE2 = 538 // { int pipe2(int *fildes, int flags); }
SYS_UTIMENSAT = 539 // { int utimensat(int fd, const char *path, const struct timespec *ts, int flags); }
SYS_ACCEPT4 = 541 // { int accept4(int s, caddr_t name, int *anamelen, int flags); }
)
diff --git a/src/syscall/zsysnum_freebsd_386.go b/src/syscall/zsysnum_freebsd_386.go
index bb6e9d7ac3..1ed7e3ee8d 100644
--- a/src/syscall/zsysnum_freebsd_386.go
+++ b/src/syscall/zsysnum_freebsd_386.go
@@ -1,6 +1,7 @@
// mksysnum_freebsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build 386 && freebsd
// +build 386,freebsd
package syscall
diff --git a/src/syscall/zsysnum_freebsd_amd64.go b/src/syscall/zsysnum_freebsd_amd64.go
index f5d81abc51..d72dbc944a 100644
--- a/src/syscall/zsysnum_freebsd_amd64.go
+++ b/src/syscall/zsysnum_freebsd_amd64.go
@@ -1,6 +1,7 @@
// mksysnum_freebsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build amd64 && freebsd
// +build amd64,freebsd
package syscall
diff --git a/src/syscall/zsysnum_freebsd_arm.go b/src/syscall/zsysnum_freebsd_arm.go
index 006b49c245..4f4dc4db79 100644
--- a/src/syscall/zsysnum_freebsd_arm.go
+++ b/src/syscall/zsysnum_freebsd_arm.go
@@ -1,6 +1,7 @@
// mksysnum_freebsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build arm && freebsd
// +build arm,freebsd
package syscall
diff --git a/src/syscall/zsysnum_freebsd_arm64.go b/src/syscall/zsysnum_freebsd_arm64.go
index 0ce3d05cf2..ab1a05258e 100644
--- a/src/syscall/zsysnum_freebsd_arm64.go
+++ b/src/syscall/zsysnum_freebsd_arm64.go
@@ -1,6 +1,7 @@
// mksysnum_freebsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build arm64 && freebsd
// +build arm64,freebsd
package syscall
diff --git a/src/syscall/zsysnum_linux_386.go b/src/syscall/zsysnum_linux_386.go
index 6bcd22185e..792f43550e 100644
--- a/src/syscall/zsysnum_linux_386.go
+++ b/src/syscall/zsysnum_linux_386.go
@@ -1,6 +1,7 @@
// mksysnum_linux.pl /usr/include/asm/unistd_32.h
// Code generated by the command above; DO NOT EDIT.
+//go:build 386 && linux
// +build 386,linux
package syscall
diff --git a/src/syscall/zsysnum_linux_amd64.go b/src/syscall/zsysnum_linux_amd64.go
index 70ca68639f..9ea18d6111 100644
--- a/src/syscall/zsysnum_linux_amd64.go
+++ b/src/syscall/zsysnum_linux_amd64.go
@@ -1,6 +1,7 @@
// mksysnum_linux.pl /usr/include/asm/unistd_64.h
// Code generated by the command above; DO NOT EDIT.
+//go:build amd64 && linux
// +build amd64,linux
package syscall
diff --git a/src/syscall/zsysnum_linux_arm.go b/src/syscall/zsysnum_linux_arm.go
index 39ddc6536b..ccae9c15e3 100644
--- a/src/syscall/zsysnum_linux_arm.go
+++ b/src/syscall/zsysnum_linux_arm.go
@@ -1,6 +1,7 @@
// mksysnum_linux.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build arm && linux
// +build arm,linux
package syscall
diff --git a/src/syscall/zsysnum_linux_arm64.go b/src/syscall/zsysnum_linux_arm64.go
index 22a88b4dfe..17c54a2c83 100644
--- a/src/syscall/zsysnum_linux_arm64.go
+++ b/src/syscall/zsysnum_linux_arm64.go
@@ -1,6 +1,7 @@
// mksysnum_linux.pl /usr/include/asm-generic/unistd.h
// Code generated by the command above; DO NOT EDIT.
+//go:build arm64 && linux
// +build arm64,linux
package syscall
diff --git a/src/syscall/zsysnum_linux_ppc64.go b/src/syscall/zsysnum_linux_ppc64.go
index 5882a7c058..a0d37ff1f2 100644
--- a/src/syscall/zsysnum_linux_ppc64.go
+++ b/src/syscall/zsysnum_linux_ppc64.go
@@ -1,6 +1,7 @@
// mksysnum_linux.pl /usr/include/asm/unistd.h
// Code generated by the command above; DO NOT EDIT.
+//go:build ppc64 && linux
// +build ppc64,linux
package syscall
diff --git a/src/syscall/zsysnum_linux_ppc64le.go b/src/syscall/zsysnum_linux_ppc64le.go
index 4fb3f6cd29..f8f82d2043 100644
--- a/src/syscall/zsysnum_linux_ppc64le.go
+++ b/src/syscall/zsysnum_linux_ppc64le.go
@@ -1,6 +1,7 @@
// mksysnum_linux.pl /usr/include/powerpc64le-linux-gnu/asm/unistd.h
// Code generated by the command above; DO NOT EDIT.
+//go:build ppc64le && linux
// +build ppc64le,linux
package syscall
diff --git a/src/syscall/zsysnum_netbsd_386.go b/src/syscall/zsysnum_netbsd_386.go
index 514d1f8cfd..4ff8d80341 100644
--- a/src/syscall/zsysnum_netbsd_386.go
+++ b/src/syscall/zsysnum_netbsd_386.go
@@ -1,6 +1,7 @@
// mksysnum_netbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build 386 && netbsd
// +build 386,netbsd
package syscall
diff --git a/src/syscall/zsysnum_netbsd_amd64.go b/src/syscall/zsysnum_netbsd_amd64.go
index db05c03ecd..929da07604 100644
--- a/src/syscall/zsysnum_netbsd_amd64.go
+++ b/src/syscall/zsysnum_netbsd_amd64.go
@@ -1,6 +1,7 @@
// mksysnum_netbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build amd64 && netbsd
// +build amd64,netbsd
package syscall
diff --git a/src/syscall/zsysnum_netbsd_arm.go b/src/syscall/zsysnum_netbsd_arm.go
index 9a10a4383a..998238518b 100644
--- a/src/syscall/zsysnum_netbsd_arm.go
+++ b/src/syscall/zsysnum_netbsd_arm.go
@@ -1,6 +1,7 @@
// mksysnum_netbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build arm && netbsd
// +build arm,netbsd
package syscall
diff --git a/src/syscall/zsysnum_netbsd_arm64.go b/src/syscall/zsysnum_netbsd_arm64.go
index 31e13bf3b6..b3f5034390 100644
--- a/src/syscall/zsysnum_netbsd_arm64.go
+++ b/src/syscall/zsysnum_netbsd_arm64.go
@@ -1,6 +1,7 @@
// mksysnum_netbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build arm64 && netbsd
// +build arm64,netbsd
package syscall
diff --git a/src/syscall/zsysnum_openbsd_386.go b/src/syscall/zsysnum_openbsd_386.go
index 39b9c78288..b289886d6c 100644
--- a/src/syscall/zsysnum_openbsd_386.go
+++ b/src/syscall/zsysnum_openbsd_386.go
@@ -1,6 +1,7 @@
// mksysnum_openbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build 386 && openbsd
// +build 386,openbsd
package syscall
diff --git a/src/syscall/zsysnum_openbsd_amd64.go b/src/syscall/zsysnum_openbsd_amd64.go
index e176c4e23e..8cf2b68dcd 100644
--- a/src/syscall/zsysnum_openbsd_amd64.go
+++ b/src/syscall/zsysnum_openbsd_amd64.go
@@ -1,6 +1,7 @@
// mksysnum_openbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build amd64 && openbsd
// +build amd64,openbsd
package syscall
diff --git a/src/syscall/zsysnum_openbsd_arm.go b/src/syscall/zsysnum_openbsd_arm.go
index 96bbdb09f5..cc33773a05 100644
--- a/src/syscall/zsysnum_openbsd_arm.go
+++ b/src/syscall/zsysnum_openbsd_arm.go
@@ -1,6 +1,7 @@
// mksysnum_openbsd.pl
// Code generated by the command above; DO NOT EDIT.
+//go:build arm && openbsd
// +build arm,openbsd
package syscall
diff --git a/src/syscall/zsysnum_solaris_amd64.go b/src/syscall/zsysnum_solaris_amd64.go
index be198f899b..23c9c715b5 100644
--- a/src/syscall/zsysnum_solaris_amd64.go
+++ b/src/syscall/zsysnum_solaris_amd64.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build amd64 && solaris
// +build amd64,solaris
package syscall
diff --git a/src/syscall/zsysnum_windows_386.go b/src/syscall/zsysnum_windows_386.go
deleted file mode 100644
index 36bf065d1f..0000000000
--- a/src/syscall/zsysnum_windows_386.go
+++ /dev/null
@@ -1,3 +0,0 @@
-// nothing to see here
-
-package syscall
diff --git a/src/syscall/zsysnum_windows_amd64.go b/src/syscall/zsysnum_windows_amd64.go
deleted file mode 100644
index 36bf065d1f..0000000000
--- a/src/syscall/zsysnum_windows_amd64.go
+++ /dev/null
@@ -1,3 +0,0 @@
-// nothing to see here
-
-package syscall
diff --git a/src/syscall/ztypes_darwin_amd64.go b/src/syscall/ztypes_darwin_amd64.go
index da56f0da22..8feacc47ab 100644
--- a/src/syscall/ztypes_darwin_amd64.go
+++ b/src/syscall/ztypes_darwin_amd64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_darwin.go
+//go:build amd64 && darwin
// +build amd64,darwin
package syscall
diff --git a/src/syscall/ztypes_darwin_arm64.go b/src/syscall/ztypes_darwin_arm64.go
index 82685ff659..8079d22429 100644
--- a/src/syscall/ztypes_darwin_arm64.go
+++ b/src/syscall/ztypes_darwin_arm64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_darwin.go
+//go:build arm64 && darwin
// +build arm64,darwin
package syscall
diff --git a/src/syscall/ztypes_dragonfly_amd64.go b/src/syscall/ztypes_dragonfly_amd64.go
index e9e811f776..a51e0038bb 100644
--- a/src/syscall/ztypes_dragonfly_amd64.go
+++ b/src/syscall/ztypes_dragonfly_amd64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_dragonfly.go
+//go:build amd64 && dragonfly
// +build amd64,dragonfly
package syscall
diff --git a/src/syscall/ztypes_freebsd_386.go b/src/syscall/ztypes_freebsd_386.go
index 27d82dea10..1739726883 100644
--- a/src/syscall/ztypes_freebsd_386.go
+++ b/src/syscall/ztypes_freebsd_386.go
@@ -1,6 +1,7 @@
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types_freebsd.go | go run mkpost.go
+//go:build 386 && freebsd
// +build 386,freebsd
package syscall
diff --git a/src/syscall/ztypes_freebsd_amd64.go b/src/syscall/ztypes_freebsd_amd64.go
index 8abfbb45d6..0457d8e995 100644
--- a/src/syscall/ztypes_freebsd_amd64.go
+++ b/src/syscall/ztypes_freebsd_amd64.go
@@ -1,6 +1,7 @@
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types_freebsd.go | go run mkpost.go
+//go:build amd64 && freebsd
// +build amd64,freebsd
package syscall
diff --git a/src/syscall/ztypes_freebsd_arm.go b/src/syscall/ztypes_freebsd_arm.go
index ff552a6a63..29c8380d89 100644
--- a/src/syscall/ztypes_freebsd_arm.go
+++ b/src/syscall/ztypes_freebsd_arm.go
@@ -1,6 +1,7 @@
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -fsigned-char types_freebsd.go
+//go:build arm && freebsd
// +build arm,freebsd
package syscall
diff --git a/src/syscall/ztypes_freebsd_arm64.go b/src/syscall/ztypes_freebsd_arm64.go
index 6d56fc85cf..6472db0080 100644
--- a/src/syscall/ztypes_freebsd_arm64.go
+++ b/src/syscall/ztypes_freebsd_arm64.go
@@ -1,6 +1,7 @@
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs types_freebsd.go | go run mkpost.go
+//go:build arm64 && freebsd
// +build arm64,freebsd
package syscall
diff --git a/src/syscall/ztypes_linux_386.go b/src/syscall/ztypes_linux_386.go
index 0252620f48..251a0c0b4a 100644
--- a/src/syscall/ztypes_linux_386.go
+++ b/src/syscall/ztypes_linux_386.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_linux.go
+//go:build 386 && linux
// +build 386,linux
package syscall
diff --git a/src/syscall/ztypes_linux_amd64.go b/src/syscall/ztypes_linux_amd64.go
index 1fb0ee566f..34c953fc8b 100644
--- a/src/syscall/ztypes_linux_amd64.go
+++ b/src/syscall/ztypes_linux_amd64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_linux.go
+//go:build amd64 && linux
// +build amd64,linux
package syscall
diff --git a/src/syscall/ztypes_linux_arm.go b/src/syscall/ztypes_linux_arm.go
index a88b577bed..4de656b491 100644
--- a/src/syscall/ztypes_linux_arm.go
+++ b/src/syscall/ztypes_linux_arm.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_linux.go
+//go:build arm && linux
// +build arm,linux
package syscall
diff --git a/src/syscall/ztypes_linux_arm64.go b/src/syscall/ztypes_linux_arm64.go
index f63391cdad..bed9cb0851 100644
--- a/src/syscall/ztypes_linux_arm64.go
+++ b/src/syscall/ztypes_linux_arm64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs -- -fsigned-char types_linux.go
+//go:build arm64 && linux
// +build arm64,linux
package syscall
diff --git a/src/syscall/ztypes_linux_ppc64.go b/src/syscall/ztypes_linux_ppc64.go
index 8b6be21e2e..355533fb27 100644
--- a/src/syscall/ztypes_linux_ppc64.go
+++ b/src/syscall/ztypes_linux_ppc64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_linux.go
+//go:build ppc64 && linux
// +build ppc64,linux
package syscall
diff --git a/src/syscall/ztypes_linux_ppc64le.go b/src/syscall/ztypes_linux_ppc64le.go
index a9c3ee2626..94e12c742c 100644
--- a/src/syscall/ztypes_linux_ppc64le.go
+++ b/src/syscall/ztypes_linux_ppc64le.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_linux.go
+//go:build ppc64le && linux
// +build ppc64le,linux
package syscall
diff --git a/src/syscall/ztypes_netbsd_386.go b/src/syscall/ztypes_netbsd_386.go
index 737abb87c7..321460f45a 100644
--- a/src/syscall/ztypes_netbsd_386.go
+++ b/src/syscall/ztypes_netbsd_386.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_netbsd.go
+//go:build 386 && netbsd
// +build 386,netbsd
package syscall
diff --git a/src/syscall/ztypes_netbsd_amd64.go b/src/syscall/ztypes_netbsd_amd64.go
index cf059f79ff..370d717263 100644
--- a/src/syscall/ztypes_netbsd_amd64.go
+++ b/src/syscall/ztypes_netbsd_amd64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_netbsd.go
+//go:build amd64 && netbsd
// +build amd64,netbsd
package syscall
diff --git a/src/syscall/ztypes_netbsd_arm.go b/src/syscall/ztypes_netbsd_arm.go
index c532b3a7af..557c634533 100644
--- a/src/syscall/ztypes_netbsd_arm.go
+++ b/src/syscall/ztypes_netbsd_arm.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_netbsd.go
+//go:build arm && netbsd
// +build arm,netbsd
package syscall
diff --git a/src/syscall/ztypes_netbsd_arm64.go b/src/syscall/ztypes_netbsd_arm64.go
index 6d7f9edf34..19f3690341 100644
--- a/src/syscall/ztypes_netbsd_arm64.go
+++ b/src/syscall/ztypes_netbsd_arm64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_netbsd.go
+//go:build arm64 && netbsd
// +build arm64,netbsd
package syscall
diff --git a/src/syscall/ztypes_openbsd_386.go b/src/syscall/ztypes_openbsd_386.go
index c2a03ebdd8..222c6c7e46 100644
--- a/src/syscall/ztypes_openbsd_386.go
+++ b/src/syscall/ztypes_openbsd_386.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_openbsd.go
+//go:build 386 && openbsd
// +build 386,openbsd
package syscall
diff --git a/src/syscall/ztypes_openbsd_amd64.go b/src/syscall/ztypes_openbsd_amd64.go
index 1a659ba2fe..644ee9b3df 100644
--- a/src/syscall/ztypes_openbsd_amd64.go
+++ b/src/syscall/ztypes_openbsd_amd64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_openbsd.go
+//go:build amd64 && openbsd
// +build amd64,openbsd
package syscall
diff --git a/src/syscall/ztypes_solaris_amd64.go b/src/syscall/ztypes_solaris_amd64.go
index f846666fff..64e16b4943 100644
--- a/src/syscall/ztypes_solaris_amd64.go
+++ b/src/syscall/ztypes_solaris_amd64.go
@@ -1,6 +1,7 @@
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs types_solaris.go
+//go:build amd64 && solaris
// +build amd64,solaris
package syscall
diff --git a/src/testing/fstest/testfs.go b/src/testing/fstest/testfs.go
index a7f8007333..736bbf0590 100644
--- a/src/testing/fstest/testfs.go
+++ b/src/testing/fstest/testfs.go
@@ -303,7 +303,7 @@ func (t *fsTester) checkGlob(dir string, list []fs.DirEntry) {
for i, e := range elem {
var pattern []rune
for j, r := range e {
- if r == '*' || r == '?' || r == '\\' || r == '[' {
+ if r == '*' || r == '?' || r == '\\' || r == '[' || r == '-' {
pattern = append(pattern, '\\', r)
continue
}
@@ -403,9 +403,10 @@ func (t *fsTester) checkStat(path string, entry fs.DirEntry) {
return
}
fentry := formatEntry(entry)
- finfo := formatInfoEntry(info)
- if fentry != finfo {
- t.errorf("%s: mismatch:\n\tentry = %s\n\tfile.Stat() = %s", path, fentry, finfo)
+ fientry := formatInfoEntry(info)
+ // Note: mismatch here is OK for symlink, because Open dereferences symlink.
+ if fentry != fientry && entry.Type()&fs.ModeSymlink == 0 {
+ t.errorf("%s: mismatch:\n\tentry = %s\n\tfile.Stat() = %s", path, fentry, fientry)
}
einfo, err := entry.Info()
@@ -413,12 +414,22 @@ func (t *fsTester) checkStat(path string, entry fs.DirEntry) {
t.errorf("%s: entry.Info: %v", path, err)
return
}
- fentry = formatInfo(einfo)
- finfo = formatInfo(info)
- if fentry != finfo {
- t.errorf("%s: mismatch:\n\tentry.Info() = %s\n\tfile.Stat() = %s\n", path, fentry, finfo)
+ finfo := formatInfo(info)
+ if entry.Type()&fs.ModeSymlink != 0 {
+ // For symlink, just check that entry.Info matches entry on common fields.
+ // Open deferences symlink, so info itself may differ.
+ feentry := formatInfoEntry(einfo)
+ if fentry != feentry {
+ t.errorf("%s: mismatch\n\tentry = %s\n\tentry.Info() = %s\n", path, fentry, feentry)
+ }
+ } else {
+ feinfo := formatInfo(einfo)
+ if feinfo != finfo {
+ t.errorf("%s: mismatch:\n\tentry.Info() = %s\n\tfile.Stat() = %s\n", path, feinfo, finfo)
+ }
}
+ // Stat should be the same as Open+Stat, even for symlinks.
info2, err := fs.Stat(t.fsys, path)
if err != nil {
t.errorf("%s: fs.Stat: %v", path, err)
diff --git a/src/testing/fstest/testfs_test.go b/src/testing/fstest/testfs_test.go
new file mode 100644
index 0000000000..aefb4b3361
--- /dev/null
+++ b/src/testing/fstest/testfs_test.go
@@ -0,0 +1,40 @@
+// Copyright 2021 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.
+
+package fstest
+
+import (
+ "internal/testenv"
+ "os"
+ "path/filepath"
+ "testing"
+)
+
+func TestSymlink(t *testing.T) {
+ testenv.MustHaveSymlink(t)
+
+ tmp := t.TempDir()
+ tmpfs := os.DirFS(tmp)
+
+ if err := os.WriteFile(filepath.Join(tmp, "hello"), []byte("hello, world\n"), 0644); err != nil {
+ t.Fatal(err)
+ }
+
+ if err := os.Symlink(filepath.Join(tmp, "hello"), filepath.Join(tmp, "hello.link")); err != nil {
+ t.Fatal(err)
+ }
+
+ if err := TestFS(tmpfs, "hello", "hello.link"); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestDash(t *testing.T) {
+ m := MapFS{
+ "a-b/a": {Data: []byte("a-b/a")},
+ }
+ if err := TestFS(m, "a-b/a"); err != nil {
+ t.Error(err)
+ }
+}
diff --git a/src/testing/run_example.go b/src/testing/run_example.go
index 4dc83f7d32..d9e342d495 100644
--- a/src/testing/run_example.go
+++ b/src/testing/run_example.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build !js
// +build !js
// TODO(@musiol, @odeke-em): re-unify this entire file back into
diff --git a/src/testing/run_example_js.go b/src/testing/run_example_js.go
index 1d4164b61f..d914633ba9 100644
--- a/src/testing/run_example_js.go
+++ b/src/testing/run_example_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js
// +build js
package testing
diff --git a/src/testing/sub_test.go b/src/testing/sub_test.go
index 5b226f85ad..6c7d83aac2 100644
--- a/src/testing/sub_test.go
+++ b/src/testing/sub_test.go
@@ -822,7 +822,7 @@ func TestLogAfterComplete(t *T) {
c2 <- fmt.Sprintf("subtest panic with unexpected value %v", p)
return
}
- const want = "Log in goroutine after TestLateLog has completed"
+ const want = "Log in goroutine after TestLateLog has completed: log after test"
if !strings.Contains(s, want) {
c2 <- fmt.Sprintf("subtest panic %q does not contain %q", s, want)
}
diff --git a/src/testing/testing.go b/src/testing/testing.go
index 80354d5ce8..466dd96981 100644
--- a/src/testing/testing.go
+++ b/src/testing/testing.go
@@ -762,7 +762,7 @@ func (c *common) logDepth(s string, depth int) {
return
}
}
- panic("Log in goroutine after " + c.name + " has completed")
+ panic("Log in goroutine after " + c.name + " has completed: " + s)
} else {
if c.chatty != nil {
if c.bench {
diff --git a/src/text/template/exec.go b/src/text/template/exec.go
index 19154fc640..4637b2035f 100644
--- a/src/text/template/exec.go
+++ b/src/text/template/exec.go
@@ -615,7 +615,7 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node,
tField, ok := receiver.Type().FieldByName(fieldName)
if ok {
field := receiver.FieldByIndex(tField.Index)
- if tField.PkgPath != "" { // field is unexported
+ if !tField.IsExported() {
s.errorf("%s is an unexported field of struct type %s", fieldName, typ)
}
// If it's a function, we must call it.
diff --git a/src/time/embed.go b/src/time/embed.go
index cb4fdac4ef..34490c859d 100644
--- a/src/time/embed.go
+++ b/src/time/embed.go
@@ -5,6 +5,7 @@
// This file is used with build tag timetzdata to embed tzdata into
// the binary.
+//go:build timetzdata
// +build timetzdata
package time
diff --git a/src/time/genzabbrs.go b/src/time/genzabbrs.go
index 9825e705d2..9fd2f2b762 100644
--- a/src/time/genzabbrs.go
+++ b/src/time/genzabbrs.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
//
diff --git a/src/time/sys_plan9.go b/src/time/sys_plan9.go
index b7fba0802c..4dc55e44aa 100644
--- a/src/time/sys_plan9.go
+++ b/src/time/sys_plan9.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build plan9
// +build plan9
package time
diff --git a/src/time/sys_unix.go b/src/time/sys_unix.go
index 97b1140bbc..60fc090dc9 100644
--- a/src/time/sys_unix.go
+++ b/src/time/sys_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || darwin || dragonfly || freebsd || (js && wasm) || linux || netbsd || openbsd || solaris
// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris
package time
diff --git a/src/time/tzdata/generate_zipdata.go b/src/time/tzdata/generate_zipdata.go
index 21357fbf1c..64b5b1b22c 100644
--- a/src/time/tzdata/generate_zipdata.go
+++ b/src/time/tzdata/generate_zipdata.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ignore
// +build ignore
// This program generates zipdata.go from $GOROOT/lib/time/zoneinfo.zip.
diff --git a/src/time/zoneinfo.go b/src/time/zoneinfo.go
index c3662297c7..6db9443474 100644
--- a/src/time/zoneinfo.go
+++ b/src/time/zoneinfo.go
@@ -377,8 +377,10 @@ func tzsetOffset(s string) (offset int, rest string, ok bool) {
neg = true
}
+ // The tzdata code permits values up to 24 * 7 here,
+ // although POSIX does not.
var hours int
- hours, s, ok = tzsetNum(s, 0, 24)
+ hours, s, ok = tzsetNum(s, 0, 24*7)
if !ok {
return 0, "", false
}
@@ -487,7 +489,7 @@ func tzsetRule(s string) (rule, string, bool) {
}
offset, s, ok := tzsetOffset(s[1:])
- if !ok || offset < 0 {
+ if !ok {
return rule{}, "", false
}
r.time = offset
diff --git a/src/time/zoneinfo_ios.go b/src/time/zoneinfo_ios.go
index 0f1e9334b5..044691e130 100644
--- a/src/time/zoneinfo_ios.go
+++ b/src/time/zoneinfo_ios.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build ios
// +build ios
package time
diff --git a/src/time/zoneinfo_js.go b/src/time/zoneinfo_js.go
index 2d76a571f2..8245614d2e 100644
--- a/src/time/zoneinfo_js.go
+++ b/src/time/zoneinfo_js.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build js && wasm
// +build js,wasm
package time
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
index 277b68f798..d043e1e9f1 100644
--- a/src/time/zoneinfo_test.go
+++ b/src/time/zoneinfo_test.go
@@ -183,22 +183,50 @@ func TestMalformedTZData(t *testing.T) {
}
}
-func TestLoadLocationFromTZDataSlim(t *testing.T) {
- // A 2020b slim tzdata for Europe/Berlin
- tzData := "TZif2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00TZif2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00<\x00\x00\x00\x04\x00\x00\x00\x12\xff\xff\xff\xffo\xa2a\xf8\xff\xff\xff\xff\x9b\f\x17`\xff\xff\xff\xff\x9b\xd5\xda\xf0\xff\xff\xff\xff\x9cٮ\x90\xff\xff\xff\xff\x9d\xa4\xb5\x90\xff\xff\xff\xff\x9e\xb9\x90\x90\xff\xff\xff\xff\x9f\x84\x97\x90\xff\xff\xff\xff\xc8\tq\x90\xff\xff\xff\xff\xcc\xe7K\x10\xff\xff\xff\xffͩ\x17\x90\xff\xff\xff\xff\u03a2C\x10\xff\xff\xff\xffϒ4\x10\xff\xff\xff\xffЂ%\x10\xff\xff\xff\xff\xd1r\x16\x10\xff\xff\xff\xffѶ\x96\x00\xff\xff\xff\xff\xd2X\xbe\x80\xff\xff\xff\xffҡO\x10\xff\xff\xff\xff\xd3c\x1b\x90\xff\xff\xff\xff\xd4K#\x90\xff\xff\xff\xff\xd59\xd1 \xff\xff\xff\xff\xd5g\xe7\x90\xff\xff\xff\xffըs\x00\xff\xff\xff\xff\xd6)\xb4\x10\xff\xff\xff\xff\xd7,\x1a\x10\xff\xff\xff\xff\xd8\t\x96\x10\xff\xff\xff\xff\xd9\x02\xc1\x90\xff\xff\xff\xff\xd9\xe9x\x10\x00\x00\x00\x00\x13MD\x10\x00\x00\x00\x00\x143\xfa\x90\x00\x00\x00\x00\x15#\xeb\x90\x00\x00\x00\x00\x16\x13ܐ\x00\x00\x00\x00\x17\x03͐\x00\x00\x00\x00\x17\xf3\xbe\x90\x00\x00\x00\x00\x18㯐\x00\x00\x00\x00\x19Ӡ\x90\x00\x00\x00\x00\x1aÑ\x90\x00\x00\x00\x00\x1b\xbc\xbd\x10\x00\x00\x00\x00\x1c\xac\xae\x10\x00\x00\x00\x00\x1d\x9c\x9f\x10\x00\x00\x00\x00\x1e\x8c\x90\x10\x00\x00\x00\x00\x1f|\x81\x10\x00\x00\x00\x00 lr\x10\x00\x00\x00\x00!\\c\x10\x00\x00\x00\x00\"LT\x10\x00\x00\x00\x00#<E\x10\x00\x00\x00\x00$,6\x10\x00\x00\x00\x00%\x1c'\x10\x00\x00\x00\x00&\f\x18\x10\x00\x00\x00\x00'\x05C\x90\x00\x00\x00\x00'\xf54\x90\x00\x00\x00\x00(\xe5%\x90\x00\x00\x00\x00)\xd5\x16\x90\x00\x00\x00\x00*\xc5\a\x90\x00\x00\x00\x00+\xb4\xf8\x90\x00\x00\x00\x00,\xa4\xe9\x90\x00\x00\x00\x00-\x94ڐ\x00\x00\x00\x00.\x84ː\x00\x00\x00\x00/t\xbc\x90\x00\x00\x00\x000d\xad\x90\x00\x00\x00\x001]\xd9\x10\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x03\x01\x02\x01\x02\x01\x03\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x00\x00\f\x88\x00\x00\x00\x00\x1c \x01\x04\x00\x00\x0e\x10\x00\t\x00\x00*0\x01\rLMT\x00CEST\x00CET\x00CEMT\x00\nCET-1CEST,M3.5.0,M10.5.0/3\n"
+var slimTests = []struct {
+ zoneName string
+ tzData string
+ wantName string
+ wantOffset int
+}{
+ {
+ // 2020b slim tzdata for Europe/Berlin.
+ zoneName: "Europe/Berlin",
+ tzData: "TZif2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00TZif2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00<\x00\x00\x00\x04\x00\x00\x00\x12\xff\xff\xff\xffo\xa2a\xf8\xff\xff\xff\xff\x9b\f\x17`\xff\xff\xff\xff\x9b\xd5\xda\xf0\xff\xff\xff\xff\x9cٮ\x90\xff\xff\xff\xff\x9d\xa4\xb5\x90\xff\xff\xff\xff\x9e\xb9\x90\x90\xff\xff\xff\xff\x9f\x84\x97\x90\xff\xff\xff\xff\xc8\tq\x90\xff\xff\xff\xff\xcc\xe7K\x10\xff\xff\xff\xffͩ\x17\x90\xff\xff\xff\xff\u03a2C\x10\xff\xff\xff\xffϒ4\x10\xff\xff\xff\xffЂ%\x10\xff\xff\xff\xff\xd1r\x16\x10\xff\xff\xff\xffѶ\x96\x00\xff\xff\xff\xff\xd2X\xbe\x80\xff\xff\xff\xffҡO\x10\xff\xff\xff\xff\xd3c\x1b\x90\xff\xff\xff\xff\xd4K#\x90\xff\xff\xff\xff\xd59\xd1 \xff\xff\xff\xff\xd5g\xe7\x90\xff\xff\xff\xffըs\x00\xff\xff\xff\xff\xd6)\xb4\x10\xff\xff\xff\xff\xd7,\x1a\x10\xff\xff\xff\xff\xd8\t\x96\x10\xff\xff\xff\xff\xd9\x02\xc1\x90\xff\xff\xff\xff\xd9\xe9x\x10\x00\x00\x00\x00\x13MD\x10\x00\x00\x00\x00\x143\xfa\x90\x00\x00\x00\x00\x15#\xeb\x90\x00\x00\x00\x00\x16\x13ܐ\x00\x00\x00\x00\x17\x03͐\x00\x00\x00\x00\x17\xf3\xbe\x90\x00\x00\x00\x00\x18㯐\x00\x00\x00\x00\x19Ӡ\x90\x00\x00\x00\x00\x1aÑ\x90\x00\x00\x00\x00\x1b\xbc\xbd\x10\x00\x00\x00\x00\x1c\xac\xae\x10\x00\x00\x00\x00\x1d\x9c\x9f\x10\x00\x00\x00\x00\x1e\x8c\x90\x10\x00\x00\x00\x00\x1f|\x81\x10\x00\x00\x00\x00 lr\x10\x00\x00\x00\x00!\\c\x10\x00\x00\x00\x00\"LT\x10\x00\x00\x00\x00#<E\x10\x00\x00\x00\x00$,6\x10\x00\x00\x00\x00%\x1c'\x10\x00\x00\x00\x00&\f\x18\x10\x00\x00\x00\x00'\x05C\x90\x00\x00\x00\x00'\xf54\x90\x00\x00\x00\x00(\xe5%\x90\x00\x00\x00\x00)\xd5\x16\x90\x00\x00\x00\x00*\xc5\a\x90\x00\x00\x00\x00+\xb4\xf8\x90\x00\x00\x00\x00,\xa4\xe9\x90\x00\x00\x00\x00-\x94ڐ\x00\x00\x00\x00.\x84ː\x00\x00\x00\x00/t\xbc\x90\x00\x00\x00\x000d\xad\x90\x00\x00\x00\x001]\xd9\x10\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x03\x01\x02\x01\x02\x01\x03\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x00\x00\f\x88\x00\x00\x00\x00\x1c \x01\x04\x00\x00\x0e\x10\x00\t\x00\x00*0\x01\rLMT\x00CEST\x00CET\x00CEMT\x00\nCET-1CEST,M3.5.0,M10.5.0/3\n",
+ wantName: "CET",
+ wantOffset: 3600,
+ },
+ {
+ // 2021a slim tzdata for America/Nuuk.
+ zoneName: "America/Nuuk",
+ tzData: "TZif3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00TZif3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\"\x00\x00\x00\x03\x00\x00\x00\f\xff\xff\xff\xff\x9b\x80h\x00\x00\x00\x00\x00\x13M|P\x00\x00\x00\x00\x143\xfa\x90\x00\x00\x00\x00\x15#\xeb\x90\x00\x00\x00\x00\x16\x13ܐ\x00\x00\x00\x00\x17\x03͐\x00\x00\x00\x00\x17\xf3\xbe\x90\x00\x00\x00\x00\x18㯐\x00\x00\x00\x00\x19Ӡ\x90\x00\x00\x00\x00\x1aÑ\x90\x00\x00\x00\x00\x1b\xbc\xbd\x10\x00\x00\x00\x00\x1c\xac\xae\x10\x00\x00\x00\x00\x1d\x9c\x9f\x10\x00\x00\x00\x00\x1e\x8c\x90\x10\x00\x00\x00\x00\x1f|\x81\x10\x00\x00\x00\x00 lr\x10\x00\x00\x00\x00!\\c\x10\x00\x00\x00\x00\"LT\x10\x00\x00\x00\x00#<E\x10\x00\x00\x00\x00$,6\x10\x00\x00\x00\x00%\x1c'\x10\x00\x00\x00\x00&\f\x18\x10\x00\x00\x00\x00'\x05C\x90\x00\x00\x00\x00'\xf54\x90\x00\x00\x00\x00(\xe5%\x90\x00\x00\x00\x00)\xd5\x16\x90\x00\x00\x00\x00*\xc5\a\x90\x00\x00\x00\x00+\xb4\xf8\x90\x00\x00\x00\x00,\xa4\xe9\x90\x00\x00\x00\x00-\x94ڐ\x00\x00\x00\x00.\x84ː\x00\x00\x00\x00/t\xbc\x90\x00\x00\x00\x000d\xad\x90\x00\x00\x00\x001]\xd9\x10\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\xff\xffπ\x00\x00\xff\xff\xd5\xd0\x00\x04\xff\xff\xe3\xe0\x01\bLMT\x00-03\x00-02\x00\n<-03>3<-02>,M3.5.0/-2,M10.5.0/-1\n",
+ wantName: "-03",
+ wantOffset: -10800,
+ },
+ {
+ // 2021a slim tzdata for Asia/Gaza.
+ zoneName: "Asia/Gaza",
+ tzData: "TZif3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00TZif3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00s\x00\x00\x00\x05\x00\x00\x00\x15\xff\xff\xff\xff}\xbdJ\xb0\xff\xff\xff\xff\xc8Y\xcf\x00\xff\xff\xff\xff\xc8\xfa\xa6\x00\xff\xff\xff\xff\xc98\x9c\x80\xff\xff\xff\xff\xcc\xe5\xeb\x80\xff\xff\xff\xffͬ\xfe\x00\xff\xff\xff\xff\xce\xc7\x1f\x00\xff\xff\xff\xffϏ\x83\x00\xff\xff\xff\xffЩ\xa4\x00\xff\xff\xff\xffф}\x00\xff\xff\xff\xffҊ׀\xff\xff\xff\xff\xd3e\xb0\x80\xff\xff\xff\xff\xd4l\v\x00\xff\xff\xff\xff\xe86c`\xff\xff\xff\xff\xe8\xf4-P\xff\xff\xff\xff\xea\v\xb9`\xff\xff\xff\xff\xea\xd5`\xd0\xff\xff\xff\xff\xeb\xec\xfa\xf0\xff\xff\xff\xff\xec\xb5m\x00\xff\xff\xff\xff\xed\xcf\u007f\xf0\xff\xff\xff\xff\xee\x97\xf2\x00\xff\xff\xff\xffﰳp\xff\xff\xff\xff\xf0y%\x80\xff\xff\xff\xff\xf1\x91\xe6\xf0\xff\xff\xff\xff\xf2ZY\x00\xff\xff\xff\xff\xf3s\x1ap\xff\xff\xff\xff\xf4;\x8c\x80\xff\xff\xff\xff\xf5U\x9fp\xff\xff\xff\xff\xf6\x1e\x11\x80\xff\xff\xff\xff\xf76\xd2\xf0\xff\xff\xff\xff\xf7\xffE\x00\xff\xff\xff\xff\xf9\x18\x06p\xff\xff\xff\xff\xf9\xe1\xca\x00\xff\xff\xff\xff\xfa\xf99\xf0\xff\xff\xff\xff\xfb'BP\x00\x00\x00\x00\b|\x8b\xe0\x00\x00\x00\x00\b\xfd\xb0\xd0\x00\x00\x00\x00\t\xf6\xea`\x00\x00\x00\x00\n\xa63\xd0\x00\x00\x00\x00\x13\xe9\xfc`\x00\x00\x00\x00\x14![`\x00\x00\x00\x00\x1a\xfa\xc6`\x00\x00\x00\x00\x1b\x8en`\x00\x00\x00\x00\x1c\xbe\xf8\xe0\x00\x00\x00\x00\x1dw|\xd0\x00\x00\x00\x00\x1e\xcc\xff`\x00\x00\x00\x00\x1f`\x99P\x00\x00\x00\x00 \x82\xb1`\x00\x00\x00\x00!I\xb5\xd0\x00\x00\x00\x00\"^\x9e\xe0\x00\x00\x00\x00# ]P\x00\x00\x00\x00$Z0`\x00\x00\x00\x00%\x00?P\x00\x00\x00\x00&\v\xed\xe0\x00\x00\x00\x00&\xd6\xe6\xd0\x00\x00\x00\x00'\xeb\xcf\xe0\x00\x00\x00\x00(\xc0\x03P\x00\x00\x00\x00)\xd4\xec`\x00\x00\x00\x00*\xa9\x1f\xd0\x00\x00\x00\x00+\xbbe\xe0\x00\x00\x00\x00,\x89\x01\xd0\x00\x00\x00\x00-\x9bG\xe0\x00\x00\x00\x00._\xa9P\x00\x00\x00\x00/{)\xe0\x00\x00\x00\x000H\xc5\xd0\x00\x00\x00\x000\xe7\a\xe0\x00\x00\x00\x001dF`\x00\x00\x00\x002A\xc2`\x00\x00\x00\x003D(`\x00\x00\x00\x004!\xa4`\x00\x00\x00\x005$\n`\x00\x00\x00\x006\x01\x86`\x00\x00\x00\x007\x16a`\x00\x00\x00\x008\x06DP\x00\x00\x00\x008\xff}\xe0\x00\x00\x00\x009\xef`\xd0\x00\x00\x00\x00:\xdf_\xe0\x00\x00\x00\x00;\xcfB\xd0\x00\x00\x00\x00<\xbfA\xe0\x00\x00\x00\x00=\xaf$\xd0\x00\x00\x00\x00>\x9f#\xe0\x00\x00\x00\x00?\x8f\x06\xd0\x00\x00\x00\x00@\u007f\x05\xe0\x00\x00\x00\x00A\\\x81\xe0\x00\x00\x00\x00B^\xe7\xe0\x00\x00\x00\x00CA\xb7\xf0\x00\x00\x00\x00D-\xa6`\x00\x00\x00\x00E\x12\xfdP\x00\x00\x00\x00F\x0e\xd9\xe0\x00\x00\x00\x00F\xe8op\x00\x00\x00\x00G\xec\x18\xe0\x00\x00\x00\x00H\xb7\x11\xd0\x00\x00\x00\x00I\xcb\xfa\xe0\x00\x00\x00\x00J\xa0<`\x00\x00\x00\x00K\xad.\x9c\x00\x00\x00\x00La\xbd\xd0\x00\x00\x00\x00M\x94\xf9\x9c\x00\x00\x00\x00N5\xc2P\x00\x00\x00\x00Ot\xdb`\x00\x00\x00\x00P[\x91\xe0\x00\x00\x00\x00QT\xbd`\x00\x00\x00\x00RD\xa0P\x00\x00\x00\x00S4\x9f`\x00\x00\x00\x00TIlP\x00\x00\x00\x00U\x15\xd2\xe0\x00\x00\x00\x00V)\\`\x00\x00\x00\x00V\xf5\xc2\xf0\x00\x00\x00\x00X\x13\xca`\x00\x00\x00\x00Xդ\xf0\x00\x00\x00\x00Y\xf3\xac`\x00\x00\x00\x00Z\xb5\x86\xf0\x00\x00\x00\x00[ӎ`\x00\x00\x00\x00\\\x9dC\xe0\x00\x00\x00\x00]\xb3bP\x00\x00\x00\x00^~w`\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x03\x04\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x00\x00 P\x00\x00\x00\x00*0\x01\x04\x00\x00\x1c \x00\t\x00\x00*0\x01\r\x00\x00\x1c \x00\x11LMT\x00EEST\x00EET\x00IDT\x00IST\x00\nEET-2EEST,M3.4.4/48,M10.4.4/49\n",
+ wantName: "EET",
+ wantOffset: 7200,
+ },
+}
- reference, err := time.LoadLocationFromTZData("Europe/Berlin", []byte(tzData))
- if err != nil {
- t.Fatal(err)
- }
+func TestLoadLocationFromTZDataSlim(t *testing.T) {
+ for _, test := range slimTests {
+ reference, err := time.LoadLocationFromTZData(test.zoneName, []byte(test.tzData))
+ if err != nil {
+ t.Fatal(err)
+ }
- d := time.Date(2020, time.October, 29, 15, 30, 0, 0, reference)
- tzName, tzOffset := d.Zone()
- if want := "CET"; tzName != want {
- t.Errorf("Zone name == %s, want %s", tzName, want)
- }
- if want := 3600; tzOffset != want {
- t.Errorf("Zone offset == %d, want %d", tzOffset, want)
+ d := time.Date(2020, time.October, 29, 15, 30, 0, 0, reference)
+ tzName, tzOffset := d.Zone()
+ if tzName != test.wantName {
+ t.Errorf("Zone name == %s, want %s", tzName, test.wantName)
+ }
+ if tzOffset != test.wantOffset {
+ t.Errorf("Zone offset == %d, want %d", tzOffset, test.wantOffset)
+ }
}
}
@@ -263,7 +291,8 @@ func TestTzsetOffset(t *testing.T) {
{"+08", 8 * 60 * 60, "", true},
{"-01:02:03", -1*60*60 - 2*60 - 3, "", true},
{"01", 1 * 60 * 60, "", true},
- {"100", 0, "", false},
+ {"100", 100 * 60 * 60, "", true},
+ {"1000", 0, "", false},
{"8PDT", 8 * 60 * 60, "PDT", true},
} {
off, out, ok := time.TzsetOffset(test.in)
@@ -288,6 +317,7 @@ func TestTzsetRule(t *testing.T) {
{"30/03:00:00", time.Rule{Kind: time.RuleDOY, Day: 30, Time: 3 * 60 * 60}, "", true},
{"M4.5.6/03:00:00", time.Rule{Kind: time.RuleMonthWeekDay, Mon: 4, Week: 5, Day: 6, Time: 3 * 60 * 60}, "", true},
{"M4.5.7/03:00:00", time.Rule{}, "", false},
+ {"M4.5.6/-04", time.Rule{Kind: time.RuleMonthWeekDay, Mon: 4, Week: 5, Day: 6, Time: -4 * 60 * 60}, "", true},
} {
r, out, ok := time.TzsetRule(test.in)
if r != test.r || out != test.out || ok != test.ok {
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index d2465eef65..4ea029dbde 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || (darwin && !ios) || dragonfly || freebsd || (linux && !android) || netbsd || openbsd || solaris
// +build aix darwin,!ios dragonfly freebsd linux,!android netbsd openbsd solaris
// Parse "zoneinfo" time zone file.
diff --git a/src/time/zoneinfo_unix_test.go b/src/time/zoneinfo_unix_test.go
index f290ae754f..b75b374c3d 100644
--- a/src/time/zoneinfo_unix_test.go
+++ b/src/time/zoneinfo_unix_test.go
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build aix || (darwin && !ios) || dragonfly || freebsd || (linux && !android) || netbsd || openbsd || solaris
// +build aix darwin,!ios dragonfly freebsd linux,!android netbsd openbsd solaris
package time_test
diff --git a/src/unicode/letter.go b/src/unicode/letter.go
index a57566f0a5..268e457a87 100644
--- a/src/unicode/letter.go
+++ b/src/unicode/letter.go
@@ -154,7 +154,8 @@ func is32(ranges []Range32, r uint32) bool {
// Is reports whether the rune is in the specified table of ranges.
func Is(rangeTab *RangeTable, r rune) bool {
r16 := rangeTab.R16
- if len(r16) > 0 && r <= rune(r16[len(r16)-1].Hi) {
+ // Compare as uint32 to correctly handle negative runes.
+ if len(r16) > 0 && uint32(r) <= uint32(r16[len(r16)-1].Hi) {
return is16(r16, uint16(r))
}
r32 := rangeTab.R32
@@ -166,7 +167,8 @@ func Is(rangeTab *RangeTable, r rune) bool {
func isExcludingLatin(rangeTab *RangeTable, r rune) bool {
r16 := rangeTab.R16
- if off := rangeTab.LatinOffset; len(r16) > off && r <= rune(r16[len(r16)-1].Hi) {
+ // Compare as uint32 to correctly handle negative runes.
+ if off := rangeTab.LatinOffset; len(r16) > off && uint32(r) <= uint32(r16[len(r16)-1].Hi) {
return is16(r16[off:], uint16(r))
}
r32 := rangeTab.R32
diff --git a/src/unicode/letter_test.go b/src/unicode/letter_test.go
index 19ee535d57..a91e3a326f 100644
--- a/src/unicode/letter_test.go
+++ b/src/unicode/letter_test.go
@@ -563,3 +563,82 @@ func TestSpecialCaseNoMapping(t *testing.T) {
t.Errorf("got %q; want %q", got, want)
}
}
+
+func TestNegativeRune(t *testing.T) {
+ // Issue 43254
+ // These tests cover negative rune handling by testing values which,
+ // when cast to uint8 or uint16, look like a particular valid rune.
+ // This package has Latin-1-specific optimizations, so we test all of
+ // Latin-1 and representative non-Latin-1 values in the character
+ // categories covered by IsGraphic, etc.
+ nonLatin1 := []uint32{
+ // Lu: LATIN CAPITAL LETTER A WITH MACRON
+ 0x0100,
+ // Ll: LATIN SMALL LETTER A WITH MACRON
+ 0x0101,
+ // Lt: LATIN CAPITAL LETTER D WITH SMALL LETTER Z WITH CARON
+ 0x01C5,
+ // M: COMBINING GRAVE ACCENT
+ 0x0300,
+ // Nd: ARABIC-INDIC DIGIT ZERO
+ 0x0660,
+ // P: GREEK QUESTION MARK
+ 0x037E,
+ // S: MODIFIER LETTER LEFT ARROWHEAD
+ 0x02C2,
+ // Z: OGHAM SPACE MARK
+ 0x1680,
+ }
+ for i := 0; i < MaxLatin1+len(nonLatin1); i++ {
+ base := uint32(i)
+ if i >= MaxLatin1 {
+ base = nonLatin1[i-MaxLatin1]
+ }
+
+ // Note r is negative, but uint8(r) == uint8(base) and
+ // uint16(r) == uint16(base).
+ r := rune(base - 1<<31)
+ if Is(Letter, r) {
+ t.Errorf("Is(Letter, 0x%x - 1<<31) = true, want false", base)
+ }
+ if IsControl(r) {
+ t.Errorf("IsControl(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsDigit(r) {
+ t.Errorf("IsDigit(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsGraphic(r) {
+ t.Errorf("IsGraphic(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsLetter(r) {
+ t.Errorf("IsLetter(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsLower(r) {
+ t.Errorf("IsLower(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsMark(r) {
+ t.Errorf("IsMark(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsNumber(r) {
+ t.Errorf("IsNumber(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsPrint(r) {
+ t.Errorf("IsPrint(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsPunct(r) {
+ t.Errorf("IsPunct(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsSpace(r) {
+ t.Errorf("IsSpace(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsSymbol(r) {
+ t.Errorf("IsSymbol(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsTitle(r) {
+ t.Errorf("IsTitle(0x%x - 1<<31) = true, want false", base)
+ }
+ if IsUpper(r) {
+ t.Errorf("IsUpper(0x%x - 1<<31) = true, want false", base)
+ }
+ }
+}
diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt
index 04bb67e58d..06e6ef1945 100644
--- a/src/vendor/modules.txt
+++ b/src/vendor/modules.txt
@@ -18,7 +18,7 @@ golang.org/x/net/idna
golang.org/x/net/lif
golang.org/x/net/nettest
golang.org/x/net/route
-# golang.org/x/sys v0.0.0-20201204225414-ed752295db88
+# golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e
## explicit
golang.org/x/sys/cpu
# golang.org/x/text v0.3.4
diff --git a/test/abi/f_ret_z_not.go b/test/abi/f_ret_z_not.go
new file mode 100644
index 0000000000..b072aea75e
--- /dev/null
+++ b/test/abi/f_ret_z_not.go
@@ -0,0 +1,33 @@
+// run
+
+// Copyright 2021 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.
+
+package main
+
+import "fmt"
+
+type Z struct {
+}
+
+type NZ struct {
+ x, y int
+}
+
+//go:noinline
+func f(x,y int) (Z,NZ,Z) {
+ var z Z
+ return z,NZ{x,y},z
+}
+
+//go:noinline
+func g() (Z,NZ,Z) {
+ a,b,c := f(3,4)
+ return c,b,a
+}
+
+func main() {
+ _,b,_ := g()
+ fmt.Println(b.x+b.y)
+}
diff --git a/test/abi/f_ret_z_not.out b/test/abi/f_ret_z_not.out
new file mode 100644
index 0000000000..7f8f011eb7
--- /dev/null
+++ b/test/abi/f_ret_z_not.out
@@ -0,0 +1 @@
+7
diff --git a/test/abi/regabipragma.go b/test/abi/regabipragma.go
index 6a1b1938ea..86f42f9779 100644
--- a/test/abi/regabipragma.go
+++ b/test/abi/regabipragma.go
@@ -1,10 +1,12 @@
-// runindir
+// skip
+// runindir -gcflags=-c=1
// +build !windows
// Copyright 2021 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.
-// TODO May delete or adapt this test once regabi is the default
+// TODO(register args) Temporarily disabled now that register abi info is flowing halfway through the compiler.
+// TODO(register args) May delete or adapt this test once regabi is the default
package ignore
diff --git a/test/closure3.go b/test/closure3.go
index 37b548d6dc..452a52720a 100644
--- a/test/closure3.go
+++ b/test/closure3.go
@@ -1,4 +1,4 @@
-// errorcheckandrundir -0 -m
+// errorcheckandrundir -0 -m -d=inlfuncswithclosures=1
// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/codegen/bits.go b/test/codegen/bits.go
index 4508eba487..806dad13c8 100644
--- a/test/codegen/bits.go
+++ b/test/codegen/bits.go
@@ -352,3 +352,12 @@ func cont0Mask64U(x uint64) uint64 {
// s390x:"RISBGZ\t[$]48, [$]15, [$]0,"
return x & 0xffff00000000ffff
}
+
+func issue44228a(a []int64, i int) bool {
+ // amd64: "BTQ", -"SHL"
+ return a[i>>6]&(1<<(i&63)) != 0
+}
+func issue44228b(a []int32, i int) bool {
+ // amd64: "BTL", -"SHL"
+ return a[i>>5]&(1<<(i&31)) != 0
+}
diff --git a/test/codegen/floats.go b/test/codegen/floats.go
index 83b4a358a5..397cbb82f7 100644
--- a/test/codegen/floats.go
+++ b/test/codegen/floats.go
@@ -53,12 +53,12 @@ func DivPow2(f1, f2, f3 float64) (float64, float64, float64) {
}
func indexLoad(b0 []float32, b1 float32, idx int) float32 {
- // arm64:`FMOVS\s\(R[0-9]+\)\(R[0-9]+\),\sF[0-9]+`
+ // arm64:`FMOVS\s\(R[0-9]+\)\(R[0-9]+<<2\),\sF[0-9]+`
return b0[idx] * b1
}
func indexStore(b0 []float64, b1 float64, idx int) {
- // arm64:`FMOVD\sF[0-9]+,\s\(R[0-9]+\)\(R[0-9]+\)`
+ // arm64:`FMOVD\sF[0-9]+,\s\(R[0-9]+\)\(R[0-9]+<<3\)`
b0[idx] = b1
}
diff --git a/test/codegen/math.go b/test/codegen/math.go
index ac8071400e..243ddb0494 100644
--- a/test/codegen/math.go
+++ b/test/codegen/math.go
@@ -55,6 +55,17 @@ func sqrt(x float64) float64 {
return math.Sqrt(x)
}
+func sqrt32(x float32) float32 {
+ // amd64:"SQRTSS"
+ // 386/sse2:"SQRTSS" 386/softfloat:-"SQRTS"
+ // arm64:"FSQRTS"
+ // arm/7:"SQRTF"
+ // mips/hardfloat:"SQRTF" mips/softfloat:-"SQRTF"
+ // mips64/hardfloat:"SQRTF" mips64/softfloat:-"SQRTF"
+ // wasm:"F32Sqrt"
+ return float32(math.Sqrt(float64(x)))
+}
+
// Check that it's using integer registers
func abs(x, y float64) {
// amd64:"BTRQ\t[$]63"
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index 6ad9514557..121f394f29 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -367,6 +367,15 @@ func store_le64_idx(b []byte, idx int) {
binary.LittleEndian.PutUint64(b[idx:], sink64)
}
+func store_le64_load(b []byte, x *[8]byte) {
+ _ = b[8]
+ // amd64:-`MOV[BWL]`
+ // arm64:-`MOV[BWH]`
+ // ppc64le:-`MOV[BWH]`
+ // s390x:-`MOVB`,-`MOV[WH]BR`
+ binary.LittleEndian.PutUint64(b, binary.LittleEndian.Uint64(x[:]))
+}
+
func store_le32(b []byte) {
// amd64:`MOVL\s`
// arm64:`MOVW`,-`MOV[BH]`
diff --git a/test/codegen/memops.go b/test/codegen/memops.go
index a234283146..7f06a574fe 100644
--- a/test/codegen/memops.go
+++ b/test/codegen/memops.go
@@ -177,9 +177,11 @@ func idxFloat32(x, y []float32, i int) {
var t float32
// amd64: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
// 386/sse2: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), X[0-9]+`
+ // arm64: `FMOVS\t\(R[0-9]*\)\(R[0-9]*<<2\), F[0-9]+`
t = x[i+1]
// amd64: `MOVSS\tX[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
// 386/sse2: `MOVSS\tX[0-9]+, 4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\)`
+ // arm64: `FMOVS\tF[0-9]+, \(R[0-9]*\)\(R[0-9]*<<2\)`
y[i+1] = t
// amd64: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), X[0-9]+`
// 386/sse2: `MOVSS\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), X[0-9]+`
@@ -193,9 +195,11 @@ func idxFloat64(x, y []float64, i int) {
var t float64
// amd64: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
// 386/sse2: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), X[0-9]+`
+ // arm64: `FMOVD\t\(R[0-9]*\)\(R[0-9]*<<3\), F[0-9]+`
t = x[i+1]
// amd64: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
// 386/sse2: `MOVSD\tX[0-9]+, 8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\)`
+ // arm64: `FMOVD\tF[0-9]+, \(R[0-9]*\)\(R[0-9]*<<3\)`
y[i+1] = t
// amd64: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), X[0-9]+`
// 386/sse2: `MOVSD\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), X[0-9]+`
diff --git a/test/codegen/structs.go b/test/codegen/structs.go
index 9eddc5b16e..c4bcb55c63 100644
--- a/test/codegen/structs.go
+++ b/test/codegen/structs.go
@@ -18,7 +18,7 @@ type Z1 struct {
}
func Zero1(t *Z1) { // Issue #18370
- // amd64:`XORPS\tX., X`,`MOVUPS\tX., \(.*\)`,`MOVQ\t\$0, 16\(.*\)`
+ // amd64:`MOVUPS\tX[0-9]+, \(.*\)`,`MOVQ\t\$0, 16\(.*\)`
*t = Z1{}
}
@@ -27,7 +27,7 @@ type Z2 struct {
}
func Zero2(t *Z2) {
- // amd64:`XORPS\tX., X`,`MOVUPS\tX., \(.*\)`,`MOVQ\t\$0, 16\(.*\)`
+ // amd64:`MOVUPS\tX[0-9]+, \(.*\)`,`MOVQ\t\$0, 16\(.*\)`
// amd64:`.*runtime[.]gcWriteBarrier.*\(SB\)`
*t = Z2{}
}
diff --git a/test/escape5.go b/test/escape5.go
index 2ed2023cd2..82be2c38e7 100644
--- a/test/escape5.go
+++ b/test/escape5.go
@@ -269,3 +269,14 @@ func f28369(n int) int {
return 1 + f28369(n-1)
}
+
+// Issue 44614: parameters that flow to a heap-allocated result
+// parameter must be recorded as a heap-flow rather than a
+// result-flow.
+
+// N.B., must match "leaking param: p",
+// but *not* "leaking param: p to result r level=0".
+func f(p *int) (r *int) { // ERROR "leaking param: p$" "moved to heap: r"
+ sink4 = &r
+ return p
+}
diff --git a/test/fixedbugs/bug511.dir/a.go b/test/fixedbugs/bug511.dir/a.go
new file mode 100644
index 0000000000..33931a07a8
--- /dev/null
+++ b/test/fixedbugs/bug511.dir/a.go
@@ -0,0 +1,11 @@
+// Copyright 2021 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.
+
+package a
+
+type S struct{}
+
+type A = S
+
+func (A) M() {}
diff --git a/src/syscall/zerrors_windows_386.go b/test/fixedbugs/bug511.dir/b.go
index 8bc5b6b194..f8877d6afd 100644
--- a/src/syscall/zerrors_windows_386.go
+++ b/test/fixedbugs/bug511.dir/b.go
@@ -1,5 +1,11 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2021 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.
-package syscall
+package b
+
+import "./a"
+
+func F() {
+ a.S{}.M()
+}
diff --git a/test/fixedbugs/bug511.go b/test/fixedbugs/bug511.go
new file mode 100644
index 0000000000..edd3a23521
--- /dev/null
+++ b/test/fixedbugs/bug511.go
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2021 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.
+
+// Gccgo mishandled type aliases as receiver types.
+
+package ignored
diff --git a/test/fixedbugs/issue16760.go b/test/fixedbugs/issue16760.go
index d0e08b5ead..a7eede4d10 100644
--- a/test/fixedbugs/issue16760.go
+++ b/test/fixedbugs/issue16760.go
@@ -6,7 +6,7 @@
// Make sure we don't start marshaling (writing to the stack)
// arguments until those arguments are evaluated and known
-// not to unconditinally panic. If they unconditionally panic,
+// not to unconditionally panic. If they unconditionally panic,
// we write some args but never do the call. That messes up
// the logic which decides how big the argout section needs to be.
diff --git a/test/fixedbugs/issue24491a.go b/test/fixedbugs/issue24491a.go
index 8accf8c0a3..d30b65b233 100644
--- a/test/fixedbugs/issue24491a.go
+++ b/test/fixedbugs/issue24491a.go
@@ -48,6 +48,14 @@ func f() int {
return test("return", uintptr(setup()), uintptr(setup()), uintptr(setup()), uintptr(setup()))
}
+type S struct{}
+
+//go:noinline
+//go:uintptrescapes
+func (S) test(s string, p, q uintptr, rest ...uintptr) int {
+ return test(s, p, q, rest...)
+}
+
func main() {
test("normal", uintptr(setup()), uintptr(setup()), uintptr(setup()), uintptr(setup()))
<-done
@@ -60,6 +68,29 @@ func main() {
}()
<-done
+ func() {
+ for {
+ defer test("defer in for loop", uintptr(setup()), uintptr(setup()), uintptr(setup()), uintptr(setup()))
+ break
+ }
+ }()
+
+ <-done
+ func() {
+ s := &S{}
+ defer s.test("method call", uintptr(setup()), uintptr(setup()), uintptr(setup()), uintptr(setup()))
+ }()
+ <-done
+
+ func() {
+ s := &S{}
+ for {
+ defer s.test("defer method loop", uintptr(setup()), uintptr(setup()), uintptr(setup()), uintptr(setup()))
+ break
+ }
+ }()
+ <-done
+
f()
<-done
}
diff --git a/test/fixedbugs/issue31747.go b/test/fixedbugs/issue31747.go
index 420fe30735..319a721337 100644
--- a/test/fixedbugs/issue31747.go
+++ b/test/fixedbugs/issue31747.go
@@ -8,7 +8,7 @@ package p
// numeric literals
const (
- _ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later \(-lang was set to go1.12; check go.mod\)"
+ _ = 1_000 // ERROR "underscores in numeric literals requires go1.13 or later \(-lang was set to go1.12; check go.mod\)|requires go1.13"
_ = 0b111 // ERROR "binary literals requires go1.13 or later"
_ = 0o567 // ERROR "0o/0O-style octal literals requires go1.13 or later"
_ = 0xabc // ok
@@ -29,6 +29,6 @@ const (
// signed shift counts
var (
s int
- _ = 1 << s // ERROR "invalid operation: 1 << s \(signed shift count type int\) requires go1.13 or later"
+ _ = 1 << s // ERROR "invalid operation: 1 << s \(signed shift count type int\) requires go1.13 or later|signed shift count"
_ = 1 >> s // ERROR "signed shift count"
)
diff --git a/test/fixedbugs/issue38698.go b/test/fixedbugs/issue38698.go
new file mode 100644
index 0000000000..819e223791
--- /dev/null
+++ b/test/fixedbugs/issue38698.go
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2021 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.
+
+// This test case caused a panic in the compiler's DWARF gen code.
+
+package p
+
+func ff( /*line :10*/ x string) bool {
+ {
+ var _ /*line :10*/, x int
+ _ = x
+ }
+ return x == ""
+}
+
+
+func h(a string) bool {
+ return ff(a)
+}
+
diff --git a/test/fixedbugs/issue44266.go b/test/fixedbugs/issue44266.go
new file mode 100644
index 0000000000..c683e56075
--- /dev/null
+++ b/test/fixedbugs/issue44266.go
@@ -0,0 +1,23 @@
+// errorcheck
+
+// Copyright 2021 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.
+
+package p
+
+import "io"
+
+type T1 interface {
+ io.Reader
+}
+
+type T2 struct {
+ io.SectionReader
+}
+
+type T3 struct { // ERROR "invalid recursive type T3"
+ T1
+ T2
+ parent T3
+}
diff --git a/test/fixedbugs/issue44325.dir/a.go b/test/fixedbugs/issue44325.dir/a.go
new file mode 100644
index 0000000000..5a22b455b7
--- /dev/null
+++ b/test/fixedbugs/issue44325.dir/a.go
@@ -0,0 +1,13 @@
+// Copyright 2021 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.
+
+package a
+
+func FM() func() {
+ return func() {
+ _ = func() int {
+ return 0
+ }
+ }
+}
diff --git a/test/fixedbugs/issue44325.dir/b.go b/test/fixedbugs/issue44325.dir/b.go
new file mode 100644
index 0000000000..c4d77e311a
--- /dev/null
+++ b/test/fixedbugs/issue44325.dir/b.go
@@ -0,0 +1,13 @@
+// Copyright 2021 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.
+
+package b
+
+import (
+ "./a"
+)
+
+func F() {
+ a.FM()
+}
diff --git a/test/fixedbugs/issue44325.go b/test/fixedbugs/issue44325.go
new file mode 100644
index 0000000000..d406838588
--- /dev/null
+++ b/test/fixedbugs/issue44325.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2021 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.
+
+package ignored
diff --git a/test/fixedbugs/issue44330.dir/a.go b/test/fixedbugs/issue44330.dir/a.go
new file mode 100644
index 0000000000..9d3ab9fe80
--- /dev/null
+++ b/test/fixedbugs/issue44330.dir/a.go
@@ -0,0 +1,21 @@
+// Copyright 2021 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.
+
+package a
+
+type Table struct {
+ ColumnSeparator bool
+ RowSeparator bool
+
+ // ColumnResizer is called on each Draw. Can be used for custom column sizing.
+ ColumnResizer func()
+}
+
+func NewTable() *Table {
+ return &Table{
+ ColumnSeparator: true,
+ RowSeparator: true,
+ ColumnResizer: func() {},
+ }
+}
diff --git a/test/fixedbugs/issue44330.dir/b.go b/test/fixedbugs/issue44330.dir/b.go
new file mode 100644
index 0000000000..1d5742421b
--- /dev/null
+++ b/test/fixedbugs/issue44330.dir/b.go
@@ -0,0 +1,23 @@
+// Copyright 2021 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.
+
+package main
+
+import (
+ "./a"
+)
+
+type Term struct {
+ top *a.Table
+}
+
+//go:noinline
+func NewFred() *Term {
+ table := a.NewTable()
+ return &Term{top: table}
+}
+
+func main() {
+ NewFred()
+}
diff --git a/test/fixedbugs/issue44330.go b/test/fixedbugs/issue44330.go
new file mode 100644
index 0000000000..682d9c5bf3
--- /dev/null
+++ b/test/fixedbugs/issue44330.go
@@ -0,0 +1,7 @@
+// rundir
+
+// Copyright 2021 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.
+
+package ignored
diff --git a/test/fixedbugs/issue44335.dir/a.go b/test/fixedbugs/issue44335.dir/a.go
new file mode 100644
index 0000000000..2c9c217813
--- /dev/null
+++ b/test/fixedbugs/issue44335.dir/a.go
@@ -0,0 +1,17 @@
+// Copyright 2021 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
+
+package a
+
+type W struct {
+ M func(string) string
+}
+
+func FM(m string) func(W) {
+ return func(pw W) {
+ pw.M = func(string) string {
+ return m
+ }
+ }
+}
diff --git a/test/fixedbugs/issue44335.dir/b.go b/test/fixedbugs/issue44335.dir/b.go
new file mode 100644
index 0000000000..e72c2abc6a
--- /dev/null
+++ b/test/fixedbugs/issue44335.dir/b.go
@@ -0,0 +1,11 @@
+// Copyright 2021 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.
+
+package b
+
+import "./a"
+
+func F() {
+ a.FM("")
+}
diff --git a/test/fixedbugs/issue44335.go b/test/fixedbugs/issue44335.go
new file mode 100644
index 0000000000..d406838588
--- /dev/null
+++ b/test/fixedbugs/issue44335.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2021 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.
+
+package ignored
diff --git a/test/fixedbugs/issue44344.go b/test/fixedbugs/issue44344.go
new file mode 100644
index 0000000000..06c4cb6cb8
--- /dev/null
+++ b/test/fixedbugs/issue44344.go
@@ -0,0 +1,30 @@
+// compile
+
+// Copyright 2021 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.
+
+// Issue #44344: a crash in DWARF scope generation (trying to
+// scope the PCs of a function that was inlined away).
+
+package main
+
+func main() {
+ pv := []int{3, 4, 5}
+ if pv[1] != 9 {
+ pv = append(pv, 9)
+ }
+ tryit := func() bool {
+ lpv := len(pv)
+ if lpv == 101 {
+ return false
+ }
+ if worst := pv[pv[1]&1]; worst != 101 {
+ return true
+ }
+ return false
+ }()
+ if tryit {
+ println(pv[0])
+ }
+}
diff --git a/test/fixedbugs/issue44355.dir/a.go b/test/fixedbugs/issue44355.dir/a.go
new file mode 100644
index 0000000000..0f63c6fd98
--- /dev/null
+++ b/test/fixedbugs/issue44355.dir/a.go
@@ -0,0 +1,7 @@
+// Copyright 2021 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.
+
+package a
+
+func F() (_ *int) { return nil }
diff --git a/test/fixedbugs/issue44355.dir/b.go b/test/fixedbugs/issue44355.dir/b.go
new file mode 100644
index 0000000000..09d5bde887
--- /dev/null
+++ b/test/fixedbugs/issue44355.dir/b.go
@@ -0,0 +1,9 @@
+// Copyright 2021 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.
+
+package b
+
+import "./a"
+
+var _ = a.F()
diff --git a/test/fixedbugs/issue44355.go b/test/fixedbugs/issue44355.go
new file mode 100644
index 0000000000..d406838588
--- /dev/null
+++ b/test/fixedbugs/issue44355.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2021 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.
+
+package ignored
diff --git a/test/fixedbugs/issue44370.dir/a.go b/test/fixedbugs/issue44370.dir/a.go
new file mode 100644
index 0000000000..c5bf1bcbc7
--- /dev/null
+++ b/test/fixedbugs/issue44370.dir/a.go
@@ -0,0 +1,20 @@
+// Copyright 2021 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.
+
+package a
+
+// A StoppableWaitGroup waits for a collection of goroutines to finish.
+type StoppableWaitGroup struct {
+ // i is the internal counter which can store tolerate negative values
+ // as opposed the golang's library WaitGroup.
+ i *int64
+}
+
+// NewStoppableWaitGroup returns a new StoppableWaitGroup. When the 'Stop' is
+// executed, following 'Add()' calls won't have any effect.
+func NewStoppableWaitGroup() *StoppableWaitGroup {
+ return &StoppableWaitGroup{
+ i: func() *int64 { i := int64(0); return &i }(),
+ }
+}
diff --git a/test/fixedbugs/issue44370.dir/b.go b/test/fixedbugs/issue44370.dir/b.go
new file mode 100644
index 0000000000..f0e0b4e55f
--- /dev/null
+++ b/test/fixedbugs/issue44370.dir/b.go
@@ -0,0 +1,11 @@
+// Copyright 2021 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.
+
+package b
+
+import "./a"
+
+func JoinClusterServices() {
+ _ = a.NewStoppableWaitGroup()
+}
diff --git a/test/fixedbugs/issue44370.go b/test/fixedbugs/issue44370.go
new file mode 100644
index 0000000000..d406838588
--- /dev/null
+++ b/test/fixedbugs/issue44370.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2021 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.
+
+package ignored
diff --git a/test/fixedbugs/issue44378.go b/test/fixedbugs/issue44378.go
new file mode 100644
index 0000000000..58c88d573f
--- /dev/null
+++ b/test/fixedbugs/issue44378.go
@@ -0,0 +1,40 @@
+// compile
+
+// Copyright 2021 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.
+
+// This test case caused a panic in the compiler's DWARF gen code.
+
+// Note to future maintainers of this code:
+//
+// ** Do NOT run gofmt when editing this file **
+//
+// In order for the buggy behavior to be triggered in the compiler,
+// we need to have a the function of interest all on one gigantic line.
+
+package a
+
+type O interface{}
+type IO int
+type OS int
+
+type A struct {
+ x int
+}
+
+// original versions of the two function
+func (p *A) UO(o O) {
+ p.r(o, o)
+}
+func (p *A) r(o1, o2 O) {
+ switch x := o1.(type) {
+ case *IO:
+ p.x = int(*x)
+ case *OS:
+ p.x = int(*x + 2)
+ }
+}
+
+// see note above about the importance of all this code winding up on one line.
+var myverylongname0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 int ; func (p *A) UO2(o O) { p.r2(o, o); }; func (p *A) r2(o1, o2 O) { switch x := o1.(type) { case *IO: p.x = int(*x); case *OS: p.x = int(*x + 2); } }
diff --git a/test/fixedbugs/issue44465.go b/test/fixedbugs/issue44465.go
new file mode 100644
index 0000000000..8cb62adaac
--- /dev/null
+++ b/test/fixedbugs/issue44465.go
@@ -0,0 +1,21 @@
+// compile -d=ssa/check/seed
+
+// Copyright 2021 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.
+
+// This code caused an internal consistency error due to a bad shortcircuit optimization.
+
+package p
+
+func f() {
+ var b bool
+ if b {
+ b = true
+ }
+l:
+ for !b {
+ b = true
+ goto l
+ }
+}
diff --git a/test/inline.go b/test/inline.go
index 37965c0d9d..bc23768d01 100644
--- a/test/inline.go
+++ b/test/inline.go
@@ -1,4 +1,4 @@
-// errorcheck -0 -m
+// errorcheck -0 -m -d=inlfuncswithclosures=1
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -262,3 +262,31 @@ func gd2() int { // ERROR "can inline gd2"
func gd3() func() { // ERROR "can inline gd3"
return ii
}
+
+// Issue #42788 - ensure ODEREF OCONVNOP* OADDR is low cost.
+func EncodeQuad(d []uint32, x [6]float32) { // ERROR "can inline EncodeQuad" "d does not escape"
+ _ = d[:6]
+ d[0] = float32bits(x[0]) // ERROR "inlining call to float32bits"
+ d[1] = float32bits(x[1]) // ERROR "inlining call to float32bits"
+ d[2] = float32bits(x[2]) // ERROR "inlining call to float32bits"
+ d[3] = float32bits(x[3]) // ERROR "inlining call to float32bits"
+ d[4] = float32bits(x[4]) // ERROR "inlining call to float32bits"
+ d[5] = float32bits(x[5]) // ERROR "inlining call to float32bits"
+}
+
+// float32bits is a copy of math.Float32bits to ensure that
+// these tests pass with `-gcflags=-l`.
+func float32bits(f float32) uint32 { // ERROR "can inline float32bits"
+ return *(*uint32)(unsafe.Pointer(&f))
+}
+
+// Ensure OCONVNOP is zero cost.
+func Conv(v uint64) uint64 { // ERROR "can inline Conv"
+ return conv2(conv2(conv2(v))) // ERROR "inlining call to (conv1|conv2)"
+}
+func conv2(v uint64) uint64 { // ERROR "can inline conv2"
+ return conv1(conv1(conv1(conv1(v)))) // ERROR "inlining call to conv1"
+}
+func conv1(v uint64) uint64 { // ERROR "can inline conv1"
+ return uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(uint64(v)))))))))))
+}
diff --git a/test/nilptr.go b/test/nilptr.go
index c9a044dd36..b296c88c99 100644
--- a/test/nilptr.go
+++ b/test/nilptr.go
@@ -9,7 +9,8 @@
// +build !aix
// +build !darwin !arm64
-// Address space starts at 1<<32 on AIX and on darwin/arm64, so dummy is too far.
+// +build !windows !arm64
+// Address space starts at 1<<32 on AIX and on darwin/arm64 and on windows/arm64, so dummy is too far.
package main
diff --git a/test/prove.go b/test/prove.go
index d37021d283..83b0380838 100644
--- a/test/prove.go
+++ b/test/prove.go
@@ -629,6 +629,22 @@ func trans3(a, b []int, i int) {
_ = b[i] // ERROR "Proved IsInBounds$"
}
+func trans4(b []byte, x int) {
+ // Issue #42603: slice len/cap transitive relations.
+ switch x {
+ case 0:
+ if len(b) < 20 {
+ return
+ }
+ _ = b[:2] // ERROR "Proved IsSliceInBounds$"
+ case 1:
+ if len(b) < 40 {
+ return
+ }
+ _ = b[:2] // ERROR "Proved IsSliceInBounds$"
+ }
+}
+
// Derived from nat.cmp
func natcmp(x, y []uint) (r int) {
m := len(x)
@@ -997,7 +1013,7 @@ func sh64noopt(n int64) int64 {
// opt, an earlier pass, has already replaced it.
// The fix for this issue allows prove to zero a right shift that was added as
// part of the less-than-optimal reqwrite. That change by prove then allows
-// lateopt to clean up all the unneccesary parts of the original division
+// lateopt to clean up all the unnecessary parts of the original division
// replacement. See issue #36159.
func divShiftClean(n int) int {
if n < 0 {
diff --git a/test/reflectmethod7.go b/test/reflectmethod7.go
new file mode 100644
index 0000000000..42429978b4
--- /dev/null
+++ b/test/reflectmethod7.go
@@ -0,0 +1,24 @@
+// run
+
+// Copyright 2021 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.
+
+// See issue 44207.
+
+package main
+
+import "reflect"
+
+type S int
+
+func (s S) M() {}
+
+func main() {
+ t := reflect.TypeOf(S(0))
+ fn, ok := reflect.PtrTo(t).MethodByName("M")
+ if !ok {
+ panic("FAIL")
+ }
+ fn.Func.Call([]reflect.Value{reflect.New(t)})
+}
diff --git a/test/run.go b/test/run.go
index bae51c18f1..5761f8ac9f 100644
--- a/test/run.go
+++ b/test/run.go
@@ -864,7 +864,7 @@ func (t *test) run() {
// up and running against the existing test cases. The explicitly
// listed files don't pass yet, usually because the error messages
// are slightly different (this list is not complete). Any errorcheck
- // tests that require output from analysis phases past intial type-
+ // tests that require output from analysis phases past initial type-
// checking are also excluded since these phases are not running yet.
// We can get rid of this code once types2 is fully plugged in.
@@ -1068,6 +1068,7 @@ func (t *test) run() {
if *linkshared {
cmd = append(cmd, "-linkshared")
}
+ cmd = append(cmd, flags...)
cmd = append(cmd, ".")
out, err := runcmd(cmd...)
if err != nil {
@@ -2070,9 +2071,7 @@ var excluded = map[string]bool{
"fixedbugs/issue25958.go": true, // types2 doesn't report a follow-on error (pref: types2)
"fixedbugs/issue28079b.go": true, // types2 reports follow-on errors
"fixedbugs/issue28268.go": true, // types2 reports follow-on errors
- "fixedbugs/issue31747.go": true, // types2 is missing support for -lang flag
"fixedbugs/issue33460.go": true, // types2 reports alternative positions in separate error
- "fixedbugs/issue34329.go": true, // types2 is missing support for -lang flag
"fixedbugs/issue41575.go": true, // types2 reports alternative positions in separate error
"fixedbugs/issue42058a.go": true, // types2 doesn't report "channel element type too large"
"fixedbugs/issue42058b.go": true, // types2 doesn't report "channel element type too large"
@@ -2085,5 +2084,4 @@ var excluded = map[string]bool{
"fixedbugs/issue7525c.go": true, // types2 reports init cycle error on different line - ok otherwise
"fixedbugs/issue7525d.go": true, // types2 reports init cycle error on different line - ok otherwise
"fixedbugs/issue7525e.go": true, // types2 reports init cycle error on different line - ok otherwise
- "fixedbugs/issue7746.go": true, // types2 reports overflow on a different line
}
diff --git a/test/typeparam/combine.go b/test/typeparam/combine.go
new file mode 100644
index 0000000000..d4a2988a7b
--- /dev/null
+++ b/test/typeparam/combine.go
@@ -0,0 +1,65 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+type _Gen[A any] func() (A, bool)
+
+func combine[T1, T2, T any](g1 _Gen[T1], g2 _Gen[T2], join func(T1, T2) T) _Gen[T] {
+ return func() (T, bool) {
+ var t T
+ t1, ok := g1()
+ if !ok {
+ return t, false
+ }
+ t2, ok := g2()
+ if !ok {
+ return t, false
+ }
+ return join(t1, t2), true
+ }
+}
+
+type _Pair[A, B any] struct {
+ A A
+ B B
+}
+
+func _NewPair[A, B any](a A, b B) _Pair[A, B] {
+ return _Pair[A, B]{a, b}
+}
+
+func _Combine2[A, B any](ga _Gen[A], gb _Gen[B]) _Gen[_Pair[A, B]] {
+ return combine(ga, gb, _NewPair[A, B])
+}
+
+func main() {
+ var g1 _Gen[int] = func() (int, bool) { return 3, true }
+ var g2 _Gen[string] = func() (string, bool) { return "x", false }
+ var g3 _Gen[string] = func() (string, bool) { return "y", true }
+
+ gc := combine(g1, g2, _NewPair[int, string])
+ if got, ok := gc(); ok {
+ panic(fmt.Sprintf("got %v, %v, wanted -/false", got, ok))
+ }
+ gc2 := _Combine2(g1, g2)
+ if got, ok := gc2(); ok {
+ panic(fmt.Sprintf("got %v, %v, wanted -/false", got, ok))
+ }
+
+ gc3 := combine(g1, g3, _NewPair[int, string])
+ if got, ok := gc3(); !ok || got.A != 3 || got.B != "y" {
+ panic(fmt.Sprintf("got %v, %v, wanted {3, y}, true", got, ok))
+ }
+ gc4 := _Combine2(g1, g3)
+ if got, ok := gc4(); !ok || got.A != 3 || got.B != "y" {
+ panic (fmt.Sprintf("got %v, %v, wanted {3, y}, true", got, ok))
+ }
+}
diff --git a/test/typeparam/fact.go b/test/typeparam/fact.go
new file mode 100644
index 0000000000..16b2adf6fb
--- /dev/null
+++ b/test/typeparam/fact.go
@@ -0,0 +1,32 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import "fmt"
+
+func fact[T interface { type int, int64, float64 }](n T) T {
+ if n == T(1) {
+ return T(1)
+ }
+ return n * fact(n - T(1))
+}
+
+func main() {
+ const want = 120
+
+ if got := fact(5); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ if got := fact[int64](5); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ if got := fact(5.0); got != want {
+ panic(fmt.Sprintf("got %f, want %f", got, want))
+ }
+}
diff --git a/test/typeparam/index.go b/test/typeparam/index.go
new file mode 100644
index 0000000000..83e65acdd0
--- /dev/null
+++ b/test/typeparam/index.go
@@ -0,0 +1,46 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+// Index returns the index of x in s, or -1 if not found.
+func index[T comparable](s []T, x T) int {
+ for i, v := range s {
+ // v and x are type T, which has the comparable
+ // constraint, so we can use == here.
+ if v == x {
+ return i
+ }
+ }
+ return -1
+}
+
+type obj struct {
+ x int
+}
+
+func main() {
+ want := 2
+
+ vec1 := []string{"ab", "cd", "ef"}
+ if got := index(vec1, "ef"); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ vec2 := []byte{'c', '6', '@'}
+ if got := index(vec2, '@'); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ vec3 := []*obj{&obj{2}, &obj{42}, &obj{1}}
+ if got := index(vec3, vec3[2]); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+}
diff --git a/test/typeparam/list.go b/test/typeparam/list.go
new file mode 100644
index 0000000000..64230060de
--- /dev/null
+++ b/test/typeparam/list.go
@@ -0,0 +1,65 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+type Ordered interface {
+ type int, int8, int16, int32, int64,
+ uint, uint8, uint16, uint32, uint64, uintptr,
+ float32, float64,
+ string
+}
+
+// List is a linked list of ordered values of type T.
+type list[T Ordered] struct {
+ next *list[T]
+ val T
+}
+
+func (l *list[T]) largest() T {
+ var max T
+ for p := l; p != nil; p = p.next {
+ if p.val > max {
+ max = p.val
+ }
+ }
+ return max
+}
+
+
+func main() {
+ i3 := &list[int]{nil, 1}
+ i2 := &list[int]{i3, 3}
+ i1 := &list[int]{i2, 2}
+ if got, want := i1.largest(), 3; got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ b3 := &list[byte]{nil, byte(1)}
+ b2 := &list[byte]{b3, byte(3)}
+ b1 := &list[byte]{b2, byte(2)}
+ if got, want := b1.largest(), byte(3); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ f3 := &list[float64]{nil, 13.5}
+ f2 := &list[float64]{f3, 1.2}
+ f1 := &list[float64]{f2, 4.5}
+ if got, want := f1.largest(), 13.5; got != want {
+ panic(fmt.Sprintf("got %f, want %f", got, want))
+ }
+
+ s3 := &list[string]{nil, "dd"}
+ s2 := &list[string]{s3, "aa"}
+ s1 := &list[string]{s2, "bb"}
+ if got, want := s1.largest(), "dd"; got != want {
+ panic(fmt.Sprintf("got %s, want %s", got, want))
+ }
+}
diff --git a/test/typeparam/map.go b/test/typeparam/map.go
new file mode 100644
index 0000000000..72d05f0872
--- /dev/null
+++ b/test/typeparam/map.go
@@ -0,0 +1,39 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+ "reflect"
+ "strconv"
+)
+
+// Map calls the function f on every element of the slice s,
+// returning a new slice of the results.
+func mapper[F, T any](s []F, f func(F) T) []T {
+ r := make([]T, len(s))
+ for i, v := range s {
+ r[i] = f(v)
+ }
+ return r
+}
+
+func main() {
+ got := mapper([]int{1, 2, 3}, strconv.Itoa)
+ want := []string{"1", "2", "3"}
+ if !reflect.DeepEqual(got, want) {
+ panic(fmt.Sprintf("got %s, want %s", got, want))
+ }
+
+ fgot := mapper([]float64{2.5, 2.3, 3.5}, func(f float64) string {
+ return strconv.FormatFloat(f, 'f', -1, 64)
+ })
+ fwant := []string{"2.5", "2.3", "3.5"}
+ if !reflect.DeepEqual(fgot, fwant) {
+ panic(fmt.Sprintf("got %s, want %s", fgot, fwant))
+ }
+}
diff --git a/test/typeparam/min.go b/test/typeparam/min.go
new file mode 100644
index 0000000000..a3e4464a30
--- /dev/null
+++ b/test/typeparam/min.go
@@ -0,0 +1,41 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+type Ordered interface {
+ type int, int64, float64
+}
+
+func min[T Ordered](x, y T) T {
+ if x < y {
+ return x
+ }
+ return y
+}
+
+func main() {
+ const want = 2
+ if got := min[int](2, 3); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ if got := min(2, 3); got != want {
+ panic(fmt.Sprintf("want %d, got %d", want, got))
+ }
+
+ if got := min[float64](3.5, 2.0); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ if got := min(3.5, 2.0); got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+}
diff --git a/test/typeparam/pair.go b/test/typeparam/pair.go
new file mode 100644
index 0000000000..7faf083c89
--- /dev/null
+++ b/test/typeparam/pair.go
@@ -0,0 +1,32 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+type pair[F1, F2 any] struct {
+ f1 F1
+ f2 F2
+}
+
+func main() {
+ p := pair[int32, int64]{1, 2}
+ if got, want := unsafe.Sizeof(p.f1), uintptr(4); got != want {
+ panic(fmt.Sprintf("unexpected f1 size == %d, want %d", got, want))
+ }
+ if got, want := unsafe.Sizeof(p.f2), uintptr(8); got != want {
+ panic(fmt.Sprintf("unexpected f2 size == %d, want %d", got, want))
+ }
+ type mypair struct { f1 int32; f2 int64 }
+ mp := mypair(p)
+ if mp.f1 != 1 || mp.f2 != 2 {
+ panic(fmt.Sprintf("mp == %#v, want %#v", mp, mypair{1, 2}))
+ }
+}
diff --git a/test/typeparam/settable.go b/test/typeparam/settable.go
new file mode 100644
index 0000000000..7532953a77
--- /dev/null
+++ b/test/typeparam/settable.go
@@ -0,0 +1,59 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+ "strconv"
+)
+
+type Setter[B any] interface {
+ Set(string)
+ type *B
+}
+
+func fromStrings1[T any, PT Setter[T]](s []string) []T {
+ result := make([]T, len(s))
+ for i, v := range s {
+ // The type of &result[i] is *T which is in the type list
+ // of Setter, so we can convert it to PT.
+ p := PT(&result[i])
+ // PT has a Set method.
+ p.Set(v)
+ }
+ return result
+}
+
+func fromStrings2[T any](s []string, set func(*T, string)) []T {
+ results := make([]T, len(s))
+ for i, v := range s {
+ set(&results[i], v)
+ }
+ return results
+}
+
+type Settable int
+
+func (p *Settable) Set(s string) {
+ i, err := strconv.Atoi(s)
+ if err != nil {
+ panic(err)
+ }
+ *p = Settable(i)
+}
+
+func main() {
+ s := fromStrings1[Settable, *Settable]([]string{"1"})
+ if len(s) != 1 || s[0] != 1 {
+ panic(fmt.Sprintf("got %v, want %v", s, []int{1}))
+ }
+
+ s = fromStrings2([]string{"1"}, func(p *Settable, s string) { p.Set(s) })
+ if len(s) != 1 || s[0] != 1 {
+ panic(fmt.Sprintf("got %v, want %v", s, []int{1}))
+ }
+}
diff --git a/test/typeparam/smallest.go b/test/typeparam/smallest.go
new file mode 100644
index 0000000000..63dd9ddb70
--- /dev/null
+++ b/test/typeparam/smallest.go
@@ -0,0 +1,42 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+type Ordered interface {
+ type int, int8, int16, int32, int64,
+ uint, uint8, uint16, uint32, uint64, uintptr,
+ float32, float64,
+ string
+}
+
+func smallest[T Ordered](s []T) T {
+ r := s[0] // panics if slice is empty
+ for _, v := range s[1:] {
+ if v < r {
+ r = v
+ }
+ }
+ return r
+}
+
+func main() {
+ vec1 := []float64{5.3, 1.2, 32.8}
+ vec2 := []string{"abc", "def", "aaa"}
+
+ want1 := 1.2
+ if got := smallest(vec1); got != want1 {
+ panic(fmt.Sprintf("got %d, want %d", got, want1))
+ }
+ want2 := "aaa"
+ if got := smallest(vec2); got != want2 {
+ panic(fmt.Sprintf("got %d, want %d", got, want2))
+ }
+}
diff --git a/test/typeparam/stringable.go b/test/typeparam/stringable.go
new file mode 100644
index 0000000000..9340a3b10a
--- /dev/null
+++ b/test/typeparam/stringable.go
@@ -0,0 +1,46 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+ "strconv"
+ "strings"
+)
+
+type Stringer interface {
+ String() string
+}
+
+// stringableList is a slice of some type, where the type
+// must have a String method.
+type stringableList[T Stringer] []T
+
+func (s stringableList[T]) String() string {
+ var sb strings.Builder
+ for i, v := range s {
+ if i > 0 {
+ sb.WriteString(", ")
+ }
+ sb.WriteString(v.String())
+ }
+ return sb.String()
+}
+
+type myint int
+
+func (a myint) String() string {
+ return strconv.Itoa(int(a))
+}
+
+func main() {
+ v := stringableList[myint]{ myint(1), myint(2) }
+
+ if got, want := v.String(), "1, 2"; got != want {
+ panic(fmt.Sprintf("got %s, want %s", got, want))
+ }
+}
diff --git a/test/typeparam/stringer.go b/test/typeparam/stringer.go
new file mode 100644
index 0000000000..81290d599e
--- /dev/null
+++ b/test/typeparam/stringer.go
@@ -0,0 +1,88 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+// Test method calls on type parameters
+
+package main
+
+import (
+ "fmt"
+ "reflect"
+ "strconv"
+)
+
+// Simple constraint
+type Stringer interface {
+ String() string
+}
+
+func stringify[T Stringer](s []T) (ret []string) {
+ for _, v := range s {
+ ret = append(ret, v.String())
+ }
+ return ret
+}
+
+type myint int
+
+func (i myint) String() string {
+ return strconv.Itoa(int(i))
+}
+
+// Constraint with an embedded interface, but still only requires String()
+type Stringer2 interface {
+ CanBeStringer2() int
+ SubStringer2
+}
+
+type SubStringer2 interface {
+ CanBeSubStringer2() int
+ String() string
+}
+
+func stringify2[T Stringer2](s []T) (ret []string) {
+ for _, v := range s {
+ ret = append(ret, v.String())
+ }
+ return ret
+}
+
+func (myint) CanBeStringer2() int {
+ return 0
+}
+
+func (myint) CanBeSubStringer2() int {
+ return 0
+}
+
+// Test use of method values that are not called
+func stringify3[T Stringer](s []T) (ret []string) {
+ for _, v := range s {
+ f := v.String
+ ret = append(ret, f())
+ }
+ return ret
+}
+
+func main() {
+ x := []myint{myint(1), myint(2), myint(3)}
+
+ got := stringify(x)
+ want := []string{"1", "2", "3"}
+ if !reflect.DeepEqual(got, want) {
+ panic(fmt.Sprintf("got %s, want %s", got, want))
+ }
+
+ got = stringify2(x)
+ if !reflect.DeepEqual(got, want) {
+ panic(fmt.Sprintf("got %s, want %s", got, want))
+ }
+
+ got = stringify3(x)
+ if !reflect.DeepEqual(got, want) {
+ panic(fmt.Sprintf("got %s, want %s", got, want))
+ }
+}
diff --git a/test/typeparam/struct.go b/test/typeparam/struct.go
new file mode 100644
index 0000000000..98f0fcd888
--- /dev/null
+++ b/test/typeparam/struct.go
@@ -0,0 +1,49 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+type _E[T any] struct {
+ v T
+}
+
+type _S1 struct {
+ _E[int]
+ v string
+}
+
+type _Eint = _E[int]
+type _Ebool = _E[bool]
+
+type _S2 struct {
+ _Eint
+ _Ebool
+ v string
+}
+
+type _S3 struct {
+ *_E[int]
+}
+
+func main() {
+ s1 := _S1{_Eint{2}, "foo"}
+ if got, want := s1._E.v, 2; got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+ s2 := _S2{_Eint{3}, _Ebool{true}, "foo"}
+ if got, want := s2._Eint.v, 3; got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+ var s3 _S3
+ s3._E = &_Eint{4}
+ if got, want := s3._E.v, 4; got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+}
diff --git a/test/typeparam/sum.go b/test/typeparam/sum.go
new file mode 100644
index 0000000000..f0f5e6aa07
--- /dev/null
+++ b/test/typeparam/sum.go
@@ -0,0 +1,50 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import (
+ "fmt"
+)
+
+func sum[T interface{ type int, float64 }](vec []T) T {
+ var sum T
+ for _, elt := range vec {
+ sum = sum + elt
+ }
+ return sum
+}
+
+func abs(f float64) float64 {
+ if f < 0.0 {
+ return -f
+ }
+ return f
+}
+
+func main() {
+ vec1 := []int{3, 4}
+ vec2 := []float64{5.8, 9.6}
+ got := sum[int](vec1)
+ want := vec1[0] + vec1[1]
+ if got != want {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+ got = sum(vec1)
+ if want != got {
+ panic(fmt.Sprintf("got %d, want %d", got, want))
+ }
+
+ fwant := vec2[0] + vec2[1]
+ fgot := sum[float64](vec2)
+ if abs(fgot - fwant) > 1e-10 {
+ panic(fmt.Sprintf("got %f, want %f", fgot, fwant))
+ }
+ fgot = sum(vec2)
+ if abs(fgot - fwant) > 1e-10 {
+ panic(fmt.Sprintf("got %f, want %f", fgot, fwant))
+ }
+}
diff --git a/test/typeparam/value.go b/test/typeparam/value.go
new file mode 100644
index 0000000000..5dd7449d9c
--- /dev/null
+++ b/test/typeparam/value.go
@@ -0,0 +1,75 @@
+// run -gcflags=-G=3
+
+// Copyright 2021 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.
+
+package main
+
+import "fmt"
+
+type value[T any] struct {
+ val T
+}
+
+func get[T2 any](v *value[T2]) T2 {
+ return v.val
+}
+
+func set[T any](v *value[T], val T) {
+ v.val = val
+}
+
+func (v *value[T2]) set(val T2) {
+ v.val = val
+}
+
+func (v *value[T2]) get() T2 {
+ return v.val
+}
+
+func main() {
+ var v1 value[int]
+ set(&v1, 1)
+ if got, want := get(&v1), 1; got != want {
+ panic(fmt.Sprintf("get() == %d, want %d", got, want))
+ }
+
+ v1.set(2)
+ if got, want := v1.get(), 2; got != want {
+ panic(fmt.Sprintf("get() == %d, want %d", got, want))
+ }
+
+ v1p := new(value[int])
+ set(v1p, 3)
+ if got, want := get(v1p), 3; got != want {
+ panic(fmt.Sprintf("get() == %d, want %d", got, want))
+ }
+
+ v1p.set(4)
+ if got, want := v1p.get(), 4; got != want {
+ panic(fmt.Sprintf("get() == %d, want %d", got, want))
+ }
+
+ var v2 value[string]
+ set(&v2, "a")
+ if got, want := get(&v2), "a"; got != want {
+ panic(fmt.Sprintf("get() == %q, want %q", got, want))
+ }
+
+ v2.set("b")
+ if got, want := get(&v2), "b"; got != want {
+ panic(fmt.Sprintf("get() == %q, want %q", got, want))
+ }
+
+ v2p := new(value[string])
+ set(v2p, "c")
+ if got, want := get(v2p), "c"; got != want {
+ panic(fmt.Sprintf("get() == %d, want %d", got, want))
+ }
+
+ v2p.set("d")
+ if got, want := v2p.get(), "d"; got != want {
+ panic(fmt.Sprintf("get() == %d, want %d", got, want))
+ }
+}