1
0
mirror of https://github.com/golang/go synced 2024-11-19 07:34:44 -07:00
Commit Graph

46824 Commits

Author SHA1 Message Date
Rob Findley
26713b5fef go/types: don't write during sanitizeInfo if nothing has changed
In its final phase, the typechecker walks the types it produces to
ensure that no unexpanded type instances leak through the API. However,
this also walks shared types (such as those in the universe scope),
resulting in a potential data race during concurrent typechecking
passes.

Fix this by being careful not to write if nothing needs to be changed.
Since any shared types should already be sanitized, this should
eliminate data races.

For #44434

Change-Id: Iadb2e78863efe0e974e69a00e255f26cfaf9386a
Reviewed-on: https://go-review.googlesource.com/c/go/+/294411
Trust: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-19 23:22:33 +00:00
Robert Griesemer
9a99515c8f all: REVERSE MERGE dev.typeparams (7cdfa49) into master
This commit is a REVERSE MERGE.
It merges dev.typeparams back into its parent branch, master.
This marks the end of development on dev.typeparams.

Merge List:

+ 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 dfe0ef961b [dev.typeparams] go/types, types2: revert fancy struct printing (fixes x/tools tests)
+ 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 47e4b0739e Merge "[dev.typeparams] all: merge master (eb98272) into dev.typeparams" into dev.typeparams
+ 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 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 7b679617f3 [dev.typeparams] go/types: conversions to type parameters are not constant
+ 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-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 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-10 df23540dde [dev.typeparams] cmd/gofmt: add the -G flag to allow generic code
+ 2021-02-10 ddec18cf82 [dev.typeparams] cmd/compile/internal/types2: overlapping embedded interfaces requires go1.14
+ 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-08 ca18c42054 [dev.typeparams] merge dev.regabi (618e3c1) into dev.typeparams
+ 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-05 dcb5e0392e [dev.typeparams] cmd/compile: add stenciling of simple generic functions
+ 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 ca2f152893 [dev.typeparams] go/types: add missing test from dev.go2go
+ 2021-02-03 dc122c7a9c [dev.typeparams] test: exclude a failing test again (fix 32bit builds)
+ 2021-02-03 c910fd7b77 [dev.typeparams] cmd/compile: refuse excessively long constants
+ 2021-02-03 3db6e18468 [dev.typeparams] test: enable more errorcheck tests
+ 2021-02-03 bb53a5ad43 [dev.typeparams] cmd/compile/internal/importer: adjust importer to match compiler importer
+ 2021-02-03 3f845b3b45 [dev.typeparams] cmd/compile: deal with inferred type arguments
+ 2021-02-03 e633f343ba [dev.typeparams] cmd/compile:  add OFUNCINST/OTYPEINST nodes for generic func/type instantiation
+ 2021-02-02 0d2d6c7464 [dev.typeparams] all: merge dev.regabi (23b0c1f) into dev.typeparams
+ 2021-02-02 3d5c715bf2 [dev.typeparams] Handling multiple type arguments for call via new node OLIST
+ 2021-02-01 13a7412983 [dev.typeparams] Parse a generic type arg for generic function call
+ 2021-01-30 0aafd69124 [dev.typeparams] cmd/compile: start translating type params in noder2
+ 2021-01-30 a59cb5109d [dev.typeparams] cmd/compile/internal/types2: handle untyped constant arithmetic overflow
+ 2021-01-29 507e641963 [dev.typeparams] cmd/compile/internal/typecheck: declutter generated builtin.go (cleanup)
+ 2021-01-28 2440dd457a [dev.typeparams] cmd/compile:  start adding info needed for typeparams in types & ir
+ 2021-01-28 c0bf904ddf [dev.typeparams] cmd/compile/internal/types2: translate syntax to token constants via tables
+ 2021-01-28 f7d1c5990b [dev.typeparams] cmd/compile/internal/types2: must not import a package called "init"
+ 2021-01-27 217a461f56 [dev.typeparams] cmd/compile/internal/types2: report unused packages in source order
+ 2021-01-26 08a598f8c1 [dev.typeparams] cmd/compile: fix MethodExpr handling with embedded fields
+ 2021-01-26 cecc1dfcba [dev.typeparams] test: enable excluded test fixedbugs/issue7742.go
+ 2021-01-26 e48d7d3b21 [dev.typeparams] go/constant: faster match implementation
+ 2021-01-26 d39685e5e9 [dev.typeparams] go/constant: choose internal float representations more consistently
+ 2021-01-25 34704e374f [dev.typeparams] all: merge dev.regabi (5e4a0cd) into dev.typeparams
+ 2021-01-26 c97af0036b [dev.typeparams] cmd/compile: force untyped constants from types2 to expected kind
+ 2021-01-25 3663a437a7 [dev.typeparams] go/constant: in ToFloat, convert to rational numbers, not floats
+ 2021-01-25 3432d24bab Merge "[dev.typeparams] all: merge dev.regabi (063c72f) into dev.typeparams" into dev.typeparams
+ 2021-01-25 493eb6e6ec [dev.typeparams] cmd/compile: fix -G=3 handling of blank methods
+ 2021-01-25 13f02018af [dev.typeparams] test: enable more errorcheck tests w/ -G=3
+ 2021-01-24 6d8d118762 [dev.typeparams] all: merge dev.regabi (063c72f) into dev.typeparams
+ 2021-01-24 9456804e86 [dev.typeparams] test: fix excluded files lookup so it works on Windows
+ 2021-01-23 7947df436d [dev.typeparams] test: set -G=3 and enable more errorcheck tests in run.go
+ 2021-01-23 a49e941027 [dev.typeparams] cmd/compile/internal/types2: remove MethodSet code - not used by types2
+ 2021-01-23 5347241b5e [dev.typeparams] cmd/compile/internal/types2: use same sort criteria for methods as compiler
+ 2021-01-23 2b95c28b18 [dev.typeparams] cmd/compile: refactor SelectorExpr code into helpers
+ 2021-01-23 1946a77e69 Merge "[dev.typeparams] all: merge dev.regabi (7e0a81d) into dev.typeparams" into dev.typeparams
+ 2021-01-23 6923019a71 [dev.typeparams] cmd/compile/internal/types2: factor out sorting of methods
+ 2021-01-22 6e46c8fbb5 [dev.typeparams] all: merge dev.regabi (7e0a81d) into dev.typeparams
+ 2021-01-22 e4ef30a667 [dev.typeparams] cmd/compile: refactor irgen's handling of ":="
+ 2021-01-22 626406b703 [dev.typeparams] go/types: import api_test.go changes from dev.go2go
+ 2021-01-22 12cd9cf7e0 [dev.typeparams] cmd/compile: disambiguate OXDOT in noder using types2 Selection info
+ 2021-01-22 f8654579cd [dev.typeparams] cmd/compile/internal/types2: adjust errors in branch checking code, fix a bug
+ 2021-01-21 18bd7aa625 [dev.typeparams] cmd/compile: use nil instead of syntax.ImplicitOne
+ 2021-01-21 2427f6e6c0 [dev.typeparams] cmd/compile: directly set some simple expression types
+ 2021-01-21 455c29af83 [dev.typeparams] cmd/compile/internal/types2: convert untyped arguments to delete
+ 2021-01-21 f03f934ede [dev.typeparams] cmd/compile/internal/types2: make predeclared "any" alias for interface{}
+ 2021-01-20 0f054c5be0 [dev.typeparams] cmd/dist: add -G=3 test coverage
+ 2021-01-20 89ec17be9a [dev.typeparams] cmd/compile: simplify how irgen handles qualified idents
+ 2021-01-20 fa01ade41e [dev.typeparams] go/types: add tests from dev.go2go
+ 2021-01-20 734cb8be0a [dev.typeparams] go/types: refactor untyped conversion for typeparams
+ 2021-01-20 d8796b5670 [dev.typeparams] cmd/compile/internal/types2: report type of nil based on context
+ 2021-01-19 48a3cb399d [dev.typeparams] go/types: fix some merge errors in call.go
+ 2021-01-19 3e15bf7716 [dev.typeparams] go/types: don't modify Named.underlying in validType
+ 2021-01-19 f38f862417 [dev.typeparams] go/types: strip annotations from errors
+ 2021-01-19 2e64511ac9 [dev.typeparams] go/types: unify methods in missingMethod
+ 2021-01-19 958927c824 [dev.typeparams] go/parser: error for type instances without ParseTypeParams
+ 2021-01-19 90bfc73071 [dev.typeparams] cmd/compile: cache mapped types during irgen
+ 2021-01-19 3c0a39c964 [dev.typeparams] cmd/compile/internal/types: minor fixes/cleanups around testing
+ 2021-01-15 502198c8dc [dev.typeparams] cmd/compile/internal/types2: consistently report nil type as "untyped nil"
+ 2021-01-14 82c3f0a358 [dev.typeparams] cmd/compile/internal/types2: untyped shift counts must fit into uint
+ 2021-01-14 67bf62d939 [dev.typeparams] cmd/compile/internal/types2: better error message for invalid ... use
+ 2021-01-14 ef5285fbd0 [dev.typeparams] cmd/compile: add types2-based noder
+ 2021-01-12 f065ff221b [dev.typeparams] all: merge dev.regabi (d9acf6f) into dev.typeparams
+ 2021-01-12 099599662d [dev.typeparams] cmd/compile: refactor import logic
+ 2021-01-12 106aa941df [dev.typeparams] cmd/compile: refactor DWARF scope marking
+ 2021-01-12 6a56c6c870 [dev.typeparams] go/types: import dev.go2go changes to check tests
+ 2021-01-11 9e746e4255 [dev.typeparams] cmd/compile: refactor varEmbed logic
+ 2021-01-11 3e1a87ac2a [dev.typeparams] cmd/compile: extract posMap from noder
+ 2021-01-11 2e8f29b79d [dev.typeparams] cmd/compile: add types2.Sizes implementation
+ 2021-01-11 44d1a8523a [dev.typeparams] cmd/compile/internal/types2: fixes for all.bash
+ 2021-01-11 8123bc90b8 [dev.typeparams] cmd/go: relax test expectation
+ 2021-01-11 8c5aa42c79 [dev.typeparams] cmd/compile: calculate variable sizes in walk
+ 2021-01-11 1ce0854157 [dev.typeparams] import stmt changes from dev.go2go
+ 2021-01-11 eb53a6c7cf [dev.typeparams] import operand.go changes from dev.go2go
+ 2021-01-11 81cd99858d [dev.typeparams] go/types: import expr changes from dev.go2go
+ 2021-01-08 822aeacd9e [dev.typeparams] cmd/compile/internal/syntax: remove ShortString, use String instead
+ 2021-01-08 d017a1b649 [dev.typeparams] cmd/compile/internal/syntax: add Walk node vistor from types2
+ 2021-01-08 7903214fcc [dev.typeparams] cmd/compile/internal/syntax: add ShortString tests
+ 2021-01-08 0aede1205b [dev.typeparams] cmd/compile/internal/types2: use syntax printer to print expressions
+ 2021-01-08 934f9dc0ef [dev.typeparams] cmd/compile/internal/syntax: clean up node printing API
+ 2021-01-07 5b9152de57 [dev.typeparams] all: merge dev.regabi (cb05a0a) into dev.typeparams
+ 2021-01-07 7e689f86e3 [dev.typeparams] go/types: move use and useLHS to match dev.go2go
+ 2021-01-06 d76cefed1f [dev.typeparams] go/types: remove disabled code related to type lists
+ 2021-01-06 0e286579c5 [dev.typeparams] go/types: import typexpr.go from dev.go2go
+ 2021-01-06 9546596d77 [dev.typeparams] cmd/compile/internal/types2: remove disabled code related to type lists
+ 2021-01-06 196102d046 [dev.typeparams] cmd/compile/internal/types2: review of typexpr.go
+ 2021-01-05 a8fe098a12 [dev.typeparams] all: merge dev.regabi (77365c5) into dev.typeparams
+ 2020-12-28 a800acaae1 [dev.typeparams] all: merge dev.regabi (07569da) into dev.typeparams
+ 2020-12-27 dd40bbc57b [dev.typeparams] cmd/compile: re-enable internal/types2 test
+ 2020-12-23 d99dd17827 [dev.typeparams] all: merge dev.regabi (37f138d) into dev.typeparams
+ 2020-12-22 8b1fbd8215 [dev.typeparams] all: merge dev.regabi (6d03cde) into dev.typeparams
+ 2020-12-22 23922cf83b [dev.typeparams] all: merge dev.regabi (d1d1099) into dev.typeparams
+ 2020-12-23 788dad53c5 [dev.typeparams] cmd/compile/internal/types2: disable external test temporarily
+ 2020-12-22 91cc51e005 [dev.typeparams] all: merge dev.regabi (ec741b0) into dev.typeparams
+ 2020-12-22 e02a007ffd [dev.typeparams] codereview.cfg: add config for dev.typeparams
+ 2020-12-22 41e7901ca4 [dev.typeparams] cmd/compile/internal/types2: report error for invalid main function signature
+ 2020-12-22 53c4c17b09 [dev.typeparams] all: merge dev.regabi into dev.typeparams
+ 2020-12-17 060cdbc7b5 [dev.typeparams] go/types: import object resolution from dev.go2go
+ 2020-12-17 c4f0da5750 [dev.typeparams] cmd/compile/internal/types2: remove code for implicit type arguments
+ 2020-12-16 068dd0470b [dev.typeparams] cmd/compile/internal/syntax: don't panic when providing -verify
+ 2020-12-16 7909d6ec28 [dev.typeparams] cmd/compile/internal/syntax: type parameters must always be named
+ 2020-12-16 3b5918c757 [dev.typeparams] cmd/compile/internal/types2: review of predicates.go
+ 2020-12-16 09abd23d9e [dev.typeparams] go/types: import predicates.go from dev.go2go
+ 2020-12-16 f38da2cbb6 [dev.typeparams] cmd/compile/internal/types2: review of unify.go
+ 2020-12-16 ceb77db24f [dev.typeparams] go/types: import some support functions from dev.go2go
+ 2020-12-15 a4d4c10340 [dev.typeparams] go/types: import lookup logic from dev.go2go
+ 2020-12-15 1306435103 [dev.typeparams] go/types: import changes to types.Info from dev.go2go
+ 2020-12-15 6b18081d01 [dev.typeparams] cmd/compile/internal/types2: don't crash if import path is missing
+ 2020-12-15 14e4267c34 [dev.typeparams] cmd/compile/internal/types2: report error for invalid (but empty) expr switch
+ 2020-12-15 96999296e6 [dev.typeparams] go/types: import unify.go and infer.go from dev.go2go
+ 2020-12-15 5aff757efc [dev.typeparams] cmd/compile/internal/gc: provide types2 selection info to noder
+ 2020-12-14 c8e73489c3 go/types: import instance.expand and subst.go from dev.go2go
+ 2020-12-14 3a912f279f [dev.typeparams] cmd/compile/internal/syntax: export NewName and use it
+ 2020-12-14 8ec9e89000 [dev.typeparams] cmd/compile/internal/types2: fix stray ')' in error
+ 2020-12-14 8fe8e29c9f [dev.typeparams] cmd/compile/internal/types2: report error for invalid type expression
+ 2020-12-14 f8930a2413 [dev.typeparams] cmd/compile/internal/types2: report invalid ... in conversions
+ 2020-12-14 5aca6e7857 [dev.typeparams] test: finish triaging all outstanding failing tests
+ 2020-12-14 df58f3368e [dev.typeparams] cmd/compile/internal/types2: don't report two errors for bad strings
+ 2020-12-14 91803a2df3 [dev.typeparams] merge: merge branch 'dev.regabi' into 'dev.typeparams'
+ 2020-12-11 a20021227e [dev.typeparams] cmd/compile/internal/types2: bring over subst.go changes from go/types
+ 2020-12-10 ddf44904f1 [dev.typeparams] test: exclude 32bit-specific test that fails on 32bit platforms (fix build)
+ 2020-12-10 dbce27d29c [dev.typeparams] cmd/compile/internal/types2: report correct line number for missing key
+ 2020-12-09 edf80c4209 [dev.typeparams] cmd/compile/internal/types2: adjusted more error messages for compiler
+ 2020-12-09 43c7b214db [dev.typeparams] cmd/compile/internal/types2: adjusted qualified identifier error message for compiler
+ 2020-12-09 6812eae2e2 [dev.typeparams] cmd/compile/internal/types2: adjust init cycle error message for compiler
+ 2020-12-09 810957b155 [dev.typeparams] cmd/compile/internal/types2: adjusted array error message for compiler
+ 2020-12-09 c32566c336 [dev.typeparams] cmd/compile/internal/types2: avoid endless recursion in Comparable predicate
+ 2020-12-08 6015c4e543 [dev.typeparams] go/*: add TODOs from CLs importing dev.go2go changes
+ 2020-12-08 b6e678573d [dev.typeparams] go/types: import universe changes from dev.go2go
+ 2020-12-08 14dc2d2345 [dev.typeparams] go/types: import the Type API from dev.go2go
+ 2020-12-07 cd15a48036 [dev.typeparams] cmd/compile/internal/types2: correct error position for inherited const init expression
+ 2020-12-04 02820d61a9 [dev.typeparams] test: enable some more errorcheck tests
+ 2020-12-03 9ff27e9fad [dev.typeparams] test: run all errorcheck tests that pass compiler with -G flag
+ 2020-12-03 7a1aa7dfaf [dev.typeparams] test: adjust more test cases to match compiler -G output
+ 2020-12-03 07d32c8183 [dev.typeparams] cmd/compile/internal/types: adjust some error messages to match the compiler
+ 2020-12-03 6b4da14dd3 [dev.typeparams] cmd/compile: provide scaffolding to get types2 types during noding
+ 2020-12-02 72cc2353f0 [dev.typeparams] go/printer: adapt changes from dev.go2go
+ 2020-12-02 ab18125567 [dev.typeparams] cmd/compile/internal/types2: no "declared but not used" errors for invalid var decls
+ 2020-12-02 036245862a [dev.typeparams] cmd/compile/internal/types2: set compiler error message for undeclared variable
+ 2020-12-01 bdc4ffe9a8 [dev.typeparams] cmd/compile/internal/types2: add Config.IgnoreBranches flag
+ 2020-12-01 72ad2f44ea [dev.typeparams] test: add scaffolding to run.go to check compiler with -G flag
+ 2020-12-01 87bc85a846 [dev.typeparams] cmd/compile/internal/types2: adjustments toward matching compiler error messages
+ 2020-12-01 fbc4c6a3ae [dev.typeparams] cmd/compile/internal/types2: remove support for type parameter pointer designation
+ 2020-11-25 ba9c35aa12 [dev.typeparams] merge dev.regabi 40f5bc4d55 into dev.typeparams
+ 2020-11-25 5c2e14872c [dev.typeparams] merge dev.regabi 41f3af9d04 into dev.typeparams
+ 2020-11-25 2c25cd5ba7 [dev.typeparams] cmd/compile/internal/types2: a type parameter is a valid type case in a type switch
+ 2020-11-24 0fb733b7f7 [dev.typeparams] go/parser: support the ParseTypeParams mode
+ 2020-11-24 b56762129e [dev.typeparams] import go2go changes to parse type parameters
+ 2020-11-24 a324aebb7d [dev.typeparams] go/types, cmd/compile/internal/types2: fix incorrect string(int) conversion (regression)
+ 2020-11-20 8fbdacf64c [dev.typeparams] cmd/compile/internal/types2: report constant overflow in binary ops
+ 2020-11-19 b1ae0a0646 [dev.typeparams] Merge branch 'master' into dev.typeparams
+ 2020-11-19 0123c9b321 [dev.typeparams] cmd/compile/internal/types2: report an error for invalid constant values
+ 2020-11-18 2140049172 [dev.typeparams] cmd/compile/internal/types2: port of https://golang.org/cl/270957
+ 2020-11-11 6877ee1e07 [dev.typeparams] cmd/compile: use existing findpkg algorithm when importing through types2
+ 2020-11-03 165ceb09f9 [dev.typeparams] merge master into dev.typeparams
+ 2020-10-28 41ff51ae00 [dev.typeparams] cmd/compile/internal/types2: review of scopes.go
+ 2020-10-27 9392b82919 [dev.typeparams] cmd/compile/internal/types: review of objset.go
+ 2020-10-27 c32ac6c15f [dev.typeparams] cmd/compile/internal/types: review of selection.go
+ 2020-10-27 ff6ab114c9 [dev.typeparams] cmd/compile/internal/types: review of gccgosizes.go
+ 2020-10-27 abb31c2558 [dev.typeparams] cmd/compile/internal/types2: review of hilbert_test.go
+ 2020-10-27 6e98406ac3 [dev.typeparams] cmd/compile/internal/types2: review of initorder.go
+ 2020-10-27 38af45b4cb [dev.typeparams] cmd/compile/internal/types2: review of package.go
+ 2020-10-27 87eab74628 [dev.typeparams] cmd/compile: enable type-checking of generic code
+ 2020-10-23 5bfd2964a6 [dev.typeparams] merge master into dev.typeparams
+ 2020-10-22 a10fe9f6e7 go/ast: import AST changes supporting typeparams from dev.go2go
+ 2020-10-21 7a8a720c80 [dev.typeparams] cmd/compile/internal/types2: add *.go2 (generic) tests
+ 2020-10-21 755d6de1d8 [dev.typeparams] cmd/compile/internal/types2: add some more tests
+ 2020-10-21 1d07306a44 [dev.typeparams] cmd/compile/internal/types2: adjust tests, enable Testdata tests
+ 2020-10-21 befc62a2c4 [dev.typeparams] cmd/compile/internal/types2: add testdata directory
+ 2020-10-21 ca36ba83ab [dev.typeparams] cmd/compile/internal/importer, types2: initial check-in of types2 and importer
+ 2020-10-20 6ff16fe3ee [dev.typeparams] cmd/compile/internal/syntax: add utility functions for testing
+ 2020-10-19 5e46c6a10f [dev.typeparams] cmd/compile/internal/syntax: add Pos method
+ 2020-10-15 e9e58a4d49 [dev.typeparams] cmd/compile/internal/syntax: fix printing of channel types
+ 2020-10-14 73f529845c [dev.typeparams] cmd/compile/internal/syntax: always use IndexExpr node for type instantiation
+ 2020-10-13 48755e06aa [dev.typeparams] cmd/compile: enable parsing of generic code with new -G flag
+ 2020-10-13 7668f02dec [dev.typeparams] cmd/compile/internal/syntax: add type parameter tests
+ 2020-10-13 b627988b0c [dev.typeparams] cmd/compile/internal/syntax: implement parsing of type parameters
+ 2020-10-13 617b633917 [dev.typeparams] cmd/compile/internal/syntax: prepare syntax nodes for type parameters
+ 2020-10-12 986cad14e2 [dev.typeparams] merge master into dev.typeparams

Change-Id: Ie0796a53af1fb5db49f4c748144461d3af598575
2021-02-19 12:23:42 -08:00
Robert Griesemer
7cdfa4969a [dev.typeparams] all: merge master (06b86e9) into dev.typeparams
Merge List:

+ 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 7764ee5614 runtime: fix invalid nil g check for for mips64x
+ 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 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

Change-Id: Ib27e232dabac0604b588f27749bd8ad45a281fe3
2021-02-19 11:56:04 -08:00
Robert Griesemer
6521c7b378 [dev.typeparams] cmd/compile/internal/types2: resolve decl cycle the same way as in go/types
Minor adjustment to match go/types more closely.

Change-Id: Id79c51f0ecd8cda0f5b68f6e961500f7f22f7115
Reviewed-on: https://go-review.googlesource.com/c/go/+/294270
Reviewed-by: Robert Findley <rfindley@google.com>
Trust: Robert Griesemer <gri@golang.org>
2021-02-19 19:39:03 +00:00
Dan Scales
06b86e9803 cmd/compile: fix check to avoid creating new closure function when typechecking inline body
By default, when typechecking a closure, tcClosure() creates a new
closure function. This should really be done separate from typechecking.
For now, we explicitly avoid creating a new closure function when
typechecking an inline body (in ImportedBody). However, the heuristic
for determining when we are typechecking an inline body was not correct
for double nested closures in an inline body, since CurFunc will then be
the inner closure, which has a body.

So, use a simple global variable to indicate when we typechecking an
inline body. The global variable is fine (just like ir.CurFunc), since
the front-end runs serially.

Fixes #44325

Change-Id: If2829fe1ebb195a7b1a240192b57fe6f04d1a36b
Reviewed-on: https://go-review.googlesource.com/c/go/+/294211
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
2021-02-19 19:28:53 +00:00
Russ Cox
9322eec8a2 codereview.cfg: add codereview.cfg for master branch
The codereview sync-branch command wants all involved
branches to have codereview.cfg, and this will help us when
we transition from master to main later this year.

Change-Id: Ia8e4c8b8c86864ed9d730e5d96be1ff386e2e1cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/294291
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-19 18:44:53 +00:00
Russ Cox
02e5a8fdfc runtime: ignore SPWRITE in syscall functions
netbsd/amd64's Syscall9 changes SP using ADD and SUB,
which are treated as SPWRITEs (they are not accounted for
in the sp-adjust tracking, and there are too many functions that
would report mismatched stack adjustments at RET if they were).
A traceback starting in Syscall9 as saved by entersyscall complains
about the SPWRITE-ness unnecessarily, since the PC/SP are saved
at the start of the function. Ignore SPWRITE in that case.

netbsd/arm's Syscall6 also changes SP (R13), using a direct write.
So even if we could handle the ADD/SUB in the amd64 case or
rewrote that assembly, we'd still be stuck with a more difficult
problem in this case. Ignoring the SPWRITE fixes it.

Example crashes:
https://build.golang.org/log/160fc7b051a2cf90782b75a99984fff129329e66
https://build.golang.org/log/7879e2fecdb400eee616294285e1f952e5b17301

Change-Id: I0c8e9696066e90dafed6d4a93d11697da23f0080
Reviewed-on: https://go-review.googlesource.com/c/go/+/294072
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2021-02-19 16:09:17 +00:00
Russ Cox
fa18f224c3 runtime/pprof: disable TestMorestack on macOS under race detector
This is failing but only under the race detector.
It doesn't really seem fair to expect pprof to find
specific profile events with the race detector slowing
everything down anyway.

Change-Id: I4b353d3d63944c87884d117e07d119b2c7bf4684
Reviewed-on: https://go-review.googlesource.com/c/go/+/294071
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 15:31:06 +00:00
Russ Cox
01eb70e3dd os: fix hex exit code print on 32-bit windows
We want to print hex exit codes for the large values,
but on 32-bit Windows the large values are negative.

Change-Id: I0e350b128414a9468c93eddc62d660f552c1ee05
Reviewed-on: https://go-review.googlesource.com/c/go/+/294070
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 15:30:59 +00:00
Russ Cox
49add6ad90 runtime: fix spurious stack overflow detection
The regabi builders are unhappy about badctxt calling throw
calling systemstack calling gosave_systemstack_switch calling
badctxt, all nosplit, repeating. This wouldn't actually happen
since after one systemstack we'd end up on the system stack
and the next one wouldn't call gosave_systemstack_switch at all.

The badctxt call itself is in a very unlikely assertion failure
inside gosave_systemstack_switch.
Keep the assertion check but call runtime.abort instead on failure,
breaking the detected (but not real) cycle.

Change-Id: Iaf5c0fc065783b8c1c6d0f62d848f023a0714b96
Reviewed-on: https://go-review.googlesource.com/c/go/+/294069
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 15:30:52 +00:00
Than McIntosh
fce2a94d84 cmd/compile: fix buglet in inlined info abstract function dwarf-gen
When generating DWARF inlined info records, it's possible to have a
local function whose only callsites are inlined away, meaning that we
emit an abstract function DIE but no regular subprogram DIE. When
emitting DWARF scope info we need to handle this case (specifically
when scoping PCs, check for the case that the func in question has
been entirely deleted).

Fixes #44344.

Change-Id: I9f5bc692f225aa4c5c23f7bd2e50bcf7fe4fc5f3
Reviewed-on: https://go-review.googlesource.com/c/go/+/293309
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
2021-02-19 14:46:21 +00:00
Robert Griesemer
dfe0ef961b [dev.typeparams] go/types, types2: revert fancy struct printing (fixes x/tools tests)
An embedded struct field is embedded by mentioning its type.
The fact that the field name may be different and derived
from the type doesn't matter for the struct type.

Do print the embedded type rather than the derived field
name, as we have always done in the past. Remove the fancy
new code which was just plain wrong.

The struct output printing is only relevant for debugging
and test cases. Reverting to the original code (pre-generics)
fixes a couple of x/tools tests.

Unfortunately, the original code is (also) not correct for
embedded type aliases. Adjusted a gccgoimporter test
accordingly and filed issue #44410.

This is a follow-up on https://golang.org/cl/293961 which
addressed the issue only partially and left the incorrect
code in place.

Change-Id: Icb7a89c12ef7929c221fb1a5792f144f7fcd5855
Reviewed-on: https://go-review.googlesource.com/c/go/+/293962
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-02-19 12:42:07 +00:00
Meng Zhuo
7764ee5614 runtime: fix invalid nil g check for for mips64x
In CL 292109 we removed unnecessary writes to gp.sched.g
but put wrong register to save g (R4 saves pointer to g) on mips64x

Change-Id: I9777846a7b0a46e1af83dcfc73b74649e0dba3c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/293989
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
2021-02-19 08:48:55 +00:00
Rob Findley
2f37939a21 go/parser: improve error recovery from invalid selector exprs
Before this CL, the parser consumed the next token following an invalid
selector expr no matter what it was. This leads to poor error recovery
when this next token is a closing delimiter or other reasonable element
of a stop set. As a side-effect, x/tools tests broke when parser logic
for type parameters was introduced, as they threw off the parser
synchronization to the point where the x/tools test bailed out.

This CL introduces a targeted fix that allows the x/tools tests to pass.
More general improvement for parser error recovery should be done for
go1.17.

Change-Id: I44d73d34b6063e62d16a23d24ab7cbce6500239d
Reviewed-on: https://go-review.googlesource.com/c/go/+/293792
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-19 01:53:53 +00:00
Robert Griesemer
8654db4555 [dev.typeparams] go/types: adjust printing of embedded struct fields (fixes x/tools/cmd/guru tests)
Prior to 1.16, go/types printed an embedded struct field by simply
printing its type, which may have included a package qualification.
Just printing the type is not useful with generic types and we now
must print the actual field name derived from the type - this leads
to different output for non-generic imported embedded types. Fix by
printing a package qualification in that case.

Change-Id: I2cb2484da7732428d13fdfb5fe4ec1fa1ee813a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/293961
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-02-19 01:22:43 +00:00
Bryan C. Mills
87f425da14 cmd/go/internal/mvs: split Reqs into narrower per-function interfaces
Reqs currently combines requirements with upgrades and downgrades.
However, only Upgrade needs the Upgrade method, and only Downgrade
needs the Previous method.

When we eventually add lazy loading, the lazily-loaded module graph
will not be able to compute upgrades and downgrades, so the
implementation work from here to there will be clearer if we are
explicit about which are still needed.

For #36460

Change-Id: I7bf8c2a84ce6bc4ef493a383e3d26850e9a6a6c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/290771
Trust: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-19 01:22:14 +00:00
Bryan C. Mills
4da0188c6c cmd/go/internal/modget: split resolveCandidates into two methods
It turns out that the existing call sites of the resolveCandidates
method pass only *either* a slice of queries or a slice of upgrades
(never both), and the behaviors triggered by the two parameters don't
overlap much at all. To clarify the two different operations, split
them into two separate methods.

For #36460

Change-Id: I64651637734fd44fea68740a3cdfbacfb73c19b6
Reviewed-on: https://go-review.googlesource.com/c/go/+/289697
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-02-19 01:19:01 +00:00
Russ Cox
5f2e24efb3 cmd/internal/diff: skip over Cygwin warning in diff output
This happens on Windows. Don't let it stop us.

Change-Id: Ie2115d5825e1c2217f237ed373adb35594a5aaff
Reviewed-on: https://go-review.googlesource.com/c/go/+/293850
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:41:47 +00:00
Russ Cox
ee7038f6a5 net: disable Windows netsh tests when netsh won't run
On my Surface Pro X running the insider preview,
running "netsh help" from Powershell started from the task bar works.
But running "powershell" at a cmd.exe prompt and then running
"netsh help" produces missing DLL errors.
These aren't our fault, so just skip the netsh-based tests if this happens.

Change-Id: I13a17e01143d823d3b5242d827db056bd253e3e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/293849
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:41:41 +00:00
Russ Cox
40765ffa95 os/exec: disable failing LookPathTest on windows/arm64
For #44379.

Change-Id: I9a3cf4d511a8286117f877c2ff9dbde56fa55983
Reviewed-on: https://go-review.googlesource.com/c/go/+/293709
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Russ Cox <rsc@golang.org>
2021-02-19 00:41:36 +00:00
Russ Cox
b445d6ea34 runtime/pprof: expect tests to pass on macOS
macOS tests have been disabled since CL 12429045 (Aug 2013).
At the time, macOS required a kernel patch to get a working profiler
(https://research.swtch.com/macpprof), which we didn't want
to require, of course.

macOS has improved - it no longer requires the kernel patch - but
we never updated the list of exceptions.

As far as I can tell, the builders have no problem passing the pprof test now.
(It is possible that the iOS builders have trouble, but that is now a different GOOS.)

Remove the exception for macOS. The test should now pass.

Fixes #6047.

Change-Id: Iab49036cacc1025e56f515bd19d084390c2f5357
Reviewed-on: https://go-review.googlesource.com/c/go/+/292229
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:41:28 +00:00
Russ Cox
b110a43628 runtime: delete gosave (dead code)
Change-Id: Ie811526534df8622d89c5b1b81dbe19ece1c962b
Reviewed-on: https://go-review.googlesource.com/c/go/+/292110
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-19 00:41:17 +00:00
Russ Cox
474d5f4f4d math: remove most 387 implementations
The Surface Pro X's 386 simulator is not completely faithful to a real 387.
The most egregious problem is that it computes Log2(8) as 2.9999999999999996,
but it has some other subtler problems as well. All the problems occur in
routines that we don't even bother with assembly for on amd64.
If the speed of Go code is OK on amd64 it should be OK on 386 too.
Just remove all the 386-only assembly functions.

This leaves Ceil, Floor, Trunc, Hypot, and Sqrt in 386 assembly,
all of which are also in assembly on amd64 and all of which pass
their tests on Surface Pro X.

Compared to amd64, the 386 port omits assembly for Min, Max, and Log.
It never had Min and Max, and this CL deletes Log because Log2 wasn't
even correct. (None of the other architectures have assembly Log either.)

Change-Id: I5eb6c61084467035269d4098a36001447b7a0601
Reviewed-on: https://go-review.googlesource.com/c/go/+/291229
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-02-19 00:41:09 +00:00
Russ Cox
c7c6c113be runtime: convert windows/arm64 assembly
The assembly is mostly a straightforward conversion of the
equivalent arm assembly.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I61b15d712ade4d3a7285c7680de8e0987aacba10
Reviewed-on: https://go-review.googlesource.com/c/go/+/288828
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:41:03 +00:00
Russ Cox
3527caa7d6 runtime: initial windows/arm64 implementation files
This CL adds a few small files - defs, os, and rt0 - to start
on windows/arm64 support for the runtime.

It also copies sys_windows_arm.s to sys_windows_arm64.s,
with the addition of "#ifdef NOT_PORTED" around the entire file.
This is meant to make future CLs easier to review, since the
general pattern is to translate the 32-bit ARM assembly into
64-bit ARM assembly.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I922037eb3890e77bac48281ecaa8e489595675be
Reviewed-on: https://go-review.googlesource.com/c/go/+/288827
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:56 +00:00
Russ Cox
427bd7599d runtime: generate windows/arm64 callback asm
This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I5e2b589797808626bcca771cdf860d5cb85586cb
Reviewed-on: https://go-review.googlesource.com/c/go/+/288826
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:49 +00:00
Russ Cox
f6c4b4bf96 syscall: add windows/arm64 support
types_windows_arm64.go is a copy of types_windows_amd64.go.
All that matters for these types seems to be that they are 64-bit vs 32-bit.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: Ia7788d6e88e5db899371c75dc7dea7d912a689ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/288825
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:42 +00:00
Russ Cox
ac024a0c7b cmd/vendor: get golang.org/x/sys@beda7e5e158
This brings in the windows/arm64 support, along with other recent changes.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: Ifaca710093376c658ecf91239aa05cc33af98a31
Reviewed-on: https://go-review.googlesource.com/c/go/+/288824
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2021-02-19 00:40:30 +00:00
Russ Cox
a3b97e7628 test: disable nilptr on windows/arm64
The address space starts at 4GB, so dummy is too far out.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I5f67e268ce729086d9f9fc8541722fabccfd0145
Reviewed-on: https://go-review.googlesource.com/c/go/+/288823
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:22 +00:00
Russ Cox
985d087782 cmd/link: add windows/arm64 support
This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I397c1d238bb18cbe78b3fca00910660cf1d66b8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/288822
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:16 +00:00
Russ Cox
95a44d2409 cmd/internal/objfile: recognize Windows ARM64 executables
This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I5ec459063d394b9f434d1b8b5030960b45061038
Reviewed-on: https://go-review.googlesource.com/c/go/+/288821
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:05 +00:00
Russ Cox
0ca0551f02 debug/pe: recognize arm64 executables
We still need to add test data, but as yet we haven't identified
a good Windows arm64 compiler to produce small binaries.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: Ifbecb9a6e25f7af38e20b7d7830df7f5efe2798a
Reviewed-on: https://go-review.googlesource.com/c/go/+/288820
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:40:00 +00:00
Gerrit Code Review
47e4b0739e Merge "[dev.typeparams] all: merge master (eb98272) into dev.typeparams" into dev.typeparams 2021-02-19 00:36:17 +00:00
Russ Cox
0c633125f2 cmd/dist: add windows/arm64 support
- Add Windows SystemInfo constant for arm64
- Add windows/arm64 to GOOS/GOARCH list

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.

Change-Id: I6109bd87512b5cb1d227d7a85fd0ac20eb2259e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/288819
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-02-19 00:05:03 +00:00
Russ Cox
bb6efb9609 build: set GOPATH consistently in run.bash, run.bat, run.rc
We used to clear GOPATH in all the build scripts.
Clearing GOPATH is misleading at best, since you just end up
with the default GOPATH (%USERPROFILE%\go on Windows).
Unless that's your GOROOT, in which case you end up with a
fatal error from the go command (#43938).

run.bash changed to setting GOPATH=/dev/null, which has no
clear analogue on Windows.

run.rc still clears GOPATH.

Change them all to set GOPATH to a non-existent directory
/nonexist-gopath or c:\nonexist-gopath.

Change-Id: I51edd66d37ff6a891b0d0541d91ecba97fbbb03d
Reviewed-on: https://go-review.googlesource.com/c/go/+/288818
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:04:56 +00:00
Russ Cox
a1222b7535 cmd/link: add debug print in deadcode
This matches the prints that deadcode prints later
as the algorithm progresses under -v=2.
It helps to see the initial conditions with -v=2 as well.

Change-Id: I06ae86fe9bd8314d003148f3d941832c9b10aef1
Reviewed-on: https://go-review.googlesource.com/c/go/+/288817
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:04:49 +00:00
Russ Cox
1c659f2525 cmd/link: clean up windows PE generation
A bunch of places are a bit too picky about the architecture.
Simplify them.

Also use a large PEBASE for 64-bit systems.
This more closely matches what is usually used on Windows x86-64
and is required for Windows arm64.
Unfortunately, we still need a special case for x86-64 because
of some cgo relocations. This may be fixable separately.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I65212d28ad4d8c40e2b70dc29f7fce072babecb5
Reviewed-on: https://go-review.googlesource.com/c/go/+/288816
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:04:42 +00:00
Russ Cox
b6379f190b syscall: clean up windows a bit
The files being deleted contain no code.
They exist because back when we used Makefiles
that listed all the Go sources to be compiled, we wrote
patterns like syscall_$GOOS_$GOARCH.go,
and it was easier to create dummy empty files
than introduce conditionals to not look for that
file on Windows.

Now that we have the go command instead,
we don't need those dummy files.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: Ie0066d1dd2bf09802c74c6a496276e8c593e4bc2
Reviewed-on: https://go-review.googlesource.com/c/go/+/288815
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:04:30 +00:00
Russ Cox
09e059afb1 runtime: enable framepointer on all arm64
Frame pointers were already enabled on linux, darwin, ios,
but not freebsd, android, openbsd, netbsd.

But the space was reserved on all platforms, leading to
two different arm64 framepointer conditions in different
parts of the code, one of which had no name
(framepointer_enabled || GOARCH == "arm64",
which might have been "framepointer_space_reserved").

So on the disabled systems, the stack layouts were still
set up for frame pointers and the only difference was not
actually maintaining the FP register in the generated code.

Reduce complexity by just enabling the frame pointer
completely on all the arm64 systems.

This commit passes on freebsd, android, netbsd.
I have not been able to try it on openbsd.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I83bd23369d24b76db4c6a648fa74f6917819a093
Reviewed-on: https://go-review.googlesource.com/c/go/+/288814
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:04:22 +00:00
Russ Cox
b19e7b518e runtime: clean up windows a bit
Document the various hard-coded architecture checks
or remove them in favor of more general checks.
This should be a no-op now but will make the arm64 port
have fewer diffs.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: Ifd6b19e44e8c9ca4a0d2590f314928ce235821b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/288813
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2021-02-19 00:04:14 +00:00
Russ Cox
5421c37a1d runtime: fix windows/arm externalthreadhandler
Externalthreadhandler was not handling its own stack correctly.
It incorrectly referred to the saved LR slot (uninitialized, it turned out)
as holding the return value from the called function.

Externalthreadhandler is used to call two different functions:
profileloop1 and ctrlhandler1.
Profileloop1 does not return, so no harm done.
Ctrlhandler1 returns a boolean indicating whether the handler
took care of the control event (if true, no other handlers run).

It's hard to say exactly what uninitialized values are likely to
have been returned instead of ctrlhandler1's result, but it
probably wasn't helping matters.

Change-Id: Ia02f1c033df618cb82c2193b3a8241ed048a8b18
Reviewed-on: https://go-review.googlesource.com/c/go/+/288812
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:04:07 +00:00
Russ Cox
91cc484ea9 runtime: fix time on windows/arm under WINE
This code has clearly never run successfully,
since one of the “tail calls" calls the wrong function,
and both of them appear in functions with stack frames
that are never going to be properly unwound.
Probably there is no windows/arm under WINE at all.
But might as well fix the code.

Change-Id: I5fa62274b3661bc6bce098657b5bcf11d59655eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/288811
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:03:59 +00:00
Russ Cox
38672d3dcf runtime: crash earlier on windows for runtime.abort
The isAbort check was wrong for non-x86 systems.
That was causing the exception chain to be passed back to Windows.
That was causing some other kind of fault - not sure what.
That was leading back to lastcontinuehandler to print a larger
stack trace, and then the throwing = 1 print added runtime.abort,
which made TestAbort pass even though it wasn't really working.

Recognize abort properly and handle it as Go, not as something
for Windows to try to handle.

Keep the throwing = 1 print, because more detail on throw is
always better.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: If614f4ab2884bd90410d29e28311bf969ceeac09
Reviewed-on: https://go-review.googlesource.com/c/go/+/288810
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:03:52 +00:00
Russ Cox
a1e9148e3d runtime: print hex numbers with hex prefixes in traceback debug
If traceback fails, it prints a helpful hex dump of the stack.
But the hex numbers have no 0x prefix, which might make it
a little unclear that they are hex.
We only print two per line, so there is plenty of room for the 0x.
Print it, which lets us delete a custom hex formatter.

Also, in the translated <name+off> hints, print off in hex
(with a 0x prefix). The offsets were previously decimal, which
could have been confused for hex since none of the hex had
0x prefixes. And decimal is kind of useless anyway since the
offsets shown in the main traceback are hex, so you can't
easily match them up without mental base conversions.

Just print hex everywhere, clearly marked by 0x.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I72d26a4e41ada38b620bf8fe3576d787a2e59b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/288809
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:03:44 +00:00
Russ Cox
75e273fc2c runtime: fix windows/arm CONTEXT_CONTROL
The constant was wrong, and the “right” constant doesn't work either.
But with the actually-right constant (and possibly earlier fixes in this
stack as well), profiling now works.

Change-Id: If8caff1da556826db40961fb9bcfe2b1f31ea9f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/288808
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-02-19 00:03:36 +00:00
Russ Cox
76ab626bfc runtime: factor common code out of defs_windows_*.go
Also give up on the fiction that these files can be regenerated.
They contain many manual edits, and they're fairly small anyway.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: Ib4e4e20a43d8beb1d5390fd184160c33607641f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/288807
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:03:30 +00:00
Russ Cox
ece954d8b8 runtime: find g in Windows profiler using SP
The architecture-specific interpretation of m->tls[0]
is unnecessary and fragile. Delete it.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I927345e52fa2f1741d4914478a29d1fb8acb0dc3
Reviewed-on: https://go-review.googlesource.com/c/go/+/288806
Trust: Russ Cox <rsc@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:03:22 +00:00
Russ Cox
a54f7fc0fd runtime: do not treat asmcgocall as a topofstack on g0
This was added in 2018 to fix a runtime crash during unwind
during a unhandled-panic-induced crash.
(See https://golang.org/cl/90895 and #23576.)
Clearly we cannot unwind past this function, and the change
did stop the unwind. But it's not a top-of-stack function, and
the real issue is that SP is changed.

The new SPWRITE bit takes care of this instead, so we can drop
it from the topofstack function.

At this point the topofstack function is only checking the
TOPFRAME bit, so we can inline that into the one call site.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I856552298032770e48e06c95a20823a1dbd5e38c
Reviewed-on: https://go-review.googlesource.com/c/go/+/288805
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:03:14 +00:00
Russ Cox
776ee4079a runtime: do not treat morestack as a topofstack
I added morestack to this list in 2013 with an explanation
that they were needed if we “start a garbage collection on g0
during a stack split or unsplit”.
(https://golang.org/cl/11533043)

This explanation no longer applies for a handful of reasons,
most importantly that if we did stop a stack scan in the middle
of a call to morestack, we'd ignore pointers above the split,
which would lead to memory corruption. But we don't scan
goroutine stacks during morestack now, so that can't happen.
If we did see morestack during a GC, that would be a good time
to crash the program.

The real problem with morestack is during profiling, as noted
in the code review conversation during 2013. And in profiling
we just need to know to stop and not unwind further, which
the new SPWRITE bit will do for us.

So remove from topofstack and let the program crash if GC
sees morestack and otherwise let the SPWRITE stop morestack
unwinding during profiling.

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I06d95920b18c599c7c46f64c21028104978215d7
Reviewed-on: https://go-review.googlesource.com/c/go/+/288804
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:03:07 +00:00
Russ Cox
5ecd9e34df runtime: do not treat mcall as a topofstack
I added mcall to this list in 2013 without explaining why.
(https://codereview.appspot.com/11085043/diff/61001/src/pkg/runtime/traceback_x86.c)
I suspect I was stopping crashes during profiling where the unwind
tried to walk up past mcall and got confused.

mcall is not something you can unwind past, because it switches
stacks, but it's also not something you should expect as a
standard top-of-stack frame. So if you do see it during say
a garbage collection stack walk, it would be important to crash
instead of silently stopping the walk prematurely.

This CL removes it from the topofstack list to avoid the silent stop.
Now that mcall is detected as SPWRITE, that will stop the
unwind (with a crash if encountered during GC, which we want).

This CL is part of a stack adding windows/arm64
support (#36439), intended to land in the Go 1.17 cycle.
This CL is, however, not windows/arm64-specific.
It is cleanup meant to make the port (and future ports) easier.

Change-Id: I666487ce24efd72292f2bc3eac7fe0477e16bddd
Reviewed-on: https://go-review.googlesource.com/c/go/+/288803
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-02-19 00:02:58 +00:00