Age | Commit message (Collapse) | Author |
|
This CL backports a bunch of changes that landed on dev.typeparams,
but are not dependent on types2 or generics. By backporting, we reduce
the divergence between development branches, hopefully improving test
coverage and reducing risk of merge conflicts.
Updates #43866.
Change-Id: I382510855c9b5fac52b17066e44a00bd07fe86f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/286172
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
|
|
[git-generate]
cd src/cmd/compile/internal/gc
rf '
# Type hash (formatting).
mv typehash TypeHash
mv TypeHash fmt.go
# Method sorting.
mv methcmp MethodsByName
mv MethodsByName MethodsByName.Len MethodsByName.Swap \
MethodsByName.Less sort.go
# Move version check into types.
# A little surprising, but its keyed off the types.Pkg.
ex {
import "cmd/compile/internal/types"
var p *types.Pkg
var major, minor int
langSupported(major, minor, p) -> AllowsGoVersion(p, major, minor)
}
rm langSupported
mv checkLang ParseLangFlag
mv lang langWant AllowsGoVersion ParseLangFlag \
parseLang currentLang goVersionRE goversion.go
mv testdclstack CheckDclstack
mv CheckDclstack scope.go
mv algtype1 AlgType
mv isComplex IsComplex
mv isFloat IsFloat
mv isInt IsInt
mv issimple IsSimple
mv okforcmp IsOrdered
mv floatForComplex FloatForComplex
mv complexForFloat ComplexForFloat
mv isdirectiface IsDirectIface
mv isifacemethod IsInterfaceMethod
mv isMethodApplicable IsMethodApplicable
mv ispaddedfield IsPaddedField
mv isRuntimePkg IsRuntimePkg
mv isReflectPkg IsReflectPkg
mv methtype ReceiverBaseType
mv typesymname TypeSymName
mv typesym TypeSym
mv typeLookup TypeSymLookup
mv IsAlias IsDotAlias
mv isreflexive IsReflexive
mv simtype SimType
# The type1.go here is to avoid an undiagnosed bug in rf
# that does not get the follow-up typechecking right if we
# move directly to type.go during the mv into package types below.
mv \
IsInt IsOrdered IsReflexive \
IsDirectIface IsInterfaceMethod IsMethodApplicable IsPaddedField \
IsRuntimePkg IsReflectPkg ReceiverBaseType \
FloatForComplex ComplexForFloat \
TypeSym TypeSymLookup TypeSymName \
typepkg SimType \
type1.go
# The alg1.go here is because we are only moving part of alg.go.
mv typeHasNoAlg TypeHasNoAlg
mv AlgKind ANOEQ AlgType TypeHasNoAlg IsComparable IncomparableField IsPaddedField alg1.go
mv IsDotAlias pkg.go
mv alg1.go algkind_string.go fmt.go goversion.go pkg.go \
CheckDclstack \ # scope.go
sort.go type1.go \
cmd/compile/internal/types
'
cd ../types
rf '
mv IsDclstackValid isDclstackValid
mv alg1.go alg.go
mv type1.go type.go
'
Change-Id: I8bd53b21c7bdd1770e1b525de32f136833e84c9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/279307
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
Sym.pkgDefPtr is supposed to return a pointer to the types.Object
variable currently holding the Sym's package-scope
definition. However, in the case of identifiers that were shadowed in
the current scope, it was incorrectly returning a pointer to a stack
copy of the dclstack variable, rather than a pointer into the dclstack
itself.
This doesn't affect PkgDef, because it only reads from the variable,
so it got the same result anyway. It also happens to not affect our
usage of SetPkgDef today, because we currently only call SetPkgDef for
the builtin/runtime.go symbols, and those are never shadowed.
However, it does affect my upcoming CL to lazily create the ir.Names
for imported objects, as that depends on the ability to use SetPkgDef
to set shadowed identifiers.
Passes buildall w/ toolstash -cmp.
Change-Id: I54fc48b33da0670d31725faa1df1170a8730750a
Reviewed-on: https://go-review.googlesource.com/c/go/+/277712
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
|
|
Narrow the interface between package ir and package types
to make it easier to clean up the type formatting code all in one place.
Also introduce ir.BlankSym for use by OrigSym, so that later
OrigSym can move to package types without needing to reference
a variable of type ir.Node.
Passes buildall w/ toolstash -cmp.
Change-Id: I39fa419a1c8fb3318203e31cacc8d06399deeff9
Reviewed-on: https://go-review.googlesource.com/c/go/+/275776
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
Passes toolstash/buildall.
[git-generate]
cd src/cmd/compile/internal/ssa
rf '
ex . ../ir ../gc {
import "cmd/compile/internal/types"
var t *types.Type
t.Etype -> t.Kind()
t.Sym -> t.GetSym()
t.Orig -> t.Underlying()
}
'
cd ../types
rf '
mv EType Kind
mv IRNode Object
mv Type.Etype Type.kind
mv Type.Sym Type.sym
mv Type.Orig Type.underlying
mv Type.Cache Type.cache
mv Type.GetSym Type.Sym
mv Bytetype ByteType
mv Runetype RuneType
mv Errortype ErrorType
'
cd ../gc
sed -i 's/Bytetype/ByteType/; s/Runetype/RuneType/' mkbuiltin.go
git codereview gofmt
go install cmd/compile/internal/...
go test cmd/compile -u || go test cmd/compile
Change-Id: Ibecb2d7100d3318a49238eb4a78d70acb49eedca
Reviewed-on: https://go-review.googlesource.com/c/go/+/274437
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
|
|
interface)
The pointer hack was nice and saved a word, but it's untenable
in a world where nodes are themselves interfaces with different
underlying types. Bite the bullet and use an interface to hold the
Node when in types.Sym and types.Type.
This has the nice benefit of removing AsTypesNode entirely.
AsNode is still useful because of its nil handling.
Change-Id: I298cba9ff788b956ee287283bec78010e8b601e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/272933
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
If expanding an inline function body required lazily expanding a
package-scoped type whose identifier was shadowed within the function
body, the lazy expansion would instead overwrite the local symbol
definition instead of the package-scoped symbol. This was due to
importsym using s.Def instead of s.PkgDef.
Unfortunately, this is yet another consequence of the current awkward
scope handling code.
Passes toolstash-check.
Fixes #25984.
Change-Id: Ia7033e1749a883e6e979c854d4b12b0b28083dd8
Reviewed-on: https://go-review.googlesource.com/120456
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
|
|
This CL introduces a new indexed data format for package export
data. This improves on the previous (sequential) binary format by
allowing the compiler to selectively (and lazily) load only the data
that's actually needed for compilation.
In large Go projects, the package export data can become very large
due to transitive type declaration dependencies and inline
function/method bodies. By lazily loading these declarations and
bodies as needed, we avoid wasting time and memory processing
unnecessary and/or redundant data.
In the benchmarks below, "old" is -iexport=false and "new" is
-iexport=true. The suffixes indicate the compiler concurrency (-c) and
inlining (-l) settings used for the build (using -gcflags=all=-foo).
Benchmarks were run on an HP Z620.
Juju is "go build -a github.com/juju/juju/cmd/...":
name old real-time/op new real-time/op delta
Juju/c=1/l=0 44.0s ± 1% 38.7s ± 9% -11.97% (p=0.001 n=7+7)
Juju/c=1/l=4 53.7s ± 3% 45.3s ± 4% -15.53% (p=0.001 n=7+7)
Juju/c=4/l=0 39.7s ± 8% 32.0s ± 4% -19.38% (p=0.001 n=7+7)
Juju/c=4/l=4 46.3s ± 4% 38.0s ± 4% -18.06% (p=0.001 n=7+7)
name old user-time/op new user-time/op delta
Juju/c=1/l=0 371s ± 1% 300s ± 0% -19.07% (p=0.001 n=7+6)
Juju/c=1/l=4 482s ± 0% 374s ± 1% -22.37% (p=0.001 n=7+7)
Juju/c=4/l=0 410s ± 1% 340s ± 1% -17.19% (p=0.001 n=7+7)
Juju/c=4/l=4 532s ± 1% 424s ± 1% -20.26% (p=0.001 n=7+7)
name old sys-time/op new sys-time/op delta
Juju/c=1/l=0 33.4s ± 1% 28.4s ± 2% -15.02% (p=0.001 n=7+7)
Juju/c=1/l=4 40.7s ± 2% 32.8s ± 3% -19.51% (p=0.001 n=7+7)
Juju/c=4/l=0 39.8s ± 2% 34.4s ± 2% -13.74% (p=0.001 n=7+7)
Juju/c=4/l=4 48.4s ± 2% 40.4s ± 2% -16.50% (p=0.001 n=7+7)
Kubelet is "go build -a k8s.io/kubernetes/cmd/kubelet":
name old real-time/op new real-time/op delta
Kubelet/c=1/l=0 42.0s ± 1% 34.8s ± 1% -17.27% (p=0.008 n=5+5)
Kubelet/c=1/l=4 55.4s ± 3% 45.4s ± 3% -18.06% (p=0.002 n=6+6)
Kubelet/c=4/l=0 37.4s ± 3% 29.9s ± 1% -20.25% (p=0.004 n=6+5)
Kubelet/c=4/l=4 48.1s ± 2% 39.0s ± 5% -18.93% (p=0.002 n=6+6)
name old user-time/op new user-time/op delta
Kubelet/c=1/l=0 291s ± 1% 233s ± 1% -19.96% (p=0.002 n=6+6)
Kubelet/c=1/l=4 385s ± 1% 298s ± 1% -22.51% (p=0.002 n=6+6)
Kubelet/c=4/l=0 325s ± 0% 268s ± 1% -17.48% (p=0.004 n=5+6)
Kubelet/c=4/l=4 429s ± 1% 343s ± 1% -20.08% (p=0.002 n=6+6)
name old sys-time/op new sys-time/op delta
Kubelet/c=1/l=0 25.1s ± 2% 20.9s ± 4% -16.69% (p=0.002 n=6+6)
Kubelet/c=1/l=4 31.2s ± 3% 24.4s ± 0% -21.67% (p=0.010 n=6+4)
Kubelet/c=4/l=0 30.2s ± 2% 25.6s ± 1% -15.34% (p=0.002 n=6+6)
Kubelet/c=4/l=4 37.3s ± 1% 30.9s ± 2% -17.11% (p=0.002 n=6+6)
Change-Id: Ie43eb3bbe1392cbb61c86792a17a57b33b9561f0
Reviewed-on: https://go-review.googlesource.com/106796
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
|
|
We used to backup symbol declarations using complete Syms, but this
was unnecessary: very few of Sym's fields were actually needed. Also,
to restore a symbol, we had to re-Lookup the Sym in its Pkg.
By introducing a new dedicated dsym type for this purpose, we can
address both of these deficiencies.
Passes toolstash-check.
Change-Id: I39f3d672b301f84a3a62b9b34b4b2770cb25df79
Reviewed-on: https://go-review.googlesource.com/64811
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
|
|
When restoring syms, we must also restore the original Lastlineno.
Bug introduced with https://golang.org/cl/41390/.
Fixes #20415.
Change-Id: Ie81d36279d717e330951b52f42dcee4b0025b9f0
Reviewed-on: https://go-review.googlesource.com/43811
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
More steps towards simpler symbol handling:
- Pushdcl's incoming pos argument, saved in a newly pushed *Sym, was always
immediately overwritten by the Lastlineno value of the saved *Sym.
- Markdcl's incoming pos argument, saved in the stack mark *Sym, was not
restored when the stack mark was popped.
- Popdcl always maintained the most recent Lastlineno for a *Sym given
by package and name, making it unnecessary to save Lastlineno in the
first place. Removed Lastlineno from the set of fields that need saving,
and simplified Popdcl.
Change-Id: Ie93da1fbd780dcafc2703044e781c0c6298df569
Reviewed-on: https://go-review.googlesource.com/41390
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
The dclstack is now a proper stack and thus we can implement it
using a slice rather than a linked list.
Change-Id: I200e85621ff76c111bdeb7eb382fd82da438f3ba
Reviewed-on: https://go-review.googlesource.com/41135
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
|
|
Follow-up on https://go-review.googlesource.com/#/c/39998/.
Change-Id: I8830eebd7ea7e02b7edda99e67b6d43529401201
Reviewed-on: https://go-review.googlesource.com/40974
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
Change-Id: Ib55f7ea3f7dcd9d02f6027121663870a65cb886c
Reviewed-on: https://go-review.googlesource.com/39924
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|
|
Change-Id: I000bb530e00d0f0bc59e0f1366b5fb586adf4f37
Reviewed-on: https://go-review.googlesource.com/39912
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
|