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

48988 Commits

Author SHA1 Message Date
Matthew Dempsky
49ade6b298 [dev.typeparams] test: add expected failure mechanism
This CL changes the existing excluded-test mechanism into a
known-failure mechanism instead. That is, it runs the test regardless,
but only reports if it failed (or succeeded) unexpectedly.

It also splits the known failures list into fine-grain failure lists
for types2, types2 w/ 32-bit target, -G=3, and unified.

Updates #46704.

Change-Id: I1213cbccf1bab6a92d9bfcf0d971a2554249bbff
Reviewed-on: https://go-review.googlesource.com/c/go/+/332551
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-07-07 11:12:13 +00:00
Matthew Dempsky
cd00499c61 [dev.typeparams] cmd/compile: better Call constructor
Historically, it's been tedious to create and typecheck ir.OCALL
nodes, except by handing them off entirely to typecheck. This is
because typecheck needed context on whether the call is an expression
or statement, and to set flags like Func.ClosureCalled and
CallExpr.Use.

However, those flags have now been removed entirely by recent CLs, so
we can instead just provide a better typecheck.Call function for
constructing and typechecking arbitrary call nodes. Notably, this
simplifies things for unified IR, which can now incrementally
typecheck call expressions as it goes without worrying about context.

Change-Id: Icbdc55c3bd8be84a242323bc45006f9dec09fdcd
Reviewed-on: https://go-review.googlesource.com/c/go/+/332692
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-04 00:19:36 +00:00
Matthew Dempsky
899b158ee9 [dev.typeparams] cmd/compile: set Func.ClosureCalled in escape analysis
The Func.ClosureCalled flag is an optimization used by escape analysis
to detect closures that were directly called, so we know we have
visibility of the result flows. It's not needed by any other phases of
the compiler, so we might as well calculate it within escape analysis
too.

This saves some trouble during IR construction and trying to maintain
the ClosureCalled flag through inlining and copying.

Passes toolstash -cmp.

Change-Id: Ic53cecb7ac439745c0dfba2cd202b9cc40f1e47c
Reviewed-on: https://go-review.googlesource.com/c/go/+/332691
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-04 00:19:26 +00:00
Matthew Dempsky
ea5369bac0 [dev.typeparams] cmd/compile: remove ir.CallUse
Unneeded after the previous CL changed inlining to leave OINLCALL
nodes in place.

Change-Id: I9af09a86a21caa51a1117b3de17d7312dd702600
Reviewed-on: https://go-review.googlesource.com/c/go/+/332650
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-07-03 17:46:01 +00:00
Matthew Dempsky
c45d0eaadb [dev.typeparams] cmd/compile: flatten OINLCALL in walk
Inlining replaces inlined calls with OINLCALL nodes, and then somewhat
clumsily tries to rewrite these in place without messing up
order-of-evaluation rules.

But handling these rules cleanly is much easier to do during order,
and escape analysis is the only major pass between inlining and
order. It's simpler to teach escape analysis how to analyze OINLCALL
nodes than to try to hide them from escape analysis.

Does not pass toolstash -cmp, but seems to just be line number
changes.

Change-Id: I1986cea39793e3e1ed5e887ba29d46364c6c532e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332649
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-07-03 17:45:52 +00:00
Matthew Dempsky
ad2ba3ff51 [dev.typeparams] src,cmd: run 'go mod tidy'
Run 'go mod tidy' to satisfy the longtest builders.

Change-Id: I5b31b63d0f273fca0833e44b826edfd726a1a958
Reviewed-on: https://go-review.googlesource.com/c/go/+/332669
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-03 17:45:01 +00:00
Matthew Dempsky
5dac279fbd [dev.typeparams] cmd/compile: formalize "hidden parameters" idea
This CL formalizes the closure-var trick used for method-value
wrappers to be reusable for defining other functions that take hidden
parameters via the closure-context register. In particular, it:

1. Adds a new ir.NewHiddenParam function for creating hidden
parameters.

2. Changes ir.NewClosureVar to copy Type/Typecheck from the closure
variable, so that callers can needing to manually copy these.

3. Updates existing code accordingly (i.e., method-value wrappers to
start using ir.NewHiddenParam, and closure builders to stop copying
types).

Longer term, I anticipate using this to pass dictionaries to stenciled
functions within unified IR.

Change-Id: I9da3ffdb2a26d15c6e89a21b4e080686d6dc872c
Reviewed-on: https://go-review.googlesource.com/c/go/+/332612
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-03 10:21:47 +00:00
Gerrit Code Review
611056ec34 Merge "[dev.typeparams] all: merge master (912f075) into dev.typeparams" into dev.typeparams 2021-07-03 02:00:21 +00:00
Matthew Dempsky
ef39edefe1 [dev.typeparams] src,cmd: bump go.mod to 'go 1.18'
Necessary for building/testing generics code within src/ or src/cmd/
since CL 332373, and we'll need to do this eventually anyway.

Change-Id: Ia8c658c92d861fd3803fa18bfc80407c3381b411
Reviewed-on: https://go-review.googlesource.com/c/go/+/332554
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-02 23:55:07 +00:00
Matthew Dempsky
f35d86fd5f [dev.typeparams] all: merge master (912f075) into dev.typeparams
Conflicts:

- src/cmd/compile/internal/escape/escape.go

  On master, CL 332230 changed the ">=" in HeapAllocReason to ">"; but
  on dev.typeparams, CL 329989 moved HeapAllocReason into utils.go.

Merge List:

+ 2021-07-02 912f075047 net/http: mention socks5 support in proxy
+ 2021-07-02 287c5e8066 cmd/compile: fix stack growing algorithm
+ 2021-07-02 743f03eeb0 spec, unsafe: clarify unsafe.Slice docs
+ 2021-07-02 6125d0c426 cmd/dist: correct comment: SysProcAttri -> SysProcAttr
+ 2021-07-01 03761ede02 net: don't reject null mx records
+ 2021-07-01 877688c838 testing: add TB.Setenv
+ 2021-07-01 ef8ae82b37 cmd/compile: fix bug in dwarf-gen var location generation
+ 2021-07-01 770899f7e1 cmd/go: add a regression test for 'go mod vendor' path traversal
+ 2021-07-01 835d86a17e cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
+ 2021-07-01 eb437ba92c cmd/compile: make stack value size threshold comparisons consistent
+ 2021-07-01 9d65578b83 cmd/compile: fix typos in document

Change-Id: I08aa852441af0f070aa32dd2f99b6fa4e9d79cfa
2021-07-02 16:03:51 -07:00
Dan Scales
b994cc69e0 [dev.typeparams] cmd/compile: separate out creating instantiations from creating dictionaries
We often need to create a function/method instantiation, but not a
dictionary, because the call to the instantiation will be using a
sub-dictionary. Also, main dictionaries are only need for concrete,
non-gcshape types, whereas instantiations will be for gcshape types (or
concrete types, for strict stenciling).

Created a helper function getDictOrSubdict() to reduce duplicated code.
Also, moved gfGetGfInfo() call in getDictionarySym() inside conditional
where it is needed, to avoid extra work when dictionary has already been
created.

Change-Id: I06587cb2ddc77de2f991e9f9eaf462d2c5a5d45e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332550
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
2021-07-02 21:12:15 +00:00
Sean Liao
912f075047 net/http: mention socks5 support in proxy
Change-Id: I55b6d5c77221569eeafea625379affd476a65772
Reviewed-on: https://go-review.googlesource.com/c/go/+/326011
Reviewed-by: Damien Neil <dneil@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-02 21:06:08 +00:00
go101
287c5e8066 cmd/compile: fix stack growing algorithm
The current stack growing implementation looks not right.
Specially, the line runtime/stack.go#L1068 never gets executed,
which causes many unnecessary copystack calls.

This PR is trying to correct the implementation.
As I'm not familiar with the code, the fix is just a guess.

Change-Id: I0bea1148175fad34f74f19d455c240c94d3cb78b
GitHub-Last-Rev: 57205f91fe
GitHub-Pull-Request: golang/go#47010
Reviewed-on: https://go-review.googlesource.com/c/go/+/332229
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-07-02 20:11:05 +00:00
Ian Lance Taylor
743f03eeb0 spec, unsafe: clarify unsafe.Slice docs
For #19367

Change-Id: If0ff8ddba3b6b48e2e198cf3653e73284c7572a3
Reviewed-on: https://go-review.googlesource.com/c/go/+/332409
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-07-02 19:26:52 +00:00
Dan Scales
6dec18cc75 [dev.typeparams] cmd/compile: start using sub-dictionary entries where needed
Added new struct instInfo for information about an instantiation (of a
generic function/method with gcshapes or concrete types). We use this to
remember the dictionary param node, the nodes where sub-dictionaries
need to be used, etc. The instInfo map replaces the Stencil map in
Package.

Added code to access sub-dictionary entries at the appropriate call
sites. We are currently still calculating the corresponding main
dictionary, even when we really only need a sub-dictionary. I'll clean
that up in a follow-up CL.

Added code to deal with "generic" closures (closures that reference some
generic variables/types). We decided that closures will share the same
dictionary as the containing function (accessing the dictionary via a
closure variable). So, the getGfInfo function now traverses all the
nodes of each closure in a function that it is analyzing, so that a
function's dictionary has all the entries needed for all its closures as
well. Also, the instInfo of a closure is largely shared with its
containing function. A good test for generic closures already exists
with orderedmap.go.

Other improvements:
 - Only create sub-dictionary entries when the function/method
   call/value or closure actually has type params in it. Added new test
   file subdict.go with an example where a generic method has an
   instantiated method call that does not depend not have type params.

Change-Id: I691b9dc024a89d2305fcf1d8ba8540e53c9d103f
Reviewed-on: https://go-review.googlesource.com/c/go/+/331516
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-07-02 19:07:06 +00:00
komisan19
6125d0c426 cmd/dist: correct comment: SysProcAttri -> SysProcAttr
Fixes #46982

Change-Id: I07a18507b7aad828714b187f296fa7268f32b1c4
GitHub-Last-Rev: f498febffd
GitHub-Pull-Request: golang/go#46983
Reviewed-on: https://go-review.googlesource.com/c/go/+/331869
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-02 16:25:10 +00:00
Matthew Dempsky
a18726a648 [dev.typeparams] cmd/compile: incremental typecheck during unified IR
This CL changes unified IR to incrementally typecheck the IR as it's
constructed. This is significant, because it means reader can now use
typecheck.Expr to typecheck sub-expressions when it's needed. This
should be helpful for construction and insertion of dictionaries.

This CL does introduce two quirks outside of unified IR itself,
which simplify preserving binary output:

1. Top-level declarations are sorted after they're constructed, to
avoid worrying about the order that closures are added.

2. Zero-padding autotmp_N variable names. Interleaving typechecking
means autotmp variables are sometimes named differently (since their
naming depends on the number of variables declared so far), and this
ensures that code that sorts variables by names doesn't suddenly sort
autotmp_8/autotmp_9 differently than it would have sorted
autotmp_9/autotmp_10.

While at it, this CL also updated reader to use ir.WithFunc instead of
manually setting and restoring ir.CurFunc. There's now only one
remaining direct use of ir.CurFunc.

Change-Id: I6233b4c059596e471c53166f94750917d710462f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332469
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-02 14:56:37 +00:00
Matthew Dempsky
2aea44204e [dev.typeparams] cmd/compile: enable generics syntax with -lang=go1.18
We already use -lang=go1.18 to control the types2 type checker
behavior. This CL does the same for the parser.

Also, disable an assertion in the unified IR linker that depended on
the -G flag. This assertion was more useful during initial
bootstrapping of that code, but it's less critical now.

With these two changes, "GOEXPERIMENT=unified ./make.bash" is enough
to get a fully functional generics-enabled toolchain. There's no need
to continue specifying custom compiler flags later on.

Change-Id: I7766381926f3bb17eee2e5fcc182a38a39e937e1
Reviewed-on: https://go-review.googlesource.com/c/go/+/332373
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-02 14:55:39 +00:00
Robert Griesemer
30e5f266ed [dev.typeparams] cmd/compile/internal/types2: move (remaining) type decls into their own files (cleanup)
This change moves the type declarations and associated methods for
each of the remaining Type types into their respective files. Except
for import and comment adjustments, and receiver name adjustments for
the Underlying and String methods, no functional changes are made.

Change-Id: I3b9ccab3c85abea4852bacd28c2e47cec05c0bac
Reviewed-on: https://go-review.googlesource.com/c/go/+/332093
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 22:17:50 +00:00
Robert Griesemer
9c1e7d9eff [dev.typeparams] cmd/compile/internal/types2: move Interface type decl into interface.go (cleanup)
Change-Id: Ie1ba50c82afb7409f9495a19b8629c61c6a8d4dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/332092
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 22:17:43 +00:00
Matthew Dempsky
838079beef [dev.typeparams] cmd/internal/dwarf: remove putInlinedFunc's callersym param
This parameter is only used for debugging, and all of putInlinedFunc's
callers were actually passing the callee symbol instead.

Change-Id: I964825a514cc42a1b0bcbce4ef11a1a47084d882
Reviewed-on: https://go-review.googlesource.com/c/go/+/332370
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-07-01 19:29:58 +00:00
Roland Shoemaker
03761ede02 net: don't reject null mx records
Bypass hostname validity checking when a null mx record is returned as,
defined in RFC 7505.

Updates #46979

Change-Id: Ibe683bd6b47333a8ff30909fb2680ec8e10696ef
Reviewed-on: https://go-review.googlesource.com/c/go/+/332094
Trust: Roland Shoemaker <roland@golang.org>
Trust: Katie Hockman <katie@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-07-01 19:09:57 +00:00
Russ Cox
877688c838 testing: add TB.Setenv
For #41260 and #46688.

Change-Id: I6f42742cc3234a90003136ae8798a6b0e1291788
Reviewed-on: https://go-review.googlesource.com/c/go/+/326790
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-07-01 18:35:33 +00:00
Than McIntosh
ef8ae82b37 cmd/compile: fix bug in dwarf-gen var location generation
This patch fixes a bug in the SSA back end's DWARF generation code
that determines variable locations / lifetimes.

The code in question was written to handle sequences of initial
pseudo-ops (zero width instructions such as OpPhi, OpArg, etc) in a
basic block, detecting these ops at the start of a block and then
treating the values specially when emitting ranges for the variables
in those values.  The logic in this code wasn't quite correct, meaning
that a flag variable wasn't being set properly to record the presence
of a block of zero-width value-bearing ops, leading to incorrect or
missing DWARF locations for register params.

Also in this patch is a tweak to some sanity-checking code intended to
catch scheduling problems with OpArg/OpPhi etc. The checks need to
allow for the possibility of an Arg op scheduled after a spill of an
incoming register param inserted by the register allocator. Example:

    b1:
      v13 = ArgIntReg <int> {p1+16} [2] : CX
      v14 = ArgIntReg <int> {p2+16} [5] : R8
      v38 = ArgIntReg <int> {p3+16} [8] : R11
      v35 = ArgIntReg <int> {p1+0} [0] : AX
      v15 = StoreReg <int> v35 : .autotmp_4[int]
      v40  = Arg <int> {p4} [16] : p4+16[int]
      v1 = InitMem <mem>
      v3 = SB <uintptr> : SB
      v18 = CMPQ <flags> v14 v13
      NE v18 → b3 b2 (unlikely) (18)

Here the register allocator has decided to spill v35, meaning that the
OpArg v40 is no longer going to be positioned prior to all other
non-zero-width ops; this is a valid scenario and needs to be handled
properly by the debug code.

Fixes #46425.

Change-Id: I239b3ad56a9c1b8ebf68af42e1f57308293ed7e6
Reviewed-on: https://go-review.googlesource.com/c/go/+/332269
Trust: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-01 17:41:22 +00:00
Dan Scales
9ba294e15b [dev.typeparams] cmd/compile: fix getDictionarySym for methods references, write out sub-dictionaries
For method references (only), selectorExpr() now computes n.Selection,
which is the generic method that is selected. This allows us to compute
as needed the proper sub-dictionary for method reference. Also cleans up
some code for distinguishing method references from references to a
field that has a function value (especially in the presence of embedded
fields).

Change-Id: I9c5b789c15537ff48c70ca7a6444aa0420178a3a
Reviewed-on: https://go-review.googlesource.com/c/go/+/332095
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-07-01 17:35:29 +00:00
Bryan C. Mills
770899f7e1 cmd/go: add a regression test for 'go mod vendor' path traversal
For #46867

Change-Id: I1547ebf7b91e9ddd7b67fd2f20e91391d79fa35d
Reviewed-on: https://go-review.googlesource.com/c/go/+/332250
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2021-07-01 17:10:57 +00:00
Yasuhiro Matsumoto
835d86a17e cmd/go: use path.Dir instead of filepath.Dir for package paths in 'go mod vendor'
copyMetadata walk-up to parent directory until the pkg become modPath.
But pkg should be slash-separated paths. It have to use path.Dir instead of
filepath.Dir.

Fixes #46867

Change-Id: I44cf1429fe52379a7415b94cc30ae3275cc430e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/330149
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-01 17:10:36 +00:00
go101
eb437ba92c cmd/compile: make stack value size threshold comparisons consistent
Consistency is beautiful.

Change-Id: Ib110dcff0ce2fa87b5576c79cd79c83aab385a7c
GitHub-Last-Rev: b8758f8ae0
GitHub-Pull-Request: golang/go#47011
Reviewed-on: https://go-review.googlesource.com/c/go/+/332230
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-07-01 17:07:36 +00:00
Robert Griesemer
0e0b80cb56 [dev.typeparams] cmd/compile/internal/types2: move Signature type decl into signature.go (cleanup)
Change-Id: I68c9da6a87cdc15bde8bffa8cb86fb8705eb1f8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332091
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 16:44:00 +00:00
Robert Griesemer
1aadb18f83 [dev.typeparams] cmd/compile/internal/types2: move Struct type decl into struct.go (cleanup)
Change-Id: I074550236785091d2f79dd5de73c3462614c5c0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332090
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 16:43:44 +00:00
Robert Griesemer
fac21803ce [dev.typeparams] cmd/compile/internal/types2: rename newTypeSet -> computeTypeSet
Follow-up on comment in https://golang.org/cl/329309.

Change-Id: I31f746180237b916c1825fa1688641849478ba41
Reviewed-on: https://go-review.googlesource.com/c/go/+/332089
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 16:43:23 +00:00
Robert Griesemer
1eb756689c [dev.typeparams] cmd/compile/internal/types2: make Interface.obj a *TypeName
We know the exact type, so make it that. This saves some code
and a word of space with each Interface.

Follow-up on a comment in https://golang.org/cl/329309.

Change-Id: I827e39d17aae159a52ac563544c5e6d017bc05ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/332011
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 16:43:07 +00:00
Robert Griesemer
9cb1b0f50b [dev.typeparams] cmd/compile/internal/types2: delay interface check for type bounds
While at it, clean up code for collecting/declaring type parameters.

For #40789.

Change-Id: I0855137d5ee85c0ae2fa60d33b28c24a33132fbc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331690
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 16:42:34 +00:00
Robert Griesemer
1cd505c353 [dev.typeparams] cmd/compile/internal/types2: "comparable" must not be visible before Go 1.18
While at it, clean up the setup of comparable in universe.go.

Fixes #46090

Change-Id: I9655b3e137a03763d677d9a2a730c5570ccff6dc
Reviewed-on: https://go-review.googlesource.com/c/go/+/331517
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-07-01 16:36:06 +00:00
Matthew Dempsky
706c580ee1 [dev.typeparams] cmd/compile: simplify autotmpname
Rather than manually formatting a byte-string and then using a map
lookup to convert it to string, we can just use a slice. This avoids
both the overhead of formatting the byte slice and the map lookup.

Change-Id: Ia7b883632ea990ce9ee848dd4b4e4cdfbd611212
Reviewed-on: https://go-review.googlesource.com/c/go/+/332191
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-01 08:26:25 +00:00
Matthew Dempsky
372b312735 [dev.typeparams] cmd/compile: refactor top-level typechecking in unified IR
This CL is a first step towards incremental typechecking during IR
construction within unified IR. Namely, all top-level declarations are
now typechecked as they're constructed, except for assignments (which
aren't really declarations anyway).

Change-Id: I65763a7659bf2e0f5e89dfe9e709d60e0fa4c631
Reviewed-on: https://go-review.googlesource.com/c/go/+/332097
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2021-07-01 03:34:49 +00:00
fanzha02
9d65578b83 cmd/compile: fix typos in document
Correct "a2Spill" to "a3Spill"

Change-Id: I6ac4c45973dfaeb16d3a90d835589b6af1aefe1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/331850
Trust: fannie zhang <Fannie.Zhang@arm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2021-07-01 01:38:42 +00:00
Matthew Dempsky
ad7e5b219e [dev.typeparams] all: merge master (4711bf3) into dev.typeparams
Conflicts:

- src/cmd/compile/internal/walk/builtin.go

  On dev.typeparams, CL 330194 changed OCHECKNIL to not require manual
  SetTypecheck(1) anymore; while on master, CL 331070 got rid of the
  OCHECKNIL altogether by moving the check into the runtime support
  functions.

- src/internal/buildcfg/exp.go

  On master, CL 331109 refactored the logic for parsing the
  GOEXPERIMENT string, so that it could be more easily reused by
  cmd/go; while on dev.typeparams, several CLs tweaked the regabi
  experiment defaults.

Merge List:

+ 2021-06-30 4711bf30e5 doc/go1.17: linkify "language changes" in the runtime section
+ 2021-06-30 ed56ea73e8 path/filepath: deflake TestEvalSymlinksAboveRoot on darwin
+ 2021-06-30 c080d0323b cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto
+ 2021-06-30 7d0e9e6e74 image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)
+ 2021-06-30 0fa3265fe1 os: change example to avoid deprecated function
+ 2021-06-30 d19a53338f image: add Uniform.RGBA64At and Rectangle.RGBA64At
+ 2021-06-30 c45e800e0c crypto/x509: don't fail on optional auth key id fields
+ 2021-06-29 f9d50953b9 net: fix failure of TestCVE202133195
+ 2021-06-29 e294b8a49e doc/go1.17: fix typo "MacOS" -> "macOS"
+ 2021-06-29 3463852b76 math/big: fix typo of comment (`BytesScanner` to `ByteScanner`)
+ 2021-06-29 fd4b587da3 cmd/compile: suppress details error for invalid variadic argument type
+ 2021-06-29 e2e05af6e1 cmd/internal/obj/arm64: fix an encoding error of CMPW instruction
+ 2021-06-28 4bb0847b08 cmd/compile,runtime: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
+ 2021-06-28 1519271a93 spec: change unsafe.Slice((*T)(nil), 0) to return []T(nil)
+ 2021-06-28 5385e2386b runtime/internal/atomic: drop Cas64 pointer indirection in comments
+ 2021-06-28 956c81bfe6 cmd/go: add GOEXPERIMENT to `go env` output
+ 2021-06-28 a1d27269d6 cmd/go: prep for 'go env' refactoring
+ 2021-06-28 901510ed4e cmd/link/internal/ld: skip the windows ASLR test when CGO_ENABLED=0
+ 2021-06-28 361159c055 cmd/cgo: fix 'see gmp.go' to 'see doc.go'
+ 2021-06-27 c95464f0ea internal/buildcfg: refactor GOEXPERIMENT parsing code somewhat
+ 2021-06-25 ed01ceaf48 runtime/race: use race build tag on syso_test.go
+ 2021-06-25 d1916e5e84 go/types: in TestCheck/issues.src, import regexp/syntax instead of cmd/compile/internal/syntax
+ 2021-06-25 5160896c69 go/types: in TestStdlib, import from source instead of export data
+ 2021-06-25 d01bc571f7 runtime: make ncgocall a global counter

Change-Id: I1ce4a3b3ff7c824c67ad66dd27d9d5f1d25c0023
2021-06-30 18:28:34 -07:00
Bryan C. Mills
4711bf30e5 doc/go1.17: linkify "language changes" in the runtime section
Change-Id: I82bd3954bfc5da59c7952eba2a28ff0e3b41427f
Reviewed-on: https://go-review.googlesource.com/c/go/+/331969
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-30 22:02:09 +00:00
Dan Scales
8767b87ab5 [dev.typeparams] cmd/compile: functions to create GC shape types/names for a concrete type
Created functions to create GC shape type and names, based on a proposal
from Keith. Kept unsigned and signed integer types as different, since
they have different shift operations.

Included adding in alignment fields where padding is
required between fields, even though that seems like it will be fairly
uncommon to use.

Added some extra unusual struct typeparams (for testing the gcshape
names/types) in index.go test.

Change-Id: I8132bbd28098bd933435b8972ac5cc0b39f4c0df
Reviewed-on: https://go-review.googlesource.com/c/go/+/329921
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
2021-06-30 20:51:17 +00:00
Josh Bleecher Snyder
ed56ea73e8 path/filepath: deflake TestEvalSymlinksAboveRoot on darwin
On darwin, under load, it appears that the system occasionally
deletes the temp dir mid-test. Don't fail the test when that happens.

It would be nice to fix this in a deeper way.
See golang.org/cl/332009 for some discussion.

In the meantime, this will at least stop the flakiness.

Updates #37910

Change-Id: I6669e466fed9abda4a87ca88345c04cd7986b41e
Reviewed-on: https://go-review.googlesource.com/c/go/+/332009
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2021-06-30 20:03:34 +00:00
Robert Griesemer
b47cbc2ffe [dev.typeparams] cmd/compile/internal/types2: move newTypeSet function into typeset.go
No functional changes except for import declaration and comment
adjustments.

Change-Id: I75fb5edba8b89a5aad7c9b4ddb427c201265def0
Reviewed-on: https://go-review.googlesource.com/c/go/+/331515
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-30 19:00:23 +00:00
Robert Griesemer
f0206e3df2 [dev.typeparams] cmd/compile/internal/types2: move embedding positions from Checker to Interface
This change moves the position information to the place where it
is actually used. It also simplifies getting rid of it after use.

In the process, fixed a latent bug: Before this CL, embedded types
were sorted, but the corresponding embedding positions were not.
Removed the sorting altogether as it is not needed for type-checking.

Change-Id: I48003f317196d814326424430336b6cb222fdee6
Reviewed-on: https://go-review.googlesource.com/c/go/+/331514
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-30 18:59:58 +00:00
Robert Griesemer
1ff43d1b17 [dev.typeparams] cmd/compile/internal/types2: remove unused *Checker arguments (cleanup)
Simplified names and unnecessary function indirections where possible.

Change-Id: I1c7a386393d086fd7ad29f892e03f048781f3547
Reviewed-on: https://go-review.googlesource.com/c/go/+/331512
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
2021-06-30 18:59:30 +00:00
Robert Griesemer
4b5fdb0b7a [dev.typeparams] cmd/compile/internal/types2: introduce type set abstraction for interfaces
With this change, interfaces are "completed" on-demand, when needed,
and the respective information (set of all methods, type constraints)
is recorded in a new typeSet data structure.

As a consequence, interfaces don't need to be explicitly completed
anymore and (internal) uses of interfaces have become much simpler.

This change also introduces a new field Interface.complete to indicate
that all methods and embedded elements have been set up. This prevent
the computation and recording (!) of a partial type set for erroneous
programs (if we compute the partial type set and store it, subsequent
type set accesses use the wrong type set which may lead to follow-on
errors).

Change-Id: I1ffc907f7d0fb93b3e987fe5ff9c6fa5cae00d7f
Reviewed-on: https://go-review.googlesource.com/c/go/+/329309
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-06-30 18:58:34 +00:00
Ian Lance Taylor
c080d0323b cmd/dist: pass -Wno-unknown-warning-option in swig_callback_lto
For #46557
Fixes #46991

Change-Id: Ic88ebaa13d3edf904657dc19ada4fd4ff7f44a8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/332010
Trust: Ian Lance Taylor <iant@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-06-30 18:03:06 +00:00
uji
7d0e9e6e74 image/gif: fix typo in the comment (io.ReadByte -> io.ByteReader)
Fixes #46967

Change-Id: I66e69c70b74e904623e8ca854562d255692b2143
Reviewed-on: https://go-review.googlesource.com/c/go/+/331649
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
2021-06-30 17:58:50 +00:00
Eli Bendersky
0fa3265fe1 os: change example to avoid deprecated function
The IsNotExist function is deprecated; change package example to avoid
it and use the recommended way instead.

Fixes #46976

Change-Id: I3c301d0a89b6bda42184df314ba8418062ca39ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/331692
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2021-06-30 16:44:19 +00:00
Matthew Dempsky
f503740ccf [dev.typeparams] cmd/compile: add derived-type dictionaries to unified IR
This CL updates the unified IR export data serialization to explicitly
and separately record the derived types used by a declaration. The
readers currently just use this data to construct types/IR the same as
before, but eventually we can use it for emitting GC-shape
dictionaries.

Change-Id: I7d67ad9b3f1fbe69664bf19e056bc94f73507220
Reviewed-on: https://go-review.googlesource.com/c/go/+/331829
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Trust: Matthew Dempsky <mdempsky@google.com>
2021-06-30 04:31:37 +00:00
Nigel Tao
d19a53338f image: add Uniform.RGBA64At and Rectangle.RGBA64At
These types already implemented the Image interface. They should also
implement the RGBA64Image interface (new in Go 1.17)

Updates #44808

Change-Id: I9a2b13e305997088ae874efb95ad9e1648f94812
Reviewed-on: https://go-review.googlesource.com/c/go/+/331570
Trust: Nigel Tao <nigeltao@golang.org>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-06-30 02:00:49 +00:00